diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2d67d9dfcdc..c4a08668e37 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,5 +1,13 @@
== Changelog ==
+= 3.9.1 - 2020-01-28 =
+
+* Tweak - Trim whitespaces and strip slashes from MaxMind License Key.
+* Dev - Prevent empty notices to get displayed on frontend.
+* Fix - Show "-" instead of "0" when tax isn't applicable to a product.
+* Fix - Fixed fatal error on the thank you page if order is not specified.
+* REST API - Fixed - Product and variations schema to allow remove sale prices, dimensions and weight.
+
= 3.9.0 - 2020-01-21 =
* Enhancement - Added a "Show" button next to the password field on the login fields. #24915
@@ -79,7 +87,7 @@
* Dev - Introduced wc_get_product_object() helper. #25031
* Dev - Pass the correct `$this->updated_props` variable to the `woocommerce_coupon_object_updated_props` action's second paramater. #25077
* Dev - Remove a few calls to `func_get_args()` and `call_user_func_array()` with the spread operator for better code legibility and performance gains. #25101
-- Dev - New `woocommerce_valid_order_statuses_for_payment` hook that triggers when an order is paid. Use this new hook instead of `woocommerce_order_status_changed` or *woocommerce_order_status_{old_status}}_to_{new_status}` to trigger code for payment completion. #25158
+* Dev - New `woocommerce_valid_order_statuses_for_payment` hook that triggers when an order is paid. Use this new hook instead of `woocommerce_order_status_changed` or woocommerce_order_status_{old_status}}_to_{new_status}` to trigger code for payment completion. #25158
* Dev - Ability to exclude certain product types from product search calls. #25162
* Dev - Raise exception when `WC_Product_Variation` is instantiated with an ID that belongs to an object that is not a variation. #25178
* Localization - Add subdivisions of Laos. #24765
@@ -144,7 +152,7 @@
* Dev - Introduced woocommerce_payment_token_class filter. #24542
* Dev - Add support for post type count to system status report. #24536
* Dev - Check for max discount to be -ve to prevent overwriting refunded fee amount. #24341
-* Dev: Add filter woocommerce_european_union_countries to the method WC_Countries::get_european_union_countries(). #24741
+* Dev - Add filter woocommerce_european_union_countries to the method WC_Countries::get_european_union_countries(). #24741
* Dev - Allow WC_Product_Query sort products by include order. #24294
* Dev - Removed duplicated include of WC_Admin_Importers. #24751
* Dev - Refactor minimum requirement notice to use constant for easier changes in the future. #24830
diff --git a/assets/js/admin/wc-setup.js b/assets/js/admin/wc-setup.js
index 41a55875aa6..168a425de7a 100644
--- a/assets/js/admin/wc-setup.js
+++ b/assets/js/admin/wc-setup.js
@@ -168,7 +168,10 @@ jQuery( function( $ ) {
$( '.wc-wizard-services' ).on( 'change', '.wc-wizard-shipping-method-enable', function() {
var checked = $( this ).is( ':checked' );
- var selectedMethod = $( '.wc-wizard-shipping-method-select .method' ).val();
+ var selectedMethod = $( this )
+ .closest( '.wc-wizard-service-item' )
+ .find( '.wc-wizard-shipping-method-select .method' )
+ .val();
$( this )
.closest( '.wc-wizard-service-item' )
diff --git a/assets/js/frontend/checkout.js b/assets/js/frontend/checkout.js
index 6ddc34b99c8..73a7693bc76 100644
--- a/assets/js/frontend/checkout.js
+++ b/assets/js/frontend/checkout.js
@@ -50,7 +50,7 @@ jQuery( function( $ ) {
this.$checkout_form.on( 'change', '#ship-to-different-address input', this.ship_to_different_address );
// Trigger events
- this.init_ship_to_different_address();
+ this.$checkout_form.find( '#ship-to-different-address input' ).change();
this.init_payment_methods();
// Update on page load
@@ -135,10 +135,7 @@ jQuery( function( $ ) {
}
},
init_checkout: function() {
- // Fire updated_checkout event after existing ready event handlers.
- $( function() {
- $( document.body ).trigger( 'updated_checkout' );
- } );
+ $( document.body ).trigger( 'update_checkout' );
},
maybe_input_changed: function( e ) {
if ( wc_checkout_form.dirtyInput ) {
@@ -183,31 +180,10 @@ jQuery( function( $ ) {
wc_checkout_form.trigger_update_checkout();
}
},
- init_ship_to_different_address: function() {
- var $checkbox = $( '#ship-to-different-address input' );
-
- if ( ! $checkbox.prop( 'checked' ) ) {
- var $billing = $( 'div.woocommerce-billing-fields' );
-
- // Find shipping field values that diverge from billing.
- var $differentFields = $( 'div.shipping_address' ).find( 'input, select' ).filter( function() {
- $( this ).attr( 'id' ).replace( 'shipping', 'billing' );
- var id = $( this ).attr( 'id' ).replace( 'shipping', 'billing' );
- return $( this ).val() !== $billing.find( '#' + id ).val();
- } );
-
- if ( $differentFields.length > 0 ) {
- $checkbox.prop( 'checked', true );
- }
- }
-
- $( 'div.shipping_address' ).toggle( $checkbox.prop( 'checked' ) );
- },
ship_to_different_address: function() {
+ $( 'div.shipping_address' ).hide();
if ( $( this ).is( ':checked' ) ) {
$( 'div.shipping_address' ).slideDown();
- } else {
- $( 'div.shipping_address' ).slideUp();
}
},
reset_update_checkout_timer: function() {
diff --git a/bin/post-merge.sh b/bin/post-merge.sh
new file mode 100755
index 00000000000..67196fe5f18
--- /dev/null
+++ b/bin/post-merge.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
+
+runOnChange() {
+ echo "$changedFiles" | grep -q "$1" && eval "$2"
+}
+
+runOnChange "package-lock.json" "npm install"
+runOnChange "composer.lock" "composer install"
diff --git a/composer.json b/composer.json
index 06b4761723b..a6e48286c1c 100644
--- a/composer.json
+++ b/composer.json
@@ -9,10 +9,12 @@
"require": {
"php": ">=5.6|>=7.0",
"automattic/jetpack-autoloader": "^1.2.0",
+ "automattic/jetpack-constants": "^1.1",
"composer/installers": "1.7.0",
"maxmind-db/reader": "1.6.0",
+ "woocommerce/action-scheduler": "2.2.5",
"woocommerce/woocommerce-blocks": "2.5.11",
- "woocommerce/woocommerce-rest-api": "1.0.6"
+ "woocommerce/woocommerce-rest-api": "1.0.7"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
@@ -23,6 +25,7 @@
"php": "7.1"
},
"preferred-install": {
+ "woocommerce/action-scheduler": "dist",
"woocommerce/woocommerce-rest-api": "dist",
"woocommerce/woocommerce-blocks": "dist"
},
@@ -59,6 +62,7 @@
},
"extra": {
"installer-paths": {
+ "packages/action-scheduler": ["woocommerce/action-scheduler"],
"packages/woocommerce-rest-api": ["woocommerce/woocommerce-rest-api"],
"packages/woocommerce-blocks": ["woocommerce/woocommerce-blocks"]
},
diff --git a/composer.lock b/composer.lock
index e7cdd373318..abc155988a5 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e6dfd8d640c9fc3f21795ddb41a23477",
+ "content-hash": "d2f5085db8a002bfb5349dca8dc82878",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@@ -42,6 +42,36 @@
"description": "Creates a custom autoloader for a plugin or theme.",
"time": "2019-09-24T06:39:29+00:00"
},
+ {
+ "name": "automattic/jetpack-constants",
+ "version": "v1.1.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Automattic/jetpack-constants.git",
+ "reference": "5fdd94dec1151e7defd684a97e0b64fe6ff1bd3a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/5fdd94dec1151e7defd684a97e0b64fe6ff1bd3a",
+ "reference": "5fdd94dec1151e7defd684a97e0b64fe6ff1bd3a",
+ "shasum": ""
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0-or-later"
+ ],
+ "description": "A wrapper for defining constants in a more testable way.",
+ "time": "2019-11-08T21:16:05+00:00"
+ },
{
"name": "composer/installers",
"version": "v1.7.0",
@@ -224,6 +254,31 @@
],
"time": "2019-12-19T22:59:03+00:00"
},
+ {
+ "name": "woocommerce/action-scheduler",
+ "version": "2.2.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/woocommerce/action-scheduler.git",
+ "reference": "fd7c6b76a7af27d6403ffe39b0963dbd8ce50488"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/fd7c6b76a7af27d6403ffe39b0963dbd8ce50488",
+ "reference": "fd7c6b76a7af27d6403ffe39b0963dbd8ce50488",
+ "shasum": ""
+ },
+ "require-dev": {
+ "wp-cli/wp-cli": "1.5.1"
+ },
+ "type": "wordpress-plugin",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-3.0"
+ ],
+ "description": "Action Scheduler for WordPress and WooCommerce",
+ "time": "2019-04-24T12:45:40+00:00"
+ },
{
"name": "woocommerce/woocommerce-blocks",
"version": "v2.5.11",
@@ -273,16 +328,16 @@
},
{
"name": "woocommerce/woocommerce-rest-api",
- "version": "1.0.6",
+ "version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-rest-api.git",
- "reference": "78ccf4d4c6bafbc841182b68aa863e7b0caa37c8"
+ "reference": "49162ec26a25bd0c6efc0f3452b113cdfff0a823"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/woocommerce/woocommerce-rest-api/zipball/78ccf4d4c6bafbc841182b68aa863e7b0caa37c8",
- "reference": "78ccf4d4c6bafbc841182b68aa863e7b0caa37c8",
+ "url": "https://api.github.com/repos/woocommerce/woocommerce-rest-api/zipball/49162ec26a25bd0c6efc0f3452b113cdfff0a823",
+ "reference": "49162ec26a25bd0c6efc0f3452b113cdfff0a823",
"shasum": ""
},
"require": {
@@ -309,7 +364,7 @@
],
"description": "The WooCommerce core REST API.",
"homepage": "https://github.com/woocommerce/woocommerce-rest-api",
- "time": "2020-01-15T23:29:39+00:00"
+ "time": "2020-01-28T21:04:51+00:00"
}
],
"packages-dev": [
@@ -437,16 +492,16 @@
},
{
"name": "myclabs/deep-copy",
- "version": "1.9.4",
+ "version": "1.9.5",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
- "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7"
+ "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7",
- "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef",
+ "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef",
"shasum": ""
},
"require": {
@@ -481,7 +536,7 @@
"object",
"object graph"
],
- "time": "2019-12-15T19:12:40+00:00"
+ "time": "2020-01-17T21:11:47+00:00"
},
{
"name": "phar-io/manifest",
@@ -898,24 +953,24 @@
},
{
"name": "phpspec/prophecy",
- "version": "1.10.1",
+ "version": "v1.10.2",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
- "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc"
+ "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc",
- "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9",
+ "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
- "sebastian/comparator": "^1.2.3|^2.0|^3.0",
- "sebastian/recursion-context": "^1.0|^2.0|^3.0"
+ "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
+ "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5 || ^3.2",
@@ -957,7 +1012,7 @@
"spy",
"stub"
],
- "time": "2019-12-22T21:05:45+00:00"
+ "time": "2020-01-20T15:57:02+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -1863,16 +1918,16 @@
},
{
"name": "squizlabs/php_codesniffer",
- "version": "3.5.3",
+ "version": "3.5.4",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb"
+ "reference": "dceec07328401de6211037abbb18bda423677e26"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb",
- "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
+ "reference": "dceec07328401de6211037abbb18bda423677e26",
"shasum": ""
},
"require": {
@@ -1910,7 +1965,7 @@
"phpcs",
"standards"
],
- "time": "2019-12-04T04:46:47+00:00"
+ "time": "2020-01-30T22:20:29+00:00"
},
{
"name": "symfony/polyfill-ctype",
diff --git a/includes/abstracts/abstract-wc-deprecated-hooks.php b/includes/abstracts/abstract-wc-deprecated-hooks.php
index 77acca23686..c7cb4c56975 100644
--- a/includes/abstracts/abstract-wc-deprecated-hooks.php
+++ b/includes/abstracts/abstract-wc-deprecated-hooks.php
@@ -7,6 +7,8 @@
* @version 3.3.0
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -94,7 +96,7 @@ abstract class WC_Deprecated_Hooks {
* @return string
*/
protected function get_deprecated_version( $old_hook ) {
- return ! empty( $this->deprecated_version[ $old_hook ] ) ? $this->deprecated_version[ $old_hook ] : WC_VERSION;
+ return ! empty( $this->deprecated_version[ $old_hook ] ) ? $this->deprecated_version[ $old_hook ] : Constants::get_constant( 'WC_VERSION' );
}
/**
diff --git a/includes/abstracts/abstract-wc-payment-gateway.php b/includes/abstracts/abstract-wc-payment-gateway.php
index 6930fccec99..180c3f05adf 100644
--- a/includes/abstracts/abstract-wc-payment-gateway.php
+++ b/includes/abstracts/abstract-wc-payment-gateway.php
@@ -9,6 +9,8 @@
* @package WooCommerce/Abstracts
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -450,7 +452,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
public function tokenization_script() {
wp_enqueue_script(
'woocommerce-tokenization-form',
- plugins_url( '/assets/js/frontend/tokenization-form' . ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min' ) . '.js', WC_PLUGIN_FILE ),
+ plugins_url( '/assets/js/frontend/tokenization-form' . ( Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min' ) . '.js', WC_PLUGIN_FILE ),
array( 'jquery' ),
WC()->version
);
diff --git a/includes/abstracts/abstract-wc-widget.php b/includes/abstracts/abstract-wc-widget.php
index a65a3914c61..c2f6f1bf298 100644
--- a/includes/abstracts/abstract-wc-widget.php
+++ b/includes/abstracts/abstract-wc-widget.php
@@ -6,6 +6,8 @@
* @package WooCommerce/Abstracts
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -319,7 +321,7 @@ abstract class WC_Widget extends WP_Widget {
* @since 3.3.0
*/
protected function get_current_page_url() {
- if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
+ if ( Constants::is_defined( 'SHOP_IS_ON_FRONT' ) ) {
$link = home_url();
} elseif ( is_shop() ) {
$link = get_permalink( wc_get_page_id( 'shop' ) );
diff --git a/includes/admin/class-wc-admin-addons.php b/includes/admin/class-wc-admin-addons.php
index c4ba6b50c9a..31e9adac3a3 100644
--- a/includes/admin/class-wc-admin-addons.php
+++ b/includes/admin/class-wc-admin-addons.php
@@ -6,6 +6,8 @@
* @version 2.5.0
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -489,7 +491,7 @@ class WC_Admin_Addons {
return array(
'wccom-site' => site_url(),
'wccom-back' => rawurlencode( $back_admin_path ),
- 'wccom-woo-version' => WC_VERSION,
+ 'wccom-woo-version' => Constants::get_constant( 'WC_VERSION' ),
'wccom-connect-nonce' => wp_create_nonce( 'connect' ),
);
}
diff --git a/includes/admin/class-wc-admin-assets.php b/includes/admin/class-wc-admin-assets.php
index baabe2594c2..5bdd3e12685 100644
--- a/includes/admin/class-wc-admin-assets.php
+++ b/includes/admin/class-wc-admin-assets.php
@@ -6,6 +6,8 @@
* @version 3.7.0
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -31,16 +33,17 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
public function admin_styles() {
global $wp_scripts;
+ $version = Constants::get_constant( 'WC_VERSION' );
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
// Register admin styles.
- wp_register_style( 'woocommerce_admin_menu_styles', WC()->plugin_url() . '/assets/css/menu.css', array(), WC_VERSION );
- wp_register_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
- wp_register_style( 'jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), WC_VERSION );
- wp_register_style( 'woocommerce_admin_dashboard_styles', WC()->plugin_url() . '/assets/css/dashboard.css', array(), WC_VERSION );
- wp_register_style( 'woocommerce_admin_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), WC_VERSION, 'print' );
- wp_register_style( 'woocommerce_admin_marketplace_styles', WC()->plugin_url() . '/assets/css/marketplace-suggestions.css', array(), WC_VERSION );
+ wp_register_style( 'woocommerce_admin_menu_styles', WC()->plugin_url() . '/assets/css/menu.css', array(), $version );
+ wp_register_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), $version );
+ wp_register_style( 'jquery-ui-style', WC()->plugin_url() . '/assets/css/jquery-ui/jquery-ui.min.css', array(), $version );
+ wp_register_style( 'woocommerce_admin_dashboard_styles', WC()->plugin_url() . '/assets/css/dashboard.css', array(), $version );
+ wp_register_style( 'woocommerce_admin_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), $version, 'print' );
+ wp_register_style( 'woocommerce_admin_marketplace_styles', WC()->plugin_url() . '/assets/css/marketplace-suggestions.css', array(), $version );
// Add RTL support for admin styles.
wp_style_add_data( 'woocommerce_admin_menu_styles', 'rtl', 'replace' );
@@ -88,32 +91,33 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
$wc_screen_id = sanitize_title( __( 'WooCommerce', 'woocommerce' ) );
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+ $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min';
+ $version = Constants::get_constant( 'WC_VERSION' );
// Register scripts.
- wp_register_script( 'woocommerce_admin', WC()->plugin_url() . '/assets/js/admin/woocommerce_admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip' ), WC_VERSION );
+ wp_register_script( 'woocommerce_admin', WC()->plugin_url() . '/assets/js/admin/woocommerce_admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip' ), $version );
wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
- wp_register_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
- wp_register_script( 'round', WC()->plugin_url() . '/assets/js/round/round' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
- wp_register_script( 'wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'wc-enhanced-select', 'plupload-all', 'stupidtable', 'jquery-tiptip' ), WC_VERSION );
- wp_register_script( 'zeroclipboard', WC()->plugin_url() . '/assets/js/zeroclipboard/jquery.zeroclipboard' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
- wp_register_script( 'qrcode', WC()->plugin_url() . '/assets/js/jquery-qrcode/jquery.qrcode' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
- wp_register_script( 'stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
+ wp_register_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), $version, true );
+ wp_register_script( 'round', WC()->plugin_url() . '/assets/js/round/round' . $suffix . '.js', array( 'jquery' ), $version );
+ wp_register_script( 'wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'wc-enhanced-select', 'plupload-all', 'stupidtable', 'jquery-tiptip' ), $version );
+ wp_register_script( 'zeroclipboard', WC()->plugin_url() . '/assets/js/zeroclipboard/jquery.zeroclipboard' . $suffix . '.js', array( 'jquery' ), $version );
+ wp_register_script( 'qrcode', WC()->plugin_url() . '/assets/js/jquery-qrcode/jquery.qrcode' . $suffix . '.js', array( 'jquery' ), $version );
+ wp_register_script( 'stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array( 'jquery' ), $version );
wp_register_script( 'serializejson', WC()->plugin_url() . '/assets/js/jquery-serializejson/jquery.serializejson' . $suffix . '.js', array( 'jquery' ), '2.8.1' );
- wp_register_script( 'flot', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
- wp_register_script( 'flot-resize', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.resize' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
- wp_register_script( 'flot-time', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.time' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
- wp_register_script( 'flot-pie', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.pie' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
- wp_register_script( 'flot-stack', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.stack' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
- wp_register_script( 'wc-settings-tax', WC()->plugin_url() . '/assets/js/admin/settings-views-html-settings-tax' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), WC_VERSION );
- wp_register_script( 'wc-backbone-modal', WC()->plugin_url() . '/assets/js/admin/backbone-modal' . $suffix . '.js', array( 'underscore', 'backbone', 'wp-util' ), WC_VERSION );
- wp_register_script( 'wc-shipping-zones', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zones' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select', 'wc-backbone-modal' ), WC_VERSION );
- wp_register_script( 'wc-shipping-zone-methods', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zone-methods' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-backbone-modal' ), WC_VERSION );
- wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
- wp_register_script( 'wc-clipboard', WC()->plugin_url() . '/assets/js/admin/wc-clipboard' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
+ wp_register_script( 'flot', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot' . $suffix . '.js', array( 'jquery' ), $version );
+ wp_register_script( 'flot-resize', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.resize' . $suffix . '.js', array( 'jquery', 'flot' ), $version );
+ wp_register_script( 'flot-time', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.time' . $suffix . '.js', array( 'jquery', 'flot' ), $version );
+ wp_register_script( 'flot-pie', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.pie' . $suffix . '.js', array( 'jquery', 'flot' ), $version );
+ wp_register_script( 'flot-stack', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.stack' . $suffix . '.js', array( 'jquery', 'flot' ), $version );
+ wp_register_script( 'wc-settings-tax', WC()->plugin_url() . '/assets/js/admin/settings-views-html-settings-tax' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), $version );
+ wp_register_script( 'wc-backbone-modal', WC()->plugin_url() . '/assets/js/admin/backbone-modal' . $suffix . '.js', array( 'underscore', 'backbone', 'wp-util' ), $version );
+ wp_register_script( 'wc-shipping-zones', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zones' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select', 'wc-backbone-modal' ), $version );
+ wp_register_script( 'wc-shipping-zone-methods', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zone-methods' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-backbone-modal' ), $version );
+ wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), $version );
+ wp_register_script( 'wc-clipboard', WC()->plugin_url() . '/assets/js/admin/wc-clipboard' . $suffix . '.js', array( 'jquery' ), $version );
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.6' );
- wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), WC_VERSION );
+ wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), $version );
wp_register_script( 'js-cookie', WC()->plugin_url() . '/assets/js/js-cookie/js.cookie' . $suffix . '.js', array(), '2.1.4', true );
wp_localize_script(
@@ -146,7 +150,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
)
);
- wp_register_script( 'wc-orders', WC()->plugin_url() . '/assets/js/admin/wc-orders' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), WC_VERSION );
+ wp_register_script( 'wc-orders', WC()->plugin_url() . '/assets/js/admin/wc-orders' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), $version );
wp_localize_script(
'wc-orders',
'wc_orders_params',
@@ -202,7 +206,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
// Products.
if ( in_array( $screen_id, array( 'edit-product' ) ) ) {
- wp_enqueue_script( 'woocommerce_quick-edit', WC()->plugin_url() . '/assets/js/admin/quick-edit' . $suffix . '.js', array( 'jquery', 'woocommerce_admin' ), WC_VERSION );
+ wp_enqueue_script( 'woocommerce_quick-edit', WC()->plugin_url() . '/assets/js/admin/quick-edit' . $suffix . '.js', array( 'jquery', 'woocommerce_admin' ), $version );
$params = array(
'strings' => array(
@@ -216,8 +220,8 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
// Meta boxes.
if ( in_array( $screen_id, array( 'product', 'edit-product' ) ) ) {
wp_enqueue_media();
- wp_register_script( 'wc-admin-product-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'media-models' ), WC_VERSION );
- wp_register_script( 'wc-admin-variation-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product-variation' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'serializejson', 'media-models' ), WC_VERSION );
+ wp_register_script( 'wc-admin-product-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'media-models' ), $version );
+ wp_register_script( 'wc-admin-variation-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-product-variation' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'serializejson', 'media-models' ), $version );
wp_enqueue_script( 'wc-admin-product-meta-boxes' );
wp_enqueue_script( 'wc-admin-variation-meta-boxes' );
@@ -234,7 +238,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
'save_variations_nonce' => wp_create_nonce( 'save-variations' ),
'bulk_edit_variations_nonce' => wp_create_nonce( 'bulk-edit-variations' ),
/* translators: %d: Number of variations */
- 'i18n_link_all_variations' => esc_js( sprintf( __( 'Are you sure you want to link all variations? This will create a new variation for each and every possible combination of variation attributes (max %d per run).', 'woocommerce' ), defined( 'WC_MAX_LINKED_VARIATIONS' ) ? WC_MAX_LINKED_VARIATIONS : 50 ) ),
+ 'i18n_link_all_variations' => esc_js( sprintf( __( 'Are you sure you want to link all variations? This will create a new variation for each and every possible combination of variation attributes (max %d per run).', 'woocommerce' ), Constants::is_defined( 'WC_MAX_LINKED_VARIATIONS' ) ? Constants::get_constant( 'WC_MAX_LINKED_VARIATIONS' ) : 50 ) ),
'i18n_enter_a_value' => esc_js( __( 'Enter a value', 'woocommerce' ) ),
'i18n_enter_menu_order' => esc_js( __( 'Variation menu order (determines position in the list of variations)', 'woocommerce' ) ),
'i18n_enter_a_value_fixed_or_percent' => esc_js( __( 'Enter a value (fixed or %)', 'woocommerce' ) ),
@@ -259,7 +263,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
if ( in_array( str_replace( 'edit-', '', $screen_id ), wc_get_order_types( 'order-meta-boxes' ) ) ) {
$default_location = wc_get_customer_default_location();
- wp_enqueue_script( 'wc-admin-order-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-order' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'wc-backbone-modal', 'selectWoo', 'wc-clipboard' ), WC_VERSION );
+ wp_enqueue_script( 'wc-admin-order-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-order' . $suffix . '.js', array( 'wc-admin-meta-boxes', 'wc-backbone-modal', 'selectWoo', 'wc-clipboard' ), $version );
wp_localize_script(
'wc-admin-order-meta-boxes',
'woocommerce_admin_meta_boxes_order',
@@ -274,7 +278,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
);
}
if ( in_array( $screen_id, array( 'shop_coupon', 'edit-shop_coupon' ) ) ) {
- wp_enqueue_script( 'wc-admin-coupon-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-coupon' . $suffix . '.js', array( 'wc-admin-meta-boxes' ), WC_VERSION );
+ wp_enqueue_script( 'wc-admin-coupon-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-coupon' . $suffix . '.js', array( 'wc-admin-meta-boxes' ), $version );
wp_localize_script(
'wc-admin-coupon-meta-boxes',
'woocommerce_admin_meta_boxes_coupon',
@@ -365,7 +369,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
// Term ordering - only when sorting by term_order.
if ( ( strstr( $screen_id, 'edit-pa_' ) || ( ! empty( $_GET['taxonomy'] ) && in_array( wp_unslash( $_GET['taxonomy'] ), apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) ) && ! isset( $_GET['orderby'] ) ) {
- wp_register_script( 'woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering' . $suffix . '.js', array( 'jquery-ui-sortable' ), WC_VERSION );
+ wp_register_script( 'woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering' . $suffix . '.js', array( 'jquery-ui-sortable' ), $version );
wp_enqueue_script( 'woocommerce_term_ordering' );
$taxonomy = isset( $_GET['taxonomy'] ) ? wc_clean( wp_unslash( $_GET['taxonomy'] ) ) : '';
@@ -379,13 +383,13 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
// Product sorting - only when sorting by menu order on the products page.
if ( current_user_can( 'edit_others_pages' ) && 'edit-product' === $screen_id && isset( $wp_query->query['orderby'] ) && 'menu_order title' === $wp_query->query['orderby'] ) {
- wp_register_script( 'woocommerce_product_ordering', WC()->plugin_url() . '/assets/js/admin/product-ordering' . $suffix . '.js', array( 'jquery-ui-sortable' ), WC_VERSION, true );
+ wp_register_script( 'woocommerce_product_ordering', WC()->plugin_url() . '/assets/js/admin/product-ordering' . $suffix . '.js', array( 'jquery-ui-sortable' ), $version, true );
wp_enqueue_script( 'woocommerce_product_ordering' );
}
// Reports Pages.
if ( in_array( $screen_id, apply_filters( 'woocommerce_reports_screen_ids', array( $wc_screen_id . '_page_wc-reports', 'toplevel_page_wc-reports', 'dashboard' ) ) ) ) {
- wp_register_script( 'wc-reports', WC()->plugin_url() . '/assets/js/admin/reports' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker' ), WC_VERSION );
+ wp_register_script( 'wc-reports', WC()->plugin_url() . '/assets/js/admin/reports' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker' ), $version );
wp_enqueue_script( 'wc-reports' );
wp_enqueue_script( 'flot' );
@@ -397,7 +401,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
// API settings.
if ( $wc_screen_id . '_page_wc-settings' === $screen_id && isset( $_GET['section'] ) && 'keys' == $_GET['section'] ) {
- wp_register_script( 'wc-api-keys', WC()->plugin_url() . '/assets/js/admin/api-keys' . $suffix . '.js', array( 'jquery', 'woocommerce_admin', 'underscore', 'backbone', 'wp-util', 'qrcode', 'wc-clipboard' ), WC_VERSION, true );
+ wp_register_script( 'wc-api-keys', WC()->plugin_url() . '/assets/js/admin/api-keys' . $suffix . '.js', array( 'jquery', 'woocommerce_admin', 'underscore', 'backbone', 'wp-util', 'qrcode', 'wc-clipboard' ), $version, true );
wp_enqueue_script( 'wc-api-keys' );
wp_localize_script(
'wc-api-keys',
@@ -412,7 +416,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
// System status.
if ( $wc_screen_id . '_page_wc-status' === $screen_id ) {
- wp_register_script( 'wc-admin-system-status', WC()->plugin_url() . '/assets/js/admin/system-status' . $suffix . '.js', array( 'wc-clipboard' ), WC_VERSION );
+ wp_register_script( 'wc-admin-system-status', WC()->plugin_url() . '/assets/js/admin/system-status' . $suffix . '.js', array( 'wc-clipboard' ), $version );
wp_enqueue_script( 'wc-admin-system-status' );
wp_localize_script(
'wc-admin-system-status',
@@ -424,7 +428,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
}
if ( in_array( $screen_id, array( 'user-edit', 'profile' ) ) ) {
- wp_register_script( 'wc-users', WC()->plugin_url() . '/assets/js/admin/users' . $suffix . '.js', array( 'jquery', 'wc-enhanced-select', 'selectWoo' ), WC_VERSION, true );
+ wp_register_script( 'wc-users', WC()->plugin_url() . '/assets/js/admin/users' . $suffix . '.js', array( 'jquery', 'wc-enhanced-select', 'selectWoo' ), $version, true );
wp_enqueue_script( 'wc-users' );
wp_localize_script(
'wc-users',
@@ -442,7 +446,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
'marketplace-suggestions',
WC()->plugin_url() . '/assets/js/admin/marketplace-suggestions' . $suffix . '.js',
array( 'jquery', 'underscore', 'js-cookie' ),
- WC_VERSION,
+ $version,
true
);
wp_localize_script(
diff --git a/includes/admin/class-wc-admin-dashboard.php b/includes/admin/class-wc-admin-dashboard.php
index 33621090e1d..9b5ef4941b3 100644
--- a/includes/admin/class-wc-admin-dashboard.php
+++ b/includes/admin/class-wc-admin-dashboard.php
@@ -6,6 +6,8 @@
* @version 2.1.0
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
@@ -322,11 +324,12 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
* Network orders widget.
*/
public function network_orders() {
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+ $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min';
+ $version = Constants::get_constant( 'WC_VERSION' );
- wp_enqueue_style( 'wc-network-orders', WC()->plugin_url() . '/assets/css/network-order-widget.css', array(), WC_VERSION );
+ wp_enqueue_style( 'wc-network-orders', WC()->plugin_url() . '/assets/css/network-order-widget.css', array(), $version );
- wp_enqueue_script( 'wc-network-orders', WC()->plugin_url() . '/assets/js/admin/network-orders' . $suffix . '.js', array( 'jquery', 'underscore' ), WC_VERSION, true );
+ wp_enqueue_script( 'wc-network-orders', WC()->plugin_url() . '/assets/js/admin/network-orders' . $suffix . '.js', array( 'jquery', 'underscore' ), $version, true );
$user = wp_get_current_user();
$blogs = get_blogs_of_user( $user->ID );
diff --git a/includes/admin/class-wc-admin-exporters.php b/includes/admin/class-wc-admin-exporters.php
index be599f7db2d..011d2e1429e 100644
--- a/includes/admin/class-wc-admin-exporters.php
+++ b/includes/admin/class-wc-admin-exporters.php
@@ -6,6 +6,8 @@
* @version 3.1.0
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -84,8 +86,9 @@ class WC_Admin_Exporters {
* Enqueue scripts.
*/
public function admin_scripts() {
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
- wp_register_script( 'wc-product-export', WC()->plugin_url() . '/assets/js/admin/wc-product-export' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
+ $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min';
+ $version = Constants::get_constant( 'WC_VERSION' );
+ wp_register_script( 'wc-product-export', WC()->plugin_url() . '/assets/js/admin/wc-product-export' . $suffix . '.js', array( 'jquery' ), $version );
wp_localize_script(
'wc-product-export',
'wc_product_export_params',
diff --git a/includes/admin/class-wc-admin-importers.php b/includes/admin/class-wc-admin-importers.php
index 65c477e546d..8f85ad27b60 100644
--- a/includes/admin/class-wc-admin-importers.php
+++ b/includes/admin/class-wc-admin-importers.php
@@ -5,6 +5,8 @@
* @package WooCommerce/Admin
*/
+use Automattic\Jetpack\Constants;
+
defined( 'ABSPATH' ) || exit;
/**
@@ -81,8 +83,9 @@ class WC_Admin_Importers {
* Register importer scripts.
*/
public function admin_scripts() {
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
- wp_register_script( 'wc-product-import', WC()->plugin_url() . '/assets/js/admin/wc-product-import' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );
+ $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min';
+ $version = Constants::get_constant( 'WC_VERSION' );
+ wp_register_script( 'wc-product-import', WC()->plugin_url() . '/assets/js/admin/wc-product-import' . $suffix . '.js', array( 'jquery' ), $version, true );
}
/**
@@ -92,7 +95,7 @@ class WC_Admin_Importers {
* If we're on that screen, redirect to the custom one.
*/
public function product_importer() {
- if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
+ if ( Constants::is_defined( 'WP_LOAD_IMPORTERS' ) ) {
wp_safe_redirect( admin_url( 'edit.php?post_type=product&page=product_importer' ) );
exit;
}
@@ -108,7 +111,7 @@ class WC_Admin_Importers {
* Register WordPress based importers.
*/
public function register_importers() {
- if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
+ if ( Constants::is_defined( 'WP_LOAD_IMPORTERS' ) ) {
add_action( 'import_start', array( $this, 'post_importer_compatibility' ) );
register_importer( 'woocommerce_product_csv', __( 'WooCommerce products (CSV)', 'woocommerce' ), __( 'Import products to your store via a csv file.', 'woocommerce' ), array( $this, 'product_importer' ) );
register_importer( 'woocommerce_tax_rate_csv', __( 'WooCommerce tax rates (CSV)', 'woocommerce' ), __( 'Import tax rates to your store via a csv file.', 'woocommerce' ), array( $this, 'tax_rates_importer' ) );
diff --git a/includes/admin/class-wc-admin-meta-boxes.php b/includes/admin/class-wc-admin-meta-boxes.php
index 89ec46dd3ae..dd50c90d3a5 100644
--- a/includes/admin/class-wc-admin-meta-boxes.php
+++ b/includes/admin/class-wc-admin-meta-boxes.php
@@ -7,6 +7,8 @@
* @package WooCommerce/Admin/Meta Boxes
*/
+use Automattic\Jetpack\Constants;
+
defined( 'ABSPATH' ) || exit;
/**
@@ -188,7 +190,7 @@ class WC_Admin_Meta_Boxes {
}
// Dont' save meta boxes for revisions or autosaves.
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
+ if ( Constants::is_true( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
return;
}
diff --git a/includes/admin/class-wc-admin-notices.php b/includes/admin/class-wc-admin-notices.php
index 76ba356bd6c..9f4a1869a44 100644
--- a/includes/admin/class-wc-admin-notices.php
+++ b/includes/admin/class-wc-admin-notices.php
@@ -6,6 +6,8 @@
* @version 3.4.0
*/
+use Automattic\Jetpack\Constants;
+
defined( 'ABSPATH' ) || exit;
/**
@@ -34,7 +36,6 @@ class WC_Admin_Notices {
'regenerating_thumbnails' => 'regenerating_thumbnails_notice',
'regenerating_lookup_table' => 'regenerating_lookup_table_notice',
'no_secure_connection' => 'secure_connection_notice',
- 'wc_admin' => 'wc_admin_feature_plugin_notice',
WC_PHP_MIN_REQUIREMENTS_NOTICE => 'wp_php_min_requirements_notice',
'maxmind_license_key' => 'maxmind_missing_license_key_notice',
);
@@ -85,7 +86,6 @@ class WC_Admin_Notices {
if ( ! self::is_ssl() ) {
self::add_notice( 'no_secure_connection' );
}
- self::add_wc_admin_feature_plugin_notice();
self::add_notice( 'template_files' );
self::add_min_version_notice();
self::add_maxmind_missing_license_key_notice();
@@ -166,7 +166,7 @@ class WC_Admin_Notices {
return;
}
- wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ), array(), WC_VERSION );
+ wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ), array(), Constants::get_constant( 'WC_VERSION' ) );
// Add RTL support.
wp_style_add_data( 'woocommerce-activation', 'rtl', 'replace' );
@@ -347,34 +347,6 @@ class WC_Admin_Notices {
include dirname( __FILE__ ) . '/views/html-notice-regenerating-lookup-table.php';
}
-
- /**
- * If on WordPress 5.0 or greater, inform users of WooCommerce Admin feature plugin.
- *
- * @since 3.6.4
- * @todo Remove this notice and associated code once the feature plugin has been merged into core.
- */
- public static function add_wc_admin_feature_plugin_notice() {
- if ( version_compare( get_bloginfo( 'version' ), '5.0', '>=' ) ) {
- self::add_notice( 'wc_admin' );
- }
- }
-
- /**
- * Notice to try WooCommerce Admin
- *
- * @since 3.6.4
- * @todo Remove this notice and associated code once the feature plugin has been merged into core.
- */
- public static function wc_admin_feature_plugin_notice() {
- if ( get_user_meta( get_current_user_id(), 'dismissed_wc_admin_notice', true ) || class_exists( 'Automattic\WooCommerce\Admin\FeaturePlugin' ) ) {
- self::remove_notice( 'wc_admin' );
- return;
- }
-
- include dirname( __FILE__ ) . '/views/html-notice-wc-admin.php';
- }
-
/**
* Add notice about minimum PHP and WordPress requirement.
*
diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php
index 99d3c6b6ccd..21430ad4fcd 100644
--- a/includes/admin/class-wc-admin-post-types.php
+++ b/includes/admin/class-wc-admin-post-types.php
@@ -6,6 +6,8 @@
* @version 3.3.0
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -294,7 +296,7 @@ class WC_Admin_Post_Types {
*/
public function bulk_and_quick_edit_save_post( $post_id, $post ) {
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
+ if ( Constants::is_true( 'DOING_AUTOSAVE' ) ) {
return $post_id;
}
diff --git a/includes/admin/class-wc-admin-profile.php b/includes/admin/class-wc-admin-profile.php
index 5686e3837ee..9aafac10e2d 100644
--- a/includes/admin/class-wc-admin-profile.php
+++ b/includes/admin/class-wc-admin-profile.php
@@ -71,11 +71,11 @@ if ( ! class_exists( 'WC_Admin_Profile', false ) ) :
'description' => '',
),
'billing_country' => array(
- 'label' => __( 'Country', 'woocommerce' ),
+ 'label' => __( 'Country / Region', 'woocommerce' ),
'description' => '',
'class' => 'js_field-country',
'type' => 'select',
- 'options' => array( '' => __( 'Select a country…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
+ 'options' => array( '' => __( 'Select a country / region…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'billing_state' => array(
'label' => __( 'State / County', 'woocommerce' ),
@@ -131,11 +131,11 @@ if ( ! class_exists( 'WC_Admin_Profile', false ) ) :
'description' => '',
),
'shipping_country' => array(
- 'label' => __( 'Country', 'woocommerce' ),
+ 'label' => __( 'Country / Region', 'woocommerce' ),
'description' => '',
'class' => 'js_field-country',
'type' => 'select',
- 'options' => array( '' => __( 'Select a country…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
+ 'options' => array( '' => __( 'Select a country / region…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'shipping_state' => array(
'label' => __( 'State / County', 'woocommerce' ),
diff --git a/includes/admin/class-wc-admin-settings.php b/includes/admin/class-wc-admin-settings.php
index 63587f17fb2..837ffbc8230 100644
--- a/includes/admin/class-wc-admin-settings.php
+++ b/includes/admin/class-wc-admin-settings.php
@@ -6,6 +6,8 @@
* @version 3.4.0
*/
+use Automattic\Jetpack\Constants;
+
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -128,7 +130,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
public static function output() {
global $current_section, $current_tab;
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+ $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min';
do_action( 'woocommerce_settings_start' );
@@ -141,7 +143,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ),
'i18n_moved_up' => __( 'Item moved up', 'woocommerce' ),
'i18n_moved_down' => __( 'Item moved down', 'woocommerce' ),
- 'i18n_no_specific_countries_selected' => __( 'Selecting no country to sell to prevents from completing the checkout. Continue anyway?', 'woocommerce' ),
+ 'i18n_no_specific_countries_selected' => __( 'Selecting no country / region to sell to prevents from completing the checkout. Continue anyway?', 'woocommerce' ),
)
);
@@ -594,7 +596,7 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
- |