| @@ -2,10 +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: 10 | |
| 6 | +Version: 11.7 | |
| 7 | 7 | Author: Wipeout Media |
| 8 | +Stable tag: 11.7 | |
| 8 | 9 | Author URI: https://css-javascript-toolbox.com |
| 9 | 10 | License: |
| 10 | 11 | |
| 11 | 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. |
| @@ -80,9 +81,9 @@ | ||
| 80 | 81 | |
| 81 | 82 | /** |
| 82 | 83 | * |
| 83 | 84 | */ |
| 84 | - const DB_VERSION = '1.6'; | |
| 85 | + const DB_VERSION = '1.7'; | |
| 85 | 86 | |
| 86 | 87 | /** |
| 87 | 88 | * put your comment there... |
| 88 | 89 | * |
| @@ -92,14 +93,14 @@ | ||
| 92 | 93 | |
| 93 | 94 | /** |
| 94 | 95 | * |
| 95 | 96 | */ |
| 96 | - const FW_Version = '4.0'; | |
| 97 | + const FW_Version = '5.0'; | |
| 97 | 98 | |
| 98 | 99 | /** |
| 99 | 100 | * |
| 100 | 101 | */ |
| 101 | - const VERSION = '10'; | |
| 102 | + const VERSION = '11'; | |
| 102 | 103 | |
| 103 | 104 | /** |
| 104 | 105 | * |
| 105 | 106 | */ |
| @@ -375,5 +376,42 @@ | ||
| 375 | 376 | // Initialize events! |
| 376 | 377 | CJTPlugin::define( 'CJTPlugin', array( 'hookType' => CJTWordpressEvents::HOOK_FILTER ) ); |
| 377 | 378 | |
| 378 | 379 | // Let's Go! |
| 379 | -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 } | |
| 388 | + | |
| 389 | +if ( version_compare( phpversion(), 7, '>=' ) ) { | |
| 390 | + CJTPlugin::getInstance(); | |
| 391 | +} else { | |
| 392 | + add_action( 'admin_notices', 'deprecatedPHPCheck' ); | |
| 393 | +} | |
| 394 | + | |
| 395 | +add_action( 'upgrader_process_complete', 'upgradeCheck',10, 2 ); | |
| 396 | + | |
| 397 | +function upgradeCheck( $upgrader_object, $options ) { | |
| 398 | + $CJTPluginPath = plugin_basename( __FILE__ ); | |
| 399 | + | |
| 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' ); | |
| 404 | + | |
| 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' ); | |
| 409 | + | |
| 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 | + } | |
| 416 | + } | |
| 417 | +} | |