PluginProbe
CSS & JavaScript Toolbox / 12
CSS & JavaScript Toolbox v12
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 | css-js-toolbox.php +48 -48 trunk12 View file →
@@ -2,13 +2,12 @@
2 2 /*
3 3 Plugin Name: CSS & JavaScript Toolbox
4 4 Plugin URI: https://css-javascript-toolbox.com/
5 5 Description: Easily add CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them anywhere on your website.
6 -Version: 12.0.7
6 +Version: 12.0
7 7 Author: Wipeout Media
8 +Stable tag: 12.0
8 9 Author URI: https://css-javascript-toolbox.com
9 -Text Domain: css-javascript-toolbox
10 -Domain Path: /locals/languages/
11 10 License:
12 11
13 12 The Software is package as a WordPress¨ plugin. The PHP code associated with the Software is licensed under the GPL version 2.0 license (as found at http://www.gnu.org/licenses/gpl-2.0.txt GNU/GPLv2 or "GPLv2"). You may redistribute, repackage, and modify the PHP code as you see fit and as consistent with GPLv2.
14 13
@@ -85,13 +84,13 @@
85 84 */
86 85 const DB_VERSION = '1.7';
87 86
88 87 /**
89 - * Minimum PHP version required to run the plugin.
88 + * put your comment there...
90 89 *
91 - * @var string
90 + * @var mixed
92 91 */
93 - CONST ENV_PHP_MIN_VERSION = '7.4';
92 + CONST ENV_PHP_MIN_VERSION = '5.3';
94 93
95 94 /**
96 95 *
97 96 */
@@ -99,9 +98,9 @@
99 98
100 99 /**
101 100 *
102 101 */
103 - const VERSION = '12.0.7';
102 + const VERSION = '11';
104 103
105 104 /**
106 105 *
107 106 */
@@ -233,11 +232,10 @@
233 232 return self::$instance;
234 233 }
235 234
236 235 /**
237 - * Check the PHP version and register an admin notice when it is too old.
236 + * put your comment there...
238 237 *
239 - * @return bool TRUE when the environment can run the plugin.
240 238 */
241 239 public static function isCompatibleEnvironment()
242 240 {
243 241
@@ -242,10 +240,13 @@
242 240 {
243 241
244 242 if ( version_compare( PHP_VERSION, self::ENV_PHP_MIN_VERSION, '<' ) )
245 243 {
246 - add_action( 'admin_notices', 'cjtIncompatiblePHPNotice' );
247 244
245 + $importHTMLFileCode = 'require "includes" . DIRECTORY_SEPARATOR . "html" . DIRECTORY_SEPARATOR . "incompatible_environment_message.html.php";';
246 +
247 + add_action( 'admin_notices', create_function( '', $importHTMLFileCode ) );
248 +
248 249 return false;
249 250 }
250 251
251 252 return true;
@@ -352,26 +353,21 @@
352 353 * @return boolean TRUE.
353 354 */
354 355 public function onconnected( $observer, $state )
355 356 {
356 - // Always connect the access point!
357 +
358 + // In all cases that we'll process the request load the localization file.
359 + load_plugin_textdomain( CJTOOLBOX_TEXT_DOMAIN, false, CJTOOLBOX_LANGUAGES );
360 +
361 + do_action( CJTPluggableHelper::ACTION_CJT_TEXT_DOMAIN_LOADED );
362 +
363 + // Always connet the access point!
357 364 return $state;
365 +
358 366 }
359 367
360 368 }// End Class
361 369
362 -/**
363 -* Admin notice shown when the site runs an unsupported PHP version.
364 -*/
365 -function cjtIncompatiblePHPNotice()
366 -{ ?>
367 - <div class="notice notice-error">
368 - <p><strong>CJT</strong>: CSS &amp; JavaScript Toolbox needs PHP version <?php echo esc_html( CJTPlugin::ENV_PHP_MIN_VERSION ); ?> or greater to operate properly. Please ask your hosting provider to update the PHP version.<br>
369 - Current PHP Version: <strong><?php echo esc_html( phpversion() ); ?></strong>
370 - </p>
371 - </div>
372 -<?php }
373 -
374 370 // Dont run if environment (e.g PHP version) is incomaptible
375 371 if ( ! CJTPlugin::isCompatibleEnvironment() )
376 372 {
377 373 return;
@@ -380,38 +376,42 @@
380 376 // Initialize events!
381 377 CJTPlugin::define( 'CJTPlugin', array( 'hookType' => CJTWordpressEvents::HOOK_FILTER ) );
382 378
383 379 // Let's Go!
384 -CJTPlugin::getInstance();
380 +function deprecatedPHPCheck()
381 +{ ?>
382 + <div class="notice notice-error">
383 + <p><strong>CJT</strong>: CSS & JavaScript Toolbox need PHP version 7.3 or greater to operate properly. Please ask your hosting provider to update the PHP version.<br>
384 + Current PHP Version: <strong><?php echo phpversion(); ?></strong>
385 + </p>
386 + </div>
387 +<?php }
385 388
389 +if ( version_compare( phpversion(), 7, '>=' ) ) {
390 + CJTPlugin::getInstance();
391 +} else {
392 + add_action( 'admin_notices', 'deprecatedPHPCheck' );
393 +}
394 +
386 395 add_action( 'upgrader_process_complete', 'upgradeCheck',10, 2 );
387 396
388 397 function upgradeCheck( $upgrader_object, $options ) {
389 - // Bulk plugin updates are the only case we care about. Bail early on
390 - // everything else so we never touch the DB on unrelated upgrades.
391 - if ( ! isset( $options['action'], $options['type'] ) ) {
392 - return;
393 - }
398 + $CJTPluginPath = plugin_basename( __FILE__ );
394 399
395 - if ( $options['action'] !== 'update' || $options['type'] !== 'plugin' ) {
396 - return;
397 - }
400 + global $wpdb;
401 + $table_name = $wpdb->base_prefix.'cjtoolbox_blocks';
402 + $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) );
403 + $preCheck = get_option( '__existing_cjt_user' );
398 404
399 - if ( empty( $options['plugins'] ) || ! is_array( $options['plugins'] ) ) {
400 - return;
401 - }
405 + if ( $options['action'] == 'update' && $options['type'] == 'plugin' ) {
406 + foreach( $options['plugins'] as $each_plugin ) {
407 + if ( $each_plugin == $CJTPluginPath ) {
408 + $preCheck = get_option( '__existing_cjt_user' );
402 409
403 - if ( ! in_array( plugin_basename( __FILE__ ), $options['plugins'], true ) ) {
404 - return;
410 + // Only create it once.
411 + if ( empty( $preCheck ) ) {
412 + update_option( '__existing_cjt_user', $wpdb->get_var( $query ) === $table_name ? 'true' : 'false' );
413 + }
414 + }
415 + }
405 416 }
406 -
407 - // Only ever record this once.
408 - if ( ! empty( get_option( '__existing_cjt_user' ) ) ) {
409 - return;
410 - }
411 -
412 - global $wpdb;
413 - $table_name = $wpdb->base_prefix . 'cjtoolbox_blocks';
414 - $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) );
415 -
416 - update_option( '__existing_cjt_user', $wpdb->get_var( $query ) === $table_name ? 'true' : 'false' );
417 417 }