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