WooCommerce MailChimp - Version 2.0.15

Version Description

Download this release

Release Info

Developer anderly
Plugin Icon 128x128 WooCommerce MailChimp
Version 2.0.15
Comparing to
See all releases

Code changes from version 2.0.14 to 2.0.15

includes/class-ss-wc-mailchimp-compatibility.php CHANGED
@@ -113,14 +113,6 @@ final class SS_WC_MailChimp_Compatibility {
113
  return self::$valid_woocommerce;
114
  }
115
 
116
- /**
117
- * @since 2.0.13.2
118
- * @return bool
119
- */
120
- static function is_valid_curl() {
121
- return self::$valid_curl;
122
- }
123
-
124
  /**
125
  * @since 2.0.13
126
  * @return bool
@@ -138,33 +130,6 @@ final class SS_WC_MailChimp_Compatibility {
138
  return self::$notices;
139
  }
140
 
141
- /**
142
- * @since 2.0.13
143
- *
144
- * @param array $atts
145
- * @param null $content
146
- * @param string $shortcode
147
- *
148
- * @return null|string NULL returned if user can't manage options. Notice shown with a warning that GF isn't supported.
149
- */
150
- public function _shortcode_woocommerce_mailchimp_notice( $atts = array(), $content = null, $shortcode = 'woocommerce_mailchimp' ) {
151
-
152
- if( ! current_user_can('manage_options') ) {
153
- return null;
154
- }
155
-
156
- $notices = self::get_notices();
157
-
158
- $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'woocommerce-mailchimp') . '</em></p>';
159
- foreach( (array)$notices as $notice ) {
160
- $message .= wpautop( $notice['message'] );
161
- }
162
- $message .= '</div>';
163
-
164
- return $message;
165
-
166
- }
167
-
168
  /**
169
  * Is the version of PHP compatible?
170
  *
113
  return self::$valid_woocommerce;
114
  }
115
 
 
 
 
 
 
 
 
 
116
  /**
117
  * @since 2.0.13
118
  * @return bool
130
  return self::$notices;
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  /**
134
  * Is the version of PHP compatible?
135
  *
includes/class-ss-wc-mailchimp-handler.php CHANGED
@@ -33,7 +33,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
33
  $this->id = 'mailchimp';
34
  $this->namespace = 'ss_wc_' . $this->id;
35
  $this->label = __( 'MailChimp', 'woocommerce-mailchimp' );
36
-
37
  $this->register_hooks();
38
 
39
  } //end function __construct
@@ -51,146 +51,6 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
51
 
52
  }
53
 
54
- /**
55
- * api_key function.
56
- * @return string MailChimp API Key
57
- */
58
- public function api_key() {
59
- return $this->get_option( 'api_key' );
60
- }
61
-
62
- /**
63
- * is_enabled function.
64
- *
65
- * @access public
66
- * @return boolean
67
- */
68
- public function is_enabled() {
69
- return 'yes' === $this->get_option( 'enabled' );
70
- }
71
-
72
- /**
73
- * occurs function
74
- * @return string
75
- */
76
- public function occurs() {
77
- return $this->get_option( 'occurs' );
78
- }
79
-
80
- /**
81
- * get_list function.
82
- *
83
- * @access public
84
- * @return string MailChimp list ID
85
- */
86
- public function get_list() {
87
- return $this->get_option( 'list' );
88
- }
89
-
90
- /**
91
- * double_optin function.
92
- *
93
- * @access public
94
- * @return boolean
95
- */
96
- public function double_optin() {
97
- return 'yes' === $this->get_option( 'double_optin' );
98
- }
99
-
100
- /**
101
- * display_opt_in function.
102
- *
103
- * @access public
104
- * @return boolean
105
- */
106
- public function display_opt_in() {
107
- return 'yes' === $this->get_option( 'display_opt_in' );
108
- }
109
-
110
- /**
111
- * opt_in_label function.
112
- *
113
- * @access public
114
- * @return string
115
- */
116
- public function opt_in_label() {
117
- return $this->get_option( 'opt_in_label' );
118
- }
119
-
120
- /**
121
- * opt_in_checkbox_default_status function.
122
- *
123
- * @access public
124
- * @return string
125
- */
126
- public function opt_in_checkbox_default_status() {
127
- return $this->get_option( 'opt_in_checkbox_default_status' );
128
- }
129
-
130
- /**
131
- * opt_in_checkbox_display_location function.
132
- *
133
- * @access public
134
- * @return string
135
- */
136
- public function opt_in_checkbox_display_location() {
137
- return $this->get_option( 'opt_in_checkbox_display_location' );
138
- }
139
-
140
- /**
141
- * interests function.
142
- *
143
- * @access public
144
- * @return array
145
- */
146
- public function interest_groups() {
147
- return $this->get_option( 'interest_groups' );
148
- }
149
-
150
- /**
151
- * has_list function.
152
- *
153
- * @access public
154
- * @return boolean
155
- */
156
- public function has_list() {
157
- if ( $this->get_list() ) {
158
- return true;
159
- }
160
- return false;
161
- }
162
-
163
- /**
164
- * has_api_key function.
165
- *
166
- * @access public
167
- * @return boolean
168
- */
169
- public function has_api_key() {
170
- $api_key = $this->api_key();
171
- return !empty( $api_key );
172
- }
173
-
174
- /**
175
- * is_valid function.
176
- *
177
- * @access public
178
- * @return boolean
179
- */
180
- public function is_valid() {
181
- return $this->is_enabled() && $this->has_api_key() && $this->has_list();
182
- }
183
-
184
- /**
185
- * debug_enabled function.
186
- *
187
- * @access public
188
- * @return boolean
189
- */
190
- public function debug_enabled() {
191
- return 'yes' === $this->get_option( 'debug' );
192
- }
193
-
194
  /**
195
  * order_status_changed function.
196
  *
@@ -198,7 +58,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
198
  * @return void
199
  */
200
  public function order_status_changed( $id, $status = 'new', $new_status = 'pending' ) {
201
- if ( $this->is_valid() && $new_status === $this->occurs() ) {
202
  // Get WC order
203
  $order = $this->wc_get_order( $id );
204
 
@@ -210,20 +70,14 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
210
  // or the 'ss_wc_mailchimp_opt_in' is yes, subscriber the customer
211
  if ( ! $subscribe_customer || empty( $subscribe_customer ) || 'yes' === $subscribe_customer ) {
212
  // log
213
- $this->log( sprintf( __( __METHOD__ . '(): Subscribing customer (%s) to list %s', 'woocommerce-mailchimp' ), $order->billing_email, $this->get_list() ) );
214
 
215
  // subscribe
216
- $this->subscribe( $order->id, $order->billing_first_name, $order->billing_last_name, $order->billing_email, $this->get_list() );
217
  }
218
  }
219
  }
220
 
221
- public function get_option( $option_suffix ) {
222
-
223
- return get_option( $this->namespace_prefixed( $option_suffix ) );
224
-
225
- }
226
-
227
  /**
228
  * Register plugin hooks
229
  *
@@ -239,7 +93,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
239
  // hook into woocommerce order status changed hook to handle the desired subscription event trigger
240
  add_action( 'woocommerce_order_status_changed', array( $this, 'order_status_changed' ), 10, 3 );
241
 
242
- $opt_in_checkbox_display_location = $this->opt_in_checkbox_display_location();
243
 
244
  // Maybe add an "opt-in" field to the checkout
245
  $opt_in_checkbox_display_location = !empty( $opt_in_checkbox_display_location ) ? $opt_in_checkbox_display_location : 'woocommerce_review_order_before_submit';
@@ -257,8 +111,6 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
257
 
258
  add_action( $opt_in_checkbox_display_location, array( $this, 'maybe_add_checkout_fields' ) );
259
 
260
- add_filter( 'default_checkout_ss_wc_mailchimp_opt_in', array( $this, 'checkbox_default_status' ) );
261
-
262
  // Maybe save the "opt-in" field on the checkout
263
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'maybe_save_checkout_fields' ) );
264
 
@@ -268,6 +120,8 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
268
 
269
  add_action( 'wp_ajax_ss_wc_mailchimp_get_interest_groups', array( $this, 'ajax_get_interest_groups' ) );
270
 
 
 
271
  } //end function ensure_tab
272
 
273
  /**
@@ -288,7 +142,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
288
 
289
  $api_key = $_POST['data']['api_key'];
290
 
291
- $account = $this->mailchimp()->get_account( $api_key );
292
 
293
  $results = $account;
294
 
@@ -321,7 +175,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
321
 
322
  $api_key = $_POST['data']['api_key'];
323
 
324
- $lists = $this->mailchimp( $api_key )->get_lists();
325
 
326
  $results = array_merge( array('' => 'Select a list...'), $lists );
327
 
@@ -361,7 +215,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
361
  $api_key = $_POST['data']['api_key'];
362
  $list_id = $_POST['data']['list_id'];
363
 
364
- $interest_groups = $this->mailchimp( $api_key )->get_interest_categories_with_interests( $list_id );
365
 
366
  $results = $interest_groups;
367
 
@@ -376,6 +230,46 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
376
 
377
  } //end function ajax_get_interest_groups
378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  private function toJSON( $response ) {
380
 
381
  // Commented out due to json_encode not preserving quotes around MailChimp ids
@@ -421,18 +315,6 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
421
  return ob_get_clean();
422
  }
423
 
424
- /**
425
- * API Instance Singleton
426
- * @return Object
427
- */
428
- public function mailchimp( $api_key = null ) {
429
-
430
- $sswcmc = SSWCMC();
431
-
432
- return $sswcmc->mailchimp( $api_key );
433
-
434
- }
435
-
436
  /**
437
  * subscribe function.
438
  *
@@ -450,7 +332,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
450
  }
451
 
452
  if ( 'false' == $list_id ) {
453
- $list_id = $this->get_list();
454
  }
455
 
456
  $merge_tags = array(
@@ -458,10 +340,10 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
458
  'LNAME' => $last_name
459
  );
460
 
461
- $interest_groups = $this->interest_groups();
462
 
463
  if ( ! empty( $interest_groups) ) {
464
- $interest_groups = array_fill_keys( $this->interest_groups(), true );
465
 
466
  // Allow hooking into variables
467
  $interest_groups = apply_filters( $this->namespace_prefixed( 'subscribe_interest_groups' ), $interest_groups, $order_id, $email );
@@ -477,7 +359,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
477
  'merge_tags' => $merge_tags,
478
  'interest_groups' => $interest_groups,
479
  'email_type' => 'html',
480
- 'double_optin' => $this->double_optin(),
481
  );
482
 
483
  // Allow hooking into subscription options
@@ -489,15 +371,19 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
489
  // Log
490
  $this->log( sprintf( __( __METHOD__ . '(): Subscribing customer to MailChimp: %s', 'woocommerce-mailchimp' ), print_r( $options, true ) ) );
491
 
 
 
492
  // Call API
493
- $api_response = $this->mailchimp()->subscribe( $list_id, $email, $email_type, $merge_tags, $interest_groups, $double_optin );
 
 
494
 
495
  // Log api response
496
  $this->log( sprintf( __( __METHOD__ . '(): MailChimp API response: %s', 'woocommerce-mailchimp' ), print_r( $api_response, true ) ) );
497
 
498
  if ( $api_response === false ) {
499
  // Format error message
500
- $error_response = sprintf( __( __METHOD__ . '(): WooCommerce MailChimp subscription failed: %s (%s)', 'woocommerce-mailchimp' ), $this->mailchimp()->get_error_message(), $this->mailchimp()->get_error_code() );
501
 
502
  // Log
503
  $this->log( $error_response );
@@ -519,31 +405,22 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
519
  * @since 1.1
520
  */
521
  function maybe_add_checkout_fields() {
522
- if ( $this->is_valid() ) {
523
- if ( $this->display_opt_in() ) {
524
  do_action( $this->namespace_prefixed( 'before_opt_in_checkbox' ) );
525
- echo apply_filters( $this->namespace_prefixed( 'opt_in_checkbox' ), '<p class="form-row woocommerce-mailchimp-opt-in"><label for="ss_wc_mailchimp_opt_in"><input type="checkbox" name="ss_wc_mailchimp_opt_in" id="ss_wc_mailchimp_opt_in" value="yes"' . ($this->opt_in_checkbox_default_status() == 'checked' ? ' checked="checked"' : '') . '/> ' . esc_html( $this->opt_in_label() ) . '</label></p>' . "\n", $this->opt_in_checkbox_default_status(), $this->opt_in_label() );
526
  do_action( $this->namespace_prefixed( 'after_opt_in_checkbox' ) );
527
  }
528
  }
529
  }
530
 
531
- /**
532
- * Opt-in checkbox default support for WooCommerce 2.1
533
- *
534
- * @since 1.2.1
535
- */
536
- function checkbox_default_status( $input ) {
537
- return $this->opt_in_checkbox_default_status === 'checked' ? 1 : 0;
538
- }
539
-
540
  /**
541
  * When the checkout form is submitted, save opt-in value.
542
  *
543
  * @version 1.1
544
  */
545
  function maybe_save_checkout_fields( $order_id ) {
546
- if ( $this->display_opt_in() ) {
547
  $opt_in = isset( $_POST[ $this->namespace_prefixed( 'opt_in' ) ] ) ? 'yes' : 'no';
548
 
549
  update_post_meta( $order_id, $this->namespace_prefixed( 'opt_in' ), $opt_in );
@@ -556,7 +433,7 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
556
  * @since 1.2.2
557
  */
558
  private function log( $message ) {
559
- if ( $this->debug_enabled() ) {
560
  $logger = new WC_Logger();
561
 
562
  if ( is_array( $message ) || is_object( $message ) ) {
33
  $this->id = 'mailchimp';
34
  $this->namespace = 'ss_wc_' . $this->id;
35
  $this->label = __( 'MailChimp', 'woocommerce-mailchimp' );
36
+ $this->sswcmc = SSWCMC();
37
  $this->register_hooks();
38
 
39
  } //end function __construct
51
 
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  /**
55
  * order_status_changed function.
56
  *
58
  * @return void
59
  */
60
  public function order_status_changed( $id, $status = 'new', $new_status = 'pending' ) {
61
+ if ( $this->sswcmc->is_valid() && $new_status === $this->sswcmc->occurs() ) {
62
  // Get WC order
63
  $order = $this->wc_get_order( $id );
64
 
70
  // or the 'ss_wc_mailchimp_opt_in' is yes, subscriber the customer
71
  if ( ! $subscribe_customer || empty( $subscribe_customer ) || 'yes' === $subscribe_customer ) {
72
  // log
73
+ $this->log( sprintf( __( __METHOD__ . '(): Subscribing customer (%s) to list %s', 'woocommerce-mailchimp' ), $order->billing_email, $this->sswcmc->get_list() ) );
74
 
75
  // subscribe
76
+ $this->subscribe( $order->id, $order->billing_first_name, $order->billing_last_name, $order->billing_email, $this->sswcmc->get_list() );
77
  }
78
  }
79
  }
80
 
 
 
 
 
 
 
81
  /**
82
  * Register plugin hooks
83
  *
93
  // hook into woocommerce order status changed hook to handle the desired subscription event trigger
94
  add_action( 'woocommerce_order_status_changed', array( $this, 'order_status_changed' ), 10, 3 );
95
 
96
+ $opt_in_checkbox_display_location = $this->sswcmc->opt_in_checkbox_display_location();
97
 
98
  // Maybe add an "opt-in" field to the checkout
99
  $opt_in_checkbox_display_location = !empty( $opt_in_checkbox_display_location ) ? $opt_in_checkbox_display_location : 'woocommerce_review_order_before_submit';
111
 
112
  add_action( $opt_in_checkbox_display_location, array( $this, 'maybe_add_checkout_fields' ) );
113
 
 
 
114
  // Maybe save the "opt-in" field on the checkout
115
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'maybe_save_checkout_fields' ) );
116
 
120
 
121
  add_action( 'wp_ajax_ss_wc_mailchimp_get_interest_groups', array( $this, 'ajax_get_interest_groups' ) );
122
 
123
+ add_action( 'wp_ajax_ss_wc_mailchimp_get_merge_fields', array( $this, 'ajax_get_merge_fields' ) );
124
+
125
  } //end function ensure_tab
126
 
127
  /**
142
 
143
  $api_key = $_POST['data']['api_key'];
144
 
145
+ $account = $this->sswcmc->mailchimp()->get_account( $api_key );
146
 
147
  $results = $account;
148
 
175
 
176
  $api_key = $_POST['data']['api_key'];
177
 
178
+ $lists = $this->sswcmc->mailchimp( $api_key )->get_lists();
179
 
180
  $results = array_merge( array('' => 'Select a list...'), $lists );
181
 
215
  $api_key = $_POST['data']['api_key'];
216
  $list_id = $_POST['data']['list_id'];
217
 
218
+ $interest_groups = $this->sswcmc->mailchimp( $api_key )->get_interest_categories_with_interests( $list_id );
219
 
220
  $results = $interest_groups;
221
 
230
 
231
  } //end function ajax_get_interest_groups
232
 
233
+ /**
234
+ * Return merge fields (a.k.a. merge tags) for the passed MailChimp List
235
+ *
236
+ * @access public
237
+ * @return array
238
+ */
239
+ public function ajax_get_merge_fields() {
240
+
241
+ try {
242
+
243
+ if ( !$_POST['data']['api_key'] || empty( $_POST['data']['api_key'] ) ) {
244
+
245
+ return $this->toJSON( array( '' => __( 'Please enter your api key above.', 'ss_wc_mailchimp' ) ) );
246
+
247
+ }
248
+
249
+ if ( !$_POST['data']['list_id'] || empty( $_POST['data']['list_id'] ) ) {
250
+
251
+ return $this->toJSON( array( '' => __( 'Please select a list from above.', 'ss_wc_mailchimp' ) ) );
252
+
253
+ }
254
+
255
+ $api_key = $_POST['data']['api_key'];
256
+ $list_id = $_POST['data']['list_id'];
257
+
258
+ $merge_fields = $this->sswcmc->mailchimp( $api_key )->get_merge_fields( $list_id );
259
+
260
+ $results = $merge_fields;
261
+
262
+ }
263
+ catch ( Exception $e ) {
264
+
265
+ return $this->toJSON( array( 'error' => $e->getMessage() ) );
266
+
267
+ }
268
+
269
+ return $this->toJSON( $results );
270
+
271
+ } //end function ajax_get_merge_fields
272
+
273
  private function toJSON( $response ) {
274
 
275
  // Commented out due to json_encode not preserving quotes around MailChimp ids
315
  return ob_get_clean();
316
  }
317
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  /**
319
  * subscribe function.
320
  *
332
  }
333
 
334
  if ( 'false' == $list_id ) {
335
+ $list_id = $this->sswcmc->get_list();
336
  }
337
 
338
  $merge_tags = array(
340
  'LNAME' => $last_name
341
  );
342
 
343
+ $interest_groups = $this->sswcmc->interest_groups();
344
 
345
  if ( ! empty( $interest_groups) ) {
346
+ $interest_groups = array_fill_keys( $this->sswcmc->interest_groups(), true );
347
 
348
  // Allow hooking into variables
349
  $interest_groups = apply_filters( $this->namespace_prefixed( 'subscribe_interest_groups' ), $interest_groups, $order_id, $email );
359
  'merge_tags' => $merge_tags,
360
  'interest_groups' => $interest_groups,
361
  'email_type' => 'html',
362
+ 'double_opt_in' => $this->sswcmc->double_opt_in(),
363
  );
364
 
365
  // Allow hooking into subscription options
371
  // Log
372
  $this->log( sprintf( __( __METHOD__ . '(): Subscribing customer to MailChimp: %s', 'woocommerce-mailchimp' ), print_r( $options, true ) ) );
373
 
374
+ do_action( $this->namespace_prefixed( 'before_subscribe' ), $subscribe_options, $order_id );
375
+
376
  // Call API
377
+ $api_response = $this->sswcmc->mailchimp()->subscribe( $list_id, $email, $email_type, $merge_tags, $interest_groups, $double_opt_in );
378
+
379
+ do_action( $this->namespace_prefixed( 'after_subscribe' ), $subscribe_options, $order_id );
380
 
381
  // Log api response
382
  $this->log( sprintf( __( __METHOD__ . '(): MailChimp API response: %s', 'woocommerce-mailchimp' ), print_r( $api_response, true ) ) );
383
 
384
  if ( $api_response === false ) {
385
  // Format error message
386
+ $error_response = sprintf( __( __METHOD__ . '(): WooCommerce MailChimp subscription failed: %s (%s)', 'woocommerce-mailchimp' ), $this->sswcmc->mailchimp()->get_error_message(), $this->sswcmc->mailchimp()->get_error_code() );
387
 
388
  // Log
389
  $this->log( $error_response );
405
  * @since 1.1
406
  */
407
  function maybe_add_checkout_fields() {
408
+ if ( $this->sswcmc->is_valid() ) {
409
+ if ( $this->sswcmc->display_opt_in() ) {
410
  do_action( $this->namespace_prefixed( 'before_opt_in_checkbox' ) );
411
+ echo apply_filters( $this->namespace_prefixed( 'opt_in_checkbox' ), '<p class="form-row woocommerce-mailchimp-opt-in"><label for="ss_wc_mailchimp_opt_in"><input type="checkbox" name="ss_wc_mailchimp_opt_in" id="ss_wc_mailchimp_opt_in" value="yes"' . ($this->sswcmc->opt_in_checkbox_default_status() == 'checked' ? ' checked="checked"' : '') . '/> ' . esc_html( $this->sswcmc->opt_in_label() ) . '</label></p>' . "\n", $this->sswcmc->opt_in_checkbox_default_status(), $this->sswcmc->opt_in_label() );
412
  do_action( $this->namespace_prefixed( 'after_opt_in_checkbox' ) );
413
  }
414
  }
415
  }
416
 
 
 
 
 
 
 
 
 
 
417
  /**
418
  * When the checkout form is submitted, save opt-in value.
419
  *
420
  * @version 1.1
421
  */
422
  function maybe_save_checkout_fields( $order_id ) {
423
+ if ( $this->sswcmc->display_opt_in() ) {
424
  $opt_in = isset( $_POST[ $this->namespace_prefixed( 'opt_in' ) ] ) ? 'yes' : 'no';
425
 
426
  update_post_meta( $order_id, $this->namespace_prefixed( 'opt_in' ), $opt_in );
433
  * @since 1.2.2
434
  */
435
  private function log( $message ) {
436
+ if ( $this->sswcmc->debug_enabled() ) {
437
  $logger = new WC_Logger();
438
 
439
  if ( is_array( $message ) || is_object( $message ) ) {
includes/class-ss-wc-mailchimp-migrator.php CHANGED
@@ -11,6 +11,7 @@ final class SS_WC_MailChimp_Migrator {
11
  protected static $versions = array(
12
  '1.3.X',
13
  '2.0',
 
14
  );
15
 
16
  public static function migrate( $target_version ) {
@@ -40,31 +41,32 @@ final class SS_WC_MailChimp_Migrator {
40
  for ($start; $start < count(self::$versions) - 1; $start++) {
41
  $next = $start + 1;
42
  $current_version = self::$versions[$start];
43
- $target_version = self::$versions[$next];
44
 
45
  // error_log( 'Migrating from ' . $current_version . ' to ' . $target_version );
46
  //
47
- if ( file_exists( SS_WC_MAILCHIMP_DIR . "includes/migrations/class-ss-wc-migration-from-$current_version-to-$target_version.php" ) ) {
48
 
49
- require_once( SS_WC_MAILCHIMP_DIR . "includes/migrations/class-ss-wc-migration-from-$current_version-to-$target_version.php" );
50
 
51
- $migration_name = 'SS_WC_MailChimp_Migration_From_'. self::clean_version( $current_version ) .'_To_'. self::clean_version( $target_version );
52
 
53
- $migration = new $migration_name( $current_version, $target_version );
54
  if ( $migration->up() ) {
55
  // Update the current plugin version
56
- update_option( self::VERSION_KEY, $target_version );
57
  }
58
 
59
  }
60
  }
 
61
 
62
  }
63
 
64
  }
65
 
66
  private static function clean_version( $version ) {
67
- return str_replace( '.', '', $version );
68
  }
69
 
70
  }
11
  protected static $versions = array(
12
  '1.3.X',
13
  '2.0',
14
+ '2.0.15',
15
  );
16
 
17
  public static function migrate( $target_version ) {
41
  for ($start; $start < count(self::$versions) - 1; $start++) {
42
  $next = $start + 1;
43
  $current_version = self::$versions[$start];
44
+ $next_version = self::$versions[$next];
45
 
46
  // error_log( 'Migrating from ' . $current_version . ' to ' . $target_version );
47
  //
48
+ if ( file_exists( SS_WC_MAILCHIMP_DIR . "includes/migrations/class-ss-wc-migration-from-$current_version-to-$next_version.php" ) ) {
49
 
50
+ require_once( SS_WC_MAILCHIMP_DIR . "includes/migrations/class-ss-wc-migration-from-$current_version-to-$next_version.php" );
51
 
52
+ $migration_name = 'SS_WC_MailChimp_Migration_From_'. self::clean_version( $current_version ) .'_To_'. self::clean_version( $next_version );
53
 
54
+ $migration = new $migration_name( $current_version, $next_version );
55
  if ( $migration->up() ) {
56
  // Update the current plugin version
57
+ update_option( self::VERSION_KEY, $next_version );
58
  }
59
 
60
  }
61
  }
62
+ //update_option( self::VERSION_KEY, $target_version );
63
 
64
  }
65
 
66
  }
67
 
68
  private static function clean_version( $version ) {
69
+ return str_replace( '.', '_', $version );
70
  }
71
 
72
  }
includes/class-ss-wc-mailchimp-plugin.php CHANGED
@@ -9,7 +9,7 @@ final class SS_WC_MailChimp_Plugin {
9
  * Plugin version
10
  * @var string
11
  */
12
- private static $version = '2.0.14';
13
 
14
  /**
15
  * Plugin singleton instance
@@ -91,6 +91,7 @@ final class SS_WC_MailChimp_Plugin {
91
  if ( empty( $this->settings ) || true === $refresh ) {
92
 
93
  $defaults = require( SS_WC_MAILCHIMP_DIR . 'config/default-settings.php' );
 
94
  $settings = array();
95
 
96
  foreach ( $defaults as $key => $default_value ) {
@@ -100,13 +101,159 @@ final class SS_WC_MailChimp_Plugin {
100
  $settings[ $key ] = $setting_value ? $setting_value : $default_value;
101
  }
102
 
103
- $this->settings = array_merge( $defaults, $settings );
 
 
 
 
104
 
105
  }
106
 
107
  return $this->settings;
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  /**
111
  * Saves the settings back to the DB
112
  * @return void
@@ -136,6 +283,7 @@ final class SS_WC_MailChimp_Plugin {
136
  $api_key = $api_key ? $api_key : $settings['api_key'];
137
  $debug = $debug ? $debug : $settings['debug'];
138
 
 
139
  $this->mailchimp = new SS_WC_MailChimp( $api_key, $debug );
140
 
141
  delete_transient( 'sswcmc_lists' );
@@ -255,6 +403,10 @@ final class SS_WC_MailChimp_Plugin {
255
  */
256
  private function add_hooks() {
257
 
 
 
 
 
258
  //add_action( 'plugins_loaded', array( self::$instance, 'on_plugins_loaded' ) );
259
 
260
  // Add the "Settings" links on the Plugins administration screen
9
  * Plugin version
10
  * @var string
11
  */
12
+ private static $version = '2.0.15';
13
 
14
  /**
15
  * Plugin singleton instance
91
  if ( empty( $this->settings ) || true === $refresh ) {
92
 
93
  $defaults = require( SS_WC_MAILCHIMP_DIR . 'config/default-settings.php' );
94
+ $defaults = apply_filters( 'ss_wc_mailchimp_default_settings', $defaults );
95
  $settings = array();
96
 
97
  foreach ( $defaults as $key => $default_value ) {
101
  $settings[ $key ] = $setting_value ? $setting_value : $default_value;
102
  }
103
 
104
+ $merged_settings = apply_filters( 'ss_wc_mailchimp_settings', array_merge( $defaults, $settings ) );
105
+
106
+ $this->settings = $merged_settings;
107
+
108
+ $this->mailchimp( $settings['api_key'] );
109
 
110
  }
111
 
112
  return $this->settings;
113
  }
114
 
115
+ /**
116
+ * api_key function.
117
+ * @return string MailChimp API Key
118
+ */
119
+ public function api_key() {
120
+ return $this->settings[ 'api_key' ];
121
+ }
122
+
123
+ /**
124
+ * is_enabled function.
125
+ *
126
+ * @access public
127
+ * @return boolean
128
+ */
129
+ public function is_enabled() {
130
+ return 'yes' === $this->settings[ 'enabled' ];
131
+ }
132
+
133
+ /**
134
+ * has_list function.
135
+ *
136
+ * @access public
137
+ * @return boolean
138
+ */
139
+ public function has_list() {
140
+ $has_list = false;
141
+
142
+ if ( $this->get_list() ) {
143
+ $has_list = true;
144
+ }
145
+ return apply_filters( 'ss_wc_mailchimp_has_list', $has_list );
146
+ }
147
+
148
+ /**
149
+ * occurs function
150
+ * @return string
151
+ */
152
+ public function occurs() {
153
+ return $this->settings[ 'occurs' ];
154
+ }
155
+
156
+ /**
157
+ * get_list function.
158
+ *
159
+ * @access public
160
+ * @return string MailChimp list ID
161
+ */
162
+ public function get_list() {
163
+ return $this->settings[ 'list' ];
164
+ }
165
+
166
+ /**
167
+ * double_opt_in function.
168
+ *
169
+ * @access public
170
+ * @return boolean
171
+ */
172
+ public function double_opt_in() {
173
+ return 'yes' === $this->settings[ 'double_opt_in' ];
174
+ }
175
+
176
+ /**
177
+ * display_opt_in function.
178
+ *
179
+ * @access public
180
+ * @return boolean
181
+ */
182
+ public function display_opt_in() {
183
+ return 'yes' === $this->settings[ 'display_opt_in' ];
184
+ }
185
+
186
+ /**
187
+ * opt_in_label function.
188
+ *
189
+ * @access public
190
+ * @return string
191
+ */
192
+ public function opt_in_label() {
193
+ return $this->settings[ 'opt_in_label' ];
194
+ }
195
+
196
+ /**
197
+ * opt_in_checkbox_default_status function.
198
+ *
199
+ * @access public
200
+ * @return string
201
+ */
202
+ public function opt_in_checkbox_default_status() {
203
+ return $this->settings[ 'opt_in_checkbox_default_status' ];
204
+ }
205
+
206
+ /**
207
+ * opt_in_checkbox_display_location function.
208
+ *
209
+ * @access public
210
+ * @return string
211
+ */
212
+ public function opt_in_checkbox_display_location() {
213
+ return $this->settings[ 'opt_in_checkbox_display_location' ];
214
+ }
215
+
216
+ /**
217
+ * interests function.
218
+ *
219
+ * @access public
220
+ * @return array
221
+ */
222
+ public function interest_groups() {
223
+ return $this->settings[ 'interest_groups' ];
224
+ }
225
+
226
+ /**
227
+ * has_api_key function.
228
+ *
229
+ * @access public
230
+ * @return boolean
231
+ */
232
+ public function has_api_key() {
233
+ $api_key = $this->api_key();
234
+ return !empty( $api_key );
235
+ }
236
+
237
+ /**
238
+ * is_valid function.
239
+ *
240
+ * @access public
241
+ * @return boolean
242
+ */
243
+ public function is_valid() {
244
+ return $this->is_enabled() && $this->has_api_key() && $this->has_list();
245
+ }
246
+
247
+ /**
248
+ * debug_enabled function.
249
+ *
250
+ * @access public
251
+ * @return boolean
252
+ */
253
+ public function debug_enabled() {
254
+ return 'yes' === $this->settings[ 'debug' ];
255
+ }
256
+
257
  /**
258
  * Saves the settings back to the DB
259
  * @return void
283
  $api_key = $api_key ? $api_key : $settings['api_key'];
284
  $debug = $debug ? $debug : $settings['debug'];
285
 
286
+ require_once( SS_WC_MAILCHIMP_DIR . 'includes/class-ss-wc-mailchimp.php' );
287
  $this->mailchimp = new SS_WC_MailChimp( $api_key, $debug );
288
 
289
  delete_transient( 'sswcmc_lists' );
403
  */
404
  private function add_hooks() {
405
 
406
+ /** Register hooks that are fired when the plugin is activated and deactivated. */
407
+ register_activation_hook( SS_WC_MAILCHIMP_FILE, array( __CLASS__, 'activate' ) );
408
+ register_deactivation_hook( SS_WC_MAILCHIMP_FILE, array( __CLASS__, 'deactivate' ) );
409
+
410
  //add_action( 'plugins_loaded', array( self::$instance, 'on_plugins_loaded' ) );
411
 
412
  // Add the "Settings" links on the Plugins administration screen
includes/class-ss-wc-mailchimp.php CHANGED
@@ -102,11 +102,11 @@ class SS_WC_MailChimp {
102
 
103
  } //end function get_lists
104
 
105
- public function subscribe( $list_id, $email_address, $email_type, $merge_fields, $interests, $double_optin ) {
106
 
107
  $args = array(
108
  'email_address' => $email_address,
109
- 'status' => $double_optin ? 'pending' : 'subscribed',
110
  'email_type' => $email_type,
111
  'merge_fields' => $merge_fields,
112
  );
@@ -138,21 +138,31 @@ class SS_WC_MailChimp {
138
  */
139
  public function get_merge_fields( $list_id ) {
140
 
141
- $resource = "lists/$list_id/merge-fields";
142
 
143
- $response = $this->api->get( $resource );
144
 
145
- if ( ! $response ) {
146
- return false;
147
- }
148
 
149
- $merge_fields = $response['merge_fields'];
 
 
150
 
151
- $results = array();
 
 
152
 
153
- foreach ( $merge_fields as $merge_field ) {
 
 
 
 
 
 
 
154
 
155
- $results[ $merge_field['id'] ] = $merge_field['tag'];
 
156
 
157
  }
158
 
102
 
103
  } //end function get_lists
104
 
105
+ public function subscribe( $list_id, $email_address, $email_type, $merge_fields, $interests, $double_opt_in ) {
106
 
107
  $args = array(
108
  'email_address' => $email_address,
109
+ 'status' => $double_opt_in ? 'pending' : 'subscribed',
110
  'email_type' => $email_type,
111
  'merge_fields' => $merge_fields,
112
  );
138
  */
139
  public function get_merge_fields( $list_id ) {
140
 
141
+ if ( ! $results = get_transient( "sswcmc_{$list_id}_merge_fields" ) ) {
142
 
143
+ $resource = "lists/$list_id/merge-fields";
144
 
145
+ $response = $this->api->get( $resource );
 
 
146
 
147
+ if ( ! $response ) {
148
+ return false;
149
+ }
150
 
151
+ $merge_fields = $response['merge_fields'];
152
+
153
+ $results = array();
154
 
155
+ foreach ( $merge_fields as $merge_field ) {
156
+
157
+ $results[ $merge_field['tag'] ] = array(
158
+ 'name' => sprintf( '%s (%s)', $merge_field['name'], $merge_field['tag'] ),
159
+ 'required' => $merge_field['required'],
160
+ );
161
+
162
+ }
163
 
164
+ // Cache list merge tags for 15 minutes
165
+ set_transient( "sswcmc_{$list_id}_merge_fields", $results, 60*15*1 );
166
 
167
  }
168
 
includes/class-ss-wc-settings-mailchimp.php CHANGED
@@ -44,7 +44,6 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
44
  $this->id = 'mailchimp';
45
  $this->namespace = 'ss_wc_' . $this->id;
46
  $this->label = __( 'MailChimp', 'woocommerce-mailchimp' );
47
-
48
  $this->init();
49
 
50
  $this->register_hooks();
@@ -94,7 +93,7 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
94
  * @return boolean
95
  */
96
  public function double_optin() {
97
- return 'yes' === $this->get_option( 'double_optin' );
98
  }
99
 
100
  /**
@@ -277,6 +276,8 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
277
  })(jQuery);
278
  ");
279
 
 
 
280
  }
281
 
282
  /**
@@ -296,7 +297,7 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
296
  $sswcmc = SSWCMC();
297
  // Trigger reload of plugin settings
298
  $settings = $sswcmc->settings( true );
299
- $sswcmc->mailchimp( $settings['api_key'] );
300
  }
301
 
302
  /**
@@ -306,6 +307,8 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
306
  */
307
  public function get_settings( $current_section = '' ) {
308
 
 
 
309
  if ( '' === $current_section ) {
310
 
311
  $settings = array(
@@ -373,6 +376,8 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
373
  'desc_tip' => true,
374
  );
375
 
 
 
376
  $settings[] = array(
377
  'id' => $this->namespace_prefixed( 'occurs' ),
378
  'title' => __( 'Subscribe Event', 'woocommerce-mailchimp' ),
@@ -389,7 +394,7 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
389
  );
390
 
391
  $settings[] = array(
392
- 'id' => $this->namespace_prefixed( 'double_optin' ),
393
  'title' => __( 'Double Opt-In', 'woocommerce-mailchimp' ),
394
  'desc' => __( 'Enable Double Opt-In', 'woocommerce-mailchimp' ),
395
  'type' => 'checkbox',
@@ -457,10 +462,10 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
457
  'desc_tip' => true,
458
  );
459
 
460
- $settings[] = array( 'type' => 'sectionend', 'id' => 'general_options' );
461
-
462
  $settings = apply_filters( $this->namespace_prefixed( 'settings_general' ), $settings );
463
 
 
 
464
  } elseif ( 'troubleshooting' === $current_section ) {
465
 
466
  $label = __( 'Enable Logging', 'woocommerce-mailchimp' );
44
  $this->id = 'mailchimp';
45
  $this->namespace = 'ss_wc_' . $this->id;
46
  $this->label = __( 'MailChimp', 'woocommerce-mailchimp' );
 
47
  $this->init();
48
 
49
  $this->register_hooks();
93
  * @return boolean
94
  */
95
  public function double_optin() {
96
+ return 'yes' === $this->get_option( 'double_opt_in' );
97
  }
98
 
99
  /**
276
  })(jQuery);
277
  ");
278
 
279
+ do_action( 'ss_wc_mailchimp_after_settings_enqueue_js' );
280
+
281
  }
282
 
283
  /**
297
  $sswcmc = SSWCMC();
298
  // Trigger reload of plugin settings
299
  $settings = $sswcmc->settings( true );
300
+
301
  }
302
 
303
  /**
307
  */
308
  public function get_settings( $current_section = '' ) {
309
 
310
+ $settings = array();
311
+
312
  if ( '' === $current_section ) {
313
 
314
  $settings = array(
376
  'desc_tip' => true,
377
  );
378
 
379
+ $settings = apply_filters( $this->namespace_prefixed( 'settings_general_after_interest_groups' ), $settings );
380
+
381
  $settings[] = array(
382
  'id' => $this->namespace_prefixed( 'occurs' ),
383
  'title' => __( 'Subscribe Event', 'woocommerce-mailchimp' ),
394
  );
395
 
396
  $settings[] = array(
397
+ 'id' => $this->namespace_prefixed( 'double_opt_in' ),
398
  'title' => __( 'Double Opt-In', 'woocommerce-mailchimp' ),
399
  'desc' => __( 'Enable Double Opt-In', 'woocommerce-mailchimp' ),
400
  'type' => 'checkbox',
462
  'desc_tip' => true,
463
  );
464
 
 
 
465
  $settings = apply_filters( $this->namespace_prefixed( 'settings_general' ), $settings );
466
 
467
+ $settings[] = array( 'type' => 'sectionend', 'id' => 'general_options' );
468
+
469
  } elseif ( 'troubleshooting' === $current_section ) {
470
 
471
  $label = __( 'Enable Logging', 'woocommerce-mailchimp' );
includes/migrations/class-ss-wc-migration-from-1.3.X-to-2.0.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- final class SS_WC_MailChimp_Migration_From_13X_To_20 extends SS_WC_MailChimp_Migration {
4
 
5
  public function __construct( $current_version, $target_version ) {
6
  parent::__construct( $current_version, $target_version );
1
  <?php
2
 
3
+ final class SS_WC_MailChimp_Migration_From_1_3_X_To_2_0 extends SS_WC_MailChimp_Migration {
4
 
5
  public function __construct( $current_version, $target_version ) {
6
  parent::__construct( $current_version, $target_version );
includes/migrations/class-ss-wc-migration-from-2.0-to-2.0.15.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ final class SS_WC_MailChimp_Migration_From_2_0_To_2_0_15 extends SS_WC_MailChimp_Migration {
4
+
5
+ public function __construct( $current_version, $target_version ) {
6
+ parent::__construct( $current_version, $target_version );
7
+ }
8
+
9
+ /**
10
+ * [up description]
11
+ * @return [type] [description]
12
+ */
13
+ public function up() {
14
+
15
+ try {
16
+
17
+ $wrong_double_optin_setting_name = $this->namespace_prefixed('double_optin' );
18
+
19
+ if ( !$wrong_double_optin_setting = get_option( $wrong_double_optin_setting_name ) ) {
20
+ // we didn't find the wrong double optin setting (ss_wc_mailchimp_double_optin) saved in the database, so nothing to do
21
+ return true;
22
+ }
23
+
24
+ // Let's set the correct double opt in setting
25
+ $this->settings['double_opt_in'] = $wrong_double_optin_setting;
26
+
27
+ // Save the settings
28
+ $this->save_settings();
29
+
30
+ // Finally, let's delete the wrong setting so we don't cause any confusion
31
+ delete_option( $wrong_double_optin_setting_name );
32
+
33
+ } catch (Exception $e) {
34
+ return false;
35
+ }
36
+
37
+ return true;
38
+
39
+ }
40
+
41
+ /**
42
+ * [down description]
43
+ * @return [type] [description]
44
+ */
45
+ public function down() {
46
+
47
+ throw new Exception('Cannot rollback to versions prior to 2.0.15');
48
+
49
+ }
50
+
51
+ }
includes/migrations/class-ss-wc-migration.php CHANGED
@@ -59,7 +59,7 @@ abstract class SS_WC_MailChimp_Migration {
59
 
60
  } else {
61
 
62
- foreach ( $this->$setting_keys as $key ) {
63
  $this->settings[ $key ] = get_option( $this->namespace_prefixed( $key ) );
64
  }
65
 
@@ -89,7 +89,7 @@ abstract class SS_WC_MailChimp_Migration {
89
 
90
  }
91
 
92
- private function namespace_prefixed( $suffix ) {
93
  return $this->namespace . '_' . $suffix;
94
  }
95
 
59
 
60
  } else {
61
 
62
+ foreach ( $this->setting_keys as $key ) {
63
  $this->settings[ $key ] = get_option( $this->namespace_prefixed( $key ) );
64
  }
65
 
89
 
90
  }
91
 
92
+ protected function namespace_prefixed( $suffix ) {
93
  return $this->namespace . '_' . $suffix;
94
  }
95
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://ssms.us/hVdk
4
  Tags: woocommerce, mailchimp
5
  Requires at least: 3.5.1
6
  Tested up to: 4.6.1
7
- Stable tag: 2.0.14
8
  License: GPLv3
9
 
10
  Simple and flexible MailChimp integration for WooCommerce.
@@ -115,6 +115,13 @@ Also, if you enjoy using the software [we'd love it if you could give us a revie
115
 
116
  **IMPORTANT:** You must upgrade to version 2.X by December 31, 2016 as prior versions of the MailChimp API will stop working at that point.
117
 
 
 
 
 
 
 
 
118
  #### 2.0.13 - 2.0.14 - September 20, 2016
119
 
120
  - Added plugin compatibility checks for minimum supported versions of WooCommerce, WordPress and PHP.
4
  Tags: woocommerce, mailchimp
5
  Requires at least: 3.5.1
6
  Tested up to: 4.6.1
7
+ Stable tag: 2.0.15
8
  License: GPLv3
9
 
10
  Simple and flexible MailChimp integration for WooCommerce.
115
 
116
  **IMPORTANT:** You must upgrade to version 2.X by December 31, 2016 as prior versions of the MailChimp API will stop working at that point.
117
 
118
+ #### 2.0.15 - September 22, 2016
119
+
120
+ - Fix for activation error running migrations.
121
+ - Double opt-in fix.
122
+ - Added additional hooks and filters.
123
+ - Code cleanup.
124
+
125
  #### 2.0.13 - 2.0.14 - September 20, 2016
126
 
127
  - Added plugin compatibility checks for minimum supported versions of WooCommerce, WordPress and PHP.
woocommerce-mailchimp.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Saint Systems
7
  * Author URI: https://www.saintsystems.com
8
- * Version: 2.0.14
9
  * Text Domain: woocommerce-mailchimp
10
  * Domain Path: languages
11
  *
@@ -32,16 +32,11 @@ define( 'SS_WC_MAILCHIMP_FILE', __FILE__ );
32
  */
33
  require_once( 'includes/class-ss-wc-mailchimp-plugin.php' );
34
 
35
- /** Register hooks that are fired when the plugin is activated and deactivated. */
36
- if ( is_admin() ) {
37
- register_activation_hook( SS_WC_MAILCHIMP_FILE, array( 'SS_WC_MailChimp_Plugin', 'activate' ) );
38
- register_deactivation_hook( SS_WC_MAILCHIMP_FILE, array( 'SS_WC_MailChimp_Plugin', 'deactivate' ) );
39
- }
40
-
41
  //add_action( 'plugins_loaded', array( 'SS_WC_MailChimp_Plugin', 'instance' ), 0 );
42
  function SSWCMC() {
43
  return SS_WC_MailChimp_Plugin::get_instance();
44
  }
45
 
46
  // Get WooCommerce Mailchimp Running.
47
- add_action( 'plugins_loaded', 'SSWCMC', 0 );
 
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Saint Systems
7
  * Author URI: https://www.saintsystems.com
8
+ * Version: 2.0.15
9
  * Text Domain: woocommerce-mailchimp
10
  * Domain Path: languages
11
  *
32
  */
33
  require_once( 'includes/class-ss-wc-mailchimp-plugin.php' );
34
 
 
 
 
 
 
 
35
  //add_action( 'plugins_loaded', array( 'SS_WC_MailChimp_Plugin', 'instance' ), 0 );
36
  function SSWCMC() {
37
  return SS_WC_MailChimp_Plugin::get_instance();
38
  }
39
 
40
  // Get WooCommerce Mailchimp Running.
41
+ //add_action( 'plugins_loaded', 'SSWCMC', 0 );
42
+ SSWCMC();