| @@ -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,136 +6,121 @@ | ||
| 6 | 6 | // Disallow direct access. |
| 7 | 7 | defined('ABSPATH') or die("Access denied"); |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | -* | |
| 10 | +* | |
| 11 | 11 | */ |
| 12 | 12 | class CJTExtensions extends CJTHookableClass { |
| 13 | - | |
| 13 | + | |
| 14 | 14 | /** |
| 15 | - * | |
| 15 | + * | |
| 16 | 16 | */ |
| 17 | 17 | const CACHE_OPTION_NAME = 'cjt_extensions'; |
| 18 | - | |
| 18 | + | |
| 19 | 19 | /** |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | */ |
| 22 | 22 | const LOAD_METHOD = 'getInvolved'; |
| 23 | - | |
| 23 | + | |
| 24 | 24 | /** |
| 25 | - * | |
| 25 | + * | |
| 26 | 26 | */ |
| 27 | - const PREFIXS = 'cjte-,css-javascript-toolbox-'; | |
| 28 | - | |
| 27 | + const PREFIX = 'cjte-'; | |
| 28 | + | |
| 29 | 29 | /** |
| 30 | 30 | * put your comment there... |
| 31 | - * | |
| 31 | + * | |
| 32 | 32 | * @var mixed |
| 33 | 33 | */ |
| 34 | - protected $defDocs; | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * put your comment there... | |
| 38 | - * | |
| 39 | - * @var mixed | |
| 40 | - */ | |
| 41 | 34 | protected $extensions; |
| 42 | - | |
| 35 | + | |
| 43 | 36 | /** |
| 44 | 37 | * put your comment there... |
| 45 | - * | |
| 38 | + * | |
| 46 | 39 | * @var mixed |
| 47 | 40 | */ |
| 48 | 41 | protected $file2Classmap; |
| 49 | - | |
| 42 | + | |
| 50 | 43 | /** |
| 51 | 44 | * put your comment there... |
| 52 | - * | |
| 45 | + * | |
| 53 | 46 | * @var mixed |
| 54 | 47 | */ |
| 55 | 48 | protected $incompatibilies; |
| 56 | - | |
| 57 | - /** | |
| 58 | - * put your comment there... | |
| 59 | - * | |
| 60 | - * @var mixed | |
| 61 | - */ | |
| 62 | - protected $incompatibleAddons = array(); | |
| 63 | - | |
| 64 | - | |
| 49 | + | |
| 65 | 50 | /** |
| 66 | 51 | * put your comment there... |
| 67 | - * | |
| 52 | + * | |
| 68 | 53 | * @var mixed |
| 69 | 54 | */ |
| 70 | 55 | protected $loadMethod; |
| 71 | - | |
| 56 | + | |
| 72 | 57 | /** |
| 73 | 58 | * put your comment there... |
| 74 | - * | |
| 59 | + * | |
| 75 | 60 | * @var mixed |
| 76 | 61 | */ |
| 77 | 62 | protected $onautoload = array('parameters' => array('file', 'class')); |
| 78 | - | |
| 63 | + | |
| 79 | 64 | /** |
| 80 | 65 | * put your comment there... |
| 81 | - * | |
| 66 | + * | |
| 82 | 67 | * @var mixed |
| 83 | 68 | */ |
| 84 | 69 | protected $onbindevent = array('parameters' => array('event', 'callback')); |
| 85 | - | |
| 70 | + | |
| 86 | 71 | /** |
| 87 | 72 | * put your comment there... |
| 88 | - * | |
| 73 | + * | |
| 89 | 74 | * @var mixed |
| 90 | 75 | */ |
| 91 | 76 | protected $ondetectextension = array('parameters' => array('extension')); |
| 92 | - | |
| 77 | + | |
| 93 | 78 | /** |
| 94 | 79 | * put your comment there... |
| 95 | - * | |
| 80 | + * | |
| 96 | 81 | * @var mixed |
| 97 | 82 | */ |
| 98 | 83 | protected $ongetactiveplugins = array('parameters' => array('plugins')); |
| 99 | - | |
| 84 | + | |
| 100 | 85 | /** |
| 101 | 86 | * put your comment there... |
| 102 | - * | |
| 87 | + * | |
| 103 | 88 | * @var mixed |
| 104 | 89 | */ |
| 105 | 90 | protected $onload = array('parameters' => array('params')); |
| 106 | - | |
| 91 | + | |
| 107 | 92 | /** |
| 108 | 93 | * put your comment there... |
| 109 | - * | |
| 94 | + * | |
| 110 | 95 | * @var mixed |
| 111 | 96 | */ |
| 112 | 97 | protected $onloadcallback = array('parameters' => array('callback')); |
| 113 | - | |
| 98 | + | |
| 114 | 99 | /** |
| 115 | 100 | * put your comment there... |
| 116 | - * | |
| 101 | + * | |
| 117 | 102 | * @var mixed |
| 118 | 103 | */ |
| 119 | 104 | protected $onloaddefinition = array('parameters' => array('definition')); |
| 120 | - | |
| 105 | + | |
| 121 | 106 | /*** |
| 122 | 107 | * put your comment there... |
| 123 | - * | |
| 108 | + * | |
| 124 | 109 | * @var mixed |
| 125 | 110 | */ |
| 126 | 111 | protected $ontregisterautoload = array('parameters' => array('callback')); |
| 127 | - | |
| 112 | + | |
| 128 | 113 | /** |
| 129 | 114 | * put your comment there... |
| 130 | - * | |
| 115 | + * | |
| 131 | 116 | * @var mixed |
| 132 | 117 | */ |
| 133 | 118 | protected $onreloadcacheparameters = array('parameters' => array('params')); |
| 134 | - | |
| 119 | + | |
| 135 | 120 | /** |
| 136 | 121 | * put your comment there... |
| 137 | - * | |
| 122 | + * | |
| 138 | 123 | * @var mixed |
| 139 | 124 | */ |
| 140 | 125 | protected $onloaded = array( |
| 141 | 126 | 'hookType' => CJTWordpressEvents::HOOK_ACTION, |
| @@ -140,23 +125,22 @@ | ||
| 140 | 125 | protected $onloaded = array( |
| 141 | 126 | 'hookType' => CJTWordpressEvents::HOOK_ACTION, |
| 142 | 127 | 'parameters' => array('class', 'extension', 'definition', 'result') |
| 143 | 128 | ); |
| 144 | - | |
| 129 | + | |
| 145 | 130 | /** |
| 146 | 131 | * put your comment there... |
| 147 | - * | |
| 132 | + * | |
| 148 | 133 | * @var mixed |
| 149 | 134 | */ |
| 150 | 135 | protected $prefix; |
| 151 | - | |
| 136 | + | |
| 152 | 137 | /** |
| 153 | 138 | * put your comment there... |
| 154 | - * | |
| 139 | + * | |
| 155 | 140 | * @param mixed $className |
| 156 | 141 | */ |
| 157 | - public function _autoload($className) { | |
| 158 | - | |
| 142 | + public function __autoload($className) { | |
| 159 | 143 | // Load only classed defined on the list! |
| 160 | 144 | if (isset($this->extensions[$className])) { |
| 161 | 145 | $classFile = $this->onautoload($this->extensions[$className]['runtime']['classFile'], $className); |
| 162 | 146 | // Import class file! |
| @@ -162,61 +146,35 @@ | ||
| 162 | 146 | // Import class file! |
| 163 | 147 | require_once $classFile; |
| 164 | 148 | } |
| 165 | 149 | } |
| 166 | - | |
| 150 | + | |
| 167 | 151 | /** |
| 168 | 152 | * put your comment there... |
| 169 | - * | |
| 153 | + * | |
| 170 | 154 | * @param mixed $prefix |
| 171 | 155 | * @param mixed $loadMethod |
| 172 | 156 | * @return CJTExtensions |
| 173 | 157 | */ |
| 174 | - public function __construct($prefix = self::PREFIXS, $loadMethod = self::LOAD_METHOD) { | |
| 158 | + public function __construct($prefix = self::PREFIX, $loadMethod = self::LOAD_METHOD) { | |
| 175 | 159 | // Hookable! |
| 176 | 160 | parent::__construct(); |
| 177 | - | |
| 178 | - // Initialize incomapiblt addons meta data | |
| 179 | - $this->incompatibleAddons = array( | |
| 180 | - | |
| 181 | - 'css-javascript-toolbox-plus' => array( | |
| 182 | - '9.4', | |
| 183 | - '<', | |
| 184 | - 'Aborted', | |
| 185 | - | |
| 186 | - function() { | |
| 187 | - | |
| 188 | - ob_start(); | |
| 189 | - | |
| 190 | - require CJTOOLBOX_PATH . DIRECTORY_SEPARATOR . 'includes' . | |
| 191 | - DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . | |
| 192 | - 'incompatible_cjtplus_version.html.php'; | |
| 193 | - | |
| 194 | - $content = ob_get_clean(); | |
| 195 | - | |
| 196 | - return $content; | |
| 197 | - } | |
| 198 | - | |
| 199 | - ), | |
| 200 | - | |
| 201 | - ); | |
| 202 | - | |
| 203 | 161 | // Initializing! |
| 204 | - $this->prefix = explode( ',', $prefix ); | |
| 162 | + $this->prefix = $prefix; | |
| 205 | 163 | $this->loadMethod = $loadMethod; |
| 206 | 164 | } |
| 207 | - | |
| 165 | + | |
| 208 | 166 | /** |
| 209 | 167 | * put your comment there... |
| 210 | - * | |
| 168 | + * | |
| 211 | 169 | */ |
| 212 | 170 | public function __destruct() { |
| 213 | - spl_autoload_unregister(array($this, '_autoload')); | |
| 171 | + spl_autoload_unregister(array($this, '__autoload')); | |
| 214 | 172 | } |
| 215 | - | |
| 173 | + | |
| 216 | 174 | /** |
| 217 | 175 | * put your comment there... |
| 218 | - * | |
| 176 | + * | |
| 219 | 177 | * @param mixed $reload |
| 220 | 178 | * @return CJTExtensions |
| 221 | 179 | */ |
| 222 | 180 | public function & getExtensions($reload = false) { |
| @@ -225,34 +183,27 @@ | ||
| 225 | 183 | if ($reload || (!($extensions = $this->extensions) && !($extensions = get_option(self::CACHE_OPTION_NAME, array())))) { |
| 226 | 184 | //Resting! |
| 227 | 185 | $this->file2Classmap = array(); |
| 228 | 186 | $extensions = array(); |
| 229 | - # Get all active plugins | |
| 230 | - $activePlugins = wp_get_active_and_valid_plugins(); | |
| 231 | - # Get Network plugins | |
| 232 | - if (is_multisite()) { | |
| 233 | - $activePlugins = array_merge(wp_get_active_network_plugins(), $activePlugins); | |
| 234 | - } | |
| 187 | + $edition = CJTPlugin::Edition; | |
| 235 | 188 | // filter all installed Plugins to fetch all out Extensions! |
| 236 | - $activePlugins = $this->ongetactiveplugins($activePlugins); | |
| 189 | + $activePlugins = $this->ongetactiveplugins(wp_get_active_and_valid_plugins()); | |
| 237 | 190 | foreach ($activePlugins as $file) { |
| 238 | 191 | $pluginDir = dirname($file); |
| 239 | 192 | $pluginName = basename($pluginDir); |
| 240 | 193 | // Any plugin with our prefix is a CJT extension! |
| 241 | - if ( ( strpos( $pluginName, $this->prefix[0] ) === 0 ) || | |
| 242 | - ( strpos( $pluginName, $this->prefix[1] ) === 0 ) ) { | |
| 194 | + if (strpos($pluginName, $this->prefix) === 0) { | |
| 243 | 195 | // CJT Extsnsion must has the definition XML file! |
| 244 | 196 | // First try for Edition-Specific file |
| 245 | 197 | // if not exists try the generic one. |
| 246 | - $xmlFile = "{$pluginDir}/{$pluginName}.xml"; | |
| 247 | - if (file_exists($xmlFile)) { | |
| 198 | + $xmlFile = "{$pluginDir}/{$pluginName}-{$edition}.xml"; | |
| 199 | + if (file_exists($xmlFile) || file_exists($xmlFile = "{$pluginDir}/{$pluginName}.xml")) { | |
| 248 | 200 | // Get Plugin primary data! |
| 249 | 201 | $extension = array(); |
| 250 | 202 | $extension['pluginFile'] = $file; |
| 251 | 203 | $extension['file'] = basename($file); |
| 252 | - $extension['defFile'] = basename($pluginDir) . DIRECTORY_SEPARATOR . basename($xmlFile); | |
| 253 | 204 | // Its useful to use ABS path only at runtime as it might changed as host might get moved. |
| 254 | - $extension['dir'] = basename($pluginDir); | |
| 205 | + $extension['dir'] = str_replace((ABSPATH . PLUGINDIR . '/'), '', $pluginDir) ; | |
| 255 | 206 | $extension['name'] = $pluginName; |
| 256 | 207 | // Cache XML file. |
| 257 | 208 | $extension['definition']['raw'] = file_get_contents($xmlFile); |
| 258 | 209 | // Filer! |
| @@ -259,9 +210,8 @@ | ||
| 259 | 210 | $extension = $this->ondetectextension($extension); |
| 260 | 211 | // Read Basic XML Definition! |
| 261 | 212 | $definitionXML = $this->onloaddefinition(new SimpleXMLElement($extension['definition']['raw'])); |
| 262 | 213 | $attrs = $definitionXML->attributes(); |
| 263 | - $extension['defDoc'] = $definitionXML; | |
| 264 | 214 | $extension['definition']['primary']['loadMethod'] = (string) $attrs->loadMethod; |
| 265 | 215 | $extension['definition']['primary']['requiredLicense'] = (string) $definitionXML->license; |
| 266 | 216 | $className = ((string) $attrs->class); |
| 267 | 217 | // Add to list! |
| @@ -267,83 +217,41 @@ | ||
| 267 | 217 | // Add to list! |
| 268 | 218 | $extensions[$className] = $extension; |
| 269 | 219 | // Map Plugin FILE-2-CLASS name! |
| 270 | 220 | $this->file2Classmap["{$extension['dir']}/{$extension['file']}"] = $className; |
| 221 | + $definitionXML = null; | |
| 271 | 222 | } |
| 272 | 223 | } |
| 273 | 224 | } |
| 225 | + // Update the cache Cache! | |
| 226 | + // ----update_option(self::CACHE_OPTION_NAME, $extensions); | |
| 274 | 227 | } |
| 275 | 228 | $this->extensions = $this->onload($extensions); |
| 276 | 229 | // Chaining |
| 277 | 230 | return $this->extensions; |
| 278 | 231 | } |
| 279 | - | |
| 232 | + | |
| 280 | 233 | /** |
| 281 | 234 | * put your comment there... |
| 282 | - * | |
| 235 | + * | |
| 283 | 236 | */ |
| 284 | 237 | public function load() { |
| 285 | - | |
| 286 | 238 | // Initialize. |
| 287 | 239 | $frameworkVersion = new CJT_Framework_Version_Version(CJTPlugin::FW_Version); |
| 288 | - | |
| 289 | 240 | // Auto load CJT extensions files when requested. |
| 290 | - spl_autoload_register($this->ontregisterautoload(array($this, '_autoload'))); | |
| 291 | - | |
| 241 | + spl_autoload_register($this->ontregisterautoload(array($this, '__autoload'))); | |
| 292 | 242 | // Load all CJT extensions! |
| 293 | 243 | foreach ($this->getExtensions() as $class => $extension) { |
| 294 | - // Filters! | |
| 295 | 244 | extract($this->onload($extension, compact('class', 'extension'))); |
| 296 | - // Build Extension plugin path | |
| 245 | + // Initialize common vars! | |
| 246 | + $callback = $this->onloadcallback(array($class, $this->loadMethod)); | |
| 297 | 247 | $pluginPath = ABSPATH . PLUGINDIR . "/{$extension['name']}"; |
| 298 | 248 | // Set runtime variables. |
| 299 | 249 | $this->extensions[$class]['runtime']['classFile'] = "{$pluginPath}/{$extension['name']}.class.php"; |
| 300 | - // Load definition. | |
| 301 | - $definitionXML = $extension['defDoc']; | |
| 302 | - // Extensions below version 1.0 use static classes | |
| 303 | - // while version 1.0 and up use objects | |
| 304 | - if (((string) $definitionXML->attributes()->version) == '1.0') { | |
| 305 | - // Instantiate extension object | |
| 306 | - $extensionObject = new $class($extension); | |
| 307 | - // Hold extension object | |
| 308 | - $extension['exObject'] = $extensionObject; | |
| 309 | - // Obejct callback | |
| 310 | - $callback = array($extensionObject, $this->loadMethod); | |
| 311 | - } | |
| 312 | - else { | |
| 313 | - # Static callback | |
| 314 | - $callback = array($class, $this->loadMethod); | |
| 315 | - } | |
| 316 | - // Callback filter | |
| 317 | - $callback = $this->onloadcallback($callback); | |
| 318 | 250 | // If auto load is speicifd then import class file and bind events. |
| 319 | 251 | if ($extension['definition']['primary']['loadMethod'] == 'auto') { |
| 320 | - | |
| 321 | - // Don't load Incompatible extensions/addons | |
| 322 | - if (isset($this->incompatibleAddons[$extension['name']])) { | |
| 323 | - | |
| 324 | - require_once ABSPATH . DIRECTORY_SEPARATOR . 'wp-admin' . | |
| 325 | - DIRECTORY_SEPARATOR . 'includes' . | |
| 326 | - DIRECTORY_SEPARATOR . 'plugin.php'; | |
| 327 | - | |
| 328 | - $incomapatibleAddon = $this->incompatibleAddons[$extension['name']]; | |
| 329 | - $addonVersion = get_plugin_data($extension['pluginFile'], false, false)['Version']; | |
| 330 | - $currentVersion = get_plugin_data( CJTOOLBOX_PLUGIN_FILE )['Version']; | |
| 331 | - | |
| 332 | - if (version_compare($addonVersion, | |
| 333 | - $currentVersion, | |
| 334 | - $incomapatibleAddon[1])) { | |
| 335 | - | |
| 336 | - $extension['incompatibleMessage']['flag'] = $incomapatibleAddon[2]; | |
| 337 | - $extension['incompatibleMessage']['msg'] = $incomapatibleAddon[3]; | |
| 338 | - | |
| 339 | - $this->incompatibilies[$pluginPath] = $extension; | |
| 340 | - | |
| 341 | - continue; | |
| 342 | - } | |
| 343 | - | |
| 344 | - } | |
| 345 | - | |
| 252 | + // Load definition. | |
| 253 | + $definitionXML = new SimpleXMLElement($extension['definition']['raw']); | |
| 346 | 254 | // If frameworkVersion is not provided assume its 0 (Older version) |
| 347 | 255 | // before frameworkversion chech even supported. |
| 348 | 256 | // otherwise compare it with current frameworkversion |
| 349 | 257 | // If the version MAJOR is different current |
| @@ -348,23 +256,13 @@ | ||
| 348 | 256 | // otherwise compare it with current frameworkversion |
| 349 | 257 | // If the version MAJOR is different current |
| 350 | 258 | // then its incompatible. |
| 351 | 259 | $extensionVer = new CJT_Framework_Version_Version((int) ((string) $definitionXML->attributes()->requireFrameworkVersion)); |
| 352 | - if ($frameworkVersion->getMajor() < $extensionVer->getMajor()) { | |
| 353 | - // Detects which requird updates CJT or the Extension itself. | |
| 354 | - $extension['incompatibleMessage']['msg'] = cssJSToolbox::getText('Extension is required CJT Framework Version higher than currently installed, CJT need to get updated!!!'); | |
| 355 | - $extension['incompatibleMessage']['flag'] = cssJSToolbox::getText('Aborted'); | |
| 260 | + if ($frameworkVersion->getMajor() != $extensionVer->getMajor()) { | |
| 356 | 261 | // Add to incomaptibility list. |
| 357 | 262 | $this->incompatibilies[$pluginPath] = $extension; |
| 358 | 263 | } |
| 359 | 264 | else { |
| 360 | - # Detect extensions required old Framework | |
| 361 | - if ($frameworkVersion->getMajor() > $extensionVer->getMajor()) { | |
| 362 | - $extension['incompatibleMessage']['msg'] = cssJSToolbox::getText('Extension is required old CJT Framework Version than the installed. This extension might need to get update. Please check if this extension is currently behaving correctly!!!'); | |
| 363 | - $extension['incompatibleMessage']['flag'] = cssJSToolbox::getText('Ignored'); | |
| 364 | - // Add to incomaptibility list. | |
| 365 | - $this->incompatibilies[$pluginPath] = $extension; | |
| 366 | - } | |
| 367 | 265 | // Bind events for compatible extensions. |
| 368 | 266 | foreach ($definitionXML->getInvolved->event as $event) { |
| 369 | 267 | // filter! |
| 370 | 268 | extract($this->onbindevent(compact('event', 'callback'))); |
| @@ -372,9 +270,9 @@ | ||
| 372 | 270 | CJTPlugin::on((string) $event->attributes()->type, $callback); |
| 373 | 271 | } |
| 374 | 272 | } |
| 375 | 273 | } |
| 376 | - else { // If manual load specified just | |
| 274 | + else { // If manual load specified just | |
| 377 | 275 | if (class_exists($class)) { // Make sure the class is loaded! |
| 378 | 276 | $this->onloaded($class, $extension, $definitionXML, call_user_func($callback)); |
| 379 | 277 | } |
| 380 | 278 | } |
| @@ -383,57 +281,35 @@ | ||
| 383 | 281 | // Hook for processing incomaptible extensions. |
| 384 | 282 | add_action('admin_notices', array(& $this, 'processIncompatibles')); |
| 385 | 283 | } |
| 386 | 284 | } |
| 387 | - | |
| 285 | + | |
| 388 | 286 | /** |
| 389 | 287 | * put your comment there... |
| 390 | - * | |
| 391 | - * @param mixed $pluginName | |
| 288 | + * | |
| 392 | 289 | */ |
| 393 | - public function & getDefDoc($pluginName) { | |
| 394 | - # Find if cached or create it | |
| 395 | - if (!isset($this->defDocs[$pluginName])) { | |
| 396 | - // Add CJT Def doc to def docs list | |
| 397 | - $pluginXMLFile = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR . "{$pluginName}.xml"; | |
| 398 | - // Extension might removed while its license key still in the database | |
| 399 | - // Make sure the extension still exists | |
| 400 | - if (file_exists($pluginXMLFile)) { | |
| 401 | - $this->defDocs[$pluginName] = new SimpleXMLElement(file_get_contents($pluginXMLFile)); | |
| 402 | - } | |
| 403 | - else { | |
| 404 | - # Return null when extension is absent! | |
| 405 | - $this->defDocs[$pluginName] = null; | |
| 406 | - } | |
| 407 | - } | |
| 408 | - return $this->defDocs[$pluginName]; | |
| 409 | - } | |
| 410 | - | |
| 411 | - /** | |
| 412 | - * put your comment there... | |
| 413 | - * | |
| 414 | - */ | |
| 415 | 290 | public function & getFiles2ClassesMap() { |
| 416 | - return $this->file2Classmap; | |
| 291 | + return $this->file2Classmap; | |
| 417 | 292 | } |
| 418 | - | |
| 293 | + | |
| 419 | 294 | /** |
| 420 | 295 | * put your comment there... |
| 421 | - * | |
| 296 | + * | |
| 422 | 297 | * @TODO: REMOVE HTML-MARKUP. CJT PLUGIN NEVER WRITE MARKUP IMIXED WITH HTML. ITS VERY BAD PROGRAMMING PRACTICE. THIS WILL BE REMOVED NEXT TIME AS WE IN RUSH!!! |
| 423 | 298 | */ |
| 424 | 299 | public function processIncompatibles() { |
| 425 | - global $current_screen; | |
| 426 | - | |
| 427 | 300 | // Proces only if in CJT page. |
| 428 | - if (!preg_match('/\/plugins\.php|page\=cjtoolbox/', $_SERVER['REQUEST_URI'])) { | |
| 301 | + if (!isset($_GET['page']) || ($_GET['page'] != 'cjtoolbox')) { | |
| 429 | 302 | return; |
| 430 | 303 | } |
| 431 | 304 | // INitialize. |
| 432 | - $message = cssJSToolbox::getText('CJT detects incompatible installed extensions, listed below with status message for every extension:'); | |
| 305 | + $message = cssJSToolbox::getText('CJT detects incompatible installed extensions and must be updated. Extensions are listed below. | |
| 306 | + Please upgrade those extensions from Wordpress Plugins or update page. | |
| 307 | + Those extensions are now stopped until the upgrade is done. | |
| 308 | + If you\'ve any problem upgrading them please visit CJT website by clicking extension links below.'); | |
| 433 | 309 | $list = ''; |
| 434 | 310 | // For every compatible extension add |
| 435 | - // an list item with details | |
| 311 | + // an list item with details | |
| 436 | 312 | // if there is an update available or provide |
| 437 | 313 | // a direct link to CJT website if no upgrade is available. |
| 438 | 314 | // Upgrade wont be available in case no license key is activated! |
| 439 | 315 | foreach ($this->incompatibilies as $class => $extension) { |
| @@ -439,24 +315,16 @@ | ||
| 439 | 315 | foreach ($this->incompatibilies as $class => $extension) { |
| 440 | 316 | // Show details. |
| 441 | 317 | $pluginInfo = get_plugin_data($extension['pluginFile']); |
| 442 | 318 | // List item Markup |
| 443 | - $list .= is_callable($extension['incompatibleMessage']['msg']) ? | |
| 444 | - "<li style='list-style-type:none'>{$extension['incompatibleMessage']['msg']()}</li>" : | |
| 445 | - "<li><a target='_blank' href='{$pluginInfo['PluginURI']}'>{$pluginInfo['Name']}</a> (Status: {$extension['incompatibleMessage']['flag']}, Message: {$extension['incompatibleMessage']['msg']})</li>\n"; | |
| 319 | + $list .= "<li><a target='_blank' href='{$pluginInfo['PluginURI']}'>{$pluginInfo['Name']}</a></li>\n"; | |
| 446 | 320 | } |
| 447 | - | |
| 448 | - $noticeClasses = 'cjt-incomaptible-extensions-notice notice notice-error'; | |
| 449 | - | |
| 450 | - if ( $current_screen->id !== 'toplevel_page_cjtoolbox' ) { | |
| 451 | - $noticeClasses .= ' is-dismissible'; | |
| 452 | - } | |
| 453 | - | |
| 454 | 321 | // Output full message. |
| 455 | 322 | // TODO: BAD PRACTICE1!!!!! NEVER MIX HTML WITH PHP, JUST TEMPORARY1!!! |
| 456 | - echo "<div class='$noticeClasses' style='font-size:14px;font-weight:bold;margin-top: 20px;'> | |
| 457 | - <ul style='list-style-type: circle;font-size: 12px;'>{$list}</ul> | |
| 458 | - </div>"; | |
| 323 | + echo "<div class='cjt-incomaptible-extensions-notice updated' style='font-size:14px;font-weight:bold;padding-top:11px'> | |
| 324 | + <span>{$message}</span> | |
| 325 | + <ul style='list-style-type: circle;padding-left: 27px;font-size: 12px;'>{$list}</ul> | |
| 326 | + </div>"; | |
| 459 | 327 | } |
| 460 | 328 | |
| 461 | 329 | } // End class. |
| 462 | 330 | |