| 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 |
/** |
| 16 |
* put your comment there... |
| 17 |
* |
| 18 |
* @var mixed |
| 19 |
*/ |
| 20 |
protected $controllerInfo = array('model' => 'setup'); |
| 21 |
|
| 22 |
/** |
| 23 |
* put your comment there... |
| 24 |
* |
| 25 |
*/ |
| 26 |
protected function enableAction() |
| 27 |
{ |
| 28 |
|
| 29 |
$model = $this->model; |
| 30 |
$cjtWebServer = cssJSToolbox::getCJTWebSiteURL(); |
| 31 |
$extensions =& CJTPlugin::getInstance()->extensions(); |
| 32 |
|
| 33 |
// Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate |
| 34 |
// license key! |
| 35 |
$activeLicenses = $model->getStatedLicenses(); |
| 36 |
|
| 37 |
// Activate Automatic upgrade for all activated licenses/components! |
| 38 |
foreach ($activeLicenses as $name => $state) |
| 39 |
{ |
| 40 |
// Get extension def doc. |
| 41 |
// Act only if extension has XMl DOC! This might happened i fthe extension |
| 42 |
// removed while its key still in the database |
| 43 |
if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) |
| 44 |
{ |
| 45 |
// Check CJT Server only if updateSrc points to Wordpress Repository |
| 46 |
$updateSrcServer = (string) $extDef->license->attributes()->updateSrc; |
| 47 |
|
| 48 |
if (!$updateSrcServer || ($updateSrcServer == 'CJT')) |
| 49 |
{ |
| 50 |
// Initializingn vars for a single state/component! |
| 51 |
$pluginFile = ABSPATH . PLUGINDIR . DIRECTORY_SEPARATOR . $state['component']['pluginBase']; |
| 52 |
$license =& $state['license']; |
| 53 |
|
| 54 |
// Set CJT Store Automatic Updater! |
| 55 |
CJTExtensionAutoUpgrade::upgrade($name, $license['key'], $state['attrs'], $pluginFile); |
| 56 |
|
| 57 |
} |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
} // End class. |
| 62 |
|