| @@ -53,16 +53,8 @@ | ||
| 53 | 53 | * @var mixed |
| 54 | 54 | */ |
| 55 | 55 | protected $incompatibilies; |
| 56 | 56 | |
| 57 | - /** | |
| 58 | - * put your comment there... | |
| 59 | - * | |
| 60 | - * @var mixed | |
| 61 | - */ | |
| 62 | - protected $incompatibleAddons = array(); | |
| 63 | - | |
| 64 | - | |
| 65 | 57 | /** |
| 66 | 58 | * put your comment there... |
| 67 | 59 | * |
| 68 | 60 | * @var mixed |
| @@ -154,9 +146,8 @@ | ||
| 154 | 146 | * |
| 155 | 147 | * @param mixed $className |
| 156 | 148 | */ |
| 157 | 149 | public function _autoload($className) { |
| 158 | - | |
| 159 | 150 | // Load only classed defined on the list! |
| 160 | 151 | if (isset($this->extensions[$className])) { |
| 161 | 152 | $classFile = $this->onautoload($this->extensions[$className]['runtime']['classFile'], $className); |
| 162 | 153 | // Import class file! |
| @@ -173,34 +164,8 @@ | ||
| 173 | 164 | */ |
| 174 | 165 | public function __construct($prefix = self::PREFIXS, $loadMethod = self::LOAD_METHOD) { |
| 175 | 166 | // Hookable! |
| 176 | 167 | 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 | 168 | // Initializing! |
| 204 | 169 | $this->prefix = explode( ',', $prefix ); |
| 205 | 170 | $this->loadMethod = $loadMethod; |
| 206 | 171 | } |
| @@ -281,15 +246,12 @@ | ||
| 281 | 246 | * put your comment there... |
| 282 | 247 | * |
| 283 | 248 | */ |
| 284 | 249 | public function load() { |
| 285 | - | |
| 286 | 250 | // Initialize. |
| 287 | 251 | $frameworkVersion = new CJT_Framework_Version_Version(CJTPlugin::FW_Version); |
| 288 | - | |
| 289 | 252 | // Auto load CJT extensions files when requested. |
| 290 | 253 | spl_autoload_register($this->ontregisterautoload(array($this, '_autoload'))); |
| 291 | - | |
| 292 | 254 | // Load all CJT extensions! |
| 293 | 255 | foreach ($this->getExtensions() as $class => $extension) { |
| 294 | 256 | // Filters! |
| 295 | 257 | extract($this->onload($extension, compact('class', 'extension'))); |
| @@ -316,34 +278,8 @@ | ||
| 316 | 278 | // Callback filter |
| 317 | 279 | $callback = $this->onloadcallback($callback); |
| 318 | 280 | // If auto load is speicifd then import class file and bind events. |
| 319 | 281 | 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 | - | |
| 346 | 282 | // If frameworkVersion is not provided assume its 0 (Older version) |
| 347 | 283 | // before frameworkversion chech even supported. |
| 348 | 284 | // otherwise compare it with current frameworkversion |
| 349 | 285 | // If the version MAJOR is different current |
| @@ -421,10 +357,8 @@ | ||
| 421 | 357 | * |
| 422 | 358 | * @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 | 359 | */ |
| 424 | 360 | public function processIncompatibles() { |
| 425 | - global $current_screen; | |
| 426 | - | |
| 427 | 361 | // Proces only if in CJT page. |
| 428 | 362 | if (!preg_match('/\/plugins\.php|page\=cjtoolbox/', $_SERVER['REQUEST_URI'])) { |
| 429 | 363 | return; |
| 430 | 364 | } |
| @@ -439,24 +373,16 @@ | ||
| 439 | 373 | foreach ($this->incompatibilies as $class => $extension) { |
| 440 | 374 | // Show details. |
| 441 | 375 | $pluginInfo = get_plugin_data($extension['pluginFile']); |
| 442 | 376 | // 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"; | |
| 377 | + $list .= "<li><a target='_blank' href='{$pluginInfo['PluginURI']}'>{$pluginInfo['Name']}</a> (Status: {$extension['incompatibleMessage']['flag']}, Message: {$extension['incompatibleMessage']['msg']})</li>\n"; | |
| 446 | 378 | } |
| 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 | 379 | // Output full message. |
| 455 | 380 | // 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>"; | |
| 381 | + echo "<div class='cjt-incomaptible-extensions-notice updated' style='font-size:14px;font-weight:bold;padding-top:11px'> | |
| 382 | + <span>{$message}</span> | |
| 383 | + <ul style='list-style-type: circle;padding-left: 27px;font-size: 12px;'>{$list}</ul> | |
| 384 | + </div>"; | |
| 459 | 385 | } |
| 460 | 386 | |
| 461 | 387 | } // End class. |
| 462 | 388 | |