| @@ -25,29 +25,39 @@ | ||
| 25 | 25 | protected function enableAction() { |
| 26 | 26 | // Initializing! |
| 27 | 27 | $model = $this->model; |
| 28 | 28 | $cjtWebServer = cssJSToolbox::getCJTWebSiteURL(); |
| 29 | + $extensions =& CJTPlugin::getInstance()->extensions(); | |
| 29 | 30 | // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate |
| 30 | 31 | // license key! |
| 31 | 32 | $activeLicenses = $model->getStatedLicenses(); |
| 32 | 33 | // 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 | - } | |
| 34 | + cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php'); | |
| 36 | 35 | // Activate Automatic upgrade for all activated licenses/components! |
| 37 | 36 | foreach ($activeLicenses as $name => $state) { |
| 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); | |
| 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 | + } | |
| 51 | 61 | } |
| 52 | 62 | } |
| 53 | 63 | } // End class. |