WooCommerce MailChimp - Version 2.0.13

Version Description

Download this release

Release Info

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

Code changes from version 2.0.12 to 2.0.13

assets/js/woocommerce-mailchimp-admin.js CHANGED
@@ -57,10 +57,6 @@ var SS_WC_MailChimp = function($) {
57
  $interestGroups.attr('disabled','disabled');
58
  }
59
 
60
- $apiKey.on('focus', function() {
61
- apiKeyChangeTriggered = false;
62
- });
63
-
64
  $apiKey.change(function() {
65
  checkApiKey($apiKey.val(), true);
66
  });
@@ -94,7 +90,7 @@ var SS_WC_MailChimp = function($) {
94
  $optInCheckboxLocation.closest('tr').hide();
95
  $doubleOptIn.closest('tr').hide();
96
  $displayOptIn.change(function() {
97
- if ($apiKey.val() === '') return;
98
 
99
  switch ($displayOptIn.val()) {
100
  case 'no':
@@ -189,7 +185,8 @@ var SS_WC_MailChimp = function($) {
189
  result = $.parseJSON(response);
190
  } catch (err) {
191
  console.error(err);
192
- alert(' '+SS_WC_MailChimp_Messages.error_loading_account);
 
193
  return;
194
  }
195
 
57
  $interestGroups.attr('disabled','disabled');
58
  }
59
 
 
 
 
 
60
  $apiKey.change(function() {
61
  checkApiKey($apiKey.val(), true);
62
  });
90
  $optInCheckboxLocation.closest('tr').hide();
91
  $doubleOptIn.closest('tr').hide();
92
  $displayOptIn.change(function() {
93
+ if ( '' === $apiKey.val() ) return;
94
 
95
  switch ($displayOptIn.val()) {
96
  case 'no':
185
  result = $.parseJSON(response);
186
  } catch (err) {
187
  console.error(err);
188
+ $accountIndicator.addClass('error');
189
+ $accountIndicator.html(' '+SS_WC_MailChimp_Messages.error_loading_account);
190
  return;
191
  }
192
 
includes/class-ss-wc-mailchimp-admin-notices.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce MailChimp Admin notices
4
+ *
5
+ * @package WooCommerce MailChimp
6
+ * @author Saint Systems, LLC
7
+ * @link http://www.saintsystems.com
8
+ * @copyright Copyright 2016, Saint Systems, LLC
9
+ *
10
+ * @since 2.0.13
11
+ */
12
+
13
+ /**
14
+ * Handle displaying and storing of admin notices for WooCommerce MailChimp
15
+ * @since 2.0.13
16
+ */
17
+ class SS_WC_MailChimp_Admin_Notices {
18
+
19
+ static private $admin_notices = array();
20
+
21
+ static private $dismissed_notices = array();
22
+
23
+ function __construct() {
24
+
25
+ $this->add_hooks();
26
+ }
27
+
28
+ function add_hooks() {
29
+ add_action( 'network_admin_notices', array( $this, 'dismiss_notice' ), 50 );
30
+ add_action( 'admin_notices', array( $this, 'dismiss_notice' ), 50 );
31
+ add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 );
32
+ add_action( 'network_admin_notices', array( $this, 'admin_notice' ), 100 );
33
+ }
34
+
35
+ /**
36
+ * Dismiss a WooCommerce notice - stores the dismissed notices for 16 weeks
37
+ * @return void
38
+ */
39
+ public function dismiss_notice() {
40
+
41
+ // No dismiss sent
42
+ if ( empty( $_GET['sswcmc-dismiss'] ) ) {
43
+ return;
44
+ }
45
+
46
+ // Invalid nonce
47
+ if ( !wp_verify_nonce( $_GET['sswcmc-dismiss'], 'dismiss' ) ) {
48
+ return;
49
+ }
50
+
51
+ $notice_id = esc_attr( $_GET['notice'] );
52
+
53
+ //don't display a message if use has dismissed the message for this version
54
+ $dismissed_notices = (array)get_transient( 'ss_wc_mailchimp_dismissed_notices' );
55
+
56
+ $dismissed_notices[] = $notice_id;
57
+
58
+ $dismissed_notices = array_unique( $dismissed_notices );
59
+
60
+ // Remind users every 16 weeks
61
+ set_transient( 'ss_wc_mailchimp_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS * 16 );
62
+
63
+ }
64
+
65
+ /**
66
+ * Should the notice be shown in the admin (Has it been dismissed already)?
67
+ *
68
+ * If the passed notice array has a `dismiss` key, the notice is dismissable. If it's dismissable,
69
+ * we check against other notices that have already been dismissed.
70
+ *
71
+ * @see GravityView_Admin::dismiss_notice()
72
+ * @see GravityView_Admin::add_notice()
73
+ * @param string $notice Notice array, set using `add_notice()`.
74
+ * @return boolean True: show notice; False: hide notice
75
+ */
76
+ function _maybe_show_notice( $notice ) {
77
+
78
+ // There are no dismissed notices.
79
+ if( empty( self::$dismissed_notices ) ) {
80
+ return true;
81
+ }
82
+
83
+ // Has the
84
+ $is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices );
85
+
86
+ return $is_dismissed ? false : true;
87
+ }
88
+
89
+ /**
90
+ * Get admin notices
91
+ * @since 1.12
92
+ * @return array
93
+ */
94
+ public static function get_notices() {
95
+ return self::$admin_notices;
96
+ }
97
+
98
+ /**
99
+ * Handle whether to display notices in Multisite based on plugin activation status
100
+ *
101
+ * @since 2.0.13
102
+ *
103
+ * @return bool True: show the notices; false: don't show
104
+ */
105
+ private function check_show_multisite_notices() {
106
+
107
+ if ( ! is_multisite() ) {
108
+ return true;
109
+ }
110
+
111
+ // It's network activated but the user can't manage network plugins; they can't do anything about it.
112
+ if ( SS_WC_MailChimp_Plugin::is_network_activated() && ! is_main_site() ) {
113
+ return false;
114
+ }
115
+
116
+ // or they don't have admin capabilities
117
+ if ( ! is_super_admin() ) {
118
+ return false;
119
+ }
120
+
121
+ return true;
122
+ }
123
+
124
+ /**
125
+ * Outputs the admin notices generated by the plugin
126
+ *
127
+ * @since 2.0.13
128
+ *
129
+ * @return void
130
+ */
131
+ public function admin_notice() {
132
+
133
+ /**
134
+ * Modify the notices displayed
135
+ * @since 2.0.13
136
+ */
137
+ $notices = apply_filters( 'ss_wc_mailchimp/admin/notices', self::$admin_notices );
138
+
139
+ if( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
140
+ return;
141
+ }
142
+
143
+ //don't display a message if use has dismissed the message for this version
144
+ self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'ss_wc_mailchimp_dismissed_notices' );
145
+
146
+ foreach( $notices as $notice ) {
147
+
148
+ if( false === $this->_maybe_show_notice( $notice ) ) {
149
+ continue;
150
+ }
151
+
152
+ echo '<div id="message" class="notice '. sswcmc_sanitize_html_class( $notice['class'] ).'">';
153
+
154
+ if( !empty( $notice['title'] ) ) {
155
+ echo '<h3>'.esc_html( $notice['title'] ) .'</h3>';
156
+ }
157
+
158
+ echo wpautop( $notice['message'] );
159
+
160
+ if( !empty( $notice['dismiss'] ) ) {
161
+
162
+ $dismiss = esc_attr($notice['dismiss']);
163
+
164
+ $url = esc_url( add_query_arg( array( 'sswcmc-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) );
165
+
166
+ echo wpautop( '<a href="'.$url.'" data-notice="'.$dismiss.'" class="button-small button button-secondary">'.esc_html__( 'Dismiss', 'woocommerce-mailchimp' ).'</a>' );
167
+ }
168
+
169
+ echo '<div class="clear"></div>';
170
+ echo '</div>';
171
+
172
+ }
173
+
174
+ //reset the notices handler
175
+ self::$admin_notices = array();
176
+ }
177
+
178
+ /**
179
+ * Add a notice to be displayed in the admin.
180
+ * @param array $notice Array with `class` and `message` keys. The message is not escaped.
181
+ */
182
+ public static function add_notice( $notice = array() ) {
183
+
184
+ if( !isset( $notice['message'] ) ) {
185
+ do_action( 'ss_wc_mailchimp_log_error', 'SSWCMC_Admin[add_notice] Notice not set', $notice );
186
+ return;
187
+ }
188
+
189
+ $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
190
+
191
+ self::$admin_notices[] = $notice;
192
+ }
193
+ }
includes/class-ss-wc-mailchimp-compatibility.php ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handle issues with plugin and version compatibility
4
+ *
5
+ * @package WooCommerce MailChimp
6
+ * @author Saint Systems, LLC
7
+ * @link http://www.saintsystems.com
8
+ * @copyright Copyright 2016, Saint Systems, LLC
9
+ *
10
+ * @since 2.0.13
11
+ */
12
+
13
+ /**
14
+ * Handle WooCommerce MailChimp compatibility notices and fallback shortcodes
15
+ * @since 2.0.13
16
+ */
17
+ final class SS_WC_MailChimp_Compatibility {
18
+
19
+ /**
20
+ * Plugin singleton instance
21
+ * @var SS_WC_MailChimp_Compatibility
22
+ */
23
+ private static $instance = null;
24
+
25
+ /**
26
+ * @var bool Is WooCommerce version valid and is WooCommerce loaded?
27
+ */
28
+ public static $valid_woocommerce = false;
29
+
30
+ /**
31
+ * @var bool Is the WordPress installation compatible?
32
+ */
33
+ public static $valid_wordpress = false;
34
+
35
+ /**
36
+ * @var bool Is the server's PHP version compatible?
37
+ */
38
+ public static $valid_php = false;
39
+
40
+ /**
41
+ * @var array Holder for notices to be displayed in frontend shortcodes if not valid
42
+ */
43
+ static private $notices = array();
44
+
45
+ function __construct() {
46
+
47
+ self::$valid_woocommerce = self::check_woocommerce();
48
+
49
+ self::$valid_wordpress = self::check_wordpress();
50
+
51
+ self::$valid_php = self::check_php();
52
+
53
+ $this->add_hooks();
54
+ }
55
+
56
+ function add_hooks() {
57
+
58
+ add_filter( 'ss_wc_mailchimp/admin/notices', array( $this, 'insert_admin_notices' ) );
59
+
60
+ }
61
+
62
+ /**
63
+ * Add the compatibility notices to the other admin notices
64
+ * @param array $notices
65
+ *
66
+ * @return array
67
+ */
68
+ function insert_admin_notices( $notices = array() ) {
69
+
70
+ return array_merge( $notices, self::$notices );
71
+
72
+ } //end function insert_admin_notices
73
+
74
+ /**
75
+ * @return SS_WC_MailChimp_Compatibility
76
+ */
77
+ public static function get_instance() {
78
+
79
+ if ( empty( self::$instance ) ) {
80
+ self::$instance = new self;
81
+ }
82
+
83
+ return self::$instance;
84
+
85
+ }
86
+
87
+ /**
88
+ * Is everything compatible with this version of the plugin?
89
+ * @return bool
90
+ */
91
+ public static function is_valid() {
92
+
93
+ return ( self::is_valid_woocommerce()
94
+ && self::is_valid_wordpress()
95
+ && self::is_valid_php()
96
+ );
97
+
98
+ }
99
+
100
+ /**
101
+ * Is the version of WordPress compatible?
102
+ * @since 2.0.13
103
+ */
104
+ static function is_valid_wordpress() {
105
+ return self::$valid_wordpress;
106
+ }
107
+
108
+ /**
109
+ * @since 2.0.13
110
+ * @return bool
111
+ */
112
+ static function is_valid_woocommerce() {
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
127
+ */
128
+ static function is_valid_php() {
129
+ return self::$valid_php;
130
+ }
131
+
132
+ /**
133
+ * Get admin notices
134
+ * @since 2.0.13
135
+ * @return array
136
+ */
137
+ public static function get_notices() {
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
+ *
171
+ * @since 2.0.13
172
+ * @return boolean
173
+ */
174
+ public static function check_php() {
175
+ if ( false === version_compare( phpversion(), SS_WC_MAILCHIMP_MIN_PHP_VERSION , '>=' ) ) {
176
+
177
+ self::$notices['php_version'] = array(
178
+ 'class' => 'notice-error',
179
+ 'message' => sprintf( __( "%sWooCommerce MailChimp requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'woocommerce-mailchimp' ), '<h3>', SS_WC_MAILCHIMP_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' )
180
+ );
181
+
182
+ return false;
183
+ }
184
+
185
+ return true;
186
+ }
187
+
188
+ /**
189
+ * Is WordPress compatible?
190
+ *
191
+ * @since 2.0.13
192
+ * @return boolean
193
+ */
194
+ public static function check_wordpress() {
195
+ global $wp_version;
196
+
197
+ if ( version_compare( $wp_version, SS_WC_MAILCHIMP_MIN_WP_VERSION ) <= 0 ) {
198
+
199
+ self::$notices['wp_version'] = array(
200
+ 'class' => 'notice-error',
201
+ 'message' => sprintf( __( "%sWooCommerce MailChimp requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'woocommerce-mailchimp' ), '<h3>', SS_WC_MAILCHIMP_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' )
202
+ );
203
+
204
+ return false;
205
+ }
206
+
207
+ return true;
208
+
209
+ } //end public static function check_wordpress()
210
+
211
+
212
+ /**
213
+ * Check if WooCommerce plugin is active and show notice if not.
214
+ *
215
+ * @since 2.0.13
216
+ *
217
+ * @access public
218
+ * @return boolean True: checks have been passed; WooCommerce MailChimp is fine to run; False: checks have failed, don't continue loading
219
+ */
220
+ public static function check_woocommerce() {
221
+
222
+ $woocommerce_is_active = false;
223
+
224
+ // Bypass other checks: if the class exists
225
+ if ( class_exists( 'WooCommerce' ) ) {
226
+
227
+ $woocommerce_is_active = true;
228
+ $woocommerce_version = WC()->version;
229
+
230
+ } else {
231
+
232
+ if ( $wc_status = self::get_plugin_status( 'woocommerce/woocommerce.php' ) ) {
233
+ if ( true === $wc_status ) {
234
+ $woocommerce_is_active = true;
235
+ }
236
+ $wc_data = get_plugin_data( WP_CONTENT_DIR . '/plugins/woocommerce/woocommerce.php' );
237
+ $woocommerce_version = $wc_data['Version'];
238
+ }
239
+
240
+ }
241
+
242
+ if ( true === $woocommerce_is_active ) {
243
+ // and the version's right, we're good.
244
+ if ( true === version_compare( $woocommerce_version, SS_WC_MAILCHIMP_MIN_WC_VERSION, ">=" ) ) {
245
+ return true;
246
+ }
247
+
248
+ $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#woocommerce">' : '<strong><a href="'. wp_nonce_url( admin_url( 'update.php?action=upgrade-plugin&plugin=woocommerce/woocommerce.php' ), 'upgrade-plugin_woocommerce/woocommerce.php') . '" class="button button-large">';
249
+
250
+ // Or the version's wrong
251
+ self::$notices['wc_version'] = array(
252
+ 'class' => 'notice-error',
253
+ 'message' => sprintf( __( "%sWooCommerce MailChimp requires WooCommerce Version %s or newer.%s You're using Version %s. %sUpdate WooCommerce%s to use the WooCommerce MailChimp plugin.", 'woocommerce-mailchimp' ), '<h3>', SS_WC_MAILCHIMP_MIN_WC_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$woocommerce_version.'</span>', $button, '</strong></a>' )
254
+ );
255
+
256
+ return false;
257
+ }
258
+
259
+ /**
260
+ * The plugin is activated and yet somehow WooCommerce didn't get picked up...
261
+ * OR
262
+ * It's the Network Admin and we just don't know whether the sites have WooCommerce activated themselves.
263
+ */
264
+ if ( $woocommerce_is_active || is_network_admin() ) {
265
+ return true;
266
+ }
267
+
268
+ // If WooCommerce doesn't exist, assume WooCommerce not active
269
+ $return = false;
270
+
271
+ switch ( $wc_status ) {
272
+ case 'inactive':
273
+
274
+ // Required for multisite
275
+ if( ! function_exists('wp_create_nonce') ) {
276
+ require_once ABSPATH . WPINC . '/pluggable.php';
277
+ }
278
+
279
+ // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
280
+ if( is_multisite() ) {
281
+ wp_cookie_constants();
282
+ }
283
+
284
+ $return = false;
285
+
286
+ $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#woocommerce">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=woocommerce/woocommerce.php' ), 'activate-plugin_woocommerce/woocommerce.php') . '" class="button button-large">';
287
+
288
+ self::$notices['wc_inactive'] = array( 'class' => 'error', 'message' => sprintf( __( '%sWooCommerce MailChimp requires WooCommerce to be active. %sActivate WooCommerce%s to use the WooCommerce MailChimp plugin.', 'woocommerce-mailchimp' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ) );
289
+ break;
290
+ default:
291
+ $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#woocommerce">' : '<strong><a href="'. wp_nonce_url( admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' ) . '" class="button button-large">';
292
+
293
+ self::$notices['wc_installed'] = array( 'class' => 'error', 'message' => sprintf( __( '%sWooCommerce MailChimp requires WooCommerce to be installed in order to run properly. %sInstall WooCommerce%s to use the WooCommerce MailChimp plugin.', 'woocommerce-mailchimp' ), '<h3>', "</h3>\n\n". $button, '</a></strong>') );
294
+ break;
295
+ }
296
+
297
+ return $return;
298
+
299
+ } //end public static function check_woocommerce()
300
+
301
+ /**
302
+ * Check if specified plugin is active, inactive or not installed
303
+ *
304
+ * @access public
305
+ * @static
306
+ * @param string $location (default: '')
307
+ * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive
308
+ */
309
+ public static function get_plugin_status( $location = '' ) {
310
+
311
+ if ( ! function_exists('is_plugin_active') ) {
312
+ include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
313
+ }
314
+
315
+ if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
316
+ return true;
317
+ }
318
+
319
+ if ( !is_network_admin() && is_plugin_active( $location ) ) {
320
+ return true;
321
+ }
322
+
323
+ if (
324
+ !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
325
+ !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
326
+ ) {
327
+ return false;
328
+ }
329
+
330
+ return 'inactive';
331
+ }
332
+
333
+ } //SS_WC_MailChimp_Compatibility
includes/class-ss-wc-mailchimp-handler.php CHANGED
@@ -14,7 +14,13 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
14
  /**
15
  * @class SS_WC_MailChimp_Handler
16
  */
17
- class SS_WC_MailChimp_Handler {
 
 
 
 
 
 
18
 
19
  /**
20
  * Constructor
@@ -32,6 +38,19 @@ if ( ! class_exists( 'SS_WC_MailChimp_Handler' ) ) {
32
 
33
  } //end function __construct
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  /**
36
  * api_key function.
37
  * @return string MailChimp API Key
14
  /**
15
  * @class SS_WC_MailChimp_Handler
16
  */
17
+ final class SS_WC_MailChimp_Handler {
18
+
19
+ /**
20
+ * Plugin singleton instance
21
+ * @var SS_WC_MailChimp_Handler
22
+ */
23
+ private static $instance = null;
24
 
25
  /**
26
  * Constructor
38
 
39
  } //end function __construct
40
 
41
+ /**
42
+ * @return SS_WC_MailChimp_Handler
43
+ */
44
+ public static function get_instance() {
45
+
46
+ if ( empty( self::$instance ) ) {
47
+ self::$instance = new self;
48
+ }
49
+
50
+ return self::$instance;
51
+
52
+ }
53
+
54
  /**
55
  * api_key function.
56
  * @return string MailChimp API Key
includes/class-ss-wc-mailchimp-migrator.php CHANGED
@@ -31,7 +31,7 @@ final class SS_WC_MailChimp_Migrator {
31
 
32
  // error_log( 'Need to migrate from ' . $current_version . ' to ' . $target_version );
33
 
34
- require_once( 'migrations/class-ss-wc-migration.php' );
35
 
36
  $start = array_search( $current_version, self::$versions );
37
 
31
 
32
  // error_log( 'Need to migrate from ' . $current_version . ' to ' . $target_version );
33
 
34
+ require_once( SS_WC_MAILCHIMP_DIR . 'includes/migrations/class-ss-wc-migration.php' );
35
 
36
  $start = array_search( $current_version, self::$versions );
37
 
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.11';
13
 
14
  /**
15
  * Plugin singleton instance
@@ -35,6 +35,12 @@ final class SS_WC_MailChimp_Plugin {
35
  */
36
  private $mailchimp;
37
 
 
 
 
 
 
 
38
  /**
39
  * Returns the plugin version
40
  * @return string
@@ -48,23 +54,26 @@ final class SS_WC_MailChimp_Plugin {
48
  *
49
  * @return SS_WC_MailChimp_Plugin SS_WC_MailChimp_Plugin object
50
  */
51
- public static function instance() {
52
 
53
  if ( empty( self::$instance ) && ! ( self::$instance instanceof SS_WC_MailChimp_Plugin ) ) {
54
 
55
  self::$instance = new SS_WC_MailChimp_Plugin;
56
  self::$instance->define_constants();
57
 
58
- add_action( 'plugins_loaded', array( self::$instance, 'load_plugin_textdomain' ) );
59
-
60
  self::$instance->save_settings();
61
  self::$instance->settings();
62
  self::$instance->includes();
63
  self::$instance->mailchimp();
64
- self::$instance->handler = new SS_WC_MailChimp_Handler();
65
- self::$instance->add_hooks();
 
 
66
 
67
- do_action( 'ss_wc_mailchimp_loaded' );
 
 
 
68
 
69
  }
70
 
@@ -84,8 +93,11 @@ final class SS_WC_MailChimp_Plugin {
84
  $defaults = require( SS_WC_MAILCHIMP_DIR . 'config/default-settings.php' );
85
  $settings = array();
86
 
87
- foreach ( $defaults as $key => $val ) {
88
- $settings[ $key ] = get_option( 'ss_wc_mailchimp_' . $key );
 
 
 
89
  }
90
 
91
  $this->settings = array_merge( $defaults, $settings );
@@ -138,6 +150,15 @@ final class SS_WC_MailChimp_Plugin {
138
  */
139
  private function define_constants() {
140
 
 
 
 
 
 
 
 
 
 
141
  // Plugin version.
142
  $this->define( 'SS_WC_MAILCHIMP_VERSION', self::version() );
143
 
@@ -172,6 +193,12 @@ final class SS_WC_MailChimp_Plugin {
172
 
173
  require_once( 'lib/class-ss-system-info.php' );
174
 
 
 
 
 
 
 
175
  require_once( 'class-ss-wc-mailchimp-api.php' );
176
 
177
  require_once( 'class-ss-wc-mailchimp.php' );
@@ -228,6 +255,8 @@ final class SS_WC_MailChimp_Plugin {
228
  */
229
  private function add_hooks() {
230
 
 
 
231
  // Add the "Settings" links on the Plugins administration screen
232
  if ( is_admin() ) {
233
 
@@ -331,6 +360,15 @@ final class SS_WC_MailChimp_Plugin {
331
 
332
  } //end function deactivate
333
 
 
 
 
 
 
 
 
 
 
334
  /**
335
  * Returns namespace prefixed value
336
  * @param string $suffix The suffix to prefix
9
  * Plugin version
10
  * @var string
11
  */
12
+ private static $version = '2.0.13';
13
 
14
  /**
15
  * Plugin singleton instance
35
  */
36
  private $mailchimp;
37
 
38
+ /**
39
+ * Plugin compatibility checker
40
+ * @return SS_WC_MailChimp_Compatibility
41
+ */
42
+ public $compatibility;
43
+
44
  /**
45
  * Returns the plugin version
46
  * @return string
54
  *
55
  * @return SS_WC_MailChimp_Plugin SS_WC_MailChimp_Plugin object
56
  */
57
+ public static function get_instance() {
58
 
59
  if ( empty( self::$instance ) && ! ( self::$instance instanceof SS_WC_MailChimp_Plugin ) ) {
60
 
61
  self::$instance = new SS_WC_MailChimp_Plugin;
62
  self::$instance->define_constants();
63
 
 
 
64
  self::$instance->save_settings();
65
  self::$instance->settings();
66
  self::$instance->includes();
67
  self::$instance->mailchimp();
68
+ self::$instance->handler = SS_WC_MailChimp_Handler::get_instance();
69
+ self::$instance->compatibility = SS_WC_MailChimp_Compatibility::get_instance();
70
+ self::$instance->admin_notices = new SS_WC_MailChimp_Admin_Notices;
71
+ self::$instance->load_plugin_textdomain();
72
 
73
+ //if ( self::$instance->compatibility->is_valid() ) {
74
+ self::$instance->add_hooks();
75
+ do_action( 'ss_wc_mailchimp_loaded' );
76
+ //}
77
 
78
  }
79
 
93
  $defaults = require( SS_WC_MAILCHIMP_DIR . 'config/default-settings.php' );
94
  $settings = array();
95
 
96
+ foreach ( $defaults as $key => $default_value ) {
97
+
98
+ $setting_value = get_option( $this->namespace_prefixed( $key ) );
99
+
100
+ $settings[ $key ] = $setting_value ? $setting_value : $default_value;
101
  }
102
 
103
  $this->settings = array_merge( $defaults, $settings );
150
  */
151
  private function define_constants() {
152
 
153
+ // Minimum supported version of WordPress
154
+ $this->define( 'SS_WC_MAILCHIMP_MIN_WP_VERSION', '3.5.1' );
155
+
156
+ // Minimum supported version of WooCommerce
157
+ $this->define( 'SS_WC_MAILCHIMP_MIN_WC_VERSION', '2.2.0' );
158
+
159
+ // Minimum supported version of PHP
160
+ $this->define( 'SS_WC_MAILCHIMP_MIN_PHP_VERSION', '5.4.0' );
161
+
162
  // Plugin version.
163
  $this->define( 'SS_WC_MAILCHIMP_VERSION', self::version() );
164
 
193
 
194
  require_once( 'lib/class-ss-system-info.php' );
195
 
196
+ require_once( 'helper-functions.php' );
197
+
198
+ require_once( 'class-ss-wc-mailchimp-compatibility.php' );
199
+
200
+ require_once( 'class-ss-wc-mailchimp-admin-notices.php' );
201
+
202
  require_once( 'class-ss-wc-mailchimp-api.php' );
203
 
204
  require_once( 'class-ss-wc-mailchimp.php' );
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
261
  if ( is_admin() ) {
262
 
360
 
361
  } //end function deactivate
362
 
363
+ /**
364
+ * Check whether WooCommerce MailChimp is network activated
365
+ * @since 1.0
366
+ * @return bool
367
+ */
368
+ public static function is_network_activated() {
369
+ return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'woocommerce-mailchimp/woocommerce-mailchimp.php' ) );
370
+ }
371
+
372
  /**
373
  * Returns namespace prefixed value
374
  * @param string $suffix The suffix to prefix
includes/class-ss-wc-settings-mailchimp.php CHANGED
@@ -17,7 +17,7 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
17
  */
18
  class SS_WC_Settings_MailChimp extends WC_Settings_Page {
19
 
20
- private static $_instance;
21
 
22
  /**
23
  * Singleton instance
@@ -26,11 +26,11 @@ if ( ! class_exists( 'SS_WC_Settings_MailChimp' ) ) {
26
  */
27
  public static function get_instance() {
28
 
29
- if ( empty( self::$_instance ) ) {
30
- self::$_instance = new self;
31
  }
32
 
33
- return self::$_instance;
34
  }
35
 
36
  /**
17
  */
18
  class SS_WC_Settings_MailChimp extends WC_Settings_Page {
19
 
20
+ private static $instance;
21
 
22
  /**
23
  * Singleton instance
26
  */
27
  public static function get_instance() {
28
 
29
+ if ( empty( self::$instance ) ) {
30
+ self::$instance = new self;
31
  }
32
 
33
+ return self::$instance;
34
  }
35
 
36
  /**
includes/helper-functions.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Utility helper functions
4
+ */
5
+
6
+ /**
7
+ * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
8
+ * @uses sanitize_html_class
9
+ * @param string|array $classes Text or arrray of classes to sanitize
10
+ * @return string Sanitized CSS string
11
+ */
12
+ function sswcmc_sanitize_html_class( $classes ) {
13
+
14
+ if( is_string( $classes ) ) {
15
+ $classes = explode(' ', $classes );
16
+ }
17
+
18
+ // If someone passes something not string or array, we get outta here.
19
+ if( !is_array( $classes ) ) { return $classes; }
20
+
21
+ $classes = array_map( 'sanitize_html_class' , $classes );
22
+
23
+ return implode( ' ', $classes );
24
+ }
languages/woocommerce-mailchimp.pot CHANGED
@@ -3,8 +3,8 @@ msgid ""
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: WooCommerce MailChimp\n"
6
- "POT-Creation-Date: 2016-09-19 11:36-0500\n"
7
- "PO-Revision-Date: 2016-09-19 11:34-0500\n"
8
  "Last-Translator: Adam Anderly <adam.anderly@saintsystems.com>\n"
9
  "Language-Team: Adam Anderly <adam.anderly@saintsystems.com>\n"
10
  "MIME-Version: 1.0\n"
@@ -21,75 +21,124 @@ msgstr ""
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
  #: config/default-settings.php:10
24
- #: includes/class-ss-wc-settings-mailchimp.php:416
25
  msgid "Subscribe to our newsletter"
26
  msgstr ""
27
 
28
- #: includes/class-ss-wc-mailchimp-handler.php:29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  #: includes/class-ss-wc-settings-mailchimp.php:46
30
- #: includes/class-ss-wc-settings-mailchimp.php:308
31
  msgid "MailChimp"
32
  msgstr ""
33
 
34
- #: includes/class-ss-wc-mailchimp-handler.php:194
35
  #, php-format
36
  msgid "(): Subscribing customer (%s) to list %s"
37
  msgstr ""
38
 
39
- #: includes/class-ss-wc-mailchimp-handler.php:266
40
  msgid "Please enter an api key."
41
  msgstr ""
42
 
43
- #: includes/class-ss-wc-mailchimp-handler.php:299
 
44
  msgid "Enter your api key above to see your lists"
45
  msgstr ""
46
 
47
- #: includes/class-ss-wc-mailchimp-handler.php:338
48
  msgid "Please select a list from above."
49
  msgstr ""
50
 
51
- #: includes/class-ss-wc-mailchimp-handler.php:470
52
  #, php-format
53
  msgid "(): Subscribing customer to MailChimp: %s"
54
  msgstr ""
55
 
56
- #: includes/class-ss-wc-mailchimp-handler.php:476
57
  #, php-format
58
  msgid "(): MailChimp API response: %s"
59
  msgstr ""
60
 
61
- #: includes/class-ss-wc-mailchimp-handler.php:480
62
  #, php-format
63
  msgid "(): WooCommerce MailChimp subscription failed: %s (%s)"
64
  msgstr ""
65
 
66
- #: includes/class-ss-wc-mailchimp-handler.php:489
67
  msgid "WooCommerce MailChimp subscription failed"
68
  msgstr ""
69
 
70
- #: includes/class-ss-wc-mailchimp-plugin.php:252
71
  msgid "Settings"
72
  msgstr ""
73
 
74
- #: includes/class-ss-wc-mailchimp-plugin.php:284
75
  msgid "Connecting to MailChimp"
76
  msgstr ""
77
 
78
- #: includes/class-ss-wc-mailchimp-plugin.php:285
79
  msgid "Error. Please check your api key."
80
  msgstr ""
81
 
82
- #: includes/class-ss-wc-mailchimp-plugin.php:286
83
  msgid ""
84
  "Error loading groups. Please check your MailChimp Interest Groups for the "
85
  "selected list."
86
  msgstr ""
87
 
88
- #: includes/class-ss-wc-mailchimp-plugin.php:287
89
  msgid "Select one or more groups (optional)"
90
  msgstr ""
91
 
92
- #: includes/class-ss-wc-mailchimp-plugin.php:288
93
  msgid "This list does not have interest groups enabled"
94
  msgstr ""
95
 
@@ -105,102 +154,102 @@ msgid "General"
105
  msgstr ""
106
 
107
  #: includes/class-ss-wc-settings-mailchimp.php:253
108
- #: includes/class-ss-wc-settings-mailchimp.php:472
109
  msgid "Troubleshooting"
110
  msgstr ""
111
 
112
- #: includes/class-ss-wc-settings-mailchimp.php:310
113
  msgid ""
114
  "Enter your MailChimp settings below to control how WooCommerce integrates "
115
  "with your MailChimp account."
116
  msgstr ""
117
 
118
- #: includes/class-ss-wc-settings-mailchimp.php:317
119
  msgid "API Key"
120
  msgstr ""
121
 
122
- #: includes/class-ss-wc-settings-mailchimp.php:319
123
  #, php-format
124
  msgid "%sLogin to MailChimp%s to look up your api key."
125
  msgstr ""
126
 
127
- #: includes/class-ss-wc-settings-mailchimp.php:321
128
  msgid "Paste your MailChimp API key here"
129
  msgstr ""
130
 
131
- #: includes/class-ss-wc-settings-mailchimp.php:329
132
  msgid "Enable/Disable"
133
  msgstr ""
134
 
135
- #: includes/class-ss-wc-settings-mailchimp.php:330
136
  msgid "Enable MailChimp Integration"
137
  msgstr ""
138
 
139
- #: includes/class-ss-wc-settings-mailchimp.php:332
140
  msgid "Enable/disable the plugin functionality."
141
  msgstr ""
142
 
143
- #: includes/class-ss-wc-settings-mailchimp.php:346
144
  msgid "Main List"
145
  msgstr ""
146
 
147
- #: includes/class-ss-wc-settings-mailchimp.php:348
148
  msgid "All customers will be added to this list."
149
  msgstr ""
150
 
151
- #: includes/class-ss-wc-settings-mailchimp.php:358
152
  msgid "Interest Groups"
153
  msgstr ""
154
 
155
- #: includes/class-ss-wc-settings-mailchimp.php:360
156
  msgid "Optional: Interest groups to assign to subscribers."
157
  msgstr ""
158
 
159
- #: includes/class-ss-wc-settings-mailchimp.php:365
160
  msgid "Select interest groups..."
161
  msgstr ""
162
 
163
- #: includes/class-ss-wc-settings-mailchimp.php:373
164
  msgid "Subscribe Event"
165
  msgstr ""
166
 
167
- #: includes/class-ss-wc-settings-mailchimp.php:375
168
  msgid ""
169
  "Choose whether to subscribe customers as soon as an order is placed or after "
170
  "the order is processing or completed."
171
  msgstr ""
172
 
173
- #: includes/class-ss-wc-settings-mailchimp.php:379
174
  msgid "Order Created"
175
  msgstr ""
176
 
177
- #: includes/class-ss-wc-settings-mailchimp.php:380
178
  msgid "Order Processing"
179
  msgstr ""
180
 
181
- #: includes/class-ss-wc-settings-mailchimp.php:381
182
  msgid "Order Completed"
183
  msgstr ""
184
 
185
- #: includes/class-ss-wc-settings-mailchimp.php:388
186
  msgid "Double Opt-In"
187
  msgstr ""
188
 
189
- #: includes/class-ss-wc-settings-mailchimp.php:389
190
  msgid "Enable Double Opt-In"
191
  msgstr ""
192
 
193
- #: includes/class-ss-wc-settings-mailchimp.php:392
194
  msgid ""
195
  "If enabled, customers will receive an email prompting them to confirm their "
196
  "subscription to the list above."
197
  msgstr ""
198
 
199
- #: includes/class-ss-wc-settings-mailchimp.php:397
200
  msgid "Subscribe Customers"
201
  msgstr ""
202
 
203
- #: includes/class-ss-wc-settings-mailchimp.php:398
204
  msgid ""
205
  "<p>Choose <strong>Ask for permission</strong> to show an \"Opt-in\" checkbox "
206
  "during checkout. Customers will only be subscribed to the list above if they "
@@ -208,127 +257,127 @@ msgid ""
208
  "silently upon checkout. Caution, this is without the customer's consent.</p>"
209
  msgstr ""
210
 
211
- #: includes/class-ss-wc-settings-mailchimp.php:406
212
  msgid "Ask for permission"
213
  msgstr ""
214
 
215
- #: includes/class-ss-wc-settings-mailchimp.php:407
216
  msgid "Automatically"
217
  msgstr ""
218
 
219
- #: includes/class-ss-wc-settings-mailchimp.php:413
220
  msgid "Opt-In Field Label"
221
  msgstr ""
222
 
223
- #: includes/class-ss-wc-settings-mailchimp.php:415
224
  msgid "Optional: customize the label displayed next to the opt-in checkbox."
225
  msgstr ""
226
 
227
- #: includes/class-ss-wc-settings-mailchimp.php:423
228
  msgid "Opt-In Checkbox Default"
229
  msgstr ""
230
 
231
- #: includes/class-ss-wc-settings-mailchimp.php:425
232
  msgid "The default state of the opt-in checkbox."
233
  msgstr ""
234
 
235
- #: includes/class-ss-wc-settings-mailchimp.php:429
236
  msgid "Checked"
237
  msgstr ""
238
 
239
- #: includes/class-ss-wc-settings-mailchimp.php:430
240
  msgid "Unchecked"
241
  msgstr ""
242
 
243
- #: includes/class-ss-wc-settings-mailchimp.php:437
244
  msgid "Opt-In Checkbox Location"
245
  msgstr ""
246
 
247
- #: includes/class-ss-wc-settings-mailchimp.php:439
248
  msgid "Where to display the opt-in checkbox on the checkout page."
249
  msgstr ""
250
 
251
- #: includes/class-ss-wc-settings-mailchimp.php:443
252
  msgid "Above customer details"
253
  msgstr ""
254
 
255
- #: includes/class-ss-wc-settings-mailchimp.php:444
256
  msgid "Below customer details"
257
  msgstr ""
258
 
259
- #: includes/class-ss-wc-settings-mailchimp.php:445
260
  msgid "Order review above submit"
261
  msgstr ""
262
 
263
- #: includes/class-ss-wc-settings-mailchimp.php:446
264
  msgid "Order review below submit"
265
  msgstr ""
266
 
267
- #: includes/class-ss-wc-settings-mailchimp.php:447
268
  msgid "Order review above total"
269
  msgstr ""
270
 
271
- #: includes/class-ss-wc-settings-mailchimp.php:448
272
  msgid "Above billing details"
273
  msgstr ""
274
 
275
- #: includes/class-ss-wc-settings-mailchimp.php:449
276
  msgid "Above shipping details"
277
  msgstr ""
278
 
279
- #: includes/class-ss-wc-settings-mailchimp.php:450
280
  msgid "Below Checkout billing form"
281
  msgstr ""
282
 
283
- #: includes/class-ss-wc-settings-mailchimp.php:461
284
  msgid "Enable Logging"
285
  msgstr ""
286
 
287
- #: includes/class-ss-wc-settings-mailchimp.php:468
288
  #, php-format
289
  msgid "%1$sView Log%2$s"
290
  msgstr ""
291
 
292
- #: includes/class-ss-wc-settings-mailchimp.php:480
293
  msgid "Debug Log"
294
  msgstr ""
295
 
296
- #: includes/class-ss-wc-settings-mailchimp.php:484
297
  msgid ""
298
  "Enable logging MailChimp API calls. Only enable for troubleshooting purposes."
299
  msgstr ""
300
 
301
- #: includes/class-ss-wc-settings-mailchimp.php:489
302
  msgid "System Info"
303
  msgstr ""
304
 
305
- #: includes/class-ss-wc-settings-mailchimp.php:491
306
  msgid ""
307
  "Copy the information below and send it to us when reporting an issue with "
308
  "the plugin."
309
  msgstr ""
310
 
311
- #: includes/class-ss-wc-settings-mailchimp.php:579
312
  msgid "Oops! No lists in your MailChimp account..."
313
  msgstr ""
314
 
315
- #: includes/class-ss-wc-settings-mailchimp.php:584
316
  msgid "Select a list..."
317
  msgstr ""
318
 
319
- #: includes/class-ss-wc-settings-mailchimp.php:624
320
  #, php-format
321
  msgid ""
322
  "Oops! There are no lists in your MailChimp account. %sClick here%s to create "
323
  "one."
324
  msgstr ""
325
 
326
- #: includes/class-ss-wc-settings-mailchimp.php:636
327
  #, php-format
328
  msgid "Unable to load lists from MailChimp: (%s) %s. "
329
  msgstr ""
330
 
331
- #: includes/class-ss-wc-settings-mailchimp.php:637
332
  #, php-format
333
  msgid "Please check your Settings %ssettings%s."
334
  msgstr ""
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: WooCommerce MailChimp\n"
6
+ "POT-Creation-Date: 2016-09-20 10:27-0500\n"
7
+ "PO-Revision-Date: 2016-09-20 10:27-0500\n"
8
  "Last-Translator: Adam Anderly <adam.anderly@saintsystems.com>\n"
9
  "Language-Team: Adam Anderly <adam.anderly@saintsystems.com>\n"
10
  "MIME-Version: 1.0\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
  #: config/default-settings.php:10
24
+ #: includes/class-ss-wc-settings-mailchimp.php:421
25
  msgid "Subscribe to our newsletter"
26
  msgstr ""
27
 
28
+ #: includes/class-ss-wc-mailchimp-admin-notices.php:166
29
+ msgid "Dismiss"
30
+ msgstr ""
31
+
32
+ #: includes/class-ss-wc-mailchimp-compatibility.php:158
33
+ msgid ""
34
+ "You are seeing this notice because you are an administrator. Other users of "
35
+ "the site will see nothing."
36
+ msgstr ""
37
+
38
+ #: includes/class-ss-wc-mailchimp-compatibility.php:179
39
+ #, php-format
40
+ msgid ""
41
+ "%sWooCommerce MailChimp requires PHP Version %s or newer.%s \n"
42
+ "\n"
43
+ "You're using Version %s. Please ask your host to upgrade your server's PHP."
44
+ msgstr ""
45
+
46
+ #: includes/class-ss-wc-mailchimp-compatibility.php:201
47
+ #, php-format
48
+ msgid ""
49
+ "%sWooCommerce MailChimp requires WordPress %s or newer.%s \n"
50
+ "\n"
51
+ "You're using Version %s. Please upgrade your WordPress installation."
52
+ msgstr ""
53
+
54
+ #: includes/class-ss-wc-mailchimp-compatibility.php:253
55
+ #, php-format
56
+ msgid ""
57
+ "%sWooCommerce MailChimp requires WooCommerce Version %s or newer.%s You're "
58
+ "using Version %s. %sUpdate WooCommerce%s to use the WooCommerce MailChimp "
59
+ "plugin."
60
+ msgstr ""
61
+
62
+ #: includes/class-ss-wc-mailchimp-compatibility.php:288
63
+ #, php-format
64
+ msgid ""
65
+ "%sWooCommerce MailChimp requires WooCommerce to be active. %sActivate "
66
+ "WooCommerce%s to use the WooCommerce MailChimp plugin."
67
+ msgstr ""
68
+
69
+ #: includes/class-ss-wc-mailchimp-compatibility.php:293
70
+ #, php-format
71
+ msgid ""
72
+ "%sWooCommerce MailChimp requires WooCommerce to be installed in order to run "
73
+ "properly. %sInstall WooCommerce%s to use the WooCommerce MailChimp plugin."
74
+ msgstr ""
75
+
76
+ #: includes/class-ss-wc-mailchimp-handler.php:35
77
  #: includes/class-ss-wc-settings-mailchimp.php:46
78
+ #: includes/class-ss-wc-settings-mailchimp.php:313
79
  msgid "MailChimp"
80
  msgstr ""
81
 
82
+ #: includes/class-ss-wc-mailchimp-handler.php:213
83
  #, php-format
84
  msgid "(): Subscribing customer (%s) to list %s"
85
  msgstr ""
86
 
87
+ #: includes/class-ss-wc-mailchimp-handler.php:285
88
  msgid "Please enter an api key."
89
  msgstr ""
90
 
91
+ #: includes/class-ss-wc-mailchimp-handler.php:318
92
+ #: includes/class-ss-wc-mailchimp-handler.php:351
93
  msgid "Enter your api key above to see your lists"
94
  msgstr ""
95
 
96
+ #: includes/class-ss-wc-mailchimp-handler.php:357
97
  msgid "Please select a list from above."
98
  msgstr ""
99
 
100
+ #: includes/class-ss-wc-mailchimp-handler.php:490
101
  #, php-format
102
  msgid "(): Subscribing customer to MailChimp: %s"
103
  msgstr ""
104
 
105
+ #: includes/class-ss-wc-mailchimp-handler.php:496
106
  #, php-format
107
  msgid "(): MailChimp API response: %s"
108
  msgstr ""
109
 
110
+ #: includes/class-ss-wc-mailchimp-handler.php:500
111
  #, php-format
112
  msgid "(): WooCommerce MailChimp subscription failed: %s (%s)"
113
  msgstr ""
114
 
115
+ #: includes/class-ss-wc-mailchimp-handler.php:509
116
  msgid "WooCommerce MailChimp subscription failed"
117
  msgstr ""
118
 
119
+ #: includes/class-ss-wc-mailchimp-plugin.php:281
120
  msgid "Settings"
121
  msgstr ""
122
 
123
+ #: includes/class-ss-wc-mailchimp-plugin.php:313
124
  msgid "Connecting to MailChimp"
125
  msgstr ""
126
 
127
+ #: includes/class-ss-wc-mailchimp-plugin.php:314
128
  msgid "Error. Please check your api key."
129
  msgstr ""
130
 
131
+ #: includes/class-ss-wc-mailchimp-plugin.php:315
132
  msgid ""
133
  "Error loading groups. Please check your MailChimp Interest Groups for the "
134
  "selected list."
135
  msgstr ""
136
 
137
+ #: includes/class-ss-wc-mailchimp-plugin.php:316
138
  msgid "Select one or more groups (optional)"
139
  msgstr ""
140
 
141
+ #: includes/class-ss-wc-mailchimp-plugin.php:317
142
  msgid "This list does not have interest groups enabled"
143
  msgstr ""
144
 
154
  msgstr ""
155
 
156
  #: includes/class-ss-wc-settings-mailchimp.php:253
157
+ #: includes/class-ss-wc-settings-mailchimp.php:477
158
  msgid "Troubleshooting"
159
  msgstr ""
160
 
161
+ #: includes/class-ss-wc-settings-mailchimp.php:315
162
  msgid ""
163
  "Enter your MailChimp settings below to control how WooCommerce integrates "
164
  "with your MailChimp account."
165
  msgstr ""
166
 
167
+ #: includes/class-ss-wc-settings-mailchimp.php:322
168
  msgid "API Key"
169
  msgstr ""
170
 
171
+ #: includes/class-ss-wc-settings-mailchimp.php:324
172
  #, php-format
173
  msgid "%sLogin to MailChimp%s to look up your api key."
174
  msgstr ""
175
 
176
+ #: includes/class-ss-wc-settings-mailchimp.php:326
177
  msgid "Paste your MailChimp API key here"
178
  msgstr ""
179
 
180
+ #: includes/class-ss-wc-settings-mailchimp.php:334
181
  msgid "Enable/Disable"
182
  msgstr ""
183
 
184
+ #: includes/class-ss-wc-settings-mailchimp.php:335
185
  msgid "Enable MailChimp Integration"
186
  msgstr ""
187
 
188
+ #: includes/class-ss-wc-settings-mailchimp.php:337
189
  msgid "Enable/disable the plugin functionality."
190
  msgstr ""
191
 
192
+ #: includes/class-ss-wc-settings-mailchimp.php:351
193
  msgid "Main List"
194
  msgstr ""
195
 
196
+ #: includes/class-ss-wc-settings-mailchimp.php:353
197
  msgid "All customers will be added to this list."
198
  msgstr ""
199
 
200
+ #: includes/class-ss-wc-settings-mailchimp.php:363
201
  msgid "Interest Groups"
202
  msgstr ""
203
 
204
+ #: includes/class-ss-wc-settings-mailchimp.php:365
205
  msgid "Optional: Interest groups to assign to subscribers."
206
  msgstr ""
207
 
208
+ #: includes/class-ss-wc-settings-mailchimp.php:370
209
  msgid "Select interest groups..."
210
  msgstr ""
211
 
212
+ #: includes/class-ss-wc-settings-mailchimp.php:378
213
  msgid "Subscribe Event"
214
  msgstr ""
215
 
216
+ #: includes/class-ss-wc-settings-mailchimp.php:380
217
  msgid ""
218
  "Choose whether to subscribe customers as soon as an order is placed or after "
219
  "the order is processing or completed."
220
  msgstr ""
221
 
222
+ #: includes/class-ss-wc-settings-mailchimp.php:384
223
  msgid "Order Created"
224
  msgstr ""
225
 
226
+ #: includes/class-ss-wc-settings-mailchimp.php:385
227
  msgid "Order Processing"
228
  msgstr ""
229
 
230
+ #: includes/class-ss-wc-settings-mailchimp.php:386
231
  msgid "Order Completed"
232
  msgstr ""
233
 
234
+ #: includes/class-ss-wc-settings-mailchimp.php:393
235
  msgid "Double Opt-In"
236
  msgstr ""
237
 
238
+ #: includes/class-ss-wc-settings-mailchimp.php:394
239
  msgid "Enable Double Opt-In"
240
  msgstr ""
241
 
242
+ #: includes/class-ss-wc-settings-mailchimp.php:397
243
  msgid ""
244
  "If enabled, customers will receive an email prompting them to confirm their "
245
  "subscription to the list above."
246
  msgstr ""
247
 
248
+ #: includes/class-ss-wc-settings-mailchimp.php:402
249
  msgid "Subscribe Customers"
250
  msgstr ""
251
 
252
+ #: includes/class-ss-wc-settings-mailchimp.php:403
253
  msgid ""
254
  "<p>Choose <strong>Ask for permission</strong> to show an \"Opt-in\" checkbox "
255
  "during checkout. Customers will only be subscribed to the list above if they "
257
  "silently upon checkout. Caution, this is without the customer's consent.</p>"
258
  msgstr ""
259
 
260
+ #: includes/class-ss-wc-settings-mailchimp.php:411
261
  msgid "Ask for permission"
262
  msgstr ""
263
 
264
+ #: includes/class-ss-wc-settings-mailchimp.php:412
265
  msgid "Automatically"
266
  msgstr ""
267
 
268
+ #: includes/class-ss-wc-settings-mailchimp.php:418
269
  msgid "Opt-In Field Label"
270
  msgstr ""
271
 
272
+ #: includes/class-ss-wc-settings-mailchimp.php:420
273
  msgid "Optional: customize the label displayed next to the opt-in checkbox."
274
  msgstr ""
275
 
276
+ #: includes/class-ss-wc-settings-mailchimp.php:428
277
  msgid "Opt-In Checkbox Default"
278
  msgstr ""
279
 
280
+ #: includes/class-ss-wc-settings-mailchimp.php:430
281
  msgid "The default state of the opt-in checkbox."
282
  msgstr ""
283
 
284
+ #: includes/class-ss-wc-settings-mailchimp.php:434
285
  msgid "Checked"
286
  msgstr ""
287
 
288
+ #: includes/class-ss-wc-settings-mailchimp.php:435
289
  msgid "Unchecked"
290
  msgstr ""
291
 
292
+ #: includes/class-ss-wc-settings-mailchimp.php:442
293
  msgid "Opt-In Checkbox Location"
294
  msgstr ""
295
 
296
+ #: includes/class-ss-wc-settings-mailchimp.php:444
297
  msgid "Where to display the opt-in checkbox on the checkout page."
298
  msgstr ""
299
 
300
+ #: includes/class-ss-wc-settings-mailchimp.php:448
301
  msgid "Above customer details"
302
  msgstr ""
303
 
304
+ #: includes/class-ss-wc-settings-mailchimp.php:449
305
  msgid "Below customer details"
306
  msgstr ""
307
 
308
+ #: includes/class-ss-wc-settings-mailchimp.php:450
309
  msgid "Order review above submit"
310
  msgstr ""
311
 
312
+ #: includes/class-ss-wc-settings-mailchimp.php:451
313
  msgid "Order review below submit"
314
  msgstr ""
315
 
316
+ #: includes/class-ss-wc-settings-mailchimp.php:452
317
  msgid "Order review above total"
318
  msgstr ""
319
 
320
+ #: includes/class-ss-wc-settings-mailchimp.php:453
321
  msgid "Above billing details"
322
  msgstr ""
323
 
324
+ #: includes/class-ss-wc-settings-mailchimp.php:454
325
  msgid "Above shipping details"
326
  msgstr ""
327
 
328
+ #: includes/class-ss-wc-settings-mailchimp.php:455
329
  msgid "Below Checkout billing form"
330
  msgstr ""
331
 
332
+ #: includes/class-ss-wc-settings-mailchimp.php:466
333
  msgid "Enable Logging"
334
  msgstr ""
335
 
336
+ #: includes/class-ss-wc-settings-mailchimp.php:473
337
  #, php-format
338
  msgid "%1$sView Log%2$s"
339
  msgstr ""
340
 
341
+ #: includes/class-ss-wc-settings-mailchimp.php:485
342
  msgid "Debug Log"
343
  msgstr ""
344
 
345
+ #: includes/class-ss-wc-settings-mailchimp.php:489
346
  msgid ""
347
  "Enable logging MailChimp API calls. Only enable for troubleshooting purposes."
348
  msgstr ""
349
 
350
+ #: includes/class-ss-wc-settings-mailchimp.php:494
351
  msgid "System Info"
352
  msgstr ""
353
 
354
+ #: includes/class-ss-wc-settings-mailchimp.php:496
355
  msgid ""
356
  "Copy the information below and send it to us when reporting an issue with "
357
  "the plugin."
358
  msgstr ""
359
 
360
+ #: includes/class-ss-wc-settings-mailchimp.php:584
361
  msgid "Oops! No lists in your MailChimp account..."
362
  msgstr ""
363
 
364
+ #: includes/class-ss-wc-settings-mailchimp.php:589
365
  msgid "Select a list..."
366
  msgstr ""
367
 
368
+ #: includes/class-ss-wc-settings-mailchimp.php:629
369
  #, php-format
370
  msgid ""
371
  "Oops! There are no lists in your MailChimp account. %sClick here%s to create "
372
  "one."
373
  msgstr ""
374
 
375
+ #: includes/class-ss-wc-settings-mailchimp.php:641
376
  #, php-format
377
  msgid "Unable to load lists from MailChimp: (%s) %s. "
378
  msgstr ""
379
 
380
+ #: includes/class-ss-wc-settings-mailchimp.php:642
381
  #, php-format
382
  msgid "Please check your Settings %ssettings%s."
383
  msgstr ""
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.12
8
  License: GPLv3
9
 
10
  Simple and flexible MailChimp integration for WooCommerce.
@@ -113,9 +113,25 @@ Also, if you enjoy using the software [we'd love it if you could give us a revie
113
 
114
  == Changelog ==
115
 
116
- #### 2.0 - 2.0.12 - September 19, 2016
117
 
118
- **NOTE:** You must upgrade to version 2.X by December 31, 2016 as prior versions of the MailChimp API will stop working at that point.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  **WARNING:** This release contains breaking changes to the plugin's action hooks and filters. If you have custom code that hooks into the plugins action hooks and filters, please review the breaking changes below to know how to update your code appropriately.
121
 
4
  Tags: woocommerce, mailchimp
5
  Requires at least: 3.5.1
6
  Tested up to: 4.6.1
7
+ Stable tag: 2.0.13
8
  License: GPLv3
9
 
10
  Simple and flexible MailChimp integration for WooCommerce.
113
 
114
  == Changelog ==
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 - September 20, 2016
119
+
120
+ - Added plugin compatibility checks for minimum supported versions of WooCommerce, WordPress and PHP.
121
+
122
+ #### 2.0.9 - 2.0.12 - September 19, 2016
123
+
124
+ - Small fix for double-loading of lists on api key change.
125
+ - Small fix for lists not loading after initial save on new installs.
126
+ - Small fix for new installs not loading interest groups.
127
+ - Removed functions.php file (no longer used).
128
+
129
+ #### 2.0.7 - 2.0.8 - September 17, 2016
130
+
131
+ - Fix for new installs to prevent trying to run upgrade process.
132
+ - Small fix to not end WooCommerce Settings section with no api key or list is present.
133
+
134
+ #### 2.0 - 2.0.6 - September 16, 2016
135
 
136
  **WARNING:** This release contains breaking changes to the plugin's action hooks and filters. If you have custom code that hooks into the plugins action hooks and filters, please review the breaking changes below to know how to update your code appropriately.
137
 
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.12
9
  * Text Domain: woocommerce-mailchimp
10
  * Domain Path: languages
11
  *
@@ -40,8 +40,8 @@ if ( is_admin() ) {
40
 
41
  //add_action( 'plugins_loaded', array( 'SS_WC_MailChimp_Plugin', 'instance' ), 0 );
42
  function SSWCMC() {
43
- return SS_WC_MailChimp_Plugin::instance();
44
  }
45
 
46
- // Get WooCommerce Mailchipm Running.
47
- SSWCMC();
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.13
9
  * Text Domain: woocommerce-mailchimp
10
  * Domain Path: languages
11
  *
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 );