Skip to content

Commit fc60419

Browse files
committed
merge in latest master branch, fix typo
2 parents af4a2a9 + e730f93 commit fc60419

File tree

7 files changed

+123
-15
lines changed

7 files changed

+123
-15
lines changed

README.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== Constant Contact + WooCommerce ===
22
Contributors: constantcontact, znowebdev, jmichaelward, webdevstudios
33
Tags: capture, contacts, constant contact, constant contact form, constant contact newsletter, constant contact official, contact forms, email, form, forms, marketing, mobile, newsletter, opt-in, plugin, signup, subscribe, subscription, widget
4-
Requires at least: 5.1.1
5-
Tested up to: 5.1.1
6-
Stable tag: 1.0.0
4+
Requires at least: 5.2.2
5+
Tested up to: 5.2.3
6+
Stable tag: 1.1.0
77
Requires PHP: 7.2
88
WC tested up to: 3.5.6
99
License: GPLv3
@@ -20,7 +20,6 @@ and send targeted emails that engage your customers on every device.
2020

2121
Unleash the power of your business—and drive more revenue—by integrating Constant Contact with WooCommerce today.
2222

23-
2423
With Constant Contact you can:
2524
- Drag and drop products from your store into any email and customize the details.
2625
- Automatically import WooCommere contacts into your Constant Contact account.
@@ -33,3 +32,11 @@ With Constant Contact you can:
3332
--- Prospects: Have not made a purchase yet
3433
- Send automated welcome emails and behavior based trigger emails
3534
- Find new customers with Facebook and Instagram ads
35+
36+
== Changelog ==
37+
38+
= 1.1.0 =
39+
40+
* Added: Campaign ID data inclusion for purchased orders originating from your mailing campaigns.
41+
* Fixed: compatibility issue with phone numbers and PHP 7.3
42+
* Updated: Wording in our WooCommerce tab.

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Plugin Name: Constant Contact + WooCommerce
1111
* Description: Add products to your emails and sync your contacts.
1212
* Plugin URI: https://github.com/WebDevStudios/constant-contact-woocommerce
13-
* Version: 1.0.0
13+
* Version: 1.1.0
1414
* Author: Constant Contact
1515
* Author URI: https://www.constantcontact.com/
1616
* Text Domain: cc-woo

src/AbandonedCarts/CartHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ public function update_cart_data() {
8383
$customer_data['billing'] = array_merge( $customer_data['billing'], WC()->customer->get_billing() );
8484
$customer_data['shipping'] = array_merge( $customer_data['shipping'], WC()->customer->get_shipping() );
8585

86-
write_log( $_POST, 'posted' );
87-
8886
// Check if submission attempted.
8987
if ( isset( $_POST['woocommerce_checkout_place_order'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- Okay use of $_POST data.
9088
// Update customer data from posted data.

src/View/Admin/Field/ImportHistoricalData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ImportHistoricalData {
3333
*/
3434
public function get_form_field() : array {
3535
return [
36-
'title' => esc_html__( 'Import historical customer data', 'cc-woo' ),
36+
'title' => esc_html__( 'Import your contacts', 'cc-woo' ),
3737
'desc' => $this->get_description(),
3838
'type' => 'select',
3939
'id' => self::OPTION_FIELD_NAME,

src/View/Admin/WooTab.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function enqueue_scripts() {
206206
public function get_sections() {
207207
$sections = [
208208
'' => esc_html__( 'Store Information', 'cc-woo' ),
209-
$this->import_existing_customer_section => esc_html__( 'Importing Existing Customers', 'cc-woo' ),
209+
$this->import_existing_customer_section => esc_html__( 'Import your contacts', 'cc-woo' ),
210210
$this->abandoned_carts_section => esc_html__( 'Abandoned Carts', 'cc-woo' ),
211211
];
212212

@@ -514,14 +514,14 @@ private function get_store_information_settings() {
514514
private function get_customer_data_settings() {
515515
$settings = [
516516
[
517-
'title' => esc_html__( 'Importing Existing Customers', 'cc-woo' ),
517+
'title' => esc_html__( 'Import your contacts', 'cc-woo' ),
518518
'id' => 'cc_woo_customer_data_settings',
519519
'type' => 'title',
520520
],
521521
[
522522
'title' => '',
523523
'type' => 'title',
524-
'desc' => esc_html__( 'All contacts must agree to receive marketing messages in order to be added to your mailing list. Therefore, when you import contacts, you are agreeing that you have permission to send them marketing messages.', 'cc-woo' ),
524+
'desc' => esc_html__( "Start marketing to your customers right away by importing all your contacts now.\n\nDo you want to import your current contacts? By selecting yes below, you agree you have permission to market to your current contacts.", 'cc-woo' ),
525525
],
526526
];
527527

@@ -568,9 +568,9 @@ private function get_abandoned_carts_settings() {
568568
],
569569
];
570570

571-
$rest_endpoints_field = new \WebDevStudios\CCForWoo\View\Admin\Field\AbandonedCarts\RestEndpoints();
572-
$secret_key_field = new \WebDevStudios\CCForWoo\View\Admin\Field\AbandonedCarts\ApiSecretKey();
573-
$server_info_field = new \WebDevStudios\CCForWoo\View\Admin\Field\AbandonedCarts\ServerInfo();
571+
$rest_endpoints_field = new \WebDevStudios\CCForWoo\View\Admin\Field\AbandonedCarts\RestEndpoints();
572+
$secret_key_field = new \WebDevStudios\CCForWoo\View\Admin\Field\AbandonedCarts\ApiSecretKey();
573+
$server_info_field = new \WebDevStudios\CCForWoo\View\Admin\Field\AbandonedCarts\ServerInfo();
574574

575575
$settings[] = array_merge( $settings,
576576
$rest_endpoints_field->get_form_field()
@@ -627,6 +627,16 @@ public function add_cc_connection_button() {
627627
<button class="button button-primary" type="submit" name="cc_woo_action" value="<?php echo esc_attr( $value ); ?>">
628628
<?php echo esc_html( $message ); ?>
629629
</button>
630+
<span style="line-height:28px; margin-left:25px;">
631+
<?php
632+
printf(
633+
/* translators: the placeholders hold opening and closing `<a>` tags. */
634+
esc_html__( 'If you have any issues connecting please call %1$sConstant Contact Support%2$s', 'cc-woo' ),
635+
'<a href="https://community.constantcontact.com/contact-support">',
636+
'</a>'
637+
);
638+
?>
639+
</span>
630640
</div>
631641
<?php
632642
}
@@ -779,7 +789,7 @@ private function validate_value( $field ) {
779789
* @return string
780790
*/
781791
public function sanitize_phone_number( $value ) {
782-
return is_scalar( $value ) ? preg_replace( '/[^\d-()+]+/', '', $value ) : '';
792+
return is_scalar( $value ) ? preg_replace( '/[^\d\-()+]+/', '', $value ) : '';
783793
}
784794

785795
/**

src/View/Checkout/CampaignId.php

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
/**
3+
* Class to handle filtering fields in the checkout billing form.
4+
*
5+
* @see https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
6+
* @author Michael Beckwith <[email protected]>
7+
* @package WebDevStudios\CCForWoo\View\Checkout
8+
* @since 2019-08-22
9+
*/
10+
11+
namespace WebDevStudios\CCForWoo\View\Checkout;
12+
13+
use WebDevStudios\OopsWP\Utility\Hookable;
14+
15+
/**
16+
* Class CampaignId
17+
*
18+
* @author Michael Beckwith <[email protected]>
19+
* @package WebDevStudios\CCForWoo\View\Checkout
20+
* @since 2019-08-22
21+
*/
22+
class CampaignId implements Hookable {
23+
/**
24+
* The name of the meta field for the customer's preference.
25+
* This constant will be used both in usermeta (for users) and postmeta (for orders).
26+
*
27+
* @var string
28+
* @since 2019-08-22
29+
*/
30+
const CUSTOMER_CAMPAIGN_ID_KEY = 'campaign_activity_id';
31+
32+
/**
33+
* Register actions and filters with WordPress.
34+
*
35+
* @author Michael Beckwith <[email protected]>
36+
* @since 2019-08-22
37+
*/
38+
public function register_hooks() {
39+
add_action( 'init', [ $this, 'save_campaign_id' ], 11 );
40+
add_action( 'woocommerce_checkout_update_order_meta', [ $this, 'save_user_campaign_id_to_order' ] );
41+
}
42+
43+
/**
44+
* Save the user preference to the order meta.
45+
*
46+
* @param int $order_id The order ID.
47+
*
48+
* @author Michael Beckwith <[email protected]>
49+
* @since 2019-08-22
50+
* @return void
51+
*/
52+
public function save_user_campaign_id_to_order( $order_id ) {
53+
$preference = $this->get_stored_campaign_id();
54+
55+
if ( empty( $preference ) ) {
56+
return;
57+
}
58+
59+
add_post_meta( $order_id, self::CUSTOMER_CAMPAIGN_ID_KEY, $preference, true );
60+
}
61+
62+
/**
63+
* Save the campaign ID for the session.
64+
*
65+
* @throws \Exception DateTime exception.
66+
*
67+
* @author Michael Beckwith <[email protected]>
68+
* @since 2019-08-22
69+
* @return void
70+
*/
71+
public function save_campaign_id() {
72+
$campaign_id = filter_input( INPUT_GET, 'source', FILTER_SANITIZE_STRING );
73+
74+
if ( ! empty( $campaign_id ) ) {
75+
setcookie( 'ctct_woo_campaign_id', $campaign_id, 0, '/' );
76+
}
77+
}
78+
79+
/**
80+
* Get the submitted customer newsletter preference.
81+
*
82+
* @author Michael Beckwith <[email protected]>
83+
* @since 2019-08-22
84+
* @return string
85+
*/
86+
private function get_stored_campaign_id() {
87+
return isset( $_COOKIE['ctct_woo_campaign_id'] )
88+
? sanitize_text_field( $_COOKIE['ctct_woo_campaign_id'] )
89+
: '';
90+
}
91+
}

src/View/ViewRegistrar.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace WebDevStudios\CCForWoo\View;
1111

1212
use WebDevStudios\CCForWoo\View\Admin\WooTab;
13+
use WebDevStudios\CCForWoo\View\Checkout\CampaignId;
1314
use WebDevStudios\CCForWoo\View\Checkout\NewsletterPreferenceCheckbox;
1415
use WebDevStudios\OopsWP\Structure\Service;
1516

@@ -35,6 +36,7 @@ class ViewRegistrar extends Service {
3536
*/
3637
protected $forms = [
3738
NewsletterPreferenceCheckbox::class,
39+
CampaignId::class,
3840
];
3941

4042

0 commit comments

Comments
 (0)