| @@ -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: 11.3 | |
| 6 | +Version: 12.0 | |
| 7 | 7 | Author: Wipeout Media |
| 8 | +Stable tag: 12.0 | |
| 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. |
| @@ -388,5 +389,29 @@ | ||
| 388 | 389 | if ( version_compare( phpversion(), 7, '>=' ) ) { |
| 389 | 390 | CJTPlugin::getInstance(); |
| 390 | 391 | } else { |
| 391 | 392 | add_action( 'admin_notices', 'deprecatedPHPCheck' ); |
| 392 | -} | |
| 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 | +} | |