diff --git a/README.txt b/README.txt index 372f107c..3c3a232d 100644 --- a/README.txt +++ b/README.txt @@ -41,6 +41,27 @@ With Constant Contact you can: 3. Pre-filtered segmented lists. 4. Syncing status for contacts. +== Frequently Asked Questions == + +#### Overall WooCommerce and Constant Contact Guide +[https://knowledgebase.constantcontact.com/guides/KnowledgeBase/34383-Guide-Constant-Contact-and-WooCommerce?q=woocommerce*&lang=en_US](https://knowledgebase.constantcontact.com/guides/KnowledgeBase/34383-Guide-Constant-Contact-and-WooCommerce?q=woocommerce*&lang=en_US) + +#### How to Sync Contacts between WooCommerce and Constant Contact +[https://knowledgebase.constantcontact.com/articles/KnowledgeBase/33143-Sync-Contacts-Between-Your-WooCommerce-Store-and-Constant-Contact?q=woocommerce*&lang=en_US](https://knowledgebase.constantcontact.com/articles/KnowledgeBase/33143-Sync-Contacts-Between-Your-WooCommerce-Store-and-Constant-Contact?q=woocommerce*&lang=en_US) + +#### How to use the Product Block to insert WooCommerce Products to an Email +[https://knowledgebase.constantcontact.com/articles/KnowledgeBase/33144-Add-Products-from-a-WooCommerce-Store-to-an-Email?q=woocommerce*&lang=en_US](https://knowledgebase.constantcontact.com/articles/KnowledgeBase/33144-Add-Products-from-a-WooCommerce-Store-to-an-Email?q=woocommerce*&lang=en_US) + +#### How to Create an Automated Abandoned Cart Reminder Email for WooCommerce +Customers +[https://knowledgebase.constantcontact.com/articles/KnowledgeBase/36890-Create-an-Automated-Abandoned-Cart-Reminder-Email-for-WooCommerce-Customers?q=woocommerce*&lang=en_US](https://knowledgebase.constantcontact.com/articles/KnowledgeBase/36890-Create-an-Automated-Abandoned-Cart-Reminder-Email-for-WooCommerce-Customers?q=woocommerce*&lang=en_US) + +#### VIDEO Tutorial: Create an Automated WooCommerce Abandoned Cart Email +[https://knowledgebase.constantcontact.com/tutorials/KnowledgeBase/37409-Tutorial-Create-an-Automated-WooCommerce-Abandoned-Cart-Email?q=woocommerce*&lang=en_US](https://knowledgebase.constantcontact.com/tutorials/KnowledgeBase/37409-Tutorial-Create-an-Automated-WooCommerce-Abandoned-Cart-Email?q=woocommerce*&lang=en_US) + +#### View WooCommerce Sales and Recovered Revenue Reporting +[https://knowledgebase.constantcontact.com/articles/KnowledgeBase/36892-View-Recovered-Revenue-from-the-WooCommerce-Abandoned-Cart-Reminder-Email?q=woocommerce*&lang=en_US](https://knowledgebase.constantcontact.com/articles/KnowledgeBase/36892-View-Recovered-Revenue-from-the-WooCommerce-Abandoned-Cart-Reminder-Email?q=woocommerce*&lang=en_US) + == Changelog == = 1.3.1 = diff --git a/src/Settings/SettingsValidator.php b/src/Settings/SettingsValidator.php index 179270bb..537b4574 100644 --- a/src/Settings/SettingsValidator.php +++ b/src/Settings/SettingsValidator.php @@ -12,6 +12,7 @@ namespace WebDevStudios\CCForWoo\Settings; use WebDevStudios\CCForWoo\Utility\Validatable; +use WC_Validation; /** * Class SettingsValidator @@ -94,21 +95,17 @@ private function has_valid_email() { /** * Verify that the phone number is valid. * - * @since 2019-03-08 + * @since 2019-03-08 * @author Zach Owen + * + * @uses WC_Validation::is_phone() + * * @return bool */ - private function has_valid_phone() { - $phone_number = $this->settings->get_phone_number(); - - if ( '+' === substr( $phone_number, 0, 1 ) ) { - $phone_number = substr( $phone_number, 1 ); - } - - preg_match( '/^[\d\-()]/', $phone_number, $matches ); - preg_match( '/[^\d\-()]/', $phone_number, $invalid_matches ); - - return ! empty( $matches[0] ) && empty( $invalid_matches ); + private function has_valid_phone(): bool { + return ! empty( $this->settings->get_phone_number() ) + ? WC_Validation::is_phone( $this->settings->get_phone_number() ) + : false; } /** diff --git a/src/View/Admin/WooTab.php b/src/View/Admin/WooTab.php index f0f8dd76..635db23c 100644 --- a/src/View/Admin/WooTab.php +++ b/src/View/Admin/WooTab.php @@ -711,7 +711,7 @@ private function validate_value( $field ) { } /** - * Sanitize the phone number to only include digits, -, and (, ) + * Sanitize incoming phone number. * * @since 2019-03-08 * @author Zach Owen @@ -721,7 +721,7 @@ private function validate_value( $field ) { * @return string */ public function sanitize_phone_number( $value ) { - return is_scalar( $value ) ? preg_replace( '/[^\d\-()+]+/', '', $value ) : ''; + return wc_sanitize_phone_number( $value ); } /** @@ -836,6 +836,11 @@ public function display_anti_spam_notice() { public function save() { parent::save(); + // Prevent redirect to customer_data_import screen if we don't meet connection requirements. + if ( ! $this->meets_connect_requirements() ) { + return; + } + if ( $this->connection->is_connected() || $this->has_active_settings_section() ) { return; }