Skip to content

Commit d119bee

Browse files
authored
Merge pull request #105 from WebDevStudios/sprint/20.05
Merge sprint/20.05 to master for release
2 parents c84a948 + 848d433 commit d119bee

File tree

3 files changed

+37
-14
lines changed

3 files changed

+37
-14
lines changed

README.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ With Constant Contact you can:
4141
3. Pre-filtered segmented lists.
4242
4. Syncing status for contacts.
4343

44+
== Frequently Asked Questions ==
45+
46+
#### Overall WooCommerce and Constant Contact Guide
47+
[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)
48+
49+
#### How to Sync Contacts between WooCommerce and Constant Contact
50+
[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)
51+
52+
#### How to use the Product Block to insert WooCommerce Products to an Email
53+
[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)
54+
55+
#### How to Create an Automated Abandoned Cart Reminder Email for WooCommerce
56+
Customers
57+
[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)
58+
59+
#### VIDEO Tutorial: Create an Automated WooCommerce Abandoned Cart Email
60+
[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)
61+
62+
#### View WooCommerce Sales and Recovered Revenue Reporting
63+
[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)
64+
4465
== Changelog ==
4566

4667
= 1.3.1 =

src/Settings/SettingsValidator.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace WebDevStudios\CCForWoo\Settings;
1313

1414
use WebDevStudios\CCForWoo\Utility\Validatable;
15+
use WC_Validation;
1516

1617
/**
1718
* Class SettingsValidator
@@ -94,21 +95,17 @@ private function has_valid_email() {
9495
/**
9596
* Verify that the phone number is valid.
9697
*
97-
* @since 2019-03-08
98+
* @since 2019-03-08
9899
* @author Zach Owen <zach@webdevstudios>
100+
*
101+
* @uses WC_Validation::is_phone()
102+
*
99103
* @return bool
100104
*/
101-
private function has_valid_phone() {
102-
$phone_number = $this->settings->get_phone_number();
103-
104-
if ( '+' === substr( $phone_number, 0, 1 ) ) {
105-
$phone_number = substr( $phone_number, 1 );
106-
}
107-
108-
preg_match( '/^[\d\-()]/', $phone_number, $matches );
109-
preg_match( '/[^\d\-()]/', $phone_number, $invalid_matches );
110-
111-
return ! empty( $matches[0] ) && empty( $invalid_matches );
105+
private function has_valid_phone(): bool {
106+
return ! empty( $this->settings->get_phone_number() )
107+
? WC_Validation::is_phone( $this->settings->get_phone_number() )
108+
: false;
112109
}
113110

114111
/**

src/View/Admin/WooTab.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ private function validate_value( $field ) {
711711
}
712712

713713
/**
714-
* Sanitize the phone number to only include digits, -, and (, )
714+
* Sanitize incoming phone number.
715715
*
716716
* @since 2019-03-08
717717
* @author Zach Owen <zach@webdevstudios>
@@ -721,7 +721,7 @@ private function validate_value( $field ) {
721721
* @return string
722722
*/
723723
public function sanitize_phone_number( $value ) {
724-
return is_scalar( $value ) ? preg_replace( '/[^\d\-()+]+/', '', $value ) : '';
724+
return wc_sanitize_phone_number( $value );
725725
}
726726

727727
/**
@@ -836,6 +836,11 @@ public function display_anti_spam_notice() {
836836
public function save() {
837837
parent::save();
838838

839+
// Prevent redirect to customer_data_import screen if we don't meet connection requirements.
840+
if ( ! $this->meets_connect_requirements() ) {
841+
return;
842+
}
843+
839844
if ( $this->connection->is_connected() || $this->has_active_settings_section() ) {
840845
return;
841846
}

0 commit comments

Comments
 (0)