PluginProbe
CSS & JavaScript Toolbox / 8.0
CSS & JavaScript Toolbox v8.0
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 8.0, at controllers/auto-upgrade.php

64 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 $extensions =& CJTPlugin::getInstance()->extensions();
30 // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
31 // license key!
32 $activeLicenses = $model->getStatedLicenses();
33 // Import EDD updater Class!
34 cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php');
35 // Activate Automatic upgrade for all activated licenses/components!
36 foreach ($activeLicenses as $name => $state) {
37 // Get extension def doc.
38 // Act only if extension has XMl DOC! This might happened i fthe extension
39 // removed while its key still in the database
40 if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) {
41 // Check CJT Server only if updateSrc points to Wordpress Repository
42 $updateSrcServer = (string) $extDef->license->attributes()->updateSrc;
43 if (!$updateSrcServer || ($updateSrcServer == 'CJT')) {
44 // Initializingn vars for a single state/component!
45 $pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase'];
46 // Stop using Cached Data as it causes issue, always
47 // get fresh plugin data.
48 $plugin = get_plugin_data($pluginFile);
49 $license =& $state['license'];
50 // Edd API parameter to be send along with he check!
51 $requestParams= array(
52 'version' => $plugin['Version'],
53 'author' => $plugin['AuthorName'],
54 'license' => $license['key'],
55 'item_name' => $name,
56 );
57 // Set EDD Automatic Updater!
58 $updated = new CJT_EDD_SL_Plugin_Updater($cjtWebServer, $pluginFile, $requestParams);
59 }
60 }
61 }
62 }
63 } // End class.
64