| @@ -2,13 +2,11 @@ | ||
| 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: 11.2 | |
| 7 | 7 | Author: Wipeout Media |
| 8 | 8 | Author URI: https://css-javascript-toolbox.com |
| 9 | -Text Domain: css-javascript-toolbox | |
| 10 | -Domain Path: /locals/languages/ | |
| 11 | 9 | License: |
| 12 | 10 | |
| 13 | 11 | 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 | 12 | |
| @@ -85,13 +83,13 @@ | ||
| 85 | 83 | */ |
| 86 | 84 | const DB_VERSION = '1.7'; |
| 87 | 85 | |
| 88 | 86 | /** |
| 89 | - * Minimum PHP version required to run the plugin. | |
| 87 | + * put your comment there... | |
| 90 | 88 | * |
| 91 | - * @var string | |
| 89 | + * @var mixed | |
| 92 | 90 | */ |
| 93 | - CONST ENV_PHP_MIN_VERSION = '7.4'; | |
| 91 | + CONST ENV_PHP_MIN_VERSION = '5.3'; | |
| 94 | 92 | |
| 95 | 93 | /** |
| 96 | 94 | * |
| 97 | 95 | */ |
| @@ -99,9 +97,9 @@ | ||
| 99 | 97 | |
| 100 | 98 | /** |
| 101 | 99 | * |
| 102 | 100 | */ |
| 103 | - const VERSION = '12.0.7'; | |
| 101 | + const VERSION = '11'; | |
| 104 | 102 | |
| 105 | 103 | /** |
| 106 | 104 | * |
| 107 | 105 | */ |
| @@ -233,11 +231,10 @@ | ||
| 233 | 231 | return self::$instance; |
| 234 | 232 | } |
| 235 | 233 | |
| 236 | 234 | /** |
| 237 | - * Check the PHP version and register an admin notice when it is too old. | |
| 235 | + * put your comment there... | |
| 238 | 236 | * |
| 239 | - * @return bool TRUE when the environment can run the plugin. | |
| 240 | 237 | */ |
| 241 | 238 | public static function isCompatibleEnvironment() |
| 242 | 239 | { |
| 243 | 240 | |
| @@ -242,10 +239,13 @@ | ||
| 242 | 239 | { |
| 243 | 240 | |
| 244 | 241 | if ( version_compare( PHP_VERSION, self::ENV_PHP_MIN_VERSION, '<' ) ) |
| 245 | 242 | { |
| 246 | - add_action( 'admin_notices', 'cjtIncompatiblePHPNotice' ); | |
| 247 | 243 | |
| 244 | + $importHTMLFileCode = 'require "includes" . DIRECTORY_SEPARATOR . "html" . DIRECTORY_SEPARATOR . "incompatible_environment_message.html.php";'; | |
| 245 | + | |
| 246 | + add_action( 'admin_notices', create_function( '', $importHTMLFileCode ) ); | |
| 247 | + | |
| 248 | 248 | return false; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | return true; |
| @@ -352,26 +352,21 @@ | ||
| 352 | 352 | * @return boolean TRUE. |
| 353 | 353 | */ |
| 354 | 354 | public function onconnected( $observer, $state ) |
| 355 | 355 | { |
| 356 | - // Always connect the access point! | |
| 356 | + | |
| 357 | + // In all cases that we'll process the request load the localization file. | |
| 358 | + load_plugin_textdomain( CJTOOLBOX_TEXT_DOMAIN, false, CJTOOLBOX_LANGUAGES ); | |
| 359 | + | |
| 360 | + do_action( CJTPluggableHelper::ACTION_CJT_TEXT_DOMAIN_LOADED ); | |
| 361 | + | |
| 362 | + // Always connet the access point! | |
| 357 | 363 | return $state; |
| 364 | + | |
| 358 | 365 | } |
| 359 | 366 | |
| 360 | 367 | }// End Class |
| 361 | 368 | |
| 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 & 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 | 369 | // Dont run if environment (e.g PHP version) is incomaptible |
| 375 | 370 | if ( ! CJTPlugin::isCompatibleEnvironment() ) |
| 376 | 371 | { |
| 377 | 372 | return; |
| @@ -380,38 +375,18 @@ | ||
| 380 | 375 | // Initialize events! |
| 381 | 376 | CJTPlugin::define( 'CJTPlugin', array( 'hookType' => CJTWordpressEvents::HOOK_FILTER ) ); |
| 382 | 377 | |
| 383 | 378 | // Let's Go! |
| 384 | -CJTPlugin::getInstance(); | |
| 379 | +function deprecatedPHPCheck() | |
| 380 | +{ ?> | |
| 381 | + <div class="notice notice-error"> | |
| 382 | + <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> | |
| 383 | + Current PHP Version: <strong><?php echo phpversion(); ?></strong> | |
| 384 | + </p> | |
| 385 | + </div> | |
| 386 | +<?php } | |
| 385 | 387 | |
| 386 | -add_action( 'upgrader_process_complete', 'upgradeCheck',10, 2 ); | |
| 387 | - | |
| 388 | -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 | - } | |
| 394 | - | |
| 395 | - if ( $options['action'] !== 'update' || $options['type'] !== 'plugin' ) { | |
| 396 | - return; | |
| 397 | - } | |
| 398 | - | |
| 399 | - if ( empty( $options['plugins'] ) || ! is_array( $options['plugins'] ) ) { | |
| 400 | - return; | |
| 401 | - } | |
| 402 | - | |
| 403 | - if ( ! in_array( plugin_basename( __FILE__ ), $options['plugins'], true ) ) { | |
| 404 | - return; | |
| 405 | - } | |
| 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 | -} | |
| 388 | +if ( version_compare( phpversion(), 7, '>=' ) ) { | |
| 389 | + CJTPlugin::getInstance(); | |
| 390 | +} else { | |
| 391 | + add_action( 'admin_notices', 'deprecatedPHPCheck' ); | |
| 392 | +} | |