Version Description
- Fix - Remove nuisance admin notification.
Download this release
Release Info
| Developer | cshultz88 |
| Plugin | |
| Version | 1.22.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.22.0 to 1.22.1
classes/class-wc-connect-shipping-label.php
CHANGED
|
@@ -27,12 +27,12 @@ if ( ! class_exists( 'WC_Connect_Shipping_Label' ) ) {
|
|
| 27 |
/**
|
| 28 |
* @var array Supported countries by USPS, see: https://webpmt.usps.gov/pmt010.cfm
|
| 29 |
*/
|
| 30 |
-
private
|
| 31 |
|
| 32 |
/**
|
| 33 |
* @var array Supported currencies
|
| 34 |
*/
|
| 35 |
-
private
|
| 36 |
|
| 37 |
private $show_metabox = null;
|
| 38 |
|
|
@@ -292,12 +292,12 @@ if ( ! class_exists( 'WC_Connect_Shipping_Label' ) ) {
|
|
| 292 |
return $form_data;
|
| 293 |
}
|
| 294 |
|
| 295 |
-
|
| 296 |
-
return in_array( $country_code,
|
| 297 |
}
|
| 298 |
|
| 299 |
-
|
| 300 |
-
return in_array( $currency_code,
|
| 301 |
}
|
| 302 |
|
| 303 |
public function should_show_meta_box() {
|
|
@@ -322,12 +322,12 @@ if ( ! class_exists( 'WC_Connect_Shipping_Label' ) ) {
|
|
| 322 |
|
| 323 |
// Restrict showing the metabox to supported store currencies.
|
| 324 |
$base_currency = get_woocommerce_currency();
|
| 325 |
-
if ( !
|
| 326 |
return false;
|
| 327 |
}
|
| 328 |
|
| 329 |
$base_location = wc_get_base_location();
|
| 330 |
-
if ( !
|
| 331 |
return false;
|
| 332 |
}
|
| 333 |
|
| 27 |
/**
|
| 28 |
* @var array Supported countries by USPS, see: https://webpmt.usps.gov/pmt010.cfm
|
| 29 |
*/
|
| 30 |
+
private $supported_countries = array( 'US', 'AS', 'PR', 'VI', 'GU', 'MP', 'UM', 'FM', 'MH' );
|
| 31 |
|
| 32 |
/**
|
| 33 |
* @var array Supported currencies
|
| 34 |
*/
|
| 35 |
+
private $supported_currencies = array( 'USD' );
|
| 36 |
|
| 37 |
private $show_metabox = null;
|
| 38 |
|
| 292 |
return $form_data;
|
| 293 |
}
|
| 294 |
|
| 295 |
+
private function is_supported_country( $country_code ) {
|
| 296 |
+
return in_array( $country_code, $this->supported_countries );
|
| 297 |
}
|
| 298 |
|
| 299 |
+
private function is_supported_currency( $currency_code ) {
|
| 300 |
+
return in_array( $currency_code, $this->supported_currencies );
|
| 301 |
}
|
| 302 |
|
| 303 |
public function should_show_meta_box() {
|
| 322 |
|
| 323 |
// Restrict showing the metabox to supported store currencies.
|
| 324 |
$base_currency = get_woocommerce_currency();
|
| 325 |
+
if ( ! $this->is_supported_currency( $base_currency ) ) {
|
| 326 |
return false;
|
| 327 |
}
|
| 328 |
|
| 329 |
$base_location = wc_get_base_location();
|
| 330 |
+
if ( ! $this->is_supported_country( $base_location['country'] ) ) {
|
| 331 |
return false;
|
| 332 |
}
|
| 333 |
|
i18n/languages/woocommerce-services.pot
CHANGED
|
@@ -4,7 +4,7 @@ msgid ""
|
|
| 4 |
msgstr ""
|
| 5 |
"Project-Id-Version: _s woocommerce-services\n"
|
| 6 |
"Report-Msgid-Bugs-To: \n"
|
| 7 |
-
"POT-Creation-Date: 2019-11-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 4 |
msgstr ""
|
| 5 |
"Project-Id-Version: _s woocommerce-services\n"
|
| 6 |
"Report-Msgid-Bugs-To: \n"
|
| 7 |
+
"POT-Creation-Date: 2019-11-14T20:21:21.366Z\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Tags: shipping, stamps, usps, woocommerce, taxes, payment, stripe
|
|
| 4 |
Requires at least: 4.6
|
| 5 |
Requires PHP: 5.3
|
| 6 |
Tested up to: 5.3
|
| 7 |
-
Stable tag: 1.22.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -83,6 +83,9 @@ As of the WooCommerce 3.5 release, WooCommerce Services no longer provides shipp
|
|
| 83 |
|
| 84 |
== Changelog ==
|
| 85 |
|
|
|
|
|
|
|
|
|
|
| 86 |
= 1.22.0 =
|
| 87 |
|
| 88 |
* Add - Display notices when base country/currency mismatches.
|
| 4 |
Requires at least: 4.6
|
| 5 |
Requires PHP: 5.3
|
| 6 |
Tested up to: 5.3
|
| 7 |
+
Stable tag: 1.22.1
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 83 |
|
| 84 |
== Changelog ==
|
| 85 |
|
| 86 |
+
= 1.22.1 =
|
| 87 |
+
* Fix - Remove nuisance admin notification.
|
| 88 |
+
|
| 89 |
= 1.22.0 =
|
| 90 |
|
| 91 |
* Add - Display notices when base country/currency mismatches.
|
woocommerce-services.php
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
* Author URI: https://woocommerce.com/
|
| 8 |
* Text Domain: woocommerce-services
|
| 9 |
* Domain Path: /i18n/languages/
|
| 10 |
-
* Version: 1.22.
|
| 11 |
* WC requires at least: 3.0.0
|
| 12 |
* WC tested up to: 3.8
|
| 13 |
*
|
|
@@ -209,34 +209,6 @@ if ( ! class_exists( 'WC_Connect_Loader' ) ) {
|
|
| 209 |
return set_url_scheme( $url );
|
| 210 |
}
|
| 211 |
|
| 212 |
-
/**
|
| 213 |
-
* environment_check function.
|
| 214 |
-
*
|
| 215 |
-
* @return void
|
| 216 |
-
*/
|
| 217 |
-
public function environment_check() {
|
| 218 |
-
if ( ! current_user_can( 'manage_woocommerce' ) ) {
|
| 219 |
-
return;
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
$admin_page = 'wc-settings';
|
| 223 |
-
|
| 224 |
-
$base_currency = get_woocommerce_currency();
|
| 225 |
-
$base_location = wc_get_base_location();
|
| 226 |
-
|
| 227 |
-
if ( ! WC_Connect_Shipping_Label::is_supported_currency( $base_currency ) ) {
|
| 228 |
-
echo '<div class="error">
|
| 229 |
-
<p>' . sprintf( __( 'WooCommerce Services requires that the <a href="%s">currency</a> is set to US Dollars.', 'woocommerce-services' ), admin_url( 'admin.php?page=' . $admin_page . '&tab=general' ) ) . '</p>
|
| 230 |
-
</div>';
|
| 231 |
-
}
|
| 232 |
-
|
| 233 |
-
if ( ! WC_Connect_Shipping_Label::is_supported_country( $base_location['country'] ) ) {
|
| 234 |
-
echo '<div class="error">
|
| 235 |
-
<p>' . sprintf( __( 'WooCommerce Services requires that the <a href="%s">base country/region</a> is the United States.', 'woocommerce-services' ), admin_url( 'admin.php?page=' . $admin_page . '&tab=general' ) ) . '</p>
|
| 236 |
-
</div>';
|
| 237 |
-
}
|
| 238 |
-
}
|
| 239 |
-
|
| 240 |
public function __construct() {
|
| 241 |
$this->wc_connect_base_url = trailingslashit( defined( 'WOOCOMMERCE_CONNECT_DEV_SERVER_URL' ) ? WOOCOMMERCE_CONNECT_DEV_SERVER_URL : plugins_url( 'dist/', __FILE__ ) );
|
| 242 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
|
@@ -697,7 +669,6 @@ if ( ! class_exists( 'WC_Connect_Loader' ) ) {
|
|
| 697 |
$this->set_help_view( new WC_Connect_Help_View( $schema, $settings, $logger ) );
|
| 698 |
add_action( 'admin_notices', array( WC_Connect_Error_Notice::instance(), 'render_notice' ) );
|
| 699 |
add_action( 'admin_notices', array( $this, 'render_schema_notices' ) );
|
| 700 |
-
add_action( 'admin_notices', array( $this, 'environment_check' ) );
|
| 701 |
}
|
| 702 |
|
| 703 |
/**
|
| 7 |
* Author URI: https://woocommerce.com/
|
| 8 |
* Text Domain: woocommerce-services
|
| 9 |
* Domain Path: /i18n/languages/
|
| 10 |
+
* Version: 1.22.1
|
| 11 |
* WC requires at least: 3.0.0
|
| 12 |
* WC tested up to: 3.8
|
| 13 |
*
|
| 209 |
return set_url_scheme( $url );
|
| 210 |
}
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
public function __construct() {
|
| 213 |
$this->wc_connect_base_url = trailingslashit( defined( 'WOOCOMMERCE_CONNECT_DEV_SERVER_URL' ) ? WOOCOMMERCE_CONNECT_DEV_SERVER_URL : plugins_url( 'dist/', __FILE__ ) );
|
| 214 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
| 669 |
$this->set_help_view( new WC_Connect_Help_View( $schema, $settings, $logger ) );
|
| 670 |
add_action( 'admin_notices', array( WC_Connect_Error_Notice::instance(), 'render_notice' ) );
|
| 671 |
add_action( 'admin_notices', array( $this, 'render_schema_notices' ) );
|
|
|
|
| 672 |
}
|
| 673 |
|
| 674 |
/**
|
