PluginProbe
CSS & JavaScript Toolbox / 6.0.6
CSS & JavaScript Toolbox v6.0.6
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
← All changes | controllers/auto-upgrade.php +23 -26 trunk6.0.6 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 -*
3 +*
4 4 */
5 5
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
@@ -6,51 +6,48 @@
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
8 8
9 9 /**
10 -*
10 +*
11 11 */
12 12 class CJTAutoUpgradeController extends CJTController {
13 -
13 +
14 14 /**
15 15 * put your comment there...
16 - *
16 + *
17 17 * @var mixed
18 18 */
19 19 protected $controllerInfo = array('model' => 'setup');
20 -
20 +
21 21 /**
22 22 * put your comment there...
23 - *
23 + *
24 24 */
25 25 protected function enableAction() {
26 26 // Initializing!
27 27 $model = $this->model;
28 28 $cjtWebServer = cssJSToolbox::getCJTWebSiteURL();
29 - $extensions =& CJTPlugin::getInstance()->extensions();
30 29 // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
31 30 // license key!
32 31 $activeLicenses = $model->getStatedLicenses();
32 + // Import EDD updater Class!
33 + if (!class_exists('EDD_SL_Plugin_Updater')) {
34 + cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php');
35 + }
33 36 // Activate Automatic upgrade for all activated licenses/components!
34 37 foreach ($activeLicenses as $name => $state) {
35 - // Get extension def doc.
36 - // Act only if extension has XMl DOC! This might happened i fthe extension
37 - // removed while its key still in the database
38 - if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) {
39 - // Check CJT Server only if updateSrc points to Wordpress Repository
40 - $updateSrcServer = (string) $extDef->license->attributes()->updateSrc;
41 - if (!$updateSrcServer || ($updateSrcServer == 'CJT')) {
42 - // Initializingn vars for a single state/component!
43 - $pluginFile = WP_PLUGIN_DIR . '/' . $state['component']['pluginBase'];
44 - $license =& $state['license'];
45 - // Set EDD Automatic Updater!
46 - try {
47 - CJTStoreUpdate::autoUpgrade( $name, $license[ 'key' ], $pluginFile );
48 - }
49 - catch ( CJTServicesAPICallException $exception ) {
50 - die( 'CJT AUTO-UPGRADE EXCAPTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' );
51 - }
52 - }
53 - }
38 + // Initializingn vars for a single state/component!
39 + $plugin =& $state['plugin'];
40 + $license =& $state['license'];
41 + $componentPluginPath = ABSPATH . PLUGINDIR . "/{$state['component']['pluginBase']}";
42 + // Edd API parameter to be send along with he check!
43 + $requestParams= array(
44 + 'version' => $plugin['Version'],
45 + 'author' => $plugin['AuthorName'],
46 + 'license' => $license['key'],
47 + 'item_name' => $name,
48 + );
49 + // Set EDD Automatic Updater!
50 + $updated = new EDD_SL_Plugin_Updater($cjtWebServer, $componentPluginPath, $requestParams);
54 51 }
55 52 }
56 53 } // End class.