Creative Mail – Easier WordPress & WooCommerce Email Marketing - Version 1.3.2

Version Description

Download this release

Release Info

Developer constantcontact
Plugin Icon 128x128 Creative Mail – Easier WordPress & WooCommerce Email Marketing
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
  Changelog
2
  =========
3
 
 
 
 
4
  #### 1.3.1 - January 20 2021
5
  - Add the ability to show the amount of recovered revenue via abandoned carts
6
 
1
  Changelog
2
  =========
3
 
4
+ #### 1.3.2 - February 17 2021
5
+ - Fixes an issue where the contact sync might cause a critical error
6
+
7
  #### 1.3.1 - January 20 2021
8
  - Add the ability to show the amount of recovered revenue via abandoned carts
9
 
README.md CHANGED
@@ -3,7 +3,7 @@ Contributors: Constant Contact
3
  Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
- Stable tag: 1.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Requires PHP: 5.6
@@ -88,6 +88,7 @@ Creative Mail by Constant Contact [Privacy Notice](https://www.endurance.com/pri
88
  6. Enhance your brand with logomaker
89
 
90
  == Changelog ==
 
91
  * 1.3.1 - Add the ability to show the amount of recovered revenue via abandoned carts.
92
  * 1.3.0 - Support for abandoned cart emails.
93
  * 1.2.4 - Introduces a 'Reset' button on the settings page for accounts that are stuck.
3
  Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
+ Stable tag: 1.3.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Requires PHP: 5.6
88
  6. Enhance your brand with logomaker
89
 
90
  == Changelog ==
91
+ * 1.3.2 - Fixes an issue where the contact sync might cause a critical error.
92
  * 1.3.1 - Add the ability to show the amount of recovered revenue via abandoned carts.
93
  * 1.3.0 - Support for abandoned cart emails.
94
  * 1.2.4 - Introduces a 'Reset' button on the settings page for accounts that are stuck.
creative-mail-plugin.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin URI: https://wordpress.org/plugins/creative-mail-by-constant-contact/
10
  * Description: Free email marketing designed specifically for WordPress, Jetpack and WooCommerce. Send newsletters, promotions, updates and transactional e-commerce emails. Simple and easy, powered by Constant Contact’s rock solid reliability.
11
  * Author: Constant Contact
12
- * Version: 1.3.1
13
  * Author URI: https://www.constantcontact.com
14
  */
15
  use CreativeMail\CreativeMail;
@@ -24,7 +24,7 @@ function _load_ce4wp_plugin()
24
  define('CE4WP_PLUGIN_DIR', __DIR__ . '/');
25
  define('CE4WP_PLUGIN_URL', plugin_dir_url(__FILE__) . '/');
26
  define('CE4WP_PLUGIN_FILE', __FILE__);
27
- define('CE4WP_PLUGIN_VERSION', '1.3.1');
28
  define('CE4WP_INSTANCE_UUID_KEY', 'ce4wp_instance_uuid');
29
  define('CE4WP_INSTANCE_HANDSHAKE_TOKEN', 'ce4wp_handshake_token');
30
  define('CE4WP_INSTANCE_HANDSHAKE_EXPIRATION', 'ce4wp_handshake_expiration');
@@ -41,7 +41,7 @@ function _load_ce4wp_plugin()
41
  define('CE4WP_APP_GATEWAY_URL', 'https://app-gateway.creativemail.com/');
42
  define('CE4WP_APP_URL', 'https://app.creativemail.com/');
43
  define('CE4WP_ENVIRONMENT', 'PRODUCTION');
44
- define('CE4WP_BUILD_NUMBER', '975');
45
  define('CE4WP_BATCH_SIZE', 500);
46
  define('CE4WP_WC_API_KEY_ID', 'ce4wp_woocommerce_api_key_id');
47
  define('CE4WP_WC_API_CONSUMER_KEY', 'ce4wp_woocommerce_consumer_key');
9
  * Plugin URI: https://wordpress.org/plugins/creative-mail-by-constant-contact/
10
  * Description: Free email marketing designed specifically for WordPress, Jetpack and WooCommerce. Send newsletters, promotions, updates and transactional e-commerce emails. Simple and easy, powered by Constant Contact’s rock solid reliability.
11
  * Author: Constant Contact
12
+ * Version: 1.3.2
13
  * Author URI: https://www.constantcontact.com
14
  */
15
  use CreativeMail\CreativeMail;
24
  define('CE4WP_PLUGIN_DIR', __DIR__ . '/');
25
  define('CE4WP_PLUGIN_URL', plugin_dir_url(__FILE__) . '/');
26
  define('CE4WP_PLUGIN_FILE', __FILE__);
27
+ define('CE4WP_PLUGIN_VERSION', '1.3.2');
28
  define('CE4WP_INSTANCE_UUID_KEY', 'ce4wp_instance_uuid');
29
  define('CE4WP_INSTANCE_HANDSHAKE_TOKEN', 'ce4wp_handshake_token');
30
  define('CE4WP_INSTANCE_HANDSHAKE_EXPIRATION', 'ce4wp_handshake_expiration');
41
  define('CE4WP_APP_GATEWAY_URL', 'https://app-gateway.creativemail.com/');
42
  define('CE4WP_APP_URL', 'https://app.creativemail.com/');
43
  define('CE4WP_ENVIRONMENT', 'PRODUCTION');
44
+ define('CE4WP_BUILD_NUMBER', '1008');
45
  define('CE4WP_BATCH_SIZE', 500);
46
  define('CE4WP_WC_API_KEY_ID', 'ce4wp_woocommerce_api_key_id');
47
  define('CE4WP_WC_API_CONSUMER_KEY', 'ce4wp_woocommerce_consumer_key');
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Constant Contact
3
  Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
- Stable tag: 1.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Requires PHP: 5.6
@@ -93,6 +93,7 @@ Creative Mail by Constant Contact [Privacy Notice](https://www.endurance.com/pri
93
  6. Enhance your brand with logomaker
94
 
95
  == Changelog ==
 
96
  * 1.3.1 - Add the ability to show the amount of recovered revenue via abandoned carts.
97
  * 1.3.0 - Support for abandoned cart emails
98
  * 1.2.4 - Introduces a 'Reset' button on the settings page for accounts that are stuck.
3
  Tags: email, marketing, newsletter, subscribe, contact form, constant contact, crm, automations, ecommerce, promotion, offers, retargeting
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
+ Stable tag: 1.3.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Requires PHP: 5.6
93
  6. Enhance your brand with logomaker
94
 
95
  == Changelog ==
96
+ * 1.3.2 - Fixes an issue where the contact sync might cause a critical error.
97
  * 1.3.1 - Add the ability to show the amount of recovered revenue via abandoned carts.
98
  * 1.3.0 - Support for abandoned cart emails
99
  * 1.2.4 - Introduces a 'Reset' button on the settings page for accounts that are stuck.
src/helpers/EnvironmentHelper.php CHANGED
@@ -32,7 +32,7 @@ class EnvironmentHelper
32
 
33
  $environment = CE4WP_ENVIRONMENT;
34
  if ($environment === "{ENV}") {
35
- return EnvironmentNames::DEVELOPMENT;
36
  }
37
 
38
  return $environment;
32
 
33
  $environment = CE4WP_ENVIRONMENT;
34
  if ($environment === "{ENV}") {
35
+ return EnvironmentNames::PRODUCTION;
36
  }
37
 
38
  return $environment;
src/modules/contacts/Handlers/CalderaPluginHandler.php CHANGED
@@ -12,17 +12,17 @@ class CalderaPluginHandler extends BaseContactFormPluginHandler
12
 
13
  private function GetNameFromForm($entry)
14
  {
15
- if ($this->isNullOrEmpty($entry)){
16
  return null;
17
  }
18
 
19
  $name = null;
20
  foreach ($entry as $field) {
21
- if($field->slug === "first_name") {
22
  $name["firstname"] = $field->value;
23
  continue;
24
  }
25
- if($field->slug === "last_name"){
26
  $name["lastname"] = $field->value;
27
  return $name;
28
  }
@@ -32,11 +32,11 @@ class CalderaPluginHandler extends BaseContactFormPluginHandler
32
 
33
  private function GetEmailFromForm($entry)
34
  {
35
- if ($this->isNullOrEmpty($entry)){
36
  return null;
37
  }
38
  foreach ($entry as $field) {
39
- if($field->slug === "email_address" ) {
40
  return $field->value;
41
  }
42
  }
@@ -109,8 +109,7 @@ class CalderaPluginHandler extends BaseContactFormPluginHandler
109
  }
110
 
111
  // Relies on plugin => GravityForms
112
- if (in_array('caldera-forms/caldera-core.php', apply_filters('active_plugins', get_option('active_plugins'))) && defined( 'CFCORE_VER'))
113
- {
114
  global $wpdb;
115
 
116
  $contactsArray = array();
@@ -130,8 +129,15 @@ class CalderaPluginHandler extends BaseContactFormPluginHandler
130
  $contact->lastname = array_key_exists("lastname", $nameValues) ? $nameValues["lastname"] : null;
131
 
132
  //Convert to contactModel
133
- $contactModel = $this->convertToContactModel($contact);
134
- if (!empty($contactModel)){
 
 
 
 
 
 
 
135
  array_push($contactsArray, $contactModel);
136
  }
137
 
12
 
13
  private function GetNameFromForm($entry)
14
  {
15
+ if ($this->isNullOrEmpty($entry)) {
16
  return null;
17
  }
18
 
19
  $name = null;
20
  foreach ($entry as $field) {
21
+ if ($field->slug === "first_name") {
22
  $name["firstname"] = $field->value;
23
  continue;
24
  }
25
+ if ($field->slug === "last_name") {
26
  $name["lastname"] = $field->value;
27
  return $name;
28
  }
32
 
33
  private function GetEmailFromForm($entry)
34
  {
35
+ if ($this->isNullOrEmpty($entry)) {
36
  return null;
37
  }
38
  foreach ($entry as $field) {
39
+ if ($field->slug === "email_address") {
40
  return $field->value;
41
  }
42
  }
109
  }
110
 
111
  // Relies on plugin => GravityForms
112
+ if (in_array('caldera-forms/caldera-core.php', apply_filters('active_plugins', get_option('active_plugins'))) && defined('CFCORE_VER')) {
 
113
  global $wpdb;
114
 
115
  $contactsArray = array();
129
  $contact->lastname = array_key_exists("lastname", $nameValues) ? $nameValues["lastname"] : null;
130
 
131
  //Convert to contactModel
132
+ $contactModel = null;
133
+ try {
134
+ $contactModel = $this->convertToContactModel($contact);
135
+ } catch (\Exception $exception) {
136
+ // silent exception
137
+ continue;
138
+ }
139
+
140
+ if (!empty($contactModel)) {
141
  array_push($contactsArray, $contactModel);
142
  }
143
 
src/modules/contacts/Handlers/ContactFormSevenPluginHandler.php CHANGED
@@ -11,8 +11,8 @@ use CreativeMail\Modules\Contacts\Models\OptActionBy;
11
  class ContactFormSevenPluginHandler extends BaseContactFormPluginHandler
12
  {
13
 
14
- private $emailFields = array('your-email','email', 'emailaddress', 'email_address');
15
- private $firstnameFields = array('firstname', 'first_name','name','your-name');
16
  private $lastnameFields = array('lastname', 'last_name');
17
 
18
  private function findValue($data, $fieldOptions)
@@ -92,15 +92,14 @@ class ContactFormSevenPluginHandler extends BaseContactFormPluginHandler
92
  global $wpdb;
93
 
94
  $cfdb = apply_filters('cfdb7_database', $wpdb);
95
- $cfdbtable = $cfdb->prefix.'db7_forms';
96
  $cfdbQuery = "SELECT form_id, form_post_id, form_value FROM $cfdbtable";
97
 
98
  // Do we need to limit the number of results
99
  if ($limit != null) {
100
  $cfdbQuery .= " LIMIT %d";
101
  $cfdbQuery = $cfdb->prepare($cfdbQuery, $limit);
102
- }
103
- else {
104
  $cfdbQuery = $cfdb->prepare($cfdbQuery);
105
  }
106
 
@@ -114,17 +113,22 @@ class ContactFormSevenPluginHandler extends BaseContactFormPluginHandler
114
  $contactModel->setOptIn(true);
115
  $contactModel->setOptOut(false);
116
  $contactModel->setOptActionBy(OptActionBy::Visitor);
117
- $email = $this->findValueFromDb($form_data, $this->emailFields);
118
- if (!empty($email)) {
119
- $contactModel->setEmail($email);
120
- }
121
- $firstname = $this->findValueFromDb($form_data, $this->firstnameFields);
122
- if (!empty($firstname)) {
123
- $contactModel->setFirstName($firstname);
124
- }
125
- $lastname = $this->findValueFromDb($form_data, $this->lastnameFields);
126
- if (!empty($lastname)) {
127
- $contactModel->setLastName($lastname);
 
 
 
 
 
128
  }
129
 
130
  if (!empty($contactModel->getEmail())) {
@@ -136,7 +140,7 @@ class ContactFormSevenPluginHandler extends BaseContactFormPluginHandler
136
  if (!empty($contactsArray)) {
137
 
138
  $batches = array_chunk($contactsArray, CE4WP_BATCH_SIZE);
139
- foreach($batches as $batch){
140
  $this->batchUpsertContacts($batch);
141
  }
142
  }
@@ -147,8 +151,7 @@ class ContactFormSevenPluginHandler extends BaseContactFormPluginHandler
147
  {
148
  try {
149
  $this->upsertContact($this->convertToContactModel($contact_form));
150
- }
151
- catch (\Exception $exception) {
152
  // silent exception
153
  }
154
  }
11
  class ContactFormSevenPluginHandler extends BaseContactFormPluginHandler
12
  {
13
 
14
+ private $emailFields = array('your-email', 'email', 'emailaddress', 'email_address');
15
+ private $firstnameFields = array('firstname', 'first_name', 'name', 'your-name');
16
  private $lastnameFields = array('lastname', 'last_name');
17
 
18
  private function findValue($data, $fieldOptions)
92
  global $wpdb;
93
 
94
  $cfdb = apply_filters('cfdb7_database', $wpdb);
95
+ $cfdbtable = $cfdb->prefix . 'db7_forms';
96
  $cfdbQuery = "SELECT form_id, form_post_id, form_value FROM $cfdbtable";
97
 
98
  // Do we need to limit the number of results
99
  if ($limit != null) {
100
  $cfdbQuery .= " LIMIT %d";
101
  $cfdbQuery = $cfdb->prepare($cfdbQuery, $limit);
102
+ } else {
 
103
  $cfdbQuery = $cfdb->prepare($cfdbQuery);
104
  }
105
 
113
  $contactModel->setOptIn(true);
114
  $contactModel->setOptOut(false);
115
  $contactModel->setOptActionBy(OptActionBy::Visitor);
116
+ try {
117
+ $email = $this->findValueFromDb($form_data, $this->emailFields);
118
+ if (!empty($email)) {
119
+ $contactModel->setEmail($email);
120
+ }
121
+ $firstname = $this->findValueFromDb($form_data, $this->firstnameFields);
122
+ if (!empty($firstname)) {
123
+ $contactModel->setFirstName($firstname);
124
+ }
125
+ $lastname = $this->findValueFromDb($form_data, $this->lastnameFields);
126
+ if (!empty($lastname)) {
127
+ $contactModel->setLastName($lastname);
128
+ }
129
+ } catch (\Exception $exception) {
130
+ // silent exception
131
+ continue;
132
  }
133
 
134
  if (!empty($contactModel->getEmail())) {
140
  if (!empty($contactsArray)) {
141
 
142
  $batches = array_chunk($contactsArray, CE4WP_BATCH_SIZE);
143
+ foreach ($batches as $batch) {
144
  $this->batchUpsertContacts($batch);
145
  }
146
  }
151
  {
152
  try {
153
  $this->upsertContact($this->convertToContactModel($contact_form));
154
+ } catch (\Exception $exception) {
 
155
  // silent exception
156
  }
157
  }
src/modules/contacts/Handlers/GravityFormsPluginHandler.php CHANGED
@@ -26,9 +26,9 @@ class GravityFormsPluginHandler extends BaseContactFormPluginHandler
26
  $contactModel->setEmail($email);
27
  }
28
 
29
- $firstName = $user->name['firstName'];
30
- $insertion = $user->name['insertion'];
31
- $lastName = $user->name['lastName'];
32
 
33
  if (!empty($firstName)) {
34
  $contactModel->setFirstName($firstName);
@@ -48,7 +48,7 @@ class GravityFormsPluginHandler extends BaseContactFormPluginHandler
48
  * Gets the first name, optional insertion and last name from the contactform
49
  *
50
  * @param $entry (The form submission)
51
- * @param $form (The form used)
52
  *
53
  * @return string (concatenated firstname, insertion and lastname) Returns the concatenated name
54
  */
@@ -72,7 +72,7 @@ class GravityFormsPluginHandler extends BaseContactFormPluginHandler
72
  * Returns the value of the email field or the first valid email found in an "email" labelled text field, or NULL
73
  *
74
  * @param $entry (The form submission)
75
- * @param $form (The form used)
76
  *
77
  * @return string (either a validated email or NULL)
78
  */
@@ -176,7 +176,15 @@ class GravityFormsPluginHandler extends BaseContactFormPluginHandler
176
  $contact->name = $this->GetNameValuesFromForm($entry, $formArray);
177
 
178
  //Convert to contactModel
179
- $contactModel = $this->convertToContactModel($contact);
 
 
 
 
 
 
 
 
180
  array_push($contactsArray, $contactModel);
181
 
182
  if (isset($limit) && count($contactsArray) >= $limit) {
26
  $contactModel->setEmail($email);
27
  }
28
 
29
+ $firstName = isset($user->name['firstName']) ? $user->name['firstName'] : null;
30
+ $insertion = isset($user->name['insertion']) ? $user->name['insertion'] : null;
31
+ $lastName = isset($user->name['lastName']) ? $user->name['lastName'] : null;
32
 
33
  if (!empty($firstName)) {
34
  $contactModel->setFirstName($firstName);
48
  * Gets the first name, optional insertion and last name from the contactform
49
  *
50
  * @param $entry (The form submission)
51
+ * @param $form (The form used)
52
  *
53
  * @return string (concatenated firstname, insertion and lastname) Returns the concatenated name
54
  */
72
  * Returns the value of the email field or the first valid email found in an "email" labelled text field, or NULL
73
  *
74
  * @param $entry (The form submission)
75
+ * @param $form (The form used)
76
  *
77
  * @return string (either a validated email or NULL)
78
  */
176
  $contact->name = $this->GetNameValuesFromForm($entry, $formArray);
177
 
178
  //Convert to contactModel
179
+
180
+ $contactModel = null;
181
+ try {
182
+ $contactModel = $this->convertToContactModel($contact);
183
+ } catch (\Exception $exception) {
184
+ // silent exception
185
+ continue;
186
+ }
187
+
188
  array_push($contactsArray, $contactModel);
189
 
190
  if (isset($limit) && count($contactsArray) >= $limit) {
src/modules/contacts/Handlers/JetpackPluginHandler.php CHANGED
@@ -150,7 +150,14 @@ class JetpackPluginHandler extends BaseContactFormPluginHandler
150
  $contact->opt_in = boolval($consentValue);
151
 
152
  //Convert to contactModel and push to the array
153
- $contactModel = $this->convertToContactModel($contact);
 
 
 
 
 
 
 
154
  array_push($contactsArray, $contactModel);
155
 
156
  if (isset($limit) && count($contactsArray) >= $limit) {
150
  $contact->opt_in = boolval($consentValue);
151
 
152
  //Convert to contactModel and push to the array
153
+ $contactModel = null;
154
+ try {
155
+ $contactModel = $this->convertToContactModel($contact);
156
+ } catch (\Exception $exception) {
157
+ // silent exception
158
+ continue;
159
+ }
160
+
161
  array_push($contactsArray, $contactModel);
162
 
163
  if (isset($limit) && count($contactsArray) >= $limit) {
src/modules/contacts/Handlers/NewsLetterContactFormPluginHandler.php CHANGED
@@ -39,8 +39,7 @@ class NewsLetterContactFormPluginHandler extends BaseContactFormPluginHandler
39
  {
40
  try {
41
  $this->upsertContact($this->convertToContactModel($user));
42
- }
43
- catch (\Exception $exception) {
44
  // silent exception
45
  }
46
  }
@@ -72,8 +71,7 @@ class NewsLetterContactFormPluginHandler extends BaseContactFormPluginHandler
72
  if ($limit != null) {
73
  $query .= " LIMIT %d";
74
  $query = $wpdb->prepare($query, $limit);
75
- }
76
- else {
77
  $query = $wpdb->prepare($query);
78
  }
79
 
@@ -84,24 +82,29 @@ class NewsLetterContactFormPluginHandler extends BaseContactFormPluginHandler
84
  if (isset($result) && !empty($result)) {
85
  foreach ($result as $contact) {
86
  $contactModel = new ContactModel();
87
- $contactModel->setEventType(CE4WP_NL_EVENTTYPE);
88
- $contactModel->setOptIn($contact->status !== "U");
89
- $contactModel->setOptOut($contact->status === "U");
90
- $contactModel->setOptActionBy(OptActionBy::Visitor);
91
-
92
- $email = $contact->email;
93
- if (!empty($email)) {
94
- $contactModel->setEmail($email);
95
- }
96
-
97
- $name = $contact->name;
98
- if (!empty($name)) {
99
- $contactModel->setFirstName($name);
100
- }
101
-
102
- $surname = $contact->surname;
103
- if (!empty($surname)) {
104
- $contactModel->setLastName($surname);
 
 
 
 
 
105
  }
106
 
107
  if (!empty($contactModel->getEmail())) {
@@ -113,7 +116,7 @@ class NewsLetterContactFormPluginHandler extends BaseContactFormPluginHandler
113
  if (!empty($backfillArray)) {
114
 
115
  $batches = array_chunk($backfillArray, CE4WP_BATCH_SIZE);
116
- foreach($batches as $batch){
117
  try {
118
  $this->batchUpsertContacts($batch);
119
  } catch (\Exception $exception) {
39
  {
40
  try {
41
  $this->upsertContact($this->convertToContactModel($user));
42
+ } catch (\Exception $exception) {
 
43
  // silent exception
44
  }
45
  }
71
  if ($limit != null) {
72
  $query .= " LIMIT %d";
73
  $query = $wpdb->prepare($query, $limit);
74
+ } else {
 
75
  $query = $wpdb->prepare($query);
76
  }
77
 
82
  if (isset($result) && !empty($result)) {
83
  foreach ($result as $contact) {
84
  $contactModel = new ContactModel();
85
+ try {
86
+ $contactModel->setEventType(CE4WP_NL_EVENTTYPE);
87
+ $contactModel->setOptIn($contact->status !== "U");
88
+ $contactModel->setOptOut($contact->status === "U");
89
+ $contactModel->setOptActionBy(OptActionBy::Visitor);
90
+
91
+ $email = $contact->email;
92
+ if (!empty($email)) {
93
+ $contactModel->setEmail($email);
94
+ }
95
+
96
+ $name = $contact->name;
97
+ if (!empty($name)) {
98
+ $contactModel->setFirstName($name);
99
+ }
100
+
101
+ $surname = $contact->surname;
102
+ if (!empty($surname)) {
103
+ $contactModel->setLastName($surname);
104
+ }
105
+ } catch (\Exception $exception) {
106
+ // silent exception
107
+ continue;
108
  }
109
 
110
  if (!empty($contactModel->getEmail())) {
116
  if (!empty($backfillArray)) {
117
 
118
  $batches = array_chunk($backfillArray, CE4WP_BATCH_SIZE);
119
+ foreach ($batches as $batch) {
120
  try {
121
  $this->batchUpsertContacts($batch);
122
  } catch (\Exception $exception) {
src/modules/contacts/Handlers/NinjaFormsPluginHandler.php CHANGED
@@ -52,20 +52,19 @@ class NinjaFormsPluginHandler extends BaseContactFormPluginHandler
52
  $contactModel->setOptOut(false);
53
  $contactModel->setOptActionBy(OptActionBy::Owner);
54
 
55
- if(isset($contact->optinByOwner)){
56
  $contactModel->setOptIn(boolval($contact->optinByOwner));
57
  }
58
 
59
  $email = $contact->email;
60
  if (!empty($email)) {
61
-
62
  $contactModel->setEmail($email);
63
  }
64
 
65
  $name = !empty($contact->name) ? $contact->name : null;
66
  $firstName = null;
67
  $lastName = null;
68
- if (!empty($name)){
69
  $values = explode(' ', $contact->name);
70
  $firstName = array_shift($values);
71
  $lastName = implode(' ', $values);
@@ -84,7 +83,8 @@ class NinjaFormsPluginHandler extends BaseContactFormPluginHandler
84
  return $contactModel;
85
  }
86
 
87
- public function attemptAdditionalNameExtraction($contact, $field_key, $field_values){
 
88
  //Attempt additional checking for name in an attempt to get custom form fields for names
89
  $name = null;
90
  if (strpos($field_key, "full_name") !== false || isset($field_values["name"])) {
@@ -160,11 +160,10 @@ class NinjaFormsPluginHandler extends BaseContactFormPluginHandler
160
  $field_key = $field_settings["key"];
161
  $field_type = $field_settings["type"];
162
 
163
- switch($field_type)
164
- {
165
  case 'email';
166
  $email = isset($field_values[$field_key]) ? $field_values[$field_key] : null;
167
- if (filter_var($email, FILTER_VALIDATE_EMAIL)){
168
  $contact->email = $email;
169
  }
170
  break;
@@ -182,7 +181,7 @@ class NinjaFormsPluginHandler extends BaseContactFormPluginHandler
182
  break;
183
  case 'textbox';
184
  case 'text';
185
- if (empty($contact->name) && (empty($contact->firstName) || empty($contact->lastName))){
186
  $this->attemptAdditionalNameExtraction($contact, $field_key, $field_values);
187
  }
188
  break;
@@ -194,9 +193,20 @@ class NinjaFormsPluginHandler extends BaseContactFormPluginHandler
194
  if (!empty($contact->email) && $contact->email != null) {
195
  //set optin by owner on db sync
196
  $contact->optinByOwner = true;
 
 
197
  //Convert to contactModel and push to the array
198
- $contactModel = $this->convertToContactModel($contact);
199
- array_push($contactsArray, $contactModel);
 
 
 
 
 
 
 
 
 
200
  if (isset($limit) && count($contactsArray) >= $limit) {
201
  break;
202
  }
52
  $contactModel->setOptOut(false);
53
  $contactModel->setOptActionBy(OptActionBy::Owner);
54
 
55
+ if (isset($contact->optinByOwner)) {
56
  $contactModel->setOptIn(boolval($contact->optinByOwner));
57
  }
58
 
59
  $email = $contact->email;
60
  if (!empty($email)) {
 
61
  $contactModel->setEmail($email);
62
  }
63
 
64
  $name = !empty($contact->name) ? $contact->name : null;
65
  $firstName = null;
66
  $lastName = null;
67
+ if (!empty($name)) {
68
  $values = explode(' ', $contact->name);
69
  $firstName = array_shift($values);
70
  $lastName = implode(' ', $values);
83
  return $contactModel;
84
  }
85
 
86
+ public function attemptAdditionalNameExtraction($contact, $field_key, $field_values)
87
+ {
88
  //Attempt additional checking for name in an attempt to get custom form fields for names
89
  $name = null;
90
  if (strpos($field_key, "full_name") !== false || isset($field_values["name"])) {
160
  $field_key = $field_settings["key"];
161
  $field_type = $field_settings["type"];
162
 
163
+ switch ($field_type) {
 
164
  case 'email';
165
  $email = isset($field_values[$field_key]) ? $field_values[$field_key] : null;
166
+ if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
167
  $contact->email = $email;
168
  }
169
  break;
181
  break;
182
  case 'textbox';
183
  case 'text';
184
+ if (empty($contact->name) && (empty($contact->firstName) || empty($contact->lastName))) {
185
  $this->attemptAdditionalNameExtraction($contact, $field_key, $field_values);
186
  }
187
  break;
193
  if (!empty($contact->email) && $contact->email != null) {
194
  //set optin by owner on db sync
195
  $contact->optinByOwner = true;
196
+
197
+
198
  //Convert to contactModel and push to the array
199
+ $contactModel = null;
200
+ try {
201
+ $contactModel = $this->convertToContactModel($contact);
202
+ if (!empty($contactModel->getEmail())) {
203
+ array_push($contactsArray, $contactModel);
204
+ }
205
+ } catch (\Exception $exception) {
206
+ // silent exception
207
+ continue;
208
+ }
209
+
210
  if (isset($limit) && count($contactsArray) >= $limit) {
211
  break;
212
  }
src/modules/contacts/Handlers/WooCommercePluginHandler.php CHANGED
@@ -25,6 +25,12 @@ class WooCommercePluginHandler extends BaseContactFormPluginHandler
25
  $products_detail = get_post_meta($orderId);
26
 
27
  if (isset($products_detail)) {
 
 
 
 
 
 
28
  if (!empty($products_detail["_billing_first_name"])) {
29
  $contactModel->setFirstName($products_detail["_billing_first_name"][0]);
30
  }
@@ -32,10 +38,6 @@ class WooCommercePluginHandler extends BaseContactFormPluginHandler
32
  $contactModel->setLastName($products_detail["_billing_last_name"][0]);
33
  }
34
 
35
- if (!empty($products_detail["_billing_email"])) {
36
- $contactModel->setEmail($products_detail["_billing_email"][0]);
37
- }
38
-
39
  $contactAddress = $this->getContactAddressFromOrder($products_detail);
40
 
41
  if (!empty($contactAddress)) {
@@ -156,12 +158,17 @@ class WooCommercePluginHandler extends BaseContactFormPluginHandler
156
 
157
  foreach ($products_orders as $products_order) {
158
 
159
- $contactModel = $this->convertToContactModel($products_order->ID);
 
 
 
 
 
 
160
 
161
- if(!empty($contactModel->getEmail())) {
162
  array_push($backfillArray, $contactModel);
163
  }
164
-
165
  }
166
 
167
  if (!empty($backfillArray)) {
25
  $products_detail = get_post_meta($orderId);
26
 
27
  if (isset($products_detail)) {
28
+ if (!empty($products_detail["_billing_email"]) && isset($products_detail["_billing_email"][0]) && !empty($products_detail["_billing_email"][0])) {
29
+ $contactModel->setEmail($products_detail["_billing_email"][0]);
30
+ } else {
31
+ return $contactModel;
32
+ }
33
+
34
  if (!empty($products_detail["_billing_first_name"])) {
35
  $contactModel->setFirstName($products_detail["_billing_first_name"][0]);
36
  }
38
  $contactModel->setLastName($products_detail["_billing_last_name"][0]);
39
  }
40
 
 
 
 
 
41
  $contactAddress = $this->getContactAddressFromOrder($products_detail);
42
 
43
  if (!empty($contactAddress)) {
158
 
159
  foreach ($products_orders as $products_order) {
160
 
161
+ $contactModel = null;
162
+ try {
163
+ $contactModel = $this->convertToContactModel($products_order->ID);
164
+ } catch (\Exception $exception) {
165
+ // silent exception
166
+ continue;
167
+ }
168
 
169
+ if (!empty($contactModel->getEmail())) {
170
  array_push($backfillArray, $contactModel);
171
  }
 
172
  }
173
 
174
  if (!empty($backfillArray)) {
src/modules/contacts/Handlers/WpFormsPluginHandler.php CHANGED
@@ -14,7 +14,7 @@ class WpFormsPluginHandler extends BaseContactFormPluginHandler
14
  private function get_form_type_field($formData, $type)
15
  {
16
  foreach ($formData as $field) {
17
- if(array_key_exists('type', $field) && $field['type'] === $type) {
18
  return $field;
19
  }
20
  }
@@ -26,7 +26,7 @@ class WpFormsPluginHandler extends BaseContactFormPluginHandler
26
  $formdata = array();
27
  $entry = json_decode($entry->fields, true);
28
  foreach ($entry as $field) {
29
- if(array_key_exists('type', $field)) {
30
  $formdata[$field["type"]] = $field["value"];
31
  }
32
  }
@@ -68,8 +68,7 @@ class WpFormsPluginHandler extends BaseContactFormPluginHandler
68
  {
69
  try {
70
  $this->upsertContact($this->convertToContactModel($fields));
71
- }
72
- catch (\Exception $exception) {
73
  // silent exception
74
  }
75
  }
@@ -107,9 +106,18 @@ class WpFormsPluginHandler extends BaseContactFormPluginHandler
107
 
108
  //Loop through entries and create the contacts
109
  foreach ($entryResult as $entry) {
110
- $entryData = $this->convertEntryStringToFormData($entry);
111
- $contact = $this->convertToContactModel($entryData);
112
- array_push($contactsArray, $contact);
 
 
 
 
 
 
 
 
 
113
 
114
  if (isset($limit) && count($contactsArray) >= $limit) {
115
  break;
14
  private function get_form_type_field($formData, $type)
15
  {
16
  foreach ($formData as $field) {
17
+ if (array_key_exists('type', $field) && $field['type'] === $type) {
18
  return $field;
19
  }
20
  }
26
  $formdata = array();
27
  $entry = json_decode($entry->fields, true);
28
  foreach ($entry as $field) {
29
+ if (array_key_exists('type', $field)) {
30
  $formdata[$field["type"]] = $field["value"];
31
  }
32
  }
68
  {
69
  try {
70
  $this->upsertContact($this->convertToContactModel($fields));
71
+ } catch (\Exception $exception) {
 
72
  // silent exception
73
  }
74
  }
106
 
107
  //Loop through entries and create the contacts
108
  foreach ($entryResult as $entry) {
109
+ $contactModel = null;
110
+ try {
111
+ $entryData = $this->convertEntryStringToFormData($entry);
112
+ $contact = $this->convertToContactModel($entryData);
113
+ if (!empty($contact->getEmail())) {
114
+ array_push($contactsArray, $contact);
115
+ }
116
+
117
+ } catch (\Exception $exception) {
118
+ // silent exception
119
+ continue;
120
+ }
121
 
122
  if (isset($limit) && count($contactsArray) >= $limit) {
123
  break;
src/modules/contacts/models/ContactModel.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace CreativeMail\Modules\Contacts\Models;
4
 
 
 
5
  class ContactModel
6
  {
7
  public $email;
2
 
3
  namespace CreativeMail\Modules\Contacts\Models;
4
 
5
+ use Exception;
6
+
7
  class ContactModel
8
  {
9
  public $email;
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit9589a65f05c6dc7695e2164c69abdbad::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit747596c80a8c73a211d3b7d122d0bc2d::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit9589a65f05c6dc7695e2164c69abdbad
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit9589a65f05c6dc7695e2164c69abdbad
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit9589a65f05c6dc7695e2164c69abdbad', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit9589a65f05c6dc7695e2164c69abdbad', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit9589a65f05c6dc7695e2164c69abdbad::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit747596c80a8c73a211d3b7d122d0bc2d
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit747596c80a8c73a211d3b7d122d0bc2d', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit747596c80a8c73a211d3b7d122d0bc2d', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit747596c80a8c73a211d3b7d122d0bc2d::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit9589a65f05c6dc7695e2164c69abdbad
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'F' =>
@@ -130,9 +130,9 @@ class ComposerStaticInit9589a65f05c6dc7695e2164c69abdbad
130
  public static function getInitializer(ClassLoader $loader)
131
  {
132
  return \Closure::bind(function () use ($loader) {
133
- $loader->prefixLengthsPsr4 = ComposerStaticInit9589a65f05c6dc7695e2164c69abdbad::$prefixLengthsPsr4;
134
- $loader->prefixDirsPsr4 = ComposerStaticInit9589a65f05c6dc7695e2164c69abdbad::$prefixDirsPsr4;
135
- $loader->classMap = ComposerStaticInit9589a65f05c6dc7695e2164c69abdbad::$classMap;
136
 
137
  }, null, ClassLoader::class);
138
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit747596c80a8c73a211d3b7d122d0bc2d
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'F' =>
130
  public static function getInitializer(ClassLoader $loader)
131
  {
132
  return \Closure::bind(function () use ($loader) {
133
+ $loader->prefixLengthsPsr4 = ComposerStaticInit747596c80a8c73a211d3b7d122d0bc2d::$prefixLengthsPsr4;
134
+ $loader->prefixDirsPsr4 = ComposerStaticInit747596c80a8c73a211d3b7d122d0bc2d::$prefixDirsPsr4;
135
+ $loader->classMap = ComposerStaticInit747596c80a8c73a211d3b7d122d0bc2d::$classMap;
136
 
137
  }, null, ClassLoader::class);
138
  }