PluginProbe
CSS & JavaScript Toolbox / 7.1
CSS & JavaScript Toolbox v7.1
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / controllers / auto-upgrade.php

auto-upgrade.php in CSS & JavaScript Toolbox 7.1, at controllers/auto-upgrade.php

63 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 /**
10 *
11 */
12 class CJTAutoUpgradeController extends CJTController {
13
14 /**
15 * put your comment there...
16 *
17 * @var mixed
18 */
19 protected $controllerInfo = array('model' => 'setup');
20
21 /**
22 * put your comment there...
23 *
24 */
25 protected function enableAction() {
26 // Initializing!
27 $model = $this->model;
28 $cjtWebServer = cssJSToolbox::getCJTWebSiteURL();
29 // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
30 // license key!
31 $activeLicenses = $model->getStatedLicenses();
32 // Always REQUEST CJT server even if not key activated yet.
33 // FREE edition will just do normal check @Wordpress:reporioty
34 if (!isset($activeLicenses[CJTSetupModel::EDD_PRODUCT_NAME]) && (CJTPlugin::Edition != 'free')) {
35 $activeLicenses[CJTSetupModel::EDD_PRODUCT_NAME] = array(
36 'plugin' => array('Version' => CJTPlugin::VERSION, 'AuthorName' => 'CTK'),
37 'license' => array('key' => str_repeat('0', 32)),
38 'component' => array('pluginBase' => 'css-javascript-toolbox/css-js-toolbox.php')
39 );
40 }
41 // Import EDD updater Class!
42 cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php');
43 // Activate Automatic upgrade for all activated licenses/components!
44 foreach ($activeLicenses as $name => $state) {
45 // Initializingn vars for a single state/component!
46 $pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase'];
47 // Stop using Cached Data as it causes issue, always
48 // get fresh plugin data.
49 $plugin = get_plugin_data($pluginFile);
50 $license =& $state['license'];
51 // Edd API parameter to be send along with he check!
52 $requestParams= array(
53 'version' => $plugin['Version'],
54 'author' => $plugin['AuthorName'],
55 'license' => $license['key'],
56 'item_name' => $name,
57 );
58 // Set EDD Automatic Updater!
59 $updated = new CJT_EDD_SL_Plugin_Updater($cjtWebServer, $pluginFile, $requestParams);
60 }
61 }
62 } // End class.
63