Skip to content

Commit

Permalink
Merge pull request #105 from WebDevStudios/sprint/20.05
Browse files Browse the repository at this point in the history
Merge sprint/20.05 to master for release
  • Loading branch information
richaber authored Jun 10, 2020
2 parents c84a948 + 848d433 commit d119bee
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
21 changes: 21 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
21 changes: 9 additions & 12 deletions src/Settings/SettingsValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace WebDevStudios\CCForWoo\Settings;

use WebDevStudios\CCForWoo\Utility\Validatable;
use WC_Validation;

/**
* Class SettingsValidator
Expand Down Expand Up @@ -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 <zach@webdevstudios>
*
* @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;
}

/**
Expand Down
9 changes: 7 additions & 2 deletions src/View/Admin/WooTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <zach@webdevstudios>
Expand All @@ -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 );
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d119bee

Please sign in to comment.