Version Description
March 2nd, 2015 =
Enhancement: Re-bundled unaltered MailChimp API wrapper class file, and added appropriate class check to prevent conflicts with other MailChimp plugins (Gravity Forms etc.)
Enhancement: Removed the WYSIWYG editor from the options page. This caused issues for some users who were unable to validate the MailChimp API key.
Enhancement: Added a new setting to toggle the sending of the welcome email. Users can now disable the email all together, on a list by list basis. (checked
Download this release
Release Info
Developer | eherman24 |
Plugin | Easy Forms for MailChimp |
Version | 5.4 |
Comparing to | |
See all releases |
Code changes from version 5.3.3 to 5.4
- Mailchimp/Gallery.php +0 -33
- classes/MCAPI_2.0.class.php +238 -332
- classes/MCAPI_2.0.class.verify_false.php +260 -354
- {Mailchimp → classes/Mailchimp}/Campaigns.php +11 -10
- classes/Mailchimp/Conversations.php +80 -0
- {Mailchimp → classes/Mailchimp}/Ecomm.php +3 -3
- {Mailchimp → classes/Mailchimp}/Exceptions.php +30 -0
- {Mailchimp → classes/Mailchimp}/Folders.php +1 -1
- classes/Mailchimp/Gallery.php +106 -0
- classes/Mailchimp/Goal.php +49 -0
- {Mailchimp → classes/Mailchimp}/Helper.php +9 -10
- {Mailchimp → classes/Mailchimp}/Lists.php +20 -11
- {Mailchimp → classes/Mailchimp}/Mobile.php +1 -1
- {Mailchimp → classes/Mailchimp}/Neapolitan.php +1 -1
- {Mailchimp → classes/Mailchimp}/Reports.php +18 -18
- {Mailchimp → classes/Mailchimp}/Templates.php +4 -11
- {Mailchimp → classes/Mailchimp}/Users.php +6 -1
- {Mailchimp → classes/Mailchimp}/Vip.php +1 -1
- classes/class.yksemeBase.php +88 -58
- lib/inc/yks-mc-add-new-field-to-list.php +1 -1
- lib/inc/yks-mc-frontend-form-display.php +2 -2
- lib/inc/yks-mc-manage-list-form-table.php +14 -1
- lib/inc/yks-mc-update-list-field.php +1 -1
- pages/lists.php +86 -13
- pages/options.php +3 -21
- readme.txt +20 -1
- yikes-inc-easy-mailchimp-extender.php +3 -3
Mailchimp/Gallery.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Mailchimp_Gallery {
|
4 |
-
public function __construct(wpyksMCAPI $master) {
|
5 |
-
$this->master = $master;
|
6 |
-
}
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Return a section of the image gallery
|
10 |
-
* @param associative_array $opts
|
11 |
-
* - type string optional the gallery type to return - images or files - default to images
|
12 |
-
* - start int optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
13 |
-
* - limit int optional for large data sets, the number of results to return - defaults to 25, upper limit set at 100
|
14 |
-
* - sort_by string optional field to sort by - one of size, time, name - defaults to time
|
15 |
-
* - sort_dir string optional field to sort by - one of asc, desc - defaults to desc
|
16 |
-
* - search_term string optional a term to search for in names
|
17 |
-
* @return associative_array the matching gallery items
|
18 |
-
* - total int the total matching items
|
19 |
-
* - data array structs for each item included in the set, including:
|
20 |
-
* - name string the file name
|
21 |
-
* - time string the creation date for the item
|
22 |
-
* - size int the file size in bytes
|
23 |
-
* - full string the url to the actual item in the gallery
|
24 |
-
* - thumb string a url for a thumbnail that can be used to represent the item, generally an image thumbnail or an icon for a file type
|
25 |
-
*/
|
26 |
-
public function getList($opts=array()) {
|
27 |
-
$_params = array("opts" => $opts);
|
28 |
-
return $this->master->call('gallery/list', $_params);
|
29 |
-
}
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/MCAPI_2.0.class.php
CHANGED
@@ -1,354 +1,260 @@
|
|
1 |
<?php
|
2 |
-
require_once YKSEME_PATH.'/Mailchimp/Folders.php';
|
3 |
-
require_once YKSEME_PATH.'/Mailchimp/Templates.php';
|
4 |
-
require_once YKSEME_PATH.'/Mailchimp/Users.php';
|
5 |
-
require_once YKSEME_PATH.'/Mailchimp/Helper.php';
|
6 |
-
require_once YKSEME_PATH.'/Mailchimp/Mobile.php';
|
7 |
-
require_once YKSEME_PATH.'/Mailchimp/Ecomm.php';
|
8 |
-
require_once YKSEME_PATH.'/Mailchimp/Neapolitan.php';
|
9 |
-
require_once YKSEME_PATH.'/Mailchimp/Lists.php';
|
10 |
-
require_once YKSEME_PATH.'/Mailchimp/Campaigns.php';
|
11 |
-
require_once YKSEME_PATH.'/Mailchimp/Vip.php';
|
12 |
-
require_once YKSEME_PATH.'/Mailchimp/Reports.php';
|
13 |
-
require_once YKSEME_PATH.'/Mailchimp/Gallery.php';
|
14 |
-
require_once YKSEME_PATH.'/Mailchimp/Exceptions.php';
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
*/
|
32 |
-
var $templates;
|
33 |
-
/**
|
34 |
-
* Placeholder attribute for Mailchimp_Users class
|
35 |
-
*
|
36 |
-
* @var Mailchimp_Users
|
37 |
-
* @access public
|
38 |
-
*/
|
39 |
-
var $users;
|
40 |
-
/**
|
41 |
-
* Placeholder attribute for Mailchimp_Helper class
|
42 |
-
*
|
43 |
-
* @var Mailchimp_Helper
|
44 |
-
* @access public
|
45 |
-
*/
|
46 |
-
var $helper;
|
47 |
-
/**
|
48 |
-
* Placeholder attribute for Mailchimp_Mobile class
|
49 |
-
*
|
50 |
-
* @var Mailchimp_Mobile
|
51 |
-
* @access public
|
52 |
-
*/
|
53 |
-
var $mobile;
|
54 |
-
/**
|
55 |
-
* Placeholder attribute for Mailchimp_Ecomm class
|
56 |
-
*
|
57 |
-
* @var Mailchimp_Ecomm
|
58 |
-
* @access public
|
59 |
-
*/
|
60 |
-
var $ecomm;
|
61 |
-
/**
|
62 |
-
* Placeholder attribute for Mailchimp_Neapolitan class
|
63 |
-
*
|
64 |
-
* @var Mailchimp_Neapolitan
|
65 |
-
* @access public
|
66 |
-
*/
|
67 |
-
var $neapolitan;
|
68 |
-
/**
|
69 |
-
* Placeholder attribute for Mailchimp_Lists class
|
70 |
-
*
|
71 |
-
* @var Mailchimp_Lists
|
72 |
-
* @access public
|
73 |
-
*/
|
74 |
-
var $lists;
|
75 |
-
/**
|
76 |
-
* Placeholder attribute for Mailchimp_Campaigns class
|
77 |
-
*
|
78 |
-
* @var Mailchimp_Campaigns
|
79 |
-
* @access public
|
80 |
-
*/
|
81 |
-
var $campaigns;
|
82 |
-
/**
|
83 |
-
* Placeholder attribute for Mailchimp_Vip class
|
84 |
-
*
|
85 |
-
* @var Mailchimp_Vip
|
86 |
-
* @access public
|
87 |
-
*/
|
88 |
-
var $vip;
|
89 |
-
/**
|
90 |
-
* Placeholder attribute for Mailchimp_Reports class
|
91 |
-
*
|
92 |
-
* @var Mailchimp_Reports
|
93 |
-
* @access public
|
94 |
-
*/
|
95 |
-
var $reports;
|
96 |
-
/**
|
97 |
-
* Placeholder attribute for Mailchimp_Gallery class
|
98 |
-
*
|
99 |
-
* @var Mailchimp_Gallery
|
100 |
-
* @access public
|
101 |
-
*/
|
102 |
-
var $gallery;
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
* CURLOPT_SSL_VERIFYHOST setting
|
111 |
-
* @var bool
|
112 |
-
*/
|
113 |
-
public $ssl_verifyhost = 2;
|
114 |
-
/**
|
115 |
-
* CURLOPT_CAINFO
|
116 |
-
* @var string
|
117 |
-
*/
|
118 |
-
public $ssl_cainfo = null;
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
"Unknown_Exception" => "Mailchimp_Unknown_Exception",
|
138 |
-
"Request_TimedOut" => "Mailchimp_Request_TimedOut",
|
139 |
-
"Zend_Uri_Exception" => "Mailchimp_Zend_Uri_Exception",
|
140 |
-
"PDOException" => "Mailchimp_PDOException",
|
141 |
-
"Avesta_Db_Exception" => "Mailchimp_Avesta_Db_Exception",
|
142 |
-
"XML_RPC2_Exception" => "Mailchimp_XML_RPC2_Exception",
|
143 |
-
"XML_RPC2_FaultException" => "Mailchimp_XML_RPC2_FaultException",
|
144 |
-
"Too_Many_Connections" => "Mailchimp_Too_Many_Connections",
|
145 |
-
"Parse_Exception" => "Mailchimp_Parse_Exception",
|
146 |
-
"User_Unknown" => "Mailchimp_User_Unknown",
|
147 |
-
"User_Disabled" => "Mailchimp_User_Disabled",
|
148 |
-
"User_DoesNotExist" => "Mailchimp_User_DoesNotExist",
|
149 |
-
"User_NotApproved" => "Mailchimp_User_NotApproved",
|
150 |
-
"Invalid_ApiKey" => "Mailchimp_Invalid_ApiKey",
|
151 |
-
"User_UnderMaintenance" => "Mailchimp_User_UnderMaintenance",
|
152 |
-
"Invalid_AppKey" => "Mailchimp_Invalid_AppKey",
|
153 |
-
"Invalid_IP" => "Mailchimp_Invalid_IP",
|
154 |
-
"User_DoesExist" => "Mailchimp_User_DoesExist",
|
155 |
-
"User_InvalidRole" => "Mailchimp_User_InvalidRole",
|
156 |
-
"User_InvalidAction" => "Mailchimp_User_InvalidAction",
|
157 |
-
"User_MissingEmail" => "Mailchimp_User_MissingEmail",
|
158 |
-
"User_CannotSendCampaign" => "Mailchimp_User_CannotSendCampaign",
|
159 |
-
"User_MissingModuleOutbox" => "Mailchimp_User_MissingModuleOutbox",
|
160 |
-
"User_ModuleAlreadyPurchased" => "Mailchimp_User_ModuleAlreadyPurchased",
|
161 |
-
"User_ModuleNotPurchased" => "Mailchimp_User_ModuleNotPurchased",
|
162 |
-
"User_NotEnoughCredit" => "Mailchimp_User_NotEnoughCredit",
|
163 |
-
"MC_InvalidPayment" => "Mailchimp_MC_InvalidPayment",
|
164 |
-
"List_DoesNotExist" => "Mailchimp_List_DoesNotExist",
|
165 |
-
"List_InvalidInterestFieldType" => "Mailchimp_List_InvalidInterestFieldType",
|
166 |
-
"List_InvalidOption" => "Mailchimp_List_InvalidOption",
|
167 |
-
"List_InvalidUnsubMember" => "Mailchimp_List_InvalidUnsubMember",
|
168 |
-
"List_InvalidBounceMember" => "Mailchimp_List_InvalidBounceMember",
|
169 |
-
"List_AlreadySubscribed" => "Mailchimp_List_AlreadySubscribed",
|
170 |
-
"List_NotSubscribed" => "Mailchimp_List_NotSubscribed",
|
171 |
-
"List_InvalidImport" => "Mailchimp_List_InvalidImport",
|
172 |
-
"MC_PastedList_Duplicate" => "Mailchimp_MC_PastedList_Duplicate",
|
173 |
-
"MC_PastedList_InvalidImport" => "Mailchimp_MC_PastedList_InvalidImport",
|
174 |
-
"Email_AlreadySubscribed" => "Mailchimp_Email_AlreadySubscribed",
|
175 |
-
"Email_AlreadyUnsubscribed" => "Mailchimp_Email_AlreadyUnsubscribed",
|
176 |
-
"Email_NotExists" => "Mailchimp_Email_NotExists",
|
177 |
-
"Email_NotSubscribed" => "Mailchimp_Email_NotSubscribed",
|
178 |
-
"List_MergeFieldRequired" => "Mailchimp_List_MergeFieldRequired",
|
179 |
-
"List_CannotRemoveEmailMerge" => "Mailchimp_List_CannotRemoveEmailMerge",
|
180 |
-
"List_Merge_InvalidMergeID" => "Mailchimp_List_Merge_InvalidMergeID",
|
181 |
-
"List_TooManyMergeFields" => "Mailchimp_List_TooManyMergeFields",
|
182 |
-
"List_InvalidMergeField" => "Mailchimp_List_InvalidMergeField",
|
183 |
-
"List_InvalidInterestGroup" => "Mailchimp_List_InvalidInterestGroup",
|
184 |
-
"List_TooManyInterestGroups" => "Mailchimp_List_TooManyInterestGroups",
|
185 |
-
"Campaign_DoesNotExist" => "Mailchimp_Campaign_DoesNotExist",
|
186 |
-
"Campaign_StatsNotAvailable" => "Mailchimp_Campaign_StatsNotAvailable",
|
187 |
-
"Campaign_InvalidAbsplit" => "Mailchimp_Campaign_InvalidAbsplit",
|
188 |
-
"Campaign_InvalidContent" => "Mailchimp_Campaign_InvalidContent",
|
189 |
-
"Campaign_InvalidOption" => "Mailchimp_Campaign_InvalidOption",
|
190 |
-
"Campaign_InvalidStatus" => "Mailchimp_Campaign_InvalidStatus",
|
191 |
-
"Campaign_NotSaved" => "Mailchimp_Campaign_NotSaved",
|
192 |
-
"Campaign_InvalidSegment" => "Mailchimp_Campaign_InvalidSegment",
|
193 |
-
"Campaign_InvalidRss" => "Mailchimp_Campaign_InvalidRss",
|
194 |
-
"Campaign_InvalidAuto" => "Mailchimp_Campaign_InvalidAuto",
|
195 |
-
"MC_ContentImport_InvalidArchive" => "Mailchimp_MC_ContentImport_InvalidArchive",
|
196 |
-
"Campaign_BounceMissing" => "Mailchimp_Campaign_BounceMissing",
|
197 |
-
"Campaign_InvalidTemplate" => "Mailchimp_Campaign_InvalidTemplate",
|
198 |
-
"Invalid_EcommOrder" => "Mailchimp_Invalid_EcommOrder",
|
199 |
-
"Absplit_UnknownError" => "Mailchimp_Absplit_UnknownError",
|
200 |
-
"Absplit_UnknownSplitTest" => "Mailchimp_Absplit_UnknownSplitTest",
|
201 |
-
"Absplit_UnknownTestType" => "Mailchimp_Absplit_UnknownTestType",
|
202 |
-
"Absplit_UnknownWaitUnit" => "Mailchimp_Absplit_UnknownWaitUnit",
|
203 |
-
"Absplit_UnknownWinnerType" => "Mailchimp_Absplit_UnknownWinnerType",
|
204 |
-
"Absplit_WinnerNotSelected" => "Mailchimp_Absplit_WinnerNotSelected",
|
205 |
-
"Invalid_Analytics" => "Mailchimp_Invalid_Analytics",
|
206 |
-
"Invalid_DateTime" => "Mailchimp_Invalid_DateTime",
|
207 |
-
"Invalid_Email" => "Mailchimp_Invalid_Email",
|
208 |
-
"Invalid_SendType" => "Mailchimp_Invalid_SendType",
|
209 |
-
"Invalid_Template" => "Mailchimp_Invalid_Template",
|
210 |
-
"Invalid_TrackingOptions" => "Mailchimp_Invalid_TrackingOptions",
|
211 |
-
"Invalid_Options" => "Mailchimp_Invalid_Options",
|
212 |
-
"Invalid_Folder" => "Mailchimp_Invalid_Folder",
|
213 |
-
"Invalid_URL" => "Mailchimp_Invalid_URL",
|
214 |
-
"Module_Unknown" => "Mailchimp_Module_Unknown",
|
215 |
-
"MonthlyPlan_Unknown" => "Mailchimp_MonthlyPlan_Unknown",
|
216 |
-
"Order_TypeUnknown" => "Mailchimp_Order_TypeUnknown",
|
217 |
-
"Invalid_PagingLimit" => "Mailchimp_Invalid_PagingLimit",
|
218 |
-
"Invalid_PagingStart" => "Mailchimp_Invalid_PagingStart",
|
219 |
-
"Max_Size_Reached" => "Mailchimp_Max_Size_Reached",
|
220 |
-
"MC_SearchException" => "Mailchimp_MC_SearchException"
|
221 |
-
);
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
if(!$apikey) throw new Mailchimp_Error('You must provide a MailChimp API key');
|
227 |
-
$this->apikey = $apikey;
|
228 |
-
$dc = "us1";
|
229 |
-
if (strstr($this->apikey,"-")){
|
230 |
-
list($key, $dc) = explode("-",$this->apikey,2);
|
231 |
-
if (!$dc) $dc = "us1";
|
232 |
-
}
|
233 |
-
$this->root = str_replace('https://api', 'https://'.$dc.'.api', $this->root);
|
234 |
-
$this->root = rtrim($this->root, '/') . '/';
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
if (isset($opts['debug'])){
|
240 |
-
$this->debug = true;
|
241 |
-
}
|
242 |
-
if (isset($opts['ssl_verifypeer'])){
|
243 |
-
$this->ssl_verifypeer = $opts['ssl_verifypeer'];
|
244 |
-
}
|
245 |
-
if (isset($opts['ssl_verifyhost'])){
|
246 |
-
$this->ssl_verifyhost = $opts['ssl_verifyhost'];
|
247 |
-
}
|
248 |
-
if (isset($opts['ssl_cainfo'])){
|
249 |
-
$this->ssl_cainfo = $opts['ssl_cainfo'];
|
250 |
-
}
|
251 |
|
|
|
|
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
} else {
|
260 |
-
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
|
261 |
-
}
|
262 |
-
curl_setopt($this->ch, CURLOPT_HEADER, false);
|
263 |
-
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
|
264 |
-
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 45);
|
265 |
-
curl_setopt($this->ch, CURLOPT_TIMEOUT, $opts['timeout']);
|
266 |
|
267 |
-
|
268 |
-
|
269 |
-
$this->templates = new Mailchimp_Templates($this);
|
270 |
-
$this->users = new Mailchimp_Users($this);
|
271 |
-
$this->helper = new Mailchimp_Helper($this);
|
272 |
-
$this->mobile = new Mailchimp_Mobile($this);
|
273 |
-
$this->ecomm = new Mailchimp_Ecomm($this);
|
274 |
-
$this->neapolitan = new Mailchimp_Neapolitan($this);
|
275 |
-
$this->lists = new Mailchimp_Lists($this);
|
276 |
-
$this->campaigns = new Mailchimp_Campaigns($this);
|
277 |
-
$this->vip = new Mailchimp_Vip($this);
|
278 |
-
$this->reports = new Mailchimp_Reports($this);
|
279 |
-
$this->gallery = new Mailchimp_Gallery($this);
|
280 |
-
|
281 |
-
}
|
282 |
|
283 |
-
|
284 |
-
|
285 |
-
|
|
|
|
|
|
|
286 |
|
287 |
-
public function call($url, $params) {
|
288 |
-
$params['apikey'] = $this->apikey;
|
289 |
-
$params = json_encode($params);
|
290 |
-
$ch = $this->ch;
|
291 |
|
292 |
-
|
293 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
294 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
295 |
-
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
|
296 |
-
// SSL Options
|
297 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
|
298 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->ssl_verifyhost);
|
299 |
-
if ($this->ssl_cainfo) curl_setopt($ch, CURLOPT_CAINFO, $this->ssl_cainfo);
|
300 |
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
$curl_buffer = fopen('php://memory', 'w+');
|
305 |
-
curl_setopt($ch, CURLOPT_STDERR, $curl_buffer);
|
306 |
-
}
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
}
|
316 |
-
$this->log('Completed in ' . number_format($time * 1000, 2) . 'ms');
|
317 |
-
$this->log('Got response: ' . $response_body);
|
318 |
|
319 |
-
if(curl_error($ch)) {
|
320 |
-
throw new Mailchimp_HttpError("API call to $url failed: " . curl_error($ch));
|
321 |
-
}
|
322 |
-
$result = json_decode($response_body, true);
|
323 |
-
|
324 |
-
if(floor($info['http_code'] / 100) >= 4) {
|
325 |
-
throw $this->castError($result);
|
326 |
-
}
|
327 |
|
328 |
-
|
329 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
if(file_exists($path)) {
|
335 |
-
$apikey = trim(file_get_contents($path));
|
336 |
-
if($apikey) return $apikey;
|
337 |
-
}
|
338 |
-
}
|
339 |
-
return false;
|
340 |
-
}
|
341 |
|
342 |
-
|
343 |
-
|
|
|
|
|
|
|
344 |
|
345 |
-
|
346 |
-
|
347 |
-
|
|
|
348 |
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
|
|
354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
require_once 'Mailchimp/Folders.php';
|
4 |
+
require_once 'Mailchimp/Templates.php';
|
5 |
+
require_once 'Mailchimp/Users.php';
|
6 |
+
require_once 'Mailchimp/Helper.php';
|
7 |
+
require_once 'Mailchimp/Mobile.php';
|
8 |
+
require_once 'Mailchimp/Conversations.php';
|
9 |
+
require_once 'Mailchimp/Ecomm.php';
|
10 |
+
require_once 'Mailchimp/Neapolitan.php';
|
11 |
+
require_once 'Mailchimp/Lists.php';
|
12 |
+
require_once 'Mailchimp/Campaigns.php';
|
13 |
+
require_once 'Mailchimp/Vip.php';
|
14 |
+
require_once 'Mailchimp/Reports.php';
|
15 |
+
require_once 'Mailchimp/Gallery.php';
|
16 |
+
require_once 'Mailchimp/Goal.php';
|
17 |
+
require_once 'Mailchimp/Exceptions.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
class Mailchimp {
|
20 |
+
|
21 |
+
public $apikey;
|
22 |
+
public $ch;
|
23 |
+
public $root = 'https://api.mailchimp.com/2.0';
|
24 |
+
public $debug = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
public static $error_map = array(
|
27 |
+
"ValidationError" => "Mailchimp_ValidationError",
|
28 |
+
"ServerError_MethodUnknown" => "Mailchimp_ServerError_MethodUnknown",
|
29 |
+
"ServerError_InvalidParameters" => "Mailchimp_ServerError_InvalidParameters",
|
30 |
+
"Unknown_Exception" => "Mailchimp_Unknown_Exception",
|
31 |
+
"Request_TimedOut" => "Mailchimp_Request_TimedOut",
|
32 |
+
"Zend_Uri_Exception" => "Mailchimp_Zend_Uri_Exception",
|
33 |
+
"PDOException" => "Mailchimp_PDOException",
|
34 |
+
"Avesta_Db_Exception" => "Mailchimp_Avesta_Db_Exception",
|
35 |
+
"XML_RPC2_Exception" => "Mailchimp_XML_RPC2_Exception",
|
36 |
+
"XML_RPC2_FaultException" => "Mailchimp_XML_RPC2_FaultException",
|
37 |
+
"Too_Many_Connections" => "Mailchimp_Too_Many_Connections",
|
38 |
+
"Parse_Exception" => "Mailchimp_Parse_Exception",
|
39 |
+
"User_Unknown" => "Mailchimp_User_Unknown",
|
40 |
+
"User_Disabled" => "Mailchimp_User_Disabled",
|
41 |
+
"User_DoesNotExist" => "Mailchimp_User_DoesNotExist",
|
42 |
+
"User_NotApproved" => "Mailchimp_User_NotApproved",
|
43 |
+
"Invalid_ApiKey" => "Mailchimp_Invalid_ApiKey",
|
44 |
+
"User_UnderMaintenance" => "Mailchimp_User_UnderMaintenance",
|
45 |
+
"Invalid_AppKey" => "Mailchimp_Invalid_AppKey",
|
46 |
+
"Invalid_IP" => "Mailchimp_Invalid_IP",
|
47 |
+
"User_DoesExist" => "Mailchimp_User_DoesExist",
|
48 |
+
"User_InvalidRole" => "Mailchimp_User_InvalidRole",
|
49 |
+
"User_InvalidAction" => "Mailchimp_User_InvalidAction",
|
50 |
+
"User_MissingEmail" => "Mailchimp_User_MissingEmail",
|
51 |
+
"User_CannotSendCampaign" => "Mailchimp_User_CannotSendCampaign",
|
52 |
+
"User_MissingModuleOutbox" => "Mailchimp_User_MissingModuleOutbox",
|
53 |
+
"User_ModuleAlreadyPurchased" => "Mailchimp_User_ModuleAlreadyPurchased",
|
54 |
+
"User_ModuleNotPurchased" => "Mailchimp_User_ModuleNotPurchased",
|
55 |
+
"User_NotEnoughCredit" => "Mailchimp_User_NotEnoughCredit",
|
56 |
+
"MC_InvalidPayment" => "Mailchimp_MC_InvalidPayment",
|
57 |
+
"List_DoesNotExist" => "Mailchimp_List_DoesNotExist",
|
58 |
+
"List_InvalidInterestFieldType" => "Mailchimp_List_InvalidInterestFieldType",
|
59 |
+
"List_InvalidOption" => "Mailchimp_List_InvalidOption",
|
60 |
+
"List_InvalidUnsubMember" => "Mailchimp_List_InvalidUnsubMember",
|
61 |
+
"List_InvalidBounceMember" => "Mailchimp_List_InvalidBounceMember",
|
62 |
+
"List_AlreadySubscribed" => "Mailchimp_List_AlreadySubscribed",
|
63 |
+
"List_NotSubscribed" => "Mailchimp_List_NotSubscribed",
|
64 |
+
"List_InvalidImport" => "Mailchimp_List_InvalidImport",
|
65 |
+
"MC_PastedList_Duplicate" => "Mailchimp_MC_PastedList_Duplicate",
|
66 |
+
"MC_PastedList_InvalidImport" => "Mailchimp_MC_PastedList_InvalidImport",
|
67 |
+
"Email_AlreadySubscribed" => "Mailchimp_Email_AlreadySubscribed",
|
68 |
+
"Email_AlreadyUnsubscribed" => "Mailchimp_Email_AlreadyUnsubscribed",
|
69 |
+
"Email_NotExists" => "Mailchimp_Email_NotExists",
|
70 |
+
"Email_NotSubscribed" => "Mailchimp_Email_NotSubscribed",
|
71 |
+
"List_MergeFieldRequired" => "Mailchimp_List_MergeFieldRequired",
|
72 |
+
"List_CannotRemoveEmailMerge" => "Mailchimp_List_CannotRemoveEmailMerge",
|
73 |
+
"List_Merge_InvalidMergeID" => "Mailchimp_List_Merge_InvalidMergeID",
|
74 |
+
"List_TooManyMergeFields" => "Mailchimp_List_TooManyMergeFields",
|
75 |
+
"List_InvalidMergeField" => "Mailchimp_List_InvalidMergeField",
|
76 |
+
"List_InvalidInterestGroup" => "Mailchimp_List_InvalidInterestGroup",
|
77 |
+
"List_TooManyInterestGroups" => "Mailchimp_List_TooManyInterestGroups",
|
78 |
+
"Campaign_DoesNotExist" => "Mailchimp_Campaign_DoesNotExist",
|
79 |
+
"Campaign_StatsNotAvailable" => "Mailchimp_Campaign_StatsNotAvailable",
|
80 |
+
"Campaign_InvalidAbsplit" => "Mailchimp_Campaign_InvalidAbsplit",
|
81 |
+
"Campaign_InvalidContent" => "Mailchimp_Campaign_InvalidContent",
|
82 |
+
"Campaign_InvalidOption" => "Mailchimp_Campaign_InvalidOption",
|
83 |
+
"Campaign_InvalidStatus" => "Mailchimp_Campaign_InvalidStatus",
|
84 |
+
"Campaign_NotSaved" => "Mailchimp_Campaign_NotSaved",
|
85 |
+
"Campaign_InvalidSegment" => "Mailchimp_Campaign_InvalidSegment",
|
86 |
+
"Campaign_InvalidRss" => "Mailchimp_Campaign_InvalidRss",
|
87 |
+
"Campaign_InvalidAuto" => "Mailchimp_Campaign_InvalidAuto",
|
88 |
+
"MC_ContentImport_InvalidArchive" => "Mailchimp_MC_ContentImport_InvalidArchive",
|
89 |
+
"Campaign_BounceMissing" => "Mailchimp_Campaign_BounceMissing",
|
90 |
+
"Campaign_InvalidTemplate" => "Mailchimp_Campaign_InvalidTemplate",
|
91 |
+
"Invalid_EcommOrder" => "Mailchimp_Invalid_EcommOrder",
|
92 |
+
"Absplit_UnknownError" => "Mailchimp_Absplit_UnknownError",
|
93 |
+
"Absplit_UnknownSplitTest" => "Mailchimp_Absplit_UnknownSplitTest",
|
94 |
+
"Absplit_UnknownTestType" => "Mailchimp_Absplit_UnknownTestType",
|
95 |
+
"Absplit_UnknownWaitUnit" => "Mailchimp_Absplit_UnknownWaitUnit",
|
96 |
+
"Absplit_UnknownWinnerType" => "Mailchimp_Absplit_UnknownWinnerType",
|
97 |
+
"Absplit_WinnerNotSelected" => "Mailchimp_Absplit_WinnerNotSelected",
|
98 |
+
"Invalid_Analytics" => "Mailchimp_Invalid_Analytics",
|
99 |
+
"Invalid_DateTime" => "Mailchimp_Invalid_DateTime",
|
100 |
+
"Invalid_Email" => "Mailchimp_Invalid_Email",
|
101 |
+
"Invalid_SendType" => "Mailchimp_Invalid_SendType",
|
102 |
+
"Invalid_Template" => "Mailchimp_Invalid_Template",
|
103 |
+
"Invalid_TrackingOptions" => "Mailchimp_Invalid_TrackingOptions",
|
104 |
+
"Invalid_Options" => "Mailchimp_Invalid_Options",
|
105 |
+
"Invalid_Folder" => "Mailchimp_Invalid_Folder",
|
106 |
+
"Invalid_URL" => "Mailchimp_Invalid_URL",
|
107 |
+
"Module_Unknown" => "Mailchimp_Module_Unknown",
|
108 |
+
"MonthlyPlan_Unknown" => "Mailchimp_MonthlyPlan_Unknown",
|
109 |
+
"Order_TypeUnknown" => "Mailchimp_Order_TypeUnknown",
|
110 |
+
"Invalid_PagingLimit" => "Mailchimp_Invalid_PagingLimit",
|
111 |
+
"Invalid_PagingStart" => "Mailchimp_Invalid_PagingStart",
|
112 |
+
"Max_Size_Reached" => "Mailchimp_Max_Size_Reached",
|
113 |
+
"MC_SearchException" => "Mailchimp_MC_SearchException",
|
114 |
+
"Goal_SaveFailed" => "Mailchimp_Goal_SaveFailed",
|
115 |
+
"Conversation_DoesNotExist" => "Mailchimp_Conversation_DoesNotExist",
|
116 |
+
"Conversation_ReplySaveFailed" => "Mailchimp_Conversation_ReplySaveFailed",
|
117 |
+
"File_Not_Found_Exception" => "Mailchimp_File_Not_Found_Exception",
|
118 |
+
"Folder_Not_Found_Exception" => "Mailchimp_Folder_Not_Found_Exception",
|
119 |
+
"Folder_Exists_Exception" => "Mailchimp_Folder_Exists_Exception"
|
120 |
+
);
|
121 |
|
122 |
+
public function __construct($apikey=null, $opts=array()) {
|
123 |
+
if (!$apikey) {
|
124 |
+
$apikey = getenv('MAILCHIMP_APIKEY');
|
125 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
+
if (!$apikey) {
|
128 |
+
$apikey = $this->readConfigs();
|
129 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
+
if (!$apikey) {
|
132 |
+
throw new Mailchimp_Error('You must provide a MailChimp API key');
|
133 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
+
$this->apikey = $apikey;
|
136 |
+
$dc = "us1";
|
137 |
|
138 |
+
if (strstr($this->apikey, "-")){
|
139 |
+
list($key, $dc) = explode("-", $this->apikey, 2);
|
140 |
+
if (!$dc) {
|
141 |
+
$dc = "us1";
|
142 |
+
}
|
143 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
+
$this->root = str_replace('https://api', 'https://' . $dc . '.api', $this->root);
|
146 |
+
$this->root = rtrim($this->root, '/') . '/';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
+
if (!isset($opts['timeout']) || !is_int($opts['timeout'])){
|
149 |
+
$opts['timeout'] = 600;
|
150 |
+
}
|
151 |
+
if (isset($opts['debug'])){
|
152 |
+
$this->debug = true;
|
153 |
+
}
|
154 |
|
|
|
|
|
|
|
|
|
155 |
|
156 |
+
$this->ch = curl_init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
+
if (isset($opts['CURLOPT_FOLLOWLOCATION']) && $opts['CURLOPT_FOLLOWLOCATION'] === true) {
|
159 |
+
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
|
160 |
+
}
|
|
|
|
|
|
|
161 |
|
162 |
+
curl_setopt($this->ch, CURLOPT_USERAGENT, 'MailChimp-PHP/2.0.5');
|
163 |
+
curl_setopt($this->ch, CURLOPT_POST, true);
|
164 |
+
curl_setopt($this->ch, CURLOPT_HEADER, false);
|
165 |
+
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
|
166 |
+
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 30);
|
167 |
+
curl_setopt($this->ch, CURLOPT_TIMEOUT, $opts['timeout']);
|
168 |
+
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
|
|
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
$this->folders = new Mailchimp_Folders($this);
|
172 |
+
$this->templates = new Mailchimp_Templates($this);
|
173 |
+
$this->users = new Mailchimp_Users($this);
|
174 |
+
$this->helper = new Mailchimp_Helper($this);
|
175 |
+
$this->mobile = new Mailchimp_Mobile($this);
|
176 |
+
$this->conversations = new Mailchimp_Conversations($this);
|
177 |
+
$this->ecomm = new Mailchimp_Ecomm($this);
|
178 |
+
$this->neapolitan = new Mailchimp_Neapolitan($this);
|
179 |
+
$this->lists = new Mailchimp_Lists($this);
|
180 |
+
$this->campaigns = new Mailchimp_Campaigns($this);
|
181 |
+
$this->vip = new Mailchimp_Vip($this);
|
182 |
+
$this->reports = new Mailchimp_Reports($this);
|
183 |
+
$this->gallery = new Mailchimp_Gallery($this);
|
184 |
+
$this->goal = new Mailchimp_Goal($this);
|
185 |
+
}
|
186 |
|
187 |
+
public function __destruct() {
|
188 |
+
curl_close($this->ch);
|
189 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
+
public function call($url, $params) {
|
192 |
+
$params['apikey'] = $this->apikey;
|
193 |
+
|
194 |
+
$params = json_encode($params);
|
195 |
+
$ch = $this->ch;
|
196 |
|
197 |
+
curl_setopt($ch, CURLOPT_URL, $this->root . $url . '.json');
|
198 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
199 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
200 |
+
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
|
201 |
|
202 |
+
$start = microtime(true);
|
203 |
+
$this->log('Call to ' . $this->root . $url . '.json: ' . $params);
|
204 |
+
if($this->debug) {
|
205 |
+
$curl_buffer = fopen('php://memory', 'w+');
|
206 |
+
curl_setopt($ch, CURLOPT_STDERR, $curl_buffer);
|
207 |
+
}
|
208 |
|
209 |
+
$response_body = curl_exec($ch);
|
210 |
+
|
211 |
+
$info = curl_getinfo($ch);
|
212 |
+
$time = microtime(true) - $start;
|
213 |
+
if($this->debug) {
|
214 |
+
rewind($curl_buffer);
|
215 |
+
$this->log(stream_get_contents($curl_buffer));
|
216 |
+
fclose($curl_buffer);
|
217 |
+
}
|
218 |
+
$this->log('Completed in ' . number_format($time * 1000, 2) . 'ms');
|
219 |
+
$this->log('Got response: ' . $response_body);
|
220 |
+
|
221 |
+
if(curl_error($ch)) {
|
222 |
+
throw new Mailchimp_HttpError("API call to $url failed: " . curl_error($ch));
|
223 |
+
}
|
224 |
+
$result = json_decode($response_body, true);
|
225 |
+
|
226 |
+
if(floor($info['http_code'] / 100) >= 4) {
|
227 |
+
throw $this->castError($result);
|
228 |
+
}
|
229 |
+
|
230 |
+
return $result;
|
231 |
+
}
|
232 |
+
|
233 |
+
public function readConfigs() {
|
234 |
+
$paths = array('~/.mailchimp.key', '/etc/mailchimp.key');
|
235 |
+
foreach($paths as $path) {
|
236 |
+
if(file_exists($path)) {
|
237 |
+
$apikey = trim(file_get_contents($path));
|
238 |
+
if ($apikey) {
|
239 |
+
return $apikey;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
return false;
|
244 |
+
}
|
245 |
+
|
246 |
+
public function castError($result) {
|
247 |
+
if ($result['status'] !== 'error' || !$result['name']) {
|
248 |
+
throw new Mailchimp_Error('We received an unexpected error: ' . json_encode($result));
|
249 |
+
}
|
250 |
+
|
251 |
+
$class = (isset(self::$error_map[$result['name']])) ? self::$error_map[$result['name']] : 'Mailchimp_Error';
|
252 |
+
return new $class($result['error'], $result['code']);
|
253 |
+
}
|
254 |
+
|
255 |
+
public function log($msg) {
|
256 |
+
if ($this->debug) {
|
257 |
+
error_log($msg);
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}
|
classes/MCAPI_2.0.class.verify_false.php
CHANGED
@@ -1,354 +1,260 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once
|
4 |
-
require_once
|
5 |
-
require_once
|
6 |
-
require_once
|
7 |
-
require_once
|
8 |
-
require_once
|
9 |
-
require_once
|
10 |
-
require_once
|
11 |
-
require_once
|
12 |
-
require_once
|
13 |
-
require_once
|
14 |
-
require_once
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
}
|
262 |
-
curl_setopt($this->ch, CURLOPT_HEADER, false);
|
263 |
-
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
|
264 |
-
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 45);
|
265 |
-
curl_setopt($this->ch, CURLOPT_TIMEOUT, $opts['timeout']);
|
266 |
-
|
267 |
-
|
268 |
-
$this->folders = new Mailchimp_Folders($this);
|
269 |
-
$this->templates = new Mailchimp_Templates($this);
|
270 |
-
$this->users = new Mailchimp_Users($this);
|
271 |
-
$this->helper = new Mailchimp_Helper($this);
|
272 |
-
$this->mobile = new Mailchimp_Mobile($this);
|
273 |
-
$this->ecomm = new Mailchimp_Ecomm($this);
|
274 |
-
$this->neapolitan = new Mailchimp_Neapolitan($this);
|
275 |
-
$this->lists = new Mailchimp_Lists($this);
|
276 |
-
$this->campaigns = new Mailchimp_Campaigns($this);
|
277 |
-
$this->vip = new Mailchimp_Vip($this);
|
278 |
-
$this->reports = new Mailchimp_Reports($this);
|
279 |
-
$this->gallery = new Mailchimp_Gallery($this);
|
280 |
-
|
281 |
-
}
|
282 |
-
|
283 |
-
public function __destruct() {
|
284 |
-
curl_close($this->ch);
|
285 |
-
}
|
286 |
-
|
287 |
-
public function call($url, $params) {
|
288 |
-
$params['apikey'] = $this->apikey;
|
289 |
-
$params = json_encode($params);
|
290 |
-
$ch = $this->ch;
|
291 |
-
|
292 |
-
curl_setopt($ch, CURLOPT_URL, $this->root . $url . '.json');
|
293 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
294 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
295 |
-
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
|
296 |
-
// SSL Options
|
297 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
|
298 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->ssl_verifyhost);
|
299 |
-
if ($this->ssl_cainfo) curl_setopt($ch, CURLOPT_CAINFO, $this->ssl_cainfo);
|
300 |
-
|
301 |
-
$start = microtime(true);
|
302 |
-
$this->log('Call to ' . $this->root . $url . '.json: ' . $params);
|
303 |
-
if($this->debug) {
|
304 |
-
$curl_buffer = fopen('php://memory', 'w+');
|
305 |
-
curl_setopt($ch, CURLOPT_STDERR, $curl_buffer);
|
306 |
-
}
|
307 |
-
|
308 |
-
$response_body = curl_exec($ch);
|
309 |
-
$info = curl_getinfo($ch);
|
310 |
-
$time = microtime(true) - $start;
|
311 |
-
if($this->debug) {
|
312 |
-
rewind($curl_buffer);
|
313 |
-
$this->log(stream_get_contents($curl_buffer));
|
314 |
-
fclose($curl_buffer);
|
315 |
-
}
|
316 |
-
$this->log('Completed in ' . number_format($time * 1000, 2) . 'ms');
|
317 |
-
$this->log('Got response: ' . $response_body);
|
318 |
-
|
319 |
-
if(curl_error($ch)) {
|
320 |
-
throw new Mailchimp_HttpError("API call to $url failed: " . curl_error($ch));
|
321 |
-
}
|
322 |
-
$result = json_decode($response_body, true);
|
323 |
-
|
324 |
-
if(floor($info['http_code'] / 100) >= 4) {
|
325 |
-
throw $this->castError($result);
|
326 |
-
}
|
327 |
-
|
328 |
-
return $result;
|
329 |
-
}
|
330 |
-
|
331 |
-
public function readConfigs() {
|
332 |
-
$paths = array('~/.mailchimp.key', '/etc/mailchimp.key');
|
333 |
-
foreach($paths as $path) {
|
334 |
-
if(file_exists($path)) {
|
335 |
-
$apikey = trim(file_get_contents($path));
|
336 |
-
if($apikey) return $apikey;
|
337 |
-
}
|
338 |
-
}
|
339 |
-
return false;
|
340 |
-
}
|
341 |
-
|
342 |
-
public function castError($result) {
|
343 |
-
if($result['status'] !== 'error' || !$result['name']) throw new Mailchimp_Error('We received an unexpected error: ' . json_encode($result));
|
344 |
-
|
345 |
-
$class = (isset(self::$error_map[$result['name']])) ? self::$error_map[$result['name']] : 'Mailchimp_Error';
|
346 |
-
return new $class($result['error'], $result['code']);
|
347 |
-
}
|
348 |
-
|
349 |
-
public function log($msg) {
|
350 |
-
if($this->debug) error_log($msg);
|
351 |
-
}
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mailchimp/Folders.php';
|
4 |
+
require_once 'Mailchimp/Templates.php';
|
5 |
+
require_once 'Mailchimp/Users.php';
|
6 |
+
require_once 'Mailchimp/Helper.php';
|
7 |
+
require_once 'Mailchimp/Mobile.php';
|
8 |
+
require_once 'Mailchimp/Conversations.php';
|
9 |
+
require_once 'Mailchimp/Ecomm.php';
|
10 |
+
require_once 'Mailchimp/Neapolitan.php';
|
11 |
+
require_once 'Mailchimp/Lists.php';
|
12 |
+
require_once 'Mailchimp/Campaigns.php';
|
13 |
+
require_once 'Mailchimp/Vip.php';
|
14 |
+
require_once 'Mailchimp/Reports.php';
|
15 |
+
require_once 'Mailchimp/Gallery.php';
|
16 |
+
require_once 'Mailchimp/Goal.php';
|
17 |
+
require_once 'Mailchimp/Exceptions.php';
|
18 |
+
|
19 |
+
class Mailchimp {
|
20 |
+
|
21 |
+
public $apikey;
|
22 |
+
public $ch;
|
23 |
+
public $root = 'https://api.mailchimp.com/2.0';
|
24 |
+
public $debug = false;
|
25 |
+
|
26 |
+
public static $error_map = array(
|
27 |
+
"ValidationError" => "Mailchimp_ValidationError",
|
28 |
+
"ServerError_MethodUnknown" => "Mailchimp_ServerError_MethodUnknown",
|
29 |
+
"ServerError_InvalidParameters" => "Mailchimp_ServerError_InvalidParameters",
|
30 |
+
"Unknown_Exception" => "Mailchimp_Unknown_Exception",
|
31 |
+
"Request_TimedOut" => "Mailchimp_Request_TimedOut",
|
32 |
+
"Zend_Uri_Exception" => "Mailchimp_Zend_Uri_Exception",
|
33 |
+
"PDOException" => "Mailchimp_PDOException",
|
34 |
+
"Avesta_Db_Exception" => "Mailchimp_Avesta_Db_Exception",
|
35 |
+
"XML_RPC2_Exception" => "Mailchimp_XML_RPC2_Exception",
|
36 |
+
"XML_RPC2_FaultException" => "Mailchimp_XML_RPC2_FaultException",
|
37 |
+
"Too_Many_Connections" => "Mailchimp_Too_Many_Connections",
|
38 |
+
"Parse_Exception" => "Mailchimp_Parse_Exception",
|
39 |
+
"User_Unknown" => "Mailchimp_User_Unknown",
|
40 |
+
"User_Disabled" => "Mailchimp_User_Disabled",
|
41 |
+
"User_DoesNotExist" => "Mailchimp_User_DoesNotExist",
|
42 |
+
"User_NotApproved" => "Mailchimp_User_NotApproved",
|
43 |
+
"Invalid_ApiKey" => "Mailchimp_Invalid_ApiKey",
|
44 |
+
"User_UnderMaintenance" => "Mailchimp_User_UnderMaintenance",
|
45 |
+
"Invalid_AppKey" => "Mailchimp_Invalid_AppKey",
|
46 |
+
"Invalid_IP" => "Mailchimp_Invalid_IP",
|
47 |
+
"User_DoesExist" => "Mailchimp_User_DoesExist",
|
48 |
+
"User_InvalidRole" => "Mailchimp_User_InvalidRole",
|
49 |
+
"User_InvalidAction" => "Mailchimp_User_InvalidAction",
|
50 |
+
"User_MissingEmail" => "Mailchimp_User_MissingEmail",
|
51 |
+
"User_CannotSendCampaign" => "Mailchimp_User_CannotSendCampaign",
|
52 |
+
"User_MissingModuleOutbox" => "Mailchimp_User_MissingModuleOutbox",
|
53 |
+
"User_ModuleAlreadyPurchased" => "Mailchimp_User_ModuleAlreadyPurchased",
|
54 |
+
"User_ModuleNotPurchased" => "Mailchimp_User_ModuleNotPurchased",
|
55 |
+
"User_NotEnoughCredit" => "Mailchimp_User_NotEnoughCredit",
|
56 |
+
"MC_InvalidPayment" => "Mailchimp_MC_InvalidPayment",
|
57 |
+
"List_DoesNotExist" => "Mailchimp_List_DoesNotExist",
|
58 |
+
"List_InvalidInterestFieldType" => "Mailchimp_List_InvalidInterestFieldType",
|
59 |
+
"List_InvalidOption" => "Mailchimp_List_InvalidOption",
|
60 |
+
"List_InvalidUnsubMember" => "Mailchimp_List_InvalidUnsubMember",
|
61 |
+
"List_InvalidBounceMember" => "Mailchimp_List_InvalidBounceMember",
|
62 |
+
"List_AlreadySubscribed" => "Mailchimp_List_AlreadySubscribed",
|
63 |
+
"List_NotSubscribed" => "Mailchimp_List_NotSubscribed",
|
64 |
+
"List_InvalidImport" => "Mailchimp_List_InvalidImport",
|
65 |
+
"MC_PastedList_Duplicate" => "Mailchimp_MC_PastedList_Duplicate",
|
66 |
+
"MC_PastedList_InvalidImport" => "Mailchimp_MC_PastedList_InvalidImport",
|
67 |
+
"Email_AlreadySubscribed" => "Mailchimp_Email_AlreadySubscribed",
|
68 |
+
"Email_AlreadyUnsubscribed" => "Mailchimp_Email_AlreadyUnsubscribed",
|
69 |
+
"Email_NotExists" => "Mailchimp_Email_NotExists",
|
70 |
+
"Email_NotSubscribed" => "Mailchimp_Email_NotSubscribed",
|
71 |
+
"List_MergeFieldRequired" => "Mailchimp_List_MergeFieldRequired",
|
72 |
+
"List_CannotRemoveEmailMerge" => "Mailchimp_List_CannotRemoveEmailMerge",
|
73 |
+
"List_Merge_InvalidMergeID" => "Mailchimp_List_Merge_InvalidMergeID",
|
74 |
+
"List_TooManyMergeFields" => "Mailchimp_List_TooManyMergeFields",
|
75 |
+
"List_InvalidMergeField" => "Mailchimp_List_InvalidMergeField",
|
76 |
+
"List_InvalidInterestGroup" => "Mailchimp_List_InvalidInterestGroup",
|
77 |
+
"List_TooManyInterestGroups" => "Mailchimp_List_TooManyInterestGroups",
|
78 |
+
"Campaign_DoesNotExist" => "Mailchimp_Campaign_DoesNotExist",
|
79 |
+
"Campaign_StatsNotAvailable" => "Mailchimp_Campaign_StatsNotAvailable",
|
80 |
+
"Campaign_InvalidAbsplit" => "Mailchimp_Campaign_InvalidAbsplit",
|
81 |
+
"Campaign_InvalidContent" => "Mailchimp_Campaign_InvalidContent",
|
82 |
+
"Campaign_InvalidOption" => "Mailchimp_Campaign_InvalidOption",
|
83 |
+
"Campaign_InvalidStatus" => "Mailchimp_Campaign_InvalidStatus",
|
84 |
+
"Campaign_NotSaved" => "Mailchimp_Campaign_NotSaved",
|
85 |
+
"Campaign_InvalidSegment" => "Mailchimp_Campaign_InvalidSegment",
|
86 |
+
"Campaign_InvalidRss" => "Mailchimp_Campaign_InvalidRss",
|
87 |
+
"Campaign_InvalidAuto" => "Mailchimp_Campaign_InvalidAuto",
|
88 |
+
"MC_ContentImport_InvalidArchive" => "Mailchimp_MC_ContentImport_InvalidArchive",
|
89 |
+
"Campaign_BounceMissing" => "Mailchimp_Campaign_BounceMissing",
|
90 |
+
"Campaign_InvalidTemplate" => "Mailchimp_Campaign_InvalidTemplate",
|
91 |
+
"Invalid_EcommOrder" => "Mailchimp_Invalid_EcommOrder",
|
92 |
+
"Absplit_UnknownError" => "Mailchimp_Absplit_UnknownError",
|
93 |
+
"Absplit_UnknownSplitTest" => "Mailchimp_Absplit_UnknownSplitTest",
|
94 |
+
"Absplit_UnknownTestType" => "Mailchimp_Absplit_UnknownTestType",
|
95 |
+
"Absplit_UnknownWaitUnit" => "Mailchimp_Absplit_UnknownWaitUnit",
|
96 |
+
"Absplit_UnknownWinnerType" => "Mailchimp_Absplit_UnknownWinnerType",
|
97 |
+
"Absplit_WinnerNotSelected" => "Mailchimp_Absplit_WinnerNotSelected",
|
98 |
+
"Invalid_Analytics" => "Mailchimp_Invalid_Analytics",
|
99 |
+
"Invalid_DateTime" => "Mailchimp_Invalid_DateTime",
|
100 |
+
"Invalid_Email" => "Mailchimp_Invalid_Email",
|
101 |
+
"Invalid_SendType" => "Mailchimp_Invalid_SendType",
|
102 |
+
"Invalid_Template" => "Mailchimp_Invalid_Template",
|
103 |
+
"Invalid_TrackingOptions" => "Mailchimp_Invalid_TrackingOptions",
|
104 |
+
"Invalid_Options" => "Mailchimp_Invalid_Options",
|
105 |
+
"Invalid_Folder" => "Mailchimp_Invalid_Folder",
|
106 |
+
"Invalid_URL" => "Mailchimp_Invalid_URL",
|
107 |
+
"Module_Unknown" => "Mailchimp_Module_Unknown",
|
108 |
+
"MonthlyPlan_Unknown" => "Mailchimp_MonthlyPlan_Unknown",
|
109 |
+
"Order_TypeUnknown" => "Mailchimp_Order_TypeUnknown",
|
110 |
+
"Invalid_PagingLimit" => "Mailchimp_Invalid_PagingLimit",
|
111 |
+
"Invalid_PagingStart" => "Mailchimp_Invalid_PagingStart",
|
112 |
+
"Max_Size_Reached" => "Mailchimp_Max_Size_Reached",
|
113 |
+
"MC_SearchException" => "Mailchimp_MC_SearchException",
|
114 |
+
"Goal_SaveFailed" => "Mailchimp_Goal_SaveFailed",
|
115 |
+
"Conversation_DoesNotExist" => "Mailchimp_Conversation_DoesNotExist",
|
116 |
+
"Conversation_ReplySaveFailed" => "Mailchimp_Conversation_ReplySaveFailed",
|
117 |
+
"File_Not_Found_Exception" => "Mailchimp_File_Not_Found_Exception",
|
118 |
+
"Folder_Not_Found_Exception" => "Mailchimp_Folder_Not_Found_Exception",
|
119 |
+
"Folder_Exists_Exception" => "Mailchimp_Folder_Exists_Exception"
|
120 |
+
);
|
121 |
+
|
122 |
+
public function __construct($apikey=null, $opts=array()) {
|
123 |
+
if (!$apikey) {
|
124 |
+
$apikey = getenv('MAILCHIMP_APIKEY');
|
125 |
+
}
|
126 |
+
|
127 |
+
if (!$apikey) {
|
128 |
+
$apikey = $this->readConfigs();
|
129 |
+
}
|
130 |
+
|
131 |
+
if (!$apikey) {
|
132 |
+
throw new Mailchimp_Error('You must provide a MailChimp API key');
|
133 |
+
}
|
134 |
+
|
135 |
+
$this->apikey = $apikey;
|
136 |
+
$dc = "us1";
|
137 |
+
|
138 |
+
if (strstr($this->apikey, "-")){
|
139 |
+
list($key, $dc) = explode("-", $this->apikey, 2);
|
140 |
+
if (!$dc) {
|
141 |
+
$dc = "us1";
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
$this->root = str_replace('https://api', 'https://' . $dc . '.api', $this->root);
|
146 |
+
$this->root = rtrim($this->root, '/') . '/';
|
147 |
+
|
148 |
+
if (!isset($opts['timeout']) || !is_int($opts['timeout'])){
|
149 |
+
$opts['timeout'] = 600;
|
150 |
+
}
|
151 |
+
if (isset($opts['debug'])){
|
152 |
+
$this->debug = true;
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
$this->ch = curl_init();
|
157 |
+
|
158 |
+
if (isset($opts['CURLOPT_FOLLOWLOCATION']) && $opts['CURLOPT_FOLLOWLOCATION'] === true) {
|
159 |
+
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
|
160 |
+
}
|
161 |
+
|
162 |
+
curl_setopt($this->ch, CURLOPT_USERAGENT, 'MailChimp-PHP/2.0.5');
|
163 |
+
curl_setopt($this->ch, CURLOPT_POST, true);
|
164 |
+
curl_setopt($this->ch, CURLOPT_HEADER, false);
|
165 |
+
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
|
166 |
+
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 30);
|
167 |
+
curl_setopt($this->ch, CURLOPT_TIMEOUT, $opts['timeout']);
|
168 |
+
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
|
169 |
+
|
170 |
+
|
171 |
+
$this->folders = new Mailchimp_Folders($this);
|
172 |
+
$this->templates = new Mailchimp_Templates($this);
|
173 |
+
$this->users = new Mailchimp_Users($this);
|
174 |
+
$this->helper = new Mailchimp_Helper($this);
|
175 |
+
$this->mobile = new Mailchimp_Mobile($this);
|
176 |
+
$this->conversations = new Mailchimp_Conversations($this);
|
177 |
+
$this->ecomm = new Mailchimp_Ecomm($this);
|
178 |
+
$this->neapolitan = new Mailchimp_Neapolitan($this);
|
179 |
+
$this->lists = new Mailchimp_Lists($this);
|
180 |
+
$this->campaigns = new Mailchimp_Campaigns($this);
|
181 |
+
$this->vip = new Mailchimp_Vip($this);
|
182 |
+
$this->reports = new Mailchimp_Reports($this);
|
183 |
+
$this->gallery = new Mailchimp_Gallery($this);
|
184 |
+
$this->goal = new Mailchimp_Goal($this);
|
185 |
+
}
|
186 |
+
|
187 |
+
public function __destruct() {
|
188 |
+
curl_close($this->ch);
|
189 |
+
}
|
190 |
+
|
191 |
+
public function call($url, $params) {
|
192 |
+
$params['apikey'] = $this->apikey;
|
193 |
+
|
194 |
+
$params = json_encode($params);
|
195 |
+
$ch = $this->ch;
|
196 |
+
|
197 |
+
curl_setopt($ch, CURLOPT_URL, $this->root . $url . '.json');
|
198 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
199 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
200 |
+
curl_setopt($ch, CURLOPT_VERBOSE, $this->debug);
|
201 |
+
|
202 |
+
$start = microtime(true);
|
203 |
+
$this->log('Call to ' . $this->root . $url . '.json: ' . $params);
|
204 |
+
if($this->debug) {
|
205 |
+
$curl_buffer = fopen('php://memory', 'w+');
|
206 |
+
curl_setopt($ch, CURLOPT_STDERR, $curl_buffer);
|
207 |
+
}
|
208 |
+
|
209 |
+
$response_body = curl_exec($ch);
|
210 |
+
|
211 |
+
$info = curl_getinfo($ch);
|
212 |
+
$time = microtime(true) - $start;
|
213 |
+
if($this->debug) {
|
214 |
+
rewind($curl_buffer);
|
215 |
+
$this->log(stream_get_contents($curl_buffer));
|
216 |
+
fclose($curl_buffer);
|
217 |
+
}
|
218 |
+
$this->log('Completed in ' . number_format($time * 1000, 2) . 'ms');
|
219 |
+
$this->log('Got response: ' . $response_body);
|
220 |
+
|
221 |
+
if(curl_error($ch)) {
|
222 |
+
throw new Mailchimp_HttpError("API call to $url failed: " . curl_error($ch));
|
223 |
+
}
|
224 |
+
$result = json_decode($response_body, true);
|
225 |
+
|
226 |
+
if(floor($info['http_code'] / 100) >= 4) {
|
227 |
+
throw $this->castError($result);
|
228 |
+
}
|
229 |
+
|
230 |
+
return $result;
|
231 |
+
}
|
232 |
+
|
233 |
+
public function readConfigs() {
|
234 |
+
$paths = array('~/.mailchimp.key', '/etc/mailchimp.key');
|
235 |
+
foreach($paths as $path) {
|
236 |
+
if(file_exists($path)) {
|
237 |
+
$apikey = trim(file_get_contents($path));
|
238 |
+
if ($apikey) {
|
239 |
+
return $apikey;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
return false;
|
244 |
+
}
|
245 |
+
|
246 |
+
public function castError($result) {
|
247 |
+
if ($result['status'] !== 'error' || !$result['name']) {
|
248 |
+
throw new Mailchimp_Error('We received an unexpected error: ' . json_encode($result));
|
249 |
+
}
|
250 |
+
|
251 |
+
$class = (isset(self::$error_map[$result['name']])) ? self::$error_map[$result['name']] : 'Mailchimp_Error';
|
252 |
+
return new $class($result['error'], $result['code']);
|
253 |
+
}
|
254 |
+
|
255 |
+
public function log($msg) {
|
256 |
+
if ($this->debug) {
|
257 |
+
error_log($msg);
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{Mailchimp → classes/Mailchimp}/Campaigns.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Campaigns {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
@@ -10,7 +10,7 @@ class Mailchimp_Campaigns {
|
|
10 |
* @param string $cid
|
11 |
* @param associative_array $options
|
12 |
* - view string optional one of "archive" (default), "preview" (like our popup-preview) or "raw"
|
13 |
-
* - email associative_array optional if provided, view is "archive" or "preview", the campaign's list still exists, and the requested record is subscribed to the list. the returned content will be populated with member data populated. a struct with one of the following keys - failing to provide anything will produce an error relating to the email address.
|
14 |
* - email string an email address
|
15 |
* - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
|
16 |
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
@@ -45,7 +45,7 @@ class Mailchimp_Campaigns {
|
|
45 |
* - analytics associative_array optional - one or more of these keys set to the tag to use - that can be any custom text (up to 50 bytes)
|
46 |
* - google string for Google Analytics tracking
|
47 |
* - clicktale string for ClickTale tracking
|
48 |
-
* - gooal string for
|
49 |
* - auto_footer boolean optional Whether or not we should auto-generate the footer for your content. Mostly useful for content from URLs or Imports
|
50 |
* - inline_css boolean optional Whether or not css should be automatically inlined when this campaign is sent, defaults to false.
|
51 |
* - generate_text boolean optional Whether of not to auto-generate your Text content from the HTML content. Note that this will be ignored if the Text part of the content passed is not empty, defaults to false.
|
@@ -186,9 +186,10 @@ class Mailchimp_Campaigns {
|
|
186 |
* - auto_footer boolean Whether or not the auto_footer was manually turned on
|
187 |
* - timewarp boolean Whether or not the campaign used Timewarp
|
188 |
* - timewarp_schedule string The time, in GMT, that the Timewarp campaign is being sent. For A/B Split campaigns, this is blank and is instead in their schedule_a and schedule_b in the type_opts array
|
189 |
-
* - parent_id string the unique id of the parent campaign (currently only valid for rss children)
|
|
|
190 |
* - tests_sent string tests sent
|
191 |
-
* - tests_remain
|
192 |
* - tracking associative_array the various tracking options used
|
193 |
* - html_clicks boolean whether or not tracking for html clicks was enabled.
|
194 |
* - text_clicks boolean whether or not tracking for text clicks was enabled.
|
@@ -196,9 +197,9 @@ class Mailchimp_Campaigns {
|
|
196 |
* - segment_text string a string marked-up with HTML explaining the segment used for the campaign in plain English
|
197 |
* - segment_opts array the segment used for the campaign - can be passed to campaigns/segment-test or campaigns/create()
|
198 |
* - saved_segment associative_array if a saved segment was used (match+conditions returned above):
|
199 |
-
* - id
|
200 |
-
* - type
|
201 |
-
* - name
|
202 |
* - type_opts associative_array the type-specific options for the campaign - can be passed to campaigns/create()
|
203 |
* - comments_total int total number of comments left on this campaign
|
204 |
* - comments_unread int total number of unread comments for this campaign based on the login the apikey belongs to
|
@@ -207,7 +208,7 @@ class Mailchimp_Campaigns {
|
|
207 |
* - filter string the filter that caused the failure
|
208 |
* - value string the filter value that caused the failure
|
209 |
* - code int the error code
|
210 |
-
* - error
|
211 |
*/
|
212 |
public function getList($filters=array(), $start=0, $limit=25, $sort_field='create_time', $sort_dir='DESC') {
|
213 |
$_params = array("filters" => $filters, "start" => $start, "limit" => $limit, "sort_field" => $sort_field, "sort_dir" => $sort_dir);
|
@@ -289,7 +290,7 @@ class Mailchimp_Campaigns {
|
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
-
* Allows one to test their segmentation rules before creating a campaign using them
|
293 |
* @param string $list_id
|
294 |
* @param associative_array $options
|
295 |
* - saved_segment_id string a saved segment id from lists/segments() - this will take precendence, otherwise the match+conditions are required.
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Campaigns {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
10 |
* @param string $cid
|
11 |
* @param associative_array $options
|
12 |
* - view string optional one of "archive" (default), "preview" (like our popup-preview) or "raw"
|
13 |
+
* - email associative_array optional if provided, view is "archive" or "preview", the campaign's list still exists, and the requested record is subscribed to the list. the returned content will be populated with member data populated. a struct with one of the following keys - failing to provide anything will produce an error relating to the email address. If multiple keys are provided, the first one from the following list that we find will be used, the rest will be ignored.
|
14 |
* - email string an email address
|
15 |
* - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
|
16 |
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
45 |
* - analytics associative_array optional - one or more of these keys set to the tag to use - that can be any custom text (up to 50 bytes)
|
46 |
* - google string for Google Analytics tracking
|
47 |
* - clicktale string for ClickTale tracking
|
48 |
+
* - gooal string for Goal tracking (the extra 'o' in the param name is not a typo)
|
49 |
* - auto_footer boolean optional Whether or not we should auto-generate the footer for your content. Mostly useful for content from URLs or Imports
|
50 |
* - inline_css boolean optional Whether or not css should be automatically inlined when this campaign is sent, defaults to false.
|
51 |
* - generate_text boolean optional Whether of not to auto-generate your Text content from the HTML content. Note that this will be ignored if the Text part of the content passed is not empty, defaults to false.
|
186 |
* - auto_footer boolean Whether or not the auto_footer was manually turned on
|
187 |
* - timewarp boolean Whether or not the campaign used Timewarp
|
188 |
* - timewarp_schedule string The time, in GMT, that the Timewarp campaign is being sent. For A/B Split campaigns, this is blank and is instead in their schedule_a and schedule_b in the type_opts array
|
189 |
+
* - parent_id string the unique id of the parent campaign (currently only valid for rss children). Will be blank for non-rss child campaigns or parent campaign has been deleted.
|
190 |
+
* - is_child boolean true if this is an RSS child campaign. Will return true even if the parent campaign has been deleted.
|
191 |
* - tests_sent string tests sent
|
192 |
+
* - tests_remain int test sends remaining
|
193 |
* - tracking associative_array the various tracking options used
|
194 |
* - html_clicks boolean whether or not tracking for html clicks was enabled.
|
195 |
* - text_clicks boolean whether or not tracking for text clicks was enabled.
|
197 |
* - segment_text string a string marked-up with HTML explaining the segment used for the campaign in plain English
|
198 |
* - segment_opts array the segment used for the campaign - can be passed to campaigns/segment-test or campaigns/create()
|
199 |
* - saved_segment associative_array if a saved segment was used (match+conditions returned above):
|
200 |
+
* - id int the saved segment id
|
201 |
+
* - type string the saved segment type
|
202 |
+
* - name string the saved segment name
|
203 |
* - type_opts associative_array the type-specific options for the campaign - can be passed to campaigns/create()
|
204 |
* - comments_total int total number of comments left on this campaign
|
205 |
* - comments_unread int total number of unread comments for this campaign based on the login the apikey belongs to
|
208 |
* - filter string the filter that caused the failure
|
209 |
* - value string the filter value that caused the failure
|
210 |
* - code int the error code
|
211 |
+
* - error string the error message
|
212 |
*/
|
213 |
public function getList($filters=array(), $start=0, $limit=25, $sort_field='create_time', $sort_dir='DESC') {
|
214 |
$_params = array("filters" => $filters, "start" => $start, "limit" => $limit, "sort_field" => $sort_field, "sort_dir" => $sort_dir);
|
290 |
}
|
291 |
|
292 |
/**
|
293 |
+
* Allows one to test their segmentation rules before creating a campaign using them.
|
294 |
* @param string $list_id
|
295 |
* @param associative_array $options
|
296 |
* - saved_segment_id string a saved segment id from lists/segments() - this will take precendence, otherwise the match+conditions are required.
|
classes/Mailchimp/Conversations.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailchimp_Conversations {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
+
$this->master = $master;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Retrieve conversation metadata, includes message data for the most recent message in the conversation
|
10 |
+
* @param string $list_id
|
11 |
+
* @param string $leid
|
12 |
+
* @param string $campaign_id
|
13 |
+
* @param int $start
|
14 |
+
* @param int $limit
|
15 |
+
* @return associative_array Conversation data and metadata
|
16 |
+
* - count int Total number of conversations, irrespective of pagination.
|
17 |
+
* - data array An array of structs representing individual conversations
|
18 |
+
* - unique_id string A string identifying this particular conversation
|
19 |
+
* - message_count int The total number of messages in this conversation
|
20 |
+
* - campaign_id string The unique identifier of the campaign this conversation is associated with
|
21 |
+
* - list_id string The unique identifier of the list this conversation is associated with
|
22 |
+
* - unread_messages int The number of messages in this conversation which have not yet been read.
|
23 |
+
* - from_label string A label representing the sender of this message.
|
24 |
+
* - from_email string The email address of the sender of this message.
|
25 |
+
* - subject string The subject of the message.
|
26 |
+
* - timestamp string Date the message was either sent or received.
|
27 |
+
* - last_message associative_array The most recent message in the conversation
|
28 |
+
* - from_label string A label representing the sender of this message.
|
29 |
+
* - from_email string The email address of the sender of this message.
|
30 |
+
* - subject string The subject of the message.
|
31 |
+
* - message string The plain-text content of the message.
|
32 |
+
* - read boolean Whether or not this message has been marked as read.
|
33 |
+
* - timestamp string Date the message was either sent or received.
|
34 |
+
*/
|
35 |
+
public function getList($list_id=null, $leid=null, $campaign_id=null, $start=0, $limit=25) {
|
36 |
+
$_params = array("list_id" => $list_id, "leid" => $leid, "campaign_id" => $campaign_id, "start" => $start, "limit" => $limit);
|
37 |
+
return $this->master->call('conversations/list', $_params);
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Retrieve conversation messages
|
42 |
+
* @param string $conversation_id
|
43 |
+
* @param boolean $mark_as_read
|
44 |
+
* @param int $start
|
45 |
+
* @param int $limit
|
46 |
+
* @return associative_array Message data and metadata
|
47 |
+
* - count int The number of messages in this conversation, irrespective of paging.
|
48 |
+
* - data array An array of structs representing each message in a conversation
|
49 |
+
* - from_label string A label representing the sender of this message.
|
50 |
+
* - from_email string The email address of the sender of this message.
|
51 |
+
* - subject string The subject of the message.
|
52 |
+
* - message string The plain-text content of the message.
|
53 |
+
* - read boolean Whether or not this message has been marked as read.
|
54 |
+
* - timestamp string Date the message was either sent or received.
|
55 |
+
*/
|
56 |
+
public function messages($conversation_id, $mark_as_read=false, $start=0, $limit=25) {
|
57 |
+
$_params = array("conversation_id" => $conversation_id, "mark_as_read" => $mark_as_read, "start" => $start, "limit" => $limit);
|
58 |
+
return $this->master->call('conversations/messages', $_params);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieve conversation messages
|
63 |
+
* @param string $conversation_id
|
64 |
+
* @param string $message
|
65 |
+
* @return associative_array Message data from the created message
|
66 |
+
* - from_label string A label representing the sender of this message.
|
67 |
+
* - from_email string The email address of the sender of this message.
|
68 |
+
* - subject string The subject of the message.
|
69 |
+
* - message string The plain-text content of the message.
|
70 |
+
* - read boolean Whether or not this message has been marked as read.
|
71 |
+
* - timestamp string Date the message was either sent or received.
|
72 |
+
*/
|
73 |
+
public function reply($conversation_id, $message) {
|
74 |
+
$_params = array("conversation_id" => $conversation_id, "message" => $message);
|
75 |
+
return $this->master->call('conversations/reply', $_params);
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
|
{Mailchimp → classes/Mailchimp}/Ecomm.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Ecomm {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
@@ -24,8 +24,8 @@ class Mailchimp_Ecomm {
|
|
24 |
* - product_id int the store's internal Id for the product. Lines that do no contain this will be skipped
|
25 |
* - sku string optional the store's internal SKU for the product. (max 30 bytes)
|
26 |
* - product_name string the product name for the product_id associated with this item. We will auto update these as they change (based on product_id)
|
27 |
-
* - category_id int the store's internal Id for the (main) category associated with this product. Our testing has found this to be a "best guess" scenario
|
28 |
-
* - category_name string the category name for the category_id this product is in. Our testing has found this to be a "best guess" scenario. Our plugins walk the category heirarchy up and send "Root - SubCat1 - SubCat4", etc.
|
29 |
* - qty double optional the quantity of the item ordered - defaults to 1
|
30 |
* - cost double optional the cost of a single item (ie, not the extended cost of the line) - defaults to 0
|
31 |
* @return associative_array with a single entry:
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Ecomm {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
24 |
* - product_id int the store's internal Id for the product. Lines that do no contain this will be skipped
|
25 |
* - sku string optional the store's internal SKU for the product. (max 30 bytes)
|
26 |
* - product_name string the product name for the product_id associated with this item. We will auto update these as they change (based on product_id)
|
27 |
+
* - category_id int (required) the store's internal Id for the (main) category associated with this product. Our testing has found this to be a "best guess" scenario
|
28 |
+
* - category_name string (required) the category name for the category_id this product is in. Our testing has found this to be a "best guess" scenario. Our plugins walk the category heirarchy up and send "Root - SubCat1 - SubCat4", etc.
|
29 |
* - qty double optional the quantity of the item ordered - defaults to 1
|
30 |
* - cost double optional the cost of a single item (ie, not the extended cost of the line) - defaults to 0
|
31 |
* @return associative_array with a single entry:
|
{Mailchimp → classes/Mailchimp}/Exceptions.php
RENAMED
@@ -438,4 +438,34 @@ class Mailchimp_Max_Size_Reached extends Mailchimp_Error {}
|
|
438 |
*/
|
439 |
class Mailchimp_MC_SearchException extends Mailchimp_Error {}
|
440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
|
438 |
*/
|
439 |
class Mailchimp_MC_SearchException extends Mailchimp_Error {}
|
440 |
|
441 |
+
/**
|
442 |
+
* None
|
443 |
+
*/
|
444 |
+
class Mailchimp_Goal_SaveFailed extends Mailchimp_Error {}
|
445 |
+
|
446 |
+
/**
|
447 |
+
* None
|
448 |
+
*/
|
449 |
+
class Mailchimp_Conversation_DoesNotExist extends Mailchimp_Error {}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* None
|
453 |
+
*/
|
454 |
+
class Mailchimp_Conversation_ReplySaveFailed extends Mailchimp_Error {}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* None
|
458 |
+
*/
|
459 |
+
class Mailchimp_File_Not_Found_Exception extends Mailchimp_Error {}
|
460 |
+
|
461 |
+
/**
|
462 |
+
* None
|
463 |
+
*/
|
464 |
+
class Mailchimp_Folder_Not_Found_Exception extends Mailchimp_Error {}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* None
|
468 |
+
*/
|
469 |
+
class Mailchimp_Folder_Exists_Exception extends Mailchimp_Error {}
|
470 |
+
|
471 |
|
{Mailchimp → classes/Mailchimp}/Folders.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Folders {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Folders {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
classes/Mailchimp/Gallery.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailchimp_Gallery {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
+
$this->master = $master;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Return a section of the image gallery
|
10 |
+
* @param associative_array $opts
|
11 |
+
* - type string optional the gallery type to return - images or files - default to images
|
12 |
+
* - start int optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
13 |
+
* - limit int optional for large data sets, the number of results to return - defaults to 25, upper limit set at 100
|
14 |
+
* - sort_by string optional field to sort by - one of size, time, name - defaults to time
|
15 |
+
* - sort_dir string optional field to sort by - one of asc, desc - defaults to desc
|
16 |
+
* - search_term string optional a term to search for in names
|
17 |
+
* - folder_id int optional to return files that are in a specific folder. id returned by the list-folders call
|
18 |
+
* @return associative_array the matching gallery items
|
19 |
+
* - total int the total matching items
|
20 |
+
* - data array structs for each item included in the set, including:
|
21 |
+
* - id int the id of the file
|
22 |
+
* - name string the file name
|
23 |
+
* - time string the creation date for the item
|
24 |
+
* - size int the file size in bytes
|
25 |
+
* - full string the url to the actual item in the gallery
|
26 |
+
* - thumb string a url for a thumbnail that can be used to represent the item, generally an image thumbnail or an icon for a file type
|
27 |
+
*/
|
28 |
+
public function getList($opts=array()) {
|
29 |
+
$_params = array("opts" => $opts);
|
30 |
+
return $this->master->call('gallery/list', $_params);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Return a list of the folders available to the file gallery
|
35 |
+
* @param associative_array $opts
|
36 |
+
* - start int optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)
|
37 |
+
* - limit int optional for large data sets, the number of results to return - defaults to 25, upper limit set at 100
|
38 |
+
* - search_term string optional a term to search for in names
|
39 |
+
* @return associative_array the matching gallery folders
|
40 |
+
* - total int the total matching folders
|
41 |
+
* - data array structs for each folder included in the set, including:
|
42 |
+
* - id int the id of the folder
|
43 |
+
* - name string the file name
|
44 |
+
* - file_count int the number of files in the folder
|
45 |
+
*/
|
46 |
+
public function listFolders($opts=array()) {
|
47 |
+
$_params = array("opts" => $opts);
|
48 |
+
return $this->master->call('gallery/list-folders', $_params);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Adds a folder to the file gallery
|
53 |
+
* @param string $name
|
54 |
+
* @return associative_array the new data for the created folder
|
55 |
+
* - data.id int the id of the new folder
|
56 |
+
*/
|
57 |
+
public function addFolder($name) {
|
58 |
+
$_params = array("name" => $name);
|
59 |
+
return $this->master->call('gallery/add-folder', $_params);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Remove a folder
|
64 |
+
* @param int $folder_id
|
65 |
+
* @return boolean true/false for success/failure
|
66 |
+
*/
|
67 |
+
public function removeFolder($folder_id) {
|
68 |
+
$_params = array("folder_id" => $folder_id);
|
69 |
+
return $this->master->call('gallery/remove-folder', $_params);
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Add a file to a folder
|
74 |
+
* @param int $file_id
|
75 |
+
* @param int $folder_id
|
76 |
+
* @return boolean true/false for success/failure
|
77 |
+
*/
|
78 |
+
public function addFileToFolder($file_id, $folder_id) {
|
79 |
+
$_params = array("file_id" => $file_id, "folder_id" => $folder_id);
|
80 |
+
return $this->master->call('gallery/add-file-to-folder', $_params);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Remove a file from a folder
|
85 |
+
* @param int $file_id
|
86 |
+
* @param int $folder_id
|
87 |
+
* @return boolean true/false for success/failure
|
88 |
+
*/
|
89 |
+
public function removeFileFromFolder($file_id, $folder_id) {
|
90 |
+
$_params = array("file_id" => $file_id, "folder_id" => $folder_id);
|
91 |
+
return $this->master->call('gallery/remove-file-from-folder', $_params);
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Remove all files from a folder (Note that the files are not deleted, they are only removed from the folder)
|
96 |
+
* @param int $folder_id
|
97 |
+
* @return boolean true/false for success/failure
|
98 |
+
*/
|
99 |
+
public function removeAllFilesFromFolder($folder_id) {
|
100 |
+
$_params = array("folder_id" => $folder_id);
|
101 |
+
return $this->master->call('gallery/remove-all-files-from-folder', $_params);
|
102 |
+
}
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
|
classes/Mailchimp/Goal.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailchimp_Goal {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
+
$this->master = $master;
|
6 |
+
}
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Retrieve goal event data for a particular list member. Note: only unique events are returned. If a user triggers
|
10 |
+
a particular event multiple times, you will still only receive one entry for that event.
|
11 |
+
* @param string $list_id
|
12 |
+
* @param associative_array $email
|
13 |
+
* - email string an email address
|
14 |
+
* - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
|
15 |
+
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
16 |
+
* @param int $start
|
17 |
+
* @param int $limit
|
18 |
+
* @return associative_array Event data and metadata
|
19 |
+
* - data array An array of goal data structs for the specified list member in the following format
|
20 |
+
* - event string The URL or name of the event that was triggered
|
21 |
+
* - last_visited_at string A timestamp in the format 'YYYY-MM-DD HH:MM:SS' that represents the last time this event was seen.
|
22 |
+
* - total int The total number of events that match your criteria.
|
23 |
+
*/
|
24 |
+
public function events($list_id, $email, $start=0, $limit=25) {
|
25 |
+
$_params = array("list_id" => $list_id, "email" => $email, "start" => $start, "limit" => $limit);
|
26 |
+
return $this->master->call('goal/events', $_params);
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* This allows programmatically trigger goal event collection without the use of front-end code.
|
31 |
+
* @param string $list_id
|
32 |
+
* @param associative_array $email
|
33 |
+
* - email string an email address
|
34 |
+
* - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
|
35 |
+
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
36 |
+
* @param string $campaign_id
|
37 |
+
* @param string $event
|
38 |
+
* @return associative_array Event data for the submitted event
|
39 |
+
* - event string The URL or name of the event that was triggered
|
40 |
+
* - last_visited_at string A timestamp in the format 'YYYY-MM-DD HH:MM:SS' that represents the last time this event was seen.
|
41 |
+
*/
|
42 |
+
public function recordEvent($list_id, $email, $campaign_id, $event) {
|
43 |
+
$_params = array("list_id" => $list_id, "email" => $email, "campaign_id" => $campaign_id, "event" => $event);
|
44 |
+
return $this->master->call('goal/record-event', $_params);
|
45 |
+
}
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
|
{Mailchimp → classes/Mailchimp}/Helper.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Helper {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
@@ -10,7 +10,7 @@ class Mailchimp_Helper {
|
|
10 |
contact info, and more. No private information like Credit Card numbers is available.
|
11 |
* @param array $exclude
|
12 |
* @return associative_array containing the details for the account tied to this API Key
|
13 |
-
* - username string The
|
14 |
* - user_id string The Account user unique id (for building some links)
|
15 |
* - is_trial bool Whether the Account is in Trial mode (can only send campaigns to less than 100 emails)
|
16 |
* - is_approved bool Whether the Account has been approved for purchases
|
@@ -165,8 +165,8 @@ It's also not just Lynx and is very fine tuned for our template layouts - your m
|
|
165 |
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
166 |
* @return array An array of structs with info on the list_id the member is subscribed to.
|
167 |
* - id string the list unique id
|
168 |
-
* - the
|
169 |
-
* - the
|
170 |
*/
|
171 |
public function listsForEmail($email) {
|
172 |
$_params = array("email" => $email);
|
@@ -196,7 +196,6 @@ string back that will explain our view on what is going on.
|
|
196 |
* - results array matching campaigns and snippets
|
197 |
* - snippet string the matching snippet for the campaign
|
198 |
* - campaign associative_array the matching campaign's details - will return same data as single campaign from campaigns/list()
|
199 |
-
* - summary associative_array if available, the matching campaign's report/summary data, other wise empty
|
200 |
*/
|
201 |
public function searchCampaigns($query, $offset=0, $snip_start=null, $snip_end=null) {
|
202 |
$_params = array("query" => $query, "offset" => $offset, "snip_start" => $snip_start, "snip_end" => $snip_end);
|
@@ -209,12 +208,12 @@ string back that will explain our view on what is going on.
|
|
209 |
* @param string $id
|
210 |
* @param int $offset
|
211 |
* @return associative_array An array of both exact matches and partial matches over a full search
|
212 |
-
* - exact_matches associative_array containing the
|
213 |
-
*
|
214 |
-
*
|
215 |
* - full_search associative_array containing the total matches and current results
|
216 |
-
*
|
217 |
-
*
|
218 |
*/
|
219 |
public function searchMembers($query, $id=null, $offset=0) {
|
220 |
$_params = array("query" => $query, "id" => $id, "offset" => $offset);
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Helper {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
10 |
contact info, and more. No private information like Credit Card numbers is available.
|
11 |
* @param array $exclude
|
12 |
* @return associative_array containing the details for the account tied to this API Key
|
13 |
+
* - username string The company name associated with the account
|
14 |
* - user_id string The Account user unique id (for building some links)
|
15 |
* - is_trial bool Whether the Account is in Trial mode (can only send campaigns to less than 100 emails)
|
16 |
* - is_approved bool Whether the Account has been approved for purchases
|
165 |
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
166 |
* @return array An array of structs with info on the list_id the member is subscribed to.
|
167 |
* - id string the list unique id
|
168 |
+
* - web_id int the id referenced in web interface urls
|
169 |
+
* - name string the list name
|
170 |
*/
|
171 |
public function listsForEmail($email) {
|
172 |
$_params = array("email" => $email);
|
196 |
* - results array matching campaigns and snippets
|
197 |
* - snippet string the matching snippet for the campaign
|
198 |
* - campaign associative_array the matching campaign's details - will return same data as single campaign from campaigns/list()
|
|
|
199 |
*/
|
200 |
public function searchCampaigns($query, $offset=0, $snip_start=null, $snip_end=null) {
|
201 |
$_params = array("query" => $query, "offset" => $offset, "snip_start" => $snip_start, "snip_end" => $snip_end);
|
208 |
* @param string $id
|
209 |
* @param int $offset
|
210 |
* @return associative_array An array of both exact matches and partial matches over a full search
|
211 |
+
* - exact_matches associative_array containing the exact email address matches and current results
|
212 |
+
* - total int total members matching
|
213 |
+
* - members array each entry will be struct matching the data format for a single member as returned by lists/member-info()
|
214 |
* - full_search associative_array containing the total matches and current results
|
215 |
+
* - total int total members matching
|
216 |
+
* - members array each entry will be struct matching the data format for a single member as returned by lists/member-info()
|
217 |
*/
|
218 |
public function searchMembers($query, $id=null, $offset=0) {
|
219 |
$_params = array("query" => $query, "id" => $id, "offset" => $offset);
|
{Mailchimp → classes/Mailchimp}/Lists.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Lists {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
@@ -88,7 +88,6 @@ though you should cap them at 5k - 10k records, depending on your experience. Th
|
|
88 |
* @return array Array of structs containing results and any errors that occurred
|
89 |
* - success_count int Number of email addresses that were successfully removed
|
90 |
* - error_count int Number of email addresses that failed during addition/updating
|
91 |
-
* - of array structs contain error details including:
|
92 |
* - errors array array of error structs including:
|
93 |
* - email string whatever was passed in the batch record's email parameter
|
94 |
* - email string the email address added
|
@@ -516,7 +515,17 @@ unless you're fixing data since you should probably be using default_values and/
|
|
516 |
* @param string $id
|
517 |
* @param string $type
|
518 |
* @return associative_array with 2 keys:
|
519 |
-
* - static
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
* - created_date string the date+time the segment was created
|
521 |
* - last_update string the date+time the segment was last updated (add or del)
|
522 |
*/
|
@@ -563,9 +572,6 @@ used.
|
|
563 |
For the time being, the crazy segmenting condition documentation will continue to live over there.
|
564 |
* @param string $list_id
|
565 |
* @param associative_array $options
|
566 |
-
* - saved_segment_id string a saved segment id from lists/segments() - this will take precendence, otherwise the match+conditions are required.
|
567 |
-
* - match string controls whether to use AND or OR when applying your options - expects "<strong>any</strong>" (for OR) or "<strong>all</strong>" (for AND)
|
568 |
-
* - conditions array of up to 5 structs for different criteria to apply while segmenting. Each criteria row must contain 3 keys - "<strong>field</strong>", "<strong>op</strong>", and "<strong>value</strong>" - and possibly a fourth, "<strong>extra</strong>", based on these definitions:
|
569 |
* @return associative_array with a single entry:
|
570 |
* - total int The total number of subscribers matching your segmentation options
|
571 |
*/
|
@@ -581,7 +587,7 @@ For the time being, the crazy segmenting condition documentation will continue t
|
|
581 |
* @param associative_array $opts
|
582 |
* - name string a unique name per list for the segment - 100 byte maximum length, anything longer will throw an error
|
583 |
* - segment_opts associative_array for "saved" only, the standard segment match+conditions, just like campaigns/segment-test
|
584 |
-
* - match
|
585 |
* - conditions array structs for each condition, just like campaigns/segment-test
|
586 |
* @return associative_array with a single entry:
|
587 |
* - complete bool whether the call worked. reallistically this will always be true as errors will be thrown otherwise.
|
@@ -682,6 +688,9 @@ in order to be removed - this <strong>will not</strong> unsubscribe them from th
|
|
682 |
/**
|
683 |
* Retrieve all of the Static Segments for a list.
|
684 |
* @param string $id
|
|
|
|
|
|
|
685 |
* @return array an of structs with data for each static segment
|
686 |
* - id int the id of the segment
|
687 |
* - name string the name for the segment
|
@@ -690,8 +699,8 @@ in order to be removed - this <strong>will not</strong> unsubscribe them from th
|
|
690 |
* - last_update string the date+time the segment was last updated (add or del)
|
691 |
* - last_reset string the date+time the segment was last reset (ie had all members cleared from it)
|
692 |
*/
|
693 |
-
public function staticSegments($id) {
|
694 |
-
$_params = array("id" => $id);
|
695 |
return $this->master->call('lists/static-segments', $_params);
|
696 |
}
|
697 |
|
@@ -703,7 +712,7 @@ in order to be removed - this <strong>will not</strong> unsubscribe them from th
|
|
703 |
* - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
|
704 |
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
705 |
* @param associative_array $merge_vars
|
706 |
-
* - new-email string set this to change the email address. This is only respected on calls using update_existing or when passed to
|
707 |
* - groupings array of Interest Grouping structs. Each should contain:
|
708 |
* - id int Grouping "id" from lists/interest-groupings (either this or name must be present) - this id takes precedence and can't change (unlike the name)
|
709 |
* - name string Grouping "name" from lists/interest-groupings (either this or id must be present)
|
@@ -883,7 +892,7 @@ consider using lists/batch-subscribe() with the update_existing and possible rep
|
|
883 |
* - errors array structs of any errors found while loading lists - usually just from providing invalid list ids
|
884 |
* - param string the data that caused the failure
|
885 |
* - code int the error code
|
886 |
-
* - error
|
887 |
*/
|
888 |
public function getList($filters=array(), $start=0, $limit=25, $sort_field='created', $sort_dir='DESC') {
|
889 |
$_params = array("filters" => $filters, "start" => $start, "limit" => $limit, "sort_field" => $sort_field, "sort_dir" => $sort_dir);
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Lists {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
88 |
* @return array Array of structs containing results and any errors that occurred
|
89 |
* - success_count int Number of email addresses that were successfully removed
|
90 |
* - error_count int Number of email addresses that failed during addition/updating
|
|
|
91 |
* - errors array array of error structs including:
|
92 |
* - email string whatever was passed in the batch record's email parameter
|
93 |
* - email string the email address added
|
515 |
* @param string $id
|
516 |
* @param string $type
|
517 |
* @return associative_array with 2 keys:
|
518 |
+
* - static array of structs with data for each segment
|
519 |
+
* - id int the id of the segment
|
520 |
+
* - name string the name for the segment
|
521 |
+
* - created_date string the date+time the segment was created
|
522 |
+
* - last_update string the date+time the segment was last updated (add or del)
|
523 |
+
* - last_reset string the date+time the segment was last reset (ie had all members cleared from it)
|
524 |
+
* - saved array of structs with data for each segment
|
525 |
+
* - id int the id of the segment
|
526 |
+
* - name string the name for the segment
|
527 |
+
* - segment_opts string same match+conditions struct typically used
|
528 |
+
* - segment_text string a textual description of the segment match/conditions
|
529 |
* - created_date string the date+time the segment was created
|
530 |
* - last_update string the date+time the segment was last updated (add or del)
|
531 |
*/
|
572 |
For the time being, the crazy segmenting condition documentation will continue to live over there.
|
573 |
* @param string $list_id
|
574 |
* @param associative_array $options
|
|
|
|
|
|
|
575 |
* @return associative_array with a single entry:
|
576 |
* - total int The total number of subscribers matching your segmentation options
|
577 |
*/
|
587 |
* @param associative_array $opts
|
588 |
* - name string a unique name per list for the segment - 100 byte maximum length, anything longer will throw an error
|
589 |
* - segment_opts associative_array for "saved" only, the standard segment match+conditions, just like campaigns/segment-test
|
590 |
+
* - match string "any" or "all"
|
591 |
* - conditions array structs for each condition, just like campaigns/segment-test
|
592 |
* @return associative_array with a single entry:
|
593 |
* - complete bool whether the call worked. reallistically this will always be true as errors will be thrown otherwise.
|
688 |
/**
|
689 |
* Retrieve all of the Static Segments for a list.
|
690 |
* @param string $id
|
691 |
+
* @param boolean $get_counts
|
692 |
+
* @param int $start
|
693 |
+
* @param int $limit
|
694 |
* @return array an of structs with data for each static segment
|
695 |
* - id int the id of the segment
|
696 |
* - name string the name for the segment
|
699 |
* - last_update string the date+time the segment was last updated (add or del)
|
700 |
* - last_reset string the date+time the segment was last reset (ie had all members cleared from it)
|
701 |
*/
|
702 |
+
public function staticSegments($id, $get_counts=true, $start=0, $limit=null) {
|
703 |
+
$_params = array("id" => $id, "get_counts" => $get_counts, "start" => $start, "limit" => $limit);
|
704 |
return $this->master->call('lists/static-segments', $_params);
|
705 |
}
|
706 |
|
712 |
* - euid string the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
|
713 |
* - leid string the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes
|
714 |
* @param associative_array $merge_vars
|
715 |
+
* - new-email string set this to change the email address. This is only respected on calls using update_existing or when passed to lists/update.
|
716 |
* - groupings array of Interest Grouping structs. Each should contain:
|
717 |
* - id int Grouping "id" from lists/interest-groupings (either this or name must be present) - this id takes precedence and can't change (unlike the name)
|
718 |
* - name string Grouping "name" from lists/interest-groupings (either this or id must be present)
|
892 |
* - errors array structs of any errors found while loading lists - usually just from providing invalid list ids
|
893 |
* - param string the data that caused the failure
|
894 |
* - code int the error code
|
895 |
+
* - error string the error message
|
896 |
*/
|
897 |
public function getList($filters=array(), $start=0, $limit=25, $sort_field='created', $sort_dir='DESC') {
|
898 |
$_params = array("filters" => $filters, "start" => $start, "limit" => $limit, "sort_field" => $sort_field, "sort_dir" => $sort_dir);
|
{Mailchimp → classes/Mailchimp}/Mobile.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Mobile {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Mobile {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
{Mailchimp → classes/Mailchimp}/Neapolitan.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Neapolitan {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Neapolitan {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
{Mailchimp → classes/Mailchimp}/Reports.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Reports {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
@@ -137,23 +137,23 @@ messages over 30 days old are subject to being removed
|
|
137 |
* @return associative_array the total matching orders and the specific orders for the requested page
|
138 |
* - total int the total matching orders
|
139 |
* - data array structs for the actual data for each order being returned
|
140 |
-
*
|
141 |
-
*
|
142 |
-
*
|
143 |
-
*
|
144 |
-
*
|
145 |
-
*
|
146 |
-
*
|
147 |
-
*
|
148 |
-
*
|
149 |
-
*
|
150 |
-
*
|
151 |
-
*
|
152 |
-
*
|
153 |
-
*
|
154 |
-
*
|
155 |
-
*
|
156 |
-
*
|
157 |
*/
|
158 |
public function ecommOrders($cid, $opts=array()) {
|
159 |
$_params = array("cid" => $cid, "opts" => $opts);
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Reports {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
137 |
* @return associative_array the total matching orders and the specific orders for the requested page
|
138 |
* - total int the total matching orders
|
139 |
* - data array structs for the actual data for each order being returned
|
140 |
+
* - store_id string the store id generated by the plugin used to uniquely identify a store
|
141 |
+
* - store_name string the store name collected by the plugin - often the domain name
|
142 |
+
* - order_id string the internal order id the store tracked this order by
|
143 |
+
* - member associative_array the member record as returned by lists/member-info() that received this campaign and is associated with this order
|
144 |
+
* - order_total double the order total
|
145 |
+
* - tax_total double the total tax for the order (if collected)
|
146 |
+
* - ship_total double the shipping total for the order (if collected)
|
147 |
+
* - order_date string the date the order was tracked - from the store if possible, otherwise the GMT time we received it
|
148 |
+
* - lines array structs containing details of the order:
|
149 |
+
* - line_num int the line number assigned to this line
|
150 |
+
* - product_id int the product id assigned to this item
|
151 |
+
* - product_name string the product name
|
152 |
+
* - product_sku string the sku for the product
|
153 |
+
* - product_category_id int the id for the product category
|
154 |
+
* - product_category_name string the product category name
|
155 |
+
* - qty double optional the quantity of the item ordered - defaults to 1
|
156 |
+
* - cost double optional the cost of a single item (ie, not the extended cost of the line) - defaults to 0
|
157 |
*/
|
158 |
public function ecommOrders($cid, $opts=array()) {
|
159 |
$_params = array("cid" => $cid, "opts" => $opts);
|
{Mailchimp → classes/Mailchimp}/Templates.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Templates {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
@@ -49,12 +49,13 @@ class Mailchimp_Templates {
|
|
49 |
* @param associative_array $types
|
50 |
* - user boolean Custom templates for this user account. Defaults to true.
|
51 |
* - gallery boolean Templates from our Gallery. Note that some templates that require extra configuration are withheld. (eg, the Etsy template). Defaults to false.
|
52 |
-
* - base boolean Our "start from scratch" extremely basic templates. Defaults to false.
|
53 |
* @param associative_array $filters
|
54 |
* - category string optional for Gallery templates only, limit to a specific template category
|
55 |
* - folder_id string user templates, limit to this folder_id
|
56 |
* - include_inactive boolean user templates are not deleted, only set inactive. defaults to false.
|
57 |
* - inactive_only boolean only include inactive user templates. defaults to false.
|
|
|
58 |
* @return associative_array for each type
|
59 |
* - user array matching user templates, if requested.
|
60 |
* - id int Id of the template
|
@@ -75,15 +76,7 @@ class Mailchimp_Templates {
|
|
75 |
* - date_created string The date/time the template was created
|
76 |
* - active boolean whether or not the template is active and available for use.
|
77 |
* - edit_source boolean Whether or not you are able to edit the source of a template.
|
78 |
-
* - base array matching base templates, if requested.
|
79 |
-
* - id int Id of the template
|
80 |
-
* - name string Name of the template
|
81 |
-
* - layout string General description of the layout of the template
|
82 |
-
* - category string The category for the template, if there is one.
|
83 |
-
* - preview_image string If we've generated it, the url of the preview image for the template. We do out best to keep these up to date, but Preview image urls are not guaranteed to be available
|
84 |
-
* - active boolean whether or not the template is active and available for use.
|
85 |
-
* - date_created string The date/time the template was created
|
86 |
-
* - edit_source boolean Whether or not you are able to edit the source of a template.
|
87 |
*/
|
88 |
public function getList($types=array(), $filters=array()) {
|
89 |
$_params = array("types" => $types, "filters" => $filters);
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Templates {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
49 |
* @param associative_array $types
|
50 |
* - user boolean Custom templates for this user account. Defaults to true.
|
51 |
* - gallery boolean Templates from our Gallery. Note that some templates that require extra configuration are withheld. (eg, the Etsy template). Defaults to false.
|
52 |
+
* - base boolean Our "start from scratch" extremely basic templates. Defaults to false. As of the 9.0 update, "base" templates are no longer available via the API because they are now all saved Drag & Drop templates.
|
53 |
* @param associative_array $filters
|
54 |
* - category string optional for Gallery templates only, limit to a specific template category
|
55 |
* - folder_id string user templates, limit to this folder_id
|
56 |
* - include_inactive boolean user templates are not deleted, only set inactive. defaults to false.
|
57 |
* - inactive_only boolean only include inactive user templates. defaults to false.
|
58 |
+
* - include_drag_and_drop boolean Include templates created and saved using the new Drag & Drop editor. <strong>Note:</strong> You will not be able to edit or create new drag & drop templates via this API. This is useful only for creating a new campaign based on a drag & drop template.
|
59 |
* @return associative_array for each type
|
60 |
* - user array matching user templates, if requested.
|
61 |
* - id int Id of the template
|
76 |
* - date_created string The date/time the template was created
|
77 |
* - active boolean whether or not the template is active and available for use.
|
78 |
* - edit_source boolean Whether or not you are able to edit the source of a template.
|
79 |
+
* - base array matching base templates, if requested. (Will always be empty as of 9.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
*/
|
81 |
public function getList($types=array(), $filters=array()) {
|
82 |
$_params = array("types" => $types, "filters" => $filters);
|
{Mailchimp → classes/Mailchimp}/Users.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Users {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
@@ -74,6 +74,8 @@ class Mailchimp_Users {
|
|
74 |
* - email string the email tied to the account used for passwords resets and the ilk
|
75 |
* - role string the role assigned to the account
|
76 |
* - avatar string if available, the url for the login's avatar
|
|
|
|
|
77 |
*/
|
78 |
public function logins() {
|
79 |
$_params = array();
|
@@ -89,6 +91,9 @@ class Mailchimp_Users {
|
|
89 |
* - email string the email tied to the account used for passwords resets and the ilk
|
90 |
* - role string the role assigned to the account
|
91 |
* - avatar string if available, the url for the login's avatar
|
|
|
|
|
|
|
92 |
*/
|
93 |
public function profile() {
|
94 |
$_params = array();
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Users {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
74 |
* - email string the email tied to the account used for passwords resets and the ilk
|
75 |
* - role string the role assigned to the account
|
76 |
* - avatar string if available, the url for the login's avatar
|
77 |
+
* - global_user_id int the globally unique user id for the user account connected to
|
78 |
+
* - dc_unique_id string the datacenter unique id for the user account connected to, like helper/account-details
|
79 |
*/
|
80 |
public function logins() {
|
81 |
$_params = array();
|
91 |
* - email string the email tied to the account used for passwords resets and the ilk
|
92 |
* - role string the role assigned to the account
|
93 |
* - avatar string if available, the url for the login's avatar
|
94 |
+
* - global_user_id int the globally unique user id for the user account connected to
|
95 |
+
* - dc_unique_id string the datacenter unique id for the user account connected to, like helper/account-details
|
96 |
+
* - account_name string The name of the account to which the API key belongs
|
97 |
*/
|
98 |
public function profile() {
|
99 |
$_params = array();
|
{Mailchimp → classes/Mailchimp}/Vip.php
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Vip {
|
4 |
-
public function __construct(
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
1 |
<?php
|
2 |
|
3 |
class Mailchimp_Vip {
|
4 |
+
public function __construct(Mailchimp $master) {
|
5 |
$this->master = $master;
|
6 |
}
|
7 |
|
classes/class.yksemeBase.php
CHANGED
@@ -65,11 +65,14 @@ if(!class_exists("yksemeBase")) {
|
|
65 |
/*
|
66 |
Conditionally Include the MailChimp Class File
|
67 |
*/
|
68 |
-
if (
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
72 |
}
|
|
|
73 |
/*
|
74 |
* add our new ssl_verify_peer debug option, if it doesn't already exist
|
75 |
* @since v5.2
|
@@ -407,7 +410,7 @@ if(!class_exists("yksemeBase")) {
|
|
407 |
|
408 |
if( $lid == '' || isset( $this->optionVal['lists'][$lid] ) ) return false;
|
409 |
|
410 |
-
$api = new
|
411 |
|
412 |
$mv = $api->call('lists/merge-vars', array(
|
413 |
'id' => array($lid)
|
@@ -441,7 +444,7 @@ if(!class_exists("yksemeBase")) {
|
|
441 |
// Send request to MailChimp API to retreive interest groups associated to a specific list
|
442 |
public function getInterestGroups( $list_id ) {
|
443 |
// store our API key
|
444 |
-
$api = new
|
445 |
|
446 |
// setup switch for div/table
|
447 |
$yikes_mc_flavor = $this->optionVal['flavor'];
|
@@ -480,7 +483,7 @@ if(!class_exists("yksemeBase")) {
|
|
480 |
echo '<tr class="yks_mc_table_interest_group_holder yks_mc_table_checkbox_holder">';
|
481 |
echo '<td class="yks_mc_table_td">';
|
482 |
// display the label
|
483 |
-
echo '<label class="prompt yks_table_label yks-mailchimpFormTableRowLabel yks-mailchimpFormTableRowLabel-required font-secondary label-text">'
|
484 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
485 |
$checkboxValue = $interest_group['name'];
|
486 |
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="checkbox" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_checkbox" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'[]" value="'.$singleGrouping['name'].'"><span>'.$singleGrouping['name'].'</span></label>';
|
@@ -494,10 +497,10 @@ if(!class_exists("yksemeBase")) {
|
|
494 |
echo '<tr class="yks_mc_table_interest_group_holder yks_mc_table_radio_holder">';
|
495 |
echo '<td class="yks_mc_interest_radio_button_holder yks_mc_table_td">';
|
496 |
// display the label
|
497 |
-
echo $user_set_interest_group_label;
|
498 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
499 |
$radioValue = $interest_group['name'];
|
500 |
-
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="radio" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_radio" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" value="'.$singleGrouping['name'].'"><span>'
|
501 |
}
|
502 |
echo '</td>';
|
503 |
echo '</tr>';
|
@@ -508,7 +511,7 @@ if(!class_exists("yksemeBase")) {
|
|
508 |
echo '<tr class="yks_mc_table_interest_group_holder yks_mc_table_dropdown_holder">';
|
509 |
echo '<td class="yks_mc_table_dropdown_interest_group_holder yks_mc_table_td">';
|
510 |
// display the label
|
511 |
-
echo $user_set_interest_group_label;
|
512 |
echo '<select id="yks_mc_interest_dropdown" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" class="yks_mc_interest_group_select">';
|
513 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
514 |
$dropDownValue = $interest_group['name'];
|
@@ -562,7 +565,7 @@ if(!class_exists("yksemeBase")) {
|
|
562 |
echo '<div class="yks_mc_interest_group_holder">';
|
563 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
564 |
$checkboxValue = $interest_group['name'];
|
565 |
-
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="checkbox" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_checkbox" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'[]" value="'.$singleGrouping['name'].'"><span></span>'
|
566 |
}
|
567 |
echo '</div>';
|
568 |
break; // break checkbox interest group type
|
@@ -571,9 +574,10 @@ if(!class_exists("yksemeBase")) {
|
|
571 |
case 'radio':
|
572 |
echo '<div class="yks_mc_interest_group_holder">';
|
573 |
echo '<div class="yks_mc_interest_radio_button_holder">';
|
|
|
574 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
575 |
$radioValue = $interest_group['name'];
|
576 |
-
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="radio" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_radio" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" value="'.$singleGrouping['name'].'"><span></span>'
|
577 |
}
|
578 |
echo '</div>';
|
579 |
echo '</div>';
|
@@ -594,6 +598,8 @@ if(!class_exists("yksemeBase")) {
|
|
594 |
// hidden dropdown interest groups
|
595 |
case 'hidden':
|
596 |
echo '<div class="yks_mc_interest_group_holder" style="display:none;">';
|
|
|
|
|
597 |
echo '<select id="yks_mc_interest_dropdown" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" class="yks_mc_interest_group_select">';
|
598 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
599 |
$dropDownValue = $interest_group['name'];
|
@@ -622,7 +628,7 @@ if(!class_exists("yksemeBase")) {
|
|
622 |
|
623 |
// Send a call to the MailChimp API to retreive all lists on the account
|
624 |
public function getLists() {
|
625 |
-
$api = new
|
626 |
$lists = $this->getListsData();
|
627 |
$listArr = (!isset($listArr) ? $this->optionVal['lists'] : $listArr);
|
628 |
$theusedlist = array();
|
@@ -656,7 +662,7 @@ if(!class_exists("yksemeBase")) {
|
|
656 |
// Get lists for the settings page
|
657 |
// Used for default subscription list
|
658 |
public function getOptionsLists() {
|
659 |
-
$api = new
|
660 |
$lists = $this->getListsData();
|
661 |
$listArr = (!isset($listArr) ? $this->optionVal['lists'] : $listArr);
|
662 |
if( $lists ) {
|
@@ -672,7 +678,7 @@ if(!class_exists("yksemeBase")) {
|
|
672 |
|
673 |
// Send a call to MailChimp API to get the data associated with a specific list (in this instance: the fields, and the subscriber count)
|
674 |
public function getListsData() {
|
675 |
-
$api = new
|
676 |
$lists = $api->call('lists/list', array( 'limit' => 100 ));
|
677 |
if( $lists ) {
|
678 |
foreach ( $lists['data'] as $list ) {
|
@@ -691,7 +697,7 @@ if(!class_exists("yksemeBase")) {
|
|
691 |
@since v5.2
|
692 |
*/
|
693 |
public function getInterstGroupInfo( $list_id ) {
|
694 |
-
$api = new
|
695 |
try {
|
696 |
$interest_groups = $api->call('lists/interest-groupings', array( 'id' => $list_id ));
|
697 |
return $interest_groups;
|
@@ -765,7 +771,7 @@ if(!class_exists("yksemeBase")) {
|
|
765 |
|
766 |
// Send a call to MailChimp API to get the data associated with a specific list (in this instance: the fields, and the subscriber count)
|
767 |
public function getListsForStats() {
|
768 |
-
$api = new
|
769 |
$lists = $this->getListsData();
|
770 |
$listArr = (!isset($listArr) ? $this->optionVal['lists'] : $listArr);
|
771 |
$theusedlist = array();
|
@@ -838,8 +844,12 @@ if(!class_exists("yksemeBase")) {
|
|
838 |
$this->optionVal['lists'][$fd['yks-mailchimp-unique-id']]['fields'][$k]['custom-field-class-'.$fd['yks-mailchimp-unique-id'].'-'.$num] = $fd['custom-field-class-'.$fd['yks-mailchimp-unique-id'].'-'.$num];
|
839 |
$num++;
|
840 |
|
|
|
841 |
$this->optionVal['lists'][$fd['yks-mailchimp-unique-id']]['fields'][$k]['yks_mailchimp_redirect_'.$fd['yks-mailchimp-unique-id']] = (isset($fd['yks_mailchimp_redirect_'.$fd['yks-mailchimp-unique-id']]) ? '1' : '');
|
842 |
|
|
|
|
|
|
|
843 |
if(isset($fd['yks_mailchimp_redirect_'.$fd['yks-mailchimp-unique-id']])) {
|
844 |
$this->optionVal['lists'][$fd['yks-mailchimp-unique-id']]['fields'][$k]['page_id_'.$fd['yks-mailchimp-unique-id']] = $fd['page_id_'.$fd['yks-mailchimp-unique-id']];
|
845 |
}
|
@@ -921,7 +931,7 @@ if(!class_exists("yksemeBase")) {
|
|
921 |
// create our variables
|
922 |
$lid = $this->optionVal['lists'][$i]['list-id'];
|
923 |
$name = $this->optionVal['lists'][$i]['name'];
|
924 |
-
$api = new
|
925 |
$mv = $api->call('lists/merge-vars', array(
|
926 |
'id' => array( $lid )
|
927 |
)
|
@@ -948,7 +958,7 @@ if(!class_exists("yksemeBase")) {
|
|
948 |
// create our variables
|
949 |
$lid = $this->optionVal['lists'][$i]['list-id'];
|
950 |
$name = $this->optionVal['lists'][$i]['name'];
|
951 |
-
$api = new
|
952 |
$mv = $api->call('lists/merge-vars', array(
|
953 |
'id' => array( $lid )
|
954 |
)
|
@@ -970,7 +980,7 @@ if(!class_exists("yksemeBase")) {
|
|
970 |
// Make a call to the MailChimp API to retrieve all subscribers to a given list
|
971 |
// Runs when the user clicks 'view' next to the subscriber count on the list page
|
972 |
public function listAllSubscribers( $lid, $list_name ) {
|
973 |
-
$api = new
|
974 |
$subscribers_list = $api->call('lists/members',
|
975 |
array(
|
976 |
'id' => $lid,
|
@@ -1018,7 +1028,7 @@ if(!class_exists("yksemeBase")) {
|
|
1018 |
// Make a call to the MailChimp API to retrieve information about a specific user
|
1019 |
// Runs when the user clicks a subscribers email address
|
1020 |
public function getSubscriberInfo($lid, $email) {
|
1021 |
-
$api = new
|
1022 |
$subscriber_info = $api->call('lists/member-info',
|
1023 |
array(
|
1024 |
'id' => $lid,
|
@@ -1184,7 +1194,7 @@ if(!class_exists("yksemeBase")) {
|
|
1184 |
// Make a call to the MailChimp API to remove a specified user from a given list
|
1185 |
// Runs when the user clicks the 'X' next to a subscriber when viewing all subscribers on the lists page
|
1186 |
public function yks_removeSubscriber($lid, $user_email) {
|
1187 |
-
$api = new
|
1188 |
$subscribers_list = $api->call('lists/unsubscribe', array(
|
1189 |
'id' => $lid,
|
1190 |
'email' => array(
|
@@ -1396,7 +1406,7 @@ if(!class_exists("yksemeBase")) {
|
|
1396 |
$apiKey = $this->yikes_mc_decryptIt($_POST['api_key']); // api key
|
1397 |
$apiKey_explosion = explode( "-" , $apiKey);
|
1398 |
$dataCenter = $apiKey_explosion[0]; // data center (ie: us3)
|
1399 |
-
$api = new
|
1400 |
// try the call, catch any errors that may be thrown
|
1401 |
try {
|
1402 |
$resp = $api->call('helper/ping', array('apikey' => $apiKey));
|
@@ -1417,7 +1427,7 @@ if(!class_exists("yksemeBase")) {
|
|
1417 |
$decryped_api_key = $this->yikes_mc_decryptIt($apiKey); // api key
|
1418 |
$apiKey_explosion = explode( "-" , $decryped_api_key);
|
1419 |
$dataCenter = $apiKey_explosion[0]; // data center (ie: us3)
|
1420 |
-
$api = new
|
1421 |
// try the call, catch any errors that may be thrown
|
1422 |
try {
|
1423 |
$resp = $api->call('helper/ping', array('apikey' => $decryped_api_key));
|
@@ -1438,7 +1448,7 @@ if(!class_exists("yksemeBase")) {
|
|
1438 |
public function getUserProfileDetails() {
|
1439 |
// Create and store our variables to pass to MailChimp
|
1440 |
$apiKey = $_POST['api_key']; // api key
|
1441 |
-
$api = new
|
1442 |
// try the call, catch any errors that may be thrown
|
1443 |
try {
|
1444 |
$profile_response = $api->call('users/profile', array('apikey' => $apiKey));
|
@@ -1475,7 +1485,7 @@ if(!class_exists("yksemeBase")) {
|
|
1475 |
@since v5.2
|
1476 |
*/
|
1477 |
public function sendUpdateProfileEmail( $user_email , $list_id ) {
|
1478 |
-
$api = new
|
1479 |
$explode_key = explode( '-' , $this->optionVal['api-key'] );
|
1480 |
$data_center = $explode_key[1];
|
1481 |
$full_site_url = get_bloginfo('url');
|
@@ -1539,7 +1549,7 @@ if(!class_exists("yksemeBase")) {
|
|
1539 |
public function getMailChimpChatter() {
|
1540 |
// Create and store our variables to pass to MailChimp
|
1541 |
$apiKey = $this->optionVal['api-key']; // api key
|
1542 |
-
$api = new
|
1543 |
// try the call, catch any errors that may be thrown
|
1544 |
try {
|
1545 |
$resp = $api->call('helper/chimp-chatter', array('apikey' => $apiKey));
|
@@ -1563,7 +1573,7 @@ if(!class_exists("yksemeBase")) {
|
|
1563 |
public function getMailChimpChatterForWidget() {
|
1564 |
// Create and store our variables to pass to MailChimp
|
1565 |
$apiKey = $this->optionVal['api-key']; // api key
|
1566 |
-
$api = new
|
1567 |
// try the call, catch any errors that may be thrown
|
1568 |
try {
|
1569 |
$resp = $api->call('helper/chimp-chatter', array('apikey' => $apiKey));
|
@@ -1587,7 +1597,7 @@ if(!class_exists("yksemeBase")) {
|
|
1587 |
// Create and store our variables to pass to MailChimp
|
1588 |
$apiKey = $_POST['api_key']; // api key
|
1589 |
if ( isset($_POST['list_id']) ) { $listID = $_POST['list_id']; } else { $listID = NULL; }
|
1590 |
-
$api = new
|
1591 |
// try the call, catch any errors that may be thrown
|
1592 |
try {
|
1593 |
$resp = $api->call('lists/growth-history', array( 'apikey' => $apiKey , 'id' => $listID ));
|
@@ -1616,7 +1626,7 @@ if(!class_exists("yksemeBase")) {
|
|
1616 |
public function getCapmpaignData() {
|
1617 |
// Create and store our variables to pass to MailChimp
|
1618 |
$apiKey = $_POST['api_key']; // api key
|
1619 |
-
$api = new
|
1620 |
// try the call, catch any errors that may be thrown
|
1621 |
try {
|
1622 |
$resp = $api->call('campaigns/list', array( 'apikey' => $apiKey , 'limit' => 1000 ));
|
@@ -1654,7 +1664,7 @@ if(!class_exists("yksemeBase")) {
|
|
1654 |
public function getSpecificCapmpaignData() {
|
1655 |
// Create and store our variables to pass to MailChimp
|
1656 |
$apiKey = $_POST['api_key']; // api key
|
1657 |
-
$api = new
|
1658 |
$campaign_id = $_POST['campaign_id'];
|
1659 |
$campaign_title = $_POST['campaign_title'];
|
1660 |
$campaign_email_subject = $_POST['campaign_subject'];
|
@@ -1684,7 +1694,7 @@ if(!class_exists("yksemeBase")) {
|
|
1684 |
public function getCampaignEmailToTable() {
|
1685 |
// Create and store our variables to pass to MailChimp
|
1686 |
$apiKey = $_POST['api_key']; // api key
|
1687 |
-
$api = new
|
1688 |
$campaign_id = $_POST['campaign_id'];
|
1689 |
// try the call, catch any errors that may be thrown
|
1690 |
try {
|
@@ -1784,7 +1794,7 @@ if(!class_exists("yksemeBase")) {
|
|
1784 |
public function getGeoDataForCampaignOpenLinks() {
|
1785 |
// Create and store our variables to pass to MailChimp
|
1786 |
$apiKey = $_POST['api_key']; // api key
|
1787 |
-
$api = new
|
1788 |
$campaign_id = $_POST['campaign_id'];
|
1789 |
// try the call, catch any errors that may be thrown
|
1790 |
try {
|
@@ -1839,7 +1849,7 @@ if(!class_exists("yksemeBase")) {
|
|
1839 |
public function getCampaignLinkStats() {
|
1840 |
// Create and store our variables to pass to MailChimp
|
1841 |
$apiKey = $_POST['api_key']; // api key
|
1842 |
-
$api = new
|
1843 |
$campaign_id = $_POST['campaign_id'];
|
1844 |
// try the call, catch any errors that may be thrown
|
1845 |
try {
|
@@ -1865,7 +1875,7 @@ if(!class_exists("yksemeBase")) {
|
|
1865 |
public function getCampaignOpenedData() {
|
1866 |
// Create and store our variables to pass to MailChimp
|
1867 |
$apiKey = $_POST['api_key']; // api key
|
1868 |
-
$api = new
|
1869 |
$campaign_id = $_POST['campaign_id'];
|
1870 |
// try the call, catch any errors that may be thrown
|
1871 |
try {
|
@@ -1977,7 +1987,7 @@ if(!class_exists("yksemeBase")) {
|
|
1977 |
public function getCampaignBouncedEmailData() {
|
1978 |
// Create and store our variables to pass to MailChimp
|
1979 |
$apiKey = $_POST['api_key']; // api key
|
1980 |
-
$api = new
|
1981 |
$campaign_id = $_POST['campaign_id'];
|
1982 |
// try the call, catch any errors that may be thrown
|
1983 |
try {
|
@@ -2083,7 +2093,7 @@ if(!class_exists("yksemeBase")) {
|
|
2083 |
public function getCampaignUnsubscribeData() {
|
2084 |
// Create and store our variables to pass to MailChimp
|
2085 |
$apiKey = $_POST['api_key']; // api key
|
2086 |
-
$api = new
|
2087 |
$campaign_id = $_POST['campaign_id'];
|
2088 |
// try the call, catch any errors that may be thrown
|
2089 |
try {
|
@@ -2238,7 +2248,7 @@ if(!class_exists("yksemeBase")) {
|
|
2238 |
// Create and store the variables needed to add a new subscriber
|
2239 |
$email = false;
|
2240 |
$lid = $fd['yks-mailchimp-list-id'];
|
2241 |
-
$api = new
|
2242 |
$mv = array();
|
2243 |
$optin = $this->optionVal['optin'];
|
2244 |
|
@@ -2327,6 +2337,12 @@ if(!class_exists("yksemeBase")) {
|
|
2327 |
|
2328 |
$form_data = apply_filters( 'yikes_mc_get_form_data_'.$lid, $mv );
|
2329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2330 |
|
2331 |
// try adding subscriber, catch any error thrown
|
2332 |
try {
|
@@ -2335,6 +2351,7 @@ if(!class_exists("yksemeBase")) {
|
|
2335 |
'email' => array( 'email' => $email ), // user email
|
2336 |
'merge_vars' => $form_data, // merge variables (ie: fields and interest groups)
|
2337 |
'double_optin' => $optin, // double optin value (retreived from the settings page)
|
|
|
2338 |
'update_existing' => $update_existing
|
2339 |
));
|
2340 |
return "done";
|
@@ -2358,7 +2375,7 @@ if(!class_exists("yksemeBase")) {
|
|
2358 |
// Create and store the variables needed to add a new subscriber
|
2359 |
$email = false;
|
2360 |
$lid = $fd['yks-mailchimp-list-id'];
|
2361 |
-
$api = new
|
2362 |
$mv = array();
|
2363 |
$optin = $this->optionVal['optin'];
|
2364 |
|
@@ -2446,6 +2463,12 @@ if(!class_exists("yksemeBase")) {
|
|
2446 |
$form_data = apply_filters( 'yikes_mc_get_form_data' , $mv );
|
2447 |
$specific_form_data = apply_filters( 'yikes_mc_get_form_data_'.$lid, $lid, $mv );
|
2448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2449 |
|
2450 |
// try adding subscriber, catch any error thrown
|
2451 |
try {
|
@@ -2454,20 +2477,20 @@ if(!class_exists("yksemeBase")) {
|
|
2454 |
'email' => array( 'email' => $email ), // user email
|
2455 |
'merge_vars' => $form_data, // merge variables (ie: fields and interest groups)
|
2456 |
'double_optin' => $optin, // double optin value (retreived from the settings page)
|
2457 |
-
'send_welcome' =>
|
2458 |
'update_existing' => $update_existing
|
2459 |
));
|
2460 |
return "done";
|
2461 |
} catch( Exception $e ) { // catch any errors returned from MailChimp
|
2462 |
$errorCode = $e->getCode();
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
}
|
2472 |
}
|
2473 |
|
@@ -3093,7 +3116,7 @@ if(!class_exists("yksemeBase")) {
|
|
3093 |
Delete an interest group from a given list
|
3094 |
*/
|
3095 |
public function deleteInterestGroupFromList($mc_list_id,$interest_group_id) {
|
3096 |
-
$api = new
|
3097 |
try {
|
3098 |
$retval = $api->call('lists/interest-grouping-del', array(
|
3099 |
'id' => $mc_list_id,
|
@@ -3119,7 +3142,7 @@ if(!class_exists("yksemeBase")) {
|
|
3119 |
*/
|
3120 |
public function createNewInterestGroup($p) {
|
3121 |
|
3122 |
-
$api = new
|
3123 |
parse_str( $p['form_data'], $formData );
|
3124 |
$list_id = $formData['mc-list-id'];
|
3125 |
$grouping_name = $formData['add-interest-group-name'];
|
@@ -3153,7 +3176,7 @@ if(!class_exists("yksemeBase")) {
|
|
3153 |
*/
|
3154 |
public function updateInterestGroup( $mailchimp_list_id , $grouping_id , $previous_value , $new_value ) {
|
3155 |
|
3156 |
-
$api = new
|
3157 |
|
3158 |
try {
|
3159 |
$retval = $api->call('lists/interest-group-update', array(
|
@@ -3186,7 +3209,7 @@ if(!class_exists("yksemeBase")) {
|
|
3186 |
*/
|
3187 |
public function updateInterestGroupingTitle( $mailchimp_list_id , $grouping_id , $value ) {
|
3188 |
|
3189 |
-
$api = new
|
3190 |
|
3191 |
try {
|
3192 |
$retval = $api->call('lists/interest-grouping-update', array(
|
@@ -3215,7 +3238,7 @@ if(!class_exists("yksemeBase")) {
|
|
3215 |
*/
|
3216 |
public function addInterestGroupOption( $mailchimp_list_id , $group_name , $grouping_id ) {
|
3217 |
|
3218 |
-
$api = new
|
3219 |
|
3220 |
try {
|
3221 |
$retval = $api->call('lists/interest-group-add', array(
|
@@ -3244,7 +3267,7 @@ if(!class_exists("yksemeBase")) {
|
|
3244 |
*/
|
3245 |
public function deleteInterestGroupOption( $mailchimp_list_id , $group_name , $grouping_id ) {
|
3246 |
|
3247 |
-
$api = new
|
3248 |
|
3249 |
try {
|
3250 |
$retval = $api->call('lists/interest-group-del', array(
|
@@ -3279,7 +3302,7 @@ if(!class_exists("yksemeBase")) {
|
|
3279 |
MailChimp API Request to Add new field to a list
|
3280 |
*/
|
3281 |
public function deleteFieldFromList( $mailchimp_list_id , $merge_tag ) {
|
3282 |
-
$api = new
|
3283 |
try {
|
3284 |
$retval = $api->call('lists/merge-var-del', array(
|
3285 |
'id' => $mailchimp_list_id, // list id to delete merge tag from
|
@@ -3303,7 +3326,7 @@ if(!class_exists("yksemeBase")) {
|
|
3303 |
Change the interest group type
|
3304 |
*/
|
3305 |
public function changeListInterestGroupType( $grouping_id , $value ) {
|
3306 |
-
$api = new
|
3307 |
try {
|
3308 |
$retval = $api->call('lists/interest-grouping-update', array(
|
3309 |
'grouping_id' => $grouping_id, // list id to delete merge tag from
|
@@ -3471,13 +3494,20 @@ if(!class_exists("yksemeBase")) {
|
|
3471 |
|
3472 |
// store our API key
|
3473 |
// on the settings page, if they have chosen to display the checkbox
|
3474 |
-
$api = new
|
3475 |
|
3476 |
$apikey = $yikes_api_key;
|
3477 |
$listid = $this->optionVal['yks-mailchimp-optIn-default-list']; // Need to set up a default list to subscribe all users to
|
3478 |
$endpoint = 'https://api.mailchimp.com';
|
3479 |
$optin = $this->optionVal['optin'];
|
3480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3481 |
// try adding subscriber, catch any error thrown
|
3482 |
try {
|
3483 |
$retval = $api->call('lists/subscribe', array(
|
@@ -3491,7 +3521,7 @@ if(!class_exists("yksemeBase")) {
|
|
3491 |
'NAME' => $commenter_first_name
|
3492 |
),
|
3493 |
'double_optin' => $optin, // double optin value (retreived from the settings page)
|
3494 |
-
'send_welcome' =>
|
3495 |
));
|
3496 |
return "done";
|
3497 |
} catch( Exception $e ) { // catch any errors returned from MailChimp
|
65 |
/*
|
66 |
Conditionally Include the MailChimp Class File
|
67 |
*/
|
68 |
+
if( !class_exists("Mailchimp") ) {
|
69 |
+
if ( $this->optionVal['ssl_verify_peer'] == 'true' ) {
|
70 |
+
require_once YKSEME_PATH.'classes/MCAPI_2.0.class.php';
|
71 |
+
} else {
|
72 |
+
require_once YKSEME_PATH.'classes/MCAPI_2.0.class.verify_false.php';
|
73 |
+
}
|
74 |
}
|
75 |
+
|
76 |
/*
|
77 |
* add our new ssl_verify_peer debug option, if it doesn't already exist
|
78 |
* @since v5.2
|
410 |
|
411 |
if( $lid == '' || isset( $this->optionVal['lists'][$lid] ) ) return false;
|
412 |
|
413 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
414 |
|
415 |
$mv = $api->call('lists/merge-vars', array(
|
416 |
'id' => array($lid)
|
444 |
// Send request to MailChimp API to retreive interest groups associated to a specific list
|
445 |
public function getInterestGroups( $list_id ) {
|
446 |
// store our API key
|
447 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
448 |
|
449 |
// setup switch for div/table
|
450 |
$yikes_mc_flavor = $this->optionVal['flavor'];
|
483 |
echo '<tr class="yks_mc_table_interest_group_holder yks_mc_table_checkbox_holder">';
|
484 |
echo '<td class="yks_mc_table_td">';
|
485 |
// display the label
|
486 |
+
echo '<label class="prompt yks_table_label yks-mailchimpFormTableRowLabel yks-mailchimpFormTableRowLabel-required font-secondary label-text">'.stripslashes( $interest_group['name'] ).'</label>'; // display the interest group name from MailChimp
|
487 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
488 |
$checkboxValue = $interest_group['name'];
|
489 |
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="checkbox" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_checkbox" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'[]" value="'.$singleGrouping['name'].'"><span>'.$singleGrouping['name'].'</span></label>';
|
497 |
echo '<tr class="yks_mc_table_interest_group_holder yks_mc_table_radio_holder">';
|
498 |
echo '<td class="yks_mc_interest_radio_button_holder yks_mc_table_td">';
|
499 |
// display the label
|
500 |
+
echo stripslashes($user_set_interest_group_label);
|
501 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
502 |
$radioValue = $interest_group['name'];
|
503 |
+
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="radio" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_radio" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" value="'.$singleGrouping['name'].'"><span>'.stripslashes($singleGrouping['name']).'</span></label>';
|
504 |
}
|
505 |
echo '</td>';
|
506 |
echo '</tr>';
|
511 |
echo '<tr class="yks_mc_table_interest_group_holder yks_mc_table_dropdown_holder">';
|
512 |
echo '<td class="yks_mc_table_dropdown_interest_group_holder yks_mc_table_td">';
|
513 |
// display the label
|
514 |
+
echo stripslashes($user_set_interest_group_label);
|
515 |
echo '<select id="yks_mc_interest_dropdown" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" class="yks_mc_interest_group_select">';
|
516 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
517 |
$dropDownValue = $interest_group['name'];
|
565 |
echo '<div class="yks_mc_interest_group_holder">';
|
566 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
567 |
$checkboxValue = $interest_group['name'];
|
568 |
+
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="checkbox" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_checkbox" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'[]" value="'.$singleGrouping['name'].'"><span></span>'.stripslashes($singleGrouping['name']).'</label>';
|
569 |
}
|
570 |
echo '</div>';
|
571 |
break; // break checkbox interest group type
|
574 |
case 'radio':
|
575 |
echo '<div class="yks_mc_interest_group_holder">';
|
576 |
echo '<div class="yks_mc_interest_radio_button_holder">';
|
577 |
+
echo stripslashes($user_set_interest_group_label);
|
578 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
579 |
$radioValue = $interest_group['name'];
|
580 |
+
echo '<label class="yks_mc_interest_group_label" for="'.$singleGrouping['name'].'"><input type="radio" id="'.$singleGrouping['name'].'" class="yikes_mc_interest_group_radio" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" value="'.$singleGrouping['name'].'"><span></span>'.stripslashes($singleGrouping['name']).'</label>';
|
581 |
}
|
582 |
echo '</div>';
|
583 |
echo '</div>';
|
598 |
// hidden dropdown interest groups
|
599 |
case 'hidden':
|
600 |
echo '<div class="yks_mc_interest_group_holder" style="display:none;">';
|
601 |
+
// display the label
|
602 |
+
echo stripslashes($user_set_interest_group_label);
|
603 |
echo '<select id="yks_mc_interest_dropdown" name="'.$interest_group['form_field'].'-'.$interest_group['id'].'" class="yks_mc_interest_group_select">';
|
604 |
foreach ($interest_group['groups'] as $singleGrouping) {
|
605 |
$dropDownValue = $interest_group['name'];
|
628 |
|
629 |
// Send a call to the MailChimp API to retreive all lists on the account
|
630 |
public function getLists() {
|
631 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
632 |
$lists = $this->getListsData();
|
633 |
$listArr = (!isset($listArr) ? $this->optionVal['lists'] : $listArr);
|
634 |
$theusedlist = array();
|
662 |
// Get lists for the settings page
|
663 |
// Used for default subscription list
|
664 |
public function getOptionsLists() {
|
665 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
666 |
$lists = $this->getListsData();
|
667 |
$listArr = (!isset($listArr) ? $this->optionVal['lists'] : $listArr);
|
668 |
if( $lists ) {
|
678 |
|
679 |
// Send a call to MailChimp API to get the data associated with a specific list (in this instance: the fields, and the subscriber count)
|
680 |
public function getListsData() {
|
681 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
682 |
$lists = $api->call('lists/list', array( 'limit' => 100 ));
|
683 |
if( $lists ) {
|
684 |
foreach ( $lists['data'] as $list ) {
|
697 |
@since v5.2
|
698 |
*/
|
699 |
public function getInterstGroupInfo( $list_id ) {
|
700 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
701 |
try {
|
702 |
$interest_groups = $api->call('lists/interest-groupings', array( 'id' => $list_id ));
|
703 |
return $interest_groups;
|
771 |
|
772 |
// Send a call to MailChimp API to get the data associated with a specific list (in this instance: the fields, and the subscriber count)
|
773 |
public function getListsForStats() {
|
774 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
775 |
$lists = $this->getListsData();
|
776 |
$listArr = (!isset($listArr) ? $this->optionVal['lists'] : $listArr);
|
777 |
$theusedlist = array();
|
844 |
$this->optionVal['lists'][$fd['yks-mailchimp-unique-id']]['fields'][$k]['custom-field-class-'.$fd['yks-mailchimp-unique-id'].'-'.$num] = $fd['custom-field-class-'.$fd['yks-mailchimp-unique-id'].'-'.$num];
|
845 |
$num++;
|
846 |
|
847 |
+
// redirect checkbox
|
848 |
$this->optionVal['lists'][$fd['yks-mailchimp-unique-id']]['fields'][$k]['yks_mailchimp_redirect_'.$fd['yks-mailchimp-unique-id']] = (isset($fd['yks_mailchimp_redirect_'.$fd['yks-mailchimp-unique-id']]) ? '1' : '');
|
849 |
|
850 |
+
// send welcome checkbox
|
851 |
+
$this->optionVal['lists'][$fd['yks-mailchimp-unique-id']]['fields'][$k]['yks_mailchimp_send_welcome_'.$fd['yks-mailchimp-unique-id']] = (isset($fd['yks_mailchimp_send_welcome_'.$fd['yks-mailchimp-unique-id']]) ? '1' : '');
|
852 |
+
|
853 |
if(isset($fd['yks_mailchimp_redirect_'.$fd['yks-mailchimp-unique-id']])) {
|
854 |
$this->optionVal['lists'][$fd['yks-mailchimp-unique-id']]['fields'][$k]['page_id_'.$fd['yks-mailchimp-unique-id']] = $fd['page_id_'.$fd['yks-mailchimp-unique-id']];
|
855 |
}
|
931 |
// create our variables
|
932 |
$lid = $this->optionVal['lists'][$i]['list-id'];
|
933 |
$name = $this->optionVal['lists'][$i]['name'];
|
934 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
935 |
$mv = $api->call('lists/merge-vars', array(
|
936 |
'id' => array( $lid )
|
937 |
)
|
958 |
// create our variables
|
959 |
$lid = $this->optionVal['lists'][$i]['list-id'];
|
960 |
$name = $this->optionVal['lists'][$i]['name'];
|
961 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
962 |
$mv = $api->call('lists/merge-vars', array(
|
963 |
'id' => array( $lid )
|
964 |
)
|
980 |
// Make a call to the MailChimp API to retrieve all subscribers to a given list
|
981 |
// Runs when the user clicks 'view' next to the subscriber count on the list page
|
982 |
public function listAllSubscribers( $lid, $list_name ) {
|
983 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
984 |
$subscribers_list = $api->call('lists/members',
|
985 |
array(
|
986 |
'id' => $lid,
|
1028 |
// Make a call to the MailChimp API to retrieve information about a specific user
|
1029 |
// Runs when the user clicks a subscribers email address
|
1030 |
public function getSubscriberInfo($lid, $email) {
|
1031 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
1032 |
$subscriber_info = $api->call('lists/member-info',
|
1033 |
array(
|
1034 |
'id' => $lid,
|
1194 |
// Make a call to the MailChimp API to remove a specified user from a given list
|
1195 |
// Runs when the user clicks the 'X' next to a subscriber when viewing all subscribers on the lists page
|
1196 |
public function yks_removeSubscriber($lid, $user_email) {
|
1197 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
1198 |
$subscribers_list = $api->call('lists/unsubscribe', array(
|
1199 |
'id' => $lid,
|
1200 |
'email' => array(
|
1406 |
$apiKey = $this->yikes_mc_decryptIt($_POST['api_key']); // api key
|
1407 |
$apiKey_explosion = explode( "-" , $apiKey);
|
1408 |
$dataCenter = $apiKey_explosion[0]; // data center (ie: us3)
|
1409 |
+
$api = new Mailchimp($apiKey);
|
1410 |
// try the call, catch any errors that may be thrown
|
1411 |
try {
|
1412 |
$resp = $api->call('helper/ping', array('apikey' => $apiKey));
|
1427 |
$decryped_api_key = $this->yikes_mc_decryptIt($apiKey); // api key
|
1428 |
$apiKey_explosion = explode( "-" , $decryped_api_key);
|
1429 |
$dataCenter = $apiKey_explosion[0]; // data center (ie: us3)
|
1430 |
+
$api = new Mailchimp($decryped_api_key);
|
1431 |
// try the call, catch any errors that may be thrown
|
1432 |
try {
|
1433 |
$resp = $api->call('helper/ping', array('apikey' => $decryped_api_key));
|
1448 |
public function getUserProfileDetails() {
|
1449 |
// Create and store our variables to pass to MailChimp
|
1450 |
$apiKey = $_POST['api_key']; // api key
|
1451 |
+
$api = new Mailchimp($apiKey);
|
1452 |
// try the call, catch any errors that may be thrown
|
1453 |
try {
|
1454 |
$profile_response = $api->call('users/profile', array('apikey' => $apiKey));
|
1485 |
@since v5.2
|
1486 |
*/
|
1487 |
public function sendUpdateProfileEmail( $user_email , $list_id ) {
|
1488 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
1489 |
$explode_key = explode( '-' , $this->optionVal['api-key'] );
|
1490 |
$data_center = $explode_key[1];
|
1491 |
$full_site_url = get_bloginfo('url');
|
1549 |
public function getMailChimpChatter() {
|
1550 |
// Create and store our variables to pass to MailChimp
|
1551 |
$apiKey = $this->optionVal['api-key']; // api key
|
1552 |
+
$api = new Mailchimp($apiKey);
|
1553 |
// try the call, catch any errors that may be thrown
|
1554 |
try {
|
1555 |
$resp = $api->call('helper/chimp-chatter', array('apikey' => $apiKey));
|
1573 |
public function getMailChimpChatterForWidget() {
|
1574 |
// Create and store our variables to pass to MailChimp
|
1575 |
$apiKey = $this->optionVal['api-key']; // api key
|
1576 |
+
$api = new Mailchimp($apiKey);
|
1577 |
// try the call, catch any errors that may be thrown
|
1578 |
try {
|
1579 |
$resp = $api->call('helper/chimp-chatter', array('apikey' => $apiKey));
|
1597 |
// Create and store our variables to pass to MailChimp
|
1598 |
$apiKey = $_POST['api_key']; // api key
|
1599 |
if ( isset($_POST['list_id']) ) { $listID = $_POST['list_id']; } else { $listID = NULL; }
|
1600 |
+
$api = new Mailchimp($apiKey);
|
1601 |
// try the call, catch any errors that may be thrown
|
1602 |
try {
|
1603 |
$resp = $api->call('lists/growth-history', array( 'apikey' => $apiKey , 'id' => $listID ));
|
1626 |
public function getCapmpaignData() {
|
1627 |
// Create and store our variables to pass to MailChimp
|
1628 |
$apiKey = $_POST['api_key']; // api key
|
1629 |
+
$api = new Mailchimp($apiKey);
|
1630 |
// try the call, catch any errors that may be thrown
|
1631 |
try {
|
1632 |
$resp = $api->call('campaigns/list', array( 'apikey' => $apiKey , 'limit' => 1000 ));
|
1664 |
public function getSpecificCapmpaignData() {
|
1665 |
// Create and store our variables to pass to MailChimp
|
1666 |
$apiKey = $_POST['api_key']; // api key
|
1667 |
+
$api = new Mailchimp($apiKey);
|
1668 |
$campaign_id = $_POST['campaign_id'];
|
1669 |
$campaign_title = $_POST['campaign_title'];
|
1670 |
$campaign_email_subject = $_POST['campaign_subject'];
|
1694 |
public function getCampaignEmailToTable() {
|
1695 |
// Create and store our variables to pass to MailChimp
|
1696 |
$apiKey = $_POST['api_key']; // api key
|
1697 |
+
$api = new Mailchimp($apiKey);
|
1698 |
$campaign_id = $_POST['campaign_id'];
|
1699 |
// try the call, catch any errors that may be thrown
|
1700 |
try {
|
1794 |
public function getGeoDataForCampaignOpenLinks() {
|
1795 |
// Create and store our variables to pass to MailChimp
|
1796 |
$apiKey = $_POST['api_key']; // api key
|
1797 |
+
$api = new Mailchimp($apiKey);
|
1798 |
$campaign_id = $_POST['campaign_id'];
|
1799 |
// try the call, catch any errors that may be thrown
|
1800 |
try {
|
1849 |
public function getCampaignLinkStats() {
|
1850 |
// Create and store our variables to pass to MailChimp
|
1851 |
$apiKey = $_POST['api_key']; // api key
|
1852 |
+
$api = new Mailchimp($apiKey);
|
1853 |
$campaign_id = $_POST['campaign_id'];
|
1854 |
// try the call, catch any errors that may be thrown
|
1855 |
try {
|
1875 |
public function getCampaignOpenedData() {
|
1876 |
// Create and store our variables to pass to MailChimp
|
1877 |
$apiKey = $_POST['api_key']; // api key
|
1878 |
+
$api = new Mailchimp($apiKey);
|
1879 |
$campaign_id = $_POST['campaign_id'];
|
1880 |
// try the call, catch any errors that may be thrown
|
1881 |
try {
|
1987 |
public function getCampaignBouncedEmailData() {
|
1988 |
// Create and store our variables to pass to MailChimp
|
1989 |
$apiKey = $_POST['api_key']; // api key
|
1990 |
+
$api = new Mailchimp($apiKey);
|
1991 |
$campaign_id = $_POST['campaign_id'];
|
1992 |
// try the call, catch any errors that may be thrown
|
1993 |
try {
|
2093 |
public function getCampaignUnsubscribeData() {
|
2094 |
// Create and store our variables to pass to MailChimp
|
2095 |
$apiKey = $_POST['api_key']; // api key
|
2096 |
+
$api = new Mailchimp($apiKey);
|
2097 |
$campaign_id = $_POST['campaign_id'];
|
2098 |
// try the call, catch any errors that may be thrown
|
2099 |
try {
|
2248 |
// Create and store the variables needed to add a new subscriber
|
2249 |
$email = false;
|
2250 |
$lid = $fd['yks-mailchimp-list-id'];
|
2251 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
2252 |
$mv = array();
|
2253 |
$optin = $this->optionVal['optin'];
|
2254 |
|
2337 |
|
2338 |
$form_data = apply_filters( 'yikes_mc_get_form_data_'.$lid, $mv );
|
2339 |
|
2340 |
+
// setup our welcome email variable
|
2341 |
+
if( isset( $this->optionVal['lists'][$lid]['fields'][$lid.'-email']['yks_mailchimp_send_welcome_'.$lid] ) && $this->optionVal['lists'][$lid]['fields'][$lid.'-email']['yks_mailchimp_send_welcome_'.$lid] == '1' ) {
|
2342 |
+
$welcome = false;
|
2343 |
+
} else {
|
2344 |
+
$welcome = true;
|
2345 |
+
}
|
2346 |
|
2347 |
// try adding subscriber, catch any error thrown
|
2348 |
try {
|
2351 |
'email' => array( 'email' => $email ), // user email
|
2352 |
'merge_vars' => $form_data, // merge variables (ie: fields and interest groups)
|
2353 |
'double_optin' => $optin, // double optin value (retreived from the settings page)
|
2354 |
+
'send_welcome' => $welcome,
|
2355 |
'update_existing' => $update_existing
|
2356 |
));
|
2357 |
return "done";
|
2375 |
// Create and store the variables needed to add a new subscriber
|
2376 |
$email = false;
|
2377 |
$lid = $fd['yks-mailchimp-list-id'];
|
2378 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
2379 |
$mv = array();
|
2380 |
$optin = $this->optionVal['optin'];
|
2381 |
|
2463 |
$form_data = apply_filters( 'yikes_mc_get_form_data' , $mv );
|
2464 |
$specific_form_data = apply_filters( 'yikes_mc_get_form_data_'.$lid, $lid, $mv );
|
2465 |
|
2466 |
+
// setup our welcome email variable
|
2467 |
+
if( isset( $this->optionVal['lists'][$lid]['fields'][$lid.'-email']['yks_mailchimp_send_welcome_'.$lid] ) && $this->optionVal['lists'][$lid]['fields'][$lid.'-email']['yks_mailchimp_send_welcome_'.$lid] == '1' ) {
|
2468 |
+
$welcome = false;
|
2469 |
+
} else {
|
2470 |
+
$welcome = true;
|
2471 |
+
}
|
2472 |
|
2473 |
// try adding subscriber, catch any error thrown
|
2474 |
try {
|
2477 |
'email' => array( 'email' => $email ), // user email
|
2478 |
'merge_vars' => $form_data, // merge variables (ie: fields and interest groups)
|
2479 |
'double_optin' => $optin, // double optin value (retreived from the settings page)
|
2480 |
+
'send_welcome' => $welcome,
|
2481 |
'update_existing' => $update_existing
|
2482 |
));
|
2483 |
return "done";
|
2484 |
} catch( Exception $e ) { // catch any errors returned from MailChimp
|
2485 |
$errorCode = $e->getCode();
|
2486 |
+
if ( $errorCode = '214' ) {
|
2487 |
+
$errorMessage = $e->getMessage();
|
2488 |
+
return json_encode( array( 'errorCode' => $errorCode , 'errorResponse' => apply_filters( 'yikes_mc_user_already_subscribed' , $errorMessage , $email ) ) );
|
2489 |
+
die();
|
2490 |
+
} else {
|
2491 |
+
echo '<strong>'.$e->getMessage().'</strong>';
|
2492 |
+
die();
|
2493 |
+
}
|
2494 |
}
|
2495 |
}
|
2496 |
|
3116 |
Delete an interest group from a given list
|
3117 |
*/
|
3118 |
public function deleteInterestGroupFromList($mc_list_id,$interest_group_id) {
|
3119 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3120 |
try {
|
3121 |
$retval = $api->call('lists/interest-grouping-del', array(
|
3122 |
'id' => $mc_list_id,
|
3142 |
*/
|
3143 |
public function createNewInterestGroup($p) {
|
3144 |
|
3145 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3146 |
parse_str( $p['form_data'], $formData );
|
3147 |
$list_id = $formData['mc-list-id'];
|
3148 |
$grouping_name = $formData['add-interest-group-name'];
|
3176 |
*/
|
3177 |
public function updateInterestGroup( $mailchimp_list_id , $grouping_id , $previous_value , $new_value ) {
|
3178 |
|
3179 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3180 |
|
3181 |
try {
|
3182 |
$retval = $api->call('lists/interest-group-update', array(
|
3209 |
*/
|
3210 |
public function updateInterestGroupingTitle( $mailchimp_list_id , $grouping_id , $value ) {
|
3211 |
|
3212 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3213 |
|
3214 |
try {
|
3215 |
$retval = $api->call('lists/interest-grouping-update', array(
|
3238 |
*/
|
3239 |
public function addInterestGroupOption( $mailchimp_list_id , $group_name , $grouping_id ) {
|
3240 |
|
3241 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3242 |
|
3243 |
try {
|
3244 |
$retval = $api->call('lists/interest-group-add', array(
|
3267 |
*/
|
3268 |
public function deleteInterestGroupOption( $mailchimp_list_id , $group_name , $grouping_id ) {
|
3269 |
|
3270 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3271 |
|
3272 |
try {
|
3273 |
$retval = $api->call('lists/interest-group-del', array(
|
3302 |
MailChimp API Request to Add new field to a list
|
3303 |
*/
|
3304 |
public function deleteFieldFromList( $mailchimp_list_id , $merge_tag ) {
|
3305 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3306 |
try {
|
3307 |
$retval = $api->call('lists/merge-var-del', array(
|
3308 |
'id' => $mailchimp_list_id, // list id to delete merge tag from
|
3326 |
Change the interest group type
|
3327 |
*/
|
3328 |
public function changeListInterestGroupType( $grouping_id , $value ) {
|
3329 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3330 |
try {
|
3331 |
$retval = $api->call('lists/interest-grouping-update', array(
|
3332 |
'grouping_id' => $grouping_id, // list id to delete merge tag from
|
3494 |
|
3495 |
// store our API key
|
3496 |
// on the settings page, if they have chosen to display the checkbox
|
3497 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
3498 |
|
3499 |
$apikey = $yikes_api_key;
|
3500 |
$listid = $this->optionVal['yks-mailchimp-optIn-default-list']; // Need to set up a default list to subscribe all users to
|
3501 |
$endpoint = 'https://api.mailchimp.com';
|
3502 |
$optin = $this->optionVal['optin'];
|
3503 |
|
3504 |
+
// setup our welcome email variable
|
3505 |
+
if( isset( $this->optionVal['lists'][$listid]['fields'][$listid.'-email']['yks_mailchimp_send_welcome_'.$listid] ) && $this->optionVal['lists'][$listid]['fields'][$listid.'-email']['yks_mailchimp_send_welcome_'.$listid] == '1' ) {
|
3506 |
+
$welcome = false;
|
3507 |
+
} else {
|
3508 |
+
$welcome = true;
|
3509 |
+
}
|
3510 |
+
|
3511 |
// try adding subscriber, catch any error thrown
|
3512 |
try {
|
3513 |
$retval = $api->call('lists/subscribe', array(
|
3521 |
'NAME' => $commenter_first_name
|
3522 |
),
|
3523 |
'double_optin' => $optin, // double optin value (retreived from the settings page)
|
3524 |
+
'send_welcome' => $welcome
|
3525 |
));
|
3526 |
return "done";
|
3527 |
} catch( Exception $e ) { // catch any errors returned from MailChimp
|
lib/inc/yks-mc-add-new-field-to-list.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/* Main Template for generating a new field to attach to a list */
|
4 |
|
5 |
-
$api = new
|
6 |
parse_str( $p['form_data'], $formData );
|
7 |
$list_id = $formData['mc-list-id'];
|
8 |
$field_name = $formData['add-field-field-name'];
|
2 |
|
3 |
/* Main Template for generating a new field to attach to a list */
|
4 |
|
5 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
6 |
parse_str( $p['form_data'], $formData );
|
7 |
$list_id = $formData['mc-list-id'];
|
8 |
$field_name = $formData['add-field-field-name'];
|
lib/inc/yks-mc-frontend-form-display.php
CHANGED
@@ -53,7 +53,7 @@ based on the setting in the dashboard, table vs div
|
|
53 |
|
54 |
<tr class="yks-mailchimpFormTableRow yks-mc-tr-<?php echo sanitize_title( $field['label'] ); ?>" <?php if($field['active'] == 0) { echo 'style="display:none;"'; } ?>>
|
55 |
<td class="prompt yks-mailchimpFormTableRowLabel">
|
56 |
-
<label class="prompt yks-mailchimpFormTableRowLabel<?php echo $reqlabel; ?> yks-mc-label-<?php echo sanitize_title( $field['label'] ); ?>" for="<?php echo $field['id']; ?>"><?php echo apply_filters( 'yikes_mc_field_label' , $field['label'] ); ?><?php echo $reqindicator; ?></label>
|
57 |
<!-- run our function to generate the input fields for the form, passing in the field -->
|
58 |
<?php echo $this->getFrontendFormDisplay_field($field,$num); ?>
|
59 |
</td>
|
@@ -145,7 +145,7 @@ based on the setting in the dashboard, table vs div
|
|
145 |
}
|
146 |
?>
|
147 |
<div class="yks-mailchimpFormDivRow yks-mc-form-row-<?php echo sanitize_title( $field['label'] ); ?>" <?php if($field['active'] == 0) { echo 'style="display:none;"'; } ?>>
|
148 |
-
<label class="prompt yks-mailchimpFormDivRowLabel<?php echo $reqlabel; ?> yks-mc-label-<?php echo sanitize_title( $field['label'] ); ?>" for="<?php echo $field['id']; ?>"><?php echo apply_filters( 'yikes_mc_field_label' , $field['label'] ); ?><?php echo $reqindicator; ?></label>
|
149 |
<div class="yks-mailchimpFormDivRowField yks-mc-input-field-row-<?php echo sanitize_title( $field['label'] ); ?>">
|
150 |
<!-- run our function to generate the input fields for the form, passing in the field -->
|
151 |
<?php echo $this->getFrontendFormDisplay_field($field,$num); ?>
|
53 |
|
54 |
<tr class="yks-mailchimpFormTableRow yks-mc-tr-<?php echo sanitize_title( $field['label'] ); ?>" <?php if($field['active'] == 0) { echo 'style="display:none;"'; } ?>>
|
55 |
<td class="prompt yks-mailchimpFormTableRowLabel">
|
56 |
+
<label class="prompt yks-mailchimpFormTableRowLabel<?php echo $reqlabel; ?> yks-mc-label-<?php echo sanitize_title( $field['label'] ); ?>" for="<?php echo $field['id']; ?>"><?php echo apply_filters( 'yikes_mc_field_label' , stripslashes( $field['label'] ) ); ?><?php echo $reqindicator; ?></label>
|
57 |
<!-- run our function to generate the input fields for the form, passing in the field -->
|
58 |
<?php echo $this->getFrontendFormDisplay_field($field,$num); ?>
|
59 |
</td>
|
145 |
}
|
146 |
?>
|
147 |
<div class="yks-mailchimpFormDivRow yks-mc-form-row-<?php echo sanitize_title( $field['label'] ); ?>" <?php if($field['active'] == 0) { echo 'style="display:none;"'; } ?>>
|
148 |
+
<label class="prompt yks-mailchimpFormDivRowLabel<?php echo $reqlabel; ?> yks-mc-label-<?php echo sanitize_title( $field['label'] ); ?>" for="<?php echo $field['id']; ?>"><?php echo apply_filters( 'yikes_mc_field_label' , stripslashes( $field['label'] ) ); ?><?php echo $reqindicator; ?></label>
|
149 |
<div class="yks-mailchimpFormDivRowField yks-mc-input-field-row-<?php echo sanitize_title( $field['label'] ); ?>">
|
150 |
<!-- run our function to generate the input fields for the form, passing in the field -->
|
151 |
<?php echo $this->getFrontendFormDisplay_field($field,$num); ?>
|
lib/inc/yks-mc-manage-list-form-table.php
CHANGED
@@ -144,11 +144,24 @@ Included into class.yksemeBase.php around line 2541
|
|
144 |
<fieldset class="yks-mailchimp-interest-groups-container" id="yks-mailchimp-interest-groups-container_<?php echo $list['id']; ?>">
|
145 |
<?php $this->getListInterestGroups( $list['id'] ); ?>
|
146 |
</fieldset>
|
147 |
-
|
148 |
</td>
|
149 |
</tr>
|
150 |
|
151 |
</fieldset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
<!-- display redirect checkbox here -->
|
153 |
<tr valign="top">
|
154 |
<th scope="row"><label for="yks-mailchimp-url-redirect"><?php _e( 'Redirect User On Submission' , 'yikes-inc-easy-mailchimp-extender' ); ?></label></th>
|
144 |
<fieldset class="yks-mailchimp-interest-groups-container" id="yks-mailchimp-interest-groups-container_<?php echo $list['id']; ?>">
|
145 |
<?php $this->getListInterestGroups( $list['id'] ); ?>
|
146 |
</fieldset>
|
|
|
147 |
</td>
|
148 |
</tr>
|
149 |
|
150 |
</fieldset>
|
151 |
+
<!-- send welcome message (on a per list basis) -->
|
152 |
+
<tr valign="top">
|
153 |
+
<th scope="row"><label for="yks-mailchimp-send-welcome"><?php _e( 'Disable Welcome Email?' , 'yikes-inc-easy-mailchimp-extender' ); ?></label></th>
|
154 |
+
<td>
|
155 |
+
<span class="yks-mailchimp-send-welcome-checkbox-holder">
|
156 |
+
<input type="checkbox" name="yks_mailchimp_send_welcome_<?php echo $list['id']; ?>" class="yks_mailchimp_send_welcome" id="yks-mailchimp-send-welcome-<?php echo $list['id']; ?>" value="1" <?php if(isset($field['yks_mailchimp_send_welcome_'.$list['id']])) { echo ($field['yks_mailchimp_send_welcome_'.$list['id']] == 1 ? 'checked="checked"' : ''); } ?> />
|
157 |
+
<?php if( isset( $field['yks_mailchimp_send_welcome_'.$list['id']] ) && $field['yks_mailchimp_send_welcome_'.$list['id']] == '1' ) { ?>
|
158 |
+
<span class="description yks-margin-left"><?php _e( 'the welcome email will ' , 'yikes-inc-easy-mailchimp-extender' ); ?><strong><?php _e( 'not' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong><?php _e( ' be sent for this mailing list' , 'yikes-inc-easy-mailchimp-extender' ); ?></span>
|
159 |
+
<?php } else { ?>
|
160 |
+
<span class="description yks-margin-left"><?php _e( 'the welcome email will be sent for this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></span>
|
161 |
+
<?php } ?>
|
162 |
+
</span>
|
163 |
+
</td>
|
164 |
+
</tr>
|
165 |
<!-- display redirect checkbox here -->
|
166 |
<tr valign="top">
|
167 |
<th scope="row"><label for="yks-mailchimp-url-redirect"><?php _e( 'Redirect User On Submission' , 'yikes-inc-easy-mailchimp-extender' ); ?></label></th>
|
lib/inc/yks-mc-update-list-field.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
$field_type = $p['field_type'];
|
12 |
$field_default_value = $formData['add-field-default-value'];
|
13 |
|
14 |
-
$api = new
|
15 |
|
16 |
if ( $field_type == 'dropdown' || $field_type == 'radio' ) {
|
17 |
try {
|
11 |
$field_type = $p['field_type'];
|
12 |
$field_default_value = $formData['add-field-default-value'];
|
13 |
|
14 |
+
$api = new Mailchimp($this->optionVal['api-key']);
|
15 |
|
16 |
if ( $field_type == 'dropdown' || $field_type == 'radio' ) {
|
17 |
try {
|
pages/lists.php
CHANGED
@@ -131,7 +131,7 @@ To Do - 11.8 :
|
|
131 |
$('#yks-mailchimp-fields-list_'+i+' .yks-mailchimp-fields-list-row').each(function() {
|
132 |
var thisIndex = ($(this).index() + 1);
|
133 |
$(this).find('.yks-mailchimp-field-placeholder').find('input').attr('name', 'placeholder-'+i+'-'+thisIndex);
|
134 |
-
$(this).find('.yks-mailchimp-field-custom-field-class').find('input').attr('name', '
|
135 |
});
|
136 |
|
137 |
|
@@ -223,6 +223,8 @@ To Do - 11.8 :
|
|
223 |
dataType: 'json',
|
224 |
success: function(MAILCHIMP)
|
225 |
{
|
|
|
|
|
226 |
if(MAILCHIMP == '-1')
|
227 |
{
|
228 |
if ( theButton.parents('.yks-list-container').find('.yks-status-error').is(':visible') ) {
|
@@ -239,7 +241,7 @@ To Do - 11.8 :
|
|
239 |
} else {
|
240 |
theButton.parents('.yks-list-container').find('.yks-status').stop().slideDown().delay(3000).fadeOut();
|
241 |
}
|
242 |
-
|
243 |
}
|
244 |
},
|
245 |
error: function(MAILCHIMP)
|
@@ -330,6 +332,12 @@ To Do - 11.8 :
|
|
330 |
{
|
331 |
if(MAILCHIMP != '-1')
|
332 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
console.log(placeholder_array);
|
334 |
$('#yks_mc_reimporting_fields_dialog').dialog("destroy");
|
335 |
$($('#yks-mailchimp-fields-td_'+i)).replaceWith(MAILCHIMP);
|
@@ -844,7 +852,7 @@ To Do - 11.8 :
|
|
844 |
*/
|
845 |
// pass our mailchimp list id into the hidden input
|
846 |
// and populate the merge var name with a random string
|
847 |
-
jQuery( '
|
848 |
var mailchimp_list_id = jQuery(this).attr('alt');
|
849 |
setTimeout(function() {
|
850 |
jQuery( '#TB_ajaxContent' ).find( '#mc-list-id' ).val( mailchimp_list_id );
|
@@ -870,7 +878,7 @@ To Do - 11.8 :
|
|
870 |
|
871 |
// pass our mailchimp list id into the hidden input
|
872 |
// and populate the merge var name with a random string
|
873 |
-
jQuery( '
|
874 |
var mailchimp_list_id = jQuery(this).attr('alt');
|
875 |
setTimeout(function() {
|
876 |
jQuery( '#TB_ajaxContent' ).find( '#mc-list-id' ).val( mailchimp_list_id );
|
@@ -903,6 +911,16 @@ To Do - 11.8 :
|
|
903 |
jQuery( this ).attr( 'disabled' , 'disabled' );
|
904 |
});
|
905 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
906 |
jQuery( '.add-new-field' ).removeClass( 'create-this-field' );
|
907 |
jQuery(this).addClass( 'create-this-field' );
|
908 |
jQuery( '#TB_window' ).animate({
|
@@ -1227,8 +1245,7 @@ To Do - 11.8 :
|
|
1227 |
var list_data = $.parseJSON( jQuery( '#merge-field-data' ).val() );
|
1228 |
var mailchimp_list_id = jQuery(this).parents('form').find('.yks-mailchimp-import').attr('rel');
|
1229 |
var merge_tag = jQuery(this).parents( '.yks-mailchimp-fields-list-row' ).attr( 'alt' ).toLowerCase();
|
1230 |
-
|
1231 |
-
|
1232 |
// hide any previously established error messages
|
1233 |
jQuery( '.yks-mc-update-error' ).remove();
|
1234 |
|
@@ -1237,15 +1254,39 @@ To Do - 11.8 :
|
|
1237 |
var merge_name = list_data[mailchimp_list_id].fields[mailchimp_list_id+'-'+merge_tag].label;
|
1238 |
var merge_required = list_data[mailchimp_list_id].fields[mailchimp_list_id+'-'+merge_tag].require;
|
1239 |
var field_type = list_data[mailchimp_list_id].fields[mailchimp_list_id+'-'+merge_tag].type;
|
1240 |
-
|
1241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1242 |
dialogDiv.dialog({
|
1243 |
width: "50%",
|
1244 |
option: [ 'maxHeight' , 600 ],
|
1245 |
modal : true,
|
1246 |
draggable : false,
|
1247 |
resizable : false,
|
1248 |
-
title: "Update "+merge_name+" Field"
|
1249 |
});
|
1250 |
|
1251 |
// populate the form with the retreived data...
|
@@ -1254,7 +1295,6 @@ To Do - 11.8 :
|
|
1254 |
jQuery( '#updateMergeVariableContainer' ).find( '#mc-list-id' ).val( mailchimp_list_id );
|
1255 |
jQuery( '#updateMergeVariableContainer' ).find( '#old-merge-tag' ).val( merge_tag.toUpperCase() );
|
1256 |
jQuery( '#updateMergeVariableContainer' ).find( '#field-type-text' ).text( field_type.charAt(0).toUpperCase() + field_type.substring(1) );
|
1257 |
-
jQuery( '#updateMergeVariableContainer' ).find( '#update-field-custom-class' ).val( custom_class );
|
1258 |
|
1259 |
if ( merge_required == true ) { // field merge var
|
1260 |
jQuery( '.ui-dialog' ).find( '.update-field-field-required-yes' ).prop( 'checked' , 'checked' );
|
@@ -1331,8 +1371,6 @@ To Do - 11.8 :
|
|
1331 |
// append a preloader to the modal, for some feedback
|
1332 |
jQuery( '#yks-mailchimp-update-existing-field-form' ).find( 'input[type="submit"]').after( '<img src="<?php echo admin_url('/images/wpspin_light.gif'); ?>" alt="yks-mc-preloader" class="yks-mc-preloader" style="margin-left: .5em;">' );
|
1333 |
|
1334 |
-
var custom_class_value = jQuery( '#yks-mailchimp-update-existing-field-form' ).find( '#update-field-custom-class' ).val();
|
1335 |
-
|
1336 |
/* ajax update our existing field! */
|
1337 |
jQuery.ajax({
|
1338 |
type: "POST",
|
@@ -1572,13 +1610,13 @@ To Do - 11.8 :
|
|
1572 |
}, 250);
|
1573 |
|
1574 |
var dialogDiv = jQuery('#updateInterestGroupContianer');
|
|
|
1575 |
dialogDiv.dialog({
|
1576 |
width: "50%",
|
1577 |
option: [ 'maxHeight' , 600 ],
|
1578 |
modal : true,
|
1579 |
draggable : false,
|
1580 |
resizable : false,
|
1581 |
-
title: "Update "+group_name+" Group"
|
1582 |
});
|
1583 |
|
1584 |
|
@@ -1979,7 +2017,42 @@ To Do - 11.8 :
|
|
1979 |
return false;
|
1980 |
});
|
1981 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1982 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1983 |
/**
|
1984 |
Update The Interest Group Type On Dropdown Change
|
1985 |
Changes the interest group type eg Checkboxes => Radio Buttons
|
131 |
$('#yks-mailchimp-fields-list_'+i+' .yks-mailchimp-fields-list-row').each(function() {
|
132 |
var thisIndex = ($(this).index() + 1);
|
133 |
$(this).find('.yks-mailchimp-field-placeholder').find('input').attr('name', 'placeholder-'+i+'-'+thisIndex);
|
134 |
+
$(this).find('.yks-mailchimp-field-custom-field-class').find('input').attr('name', 'placeholder-'+i+'-'+thisIndex);
|
135 |
});
|
136 |
|
137 |
|
223 |
dataType: 'json',
|
224 |
success: function(MAILCHIMP)
|
225 |
{
|
226 |
+
// console.log(MAILCHIMP);
|
227 |
+
// alert($(f).serialize());
|
228 |
if(MAILCHIMP == '-1')
|
229 |
{
|
230 |
if ( theButton.parents('.yks-list-container').find('.yks-status-error').is(':visible') ) {
|
241 |
} else {
|
242 |
theButton.parents('.yks-list-container').find('.yks-status').stop().slideDown().delay(3000).fadeOut();
|
243 |
}
|
244 |
+
// console.log(MAILCHIMP);
|
245 |
}
|
246 |
},
|
247 |
error: function(MAILCHIMP)
|
332 |
{
|
333 |
if(MAILCHIMP != '-1')
|
334 |
{
|
335 |
+
/* Preserve Custom Classes on reimport
|
336 |
+
var placeholder_array = [];
|
337 |
+
jQuery( '#yks-mailchimp-fields-list_'+i ).find( '.custom-placeholder-field' ).each(function() {
|
338 |
+
console.log( jQuery( this ).val() );
|
339 |
+
});
|
340 |
+
*/
|
341 |
console.log(placeholder_array);
|
342 |
$('#yks_mc_reimporting_fields_dialog').dialog("destroy");
|
343 |
$($('#yks-mailchimp-fields-td_'+i)).replaceWith(MAILCHIMP);
|
852 |
*/
|
853 |
// pass our mailchimp list id into the hidden input
|
854 |
// and populate the merge var name with a random string
|
855 |
+
jQuery( '.add-new-field-thickbox-open' ).click(function() {
|
856 |
var mailchimp_list_id = jQuery(this).attr('alt');
|
857 |
setTimeout(function() {
|
858 |
jQuery( '#TB_ajaxContent' ).find( '#mc-list-id' ).val( mailchimp_list_id );
|
878 |
|
879 |
// pass our mailchimp list id into the hidden input
|
880 |
// and populate the merge var name with a random string
|
881 |
+
jQuery( '.add-new-group-thickbox-open' ).click(function() {
|
882 |
var mailchimp_list_id = jQuery(this).attr('alt');
|
883 |
setTimeout(function() {
|
884 |
jQuery( '#TB_ajaxContent' ).find( '#mc-list-id' ).val( mailchimp_list_id );
|
911 |
jQuery( this ).attr( 'disabled' , 'disabled' );
|
912 |
});
|
913 |
|
914 |
+
|
915 |
+
/*
|
916 |
+
if ( required_setting == true ) {
|
917 |
+
jQuery( '#merge-variable-settings' ).find( '.add-field-public-yes' ).prop( 'checked' , true );
|
918 |
+
jQuery( '#merge-variable-settings' ).find( 'input[name="add-field-public"]' ).each(function() {
|
919 |
+
jQuery( this ).attr( 'disabled' );
|
920 |
+
});
|
921 |
+
}
|
922 |
+
*/
|
923 |
+
|
924 |
jQuery( '.add-new-field' ).removeClass( 'create-this-field' );
|
925 |
jQuery(this).addClass( 'create-this-field' );
|
926 |
jQuery( '#TB_window' ).animate({
|
1245 |
var list_data = $.parseJSON( jQuery( '#merge-field-data' ).val() );
|
1246 |
var mailchimp_list_id = jQuery(this).parents('form').find('.yks-mailchimp-import').attr('rel');
|
1247 |
var merge_tag = jQuery(this).parents( '.yks-mailchimp-fields-list-row' ).attr( 'alt' ).toLowerCase();
|
1248 |
+
|
|
|
1249 |
// hide any previously established error messages
|
1250 |
jQuery( '.yks-mc-update-error' ).remove();
|
1251 |
|
1254 |
var merge_name = list_data[mailchimp_list_id].fields[mailchimp_list_id+'-'+merge_tag].label;
|
1255 |
var merge_required = list_data[mailchimp_list_id].fields[mailchimp_list_id+'-'+merge_tag].require;
|
1256 |
var field_type = list_data[mailchimp_list_id].fields[mailchimp_list_id+'-'+merge_tag].type;
|
1257 |
+
|
1258 |
+
// if the field type is 'email',
|
1259 |
+
// we should disable the "Field Name" field , as this can't be altered.
|
1260 |
+
// this needs to be changed via the 'yikes_mc_field_label' filter (see readme.txt or yks-mc-frontend-form-display.php ~line 148)
|
1261 |
+
if( field_type == 'email' ) {
|
1262 |
+
|
1263 |
+
jQuery( '#updateMergeVariableContainer' ).find( 'label[for="add-field-field-name"]' ).parents( '.form-table' ).before( "<span class='yks-mc-update-error email-mv-error' style='display:block;width:100%;color:rgb(249, 141, 141);margin:.5em 0;'>You cannot update the EMAIL merge variable. If you'd like to change the field name/label, please use the yikes_mc_field_label filter. ( see readme.txt for example )</span>" );
|
1264 |
+
|
1265 |
+
jQuery( '#updateMergeVariableContainer' ).find( '#add-field-field-name' ).attr( 'disabled' , 'disabled' );
|
1266 |
+
jQuery( '#updateMergeVariableContainer' ).find( '#add-field-field-merge-tag' ).attr( 'disabled' , 'disabled' );
|
1267 |
+
jQuery( '#updateMergeVariableContainer' ).find( '.update-field-field-required-yes' ).attr( 'disabled' , 'disabled' );
|
1268 |
+
jQuery( '#updateMergeVariableContainer' ).find( '.update-field-field-required-no' ).attr( 'disabled' , 'disabled' );
|
1269 |
+
jQuery( '#updateMergeVariableContainer' ).find( 'input[type="submit"]' ).attr( 'disabled' , 'disabled' );
|
1270 |
+
} else {
|
1271 |
+
jQuery( '#updateMergeVariableContainer' ).find( '.email-mv-error' ).remove();
|
1272 |
+
jQuery( '#updateMergeVariableContainer' ).find( '#add-field-field-name' ).removeAttr( 'disabled' );
|
1273 |
+
jQuery( '#updateMergeVariableContainer' ).find( '#add-field-field-merge-tag' ).removeAttr( 'disabled' );
|
1274 |
+
jQuery( '#updateMergeVariableContainer' ).find( '.update-field-field-required-yes' ).removeAttr( 'disabled' );
|
1275 |
+
jQuery( '#updateMergeVariableContainer' ).find( '.update-field-field-required-no' ).removeAttr( 'disabled' );
|
1276 |
+
jQuery( '#updateMergeVariableContainer' ).find( 'input[type="submit"]' ).removeAttr( 'disabled' );
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
console.log("TYPE : " + list_data[mailchimp_list_id].fields[mailchimp_list_id+'-'+merge_tag].type );
|
1280 |
+
console.log(list_data);
|
1281 |
+
|
1282 |
+
var dialogDiv = $('#updateMergeVariableContainer');
|
1283 |
+
dialogDiv.attr("Title", "Update "+merge_name+" Field");
|
1284 |
dialogDiv.dialog({
|
1285 |
width: "50%",
|
1286 |
option: [ 'maxHeight' , 600 ],
|
1287 |
modal : true,
|
1288 |
draggable : false,
|
1289 |
resizable : false,
|
|
|
1290 |
});
|
1291 |
|
1292 |
// populate the form with the retreived data...
|
1295 |
jQuery( '#updateMergeVariableContainer' ).find( '#mc-list-id' ).val( mailchimp_list_id );
|
1296 |
jQuery( '#updateMergeVariableContainer' ).find( '#old-merge-tag' ).val( merge_tag.toUpperCase() );
|
1297 |
jQuery( '#updateMergeVariableContainer' ).find( '#field-type-text' ).text( field_type.charAt(0).toUpperCase() + field_type.substring(1) );
|
|
|
1298 |
|
1299 |
if ( merge_required == true ) { // field merge var
|
1300 |
jQuery( '.ui-dialog' ).find( '.update-field-field-required-yes' ).prop( 'checked' , 'checked' );
|
1371 |
// append a preloader to the modal, for some feedback
|
1372 |
jQuery( '#yks-mailchimp-update-existing-field-form' ).find( 'input[type="submit"]').after( '<img src="<?php echo admin_url('/images/wpspin_light.gif'); ?>" alt="yks-mc-preloader" class="yks-mc-preloader" style="margin-left: .5em;">' );
|
1373 |
|
|
|
|
|
1374 |
/* ajax update our existing field! */
|
1375 |
jQuery.ajax({
|
1376 |
type: "POST",
|
1610 |
}, 250);
|
1611 |
|
1612 |
var dialogDiv = jQuery('#updateInterestGroupContianer');
|
1613 |
+
dialogDiv.attr("Title", "Update "+group_name+" Group");
|
1614 |
dialogDiv.dialog({
|
1615 |
width: "50%",
|
1616 |
option: [ 'maxHeight' , 600 ],
|
1617 |
modal : true,
|
1618 |
draggable : false,
|
1619 |
resizable : false,
|
|
|
1620 |
});
|
1621 |
|
1622 |
|
2017 |
return false;
|
2018 |
});
|
2019 |
|
2020 |
+
|
2021 |
+
/*
|
2022 |
+
* Clear our Error Log
|
2023 |
+
*
|
2024 |
+
* since v5.2
|
2025 |
+
*/
|
2026 |
+
jQuery( 'body' ).on( 'click' , '.clear-yt4wp-error-log' , function() {
|
2027 |
+
|
2028 |
+
jQuery( '#yt4wp-error-log-table' ).fadeTo( 'fast' , .5 );
|
2029 |
|
2030 |
+
jQuery.ajax({
|
2031 |
+
type: 'POST',
|
2032 |
+
url: ajaxurl,
|
2033 |
+
data: {
|
2034 |
+
action: 'yks_mailchimp_form',
|
2035 |
+
form_action: 'clear_yks_mc_error_log'
|
2036 |
+
},
|
2037 |
+
dataType: 'json',
|
2038 |
+
success: function (response) {
|
2039 |
+
setTimeout(function() {
|
2040 |
+
jQuery( '#yks-mc-error-log-table' ).fadeOut( 'fast' , function() {
|
2041 |
+
jQuery( '.clear-yks-mc-error-log' ).attr( 'disabled' , 'disabled' );
|
2042 |
+
setTimeout(function() {
|
2043 |
+
jQuery( '.yks-mc-error-log-table-row' ).html( '<em>no errors logged</em>' );
|
2044 |
+
}, 250 );
|
2045 |
+
});
|
2046 |
+
}, 1000 );
|
2047 |
+
},
|
2048 |
+
error : function(error_response) {
|
2049 |
+
alert( 'There was an error with your request. Unable to clear the erorr log!' );
|
2050 |
+
console.log(error_response.responseText);
|
2051 |
+
jQuery( '#yt4wp-error-log-table' ).fadeTo( 'fast' , 1 );
|
2052 |
+
}
|
2053 |
+
});
|
2054 |
+
});
|
2055 |
+
|
2056 |
/**
|
2057 |
Update The Interest Group Type On Dropdown Change
|
2058 |
Changes the interest group type eg Checkboxes => Radio Buttons
|
pages/options.php
CHANGED
@@ -328,25 +328,7 @@ jQuery(document).ready(function() {
|
|
328 |
<?php
|
329 |
$api_key_option = get_option( 'api_validation' );
|
330 |
$wordPress_version = get_bloginfo( 'version' );
|
331 |
-
|
332 |
-
// set up the options for our WYSIWYG editors
|
333 |
-
// for the optin messages
|
334 |
-
$single_optin_message_parameters = array(
|
335 |
-
'teeny' => true,
|
336 |
-
'textarea_rows' => 15,
|
337 |
-
'tabindex' => 1,
|
338 |
-
'textarea_name' => 'single-optin-message',
|
339 |
-
'drag_drop_upload' => true
|
340 |
-
);
|
341 |
-
|
342 |
-
$double_optin_message_parameters = array(
|
343 |
-
'teeny' => true,
|
344 |
-
'textarea_rows' => 15,
|
345 |
-
'tabindex' => 1,
|
346 |
-
'textarea_name' => 'double-optin-message',
|
347 |
-
'drag_drop_upload' => true
|
348 |
-
);
|
349 |
-
|
350 |
// used to dictate the active tab
|
351 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'form_options';
|
352 |
?>
|
@@ -465,11 +447,11 @@ jQuery(document).ready(function() {
|
|
465 |
<th scope="row"><label for="yks-mailchimp-custom-optIn-message"><?php _e('Success Message','yikes-inc-easy-mailchimp-extender'); ?></label></th>
|
466 |
<td>
|
467 |
<label for="double-optin-message" <?php if ($this->optionVal['optin'] == 'false') { echo 'style="display:none;"'; } ?>><b><?php _e('Double Opt-In Message','yikes-inc-easy-mailchimp-extender'); ?></b>
|
468 |
-
|
469 |
</label>
|
470 |
|
471 |
<label for="single-optin-message" <?php if ($this->optionVal['optin'] == 'true') { echo 'style="display:none;"'; } ?>><b><?php _e('Single Opt-In Message','yikes-inc-easy-mailchimp-extender'); ?></b>
|
472 |
-
|
473 |
</label>
|
474 |
|
475 |
</td>
|
328 |
<?php
|
329 |
$api_key_option = get_option( 'api_validation' );
|
330 |
$wordPress_version = get_bloginfo( 'version' );
|
331 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
// used to dictate the active tab
|
333 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'form_options';
|
334 |
?>
|
447 |
<th scope="row"><label for="yks-mailchimp-custom-optIn-message"><?php _e('Success Message','yikes-inc-easy-mailchimp-extender'); ?></label></th>
|
448 |
<td>
|
449 |
<label for="double-optin-message" <?php if ($this->optionVal['optin'] == 'false') { echo 'style="display:none;"'; } ?>><b><?php _e('Double Opt-In Message','yikes-inc-easy-mailchimp-extender'); ?></b>
|
450 |
+
<textarea id="double_optin_message" name="double-optin-message" style="display:block;width:450px;resize:vertical;min-height:150px;"><?php echo stripslashes( $this->optionVal['double-optin-message'] ); ?></textarea>
|
451 |
</label>
|
452 |
|
453 |
<label for="single-optin-message" <?php if ($this->optionVal['optin'] == 'true') { echo 'style="display:none;"'; } ?>><b><?php _e('Single Opt-In Message','yikes-inc-easy-mailchimp-extender'); ?></b>
|
454 |
+
<textarea id="single_optin_message" name="single-optin-message" style="display:block;width:450px;resize:vertical;min-height:150px;"><?php echo stripslashes( $this->optionVal['single-optin-message'] ); ?></textarea>
|
455 |
</label>
|
456 |
|
457 |
</td>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://yikesinc.com
|
|
4 |
Tags: mailchimp, marketing, email, mailing lists, newsletter, sign up, forms, sign up form
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 5.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Easy MailChimp Forms allows you to painlessly add MailChimp sign up forms to your WordPress site and track user activity with interactive reports.
|
@@ -835,6 +835,16 @@ These functions should be used in conjunction with the `yikes_mc_get_form_data`
|
|
835 |
|
836 |
== Changelog ==
|
837 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
838 |
= 5.3.3 - February 26th, 2015 =
|
839 |
|
840 |
* Enhancement: Added a new filter to alter field labels. Very helpful when you want to alter the default 'Email Address' field label to something else. (`yikes_mc_field_label`) (see 'filters' section in 'Other Notes')
|
@@ -1113,6 +1123,15 @@ These functions should be used in conjunction with the `yikes_mc_get_form_data`
|
|
1113 |
|
1114 |
== Upgrade Notice ==
|
1115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1116 |
= 5.3.3 - February 26th, 2015 =
|
1117 |
* Enhancement: Added a new filter to alter field labels. Very helpful when you want to alter the default 'Email Address' field label to something else. (`yikes_mc_field_label`) (see 'filters' section in 'Other Notes')
|
1118 |
|
4 |
Tags: mailchimp, marketing, email, mailing lists, newsletter, sign up, forms, sign up form
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 5.4
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Easy MailChimp Forms allows you to painlessly add MailChimp sign up forms to your WordPress site and track user activity with interactive reports.
|
835 |
|
836 |
== Changelog ==
|
837 |
|
838 |
+
= 5.4 - March 2nd, 2015 =
|
839 |
+
|
840 |
+
* Enhancement: Re-bundled unaltered MailChimp API wrapper class file, and added appropriate class check to prevent conflicts with other MailChimp plugins (Gravity Forms etc.)
|
841 |
+
* Enhancement: Removed the WYSIWYG editor from the options page. This caused issues for some users who were unable to validate the MailChimp API key.
|
842 |
+
* Enhancement: Added a new setting to toggle the sending of the welcome email. Users can now disable the email all together, on a list by list basis. (checked = disabled)
|
843 |
+
* Enhancement: Prevented users from being able to update the 'EMAIL' merge variable. Added a notification with instruction on what filter to use.
|
844 |
+
* Enhancement: Replced all instances of the old class name (wpyksMCAPI) with the appropriate MailChimp class (Mailchimp)
|
845 |
+
* Enhancement: Stripped slashes and properly escaped interest group labels
|
846 |
+
|
847 |
+
|
848 |
= 5.3.3 - February 26th, 2015 =
|
849 |
|
850 |
* Enhancement: Added a new filter to alter field labels. Very helpful when you want to alter the default 'Email Address' field label to something else. (`yikes_mc_field_label`) (see 'filters' section in 'Other Notes')
|
1123 |
|
1124 |
== Upgrade Notice ==
|
1125 |
|
1126 |
+
= 5.4 - March 2nd, 2015 =
|
1127 |
+
* Enhancement: Re-bundled unaltered MailChimp API wrapper class file, and added appropriate class check to prevent conflicts with other MailChimp plugins (Gravity Forms etc.)
|
1128 |
+
* Enhancement: Removed the WYSIWYG editor from the options page. This caused issues for some users who were unable to validate the MailChimp API key.
|
1129 |
+
* Enhancement: Added a new setting to toggle the sending of the welcome email. Users can now disable the email all together, on a list by list basis. (checked = disabled)
|
1130 |
+
* Enhancement: Prevented users from being able to update the 'EMAIL' merge variable. Added a notification with instruction on what filter to use.
|
1131 |
+
* Enhancement: Replced all instances of the old class name (wpyksMCAPI) with the appropriate MailChimp class (Mailchimp)
|
1132 |
+
* Enhancement: Stripped slashes and properly escaped interest group labels
|
1133 |
+
|
1134 |
+
|
1135 |
= 5.3.3 - February 26th, 2015 =
|
1136 |
* Enhancement: Added a new filter to alter field labels. Very helpful when you want to alter the default 'Email Address' field label to something else. (`yikes_mc_field_label`) (see 'filters' section in 'Other Notes')
|
1137 |
|
yikes-inc-easy-mailchimp-extender.php
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
Plugin Name: Easy MailChimp Forms
|
5 |
Plugin URI: http://www.yikesinc.com/services/yikes-inc-easy-mailchimp-extender/
|
6 |
Description: Mailchimp integration in the form of a shortcode, php snippet or widget. Now track account status, campaign stats, view subscribers and so much more!
|
7 |
-
Version: 5.
|
8 |
Author: YIKES Inc
|
9 |
Author URI: http://yikesinc.com
|
10 |
-
License:
|
11 |
|
12 |
#_________________________________________________ LICENSE
|
13 |
Copyright 2012-14 YIKES, Inc (email : tech@yikesinc.com)
|
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
30 |
|
31 |
/** Configuration **/
|
32 |
if(!defined('YKSEME_DEBUG')) define('YKSEME_DEBUG', false);
|
33 |
-
if(!defined('YKSEME_VERSION_CURRENT')) define('YKSEME_VERSION_CURRENT', '5.
|
34 |
if(!defined('YKSEME_REQ_PHP')) define('YKSEME_REQ_PHP', '5.0');
|
35 |
if(!defined('YKSEME_AUTHOR')) define('YKSEME_AUTHOR', 'YIKES Inc');
|
36 |
if(!defined('YKSEME_SITE')) define('YKSEME_SITE', site_url().'/');
|
4 |
Plugin Name: Easy MailChimp Forms
|
5 |
Plugin URI: http://www.yikesinc.com/services/yikes-inc-easy-mailchimp-extender/
|
6 |
Description: Mailchimp integration in the form of a shortcode, php snippet or widget. Now track account status, campaign stats, view subscribers and so much more!
|
7 |
+
Version: 5.4
|
8 |
Author: YIKES Inc
|
9 |
Author URI: http://yikesinc.com
|
10 |
+
License: GPL3
|
11 |
|
12 |
#_________________________________________________ LICENSE
|
13 |
Copyright 2012-14 YIKES, Inc (email : tech@yikesinc.com)
|
30 |
|
31 |
/** Configuration **/
|
32 |
if(!defined('YKSEME_DEBUG')) define('YKSEME_DEBUG', false);
|
33 |
+
if(!defined('YKSEME_VERSION_CURRENT')) define('YKSEME_VERSION_CURRENT', '5.4');
|
34 |
if(!defined('YKSEME_REQ_PHP')) define('YKSEME_REQ_PHP', '5.0');
|
35 |
if(!defined('YKSEME_AUTHOR')) define('YKSEME_AUTHOR', 'YIKES Inc');
|
36 |
if(!defined('YKSEME_SITE')) define('YKSEME_SITE', site_url().'/');
|