| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/stirizo/wp-content/plugins/widgetkit-pro/inc/ |
Upload File : |
<?php
class WKFE_PRO_Update_Notification{
private static $instance = null;
private $api_url = 'https://widgetkit.themesgrove.com/wp-json/wk/changelog';
public static function init(){
if(null === self::$instance ){
self::$instance = new self;
}
return self::$instance;
}
public function __construct(){
add_filter ('pre_set_site_transient_update_plugins', [$this, 'wkpro_update_notification'] );
}
/**
* update notification
*/
public function wkpro_update_notification ($transient)
{
$latest_version = $this->wkpro_get_latest_version_number();
$latest_version = $latest_version['plugin_version'];
$current_version = WKP_VERSION;
if($latest_version > $current_version ){
$obj = new stdClass();
$obj->slug = 'widgetkit-pro';
$obj->new_version = $latest_version;
$obj->url = 'https://themesgrove.com';
$obj->package = 'https://themesgrove.com/account/';
$transient->response['widgetkit-pro/widgetkit-pro.php'] = $obj;
return $transient;
}else{
return $transient;
}
}
public function wkpro_get_latest_version_number(){
$remote_api_data = wp_remote_get($this->api_url);
$response_data = wp_remote_retrieve_body($remote_api_data);
$data_arr = json_decode($response_data, true);
$changes_data = $data_arr['changes'][0];
return $changes_data;
}
}
?>