| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | * @wordpress-plugin |
| 16 | 16 | * Plugin Name: CBX Map for Google Map & OpenStreetMap |
| 17 | 17 | * Plugin URI: https://codeboxr.com/product/cbx-google-map-for-wordpress/ |
| 18 | 18 | * Description: Easy responsive embed of google map and openstreet map |
| 19 | - * Version: 2.0.0 | |
| 19 | + * Version: 2.0.5 | |
| 20 | 20 | * Author: Codeboxr |
| 21 | 21 | * Author URI: https://codeboxr.com |
| 22 | 22 | * License: GPL-2.0+ |
| 23 | 23 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| @@ -32,9 +32,9 @@ | ||
| 32 | 32 | die; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | defined( 'CBXGOOGLEMAP_PLUGIN_NAME' ) or define( 'CBXGOOGLEMAP_PLUGIN_NAME', 'cbxgooglemap' ); |
| 36 | -defined( 'CBXGOOGLEMAP_PLUGIN_VERSION' ) or define( 'CBXGOOGLEMAP_PLUGIN_VERSION', '2.0.0' ); | |
| 36 | +defined( 'CBXGOOGLEMAP_PLUGIN_VERSION' ) or define( 'CBXGOOGLEMAP_PLUGIN_VERSION', '2.0.5' ); | |
| 37 | 37 | defined( 'CBXGOOGLEMAP_BASE_NAME' ) or define( 'CBXGOOGLEMAP_BASE_NAME', plugin_basename( __FILE__ ) ); |
| 38 | 38 | defined( 'CBXGOOGLEMAP_ROOT_PATH' ) or define( 'CBXGOOGLEMAP_ROOT_PATH', plugin_dir_path( __FILE__ ) ); |
| 39 | 39 | defined( 'CBXGOOGLEMAP_ROOT_URL' ) or define( 'CBXGOOGLEMAP_ROOT_URL', plugin_dir_url( __FILE__ ) ); |
| 40 | 40 | |
| @@ -39,8 +39,9 @@ | ||
| 39 | 39 | defined( 'CBXGOOGLEMAP_ROOT_URL' ) or define( 'CBXGOOGLEMAP_ROOT_URL', plugin_dir_url( __FILE__ ) ); |
| 40 | 40 | |
| 41 | 41 | defined( 'CBXGOOGLEMAP_WP_MIN_VERSION' ) or define( 'CBXGOOGLEMAP_WP_MIN_VERSION', '5.3' ); |
| 42 | 42 | defined( 'CBXGOOGLEMAP_PHP_MIN_VERSION' ) or define( 'CBXGOOGLEMAP_PHP_MIN_VERSION', '7.4' ); |
| 43 | +defined( 'CBXGOOGLEMAP_PRO_VERSION' ) or define( 'CBXGOOGLEMAP_PRO_VERSION', '2.0.5' ); | |
| 43 | 44 | |
| 44 | 45 | // Include the main class |
| 45 | 46 | if ( ! class_exists( 'CBXGoogleMap', false ) ) { |
| 46 | 47 | include_once CBXGOOGLEMAP_ROOT_PATH . 'includes/CBXGoogleMap.php'; |
| @@ -81,47 +82,70 @@ | ||
| 81 | 82 | |
| 82 | 83 | return true; |
| 83 | 84 | }//end method cbxgooglemap_compatible_php_version |
| 84 | 85 | |
| 85 | -register_activation_hook( __FILE__, 'activate_cbxgooglemap' ); | |
| 86 | -register_deactivation_hook( __FILE__, 'deactivate_cbxgooglemap' ); | |
| 86 | +register_activation_hook( __FILE__, 'cbxgooglemap_activate' ); | |
| 87 | +register_deactivation_hook( __FILE__, 'cbxgooglemap_deactivate' ); | |
| 87 | 88 | |
| 88 | 89 | /** |
| 89 | 90 | * The code that runs during plugin activation. |
| 90 | 91 | * This action is documented in includes/class-cbxgooglemap-activator.php |
| 91 | 92 | */ |
| 92 | -function activate_cbxgooglemap() { | |
| 93 | - $wp_version = CBXGOOGLEMAP_WP_MIN_VERSION; | |
| 94 | - $php_version = CBXGOOGLEMAP_PHP_MIN_VERSION; | |
| 93 | +function cbxgooglemap_activate() { | |
| 94 | + try { | |
| 95 | + $wp_version = CBXGOOGLEMAP_WP_MIN_VERSION; | |
| 96 | + $php_version = CBXGOOGLEMAP_PHP_MIN_VERSION; | |
| 95 | 97 | |
| 96 | - $activate_ok = true; | |
| 97 | - if ( ! cbxgooglemap_compatible_wp_version() ) { | |
| 98 | - $activate_ok = false; | |
| 99 | - deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 98 | + $activate_ok = true; | |
| 99 | + if ( ! cbxgooglemap_compatible_wp_version() ) { | |
| 100 | + $activate_ok = false; | |
| 101 | + deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 100 | 102 | |
| 101 | - /* translators: WordPress version */ | |
| 102 | - wp_die( sprintf( esc_html__( 'CBX Google Map plugin requires WordPress %s or higher!', 'cbxgooglemap' ), esc_attr($wp_version) ) ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 103 | + /* translators: WordPress version */ | |
| 104 | + wp_die( sprintf( esc_html__( 'CBX Google Map plugin requires WordPress %s or higher!', 'cbxgooglemap' ), esc_attr($wp_version) ) ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 105 | + } | |
| 106 | + | |
| 107 | + if ( ! cbxgooglemap_compatible_php_version() ) { | |
| 108 | + $activate_ok = false; | |
| 109 | + deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 110 | + | |
| 111 | + /* translators: PHP version */ | |
| 112 | + wp_die( sprintf( esc_html__( 'CBX Google Map plugin requires PHP %s or higher!', 'cbxgooglemap' ), esc_attr($php_version) ) ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 113 | + } | |
| 114 | + | |
| 115 | + if($activate_ok) { | |
| 116 | + cbxgooglemap_core(); | |
| 117 | + CBXGooglemapHelper::activate(); | |
| 118 | + } | |
| 103 | 119 | } |
| 120 | + catch ( Throwable $e ) { | |
| 121 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { | |
| 122 | + //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.PHP.DevelopmentFunctions.error_log_print_r | |
| 123 | + error_log( print_r( [ | |
| 124 | + 'message' => $e->getMessage(), | |
| 125 | + 'file' => $e->getFile(), | |
| 126 | + 'line' => $e->getLine(), | |
| 127 | + 'trace' => $e->getTraceAsString(), | |
| 128 | + ], true ) ); | |
| 129 | + } | |
| 104 | 130 | |
| 105 | - if ( ! cbxgooglemap_compatible_php_version() ) { | |
| 106 | - $activate_ok = false; | |
| 131 | + | |
| 107 | 132 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 108 | 133 | |
| 109 | - /* translators: PHP version */ | |
| 110 | - wp_die( sprintf( esc_html__( 'CBX Google Map plugin requires PHP %s or higher!', 'cbxgooglemap' ), esc_attr($php_version) ) ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 134 | + wp_die( | |
| 135 | + sprintf( | |
| 136 | + 'Activation error: %s', | |
| 137 | + esc_html( $e->getMessage() ) | |
| 138 | + ) | |
| 139 | + ); | |
| 111 | 140 | } |
| 141 | +}//end method cbxgooglemap_activate | |
| 112 | 142 | |
| 113 | - if($activate_ok) { | |
| 114 | - cbxgooglemap_core(); | |
| 115 | - CBXGooglemapHelper::activate(); | |
| 116 | - } | |
| 117 | -}//end method activate_cbxgooglemap | |
| 118 | - | |
| 119 | 143 | /** |
| 120 | 144 | * The code that runs during plugin deactivation. |
| 121 | 145 | * This action is documented in includes/class-cbxgooglemap-deactivator.php |
| 122 | 146 | */ |
| 123 | -function deactivate_cbxgooglemap() { | |
| 147 | +function cbxgooglemap_deactivate() { | |
| 124 | 148 | CBXGooglemapHelper::deactivate(); |
| 125 | 149 | } |
| 126 | 150 | |
| 127 | 151 | /** |
| @@ -132,9 +156,9 @@ | ||
| 132 | 156 | function cbxgooglemap_core() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
| 133 | 157 | global $cbxgooglemap_core; |
| 134 | 158 | |
| 135 | 159 | if ( ! isset( $cbxgooglemap_core ) ) { |
| 136 | - $cbxgooglemap_core = run_cbxgooglemap(); | |
| 160 | + $cbxgooglemap_core = cbxgooglemap_run(); | |
| 137 | 161 | } |
| 138 | 162 | |
| 139 | 163 | return $cbxgooglemap_core; |
| 140 | 164 | }//end method cbxgooglemap_core |
| @@ -147,9 +171,9 @@ | ||
| 147 | 171 | * not affect the page life cycle. |
| 148 | 172 | * |
| 149 | 173 | * @since 1.0.0 |
| 150 | 174 | */ |
| 151 | -function run_cbxgooglemap() { | |
| 175 | +function cbxgooglemap_run() { | |
| 152 | 176 | return CBXGoogleMap::instance(); |
| 153 | -}//end method run_cbxgooglemap | |
| 177 | +}//end method cbxgooglemap_run | |
| 154 | 178 | |
| 155 | -$GLOBALS['cbxgooglemap_core'] = run_cbxgooglemap(); | |
| 179 | +$GLOBALS['cbxgooglemap_core'] = cbxgooglemap_run(); | |