| @@ -2,11 +2,13 @@ | ||
| 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 | |
| 6 | +Version: 12.0.4 | |
| 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/ | |
| 9 | 11 | License: |
| 10 | 12 | |
| 11 | 13 | 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. |
| 12 | 14 | |
| @@ -97,9 +99,9 @@ | ||
| 97 | 99 | |
| 98 | 100 | /** |
| 99 | 101 | * |
| 100 | 102 | */ |
| 101 | - const VERSION = '11'; | |
| 103 | + const VERSION = '12.0.4'; | |
| 102 | 104 | |
| 103 | 105 | /** |
| 104 | 106 | * |
| 105 | 107 | */ |
| @@ -352,17 +354,10 @@ | ||
| 352 | 354 | * @return boolean TRUE. |
| 353 | 355 | */ |
| 354 | 356 | public function onconnected( $observer, $state ) |
| 355 | 357 | { |
| 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! | |
| 358 | + // Always connect the access point! | |
| 363 | 359 | return $state; |
| 364 | - | |
| 365 | 360 | } |
| 366 | 361 | |
| 367 | 362 | }// End Class |
| 368 | 363 | |
| @@ -388,5 +383,29 @@ | ||
| 388 | 383 | if ( version_compare( phpversion(), 7, '>=' ) ) { |
| 389 | 384 | CJTPlugin::getInstance(); |
| 390 | 385 | } else { |
| 391 | 386 | add_action( 'admin_notices', 'deprecatedPHPCheck' ); |
| 392 | -} | |
| 387 | +} | |
| 388 | + | |
| 389 | +add_action( 'upgrader_process_complete', 'upgradeCheck',10, 2 ); | |
| 390 | + | |
| 391 | +function upgradeCheck( $upgrader_object, $options ) { | |
| 392 | + $CJTPluginPath = plugin_basename( __FILE__ ); | |
| 393 | + | |
| 394 | + global $wpdb; | |
| 395 | + $table_name = $wpdb->base_prefix.'cjtoolbox_blocks'; | |
| 396 | + $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) ); | |
| 397 | + $preCheck = get_option( '__existing_cjt_user' ); | |
| 398 | + | |
| 399 | + if ( $options['action'] == 'update' && $options['type'] == 'plugin' ) { | |
| 400 | + foreach( $options['plugins'] as $each_plugin ) { | |
| 401 | + if ( $each_plugin == $CJTPluginPath ) { | |
| 402 | + $preCheck = get_option( '__existing_cjt_user' ); | |
| 403 | + | |
| 404 | + // Only create it once. | |
| 405 | + if ( empty( $preCheck ) ) { | |
| 406 | + update_option( '__existing_cjt_user', $wpdb->get_var( $query ) === $table_name ? 'true' : 'false' ); | |
| 407 | + } | |
| 408 | + } | |
| 409 | + } | |
| 410 | + } | |
| 411 | +} | |