PluginProbe
MakeCommerce for WooCommerce / 3.0.11
MakeCommerce for WooCommerce v3.0.11
4.1.0 4.0.8 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 2.2.2 All 96 releases
← All changes | includes/makecommerce.php +18 -29 trunk3.0.11 View file →
@@ -67,9 +67,12 @@
67 67 * @since 3.0.0
68 68 */
69 69 public function __construct() {
70 70
71 - $this->version = MAKECOMMERCE_VERSION;
71 + $this->version = '3.0.0';
72 + if ( defined( 'MAKECOMMERCE_VERSION' ) ) {
73 + $this->version = MAKECOMMERCE_VERSION;
74 + }
72 75
73 76 $this->plugin_name = 'makecommerce';
74 77
75 78 //configure autoloader
@@ -109,9 +112,9 @@
109 112 private function set_locale() {
110 113
111 114 $plugin_i18n = new MakeCommerce\i18n();
112 115
113 - $this->loader->add_action( 'init', $plugin_i18n, 'load_plugin_textdomain' );
116 + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
114 117 }
115 118
116 119 /**
117 120 * Register all of the hooks related to cron functionality
@@ -150,14 +153,8 @@
150 153 //Add admin notice if api is not set up
151 154 if ( !\MakeCommerce::get_api() ) {
152 155 $this->loader->add_action( 'admin_notices', $api, 'api_info_missing' );
153 156 }
154 -
155 - //Add admin notice about Shipping+
156 - $this->loader->add_action( 'admin_notices', $api, 'shipping_api_notice' );
157 -
158 - //if API type is updated then refresh the cache
159 - $this->loader->add_action( 'update_option_mk_api_type', $api, 'mk_delete_api_cache' );
160 157
161 158 //add API access menu in woocommerce->settings->advanced (_api version is for WC <= 3.4.0)
162 159 $this->loader->add_action( 'woocommerce_get_sections_advanced', $api, 'add_woo_menu' );
163 160 $this->loader->add_action( 'woocommerce_get_sections_api', $api, 'add_woo_menu');
@@ -178,15 +175,8 @@
178 175 //adds settings link to plugins page
179 176 $this->loader->add_filter( 'plugin_action_links_makecommerce/makecommerce.php', $api, 'add_plugin_settings_link' );
180 177
181 178 $this->loader->add_filter( 'woocommerce_admin_field_api_javascript_ui', $api, 'api_javascript_ui' );
182 -
183 - // Shipping plus confirmation page in Admin panel and related hooks to it
184 - $this->loader->add_action('admin_enqueue_scripts', $api, 'enqueue_shipping_plus_assets');
185 - $this->loader->add_action('admin_menu', $api, 'add_shipping_plus_admin_page');
186 - $this->loader->add_action( 'admin_head', $api, 'remove_shipping_confirm_menu', 15 );
187 - $this->loader->add_action( 'admin_head', $api, 'hide_shipping_admin_notices' );
188 - $this->loader->add_action( 'admin_init', $api, 'save_shipping_plus_confirmation' );
189 179 }
190 180
191 181 /**
192 182 * Register all of the hooks related to the public-facing functionality
@@ -217,16 +207,9 @@
217 207 $this->loader->add_filter( 'posts_where', $plugin_shipping, 'shipping_filter', 10, 2 );
218 208
219 209 $this->loader->add_filter( 'woocommerce_order_status_processing', $plugin_shipping, 'register_shipment' );
220 210
221 - $this->loader->add_action( 'woocommerce_update_order', $plugin_shipping, 'set_parcel_machine_meta' );
222 - $this->loader->add_action( 'woocommerce_update_order', $plugin_shipping, 'update_courier_meta' );
223 -
224 - $this->loader->add_action( 'wp_ajax_update_map_center', $plugin_shipping, 'update_map_center' );
225 - $this->loader->add_action( 'wp_ajax_nopriv_update_map_center', $plugin_shipping, 'update_map_center' );
226 -
227 - $this->loader->add_action( 'update_option_mc_map_geocoding_api_key', $plugin_shipping, 'mc_check_api_key' );
228 - $this->loader->add_action( 'admin_notices', $plugin_shipping, 'invalid_api_key_notification' );
211 + $this->loader->add_action( 'save_post', $plugin_shipping, 'set_parcel_machine_meta' );
229 212 }
230 213
231 214 /**
232 215 * Run the loader to execute all of the hooks with WordPress.
@@ -383,8 +366,20 @@
383 366 );
384 367 }
385 368
386 369 /**
370 + * Notify that woocommerce version is not supported with our plugin
371 + *
372 + * @since 3.0.0
373 + */
374 + public function old_woocommerce_notice() {
375 +
376 + $class = 'notice notice-error';
377 + $message = sprintf( __( 'Makecommerce plugin needs at least <strong>WooCommerce 2.6</strong> to function correctly. Please update yours (currently %s)', 'wc_makecommerce_domain' ), $woocommerce->version );
378 + printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
379 + }
380 +
381 + /**
387 382 * Helpful tool for debugging
388 383 *
389 384 * @since 3.0.0
390 385 */
@@ -418,14 +413,8 @@
418 413 * @since 3.0.9
419 414 */
420 415 public static function mc_enqueue_script( $handle, $src, $data = [], $deps = [], $external = false ) {
421 416
422 - //check if the script is already enqueued. Fixes issue for misbehaving plugins who the queue again which causes inline script to be added more than once.
423 - //https://github.com/wp-media/wp-rocket/issues/3125
424 - if ( wp_script_is( $handle, 'enqueued' ) ) {
425 - return;
426 - }
427 -
428 417 $version = null;
429 418 if ( !$external ) {
430 419
431 420 $version = filemtime( $src );