WooCommerce MailChimp - Version 1.3.5

Version Description

  • Fix for undefined variable list and array_merge issue.
  • Change to use WC_Logger instead of error_log
  • Updated pot file
  • Added French translation
  • General code syntax cleanup
Download this release

Release Info

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

Code changes from version 1.3.4 to 1.3.5

COPYRIGHT.txt CHANGED
@@ -1,7 +1,7 @@
1
 
2
  WooCommerce MailChimp
3
 
4
- Copyright 2013 "anderly" (Adam Anderly) www.anderly.com
5
 
6
  The files COPYRIGHT.txt and LICENSE.txt as well as ALL NOTICES IN THE
7
  HEADERS OF ALL FILES MUST BE KEPT INTACT.
1
 
2
  WooCommerce MailChimp
3
 
4
+ Copyright 2015 "anderly" (Adam Anderly) www.anderly.com
5
 
6
  The files COPYRIGHT.txt and LICENSE.txt as well as ALL NOTICES IN THE
7
  HEADERS OF ALL FILES MUST BE KEPT INTACT.
README.md CHANGED
@@ -69,6 +69,13 @@ If you need help, have problems, want to leave feedback or want to provide const
69
 
70
  ### Changelog
71
 
 
 
 
 
 
 
 
72
  #### 1.3.4
73
  * Fix enabled check. Issue #6.
74
 
69
 
70
  ### Changelog
71
 
72
+ #### 1.3.5
73
+ * Fix for undefined variable list and array_merge issue.
74
+ * Change to use WC_Logger instead of error_log
75
+ * Updated pot file
76
+ * Added French translation
77
+ * General code syntax cleanup
78
+
79
  #### 1.3.4
80
  * Fix enabled check. Issue #6.
81
 
classes/api/class-MCAPI.php CHANGED
@@ -1,259 +1,260 @@
1
- <?php
2
-
3
- class MCAPI {
4
- var $version = "1.3";
5
- var $errorMessage;
6
- var $errorCode;
7
-
8
- /**
9
- * Cache the information on the API location on the server
10
- */
11
- var $apiUrl;
12
-
13
- /**
14
- * Default to a 300 second timeout on server calls
15
- */
16
- var $timeout = 300;
17
-
18
- /**
19
- * Default to a 8K chunk size
20
- */
21
- var $chunkSize = 8192;
22
-
23
- /**
24
- * Cache the user api_key so we only have to log in once per client instantiation
25
- */
26
- var $api_key;
27
-
28
- /**
29
- * Cache the user api_key so we only have to log in once per client instantiation
30
- */
31
- var $secure = false;
32
-
33
- /**
34
- * Connect to the MailChimp API for a given list.
35
- *
36
- * @param string $apikey Your MailChimp apikey
37
- * @param string $secure Whether or not this should use a secure connection
38
- */
39
- function MCAPI($apikey, $secure=false) {
40
- $this->secure = $secure;
41
- $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
42
- $this->api_key = $apikey;
43
- }
44
- function setTimeout($seconds){
45
- if (is_int($seconds)){
46
- $this->timeout = $seconds;
47
- return true;
48
- }
49
- }
50
- function getTimeout(){
51
- return $this->timeout;
52
- }
53
- function useSecure($val){
54
- if ($val===true){
55
- $this->secure = true;
56
- } else {
57
- $this->secure = false;
58
- }
59
- }
60
-
61
- /**
62
- * Actually connect to the server and call the requested methods, parsing the result
63
- * You should never have to call this function manually
64
- */
65
- function __call($method, $params) {
66
- $dc = "us1";
67
- if (strstr($this->api_key,"-")){
68
- list($key, $dc) = explode("-",$this->api_key,2);
69
- if (!$dc) $dc = "us1";
70
- }
71
- $host = $dc.".".$this->apiUrl["host"];
72
-
73
- $this->errorMessage = "";
74
- $this->errorCode = "";
75
- $sep_changed = false;
76
- //sigh, apparently some distribs change this to &amp; by default
77
- if (ini_get("arg_separator.output")!="&"){
78
- $sep_changed = true;
79
- $orig_sep = ini_get("arg_separator.output");
80
- ini_set("arg_separator.output", "&");
81
- }
82
- //mutate params
83
- $mutate = array();
84
- $mutate["apikey"] = $this->api_key;
85
- foreach($params as $k=>$v){
86
- $mutate[$this->function_map[$method][$k]] = $v;
87
- }
88
- $post_vars = http_build_query($mutate);
89
- if ($sep_changed){
90
- ini_set("arg_separator.output", $orig_sep);
91
- }
92
-
93
- $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
94
- $payload .= "Host: " . $host . "\r\n";
95
- $payload .= "User-Agent: MCAPImini/" . $this->version ."\r\n";
96
- $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
97
- $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
98
- $payload .= "Connection: close \r\n\r\n";
99
- $payload .= $post_vars;
100
-
101
- ob_start();
102
- if ($this->secure){
103
- $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
104
- } else {
105
- $sock = fsockopen($host, 80, $errno, $errstr, 30);
106
- }
107
- if(!$sock) {
108
- $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
109
- $this->errorCode = "-99";
110
- ob_end_clean();
111
- return false;
112
- }
113
-
114
- $response = "";
115
- fwrite($sock, $payload);
116
- stream_set_timeout($sock, $this->timeout);
117
- $info = stream_get_meta_data($sock);
118
- while ((!feof($sock)) && (!$info["timed_out"])) {
119
- $response .= fread($sock, $this->chunkSize);
120
- $info = stream_get_meta_data($sock);
121
- }
122
- fclose($sock);
123
- ob_end_clean();
124
- if ($info["timed_out"]) {
125
- $this->errorMessage = "Could not read response (timed out)";
126
- $this->errorCode = -98;
127
- return false;
128
- }
129
-
130
- list($headers, $response) = explode("\r\n\r\n", $response, 2);
131
- $headers = explode("\r\n", $headers);
132
- $errored = false;
133
- foreach($headers as $h){
134
- if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
135
- $errored = true;
136
- $error_code = trim(substr($h,27));
137
- break;
138
- }
139
- }
140
-
141
- if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
142
-
143
- $serial = unserialize($response);
144
- if($response && $serial === false) {
145
- $response = array("error" => "Bad Response. Got This: " . $response, "code" => "-99");
146
- } else {
147
- $response = $serial;
148
- }
149
- if($errored && is_array($response) && isset($response["error"])) {
150
- $this->errorMessage = $response["error"];
151
- $this->errorCode = $response["code"];
152
- return false;
153
- } elseif($errored){
154
- $this->errorMessage = "No error message was found";
155
- $this->errorCode = $error_code;
156
- return false;
157
- }
158
-
159
- return $response;
160
- }
161
-
162
- protected $function_map = array('campaignUnschedule'=>array("cid"),
163
- 'campaignSchedule'=>array("cid","schedule_time","schedule_time_b"),
164
- 'campaignResume'=>array("cid"),
165
- 'campaignPause'=>array("cid"),
166
- 'campaignSendNow'=>array("cid"),
167
- 'campaignSendTest'=>array("cid","test_emails","send_type"),
168
- 'campaignSegmentTest'=>array("list_id","options"),
169
- 'campaignCreate'=>array("type","options","content","segment_opts","type_opts"),
170
- 'campaignUpdate'=>array("cid","name","value"),
171
- 'campaignReplicate'=>array("cid"),
172
- 'campaignDelete'=>array("cid"),
173
- 'campaigns'=>array("filters","start","limit"),
174
- 'campaignStats'=>array("cid"),
175
- 'campaignClickStats'=>array("cid"),
176
- 'campaignEmailDomainPerformance'=>array("cid"),
177
- 'campaignMembers'=>array("cid","status","start","limit"),
178
- 'campaignHardBounces'=>array("cid","start","limit"),
179
- 'campaignSoftBounces'=>array("cid","start","limit"),
180
- 'campaignUnsubscribes'=>array("cid","start","limit"),
181
- 'campaignAbuseReports'=>array("cid","since","start","limit"),
182
- 'campaignAdvice'=>array("cid"),
183
- 'campaignAnalytics'=>array("cid"),
184
- 'campaignGeoOpens'=>array("cid"),
185
- 'campaignGeoOpensForCountry'=>array("cid","code"),
186
- 'campaignEepUrlStats'=>array("cid"),
187
- 'campaignBounceMessage'=>array("cid","email"),
188
- 'campaignBounceMessages'=>array("cid","start","limit","since"),
189
- 'campaignEcommOrders'=>array("cid","start","limit","since"),
190
- 'campaignShareReport'=>array("cid","opts"),
191
- 'campaignContent'=>array("cid","for_archive"),
192
- 'campaignTemplateContent'=>array("cid"),
193
- 'campaignOpenedAIM'=>array("cid","start","limit"),
194
- 'campaignNotOpenedAIM'=>array("cid","start","limit"),
195
- 'campaignClickDetailAIM'=>array("cid","url","start","limit"),
196
- 'campaignEmailStatsAIM'=>array("cid","email_address"),
197
- 'campaignEmailStatsAIMAll'=>array("cid","start","limit"),
198
- 'campaignEcommOrderAdd'=>array("order"),
199
- 'lists'=>array("filters","start","limit"),
200
- 'listMergeVars'=>array("id"),
201
- 'listMergeVarAdd'=>array("id","tag","name","options"),
202
- 'listMergeVarUpdate'=>array("id","tag","options"),
203
- 'listMergeVarDel'=>array("id","tag"),
204
- 'listInterestGroupings'=>array("id"),
205
- 'listInterestGroupAdd'=>array("id","group_name","grouping_id"),
206
- 'listInterestGroupDel'=>array("id","group_name","grouping_id"),
207
- 'listInterestGroupUpdate'=>array("id","old_name","new_name","grouping_id"),
208
- 'listInterestGroupingAdd'=>array("id","name","type","groups"),
209
- 'listInterestGroupingUpdate'=>array("grouping_id","name","value"),
210
- 'listInterestGroupingDel'=>array("grouping_id"),
211
- 'listWebhooks'=>array("id"),
212
- 'listWebhookAdd'=>array("id","url","actions","sources"),
213
- 'listWebhookDel'=>array("id","url"),
214
- 'listStaticSegments'=>array("id"),
215
- 'listStaticSegmentAdd'=>array("id","name"),
216
- 'listStaticSegmentReset'=>array("id","seg_id"),
217
- 'listStaticSegmentDel'=>array("id","seg_id"),
218
- 'listStaticSegmentMembersAdd'=>array("id","seg_id","batch"),
219
- 'listStaticSegmentMembersDel'=>array("id","seg_id","batch"),
220
- 'listSubscribe'=>array("id","email_address","merge_vars","email_type","double_optin","update_existing","replace_interests","send_welcome"),
221
- 'listUnsubscribe'=>array("id","email_address","delete_member","send_goodbye","send_notify"),
222
- 'listUpdateMember'=>array("id","email_address","merge_vars","email_type","replace_interests"),
223
- 'listBatchSubscribe'=>array("id","batch","double_optin","update_existing","replace_interests"),
224
- 'listBatchUnsubscribe'=>array("id","emails","delete_member","send_goodbye","send_notify"),
225
- 'listMembers'=>array("id","status","since","start","limit"),
226
- 'listMemberInfo'=>array("id","email_address"),
227
- 'listMemberActivity'=>array("id","email_address"),
228
- 'listAbuseReports'=>array("id","start","limit","since"),
229
- 'listGrowthHistory'=>array("id"),
230
- 'listActivity'=>array("id"),
231
- 'listLocations'=>array("id"),
232
- 'listClients'=>array("id"),
233
- 'templates'=>array("types","category","inactives"),
234
- 'templateInfo'=>array("tid","type"),
235
- 'templateAdd'=>array("name","html"),
236
- 'templateUpdate'=>array("id","values"),
237
- 'templateDel'=>array("id"),
238
- 'templateUndel'=>array("id"),
239
- 'getAccountDetails'=>array(),
240
- 'generateText'=>array("type","content"),
241
- 'inlineCss'=>array("html","strip_css"),
242
- 'folders'=>array("type"),
243
- 'folderAdd'=>array("name","type"),
244
- 'folderUpdate'=>array("fid","name","type"),
245
- 'folderDel'=>array("fid","type"),
246
- 'ecommOrders'=>array("start","limit","since"),
247
- 'ecommOrderAdd'=>array("order"),
248
- 'ecommOrderDel'=>array("store_id","order_id"),
249
- 'listsForEmail'=>array("email_address"),
250
- 'campaignsForEmail'=>array("email_address"),
251
- 'chimpChatter'=>array(),
252
- 'apikeys'=>array("username","password","expired"),
253
- 'apikeyAdd'=>array("username","password"),
254
- 'apikeyExpire'=>array("username","password"),
255
- 'ping'=>array());
256
-
257
- }
258
-
259
- ?>
 
1
+ <?php
2
+
3
+ class MCAPI {
4
+ var $version = "1.3";
5
+ var $errorMessage;
6
+ var $errorCode;
7
+
8
+ /**
9
+ * Cache the information on the API location on the server
10
+ */
11
+ var $apiUrl;
12
+
13
+ /**
14
+ * Default to a 300 second timeout on server calls
15
+ */
16
+ var $timeout = 300;
17
+
18
+ /**
19
+ * Default to a 8K chunk size
20
+ */
21
+ var $chunkSize = 8192;
22
+
23
+ /**
24
+ * Cache the user api_key so we only have to log in once per client instantiation
25
+ */
26
+ var $api_key;
27
+
28
+ /**
29
+ * Cache the user api_key so we only have to log in once per client instantiation
30
+ */
31
+ var $secure = false;
32
+
33
+ /**
34
+ * Connect to the MailChimp API for a given list.
35
+ *
36
+ * @param string $apikey Your MailChimp apikey
37
+ * @param string $secure Whether or not this should use a secure connection
38
+ */
39
+ function MCAPI($apikey, $secure=false) {
40
+ $this->secure = $secure;
41
+ $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
42
+ $this->api_key = $apikey;
43
+ }
44
+ function setTimeout($seconds){
45
+ if (is_int($seconds)){
46
+ $this->timeout = $seconds;
47
+ return true;
48
+ }
49
+ }
50
+ function getTimeout(){
51
+ return $this->timeout;
52
+ }
53
+ function useSecure($val){
54
+ if ($val===true){
55
+ $this->secure = true;
56
+ } else {
57
+ $this->secure = false;
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Actually connect to the server and call the requested methods, parsing the result
63
+ * You should never have to call this function manually
64
+ */
65
+ function __call($method, $params) {
66
+ $dc = "us1";
67
+ if (strstr($this->api_key,"-")){
68
+ list($key, $dc) = explode("-",$this->api_key,2);
69
+ if (!$dc) $dc = "us1";
70
+ }
71
+ $host = $dc.".".$this->apiUrl["host"];
72
+
73
+ $this->errorMessage = "";
74
+ $this->errorCode = "";
75
+ $sep_changed = false;
76
+ //sigh, apparently some distribs change this to &amp; by default
77
+ if (ini_get("arg_separator.output")!="&"){
78
+ $sep_changed = true;
79
+ $orig_sep = ini_get("arg_separator.output");
80
+ ini_set("arg_separator.output", "&");
81
+ }
82
+ //mutate params
83
+ $mutate = array();
84
+ $mutate["apikey"] = $this->api_key;
85
+ foreach($params as $k=>$v){
86
+ $mutate[$this->function_map[$method][$k]] = $v;
87
+ }
88
+ $post_vars = http_build_query($mutate);
89
+ if ($sep_changed){
90
+ ini_set("arg_separator.output", $orig_sep);
91
+ }
92
+
93
+ $payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
94
+ $payload .= "Host: " . $host . "\r\n";
95
+ $payload .= "User-Agent: MCAPImini/" . $this->version ."\r\n";
96
+ $payload .= "Content-type: application/x-www-form-urlencoded\r\n";
97
+ $payload .= "Content-length: " . strlen($post_vars) . "\r\n";
98
+ $payload .= "Connection: close \r\n\r\n";
99
+ $payload .= $post_vars;
100
+
101
+ ob_start();
102
+ if ($this->secure){
103
+ $sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
104
+ } else {
105
+ $sock = fsockopen($host, 80, $errno, $errstr, 30);
106
+ }
107
+ if(!$sock) {
108
+ $this->errorMessage = "Could not connect (ERR $errno: $errstr)";
109
+ $this->errorCode = "-99";
110
+ ob_end_clean();
111
+ return false;
112
+ }
113
+
114
+ $response = "";
115
+ fwrite($sock, $payload);
116
+ stream_set_timeout($sock, $this->timeout);
117
+ $info = stream_get_meta_data($sock);
118
+ while ((!feof($sock)) && (!$info["timed_out"])) {
119
+ $response .= fread($sock, $this->chunkSize);
120
+ $info = stream_get_meta_data($sock);
121
+ }
122
+ fclose($sock);
123
+ ob_end_clean();
124
+ if ($info["timed_out"]) {
125
+ $this->errorMessage = "Could not read response (timed out)";
126
+ $this->errorCode = -98;
127
+
128
+ return false;
129
+ }
130
+
131
+ list($headers, $response) = explode("\r\n\r\n", $response, 2);
132
+ $headers = explode("\r\n", $headers);
133
+ $errored = false;
134
+ foreach($headers as $h) {
135
+ if (substr($h,0,26)==="X-MailChimp-API-Error-Code"){
136
+ $errored = true;
137
+ $error_code = trim(substr($h,27));
138
+ break;
139
+ }
140
+ }
141
+
142
+ if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
143
+
144
+ $serial = unserialize($response);
145
+ if($response && $serial === false) {
146
+ $response = array("error" => "Bad Response. Got This: " . $response, "code" => "-99");
147
+ } else {
148
+ $response = $serial;
149
+ }
150
+ if($errored && is_array($response) && isset($response["error"])) {
151
+ $this->errorMessage = $response["error"];
152
+ $this->errorCode = $response["code"];
153
+ return false;
154
+ }
155
+ elseif($errored){
156
+ $this->errorMessage = "No error message was found";
157
+ $this->errorCode = $error_code;
158
+ return false;
159
+ }
160
+
161
+ return $response;
162
+ }
163
+
164
+ protected $function_map = array(
165
+ 'campaignUnschedule' => array( "cid" ),
166
+ 'campaignSchedule' => array( "cid", "schedule_time", "schedule_time_b" ),
167
+ 'campaignResume' => array( "cid" ),
168
+ 'campaignPause' => array( "cid" ),
169
+ 'campaignSendNow' => array( "cid" ),
170
+ 'campaignSendTest' => array( "cid", "test_emails", "send_type" ),
171
+ 'campaignSegmentTest' => array( "list_id", "options" ),
172
+ 'campaignCreate' => array( "type", "options", "content", "segment_opts", "type_opts" ),
173
+ 'campaignUpdate' => array( "cid", "name", "value" ),
174
+ 'campaignReplicate' => array( "cid" ),
175
+ 'campaignDelete' => array( "cid" ),
176
+ 'campaigns' => array( "filters", "start", "limit" ),
177
+ 'campaignStats' => array( "cid" ),
178
+ 'campaignClickStats' => array( "cid" ),
179
+ 'campaignEmailDomainPerformance'=> array( "cid" ),
180
+ 'campaignMembers' => array( "cid", "status", "start", "limit" ),
181
+ 'campaignHardBounces' => array( "cid", "start", "limit" ),
182
+ 'campaignSoftBounces' => array( "cid", "start", "limit" ),
183
+ 'campaignUnsubscribes' => array( "cid", "start", "limit" ),
184
+ 'campaignAbuseReports' => array( "cid", "since", "start", "limit" ),
185
+ 'campaignAdvice' => array( "cid" ),
186
+ 'campaignAnalytics' => array( "cid" ),
187
+ 'campaignGeoOpens' => array( "cid" ),
188
+ 'campaignGeoOpensForCountry' => array( "cid", "code" ),
189
+ 'campaignEepUrlStats' => array( "cid" ),
190
+ 'campaignBounceMessage' => array( "cid", "email" ),
191
+ 'campaignBounceMessages' => array( "cid", "start", "limit", "since" ),
192
+ 'campaignEcommOrders' => array( "cid", "start", "limit", "since" ),
193
+ 'campaignShareReport' => array( "cid", "opts" ),
194
+ 'campaignContent' => array( "cid", "for_archive" ),
195
+ 'campaignTemplateContent' => array( "cid" ),
196
+ 'campaignOpenedAIM' => array( "cid", "start", "limit" ),
197
+ 'campaignNotOpenedAIM' => array( "cid", "start", "limit" ),
198
+ 'campaignClickDetailAIM' => array( "cid", "url", "start", "limit" ),
199
+ 'campaignEmailStatsAIM' => array( "cid", "email_address" ),
200
+ 'campaignEmailStatsAIMAll' => array( "cid", "start", "limit" ),
201
+ 'campaignEcommOrderAdd' => array( "order" ),
202
+ 'lists' => array( "filters", "start", "limit" ),
203
+ 'listMergeVars' => array( "id" ),
204
+ 'listMergeVarAdd' => array( "id", "tag", "name", "options" ),
205
+ 'listMergeVarUpdate' => array( "id", "tag", "options" ),
206
+ 'listMergeVarDel' => array( "id", "tag" ),
207
+ 'listInterestGroupings' => array( "id" ),
208
+ 'listInterestGroupAdd' => array( "id", "group_name", "grouping_id" ),
209
+ 'listInterestGroupDel' => array( "id", "group_name", "grouping_id" ),
210
+ 'listInterestGroupUpdate' => array( "id", "old_name", "new_name", "grouping_id" ),
211
+ 'listInterestGroupingAdd' => array( "id", "name", "type", "groups" ),
212
+ 'listInterestGroupingUpdate' => array( "grouping_id", "name", "value" ),
213
+ 'listInterestGroupingDel' => array( "grouping_id" ),
214
+ 'listWebhooks' => array( "id" ),
215
+ 'listWebhookAdd' => array( "id", "url", "actions", "sources" ),
216
+ 'listWebhookDel' => array( "id", "url" ),
217
+ 'listStaticSegments' => array( "id" ),
218
+ 'listStaticSegmentAdd' => array( "id", "name" ),
219
+ 'listStaticSegmentReset' => array( "id", "seg_id" ),
220
+ 'listStaticSegmentDel' => array( "id", "seg_id" ),
221
+ 'listStaticSegmentMembersAdd' => array( "id", "seg_id", "batch" ),
222
+ 'listStaticSegmentMembersDel' => array( "id", "seg_id", "batch" ),
223
+ 'listSubscribe' => array( "id", "email_address", "merge_vars", "email_type", "double_optin", "update_existing", "replace_interests", "send_welcome" ),
224
+ 'listUnsubscribe' => array( "id", "email_address", "delete_member", "send_goodbye", "send_notify" ),
225
+ 'listUpdateMember' => array( "id", "email_address", "merge_vars", "email_type", "replace_interests" ),
226
+ 'listBatchSubscribe' => array( "id", "batch", "double_optin", "update_existing", "replace_interests" ),
227
+ 'listBatchUnsubscribe' => array( "id", "emails", "delete_member", "send_goodbye", "send_notify" ),
228
+ 'listMembers' => array( "id", "status", "since", "start", "limit" ),
229
+ 'listMemberInfo' => array( "id", "email_address" ),
230
+ 'listMemberActivity' => array( "id", "email_address" ),
231
+ 'listAbuseReports' => array( "id", "start", "limit", "since" ),
232
+ 'listGrowthHistory' => array( "id" ),
233
+ 'listActivity' => array( "id" ),
234
+ 'listLocations' => array( "id" ),
235
+ 'listClients' => array( "id" ),
236
+ 'templates' => array( "types", "category", "inactives" ),
237
+ 'templateInfo' => array( "tid", "type" ),
238
+ 'templateAdd' => array( "name", "html" ),
239
+ 'templateUpdate' => array( "id", "values" ),
240
+ 'templateDel' => array( "id" ),
241
+ 'templateUndel' => array( "id" ),
242
+ 'getAccountDetails' => array(),
243
+ 'generateText' => array( "type", "content" ),
244
+ 'inlineCss' => array( "html", "strip_css" ),
245
+ 'folders' => array( "type" ),
246
+ 'folderAdd' => array( "name", "type" ),
247
+ 'folderUpdate' => array( "fid", "name", "type" ),
248
+ 'folderDel' => array( "fid", "type" ),
249
+ 'ecommOrders' => array( "start", "limit", "since" ),
250
+ 'ecommOrderAdd' => array( "order" ),
251
+ 'ecommOrderDel' => array( "store_id", "order_id" ),
252
+ 'listsForEmail' => array( "email_address" ),
253
+ 'campaignsForEmail' => array( "email_address" ),
254
+ 'chimpChatter' => array(),
255
+ 'apikeys' => array( "username", "password", "expired" ),
256
+ 'apikeyAdd' => array( "username", "password" ),
257
+ 'apikeyExpire' => array( "username", "password" ),
258
+ 'ping' => array()
259
+ );
260
+ }
classes/class-ss-wc-integration-mailchimp.php CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
  *
10
  * @class SS_WC_Integration_MailChimp
11
  * @extends WC_Integration
12
- * @version 1.3.4
13
  * @package WooCommerce MailChimp
14
  * @author Saint Systems
15
  */
@@ -23,72 +23,63 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
23
  */
24
  public function __construct() {
25
 
26
- if ( !class_exists( 'MCAPI' ) ) {
27
  include_once( 'api/class-MCAPI.php' );
28
  }
29
 
30
- $this->id = 'mailchimp';
31
- $this->method_title = __( 'MailChimp', 'ss_wc_mailchimp' );
32
- $this->method_description = __( 'MailChimp is a popular email marketing service.', 'ss_wc_mailchimp' );
33
 
34
  // Load the settings.
35
  $this->init_settings();
36
 
37
  // We need the API key to set up for the lists in the form fields
38
- $this->api_key = $this->get_option( 'api_key' );
39
  $this->mailchimp = new MCAPI( $this->api_key );
40
- $this->enabled = $this->get_option( 'enabled' );
41
 
42
  $this->init_form_fields();
43
 
44
  // Get setting values
45
- $this->occurs = $this->get_option( 'occurs' );
46
- $this->list = $this->get_option( 'list' );
47
- $this->double_optin = $this->get_option( 'double_optin' );
48
- $this->groups = $this->get_option( 'groups' );
49
- $this->display_opt_in = $this->get_option( 'display_opt_in' );
50
- $this->opt_in_label = $this->get_option( 'opt_in_label' );
51
- $this->opt_in_checkbox_default_status = $this->get_option( 'opt_in_checkbox_default_status' );
52
  $this->opt_in_checkbox_display_location = $this->get_option( 'opt_in_checkbox_display_location' );
53
- $this->interest_groupings = $this->get_option( 'interest_groupings' );
54
 
55
  // Hooks
56
- add_action( 'admin_notices', array( &$this, 'checks' ) );
57
- add_action( 'woocommerce_update_options_integration', array( $this, 'process_admin_options') );
58
  add_action( 'woocommerce_update_options_integration_' . $this->id, array( $this, 'process_admin_options') );
59
 
60
- // We would use the 'woocommerce_new_order' action but first name, last name and email address (order meta) is not yet available,
61
  // so instead we use the 'woocommerce_checkout_update_order_meta' action hook which fires after the checkout process on the "thank you" page
62
- add_action( 'woocommerce_checkout_update_order_meta', array( &$this, 'order_status_changed' ), 1000, 1 );
63
 
64
  // hook into woocommerce order status changed hook to handle the desired subscription event trigger
65
- add_action( 'woocommerce_order_status_changed', array( &$this, 'order_status_changed' ), 10, 3 );
66
 
67
  // Maybe add an "opt-in" field to the checkout
68
- add_filter( 'woocommerce_checkout_fields', array( &$this, 'maybe_add_checkout_fields' ) );
69
- add_filter( 'default_checkout_ss_wc_mailchimp_opt_in', array( &$this, 'checkbox_default_status' ) );
70
 
71
  // Maybe save the "opt-in" field on the checkout
72
- add_action( 'woocommerce_checkout_update_order_meta', array( &$this, 'maybe_save_checkout_fields' ) );
73
  }
74
 
75
  /**
76
  * Check if the user has enabled the plugin functionality, but hasn't provided an api key
77
  **/
78
  function checks() {
79
- global $woocommerce;
80
-
81
- if ( $this->enabled == 'yes' ) {
82
-
83
- // Check required fields
84
- if ( ! $this->api_key ) {
85
-
86
- echo '<div class="error"><p>' . sprintf( __('WooCommerce MailChimp error: Plugin is enabled but no api key provided. Please enter your api key <a href="%s">here</a>.', 'ss_wc_mailchimp'), WOOCOMMERCE_MAILCHIMP_SETTINGS_URL ) . '</p></div>';
87
-
88
- return;
89
-
90
- }
91
-
92
  }
93
  }
94
 
@@ -98,22 +89,26 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
98
  * @access public
99
  * @return void
100
  */
101
- public function order_status_changed( $id, $status = 'new', $new_status = 'pending' ) {
102
-
103
  if ( $this->is_valid() && $new_status == $this->occurs ) {
104
-
105
- $order = new WC_Order( $id );
106
 
107
  // get the ss_wc_mailchimp_opt_in value from the post meta. "order_custom_fields" was removed with WooCommerce 2.1
108
- $ss_wc_mailchimp_opt_in = get_post_meta( $id, 'ss_wc_mailchimp_opt_in', true );
109
- self::log( '$ss_wc_mailchimp_opt_in: ' . $ss_wc_mailchimp_opt_in );
110
 
111
- // If the 'ss_wc_mailchimp_opt_in' meta value isn't set (because 'display_opt_in' wasn't enabled at the time the order was placed) or the 'ss_wc_mailchimp_opt_in' is yes, subscriber the customer
112
- if ( ! isset( $ss_wc_mailchimp_opt_in ) || empty( $ss_wc_mailchimp_opt_in ) || 'yes' == $ss_wc_mailchimp_opt_in ) {
113
- self::log( 'Subscribing user (' . $order->billing_email . ') to list(' . $this->list . ') ' );
114
- $this->subscribe( $id, $order->billing_first_name, $order->billing_last_name, $order->billing_email, $this->list );
115
- }
116
 
 
 
 
 
 
 
 
 
 
117
  }
118
  }
119
 
@@ -146,12 +141,19 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
146
  * @return boolean
147
  */
148
  public function is_valid() {
149
- if ( $this->enabled == 'yes' && $this->has_api_key() && $this->has_list() ) {
150
- return true;
151
- }
152
- return false;
 
 
 
 
 
 
 
153
  }
154
-
155
  /**
156
  * Initialize Settings Form Fields
157
  *
@@ -159,113 +161,124 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
159
  * @return void
160
  */
161
  function init_form_fields() {
 
 
 
162
 
163
- if ( is_admin() && !is_ajax() ) {
 
 
 
 
 
 
164
 
165
- if ( $this->enabled == 'yes' && $this->has_api_key() ) {
166
- $lists = $this->get_lists();
167
- if ($lists === false ) {
168
- $lists = array ();
169
- }
170
- }
171
-
172
- $mailchimp_lists = $this->has_api_key() ? array_merge( array( '' => __('Select a list...', 'ss_wc_mailchimp' ) ), $lists ) : array( '' => __( 'Enter your key and save to see your lists', 'ss_wc_mailchimp' ) );
173
- //$mailchimp_interest_groupings = $this->has_list() ? array_merge( array( '' => __('Select an interest grouping...', 'ss_wc_mailchimp' ) ), $this->get_interest_groupings( $this->list ) ) : array( '' => __( 'Please select a list to see your interest groupings.', 'ss_wc_mailchimp' ) );
174
 
175
  $this->form_fields = array(
176
  'enabled' => array(
177
- 'title' => __( 'Enable/Disable', 'ss_wc_mailchimp' ),
178
- 'label' => __( 'Enable MailChimp', 'ss_wc_mailchimp' ),
179
- 'type' => 'checkbox',
180
- 'description' => '',
181
- 'default' => 'no'
182
- ),
183
  'occurs' => array(
184
- 'title' => __( 'Subscribe Event', 'ss_wc_mailchimp' ),
185
- 'type' => 'select',
186
- 'description' => __( 'When should customers be subscribed to lists?', 'ss_wc_mailchimp' ),
187
- 'default' => 'pending',
188
- 'options' => array(
189
- 'pending' => __( 'Order Created', 'ss_wc_mailchimp' ),
190
- 'processing' => __( 'Order Processing', 'ss_wc_mailchimp' ),
191
- 'completed' => __( 'Order Completed', 'ss_wc_mailchimp' ),
192
- ),
193
- ),
194
  'api_key' => array(
195
- 'title' => __( 'API Key', 'ss_wc_mailchimp' ),
196
- 'type' => 'text',
197
- 'description' => __( '<a href="https://us2.admin.mailchimp.com/account/api/" target="_blank">Login to mailchimp</a> to look up your api key.', 'ss_wc_mailchimp' ),
198
- 'default' => ''
199
- ),
200
  'list' => array(
201
- 'title' => __( 'Main List', 'ss_wc_mailchimp' ),
202
- 'type' => 'select',
203
- 'description' => __( 'All customers will be added to this list.', 'ss_wc_mailchimp' ),
204
- 'default' => '',
205
- 'options' => $mailchimp_lists,
206
- ),
207
  'interest_groupings' => array(
208
- 'title' => __( 'Group Name', 'ss_wc_mailchimp' ),
209
- 'type' => 'text',
210
- 'description' => __( 'Optional: Enter the name of the group. Learn more about <a href="http://mailchimp.com/features/groups" target="_blank">Groups</a>', 'ss_wc_mailchimp' ),
211
- 'default' => '',
212
- ),
213
  'groups' => array(
214
- 'title' => __( 'Groups', 'ss_wc_mailchimp' ),
215
- 'type' => 'text',
216
- 'description' => __( 'Optional: Comma separated list of interest groups to which subscribers should be added.', 'ss_wc_mailchimp' ),
217
- 'default' => '',
218
- ),
219
  'double_optin' => array(
220
- 'title' => __( 'Double Opt-In', 'ss_wc_mailchimp' ),
221
- 'label' => __( 'Enable Double Opt-In', 'ss_wc_mailchimp' ),
222
- 'type' => 'checkbox',
223
- 'description' => __( 'If enabled, customers will receive an email prompting them to confirm their subscription to the list above.', 'ss_wc_mailchimp' ),
224
- 'default' => 'no'
225
- ),
226
  'display_opt_in' => array(
227
- 'title' => __( 'Display Opt-In Field', 'ss_wc_mailchimp' ),
228
- 'label' => __( 'Display an Opt-In Field on Checkout', 'ss_wc_mailchimp' ),
229
- 'type' => 'checkbox',
230
- 'description' => __( 'If enabled, customers will be presented with a "Opt-in" checkbox during checkout and will only be added to the list above if they opt-in.', 'ss_wc_mailchimp' ),
231
- 'default' => 'no',
232
- ),
233
  'opt_in_label' => array(
234
- 'title' => __( 'Opt-In Field Label', 'ss_wc_mailchimp' ),
235
- 'type' => 'text',
236
- 'description' => __( 'Optional: customize the label displayed next to the opt-in checkbox.', 'ss_wc_mailchimp' ),
237
- 'default' => __( 'Add me to the newsletter (we will never share your email).', 'ss_wc_mailchimp' ),
238
- ),
239
  'opt_in_checkbox_default_status' => array(
240
- 'title' => __( 'Opt-In Checkbox Default Status', 'ss_wc_mailchimp' ),
241
- 'type' => 'select',
242
- 'description' => __( 'The default state of the opt-in checkbox.', 'ss_wc_mailchimp' ),
243
- 'default' => 'checked',
244
- 'options' => array( 'checked' => __( 'Checked', 'ss_wc_mailchimp' ), 'unchecked' => __( 'Unchecked', 'ss_wc_mailchimp' ) )
245
- ),
 
 
 
246
  'opt_in_checkbox_display_location' => array(
247
- 'title' => __( 'Opt-In Checkbox Display Location', 'ss_wc_mailchimp' ),
248
- 'type' => 'select',
249
- 'description' => __( 'Where to display the opt-in checkbox on the checkout page (under Billing info or Order info).', 'ss_wc_mailchimp' ),
250
- 'default' => 'billing',
251
- 'options' => array( 'billing' => __( 'Billing', 'ss_wc_mailchimp' ), 'order' => __( 'Order', 'ss_wc_mailchimp' ) )
252
- ),
 
 
 
253
  );
254
 
255
  $this->wc_enqueue_js("
256
  jQuery('#woocommerce_mailchimp_display_opt_in').change(function(){
257
-
258
  jQuery('#mainform [id^=woocommerce_mailchimp_opt_in]').closest('tr').hide('fast');
259
 
260
  if ( jQuery(this).prop('checked') == true ) {
261
  jQuery('#mainform [id^=woocommerce_mailchimp_opt_in]').closest('tr').show('fast');
262
- } else {
 
263
  jQuery('#mainform [id^=woocommerce_mailchimp_opt_in]').closest('tr').hide('fast');
264
  }
265
 
266
  }).change();
267
  ");
268
-
269
  }
270
 
271
  } // End init_form_fields()
@@ -280,14 +293,44 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
280
  * @return void
281
  */
282
  private function wc_enqueue_js( $code ) {
283
-
284
  if ( function_exists( 'wc_enqueue_js' ) ) {
285
  wc_enqueue_js( $code );
286
  } else {
287
  global $woocommerce;
288
  $woocommerce->add_inline_js( $code );
289
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  }
292
 
293
  /**
@@ -297,23 +340,26 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
297
  * @return void
298
  */
299
  public function get_lists() {
300
- if ( ! $mailchimp_lists = get_transient( 'sswcmclist_' . md5( $this->api_key ) ) ) {
 
 
301
 
302
  $mailchimp_lists = array();
303
  $retval = $this->mailchimp->lists();
304
 
305
  if ( $this->mailchimp->errorCode ) {
306
 
307
- add_action( 'admin_notices', array( $this, 'mailchimp_api_error_msg' ) );
308
  add_action( 'network_admin_notices', array( $this, 'mailchimp_api_error_msg' ) );
309
- return false;
310
 
311
- } else {
 
 
312
  foreach ( $retval['data'] as $list )
313
  $mailchimp_lists[ $list['id'] ] = $list['name'];
314
 
315
  if ( sizeof( $mailchimp_lists ) > 0 )
316
- set_transient( 'sswcmclist_' . md5( $this->api_key ), $mailchimp_lists, 60*60*1 );
317
  }
318
  }
319
 
@@ -328,12 +374,10 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
328
  * @return html the message for the user
329
  */
330
  public function mailchimp_api_error_msg() {
331
-
332
- $html = '<div class="error">';
333
- $html .= '<p>' . sprintf( __( 'Unable to load lists from MailChimp: (%s) %s.', 'ss_wc_mailchimp' ), $this->mailchimp->errorCode, $this->mailchimp->errorMessage ) . sprintf( __( ' Please check your <a href="' . WOOCOMMERCE_MAILCHIMP_SETTINGS_URL . '">settings' . '</a>', 'ss_wc_mailchimp' ) ) . '</p>';
334
- $html .= '</div>';
335
- echo $html;
336
-
337
  }
338
 
339
  /**
@@ -343,43 +387,42 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
343
  * @return void
344
  */
345
  public function get_interest_groupings( $listid = 'false' ) {
346
-
347
  if ( $listid == 'false' )
348
  $listid = $this->list;
349
 
350
- //if ( ! $mailchimp_interest_groupings = get_transient( 'wc_mailchimp_list_' . md5( $this->api_key ) . '_' . $listid ) ) {
351
-
352
- $mailchimp_interest_groupings = array();
353
- $mailchimp_interest_groups = array();
354
- $api = new MCAPI( $this->api_key );
355
- $retval = $api->listInterestGroupings( $listid );
356
 
357
- if ( $mailchimp->errorCode ) {
 
358
 
359
- echo '<div class="error"><p>' . sprintf( __( 'Unable to load listInterestGroupings() from MailChimp: (%s) %s', 'ss_wc_mailchimp' ), $mailchimp->errorCode, $mailchimp->errorMessage ) . '</p></div>';
360
 
361
- return false;
 
 
 
 
362
 
363
- } else {
364
- if ( sizeof( $retval ) > 0 ) {
365
- foreach ( $retval as $interest_grouping ) {
366
- $mailchimp_interest_groupings[ $interest_grouping['id'] ] = $interest_grouping['name'];
367
- foreach ( $interest_grouping['groups'] as $group ) {
368
- $mailchimp_interest_groups[ $group['bit'] ] = $group['name'];
369
- }
370
  }
 
371
 
372
- if ( sizeof( $mailchimp_interest_groupings ) > 0 ) {
373
- set_transient( 'wc_mailchimp_list_' . md5( $this->api_key ) . '_' . $listid, $mailchimp_interest_groupings, 60*60*1 );
374
- set_transient( 'wc_mailchimp_list_' . md5( $this->api_key ) . '_' . $listid . '_groups', $mailchimp_interest_groups, 60*60*1 );
375
- $this->interest_groupings = $mailchimp_interest_groupings;
376
- $this->groups[$listid] = $mailchimp_interest_groups;
377
- }
 
378
  }
379
  }
380
- //}
381
 
382
- return $mailchimp_interest_groupings;
383
  }
384
 
385
  /**
@@ -394,48 +437,63 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
394
  * @return void
395
  */
396
  public function subscribe( $order_id, $first_name, $last_name, $email, $listid = 'false' ) {
397
-
398
  if ( ! $email )
399
  return; // Email is required
400
 
401
- if ( $listid == 'false' )
402
  $listid = $this->list;
403
 
404
- $api = new MCAPI( $this->api_key );
405
-
406
- $merge_vars = array( 'FNAME' => $first_name, 'LNAME' => $last_name );
 
 
407
 
408
- if ( !empty( $this->interest_groupings ) && !empty( $this->groups ) ) {
409
  $merge_vars['GROUPINGS'] = array(
410
- array('name' => $this->interest_groupings, 'groups' => $this->groups),
411
- );
 
 
 
412
  }
413
 
414
- $vars = apply_filters( 'ss_wc_mailchimp_subscribe_merge_vars', $merge_vars, $order_id );
415
-
416
- $email_type = 'html';
417
- $double_optin = ( $this->double_optin == 'no' ? false : true );
418
- $update_existing = true;
419
- $replace_interests = false;
420
- $send_welcome = false;
421
-
422
- self::log( 'Calling MailChimp API listSubscribe method with the following: ' .
423
- 'listid=' . $listid .
424
- ', email=' . $email .
425
- ', vars=' . print_r( $vars, true ) .
426
- ', email_type=' . $email_type .
427
- ', double_optin=' . $double_optin .
428
- ', update_existing=' . $update_existing .
429
- ', replace_interests=' . $replace_interests .
430
- ', send_welcome=' . $send_welcome
431
  );
432
 
433
- $retval = $api->listSubscribe( $listid, $email, $vars, $email_type, $double_optin, $update_existing, $replace_interests, $send_welcome );
 
434
 
435
- self::log( 'MailChimp return value:' . $retval );
 
 
 
 
 
 
 
 
 
 
436
 
437
  if ( $api->errorCode && $api->errorCode != 214 ) {
438
- self::log( 'WooCommerce MailChimp subscription failed: (' . $api->errorCode . ') ' . $api->errorMessage );
 
 
 
 
439
 
440
  // Compability to old hook
441
  do_action( 'ss_wc_mailchimp_subscribed', $email );
@@ -444,7 +502,7 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
444
  do_action( 'ss_wc_mailchimp_subscription_failed', $email, array( 'list_id' => $listid, 'order_id' => $order_id ) );
445
 
446
  // Email admin
447
- wp_mail( get_option('admin_email'), __( 'WooCommerce MailChimp subscription failed', 'ss_wc_mailchimp' ), '(' . $api->errorCode . ') ' . $api->errorMessage );
448
  }
449
  else {
450
  // Hook on success
@@ -456,11 +514,11 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
456
  * Admin Panel Options
457
  */
458
  function admin_options() {
459
- ?>
460
  <h3><?php _e( 'MailChimp', 'ss_wc_mailchimp' ); ?></h3>
461
- <p><?php _e( 'Enter your MailChimp settings below to control how WooCommerce integrates with your MailChimp lists.', 'ss_wc_mailchimp' ); ?></p>
462
- <table class="form-table">
463
- <?php $this->generate_settings_html(); ?>
464
  </table><!--/.form-table-->
465
  <?php
466
  }
@@ -471,18 +529,17 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
471
  * @since 1.1
472
  */
473
  function maybe_add_checkout_fields( $checkout_fields ) {
 
474
 
475
- $opt_in_checkbox_display_location = $this->opt_in_checkbox_display_location;
476
-
477
- if ( empty( $opt_in_checkbox_display_location ) ) {
478
- $opt_in_checkbox_display_location = 'billing';
479
  }
480
 
481
  if ( 'yes' == $this->display_opt_in ) {
482
- $checkout_fields[$opt_in_checkbox_display_location]['ss_wc_mailchimp_opt_in'] = array(
483
  'type' => 'checkbox',
484
  'label' => esc_attr( $this->opt_in_label ),
485
- 'default' => ( $this->opt_in_checkbox_default_status == 'checked' ? 1 : 0 ),
486
  );
487
  }
488
 
@@ -495,7 +552,6 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
495
  * @since 1.2.1
496
  */
497
  function checkbox_default_status( $input ) {
498
-
499
  return $this->opt_in_checkbox_default_status == 'checked' ? 1 : 0;
500
  }
501
 
@@ -505,9 +561,9 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
505
  * @version 1.1
506
  */
507
  function maybe_save_checkout_fields( $order_id ) {
508
-
509
  if ( 'yes' == $this->display_opt_in ) {
510
  $opt_in = isset( $_POST['ss_wc_mailchimp_opt_in'] ) ? 'yes' : 'no';
 
511
  update_post_meta( $order_id, 'ss_wc_mailchimp_opt_in', $opt_in );
512
  }
513
  }
@@ -519,10 +575,13 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
519
  */
520
  static function log( $message ) {
521
  if ( WP_DEBUG === true ) {
 
 
522
  if ( is_array( $message ) || is_object( $message ) ) {
523
- error_log( print_r( $message, true ) );
524
- } else {
525
- error_log( $message );
 
526
  }
527
  }
528
  }
9
  *
10
  * @class SS_WC_Integration_MailChimp
11
  * @extends WC_Integration
12
+ * @version 1.3.5
13
  * @package WooCommerce MailChimp
14
  * @author Saint Systems
15
  */
23
  */
24
  public function __construct() {
25
 
26
+ if ( ! class_exists( 'MCAPI' ) ) {
27
  include_once( 'api/class-MCAPI.php' );
28
  }
29
 
30
+ $this->id = 'mailchimp';
31
+ $this->method_title = __( 'MailChimp', 'ss_wc_mailchimp' );
32
+ $this->method_description = __( 'MailChimp is a popular email marketing service.', 'ss_wc_mailchimp' );
33
 
34
  // Load the settings.
35
  $this->init_settings();
36
 
37
  // We need the API key to set up for the lists in the form fields
38
+ $this->api_key = $this->get_option( 'api_key' );
39
  $this->mailchimp = new MCAPI( $this->api_key );
40
+ $this->enabled = $this->get_option( 'enabled' );
41
 
42
  $this->init_form_fields();
43
 
44
  // Get setting values
45
+ $this->occurs = $this->get_option( 'occurs' );
46
+ $this->list = $this->get_option( 'list' );
47
+ $this->double_optin = $this->get_option( 'double_optin' );
48
+ $this->groups = $this->get_option( 'groups' );
49
+ $this->display_opt_in = $this->get_option( 'display_opt_in' );
50
+ $this->opt_in_label = $this->get_option( 'opt_in_label' );
51
+ $this->opt_in_checkbox_default_status = $this->get_option( 'opt_in_checkbox_default_status' );
52
  $this->opt_in_checkbox_display_location = $this->get_option( 'opt_in_checkbox_display_location' );
53
+ $this->interest_groupings = $this->get_option( 'interest_groupings' );
54
 
55
  // Hooks
56
+ add_action( 'admin_notices', array( $this, 'checks' ) );
57
+ add_action( 'woocommerce_update_options_integration', array( $this, 'process_admin_options') );
58
  add_action( 'woocommerce_update_options_integration_' . $this->id, array( $this, 'process_admin_options') );
59
 
60
+ // We would use the 'woocommerce_new_order' action but first name, last name and email address (order meta) is not yet available,
61
  // so instead we use the 'woocommerce_checkout_update_order_meta' action hook which fires after the checkout process on the "thank you" page
62
+ add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'order_status_changed' ), 1000, 1 );
63
 
64
  // hook into woocommerce order status changed hook to handle the desired subscription event trigger
65
+ add_action( 'woocommerce_order_status_changed', array( $this, 'order_status_changed' ), 10, 3 );
66
 
67
  // Maybe add an "opt-in" field to the checkout
68
+ add_filter( 'woocommerce_checkout_fields', array( $this, 'maybe_add_checkout_fields' ) );
69
+ add_filter( 'default_checkout_ss_wc_mailchimp_opt_in', array( $this, 'checkbox_default_status' ) );
70
 
71
  // Maybe save the "opt-in" field on the checkout
72
+ add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'maybe_save_checkout_fields' ) );
73
  }
74
 
75
  /**
76
  * Check if the user has enabled the plugin functionality, but hasn't provided an api key
77
  **/
78
  function checks() {
79
+ // Check required fields
80
+ if ( $this->is_enabled() && ! $this->has_api_key() ) {
81
+ // Show notice
82
+ echo $this->get_message( sprintf( __( 'WooCommerce MailChimp error: Plugin is enabled but no api key provided. Please enter your api key <a href="%s">here</a>.', 'ss_wc_mailchimp' ), WOOCOMMERCE_MAILCHIMP_SETTINGS_URL ) );
 
 
 
 
 
 
 
 
 
83
  }
84
  }
85
 
89
  * @access public
90
  * @return void
91
  */
92
+ public function order_status_changed( $id, $status = 'new', $new_status = 'pending' ) {
 
93
  if ( $this->is_valid() && $new_status == $this->occurs ) {
94
+ // Get WC order
95
+ $order = $this->wc_get_order( $id );
96
 
97
  // get the ss_wc_mailchimp_opt_in value from the post meta. "order_custom_fields" was removed with WooCommerce 2.1
98
+ $subscribe_customer = get_post_meta( $id, 'ss_wc_mailchimp_opt_in', true );
 
99
 
100
+ // log
101
+ self::log( sprintf( __( 'Order Opt-In Value: %s', 'ss_wc_mailchimp' ), var_export( $subscribe_customer, true ) ) );
 
 
 
102
 
103
+ // If the 'ss_wc_mailchimp_opt_in' meta value isn't set (because 'display_opt_in' wasn't enabled at the time the order
104
+ // was placed) or the 'ss_wc_mailchimp_opt_in' is yes, subscriber the customer
105
+ if ( ! $subscribe_customer || empty( $subscribe_customer ) || 'yes' == $subscribe_customer ) {
106
+ // log
107
+ self::log( sprintf( __( 'Subscribe customer (%s) to list %s', 'ss_wc_mailchimp' ), $order->billing_email, $this->list ) );
108
+
109
+ // subscribe
110
+ $this->subscribe( $order->id, $order->billing_first_name, $order->billing_last_name, $order->billing_email, $this->list );
111
+ }
112
  }
113
  }
114
 
141
  * @return boolean
142
  */
143
  public function is_valid() {
144
+ return $this->is_enabled() && $this->has_api_key() && $this->has_list();
145
+ }
146
+
147
+ /**
148
+ * is_enabled function.
149
+ *
150
+ * @access public
151
+ * @return boolean
152
+ */
153
+ public function is_enabled() {
154
+ return 'yes' === $this->enabled;
155
  }
156
+
157
  /**
158
  * Initialize Settings Form Fields
159
  *
161
  * @return void
162
  */
163
  function init_form_fields() {
164
+ $lists = array();
165
+
166
+ if ( is_admin() && ! is_ajax() ) {
167
 
168
+ if ( $this->is_enabled() && $this->has_api_key() ) {
169
+ $user_lists = $this->get_lists();
170
+
171
+ if ( is_array( $user_lists ) && ! empty( $user_lists ) ) {
172
+ $lists = $user_lists;
173
+ }
174
+ }
175
 
176
+ if( $this->has_api_key() ) {
177
+ $mailchimp_lists = array_merge( array( '' => __( 'Select a list...', 'ss_wc_mailchimp' ) ), $lists );
178
+ }
179
+ else {
180
+ $mailchimp_lists = array( '' => __( 'Enter your key and save to see your lists', 'ss_wc_mailchimp' ) );
181
+ }
 
 
 
182
 
183
  $this->form_fields = array(
184
  'enabled' => array(
185
+ 'title' => __( 'Enable/Disable', 'ss_wc_mailchimp' ),
186
+ 'label' => __( 'Enable MailChimp', 'ss_wc_mailchimp' ),
187
+ 'type' => 'checkbox',
188
+ 'description' => '',
189
+ 'default' => 'no'
190
+ ),
191
  'occurs' => array(
192
+ 'title' => __( 'Subscribe Event', 'ss_wc_mailchimp' ),
193
+ 'type' => 'select',
194
+ 'description' => __( 'When should customers be subscribed to lists?', 'ss_wc_mailchimp' ),
195
+ 'default' => 'pending',
196
+ 'options' => array(
197
+ 'pending' => __( 'Order Created', 'ss_wc_mailchimp' ),
198
+ 'processing' => __( 'Order Processing', 'ss_wc_mailchimp' ),
199
+ 'completed' => __( 'Order Completed', 'ss_wc_mailchimp' ),
200
+ ),
201
+ ),
202
  'api_key' => array(
203
+ 'title' => __( 'API Key', 'ss_wc_mailchimp' ),
204
+ 'type' => 'text',
205
+ 'description' => __( '<a href="https://us2.admin.mailchimp.com/account/api/" target="_blank">Login to mailchimp</a> to look up your api key.', 'ss_wc_mailchimp' ),
206
+ 'default' => ''
207
+ ),
208
  'list' => array(
209
+ 'title' => __( 'Main List', 'ss_wc_mailchimp' ),
210
+ 'type' => 'select',
211
+ 'description' => __( 'All customers will be added to this list.', 'ss_wc_mailchimp' ),
212
+ 'default' => '',
213
+ 'options' => $mailchimp_lists,
214
+ ),
215
  'interest_groupings' => array(
216
+ 'title' => __( 'Group Name', 'ss_wc_mailchimp' ),
217
+ 'type' => 'text',
218
+ 'description' => __( 'Optional: Enter the name of the group. Learn more about <a href="http://mailchimp.com/features/groups" target="_blank">Groups</a>', 'ss_wc_mailchimp' ),
219
+ 'default' => '',
220
+ ),
221
  'groups' => array(
222
+ 'title' => __( 'Groups', 'ss_wc_mailchimp' ),
223
+ 'type' => 'text',
224
+ 'description' => __( 'Optional: Comma separated list of interest groups to which subscribers should be added.', 'ss_wc_mailchimp' ),
225
+ 'default' => '',
226
+ ),
227
  'double_optin' => array(
228
+ 'title' => __( 'Double Opt-In', 'ss_wc_mailchimp' ),
229
+ 'label' => __( 'Enable Double Opt-In', 'ss_wc_mailchimp' ),
230
+ 'type' => 'checkbox',
231
+ 'description' => __( 'If enabled, customers will receive an email prompting them to confirm their subscription to the list above.', 'ss_wc_mailchimp' ),
232
+ 'default' => 'no'
233
+ ),
234
  'display_opt_in' => array(
235
+ 'title' => __( 'Display Opt-In Field', 'ss_wc_mailchimp' ),
236
+ 'label' => __( 'Display an Opt-In Field on Checkout', 'ss_wc_mailchimp' ),
237
+ 'type' => 'checkbox',
238
+ 'description' => __( 'If enabled, customers will be presented with a "Opt-in" checkbox during checkout and will only be added to the list above if they opt-in.', 'ss_wc_mailchimp' ),
239
+ 'default' => 'no',
240
+ ),
241
  'opt_in_label' => array(
242
+ 'title' => __( 'Opt-In Field Label', 'ss_wc_mailchimp' ),
243
+ 'type' => 'text',
244
+ 'description' => __( 'Optional: customize the label displayed next to the opt-in checkbox.', 'ss_wc_mailchimp' ),
245
+ 'default' => __( 'Add me to the newsletter (we will never share your email).', 'ss_wc_mailchimp' ),
246
+ ),
247
  'opt_in_checkbox_default_status' => array(
248
+ 'title' => __( 'Opt-In Checkbox Default Status', 'ss_wc_mailchimp' ),
249
+ 'type' => 'select',
250
+ 'description' => __( 'The default state of the opt-in checkbox.', 'ss_wc_mailchimp' ),
251
+ 'default' => 'checked',
252
+ 'options' => array(
253
+ 'checked' => __( 'Checked', 'ss_wc_mailchimp' ),
254
+ 'unchecked' => __( 'Unchecked', 'ss_wc_mailchimp' )
255
+ )
256
+ ),
257
  'opt_in_checkbox_display_location' => array(
258
+ 'title' => __( 'Opt-In Checkbox Display Location', 'ss_wc_mailchimp' ),
259
+ 'type' => 'select',
260
+ 'description' => __( 'Where to display the opt-in checkbox on the checkout page (under Billing info or Order info).', 'ss_wc_mailchimp' ),
261
+ 'default' => 'billing',
262
+ 'options' => array(
263
+ 'billing' => __( 'Billing', 'ss_wc_mailchimp' ),
264
+ 'order' => __( 'Order', 'ss_wc_mailchimp' )
265
+ )
266
+ )
267
  );
268
 
269
  $this->wc_enqueue_js("
270
  jQuery('#woocommerce_mailchimp_display_opt_in').change(function(){
 
271
  jQuery('#mainform [id^=woocommerce_mailchimp_opt_in]').closest('tr').hide('fast');
272
 
273
  if ( jQuery(this).prop('checked') == true ) {
274
  jQuery('#mainform [id^=woocommerce_mailchimp_opt_in]').closest('tr').show('fast');
275
+ }
276
+ else {
277
  jQuery('#mainform [id^=woocommerce_mailchimp_opt_in]').closest('tr').hide('fast');
278
  }
279
 
280
  }).change();
281
  ");
 
282
  }
283
 
284
  } // End init_form_fields()
293
  * @return void
294
  */
295
  private function wc_enqueue_js( $code ) {
 
296
  if ( function_exists( 'wc_enqueue_js' ) ) {
297
  wc_enqueue_js( $code );
298
  } else {
299
  global $woocommerce;
300
  $woocommerce->add_inline_js( $code );
301
  }
302
+ }
303
+
304
+ /**
305
+ * WooCommerce 2.2 support for wc_get_order
306
+ *
307
+ * @since 1.2.1
308
+ *
309
+ * @access private
310
+ * @param int $order_id
311
+ * @return void
312
+ */
313
+ private function wc_get_order( $order_id ) {
314
+ if ( function_exists( 'wc_get_order' ) ) {
315
+ return wc_get_order( $order_id );
316
+ } else {
317
+ return new WC_Order( $order_id );
318
+ }
319
+ }
320
 
321
+ /**
322
+ * Get message
323
+ * @return string Error
324
+ */
325
+ private function get_message( $message, $type = 'error' ) {
326
+ ob_start();
327
+
328
+ ?>
329
+ <div class="<?php echo $type ?>">
330
+ <p><?php echo $message ?></p>
331
+ </div>
332
+ <?php
333
+ return ob_get_clean();
334
  }
335
 
336
  /**
340
  * @return void
341
  */
342
  public function get_lists() {
343
+ $mailchimp_lists = get_transient( 'sswcmclist_' . md5( $this->api_key ) );
344
+
345
+ if ( ! $mailchimp_lists ) {
346
 
347
  $mailchimp_lists = array();
348
  $retval = $this->mailchimp->lists();
349
 
350
  if ( $this->mailchimp->errorCode ) {
351
 
352
+ add_action( 'admin_notices', array( $this, 'mailchimp_api_error_msg' ) );
353
  add_action( 'network_admin_notices', array( $this, 'mailchimp_api_error_msg' ) );
 
354
 
355
+ return false;
356
+ }
357
+ else {
358
  foreach ( $retval['data'] as $list )
359
  $mailchimp_lists[ $list['id'] ] = $list['name'];
360
 
361
  if ( sizeof( $mailchimp_lists ) > 0 )
362
+ set_transient( 'sswcmclist_' . md5( $this->api_key ), $mailchimp_lists, 60 * 60 * 1 );
363
  }
364
  }
365
 
374
  * @return html the message for the user
375
  */
376
  public function mailchimp_api_error_msg() {
377
+ echo $this->get_message(
378
+ sprintf( __( 'Unable to load lists from MailChimp: (%s) %s. ', 'ss_wc_mailchimp' ), $this->mailchimp->errorCode, $this->mailchimp->errorMessage ) .
379
+ sprintf( __( 'Please check your %s <a href="%s">settings</a>.', 'ss_wc_mailchimp' ), WOOCOMMERCE_MAILCHIMP_SETTINGS_URL )
380
+ );
 
 
381
  }
382
 
383
  /**
387
  * @return void
388
  */
389
  public function get_interest_groupings( $listid = 'false' ) {
 
390
  if ( $listid == 'false' )
391
  $listid = $this->list;
392
 
393
+ $interest_groupings = array();
394
+ $interest_groups = array();
395
+ $api = new MCAPI( $this->api_key );
396
+ $retval = $api->listInterestGroupings( $listid );
 
 
397
 
398
+ if ( $mailchimp->errorCode ) {
399
+ echo $this->get_message( sprintf( __( 'Unable to load listInterestGroupings() from MailChimp: (%s) %s', 'ss_wc_mailchimp' ), $mailchimp->errorCode, $mailchimp->errorMessage ) );
400
 
401
+ return false;
402
 
403
+ }
404
+ else {
405
+ if ( sizeof( $retval ) > 0 ) {
406
+ foreach ( $retval as $interest_grouping ) {
407
+ $interest_groupings[ $interest_grouping['id'] ] = $interest_grouping['name'];
408
 
409
+ foreach ( $interest_grouping['groups'] as $group ) {
410
+ $interest_groups[ $group['bit'] ] = $group['name'];
 
 
 
 
 
411
  }
412
+ }
413
 
414
+ if ( sizeof( $interest_groupings ) > 0 ) {
415
+ // set transients for cache
416
+ set_transient( 'wc_mailchimp_list_' . md5( $this->api_key ) . '_' . $listid, $interest_groupings, 60 * 60 * 1 );
417
+ set_transient( 'wc_mailchimp_list_' . md5( $this->api_key ) . '_' . $listid . '_groups', $interest_groups, 60 * 60 * 1 );
418
+
419
+ $this->interest_groupings = $interest_groupings;
420
+ $this->groups[$listid] = $interest_groups;
421
  }
422
  }
423
+ }
424
 
425
+ return $interest_groupings;
426
  }
427
 
428
  /**
437
  * @return void
438
  */
439
  public function subscribe( $order_id, $first_name, $last_name, $email, $listid = 'false' ) {
 
440
  if ( ! $email )
441
  return; // Email is required
442
 
443
+ if ( 'false' == $listid )
444
  $listid = $this->list;
445
 
446
+ $api = new MCAPI( $this->api_key );
447
+ $merge_vars = array(
448
+ 'FNAME' => $first_name,
449
+ 'LNAME' => $last_name
450
+ );
451
 
452
+ if ( ! empty( $this->interest_groupings ) && ! empty( $this->groups ) ) {
453
  $merge_vars['GROUPINGS'] = array(
454
+ array(
455
+ 'name' => $this->interest_groupings,
456
+ 'groups' => $this->groups
457
+ )
458
+ );
459
  }
460
 
461
+ // Allow hooking into variables
462
+ $vars = apply_filters( 'ss_wc_mailchimp_subscribe_merge_vars', $merge_vars, $order_id );
463
+
464
+ // Set subscription options
465
+ $subscribe_options = array(
466
+ 'listid' => $listid,
467
+ 'email' => $email,
468
+ 'vars' => $vars,
469
+ 'email_type' => 'html',
470
+ 'double_optin' => $this->double_optin == 'no' ? false : true,
471
+ 'update_existing' => true,
472
+ 'replace_interests' => false,
473
+ 'send_welcome' => false
 
 
 
 
474
  );
475
 
476
+ // Allow hooking into subscription options
477
+ $options = apply_filters( 'ss_wc_mailchimp_subscribe_options', $subscribe_options );
478
 
479
+ // Extract options into variables
480
+ extract( $options );
481
+
482
+ // Log
483
+ self::log( sprintf( __( 'Calling MailChimp API listSubscribe method with the following: %s', 'ss_wc_mailchimp' ), print_r( $options, true ) ) );
484
+
485
+ // Call API
486
+ $api_response = $api->listSubscribe( $listid, $email, $vars, $email_type, $double_optin, $update_existing, $replace_interests, $send_welcome );
487
+
488
+ // Log api response
489
+ self::log( __( 'MailChimp API response: %s', $api_response ) );
490
 
491
  if ( $api->errorCode && $api->errorCode != 214 ) {
492
+ // Format error message
493
+ $error_response = sprintf( __( 'WooCommerce MailChimp subscription failed: %s (%s)', 'ss_wc_mailchimp' ), $api->errorMessage, $api->errorCode );
494
+
495
+ // Log
496
+ self::log( $error_response );
497
 
498
  // Compability to old hook
499
  do_action( 'ss_wc_mailchimp_subscribed', $email );
502
  do_action( 'ss_wc_mailchimp_subscription_failed', $email, array( 'list_id' => $listid, 'order_id' => $order_id ) );
503
 
504
  // Email admin
505
+ wp_mail( get_option( 'admin_email' ), __( 'WooCommerce MailChimp subscription failed', 'ss_wc_mailchimp' ), $error_response );
506
  }
507
  else {
508
  // Hook on success
514
  * Admin Panel Options
515
  */
516
  function admin_options() {
517
+ ?>
518
  <h3><?php _e( 'MailChimp', 'ss_wc_mailchimp' ); ?></h3>
519
+ <p><?php _e( 'Enter your MailChimp settings below to control how WooCommerce integrates with your MailChimp lists.', 'ss_wc_mailchimp' ); ?></p>
520
+ <table class="form-table">
521
+ <?php $this->generate_settings_html(); ?>
522
  </table><!--/.form-table-->
523
  <?php
524
  }
529
  * @since 1.1
530
  */
531
  function maybe_add_checkout_fields( $checkout_fields ) {
532
+ $display_location = $this->opt_in_checkbox_display_location;
533
 
534
+ if ( empty( $display_location ) ) {
535
+ $display_location = 'billing';
 
 
536
  }
537
 
538
  if ( 'yes' == $this->display_opt_in ) {
539
+ $checkout_fields[$display_location]['ss_wc_mailchimp_opt_in'] = array(
540
  'type' => 'checkbox',
541
  'label' => esc_attr( $this->opt_in_label ),
542
+ 'default' => $this->opt_in_checkbox_default_status == 'checked' ? 1 : 0,
543
  );
544
  }
545
 
552
  * @since 1.2.1
553
  */
554
  function checkbox_default_status( $input ) {
 
555
  return $this->opt_in_checkbox_default_status == 'checked' ? 1 : 0;
556
  }
557
 
561
  * @version 1.1
562
  */
563
  function maybe_save_checkout_fields( $order_id ) {
 
564
  if ( 'yes' == $this->display_opt_in ) {
565
  $opt_in = isset( $_POST['ss_wc_mailchimp_opt_in'] ) ? 'yes' : 'no';
566
+
567
  update_post_meta( $order_id, 'ss_wc_mailchimp_opt_in', $opt_in );
568
  }
569
  }
575
  */
576
  static function log( $message ) {
577
  if ( WP_DEBUG === true ) {
578
+ $logger = new WC_Logger();
579
+
580
  if ( is_array( $message ) || is_object( $message ) ) {
581
+ $logger->add( $this->id, print_r( $message, true ) );
582
+ }
583
+ else {
584
+ $logger->add( $this->id, $message );
585
  }
586
  }
587
  }
languages/woocommerce-mailchimp-fr_FR.mo ADDED
Binary file
languages/woocommerce-mailchimp-fr_FR.po ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 WooCommerce MailChimp
2
+ # This file is distributed under the same license as the WooCommerce MailChimp package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WooCommerce MailChimp 1.1.3\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/woocommerce-mailchimp\n"
7
+ "POT-Creation-Date: 2015-02-06 15:05+0200\n"
8
+ "PO-Revision-Date: 2015-02-06 09:54-0600\n"
9
+ "Last-Translator: Vincent Pintat <vincent@walliecreation.com>\n"
10
+ "Language-Team: \n"
11
+ "Language: fr_FR\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.7.4\n"
16
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
17
+
18
+ #: ../classes/class-ss-wc-integration-mailchimp.php:31
19
+ #: ../classes/class-ss-wc-integration-mailchimp.php:518
20
+ msgid "MailChimp"
21
+ msgstr "MailChimp"
22
+
23
+ #: ../classes/class-ss-wc-integration-mailchimp.php:32
24
+ msgid "MailChimp is a popular email marketing service."
25
+ msgstr "MailChimp est un service d'emailing marketing très populaire."
26
+
27
+ #: ../classes/class-ss-wc-integration-mailchimp.php:82
28
+ #, php-format
29
+ msgid ""
30
+ "WooCommerce MailChimp error: Plugin is enabled but no api key provided. Please enter "
31
+ "your api key <a href=\"%s\">here</a>."
32
+ msgstr ""
33
+ "Erreur WooCommerce MailChimp : Le plugin est activé mais la clé d'API n'a pas été "
34
+ "renseignée. Entrez votre clé d'API <a href=\"%s\">ici</a>"
35
+
36
+ #: ../classes/class-ss-wc-integration-mailchimp.php:101
37
+ #, php-format
38
+ msgid "Order Opt-In Value: %s"
39
+ msgstr ""
40
+
41
+ #: ../classes/class-ss-wc-integration-mailchimp.php:107
42
+ #, php-format
43
+ msgid "Subscribe customer (%s) to list %s"
44
+ msgstr ""
45
+
46
+ #: ../classes/class-ss-wc-integration-mailchimp.php:177
47
+ msgid "Select a list..."
48
+ msgstr "Sélectionnez une liste..."
49
+
50
+ #: ../classes/class-ss-wc-integration-mailchimp.php:180
51
+ msgid "Enter your key and save to see your lists"
52
+ msgstr "Entrez votre clé et enregistrez pour voir vos listes"
53
+
54
+ #: ../classes/class-ss-wc-integration-mailchimp.php:185
55
+ msgid "Enable/Disable"
56
+ msgstr "Activer/Désactiver"
57
+
58
+ #: ../classes/class-ss-wc-integration-mailchimp.php:186
59
+ msgid "Enable MailChimp"
60
+ msgstr "Activer MailChimp"
61
+
62
+ #: ../classes/class-ss-wc-integration-mailchimp.php:192
63
+ msgid "Subscribe Event"
64
+ msgstr "Evénément d'inscription"
65
+
66
+ #: ../classes/class-ss-wc-integration-mailchimp.php:194
67
+ msgid "When should customers be subscribed to lists?"
68
+ msgstr "Quand les abonnés doivent-ils être inscrits aux listes ?"
69
+
70
+ #: ../classes/class-ss-wc-integration-mailchimp.php:197
71
+ msgid "Order Created"
72
+ msgstr "Commande crée"
73
+
74
+ #: ../classes/class-ss-wc-integration-mailchimp.php:198
75
+ msgid "Order Processing"
76
+ msgstr "Commande"
77
+
78
+ #: ../classes/class-ss-wc-integration-mailchimp.php:199
79
+ msgid "Order Completed"
80
+ msgstr "Commande terminée"
81
+
82
+ #: ../classes/class-ss-wc-integration-mailchimp.php:203
83
+ msgid "API Key"
84
+ msgstr "Clé d'API"
85
+
86
+ #: ../classes/class-ss-wc-integration-mailchimp.php:205
87
+ msgid ""
88
+ "<a href=\"https://us2.admin.mailchimp.com/account/api/\" target=\"_blank\">Login to "
89
+ "mailchimp</a> to look up your api key."
90
+ msgstr ""
91
+ "<a href=\"https://us2.admin.mailchimp.com/account/api/\" target=\"_blank\">Connectez-"
92
+ "vous à MailChimp</a> pour voir votre clé d'API."
93
+
94
+ #: ../classes/class-ss-wc-integration-mailchimp.php:209
95
+ msgid "Main List"
96
+ msgstr "Liste principale"
97
+
98
+ #: ../classes/class-ss-wc-integration-mailchimp.php:211
99
+ msgid "All customers will be added to this list."
100
+ msgstr "Tous les clients seront ajoutés à cette liste."
101
+
102
+ #: ../classes/class-ss-wc-integration-mailchimp.php:216
103
+ msgid "Group Name"
104
+ msgstr "Nom du groupe"
105
+
106
+ #: ../classes/class-ss-wc-integration-mailchimp.php:218
107
+ msgid ""
108
+ "Optional: Enter the name of the group. Learn more about <a href=\"http://mailchimp."
109
+ "com/features/groups\" target=\"_blank\">Groups</a>"
110
+ msgstr ""
111
+ "Optionnel : Entrez le nom du groupe. Apprenez-en plus au sujet des <a href=\"http://"
112
+ "mailchimp.com/features/groups\" target=\"_blank\">Groupes</a>"
113
+
114
+ #: ../classes/class-ss-wc-integration-mailchimp.php:222
115
+ msgid "Groups"
116
+ msgstr "Groupes"
117
+
118
+ #: ../classes/class-ss-wc-integration-mailchimp.php:224
119
+ msgid ""
120
+ "Optional: Comma separated list of interest groups to which subscribers should be "
121
+ "added."
122
+ msgstr ""
123
+ "Optionnel : Liste des groupes d'intérêt auxquels ajouter les nouveaux inscrits, "
124
+ "séparés par des virgules."
125
+
126
+ #: ../classes/class-ss-wc-integration-mailchimp.php:228
127
+ msgid "Double Opt-In"
128
+ msgstr "Double validation"
129
+
130
+ #: ../classes/class-ss-wc-integration-mailchimp.php:229
131
+ msgid "Enable Double Opt-In"
132
+ msgstr "Activer la double validation"
133
+
134
+ #: ../classes/class-ss-wc-integration-mailchimp.php:231
135
+ msgid ""
136
+ "If enabled, customers will receive an email prompting them to confirm their "
137
+ "subscription to the list above."
138
+ msgstr ""
139
+ "Si activé, les clients recevront un email les incitant à confirmer leur inscription "
140
+ "à la liste ci-dessus."
141
+
142
+ #: ../classes/class-ss-wc-integration-mailchimp.php:235
143
+ msgid "Display Opt-In Field"
144
+ msgstr "Afficher le champs choix d'inscription"
145
+
146
+ #: ../classes/class-ss-wc-integration-mailchimp.php:236
147
+ msgid "Display an Opt-In Field on Checkout"
148
+ msgstr "Afficher un champs de choix d'inscription sur la page Commande (checkout)"
149
+
150
+ #: ../classes/class-ss-wc-integration-mailchimp.php:238
151
+ msgid ""
152
+ "If enabled, customers will be presented with a \"Opt-in\" checkbox during checkout "
153
+ "and will only be added to the list above if they opt-in."
154
+ msgstr ""
155
+ "Si activé, une case à cocher de choix d'inscription sera affichée aux clients "
156
+ "pendant le processus de commande. Les clients choisissant de s'inscrire seront "
157
+ "ajoutés à la liste ce-dessus s'ils cochent la case."
158
+
159
+ #: ../classes/class-ss-wc-integration-mailchimp.php:242
160
+ msgid "Opt-In Field Label"
161
+ msgstr "Label du champs \"choix d'inscription\""
162
+
163
+ #: ../classes/class-ss-wc-integration-mailchimp.php:244
164
+ msgid "Optional: customize the label displayed next to the opt-in checkbox."
165
+ msgstr "Optionnel : personnalisez le label affiché à côté de la case à cocher."
166
+
167
+ #: ../classes/class-ss-wc-integration-mailchimp.php:245
168
+ msgid "Add me to the newsletter (we will never share your email)."
169
+ msgstr "M'inscrire à la newsletter (votre email restera confidentiel)"
170
+
171
+ #: ../classes/class-ss-wc-integration-mailchimp.php:248
172
+ msgid "Opt-In Checkbox Default Status"
173
+ msgstr "Etat par défaut de la case à cocher"
174
+
175
+ #: ../classes/class-ss-wc-integration-mailchimp.php:250
176
+ msgid "The default state of the opt-in checkbox."
177
+ msgstr "L'état par défaut de la case à cocher"
178
+
179
+ #: ../classes/class-ss-wc-integration-mailchimp.php:253
180
+ msgid "Checked"
181
+ msgstr "Coché"
182
+
183
+ #: ../classes/class-ss-wc-integration-mailchimp.php:254
184
+ msgid "Unchecked"
185
+ msgstr "Non coché"
186
+
187
+ #: ../classes/class-ss-wc-integration-mailchimp.php:258
188
+ msgid "Opt-In Checkbox Display Location"
189
+ msgstr "Localisation de la case à cocher d'inscription"
190
+
191
+ #: ../classes/class-ss-wc-integration-mailchimp.php:260
192
+ msgid ""
193
+ "Where to display the opt-in checkbox on the checkout page (under Billing info or "
194
+ "Order info)."
195
+ msgstr ""
196
+ "Où afficher la case à cocher sur la page de commande (en dessous de Facturation ou "
197
+ "Récapitulatif de commande). "
198
+
199
+ #: ../classes/class-ss-wc-integration-mailchimp.php:263
200
+ msgid "Billing"
201
+ msgstr "Facturation"
202
+
203
+ #: ../classes/class-ss-wc-integration-mailchimp.php:264
204
+ msgid "Order"
205
+ msgstr "Commande"
206
+
207
+ #: ../classes/class-ss-wc-integration-mailchimp.php:378
208
+ #, php-format
209
+ msgid "Unable to load lists from MailChimp: (%s) %s. "
210
+ msgstr ""
211
+
212
+ #: ../classes/class-ss-wc-integration-mailchimp.php:379
213
+ #, php-format
214
+ msgid "Please check your %s <a href=\"%s\">settings</a>."
215
+ msgstr ""
216
+
217
+ #: ../classes/class-ss-wc-integration-mailchimp.php:399
218
+ #, php-format
219
+ msgid "Unable to load listInterestGroupings() from MailChimp: (%s) %s"
220
+ msgstr "Impossible de charger listInterestGroupings() depuis MailChimp: (%s) %s"
221
+
222
+ #: ../classes/class-ss-wc-integration-mailchimp.php:483
223
+ #, php-format
224
+ msgid "Calling MailChimp API listSubscribe method with the following: %s"
225
+ msgstr ""
226
+
227
+ #: ../classes/class-ss-wc-integration-mailchimp.php:489
228
+ #, php-format
229
+ msgid "MailChimp API response: %s"
230
+ msgstr ""
231
+
232
+ #: ../classes/class-ss-wc-integration-mailchimp.php:493
233
+ #, php-format
234
+ msgid "WooCommerce MailChimp subscription failed: %s (%s)"
235
+ msgstr ""
236
+
237
+ #: ../classes/class-ss-wc-integration-mailchimp.php:505
238
+ msgid "WooCommerce MailChimp subscription failed"
239
+ msgstr "L'inscription à WooCommerce MailChimp a échoué"
240
+
241
+ #: ../classes/class-ss-wc-integration-mailchimp.php:519
242
+ msgid ""
243
+ "Enter your MailChimp settings below to control how WooCommerce integrates with your "
244
+ "MailChimp lists."
245
+ msgstr ""
246
+ "Entrez vos paramètres MailChimp ci-dessous pour contrôler comment WooCommerce "
247
+ "s'intègre à vos listes MailChimp."
248
+
249
+ #: ../woocommerce-mailchimp.php:60
250
+ msgid "Settings"
251
+ msgstr "Paramètres"
252
+
253
+ #~ msgid "Unable to load lists from MailChimp: (%s) %s."
254
+ #~ msgstr "Impossible de charger les listes depuis MailChimp : (%s) %s"
255
+
256
+ #~ msgid "WooCommerce MailChimp"
257
+ #~ msgstr "WooCommerce MailChimp"
258
+
259
+ #~ msgid "http://anderly.com/woocommerce-mailchimp"
260
+ #~ msgstr "http://anderly.com/woocommerce-mailchimp"
261
+
262
+ #~ msgid "WooCommerce MailChimp provides simple MailChimp integration for WooCommerce."
263
+ #~ msgstr ""
264
+ #~ "WooCommerce MailChimp fourni une intégration simple de MailChimp dans WooCommerce."
265
+
266
+ #~ msgid "Adam Anderly"
267
+ #~ msgstr "Adam Anderly"
268
+
269
+ #~ msgid "http://anderly.com"
270
+ #~ msgstr "http://anderly.com"
271
+
272
+ #~ msgid "Email subscription failed (Mailchimp)"
273
+ #~ msgstr "Inscription de cet email échouée (MailChimp)"
languages/woocommerce-mailchimp.pot CHANGED
@@ -1,215 +1,238 @@
1
- # Copyright (C) 2015 WooCommerce MailChimp
2
- # This file is distributed under the same license as the WooCommerce MailChimp package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: WooCommerce MailChimp 1.3.2\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/woocommerce-mailchimp\n"
7
- "POT-Creation-Date: 2015-01-16 15:51:13+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
- "Language-Team: LANGUAGE <LL@li.org>\n"
14
-
15
- #: classes/class-ss-wc-integration-mailchimp.php:31
16
- #: classes/class-ss-wc-integration-mailchimp.php:451
17
- msgid "MailChimp"
18
- msgstr ""
19
-
20
- #: classes/class-ss-wc-integration-mailchimp.php:32
21
- msgid "MailChimp is a popular email marketing service."
22
- msgstr ""
23
-
24
- #: classes/class-ss-wc-integration-mailchimp.php:86
25
- msgid ""
26
- "WooCommerce MailChimp error: Plugin is enabled but no api key provided. "
27
- "Please enter your api key <a href=\"%s\">here</a>."
28
- msgstr ""
29
-
30
- #: classes/class-ss-wc-integration-mailchimp.php:172
31
- msgid "Select a list..."
32
- msgstr ""
33
-
34
- #: classes/class-ss-wc-integration-mailchimp.php:172
35
- msgid "Enter your key and save to see your lists"
36
- msgstr ""
37
-
38
- #: classes/class-ss-wc-integration-mailchimp.php:177
39
- msgid "Enable/Disable"
40
- msgstr ""
41
-
42
- #: classes/class-ss-wc-integration-mailchimp.php:178
43
- msgid "Enable MailChimp"
44
- msgstr ""
45
-
46
- #: classes/class-ss-wc-integration-mailchimp.php:184
47
- msgid "Subscribe Event"
48
- msgstr ""
49
-
50
- #: classes/class-ss-wc-integration-mailchimp.php:186
51
- msgid "When should customers be subscribed to lists?"
52
- msgstr ""
53
-
54
- #: classes/class-ss-wc-integration-mailchimp.php:189
55
- msgid "Order Created"
56
- msgstr ""
57
-
58
- #: classes/class-ss-wc-integration-mailchimp.php:190
59
- msgid "Order Completed"
60
- msgstr ""
61
-
62
- #: classes/class-ss-wc-integration-mailchimp.php:194
63
- msgid "API Key"
64
- msgstr ""
65
-
66
- #: classes/class-ss-wc-integration-mailchimp.php:196
67
- msgid ""
68
- "<a href=\"https://us2.admin.mailchimp.com/account/api/\" target=\"_blank"
69
- "\">Login to mailchimp</a> to look up your api key."
70
- msgstr ""
71
-
72
- #: classes/class-ss-wc-integration-mailchimp.php:200
73
- msgid "Main List"
74
- msgstr ""
75
-
76
- #: classes/class-ss-wc-integration-mailchimp.php:202
77
- msgid "All customers will be added to this list."
78
- msgstr ""
79
-
80
- #: classes/class-ss-wc-integration-mailchimp.php:207
81
- msgid "Group Name"
82
- msgstr ""
83
-
84
- #: classes/class-ss-wc-integration-mailchimp.php:209
85
- msgid ""
86
- "Optional: Enter the name of the group. Learn more about <a href=\"http://"
87
- "mailchimp.com/features/groups\" target=\"_blank\">Groups</a>"
88
- msgstr ""
89
-
90
- #: classes/class-ss-wc-integration-mailchimp.php:213
91
- msgid "Groups"
92
- msgstr ""
93
-
94
- #: classes/class-ss-wc-integration-mailchimp.php:215
95
- msgid ""
96
- "Optional: Comma separated list of interest groups to which subscribers "
97
- "should be added."
98
- msgstr ""
99
-
100
- #: classes/class-ss-wc-integration-mailchimp.php:219
101
- msgid "Double Opt-In"
102
- msgstr ""
103
-
104
- #: classes/class-ss-wc-integration-mailchimp.php:220
105
- msgid "Enable Double Opt-In"
106
- msgstr ""
107
-
108
- #: classes/class-ss-wc-integration-mailchimp.php:222
109
- msgid ""
110
- "If enabled, customers will receive an email prompting them to confirm their "
111
- "subscription to the list above."
112
- msgstr ""
113
-
114
- #: classes/class-ss-wc-integration-mailchimp.php:226
115
- msgid "Display Opt-In Field"
116
- msgstr ""
117
-
118
- #: classes/class-ss-wc-integration-mailchimp.php:227
119
- msgid "Display an Opt-In Field on Checkout"
120
- msgstr ""
121
-
122
- #: classes/class-ss-wc-integration-mailchimp.php:229
123
- msgid ""
124
- "If enabled, customers will be presented with a \"Opt-in\" checkbox during "
125
- "checkout and will only be added to the list above if they opt-in."
126
- msgstr ""
127
-
128
- #: classes/class-ss-wc-integration-mailchimp.php:233
129
- msgid "Opt-In Field Label"
130
- msgstr ""
131
-
132
- #: classes/class-ss-wc-integration-mailchimp.php:235
133
- msgid "Optional: customize the label displayed next to the opt-in checkbox."
134
- msgstr ""
135
-
136
- #: classes/class-ss-wc-integration-mailchimp.php:236
137
- msgid "Add me to the newsletter (we will never share your email)."
138
- msgstr ""
139
-
140
- #: classes/class-ss-wc-integration-mailchimp.php:239
141
- msgid "Opt-In Checkbox Default Status"
142
- msgstr ""
143
-
144
- #: classes/class-ss-wc-integration-mailchimp.php:241
145
- msgid "The default state of the opt-in checkbox."
146
- msgstr ""
147
-
148
- #: classes/class-ss-wc-integration-mailchimp.php:243
149
- msgid "Checked"
150
- msgstr ""
151
-
152
- #: classes/class-ss-wc-integration-mailchimp.php:243
153
- msgid "Unchecked"
154
- msgstr ""
155
-
156
- #: classes/class-ss-wc-integration-mailchimp.php:246
157
- msgid "Opt-In Checkbox Display Location"
158
- msgstr ""
159
-
160
- #: classes/class-ss-wc-integration-mailchimp.php:248
161
- msgid ""
162
- "Where to display the opt-in checkbox on the checkout page (under Billing "
163
- "info or Order info)."
164
- msgstr ""
165
-
166
- #: classes/class-ss-wc-integration-mailchimp.php:250
167
- msgid "Billing"
168
- msgstr ""
169
-
170
- #: classes/class-ss-wc-integration-mailchimp.php:250
171
- msgid "Order"
172
- msgstr ""
173
-
174
- #: classes/class-ss-wc-integration-mailchimp.php:332
175
- msgid "Unable to load lists from MailChimp: (%s) %s."
176
- msgstr ""
177
-
178
- #: classes/class-ss-wc-integration-mailchimp.php:358
179
- msgid "Unable to load listInterestGroupings() from MailChimp: (%s) %s"
180
- msgstr ""
181
-
182
- #: classes/class-ss-wc-integration-mailchimp.php:442
183
- msgid "WooCommerce MailChimp subscription failed"
184
- msgstr ""
185
-
186
- #: classes/class-ss-wc-integration-mailchimp.php:452
187
- msgid ""
188
- "Enter your MailChimp settings below to control how WooCommerce integrates "
189
- "with your MailChimp lists."
190
- msgstr ""
191
-
192
- #: woocommerce-mailchimp.php:55
193
- msgid "Settings"
194
- msgstr ""
195
-
196
- #. Plugin Name of the plugin/theme
197
- msgid "WooCommerce MailChimp"
198
- msgstr ""
199
-
200
- #. Plugin URI of the plugin/theme
201
- msgid "http://anderly.com/woocommerce-mailchimp"
202
- msgstr ""
203
-
204
- #. Description of the plugin/theme
205
- msgid ""
206
- "WooCommerce MailChimp provides simple MailChimp integration for WooCommerce."
207
- msgstr ""
208
-
209
- #. Author of the plugin/theme
210
- msgid "Adam Anderly"
211
- msgstr ""
212
-
213
- #. Author URI of the plugin/theme
214
- msgid "http://anderly.com"
215
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2015 WooCommerce MailChimp
2
+ # This file is distributed under the same license as the WooCommerce MailChimp package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WooCommerce MailChimp 1.3.2\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/woocommerce-mailchimp\n"
7
+ "POT-Creation-Date: 2015-02-06 15:05+0200\n"
8
+ "PO-Revision-Date: 2015-02-06 15:05+0200\n"
9
+ "Last-Translator: Risto Niinemets <risto@konekt.ee>\n"
10
+ "Language-Team: LANGUAGE <LL@li.org>\n"
11
+ "Language: en\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "X-Generator: Poedit 1.7.1\n"
17
+ "X-Poedit-KeywordsList: __;_e\n"
18
+ "X-Poedit-Basepath: .\n"
19
+ "X-Poedit-SearchPath-0: ..\n"
20
+ "X-Poedit-SearchPathExcluded-0: ../.git\n"
21
+
22
+ #: ../classes/class-ss-wc-integration-mailchimp.php:31
23
+ #: ../classes/class-ss-wc-integration-mailchimp.php:518
24
+ msgid "MailChimp"
25
+ msgstr ""
26
+
27
+ #: ../classes/class-ss-wc-integration-mailchimp.php:32
28
+ msgid "MailChimp is a popular email marketing service."
29
+ msgstr ""
30
+
31
+ #: ../classes/class-ss-wc-integration-mailchimp.php:82
32
+ #, php-format
33
+ msgid ""
34
+ "WooCommerce MailChimp error: Plugin is enabled but no api key provided. Please enter "
35
+ "your api key <a href=\"%s\">here</a>."
36
+ msgstr ""
37
+
38
+ #: ../classes/class-ss-wc-integration-mailchimp.php:101
39
+ #, php-format
40
+ msgid "Order Opt-In Value: %s"
41
+ msgstr ""
42
+
43
+ #: ../classes/class-ss-wc-integration-mailchimp.php:107
44
+ #, php-format
45
+ msgid "Subscribe customer (%s) to list %s"
46
+ msgstr ""
47
+
48
+ #: ../classes/class-ss-wc-integration-mailchimp.php:177
49
+ msgid "Select a list..."
50
+ msgstr ""
51
+
52
+ #: ../classes/class-ss-wc-integration-mailchimp.php:180
53
+ msgid "Enter your key and save to see your lists"
54
+ msgstr ""
55
+
56
+ #: ../classes/class-ss-wc-integration-mailchimp.php:185
57
+ msgid "Enable/Disable"
58
+ msgstr ""
59
+
60
+ #: ../classes/class-ss-wc-integration-mailchimp.php:186
61
+ msgid "Enable MailChimp"
62
+ msgstr ""
63
+
64
+ #: ../classes/class-ss-wc-integration-mailchimp.php:192
65
+ msgid "Subscribe Event"
66
+ msgstr ""
67
+
68
+ #: ../classes/class-ss-wc-integration-mailchimp.php:194
69
+ msgid "When should customers be subscribed to lists?"
70
+ msgstr ""
71
+
72
+ #: ../classes/class-ss-wc-integration-mailchimp.php:197
73
+ msgid "Order Created"
74
+ msgstr ""
75
+
76
+ #: ../classes/class-ss-wc-integration-mailchimp.php:198
77
+ msgid "Order Processing"
78
+ msgstr ""
79
+
80
+ #: ../classes/class-ss-wc-integration-mailchimp.php:199
81
+ msgid "Order Completed"
82
+ msgstr ""
83
+
84
+ #: ../classes/class-ss-wc-integration-mailchimp.php:203
85
+ msgid "API Key"
86
+ msgstr ""
87
+
88
+ #: ../classes/class-ss-wc-integration-mailchimp.php:205
89
+ msgid ""
90
+ "<a href=\"https://us2.admin.mailchimp.com/account/api/\" target=\"_blank\">Login to "
91
+ "mailchimp</a> to look up your api key."
92
+ msgstr ""
93
+
94
+ #: ../classes/class-ss-wc-integration-mailchimp.php:209
95
+ msgid "Main List"
96
+ msgstr ""
97
+
98
+ #: ../classes/class-ss-wc-integration-mailchimp.php:211
99
+ msgid "All customers will be added to this list."
100
+ msgstr ""
101
+
102
+ #: ../classes/class-ss-wc-integration-mailchimp.php:216
103
+ msgid "Group Name"
104
+ msgstr ""
105
+
106
+ #: ../classes/class-ss-wc-integration-mailchimp.php:218
107
+ msgid ""
108
+ "Optional: Enter the name of the group. Learn more about <a href=\"http://mailchimp."
109
+ "com/features/groups\" target=\"_blank\">Groups</a>"
110
+ msgstr ""
111
+
112
+ #: ../classes/class-ss-wc-integration-mailchimp.php:222
113
+ msgid "Groups"
114
+ msgstr ""
115
+
116
+ #: ../classes/class-ss-wc-integration-mailchimp.php:224
117
+ msgid ""
118
+ "Optional: Comma separated list of interest groups to which subscribers should be "
119
+ "added."
120
+ msgstr ""
121
+
122
+ #: ../classes/class-ss-wc-integration-mailchimp.php:228
123
+ msgid "Double Opt-In"
124
+ msgstr ""
125
+
126
+ #: ../classes/class-ss-wc-integration-mailchimp.php:229
127
+ msgid "Enable Double Opt-In"
128
+ msgstr ""
129
+
130
+ #: ../classes/class-ss-wc-integration-mailchimp.php:231
131
+ msgid ""
132
+ "If enabled, customers will receive an email prompting them to confirm their "
133
+ "subscription to the list above."
134
+ msgstr ""
135
+
136
+ #: ../classes/class-ss-wc-integration-mailchimp.php:235
137
+ msgid "Display Opt-In Field"
138
+ msgstr ""
139
+
140
+ #: ../classes/class-ss-wc-integration-mailchimp.php:236
141
+ msgid "Display an Opt-In Field on Checkout"
142
+ msgstr ""
143
+
144
+ #: ../classes/class-ss-wc-integration-mailchimp.php:238
145
+ msgid ""
146
+ "If enabled, customers will be presented with a \"Opt-in\" checkbox during checkout "
147
+ "and will only be added to the list above if they opt-in."
148
+ msgstr ""
149
+
150
+ #: ../classes/class-ss-wc-integration-mailchimp.php:242
151
+ msgid "Opt-In Field Label"
152
+ msgstr ""
153
+
154
+ #: ../classes/class-ss-wc-integration-mailchimp.php:244
155
+ msgid "Optional: customize the label displayed next to the opt-in checkbox."
156
+ msgstr ""
157
+
158
+ #: ../classes/class-ss-wc-integration-mailchimp.php:245
159
+ msgid "Add me to the newsletter (we will never share your email)."
160
+ msgstr ""
161
+
162
+ #: ../classes/class-ss-wc-integration-mailchimp.php:248
163
+ msgid "Opt-In Checkbox Default Status"
164
+ msgstr ""
165
+
166
+ #: ../classes/class-ss-wc-integration-mailchimp.php:250
167
+ msgid "The default state of the opt-in checkbox."
168
+ msgstr ""
169
+
170
+ #: ../classes/class-ss-wc-integration-mailchimp.php:253
171
+ msgid "Checked"
172
+ msgstr ""
173
+
174
+ #: ../classes/class-ss-wc-integration-mailchimp.php:254
175
+ msgid "Unchecked"
176
+ msgstr ""
177
+
178
+ #: ../classes/class-ss-wc-integration-mailchimp.php:258
179
+ msgid "Opt-In Checkbox Display Location"
180
+ msgstr ""
181
+
182
+ #: ../classes/class-ss-wc-integration-mailchimp.php:260
183
+ msgid ""
184
+ "Where to display the opt-in checkbox on the checkout page (under Billing info or "
185
+ "Order info)."
186
+ msgstr ""
187
+
188
+ #: ../classes/class-ss-wc-integration-mailchimp.php:263
189
+ msgid "Billing"
190
+ msgstr ""
191
+
192
+ #: ../classes/class-ss-wc-integration-mailchimp.php:264
193
+ msgid "Order"
194
+ msgstr ""
195
+
196
+ #: ../classes/class-ss-wc-integration-mailchimp.php:378
197
+ #, php-format
198
+ msgid "Unable to load lists from MailChimp: (%s) %s. "
199
+ msgstr ""
200
+
201
+ #: ../classes/class-ss-wc-integration-mailchimp.php:379
202
+ #, php-format
203
+ msgid "Please check your %s <a href=\"%s\">settings</a>."
204
+ msgstr ""
205
+
206
+ #: ../classes/class-ss-wc-integration-mailchimp.php:399
207
+ #, php-format
208
+ msgid "Unable to load listInterestGroupings() from MailChimp: (%s) %s"
209
+ msgstr ""
210
+
211
+ #: ../classes/class-ss-wc-integration-mailchimp.php:483
212
+ #, php-format
213
+ msgid "Calling MailChimp API listSubscribe method with the following: %s"
214
+ msgstr ""
215
+
216
+ #: ../classes/class-ss-wc-integration-mailchimp.php:489
217
+ #, php-format
218
+ msgid "MailChimp API response: %s"
219
+ msgstr ""
220
+
221
+ #: ../classes/class-ss-wc-integration-mailchimp.php:493
222
+ #, php-format
223
+ msgid "WooCommerce MailChimp subscription failed: %s (%s)"
224
+ msgstr ""
225
+
226
+ #: ../classes/class-ss-wc-integration-mailchimp.php:505
227
+ msgid "WooCommerce MailChimp subscription failed"
228
+ msgstr ""
229
+
230
+ #: ../classes/class-ss-wc-integration-mailchimp.php:519
231
+ msgid ""
232
+ "Enter your MailChimp settings below to control how WooCommerce integrates with your "
233
+ "MailChimp lists."
234
+ msgstr ""
235
+
236
+ #: ../woocommerce-mailchimp.php:60
237
+ msgid "Settings"
238
+ msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: anderly, saintsystems
3
  Tags: woocommerce, mailchimp
4
  Requires at least: 3.5.1
5
  Tested up to: 4.1
6
- Stable tag: 1.3.4
7
  License: GPLv3
8
 
9
  Simple and flexible MailChimp integration for WooCommerce.
@@ -78,6 +78,13 @@ If you need help, have problems, want to leave feedback or want to provide const
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
81
  = 1.3.4 =
82
  * Fix enabled check. Issue #6.
83
 
3
  Tags: woocommerce, mailchimp
4
  Requires at least: 3.5.1
5
  Tested up to: 4.1
6
+ Stable tag: 1.3.5
7
  License: GPLv3
8
 
9
  Simple and flexible MailChimp integration for WooCommerce.
78
 
79
  == Changelog ==
80
 
81
+ = 1.3.5 =
82
+ * Fix for undefined variable list and array_merge issue.
83
+ * Change to use WC_Logger instead of error_log
84
+ * Updated pot file
85
+ * Added French translation
86
+ * General code syntax cleanup
87
+
88
  = 1.3.4 =
89
  * Fix enabled check. Issue #6.
90
 
woocommerce-mailchimp.php CHANGED
@@ -5,10 +5,10 @@
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Adam Anderly
7
  * Author URI: http://anderly.com
8
- * Version: 1.3.4
9
  * Text Domain: ss_wc_mailchimp
10
  * Domain Path: languages
11
- *
12
  * Copyright: � 2015 Adam Anderly
13
  * License: GNU General Public License v3.0
14
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -16,7 +16,6 @@
16
  * MailChimp Docs: http://apidocs.mailchimp.com/
17
  */
18
 
19
- add_action( 'plugins_loaded', 'woocommerce_mailchimp_init', 0 );
20
 
21
  function woocommerce_mailchimp_init() {
22
 
@@ -40,23 +39,31 @@ function woocommerce_mailchimp_init() {
40
  include_once( 'classes/class-ss-wc-integration-mailchimp.php' );
41
 
42
  /**
43
- * Add the Integration to WooCommerce
44
- **/
45
  function add_mailchimp_integration($methods) {
46
- $methods[] = 'SS_WC_Integration_MailChimp';
 
47
  return $methods;
48
  }
49
 
50
- add_filter('woocommerce_integrations', 'add_mailchimp_integration' );
51
-
52
- function action_links( $links ) {
53
 
 
 
 
 
 
 
 
54
  $plugin_links = array(
55
  '<a href="' . WOOCOMMERCE_MAILCHIMP_SETTINGS_URL . '">' . __( 'Settings', 'ss_wc_mailchimp' ) . '</a>',
56
  );
57
 
58
  return array_merge( $plugin_links, $links );
59
  }
 
60
  // Add the "Settings" links on the Plugins administration screen
61
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'action_links' );
62
  }
 
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Adam Anderly
7
  * Author URI: http://anderly.com
8
+ * Version: 1.3.5
9
  * Text Domain: ss_wc_mailchimp
10
  * Domain Path: languages
11
+ *
12
  * Copyright: � 2015 Adam Anderly
13
  * License: GNU General Public License v3.0
14
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
16
  * MailChimp Docs: http://apidocs.mailchimp.com/
17
  */
18
 
 
19
 
20
  function woocommerce_mailchimp_init() {
21
 
39
  include_once( 'classes/class-ss-wc-integration-mailchimp.php' );
40
 
41
  /**
42
+ * Add the Integration to WooCommerce
43
+ */
44
  function add_mailchimp_integration($methods) {
45
+ $methods[] = 'SS_WC_Integration_MailChimp';
46
+
47
  return $methods;
48
  }
49
 
50
+ add_filter( 'woocommerce_integrations', 'add_mailchimp_integration' );
 
 
51
 
52
+ /**
53
+ * Add Settings link to plugins list
54
+ *
55
+ * @param array $links Plugin links
56
+ * @return array Modified plugin links
57
+ */
58
+ function action_links( $links ) {
59
  $plugin_links = array(
60
  '<a href="' . WOOCOMMERCE_MAILCHIMP_SETTINGS_URL . '">' . __( 'Settings', 'ss_wc_mailchimp' ) . '</a>',
61
  );
62
 
63
  return array_merge( $plugin_links, $links );
64
  }
65
+
66
  // Add the "Settings" links on the Plugins administration screen
67
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'action_links' );
68
  }
69
+ add_action( 'plugins_loaded', 'woocommerce_mailchimp_init', 0 );