/** * put your comment there... * */ protected function enableAction() { // Initializing! $model = $this->model; $cjtWebServer = cssJSToolbox::getCJTWebSiteURL(); $extensions =& CJTPlugin::getInstance()->extensions(); // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate // license key! $activeLicenses = $model->getStatedLicenses(); // Import EDD updater Class! cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php'); // Activate Automatic upgrade for all activated licenses/components! foreach ($activeLicenses as $name => $state) { // Get extension def doc. // Act only if extension has XMl DOC! This might happened i fthe extension // removed while its key still in the database if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) { // Check CJT Server only if updateSrc points to Wordpress Repository $updateSrcServer = (string) $extDef->license->attributes()->updateSrc; if (!$updateSrcServer || $updateSrcServer == 'CJT') { // Initializingn vars for a single state/component! $pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase']; // Stop using Cached Data as it causes issue, always // get fresh plugin data. $plugin = get_plugin_data($pluginFile); $license =& $state['license']; // Edd API parameter to be send along with he check! $requestParams = array('version' => $plugin['Version'], 'author' => $plugin['AuthorName'], 'license' => $license['key'], 'item_name' => $name); // Set EDD Automatic Updater! $updated = new CJT_EDD_SL_Plugin_Updater($cjtWebServer, $pluginFile, $requestParams); } } } }
/** * put your comment there... * */ protected function enableAction() { // Initializing! $model = $this->model; $cjtWebServer = cssJSToolbox::getCJTWebSiteURL(); $extensions =& CJTPlugin::getInstance()->extensions(); // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate // license key! $activeLicenses = $model->getStatedLicenses(); // Activate Automatic upgrade for all activated licenses/components! foreach ($activeLicenses as $name => $state) { // Get extension def doc. // Act only if extension has XMl DOC! This might happened i fthe extension // removed while its key still in the database if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) { // Check CJT Server only if updateSrc points to Wordpress Repository $updateSrcServer = (string) $extDef->license->attributes()->updateSrc; if (!$updateSrcServer || $updateSrcServer == 'CJT') { // Initializingn vars for a single state/component! $pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase']; $license =& $state['license']; // Set EDD Automatic Updater! try { CJTStoreUpdate::autoUpgrade($name, $license['key'], $pluginFile); } catch (CJTServicesAPICallException $exception) { die('CJT AUTO-UPGRADE EXCAPTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); } } } } }
/** * put your comment there... * * @param mixed $tpl */ public function display($tpl = null) { // Initialize. $model =& $this->model; // Set vars! $this->securityToken = cssJSToolbox::getSecurityToken(); $this->component = $this->getRequestParameter('component'); $this->cjtWebSite = cssJSToolbox::getCJTWebSiteURL(); $this->licenseTypes = $model->getExtensionProductTypes($this->component); $this->license = $model->getStateStruct($this->licenseTypes, 'license'); // Display view. echo $this->getTemplate($tpl); }
/** * put your comment there... * * @param mixed $action * @param mixed $component * @param mixed $license */ public function dispatchEddCall($action, $component, $license) { // Activating License key thorugh EDD APIs! $request['edd_action'] = "{$action}_license"; $request['item_name'] = urlencode($component['name']); $request['license'] = $license['key']; /* CJT Extra Fields For EDD */ //$request['CJTEFFEDD_licenseName'] = $license['name']; // Request the server! $response = wp_remote_get(add_query_arg($request, cssJSToolbox::getCJTWebSiteURL())); // We need only the JSON object returned by EDD APIs. $response = @json_decode(wp_remote_retrieve_body($response), true); // If request error compaitble the response object to be used! if (!$response) { $response = array('license' => 'error', 'component' => $component['name']); } return $response; }
/** * put your comment there... * */ public function __construct() { # Initialize $this->url = cssJSToolbox::getCJTWebSiteURL() . "cjtservices-api"; }