Bronto_Extension - Version 2.0.4.2

Version Notes

This is the first release of a new Bronto extension that replaces and deprecates the "Bronto Order Import for Magento," "Bronto Shopping Cart Abandonment," and "Bronto Newsletter Opt-In" extensions. All of the functionality of those extensions is included in this Bronto Extension for Magento.

For installation and configuration instructions, as well as a full list of new features and known issues, please review the Implementation Guide.

Download this release

Release Info

Developer Chris Geiss
Extension Bronto_Extension
Version 2.0.4.2
Comparing to
See all releases


Code changes from version 2.0.4.1 to 2.0.4.2

Files changed (67) hide show
  1. app/code/community/Bronto/Common/etc/config.xml +1 -1
  2. lib/Bronto/Api.php +620 -0
  3. lib/Bronto/Api/Account.php +58 -0
  4. lib/Bronto/Api/Account/Exception.php +13 -0
  5. lib/Bronto/Api/Account/Row.php +24 -0
  6. lib/Bronto/Api/Activity.php +216 -0
  7. lib/Bronto/Api/Activity/Exception.php +12 -0
  8. lib/Bronto/Api/Activity/Row.php +139 -0
  9. lib/Bronto/Api/ApiToken.php +129 -0
  10. lib/Bronto/Api/ApiToken/Exception.php +9 -0
  11. lib/Bronto/Api/ApiToken/Row.php +83 -0
  12. lib/Bronto/Api/Contact.php +107 -0
  13. lib/Bronto/Api/Contact/Exception.php +23 -0
  14. lib/Bronto/Api/Contact/Row.php +399 -0
  15. lib/Bronto/Api/ContentTag.php +45 -0
  16. lib/Bronto/Api/ContentTag/Exception.php +14 -0
  17. lib/Bronto/Api/ContentTag/Row.php +59 -0
  18. lib/Bronto/Api/Conversion.php +46 -0
  19. lib/Bronto/Api/Conversion/Exception.php +11 -0
  20. lib/Bronto/Api/Conversion/Row.php +105 -0
  21. lib/Bronto/Api/Delivery.php +86 -0
  22. lib/Bronto/Api/Delivery/Exception.php +23 -0
  23. lib/Bronto/Api/Delivery/Recipient.php +22 -0
  24. lib/Bronto/Api/Delivery/Row.php +238 -0
  25. lib/Bronto/Api/DeliveryGroup.php +100 -0
  26. lib/Bronto/Api/DeliveryGroup/Exception.php +21 -0
  27. lib/Bronto/Api/DeliveryGroup/Row.php +58 -0
  28. lib/Bronto/Api/Exception.php +249 -0
  29. lib/Bronto/Api/Field.php +136 -0
  30. lib/Bronto/Api/Field/Exception.php +18 -0
  31. lib/Bronto/Api/Field/Predefined.php +306 -0
  32. lib/Bronto/Api/Field/Row.php +62 -0
  33. lib/Bronto/Api/Field/TypeGuesser.php +129 -0
  34. lib/Bronto/Api/List.php +57 -0
  35. lib/Bronto/Api/List/Exception.php +19 -0
  36. lib/Bronto/Api/List/Row.php +128 -0
  37. lib/Bronto/Api/Login.php +46 -0
  38. lib/Bronto/Api/Login/ContactInformation.php +93 -0
  39. lib/Bronto/Api/Login/Exception.php +10 -0
  40. lib/Bronto/Api/Login/Row.php +39 -0
  41. lib/Bronto/Api/Message.php +38 -0
  42. lib/Bronto/Api/Message/Exception.php +24 -0
  43. lib/Bronto/Api/Message/Row.php +84 -0
  44. lib/Bronto/Api/MessageRule.php +43 -0
  45. lib/Bronto/Api/MessageRule/Exception.php +14 -0
  46. lib/Bronto/Api/MessageRule/Row.php +60 -0
  47. lib/Bronto/Api/Object.php +582 -0
  48. lib/Bronto/Api/Order.php +21 -0
  49. lib/Bronto/Api/Order/Exception.php +10 -0
  50. lib/Bronto/Api/Order/Product.php +68 -0
  51. lib/Bronto/Api/Order/Row.php +86 -0
  52. lib/Bronto/Api/Row.php +732 -0
  53. lib/Bronto/Api/Row/Exception.php +10 -0
  54. lib/Bronto/Api/Rowset.php +397 -0
  55. lib/Bronto/Api/Rowset/Exception.php +11 -0
  56. lib/Bronto/Api/Rowset/Iterator.php +406 -0
  57. lib/Bronto/Api/Segment.php +38 -0
  58. lib/Bronto/Api/Segment/Exception.php +11 -0
  59. lib/Bronto/Api/Segment/Row.php +71 -0
  60. lib/Bronto/SoapClient.php +25 -0
  61. lib/Bronto/Util/Colors.php +196 -0
  62. lib/Bronto/Util/CountryCodes.php +260 -0
  63. lib/Bronto/Util/Retryer/FileRetryer.php +126 -0
  64. lib/Bronto/Util/Retryer/RetryerException.php +9 -0
  65. lib/Bronto/Util/Retryer/RetryerInterface.php +20 -0
  66. lib/Bronto/Util/Uuid.php +78 -0
  67. package.xml +8 -6
app/code/community/Bronto/Common/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Bronto_Common>
5
- <version>2.0.4.1</version>
6
  </Bronto_Common>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Bronto_Common>
5
+ <version>2.0.4.2</version>
6
  </Bronto_Common>
7
  </modules>
8
  <global>
lib/Bronto/Api.php ADDED
@@ -0,0 +1,620 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ */
8
+ class Bronto_Api
9
+ {
10
+ /** URI */
11
+ const BASE_WSDL = 'https://api.bronto.com/v4?wsdl';
12
+ const BASE_LOCATION = 'https://api.bronto.com/v4';
13
+ const BASE_URL = 'http://api.bronto.com/v4';
14
+
15
+ /**
16
+ * @var SoapClient
17
+ */
18
+ protected $_soapClient;
19
+
20
+ /**
21
+ * API token
22
+ *
23
+ * @var string
24
+ */
25
+ protected $_token;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ protected $_options = array(
31
+ // Bronto
32
+ 'soap_client' => 'Bronto_SoapClient',
33
+ 'refresh_on_save' => false,
34
+ 'retry_limit' => 5,
35
+ 'debug' => false,
36
+ 'retryer' => array(
37
+ 'type' => null,
38
+ 'path' => null,
39
+ ),
40
+ // SoapClient
41
+ 'soap_version' => SOAP_1_1,
42
+ 'compression' => true,
43
+ 'encoding' => 'UTF-8',
44
+ 'trace' => false,
45
+ 'exceptions' => true,
46
+ 'cache_wsdl' => WSDL_CACHE_BOTH,
47
+ 'user_agent' => 'Bronto_Api <https://github.com/leek/bronto_service>',
48
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
49
+ 'connection_timeout' => 30,
50
+ );
51
+
52
+ /**
53
+ * Cache of class objects
54
+ *
55
+ * @var array
56
+ */
57
+ protected $_classCache = array();
58
+
59
+ /**
60
+ * @var bool
61
+ */
62
+ protected $_connected = false;
63
+
64
+ /**
65
+ * @var bool
66
+ */
67
+ protected $_authenticated = false;
68
+
69
+ /**
70
+ * @var Bronto_Util_Retryer_RetryerInterface
71
+ */
72
+ protected $_retryer;
73
+
74
+ /**
75
+ * @var Bronto_Util_Uuid
76
+ */
77
+ protected $_uuid;
78
+
79
+ /**
80
+ * @param string $token
81
+ * @param array $options
82
+ */
83
+ public function __construct($token = null, array $options = array())
84
+ {
85
+ if (!extension_loaded('soap')) {
86
+ throw new Bronto_Api_Exception('SOAP extension is not loaded.');
87
+ }
88
+
89
+ if (!extension_loaded('openssl')) {
90
+ throw new Bronto_Api_Exception('OpenSSL extension is not loaded.');
91
+ }
92
+
93
+ $this->_options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
94
+ $this->_setOptions($options);
95
+
96
+ if ($token !== null) {
97
+ $this->setToken($token);
98
+ }
99
+
100
+ ini_set('default_socket_timeout', 120);
101
+ }
102
+
103
+ /**
104
+ * Login with API token
105
+ *
106
+ * @return Bronto_Api
107
+ */
108
+ public function login()
109
+ {
110
+ $token = $this->getToken();
111
+ if (empty($token)) {
112
+ throw new Bronto_Api_Exception('Token is empty or invalid.', Bronto_Api_Exception::NO_TOKEN);
113
+ }
114
+
115
+ try {
116
+ // Get a new SoapClient
117
+ $this->reset();
118
+ $client = $this->getSoapClient(false);
119
+ $sessionId = $client->login(array('apiToken' => $token))->return;
120
+ $client->__setSoapHeaders(array(
121
+ new SoapHeader(self::BASE_URL, 'sessionHeader', array('sessionId' => $sessionId))
122
+ ));
123
+ $this->_authenticated = true;
124
+ } catch (Exception $e) {
125
+ $this->throwException($e);
126
+ }
127
+
128
+ return $this;
129
+ }
130
+
131
+ /**
132
+ * We want all Exceptions to be Bronto_Api_Exception for request/response
133
+ *
134
+ * @param string|Exception $exception
135
+ * @param string $message
136
+ * @param string $code
137
+ * @return Bronto_Api_Exception
138
+ */
139
+ public function throwException($exception, $message = null, $code = null)
140
+ {
141
+ if ($exception instanceOf Exception) {
142
+ if ($exception instanceOf Bronto_Api_Exception) {
143
+ // Good
144
+ } else {
145
+ // Convert
146
+ $exception = new Bronto_Api_Exception($exception->getMessage(), $exception->getCode(), null, $exception);
147
+ }
148
+ } else {
149
+ if (is_string($exception)) {
150
+ if (class_exists($exception, false)) {
151
+ $exception = new $exception($message, $code);
152
+ } else {
153
+ $exception = new Bronto_Api_Exception($exception);
154
+ }
155
+ }
156
+ }
157
+
158
+ // For tracking request/response in debug mode
159
+ if ($this->getDebug()) {
160
+ /* @var $exception Bronto_Api_Exception */
161
+ $exception->setRequest($this->getLastRequest());
162
+ $exception->setResponse($this->getLastResponse());
163
+ }
164
+
165
+ throw $exception;
166
+ }
167
+
168
+ /**
169
+ * Set API token
170
+ *
171
+ * @param string $token
172
+ * @return Bronto_Api
173
+ */
174
+ public function setToken($token)
175
+ {
176
+ $this->reset();
177
+ $this->_token = $token;
178
+ return $this;
179
+ }
180
+
181
+ /**
182
+ * Get token
183
+ *
184
+ * @return string
185
+ */
186
+ public function getToken()
187
+ {
188
+ return $this->_token;
189
+ }
190
+
191
+ /**
192
+ * @return Bronto_Api_ApiToken_Row
193
+ */
194
+ public function getTokenInfo()
195
+ {
196
+ $apiToken = $this->getApiTokenObject()->createRow();
197
+ $apiToken->id = $this->getToken();
198
+ $apiToken->read();
199
+
200
+ return $apiToken;
201
+ }
202
+
203
+ /**
204
+ * @param array $options
205
+ * @return Bronto_Api
206
+ */
207
+ protected function _setOptions(array $options = array())
208
+ {
209
+ foreach ($options as $name => $value) {
210
+ $this->_setOption($name, $value);
211
+ }
212
+ return $this;
213
+ }
214
+
215
+ /**
216
+ * @param string $name
217
+ * @param mixed $value
218
+ * @return Bronto_Api
219
+ */
220
+ protected function _setOption($name, $value)
221
+ {
222
+ if (isset($this->_options[$name])) {
223
+ // Some settings need checked
224
+ switch ($name) {
225
+ case 'soap_client':
226
+ if (!class_exists($value)) {
227
+ $this->throwException("Unable to load class: {$value} as SoapClient.");
228
+ }
229
+ break;
230
+ case 'soap_version':
231
+ if (!in_array($value, array(SOAP_1_1, SOAP_1_2))) {
232
+ $this->throwException('Invalid soap_version value specified. Use SOAP_1_1 or SOAP_1_2 constants.');
233
+ }
234
+ break;
235
+ case 'cache_wsdl':
236
+ if (!in_array($value, array(WSDL_CACHE_NONE, WSDL_CACHE_DISK, WSDL_CACHE_MEMORY, WSDL_CACHE_BOTH))) {
237
+ $this->throwException('Invalid cache_wsdl value specified.');
238
+ }
239
+ // If debug mode, ignore WSDL cache setting
240
+ if ($this->getDebug()) {
241
+ $value = WSDL_CACHE_NONE;
242
+ }
243
+ break;
244
+ case 'debug':
245
+ if ($value == true) {
246
+ $this->_options['trace'] = true;
247
+ $this->_options['cache_wsdl'] = WSDL_CACHE_NONE;
248
+ }
249
+ break;
250
+ }
251
+
252
+ $this->_options[$name] = $value;
253
+ }
254
+ return $this;
255
+ }
256
+
257
+ /**
258
+ * @param string $name
259
+ * @param mixed $default
260
+ * @return mixed
261
+ */
262
+ public function getOption($name, $default = null)
263
+ {
264
+ if (isset($this->_options[$name])) {
265
+ return $this->_options[$name];
266
+ }
267
+ return $default;
268
+ }
269
+
270
+ /**
271
+ * Proxy for intellisense
272
+ *
273
+ * @return Bronto_Api_Account
274
+ */
275
+ public function getAccountObject()
276
+ {
277
+ return $this->getObject('account');
278
+ }
279
+
280
+ /**
281
+ * Proxy for intellisense
282
+ *
283
+ * @return Bronto_Api_Activity
284
+ */
285
+ public function getActivityObject()
286
+ {
287
+ return $this->getObject('activity');
288
+ }
289
+
290
+ /**
291
+ * Proxy for intellisense
292
+ *
293
+ * @return Bronto_Api_ApiToken
294
+ */
295
+ public function getApiTokenObject()
296
+ {
297
+ return $this->getObject('apiToken');
298
+ }
299
+
300
+ /**
301
+ * Proxy for intellisense
302
+ *
303
+ * @return Bronto_Api_Contact
304
+ */
305
+ public function getContactObject()
306
+ {
307
+ return $this->getObject('contact');
308
+ }
309
+
310
+ /**
311
+ * Proxy for intellisense
312
+ *
313
+ * @return Bronto_Api_ContentTag
314
+ */
315
+ public function getContentTagObject()
316
+ {
317
+ return $this->getObject('contentTag');
318
+ }
319
+
320
+ /**
321
+ * Proxy for intellisense
322
+ *
323
+ * @return Bronto_Api_Conversion
324
+ */
325
+ public function getConversionObject()
326
+ {
327
+ return $this->getObject('conversion');
328
+ }
329
+
330
+ /**
331
+ * Proxy for intellisense
332
+ *
333
+ * @return Bronto_Api_Delivery
334
+ */
335
+ public function getDeliveryObject()
336
+ {
337
+ return $this->getObject('delivery');
338
+ }
339
+
340
+ /**
341
+ * Proxy for intellisense
342
+ *
343
+ * @return Bronto_Api_DeliveryGroup
344
+ */
345
+ public function getDeliveryGroupObject()
346
+ {
347
+ return $this->getObject('deliveryGroup');
348
+ }
349
+
350
+ /**
351
+ * Proxy for intellisense
352
+ *
353
+ * @return Bronto_Api_Field
354
+ */
355
+ public function getFieldObject()
356
+ {
357
+ return $this->getObject('field');
358
+ }
359
+
360
+ /**
361
+ * Proxy for intellisense
362
+ *
363
+ * @return Bronto_Api_Message
364
+ */
365
+ public function getMessageObject()
366
+ {
367
+ return $this->getObject('message');
368
+ }
369
+
370
+ /**
371
+ * Proxy for intellisense
372
+ *
373
+ * @return Bronto_Api_MessageRule
374
+ */
375
+ public function getMessageRuleObject()
376
+ {
377
+ return $this->getObject('messageRule');
378
+ }
379
+
380
+ /**
381
+ * Proxy for intellisense
382
+ *
383
+ * @return Bronto_Api_List
384
+ */
385
+ public function getListObject()
386
+ {
387
+ return $this->getObject('list');
388
+ }
389
+
390
+ /**
391
+ * Proxy for intellisense
392
+ *
393
+ * @return Bronto_Api_Login
394
+ */
395
+ public function getLoginObject()
396
+ {
397
+ return $this->getObject('login');
398
+ }
399
+
400
+ /**
401
+ * Proxy for intellisense
402
+ *
403
+ * @return Bronto_Api_Order
404
+ */
405
+ public function getOrderObject()
406
+ {
407
+ return $this->getObject('order');
408
+ }
409
+
410
+ /**
411
+ * Proxy for intellisense
412
+ *
413
+ * @return Bronto_Api_Segment
414
+ */
415
+ public function getSegmentObject()
416
+ {
417
+ return $this->getObject('segment');
418
+ }
419
+
420
+ /**
421
+ * Lazy loads our API objects
422
+ *
423
+ * @param string $object
424
+ * @return Bronto_Api_Object
425
+ */
426
+ public function getObject($object)
427
+ {
428
+ $object = ucfirst($object);
429
+
430
+ if (!isset($this->_classCache[$object])) {
431
+ $className = "Bronto_Api_{$object}";
432
+ if (class_exists($className)) {
433
+ $this->_classCache[$object] = new $className(array('api' => $this));
434
+ } else {
435
+ $this->throwException("Unable to load class: {$className}");
436
+ }
437
+ }
438
+
439
+ return $this->_classCache[$object];
440
+ }
441
+
442
+ /**
443
+ * @param bool $authenticate
444
+ * @return SoapClient
445
+ */
446
+ public function getSoapClient($authenticate = true)
447
+ {
448
+ if ($this->_soapClient == null) {
449
+ $this->_connected = false;
450
+ $soapClientClass = $this->getOption('soap_client', 'Bronto_SoapClient');
451
+ $this->_soapClient = new $soapClientClass(self::BASE_WSDL, array(
452
+ 'soap_version' => $this->_options['soap_version'],
453
+ 'compression' => $this->_options['compression'],
454
+ 'encoding' => $this->_options['encoding'],
455
+ 'trace' => $this->_options['trace'],
456
+ 'exceptions' => $this->_options['exceptions'],
457
+ 'cache_wsdl' => $this->_options['cache_wsdl'],
458
+ 'user_agent' => $this->_options['user_agent'],
459
+ 'features' => $this->_options['features'],
460
+ ));
461
+ $this->_soapClient->__setLocation(self::BASE_LOCATION);
462
+ $this->_connected = true;
463
+ if ($authenticate && !$this->_authenticated && $this->getToken()) {
464
+ $this->login();
465
+ }
466
+ }
467
+ return $this->_soapClient;
468
+ }
469
+
470
+ /**
471
+ * @return Bronto_Api
472
+ */
473
+ public function reset()
474
+ {
475
+ $this->_connected = false;
476
+ $this->_authenticated = false;
477
+ $this->_soapClient = null;
478
+ return $this;
479
+ }
480
+
481
+ /**
482
+ * @param bool $value
483
+ * @return Bronto_Api
484
+ */
485
+ public function setDebug($value)
486
+ {
487
+ return $this->_setOption('debug', (bool) $value);
488
+ }
489
+
490
+ /**
491
+ * @return bool
492
+ */
493
+ public function getDebug()
494
+ {
495
+ return (bool) $this->_options['debug'];
496
+ }
497
+
498
+ /**
499
+ * @param array $options
500
+ * @return Bronto_Util_Retryer_RetryerInterface
501
+ */
502
+ public function getRetryer(array $options = array())
503
+ {
504
+ if (!($this->_retryer instanceOf Bronto_Util_Retryer_RetryerInterface)) {
505
+ $options = array_merge($this->_options['retryer'], $options);
506
+ switch ($options['type']) {
507
+ case 'file':
508
+ $this->_retryer = new Bronto_Util_Retryer_FileRetryer($options);
509
+ break;
510
+ default:
511
+ return false;
512
+ break;
513
+ }
514
+ }
515
+
516
+ return $this->_retryer;
517
+ }
518
+
519
+ /**
520
+ * @return Bronto_Util_Retryer_RetryerInterface
521
+ */
522
+ public function getUuid()
523
+ {
524
+ if (!$this->_uuid) {
525
+ $this->_uuid = new Bronto_Util_Uuid();
526
+ }
527
+
528
+ return $this->_uuid;
529
+ }
530
+
531
+ /**
532
+ * @return bool
533
+ */
534
+ public function isConnected()
535
+ {
536
+ return (bool) $this->_connected;
537
+ }
538
+
539
+ /**
540
+ * @return bool
541
+ */
542
+ public function isAuthenticated()
543
+ {
544
+ return (bool) $this->_authenticated;
545
+ }
546
+
547
+ /**
548
+ * Seamlessly iterate over a rowset.
549
+ *
550
+ * @param Bronto_Api_Rowset $rowset
551
+ * @return Bronto_Api_Rowset_Iterator
552
+ */
553
+ public function iterate(Bronto_Api_Rowset $rowset)
554
+ {
555
+ return new Bronto_Api_Rowset_Iterator($rowset);
556
+ }
557
+
558
+ /**
559
+ * Retrieve request XML
560
+ *
561
+ * @return string
562
+ */
563
+ public function getLastRequest()
564
+ {
565
+ if ($this->_soapClient !== null) {
566
+ return $this->_soapClient->__getLastRequest();
567
+ }
568
+ return '';
569
+ }
570
+
571
+ /**
572
+ * Get response XML
573
+ *
574
+ * @return string
575
+ */
576
+ public function getLastResponse()
577
+ {
578
+ if ($this->_soapClient !== null) {
579
+ return $this->_soapClient->__getLastResponse();
580
+ }
581
+ return '';
582
+ }
583
+
584
+ /**
585
+ * Retrieve request headers
586
+ *
587
+ * @return string
588
+ */
589
+ public function getLastRequestHeaders()
590
+ {
591
+ if ($this->_soapClient !== null) {
592
+ return $this->_soapClient->__getLastRequestHeaders();
593
+ }
594
+ return '';
595
+ }
596
+
597
+ /**
598
+ * Retrieve response headers (as string)
599
+ *
600
+ * @return string
601
+ */
602
+ public function getLastResponseHeaders()
603
+ {
604
+ if ($this->_soapClient !== null) {
605
+ return $this->_soapClient->__getLastResponseHeaders();
606
+ }
607
+ return '';
608
+ }
609
+
610
+ /**
611
+ * @return array
612
+ */
613
+ public function __sleep()
614
+ {
615
+ return array(
616
+ '_token',
617
+ '_options',
618
+ );
619
+ }
620
+ }
lib/Bronto/Api/Account.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/accountobject
9
+ *
10
+ * @method Bronto_Api_Account_Row createRow() createRow(array $data)
11
+ */
12
+ class Bronto_Api_Account extends Bronto_Api_Object
13
+ {
14
+ /** Status */
15
+ const STATUS_UNRESTRICTED = 'unrestricted';
16
+ const STATUS_RESTRICTED = 'restricted';
17
+ const STATUS_INACTIVE = 'inactive';
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $_methods = array(
23
+ 'addAccounts' => 'add',
24
+ 'readAccounts' => 'read',
25
+ 'updateAccounts' => 'update',
26
+ 'deleteAccounts' => 'delete',
27
+ );
28
+
29
+ /**
30
+ * @var array
31
+ */
32
+ protected $_options = array(
33
+ 'status' => array(
34
+ self::STATUS_UNRESTRICTED,
35
+ self::STATUS_RESTRICTED,
36
+ self::STATUS_INACTIVE,
37
+ ),
38
+ );
39
+
40
+ /**
41
+ * @param array $filter
42
+ * @param bool $includeInfo
43
+ * @param string $status
44
+ * @param int $pageNumber
45
+ * @return Bronto_Api_Rowset
46
+ */
47
+ public function readAll(array $filter = array(), $includeInfo = true, $status = null, $pageNumber = 1)
48
+ {
49
+ $params = array();
50
+ $params['filter'] = $filter;
51
+ $params['includeInfo'] = (bool) $includeInfo;
52
+ if (!empty($status)) {
53
+ $params['status'] = $status;
54
+ }
55
+ $params['pageNumber'] = (int) $pageNumber;
56
+ return $this->read($params);
57
+ }
58
+ }
lib/Bronto/Api/Account/Exception.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Api_Account_Exception extends Bronto_Api_Exception
7
+ {
8
+ const INVALID_SITE = 701; // The account is invalid.
9
+ const DUPLICATE_SITE = 702; // There is already an account with the name: %s
10
+ const INVALID_TOKEN = 703; // The API token was invalid.
11
+ const INVALID_TOKEN_SITE = 704; // The account specified for the token was invalid: %s
12
+ const INVALID_TOKEN_NAME = 705; // The name specified for the token was invalid: %s
13
+ }
lib/Bronto/Api/Account/Row.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $id
8
+ * @property string $name
9
+ * @property string $status
10
+ * @property array $generalSettings
11
+ * @property array $contactInformation
12
+ * @property array $formatSettings
13
+ * @property array $brandingSettings
14
+ * @property array $repliesSettings
15
+ * @property array $allocations
16
+ * @method Bronto_Api_Account_Row read() read()
17
+ * @method Bronto_Api_Account_Row save() save()
18
+ * @method Bronto_Api_Account_Row delete() delete()
19
+ * @method Bronto_Api_Account getApiObject() getApiObject()
20
+ */
21
+ class Bronto_Api_Account_Row extends Bronto_Api_Row
22
+ {
23
+
24
+ }
lib/Bronto/Api/Activity.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/activityobject
9
+ */
10
+ class Bronto_Api_Activity extends Bronto_Api_Object
11
+ {
12
+ /** trackingType */
13
+ const TYPE_OPEN = 'open';
14
+ const TYPE_CLICK = 'click';
15
+ const TYPE_CONVERSION = 'conversion';
16
+ const TYPE_BOUNCE = 'bounce';
17
+ const TYPE_SEND = 'send';
18
+ const TYPE_UNSUBSCRIBE = 'unsubscribe';
19
+ const TYPE_VIEW = 'view';
20
+
21
+ /** bounceType */
22
+ const BOUNCE_HARD_CONN_PERM = 'conn_perm';
23
+ const BOUNCE_HARD_SUB_PERM = 'sub_perm';
24
+ const BOUNCE_HARD_CONTENT_PERM = 'content_perm';
25
+ const BOUNCE_SOFT_CONN_TEMP = 'conn_temp';
26
+ const BOUNCE_SOFT_SUB_TEMP = 'sub_temp';
27
+ const BOUNCE_SOFT_CONTENT_TEMP = 'content_temp';
28
+ const BOUNCE_SOFT_OTHER = 'other';
29
+
30
+ /**
31
+ * @var array
32
+ */
33
+ protected $_methods = array(
34
+ 'readActivities' => 'read',
35
+ );
36
+
37
+ /**
38
+ * @var array
39
+ */
40
+ protected $_options = array(
41
+ 'trackingType' => array(
42
+ self::TYPE_OPEN,
43
+ self::TYPE_CLICK,
44
+ self::TYPE_CONVERSION,
45
+ self::TYPE_BOUNCE,
46
+ self::TYPE_SEND,
47
+ self::TYPE_UNSUBSCRIBE,
48
+ self::TYPE_VIEW,
49
+ ),
50
+ 'readDirection' => array(
51
+ self::DIRECTION_FIRST,
52
+ self::DIRECTION_NEXT,
53
+ ),
54
+ 'bounceType' => array(
55
+ self::BOUNCE_HARD_CONN_PERM,
56
+ self::BOUNCE_HARD_SUB_PERM,
57
+ self::BOUNCE_HARD_CONTENT_PERM,
58
+ self::BOUNCE_SOFT_CONN_TEMP,
59
+ self::BOUNCE_SOFT_SUB_TEMP,
60
+ self::BOUNCE_SOFT_CONTENT_TEMP,
61
+ self::BOUNCE_SOFT_OTHER,
62
+ ),
63
+ );
64
+
65
+ /**
66
+ * The primary key column or columns.
67
+ *
68
+ * @var mixed
69
+ */
70
+ protected $_primary = array('activityDate', 'trackingType');
71
+
72
+ /**
73
+ * @var int
74
+ */
75
+ protected $_iteratorType = Bronto_Api_Rowset_Iterator::TYPE_STREAM;
76
+
77
+ /**
78
+ * The key(s) to use when paginating
79
+ *
80
+ * @var array
81
+ */
82
+ protected $_iteratorParams = array(
83
+ 'readDirection' => false,
84
+ 'start' => 'activityDate',
85
+ );
86
+
87
+ /**
88
+ * For many activities, caching the row objects saves tons of time.
89
+ * Example: fetching 1000 activities that references only 3 messageId's
90
+ *
91
+ * @var array
92
+ */
93
+ protected $_objectCache = array(
94
+ 'contact' => array(),
95
+ 'delivery' => array(),
96
+ 'message' => array(),
97
+ 'list' => array(),
98
+ );
99
+
100
+ /**
101
+ * @param string $startDate
102
+ * @param int $size
103
+ * @param string|array $types
104
+ * @param string $direction
105
+ * @param string|array $contactIds
106
+ * @return Bronto_Api_Rowset
107
+ */
108
+ public function readAll($startDate = '2002-01-01T00:00:00+00:00', $size = 1000, $types = array(), $direction = self::DIRECTION_FIRST, $contactIds = array())
109
+ {
110
+ $filter = array(
111
+ 'start' => '2002-01-01T00:00:00+00:00',
112
+ 'size' => 1000,
113
+ 'types' => $this->getOptionValues('trackingType'),
114
+ 'readDirection' => self::DIRECTION_FIRST,
115
+ 'contactIds' => array(),
116
+ );
117
+
118
+ if (!empty($startDate)) {
119
+ $filter['start'] = $startDate;
120
+ }
121
+
122
+ if (!empty($size)) {
123
+ $filter['size'] = $size < 1000 ? 1000 : (int) $size;
124
+ }
125
+
126
+ if (!empty($types)) {
127
+ if (is_array($types)) {
128
+ $filter['types'] = $types;
129
+ } else {
130
+ $filter['types'] = array($types);
131
+ }
132
+ }
133
+
134
+ $direction = strtoupper($direction);
135
+ if (in_array($direction, $this->_options['readDirection'])) {
136
+ $filter['readDirection'] = $direction;
137
+ }
138
+
139
+ if (!empty($contactIds)) {
140
+ if (is_array($contactIds)) {
141
+ $filter['contactIds'] = $contactIds;
142
+ } else {
143
+ $filter['contactIds'] = array($contactIds);
144
+ }
145
+ }
146
+
147
+ // @todo Remove if the contactIds filter is enabled again
148
+ unset($filter['contactIds']);
149
+
150
+ return parent::read(array('filter' => $filter));
151
+ }
152
+
153
+ /**
154
+ * @param array $data
155
+ */
156
+ public function createRow(array $data = array())
157
+ {
158
+ throw new Bronto_Api_Activity_Exception('You cannot create an Activity row.');
159
+ }
160
+
161
+ /**
162
+ * @param string $type
163
+ * @param string $index
164
+ * @param Bronto_Api_Row $object
165
+ */
166
+ public function addToCache($type, $index, Bronto_Api_Row $object)
167
+ {
168
+ // Conserve memory
169
+ while (count($this->_objectCache[$type]) >= 25) {
170
+ array_shift($this->_objectCache[$type]);
171
+ }
172
+
173
+ $this->_objectCache[$type][$index] = $object;
174
+ return $this;
175
+ }
176
+
177
+ /**
178
+ * @param string $type
179
+ * @param string $index
180
+ * @return bool|Bronto_Api_Row
181
+ */
182
+ public function getFromCache($type, $index)
183
+ {
184
+ if (isset($this->_objectCache[$type][$index])) {
185
+ return $this->_objectCache[$type][$index];
186
+ }
187
+ return false;
188
+ }
189
+
190
+ /**
191
+ * @param string $bounceType
192
+ * @return bool
193
+ */
194
+ public function isBounceHard($bounceType)
195
+ {
196
+ return (
197
+ $bounceType === self::BOUNCE_HARD_CONN_PERM ||
198
+ $bounceType === self::BOUNCE_HARD_SUB_PERM ||
199
+ $bounceType === self::BOUNCE_HARD_CONTENT_PERM
200
+ );
201
+ }
202
+
203
+ /**
204
+ * @param string $bounceType
205
+ * @return bool
206
+ */
207
+ public function isBounceSoft($bounceType)
208
+ {
209
+ return (
210
+ $bounceType === self::BOUNCE_SOFT_CONN_TEMP ||
211
+ $bounceType === self::BOUNCE_SOFT_SUB_TEMP ||
212
+ $bounceType === self::BOUNCE_SOFT_CONTENT_TEMP ||
213
+ $bounceType === self::BOUNCE_SOFT_OTHER
214
+ );
215
+ }
216
+ }
lib/Bronto/Api/Activity/Exception.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Api_Activity_Exception extends Bronto_Api_Exception
7
+ {
8
+ const INVALID_START_DATE = 1201; // Start date is invalid:
9
+ const INVALID_ACTIVITY_TYPE = 1202; // Invalid Activity types:
10
+ const INVALID_SIZE = 1203; // Activity size is invalid:
11
+ const NO_CONTACT_FILTER = 1204; // Activities cannot currently be filtered by contact ID
12
+ }
lib/Bronto/Api/Activity/Row.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $activityDate
8
+ * @property-read string $contactId
9
+ * @property-read string $deliveryId
10
+ * @property-read string $messageId
11
+ * @property-read string $listId
12
+ * @property-read string $segmentId
13
+ * @property-read string $trackingType
14
+ * @property-read string $bounceReason
15
+ * @property-read string $bounceType
16
+ * @property-read string $linkName
17
+ * @property-read string $linkUrl
18
+ * @method bool isOpen() isOpen()
19
+ * @method bool isClick() isClick()
20
+ * @method bool isConversion() isConversion()
21
+ * @method bool isBounce() isBounce()
22
+ * @method bool isSend() isSend()
23
+ * @method bool isUnsubscribe() isUnsubscribe()
24
+ * @method bool isView() isView()
25
+ * @method Bronto_Api_Contact_Row getContact() getContact()
26
+ * @method Bronto_Api_Delivery_Row getDelivery() getDelivery()
27
+ * @method Bronto_Api_Message_Row getMessage() getMessage()
28
+ * @method Bronto_Api_List_Row getList() getList()
29
+ * @method Bronto_Api_Activity getApiObject() getApiObject()
30
+ */
31
+ class Bronto_Api_Activity_Row extends Bronto_Api_Row
32
+ {
33
+ /**
34
+ * Tracks columns that are dates.
35
+ *
36
+ * @var array
37
+ */
38
+ protected $_dateFields = array(
39
+ 'activityDate' => true
40
+ );
41
+
42
+ /**
43
+ * @var bool
44
+ */
45
+ protected $_readOnly = true;
46
+
47
+ /**
48
+ * @param string $name
49
+ * @param array $arguments
50
+ * @return Bronto_Api_Row
51
+ */
52
+ public function __call($name, $arguments)
53
+ {
54
+ // Check is{Type}
55
+ if (substr($name, 0, 2) == 'is') {
56
+ $type = strtolower(substr($name, 2));
57
+ if ($this->getApiObject()->isValidOptionValue('trackingType', $type)) {
58
+ return $this->trackingType == $type;
59
+ }
60
+ }
61
+
62
+ // Check get{Object}
63
+ if (substr($name, 0, 3) == 'get') {
64
+ $object = strtolower(substr($name, 3));
65
+ switch ($object) {
66
+ case 'contact':
67
+ case 'delivery':
68
+ case 'message':
69
+ case 'list':
70
+ // Cache object result
71
+ $cacheObject = (bool) (isset($arguments[0]) && $arguments[0]);
72
+ $idField = "{$object}Id";
73
+ if (isset($this->{$idField}) && !empty($this->{$idField})) {
74
+ if ($cacheObject) {
75
+ $cached = $this->getApiObject()->getFromCache($object, $this->{$idField});
76
+ if ($cached) {
77
+ return $cached;
78
+ }
79
+ }
80
+ $apiObject = $this->getApi()->getObject($object);
81
+ $row = $apiObject->createRow();
82
+ $row->id = $this->{$idField};
83
+ $row->read();
84
+ if ($cacheObject) {
85
+ $this->getApiObject()->addToCache($object, $this->{$idField}, $row);
86
+ }
87
+ return $row;
88
+ } else {
89
+ return false;
90
+ }
91
+ break;
92
+ }
93
+ }
94
+
95
+ throw new BadMethodCallException("The method {$name} does not exist");
96
+ }
97
+
98
+ /**
99
+ * @return boolean
100
+ */
101
+ public function isSoftBounce()
102
+ {
103
+ if ($this->isBounce()) {
104
+ return $this->getApiObject()->isBounceSoft($this->bounceType);
105
+ }
106
+
107
+ return false;
108
+ }
109
+
110
+ /**
111
+ * @return boolean
112
+ */
113
+ public function isHardBounce()
114
+ {
115
+ if ($this->isBounce()) {
116
+ return $this->getApiObject()->isBounceHard($this->bounceType);
117
+ }
118
+
119
+ return false;
120
+ }
121
+
122
+ /**
123
+ * @param mixed $upsert
124
+ * @param mixed $refresh
125
+ * @throws Bronto_Api_Activity_Exception
126
+ */
127
+ public function save($upsert = null, $refresh = null)
128
+ {
129
+ throw new Bronto_Api_Activity_Exception('You cannot create/update an Activity row.');
130
+ }
131
+
132
+ /**
133
+ * @throws Bronto_Api_Activity_Exception
134
+ */
135
+ public function delete()
136
+ {
137
+ throw new Bronto_Api_Activity_Exception('You cannot delete an Activity row.');
138
+ }
139
+ }
lib/Bronto/Api/ApiToken.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/apitokenobject
9
+ *
10
+ * @method Bronto_Api_ApiToken_Row createRow() createRow(array $data)
11
+ */
12
+ class Bronto_Api_ApiToken extends Bronto_Api_Object
13
+ {
14
+ /** Permissions */
15
+ const PERMISSION_NONE = 0;
16
+ const PERMISSION_READ = 1;
17
+ const PERMISSION_WRITE = 2;
18
+ const PERMISSION_SEND = 4;
19
+
20
+ /** Permissions Shortcuts */
21
+ const PERMISSIONS_READ_WRITE = 3;
22
+ const PERMISSIONS_READ_SEND = 5;
23
+ const PERMISSIONS_WRITE_SEND = 6;
24
+ const PERMISSIONS_READ_WRITE_SEND = 7;
25
+ const PERMISSIONS_ALL = self::PERMISSIONS_READ_WRITE_SEND;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ protected $_options = array(
31
+ 'permissions' => array(
32
+ self::PERMISSION_READ,
33
+ self::PERMISSION_WRITE,
34
+ self::PERMISSION_SEND,
35
+ self::PERMISSIONS_READ_WRITE,
36
+ self::PERMISSIONS_READ_SEND,
37
+ self::PERMISSIONS_WRITE_SEND,
38
+ self::PERMISSIONS_READ_WRITE_SEND,
39
+ ),
40
+ );
41
+
42
+ /**
43
+ * @var array
44
+ */
45
+ protected $_methods = array(
46
+ 'addApiTokens' => 'add',
47
+ 'readApiTokens' => 'read',
48
+ 'updateApiTokens' => 'update',
49
+ 'deleteApiTokens' => 'delete',
50
+ );
51
+
52
+ /**
53
+ * @param array $filter
54
+ * @param int $pageNumber
55
+ * @return Bronto_Api_Rowset
56
+ */
57
+ public function readAll(array $filter = array(), $pageNumber = 1)
58
+ {
59
+ $params = array();
60
+ $params['filter'] = $filter;
61
+ $params['pageNumber'] = (int) $pageNumber;
62
+
63
+ $this->_validateParams($params);
64
+
65
+ return parent::read($params);
66
+ }
67
+
68
+ /**
69
+ * @param array $params
70
+ * @return bool
71
+ */
72
+ protected function _validateParams(array $params)
73
+ {
74
+ if (!isset($params['filter']) || !is_array($params['filter'])) {
75
+ throw new Bronto_Api_Exception('readApiTokens requires an filter array.');
76
+ }
77
+
78
+ $validFilters = array('id', 'accountId', 'name');
79
+ $hasValidFilter = false;
80
+ foreach ($params['filter'] as $key => $value) {
81
+ if (in_array($key, $validFilters)) {
82
+ $hasValidFilter = true;
83
+ break;
84
+ }
85
+ }
86
+
87
+ if (!$hasValidFilter) {
88
+ throw new Bronto_Api_Exception('readApiTokens requires a filter by one of: ' . implode(', ', $validFilters));
89
+ }
90
+
91
+ return true;
92
+ }
93
+
94
+ /**
95
+ * @param int $permissions
96
+ * @return array
97
+ */
98
+ public function getPermissionsLabels($permissions)
99
+ {
100
+ switch ($permissions) {
101
+ case Bronto_Api_ApiToken::PERMISSION_READ:
102
+ return array('read');
103
+ break;
104
+ case Bronto_Api_ApiToken::PERMISSION_WRITE:
105
+ return array('write');
106
+ break;
107
+ case Bronto_Api_ApiToken::PERMISSION_SEND:
108
+ return array('send');
109
+ break;
110
+ case Bronto_Api_ApiToken::PERMISSIONS_READ_WRITE:
111
+ return array('read', 'write');
112
+ break;
113
+ case Bronto_Api_ApiToken::PERMISSIONS_READ_SEND:
114
+ return array('read', 'send');
115
+ break;
116
+ case Bronto_Api_ApiToken::PERMISSIONS_WRITE_SEND:
117
+ return array('write', 'send');
118
+ break;
119
+ case Bronto_Api_ApiToken::PERMISSIONS_READ_WRITE_SEND:
120
+ return array('read', 'write', 'send');
121
+ break;
122
+ case Bronto_Api_ApiToken::PERMISSION_NONE:
123
+ return array('none');
124
+ break;
125
+ }
126
+
127
+ return false;
128
+ }
129
+ }
lib/Bronto/Api/ApiToken/Exception.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Api_ApiToken_Exception extends Bronto_Api_Exception
7
+ {
8
+
9
+ }
lib/Bronto/Api/ApiToken/Row.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $id
8
+ * @property string $name
9
+ * @property int $permissions
10
+ * @property bool $active
11
+ * @property string $accountId
12
+ * @method Bronto_Api_ApiToken_Row save() save()
13
+ * @method Bronto_Api_ApiToken_Row delete() delete()
14
+ * @method Bronto_Api_ApiToken getApiObject() getApiObject()
15
+ */
16
+ class Bronto_Api_ApiToken_Row extends Bronto_Api_Row
17
+ {
18
+ /**
19
+ * @return Bronto_Api_ApiToken_Row
20
+ */
21
+ public function read()
22
+ {
23
+ if ($this->id) {
24
+ $params = array('id' => $this->id);
25
+ } elseif ($this->accountId) {
26
+ $params = array('accountId' => $this->accountId);
27
+ } elseif ($this->name) {
28
+ $params = array(
29
+ 'name' => array(
30
+ 'value' => $this->name,
31
+ 'operator' => 'EqualTo',
32
+ )
33
+ );
34
+ } else {
35
+ throw new Bronto_Api_ApiToken_Exception('Trying to read ApiToken without Id or Name for lookup');
36
+ }
37
+
38
+ parent::_read($params);
39
+ return $this;
40
+ }
41
+
42
+ /**
43
+ * @return Bronto_Api_Account_Row
44
+ */
45
+ public function getAccount()
46
+ {
47
+ if (!$this->accountId) {
48
+ if ($this->id || $this->name) {
49
+ $this->read();
50
+ }
51
+ if (!$this->accountId) {
52
+ throw new Bronto_Api_ApiToken_Exception('No accountId specified to retrieve Account');
53
+ }
54
+ }
55
+
56
+ $account = $this->getApi()->getAccountObject()->createRow();
57
+ $account->id = $this->accountId;
58
+ $account->read();
59
+
60
+ return $account;
61
+ }
62
+
63
+ /**
64
+ * @param int $permissions
65
+ * @return bool
66
+ */
67
+ public function hasPermissions($permissions)
68
+ {
69
+ if ($this->permissions === null) {
70
+ $this->read();
71
+ }
72
+
73
+ return $this->permissions >= $permissions;
74
+ }
75
+
76
+ /**
77
+ * @return array
78
+ */
79
+ public function getPermissionsLabels()
80
+ {
81
+ return $this->getApiObject()->getPermissionsLabels($this->permissions);
82
+ }
83
+ }
lib/Bronto/Api/Contact.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/contactobject
9
+ *
10
+ * @method Bronto_Api_Contact_Row createRow() createRow(array $data)
11
+ */
12
+ class Bronto_Api_Contact extends Bronto_Api_Object
13
+ {
14
+ /** Status */
15
+ const STATUS_ACTIVE = 'active';
16
+ const STATUS_ONBOARDING = 'onboarding';
17
+ const STATUS_TRANSACTIONAL = 'transactional';
18
+ const STATUS_BOUNCE = 'bounce';
19
+ const STATUS_UNCONFIRMED = 'unconfirmed';
20
+ const STATUS_UNSUBSCRIBED = 'unsub';
21
+
22
+ /** MsgPref */
23
+ const MSGPREF_TEXT = 'text';
24
+ const MSGPREF_HTML = 'html';
25
+
26
+ /** Source */
27
+ const SOURCE_MANUAL = 'manual';
28
+ const SOURCE_IMPORT = 'import';
29
+ const SOURCE_API = 'api';
30
+ const SOURCE_WEBFORM = 'webform';
31
+ const SOURCE_SALESFORCE = 'sforcereport';
32
+
33
+ /**
34
+ * @var array
35
+ */
36
+ protected $_methods = array(
37
+ 'addContacts' => 'add',
38
+ 'readContacts' => 'read',
39
+ 'updateContacts' => 'update',
40
+ 'deleteContacts' => 'delete',
41
+ 'addOrUpdateContacts' => 'addOrUpdate',
42
+ 'addToList' => true,
43
+ 'removeFromList' => true,
44
+ 'addContactsToWorkflow' => true,
45
+ 'addContactEvent' => true,
46
+ );
47
+
48
+ /**
49
+ * @var array
50
+ */
51
+ protected $_options = array(
52
+ 'msgPref' => array(
53
+ self::MSGPREF_TEXT,
54
+ self::MSGPREF_HTML,
55
+ ),
56
+ 'status' => array(
57
+ self::STATUS_ACTIVE,
58
+ self::STATUS_ONBOARDING,
59
+ self::STATUS_TRANSACTIONAL,
60
+ self::STATUS_BOUNCE,
61
+ self::STATUS_UNCONFIRMED,
62
+ self::STATUS_UNSUBSCRIBED,
63
+ ),
64
+ 'source' => array(
65
+ self::SOURCE_MANUAL,
66
+ self::SOURCE_IMPORT,
67
+ self::SOURCE_API,
68
+ self::SOURCE_WEBFORM,
69
+ self::SOURCE_SALESFORCE,
70
+ ),
71
+ );
72
+
73
+ /**
74
+ * @param array $filter
75
+ * @param array $fields
76
+ * @param bool $includeLists
77
+ * @param int $pageNumber
78
+ * @return Bronto_Api_Rowset
79
+ */
80
+ public function readAll($filter = array(), $fields = array(), $includeLists = true, $pageNumber = 1)
81
+ {
82
+ $params = array(
83
+ 'filter' => array(),
84
+ 'fields' => array(),
85
+ 'includeLists' => (bool) $includeLists,
86
+ 'pageNumber' => (int) $pageNumber,
87
+ );
88
+
89
+ if (!empty($filter)) {
90
+ if (is_array($filter)) {
91
+ $params['filter'] = $filter;
92
+ } else {
93
+ $params['filter'] = array($filter);
94
+ }
95
+ }
96
+
97
+ if (!empty($fields)) {
98
+ if (is_array($fields)) {
99
+ $params['fields'] = $fields;
100
+ } else {
101
+ $params['fields'] = array($fields);
102
+ }
103
+ }
104
+
105
+ return parent::read($params);
106
+ }
107
+ }
lib/Bronto/Api/Contact/Exception.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Api_Contact_Exception extends Bronto_Api_Exception
7
+ {
8
+ const INVALID_REQUEST = 301; // Invalid request:
9
+ const NOT_FOUND = 302; // Contact does not exist.
10
+ const INVALID_EMAIL = 303; // Invalid email address:
11
+ const INVALID_STATUS = 304; // Invalid status:
12
+ const ALREADY_EXISTS = 305; // Contact already exists:
13
+ const INVALID_FIELD = 306; // Invalid field attributes.
14
+ const MAX_SEARCH_ITEMS_EXCEEDED = 311; // The maximum number of contact search items was exceeded.
15
+ const MAX_SEARCH_LISTS_EXCEEDED = 312; // The maximum number of contact search lists was exceeded.
16
+ const MAX_SEARCH_SEGMENTS_EXCEEDED = 313; // The maximum number of contact search segments was exceeded.
17
+ const EMAIL_ALREADY_EXISTS = 314; // Email address already exists on another contact.
18
+ const EMAIL_SUPPRESSED = 315; // Email address is on suppression list.
19
+ const INVALID_EMAIL_LENGTH = 317; // Email address cannot exceed 100 characters in length:
20
+ const MOBILE_ALREADY_EXISTS = 318; // Mobile number already exists on another contact.
21
+ const INVALID_MOBILE = 319; // Invalid mobile number: %s
22
+ const MISSING_EMAIL_AND_MOBILE = 320; // Email address or mobile number is required.
23
+ }
lib/Bronto/Api/Contact/Row.php ADDED
@@ -0,0 +1,399 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $id
8
+ * @property string $email
9
+ * @property string $mobileNumber
10
+ * @property string $status
11
+ * @property string $msgPref
12
+ * @property string $source
13
+ * @property string $customSource
14
+ * @property array $listIds
15
+ * @property array $fields
16
+ * @property-read string $created
17
+ * @property-read string $modifed
18
+ * @property-read bool $deleted
19
+ * @property-read int $numSends
20
+ * @property-read int $numBounces
21
+ * @property-read int $numOpens
22
+ * @property-read int $numClicks
23
+ * @property-read int $numConversions
24
+ * @property-read float $conversionAmount
25
+ * @method Bronto_Api_Contact_Row delete() delete()
26
+ * @method Bronto_Api_Contact getApiObject() getApiObject()
27
+ */
28
+ class Bronto_Api_Contact_Row extends Bronto_Api_Row implements Bronto_Api_Delivery_Recipient
29
+ {
30
+ /**
31
+ * @var array
32
+ */
33
+ protected $_data = array(
34
+ 'status' => Bronto_Api_Contact::STATUS_TRANSACTIONAL,
35
+ 'messagePrefence' => Bronto_Api_Contact::MSGPREF_HTML,
36
+ 'source' => Bronto_Api_Contact::SOURCE_API,
37
+ );
38
+
39
+ /**
40
+ * Initialize object
41
+ *
42
+ * Called from {@link __construct()} as final step of object instantiation.
43
+ */
44
+ public function init()
45
+ {
46
+ if (isset($this->_data['fields']) && is_array($this->_data['fields'])) {
47
+ foreach ($this->_data['fields'] as $i => $fieldRow) {
48
+ $this->_data['fields'][$i] = (array) $fieldRow;
49
+ }
50
+ $this->_cleanData = $this->_data;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * @return Bronto_Api_Contact_Row
56
+ */
57
+ public function read()
58
+ {
59
+ $params = array();
60
+ if ($this->id) {
61
+ $params = array('id' => $this->id);
62
+ } elseif ($this->email) {
63
+ $params = array(
64
+ 'email' => array(
65
+ 'value' => $this->email,
66
+ 'operator' => 'EqualTo',
67
+ )
68
+ );
69
+ } else {
70
+ throw new Bronto_Api_Contact_Exception('Trying to read Contact without Id or Email for lookup');
71
+ }
72
+
73
+ parent::_read($params);
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * @param bool $upsert
79
+ * @param bool $refresh
80
+ * @return Bronto_Api_Contact_Row
81
+ */
82
+ public function save($upsert = true, $refresh = false)
83
+ {
84
+ try {
85
+ parent::_save($upsert, $refresh);
86
+ } catch (Bronto_Api_Contact_Exception $e) {
87
+ if ($e->getCode() === Bronto_Api_Contact_Exception::ALREADY_EXISTS) {
88
+ $this->_refresh();
89
+ } else {
90
+ $e->appendToMessage("(Email: {$this->email})");
91
+ $this->getApi()->throwException($e);
92
+ }
93
+ }
94
+
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @return Bronto_Api_Contact_Row
100
+ */
101
+ public function persist()
102
+ {
103
+ return parent::_persist('addOrUpdate', $this->email);
104
+ }
105
+
106
+ /**
107
+ * Sets a value for a custom Field
108
+ *
109
+ * @param string|Bronto_Api_Field_Row $field
110
+ * @param mixed $value
111
+ * @return Bronto_Api_Contact_Row
112
+ */
113
+ public function setField($field, $value)
114
+ {
115
+ if ($value === '') {
116
+ return;
117
+ }
118
+
119
+ $fieldId = $field;
120
+ if ($field instanceOf Bronto_Api_Field_Row) {
121
+ if (!$field->id) {
122
+ $field = $field->read();
123
+ }
124
+ $fieldId = $field->id;
125
+
126
+ switch ($field->type) {
127
+ case Bronto_Api_Field::TYPE_DATE:
128
+ if ($value instanceOf DateTime) {
129
+ $value = date('c', $value->getTimestamp());
130
+ } else {
131
+ $value = date('c', strtotime($value));
132
+ }
133
+ break;
134
+ case Bronto_Api_Field::TYPE_INTEGER:
135
+ $value = (int) $value;
136
+ break;
137
+ case Bronto_Api_Field::TYPE_FLOAT:
138
+ $value = (float) $value;
139
+ break;
140
+ }
141
+ }
142
+
143
+ $field = array(
144
+ 'fieldId' => $fieldId,
145
+ 'content' => $value,
146
+ );
147
+
148
+ if (!isset($this->_data['fields']) || !is_array($this->_data['fields'])) {
149
+ $this->_data['fields'] = array();
150
+ } else {
151
+ // Check for dupes
152
+ foreach ($this->_data['fields'] as $i => $_field) {
153
+ if ($_field['fieldId'] == $field['fieldId']) {
154
+ $this->_data['fields'][$i] = $field;
155
+ $this->_modifiedFields['fields'] = true;
156
+ return $this;
157
+ }
158
+ }
159
+ }
160
+
161
+ $this->_data['fields'][] = $field;
162
+ $this->_modifiedFields['fields'] = true;
163
+ return $this;
164
+ }
165
+
166
+ /**
167
+ * Retreives a value for a custom field
168
+ * NOTE: Loads the field for you if it hasn't been requested
169
+ *
170
+ * @param string|Bronto_Api_Field_Row $field $field
171
+ * @return mixed
172
+ */
173
+ public function getField($field)
174
+ {
175
+ $fieldId = $field;
176
+ if ($field instanceOf Bronto_Api_Field_Row) {
177
+ if (!$field->id) {
178
+ $field = $field->read();
179
+ }
180
+ $fieldId = $field->id;
181
+ }
182
+
183
+ // Determine if we have the field already
184
+ if (isset($this->_data['fields']) && is_array($this->_data['fields'])) {
185
+ foreach ($this->_data['fields'] as $i => $fieldRow) {
186
+ if ($fieldRow['fieldId'] == $fieldId) {
187
+ return $fieldRow['content'];
188
+ }
189
+ }
190
+ }
191
+
192
+ // We don't, so request it
193
+ if ($this->id) {
194
+ try {
195
+ if ($rowset = $this->getApiObject()->readAll(array('id' => $this->id), array($fieldId))) {
196
+ foreach ($rowset as $row) {
197
+ $data = $row->getData();
198
+ if (is_array($data) && !empty($data) && isset($data['fields'])) {
199
+ $this->_data['fields'] = array_merge(
200
+ isset($this->_data['fields']) ? $this->_data['fields'] : array(),
201
+ $data['fields']
202
+ );
203
+ $this->_cleanData = $this->_data;
204
+ break;
205
+ }
206
+ }
207
+ }
208
+ } catch (Exception $e) {
209
+ return false;
210
+ }
211
+ }
212
+
213
+ // Try the traverse again
214
+ if (isset($this->_data['fields']) && is_array($this->_data['fields'])) {
215
+ foreach ($this->_data['fields'] as $i => $fieldRow) {
216
+ if ($fieldRow['fieldId'] == $fieldId) {
217
+ return $fieldRow['content'];
218
+ }
219
+ }
220
+ }
221
+
222
+ // Something went horribly wrong
223
+ return null;
224
+ }
225
+
226
+ /**
227
+ * @return array
228
+ */
229
+ public function getLists()
230
+ {
231
+ if ($this->id) {
232
+ $filter = array('id' => $this->id);
233
+ } else {
234
+ $filter = array(
235
+ 'email' => array(
236
+ 'value' => $this->email,
237
+ 'operator' => 'EqualTo',
238
+ )
239
+ );
240
+ }
241
+
242
+ try {
243
+ $rowset = $this->getApiObject()->readAll($filter, array(), true);
244
+
245
+ if ($rowset->count() > 0) {
246
+ $data = $rowset->current()->getData();
247
+ if (isset($data['listIds'])) {
248
+ return $data['listIds'];
249
+ }
250
+ }
251
+ } catch (Exception $e) {
252
+ // Ignore
253
+ }
254
+
255
+ return array();
256
+ }
257
+
258
+ /**
259
+ * @param Bronto_Api_List_Row|string $list
260
+ * @return Bronto_Api_Contact_Row
261
+ */
262
+ public function addToList($list)
263
+ {
264
+ $listId = $list;
265
+ if ($list instanceOf Bronto_Api_List_Row) {
266
+ if (!$list->id) {
267
+ $list = $list->read();
268
+ }
269
+ $listId = $list->id;
270
+ }
271
+
272
+ if (!isset($this->_data['listIds'])) {
273
+ $this->_loadLists();
274
+ }
275
+
276
+ if (!in_array($listId, $this->_data['listIds'])) {
277
+ $this->_data['listIds'][] = $listId;
278
+ $this->_modifiedFields['listIds'] = true;
279
+ }
280
+ return $this;
281
+ }
282
+
283
+ /**
284
+ * @param Bronto_Api_List_Row|string $list
285
+ * @return Bronto_Api_Contact_Row
286
+ */
287
+ public function removeFromList($list)
288
+ {
289
+ $listId = $list;
290
+ if ($list instanceOf Bronto_Api_List_Row) {
291
+ if (!$list->id) {
292
+ $list = $list->read();
293
+ }
294
+ $listId = $list->id;
295
+ }
296
+
297
+ if (!isset($this->_data['listIds'])) {
298
+ $this->_loadLists();
299
+ }
300
+
301
+ if (is_array($this->_data['listIds'])) {
302
+ foreach ($this->_data['listIds'] as $i => $id) {
303
+ if ($id == $listId) {
304
+ unset($this->_data['listIds'][$i]);
305
+ break;
306
+ }
307
+ }
308
+ }
309
+
310
+ $this->_modifiedFields['listIds'] = true;
311
+ return $this;
312
+ }
313
+
314
+ /**
315
+ * @return void
316
+ */
317
+ protected function _loadLists()
318
+ {
319
+ if (!isset($this->_data['listIds'])) {
320
+ $this->_data['listIds'] = array();
321
+ }
322
+
323
+ $listIds = $this->getLists();
324
+ foreach ($listIds as $listId) {
325
+ $this->_data['listIds'][] = $listId;
326
+ $this->_modifiedFields['listIds'] = true;
327
+ }
328
+ }
329
+
330
+ /**
331
+ * @param array $additionalFilter
332
+ * @param int $pageNumber
333
+ * @return Bronto_Api_Rowset
334
+ */
335
+ public function getDeliveries(array $additionalFilter = array(), $pageNumber = 1)
336
+ {
337
+ if (!$this->id) {
338
+ $exceptionClass = $this->getExceptionClass();
339
+ throw new $exceptionClass("This Contact has not been retrieved yet (has no ContactId)");
340
+ }
341
+
342
+ /* @var $deliveryObject Bronto_Api_Delivery */
343
+ $deliveryObject = $this->getApi()->getDeliveryObject();
344
+ $filter = array_merge_recursive(array('contactId' => $this->id), $additionalFilter);
345
+ return $deliveryObject->readDeliveryRecipients($filter, $pageNumber);
346
+ }
347
+
348
+ /**
349
+ * Set row field value
350
+ *
351
+ * @param string $columnName The column key.
352
+ * @param mixed $value The value for the property.
353
+ */
354
+ public function __set($columnName, $value)
355
+ {
356
+ switch (strtolower($columnName)) {
357
+ case 'email':
358
+ // Trim whitespace
359
+ $value = preg_replace('/\s+/', '', $value);
360
+ // Check if email got truncated
361
+ if (substr($value, -1) === '.') {
362
+ $value .= 'com';
363
+ }
364
+ break;
365
+ }
366
+
367
+ return parent::__set($columnName, $value);
368
+ }
369
+
370
+ /**
371
+ * Required by Bronto_Api_Delivery_Recipient
372
+ *
373
+ * @return false
374
+ */
375
+ public function isList()
376
+ {
377
+ return false;
378
+ }
379
+
380
+ /**
381
+ * Required by Bronto_Api_Delivery_Recipient
382
+ *
383
+ * @return true
384
+ */
385
+ public function isContact()
386
+ {
387
+ return true;
388
+ }
389
+
390
+ /**
391
+ * Required by Bronto_Api_Delivery_Recipient
392
+ *
393
+ * @return false
394
+ */
395
+ public function isSegment()
396
+ {
397
+ return false;
398
+ }
399
+ }
lib/Bronto/Api/ContentTag.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Jeremy Bobbitt <jeremy.bobbitt@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/contenttagobject
9
+ *
10
+ * @method Bronto_Api_ContentTag_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_ContentTag extends Bronto_Api_Object
13
+ {
14
+ /**
15
+ * The object name.
16
+ *
17
+ * @var string
18
+ */
19
+ protected $_name = 'ContentTag';
20
+
21
+ /**
22
+ * @var array
23
+ */
24
+ protected $_methods = array(
25
+ 'addContentTags' => 'add',
26
+ 'readContentTags' => 'read',
27
+ 'updateContentTags' => 'update',
28
+ 'deleteContentTags' => 'delete'
29
+ );
30
+
31
+ /**
32
+ * @param array $filter
33
+ * @param bool $includeContent
34
+ * @param int $pageNumber
35
+ * @return Bronto_Api_Rowset
36
+ */
37
+ public function readAll(array $filter = array(), $includeContent = true, $pageNumber = 1)
38
+ {
39
+ $params = array();
40
+ $params['filter'] = $filter;
41
+ $params['includeContent'] = (bool) $includeContent;
42
+ $params['pageNumber'] = (int) $pageNumber;
43
+ return $this->read($params);
44
+ }
45
+ }
lib/Bronto/Api/ContentTag/Exception.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_Message_Exception extends Bronto_Api_Exception
8
+ {
9
+ const INVALID_CONTENTTAG = 1601; // The content tag specified is invalid.
10
+ const MISSING_NAME = 1602; // You must specify a name.
11
+ const NAME_TOO_LONG = 1603; // Name must be 100 characters or less.
12
+ const INVALID_VALUE = 1604; // Tag value cannot contain another content tag.
13
+ const ALREADY_EXISTS = 1605; // A content tag with this name already exists.
14
+ }
lib/Bronto/Api/ContentTag/Row.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @property-read string $id
9
+ * @property string $name
10
+ * @property string value
11
+ * @method Bronto_Api_ContentTag_Row delete() delete()
12
+ * @method Bronto_Api_ContentTag getApiObject() getApiObject()
13
+ */
14
+ class Bronto_Api_ContentTag_Row extends Bronto_Api_Row
15
+ {
16
+ /**
17
+ * @return Bronto_Api_ContentTag_Row
18
+ */
19
+ public function read()
20
+ {
21
+ if ($this->id) {
22
+ $params = array('id' => $this->id);
23
+ } elseif ($this->name) {
24
+ $params = array(
25
+ 'name' => array(
26
+ 'value' => $this->name,
27
+ 'operator' => 'EqualTo',
28
+ )
29
+ );
30
+ }
31
+
32
+ parent::_read($params);
33
+ return $this;
34
+ }
35
+
36
+ /**
37
+ * @param bool $upsert
38
+ * @param bool $refresh
39
+ * @return Bronto_Api_ContentTag_Row
40
+ */
41
+ public function save($upsert = true, $refresh = false)
42
+ {
43
+ if (!$upsert) {
44
+ parent::_save(false, $refresh);
45
+ }
46
+
47
+ try {
48
+ parent::_save(true, $refresh);
49
+ } catch (Bronto_Api_ContentTag_Exception $e) {
50
+ if ($e->getCode() === Bronto_Api_ContentTag_Exception::MESSAGE_EXISTS) {
51
+ $this->_refresh();
52
+ } else {
53
+ $this->getApi()->throwException($e);
54
+ }
55
+ }
56
+
57
+ return $this;
58
+ }
59
+ }
lib/Bronto/Api/Conversion.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/conversionobject
9
+ *
10
+ * @method Bronto_Api_Conversion_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_Conversion extends Bronto_Api_Object
13
+ {
14
+ /**
15
+ * @var array
16
+ */
17
+ protected $_methods = array(
18
+ 'addConversion' => 'add',
19
+ 'readConversions' => 'read',
20
+ );
21
+
22
+ /**
23
+ * @param array $filter
24
+ * @param int $pageNumber
25
+ * @return Bronto_Api_Rowset
26
+ */
27
+ public function readAll(array $filter = array(), $pageNumber = 1)
28
+ {
29
+ $params = array(
30
+ 'filter' => array(),
31
+ 'pageNumber' => (int) $pageNumber,
32
+ );
33
+
34
+ if (!empty($filter)) {
35
+ if (is_array($filter)) {
36
+ $params['filter'] = $filter;
37
+ } else {
38
+ $params['filter'] = array($filter);
39
+ }
40
+ } else {
41
+ $params['filter'] = array('contactId' => array());
42
+ }
43
+
44
+ return parent::read($params);
45
+ }
46
+ }
lib/Bronto/Api/Conversion/Exception.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Api_Conversion_Exception extends Bronto_Api_Exception
7
+ {
8
+ const DUPLICATE_ORDER = 901; // Duplicate Order Id: %%id%%.
9
+ const MISSING_AMOUNT = 902; // Missing required field: amount.
10
+ const MISSING_QUANTITY = 903; // Missing required field: quantity.
11
+ }
lib/Bronto/Api/Conversion/Row.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $id
8
+ * @property string $contactId
9
+ * @property string $email
10
+ * @property string $orderId
11
+ * @property string $item
12
+ * @property string $description
13
+ * @property int $quantity
14
+ * @property float $amount
15
+ * @property float $orderTotal
16
+ * @property string $createdDate
17
+ * @property string $deliveryId
18
+ * @property string $messageId
19
+ * @property string $automatorId
20
+ * @property string $listId
21
+ * @property string $segmentId
22
+ * @property string $deliveryType
23
+ * @property-write string $tid
24
+ * @method Bronto_Api_Conversion getApiObject() getApiObject()
25
+ */
26
+ class Bronto_Api_Conversion_Row extends Bronto_Api_Row
27
+ {
28
+ /**
29
+ * @return Bronto_Api_Conversion_Row
30
+ */
31
+ public function read()
32
+ {
33
+ $params = array();
34
+
35
+ if ($this->id) {
36
+ $params['id'] = array($this->id);
37
+ } else {
38
+ if ($this->contactId) {
39
+ $params['contactId'] = array($this->contactId);
40
+ }
41
+
42
+ if ($this->deliveryId) {
43
+ $params['deliveryId'] = array($this->deliveryId);
44
+ }
45
+
46
+ if ($this->orderId) {
47
+ $params['orderId'] = array($this->orderId);
48
+ }
49
+ }
50
+
51
+ parent::_read($params);
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ * @param bool $upsert Ignored
57
+ * @param bool $refresh
58
+ * @return Bronto_Api_Conversion_Row
59
+ */
60
+ public function save($upsert = null, $refresh = false)
61
+ {
62
+ /**
63
+ * If the _cleanData array is empty,
64
+ * this is an ADD of a new row.
65
+ * Otherwise it is an UPDATE.
66
+ */
67
+ if (empty($this->_cleanData)) {
68
+ parent::_save(false, $refresh);
69
+ } else {
70
+ throw new Bronto_Api_Row_Exception(sprintf("Cannot update a %s record.", $this->getApiObject()->getName()));
71
+ }
72
+
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * @return Bronto_Api_Conversion_Row
78
+ */
79
+ public function persist()
80
+ {
81
+ return parent::_persist('add', false);
82
+ }
83
+
84
+ /**
85
+ * Set row field value
86
+ *
87
+ * @param string $columnName The column key.
88
+ * @param mixed $value The value for the property.
89
+ */
90
+ public function __set($columnName, $value)
91
+ {
92
+ switch (strtolower($columnName)) {
93
+ case 'email':
94
+ // Trim whitespace
95
+ $value = preg_replace('/\s+/', '', $value);
96
+ // Check if email got truncated
97
+ if (substr($value, -1) === '.') {
98
+ $value .= 'com';
99
+ }
100
+ break;
101
+ }
102
+
103
+ return parent::__set($columnName, $value);
104
+ }
105
+ }
lib/Bronto/Api/Delivery.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/deliveryobject
9
+ *
10
+ * @method Bronto_Api_Delivery_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_Delivery extends Bronto_Api_Object
13
+ {
14
+ /** Status */
15
+ const STATUS_SENT = 'sent';
16
+ const STATUS_SENDING = 'sending';
17
+ const STATUS_UNSENT = 'unsent';
18
+ const STATUS_ARCHIVED = 'archived';
19
+ const STATUS_SKIPPED = 'skipped';
20
+
21
+ /** Type */
22
+ const TYPE_NORMAL = 'normal';
23
+ const TYPE_TEST = 'test';
24
+ const TYPE_TRANSACTIONAL = 'transactional';
25
+ const TYPE_AUTOMATED = 'automated';
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ protected $_methods = array(
31
+ 'addDeliveries' => 'add',
32
+ 'readDeliveries' => 'read',
33
+ 'updateDeliveries' => 'update',
34
+ 'deleteDeliveries' => 'delete',
35
+ 'readDeliveryRecipients' => true,
36
+ );
37
+
38
+ /**
39
+ * @var array
40
+ */
41
+ protected $_options = array(
42
+ 'status' => array(
43
+ self::STATUS_SENT,
44
+ self::STATUS_SENDING,
45
+ self::STATUS_UNSENT,
46
+ self::STATUS_ARCHIVED,
47
+ self::STATUS_SKIPPED,
48
+ ),
49
+ 'type' => array(
50
+ self::TYPE_NORMAL,
51
+ self::TYPE_TEST,
52
+ self::TYPE_TRANSACTIONAL,
53
+ self::TYPE_AUTOMATED,
54
+ ),
55
+ );
56
+
57
+ /**
58
+ * @param array $filter
59
+ * @param bool $includeRecipients
60
+ * @param bool $includeContent
61
+ * @param int $pageNumber
62
+ * @return Bronto_Api_Rowset
63
+ */
64
+ public function readAll(array $filter = array(), $includeRecipients = false, $includeContent = false, $pageNumber = 1)
65
+ {
66
+ $params = array();
67
+ $params['filter'] = $filter;
68
+ $params['includeRecipients'] = (bool) $includeRecipients;
69
+ $params['includeContent'] = (bool) $includeContent;
70
+ $params['pageNumber'] = (int) $pageNumber;
71
+ return $this->read($params);
72
+ }
73
+
74
+ /**
75
+ * @param array $filter
76
+ * @param int $pageNumber
77
+ * @return Bronto_Api_Rowset
78
+ */
79
+ public function readDeliveryRecipients(array $filter = array(), $pageNumber = 1)
80
+ {
81
+ $params = array();
82
+ $params['filter'] = $filter;
83
+ $params['pageNumber'] = (int) $pageNumber;
84
+ return $this->doRequest('readDeliveryRecipients', $params);
85
+ }
86
+ }
lib/Bronto/Api/Delivery/Exception.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Api_Delivery_Exception extends Bronto_Api_Exception
7
+ {
8
+ const INVALID_SEND_DATE = 201; // The send date is invalid.
9
+ const INVALID_FROM_ADDRESS = 202; // The from address is invalid.
10
+ const FATAL_ERROR_SEND = 203; // Fatal error sending delivery.
11
+ const INVALID_RECIPIENT_TYPE = 204; // The recipient type is invalid.
12
+ const INVALID_MESSAGE = 205; // The delivery message was not found:
13
+ const INVALID_LIST = 206; // The list for this delivery was not found:
14
+ const INVALID_SEGMENT = 207; // The segment for this delivery was not found:
15
+ const INVALID_SUBSCRIBER = 208; // The subscriber for this delivery was not found:
16
+ const NO_RECIPIENTS = 209; // Your delivery has no recipients.
17
+ const INVALID_FROM_NAME = 213; // The from name is invalid.
18
+ const MESSAGE_NOT_TRANSACTIONAL_APPROVED = 215; // Message not approved for transactional sending:
19
+ const MESSAGE_FIELD_MISSING_POSITION = 216; // Missing required position in message field name: %s
20
+ const NONUNIQUE_MESSAGE_FIELD_POSITION = 217; // Position must be unique in message field name: %s
21
+ const NOT_FOUND = 219; // Delivery does not exist: %s
22
+ const INVALID_THROTTLE = 220; // Throttle rate must be in range [0, 720] (minutes)
23
+ }
lib/Bronto/Api/Delivery/Recipient.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ interface Bronto_Api_Delivery_Recipient
7
+ {
8
+ /**
9
+ * @return bool
10
+ */
11
+ public function isList();
12
+
13
+ /**
14
+ * @return bool
15
+ */
16
+ public function isContact();
17
+
18
+ /**
19
+ * @return bool
20
+ */
21
+ public function isSegment();
22
+ }
lib/Bronto/Api/Delivery/Row.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $id
8
+ * @property string start
9
+ * @property string $messageId
10
+ * @property string $status
11
+ * @property string $type
12
+ * @property string $fromEmail
13
+ * @property string $fromName
14
+ * @property bool $authentication
15
+ * @property bool $replyTracking
16
+ * @property string $replyEmail
17
+ * @property string $messageRuleId
18
+ * @property bool $optin
19
+ * @property float $throttle
20
+ * @property array $content
21
+ * @property array $recipients
22
+ * @property array $fields
23
+ * @property-read int $numSends
24
+ * @property-read int $numDeliveries
25
+ * @property-read int $numHardBadEmail
26
+ * @property-read int $numHardDestUnreach
27
+ * @property-read int $numHardMessageContent
28
+ * @property-read int $numHardBounces
29
+ * @property-read int $numSoftBadEmail
30
+ * @property-read int $numSoftDestUnreach
31
+ * @property-read int $numSoftMessageContent
32
+ * @property-read int $numSoftBounces
33
+ * @property-read int $numOtherBounces
34
+ * @property-read int $uniqOpens
35
+ * @property-read int $numOpens
36
+ * @property-read int $avgOpens
37
+ * @property-read int $uniqClicks
38
+ * @property-read int $numClicks
39
+ * @property-read int $avgClicks
40
+ * @property-read int $uniqConversions
41
+ * @property-read int $numConversions
42
+ * @property-read int $avgConversions
43
+ * @property-read int $revenue
44
+ * @property-read int $numSurveyResponses
45
+ * @property-read int $numFriendForwards
46
+ * @property-read int $numContactUpdates
47
+ * @property-read int $numUnsubscribesByPrefs
48
+ * @property-read int $numUnsubscribesByComplaint
49
+ * @property-read int $numContactLoss
50
+ * @property-read int $numContactLossBounces
51
+ * @property-read float $deliveryRate
52
+ * @property-read float $openRate
53
+ * @property-read float $clickRate
54
+ * @property-read float $clickThroughRate
55
+ * @property-read float $conversionRate
56
+ * @property-read float $bounceRate
57
+ * @property-read float $complaintRate
58
+ * @property-read float $contactLossRate
59
+ * @property-read int $numSocialShares
60
+ * @property-read int $sharesFacebook
61
+ * @property-read int $sharesTwitter
62
+ * @property-read int $sharesLinkedIn
63
+ * @property-read int $sharesDigg
64
+ * @property-read int $sharesMySpace
65
+ * @property-read int $viewsFacebook
66
+ * @property-read int $viewsTwitter
67
+ * @property-read int $viewsLinkedIn
68
+ * @property-read int $viewsDigg
69
+ * @property-read int $viewsMySpace
70
+ * @property-read int $numSocialViews
71
+ * @method Bronto_Api_Delivery_Row read() read()
72
+ * @method Bronto_Api_Delivery_Row delete() delete()
73
+ * @method Bronto_Api_Delivery getApiObject() getApiObject()
74
+ */
75
+ class Bronto_Api_Delivery_Row extends Bronto_Api_Row
76
+ {
77
+ /**
78
+ * @var array
79
+ */
80
+ protected $_recipients = array();
81
+
82
+ /**
83
+ * @param bool $refresh
84
+ * @param array $additionalFilter
85
+ * @return array
86
+ */
87
+ public function getRecipients($refresh = false, array $additionalFilter = array())
88
+ {
89
+ if (!$this->id) {
90
+ $exceptionClass = $this->getExceptionClass();
91
+ throw new $exceptionClass("This Delivery has not been retrieved yet (has no DeliveryId)");
92
+ }
93
+
94
+ // If we have already retrieved this, don't do it again
95
+ if (!empty($this->_recipients) && !$refresh) {
96
+ return $this->_recipients;
97
+ }
98
+
99
+ // We didn't do $includeRecipients = true from original request
100
+ if (empty($this->recipients)) {
101
+ $this->recipients = array();
102
+
103
+ $filter = array();
104
+ $filter['deliveryId'] = $this->id;
105
+ $filter = array_merge($additionalFilter, $filter);
106
+ $recipientPage = 1;
107
+ while ($recipients = $this->getApiObject()->readDeliveryRecipients($filter, $recipientPage)) {
108
+ if (!$recipients->count()) {
109
+ break;
110
+ }
111
+
112
+ $this->recipients = $this->recipients + $recipients;
113
+ $recipientPage++;
114
+ }
115
+ }
116
+
117
+ $this->_recipients = array();
118
+ if (!empty($this->recipients)) {
119
+ foreach ($this->recipients as $i => $recipient) {
120
+ switch ($recipient->type) {
121
+ case 'list':
122
+ $listObject = $this->getApi()->getListObject();
123
+ $list = $listObject->createRow();
124
+ $list->id = $recipient->id;
125
+ $this->_recipients[] = $list;
126
+ break;
127
+ case 'contact':
128
+ $contactObject = $this->getApi()->getContactObject();
129
+ $contact = $contactObject->createRow();
130
+ $contact->id = $recipient->id;
131
+ $this->_recipients[] = $contact;
132
+ break;
133
+ case 'segment':
134
+ $segmentObject = $this->getApi()->getSegmentObject();
135
+ $segment = $segmentObject->createRow();
136
+ $segment->id = $recipient->id;
137
+ $this->_recipients[] = $segment;
138
+ break;
139
+ default:
140
+ $exceptionClass = $this->getExceptionClass();
141
+ throw new $exceptionClass("Recipient type '{$recipient->type}' is not currently supported");
142
+ break;
143
+ }
144
+ }
145
+ }
146
+
147
+ return $this->_recipients;
148
+ }
149
+
150
+ /**
151
+ * @param Bronto_Api_DeliveryGroup_Row|string $$deliveryGroup
152
+ * @return bool
153
+ */
154
+ public function addToDeliveryGroup($deliveryGroup)
155
+ {
156
+ if (!$this->id) {
157
+ $exceptionClass = $this->getExceptionClass();
158
+ throw new $exceptionClass("This Delivery has not been saved yet (has no DeliveryId)");
159
+ }
160
+
161
+ $deliveryGroupId = $deliveryGroup;
162
+ if ($deliveryGroup instanceOf Bronto_Api_DeliveryGroup_Row) {
163
+ if (!$deliveryGroup->id) {
164
+ $deliveryGroup = $deliveryGroup->read();
165
+ }
166
+ $deliveryGroupId = $deliveryGroup->id;
167
+ }
168
+
169
+ if (empty($deliveryGroupId)) {
170
+ $exceptionClass = $this->getExceptionClass();
171
+ throw new $exceptionClass('Unable to find deliveryGroup');
172
+ }
173
+
174
+ $deliveryGroupObject = $this->getApi()->getDeliveryGroupObject();
175
+ return $deliveryGroupObject->addToDeliveryGroup($deliveryGroupId, array($this->id));
176
+ }
177
+
178
+ /**
179
+ * Sets a value for a Message Field
180
+ *
181
+ * @param string $$field
182
+ * @param mixed $value
183
+ * @param string $$type text|html
184
+ * @return Bronto_Api_Delivery_Row
185
+ */
186
+ public function setField($field, $value, $type = 'html')
187
+ {
188
+ if (strlen($field) > 25) {
189
+ // Make sure we don't pass a field name longer than 25 characters
190
+ $field = substr($field, 0, 25);
191
+ }
192
+
193
+ $messageField = array(
194
+ 'name' => $field,
195
+ 'type' => $type,
196
+ 'content' => $value,
197
+ );
198
+
199
+ if (!isset($this->_data['fields']) || !is_array($this->_data['fields'])) {
200
+ $this->_data['fields'] = array();
201
+ } else {
202
+ // Check for dupes
203
+ foreach ($this->_data['fields'] as $i => $_field) {
204
+ if ($_field['name'] == $messageField['name']) {
205
+ $this->_data['fields'][$i] = $messageField;
206
+ $this->_modifiedFields['fields'] = true;
207
+ return $this;
208
+ }
209
+ }
210
+ }
211
+
212
+ $this->_data['fields'][] = $messageField;
213
+ $this->_modifiedFields['fields'] = true;
214
+ return $this;
215
+ }
216
+
217
+ /**
218
+ * @return array
219
+ */
220
+ public function getFields()
221
+ {
222
+ if (!empty($this->_data['fields'])) {
223
+ return $this->_data['fields'];
224
+ }
225
+ return array();
226
+ }
227
+
228
+ /**
229
+ * @param bool $upsert Ignored
230
+ * @param bool $refresh
231
+ * @return Bronto_Api_Delivery_Row
232
+ */
233
+ public function save($upsert = null, $refresh = false)
234
+ {
235
+ parent::_save(false, $refresh);
236
+ return $this;
237
+ }
238
+ }
lib/Bronto/Api/DeliveryGroup.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/deliverygroupobject
9
+ *
10
+ * @method Bronto_Api_DeliveryGroup_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_DeliveryGroup extends Bronto_Api_Object
13
+ {
14
+ /** Visibility */
15
+ const VISIBILITY_INTERNAL = 'INTERNAL';
16
+ const VISIBILITY_PUBLIC = 'PUBLIC';
17
+
18
+ /** memberType */
19
+ const MEMBER_TYPE_DELIVERIES = 'DELIVERIES';
20
+ const MEMBER_TYPE_AUTOMATORS = 'AUTOMATORS';
21
+ const MEMBER_TYPE_MESSAGEGROUPS = 'MESSAGEGROUPS';
22
+ const MEMBER_TYPE_DELIVERYGROUPS = 'DELIVERYGROUPS';
23
+
24
+ /**
25
+ * The object name.
26
+ *
27
+ * @var string
28
+ */
29
+ protected $_name = 'DeliveryGroup';
30
+
31
+ /**
32
+ * @var array
33
+ */
34
+ protected $_methods = array(
35
+ 'addDeliveryGroup' => 'add',
36
+ 'readDeliveryGroups' => 'read',
37
+ 'updateDeliveryGroup' => 'update',
38
+ 'deleteDeliveryGroup' => 'delete',
39
+ 'addOrUpdateDeliveryGroup' => 'addOrUpdate',
40
+ 'addToDeliveryGroup' => true,
41
+ 'deleteFromDeliveryGroup' => true,
42
+ );
43
+
44
+ /**
45
+ * @var array
46
+ */
47
+ protected $_options = array(
48
+ 'visibility' => array(
49
+ self::VISIBILITY_INTERNAL,
50
+ self::VISIBILITY_PUBLIC,
51
+ ),
52
+ 'memberType' => array(
53
+ self::MEMBER_TYPE_DELIVERIES,
54
+ self::MEMBER_TYPE_AUTOMATORS,
55
+ self::MEMBER_TYPE_MESSAGEGROUPS,
56
+ self::MEMBER_TYPE_DELIVERYGROUPS,
57
+ ),
58
+ );
59
+
60
+ /**
61
+ * @param array $filter
62
+ * @param int $pageNumber
63
+ * @return Bronto_Api_Rowset
64
+ */
65
+ public function readAll(array $filter = array(), $pageNumber = 1)
66
+ {
67
+ $params = array();
68
+ $params['filter'] = $filter;
69
+ $params['pageNumber'] = (int) $pageNumber;
70
+ return $this->read($params);
71
+ }
72
+
73
+ /**
74
+ * @param string $deliveryGroupId
75
+ * @param array $deliveryIds
76
+ * @param array $messageIds
77
+ * @param array $messageRuleIds
78
+ * @return Bronto_Api_Rowset
79
+ */
80
+ public function addToDeliveryGroup($deliveryGroupId, array $deliveryIds = array(), array $messageIds = array(), array $messageRuleIds = array())
81
+ {
82
+ $data = array(
83
+ 'deliveryGroup' => array('id' => $deliveryGroupId),
84
+ );
85
+
86
+ if (!empty($deliveryIds)) {
87
+ $data['deliveryIds'] = $deliveryIds;
88
+ }
89
+
90
+ if (!empty($messageIds)) {
91
+ $data['messageIds'] = $messageIds;
92
+ }
93
+
94
+ if (!empty($messageRuleIds)) {
95
+ $data['messageRuleIds'] = $messageRuleIds;
96
+ }
97
+
98
+ return $this->doRequest('addToDeliveryGroup', $data);
99
+ }
100
+ }
lib/Bronto/Api/DeliveryGroup/Exception.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Api_DeliveryGroup_Exception extends Bronto_Api_Exception
7
+ {
8
+ const INVALID_DELIVERYGROUP = 801; // The specified deliverygroup was invalid.
9
+ const DELIVERYGROUP_NO_ID = 802; // No ID provided for deliverygroup.
10
+ const DELIVERYGROUP_DOES_NOT_EXIST = 803; // Specified deliverygroup (id=%s) does not exist.
11
+ const DELIVERYGROUP_ADD_FAIL = 804; // Failed to add deliverygroup.
12
+ const DELIVERYGROUP_LIST_FAIL = 805; // Failed to list %s for deliverygroup (id=%s).
13
+ const DELIVERYGROUP_ID_FAIL = 806; // Failed to find %s with id=%s in deliverygroup.
14
+ const DELIVERYGROUP_IDS_FAIL = 807; // Failed to find %s in deliverygroup.
15
+ const DELIVERYGROUP_DELETE_FAIL = 808; // Failed to remove deliverygroup.
16
+ const DELIVERYGROUP_ADD_MEMBER_FAIL = 809; // Failed to add element to deliverygroup.
17
+ const DELIVERYGROUP_DELETE_MEMBER_FAIL = 810; // Failed to remove element from deliverygroup.
18
+ const DELIVERYGROUP_SEARCH_FAIL = 811; // Search failed for query=%s.
19
+ const DELIVERYGROUP_UPDATE_FAIL = 812; // Failed to update deliverygroup.
20
+ const DELIVERYGROUP_CREATED_ADD_MEMBER_FAIL = 813; // Created deliverygroup but failed to add one or more elements to it
21
+ }
lib/Bronto/Api/DeliveryGroup/Row.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $id
8
+ * @property string $name
9
+ * @property string $visibility
10
+ * @property int $deliveryCount
11
+ * @property string $createdDate
12
+ * @property array $deliveryIds
13
+ * @property array $messageRuleIds
14
+ * @property array $messageIds
15
+ * @method Bronto_Api_DeliveryGroup getApiObject() getApiObject()
16
+ */
17
+ class Bronto_Api_DeliveryGroup_Row extends Bronto_Api_Row
18
+ {
19
+ /**
20
+ * @return Bronto_Api_DeliveryGroup_Row
21
+ */
22
+ public function read()
23
+ {
24
+ if ($this->id) {
25
+ $params = array('id' => $this->id);
26
+ } elseif ($this->name) {
27
+ $params = array(
28
+ 'name' => array(
29
+ 'value' => $this->name,
30
+ 'operator' => 'EqualTo',
31
+ )
32
+ );
33
+ }
34
+
35
+ parent::_read($params);
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * @param bool $upsert
41
+ * @param bool $refresh
42
+ * @return Bronto_Api_DeliveryGroup_Row
43
+ */
44
+ public function save($upsert = true, $refresh = false)
45
+ {
46
+ if (!$upsert) {
47
+ parent::_save(false, $refresh);
48
+ }
49
+
50
+ try {
51
+ parent::_save(true, $refresh);
52
+ } catch (Bronto_Api_DeliveryGroup_Exception $e) {
53
+ $this->getApi()->throwException($e);
54
+ }
55
+
56
+ return $this;
57
+ }
58
+ }
lib/Bronto/Api/Exception.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ */
8
+ class Bronto_Api_Exception extends Exception
9
+ {
10
+ const UNKNOWN_ERROR = 101; // There was an unknown API error. Please try your request again shortly.
11
+ const INVALID_TOKEN = 102; // Authentication failed for token:
12
+ const INVALID_SESSION_TOKEN = 103; // Your session is invalid. Please log in again.
13
+ const INVALID_ACCESS = 104; // You do not have valid access for this method.
14
+ const INVALID_INPUT_ARRAY = 105; // You must specify at least one item in the input array.
15
+ const INVALID_PARAMETER = 106; // Unable to verify parameter:
16
+ const INVALID_REQUEST = 107; // There was an error in your soap request. Please examine the request and try again.
17
+ const SHARD_OFFLINE = 108; // The API is currently undergoing maintenance. Please try your request again later.
18
+ const SITE_INACTIVE = 109; // This site is currently marked as 'inactive'
19
+ const REQUIRED_FIELDS = 110; // Required fields are missing:
20
+ const UNAUTHORIZED_IP = 111; // Your IP address does not have access for token.
21
+ const INVALID_FILTER = 112; // Invalid filter type (must be AND or OR).
22
+ const READ_ERROR = 113; // There was an error reading your query results. Please try your request again shortly.
23
+
24
+ const INVALID_PAGE_SIZE = 115; // Page size is lower than the minimum allowed limit of #
25
+
26
+ /* Misc */
27
+ const HTTP_HEADER_ERROR = 98001; // Error Fetching http headers
28
+ const NO_XML_DOCUMENT = 98002;
29
+ const INVALID_URL = 98003;
30
+ const CONNECT_ERROR = 98004;
31
+ const WSDL_PARSE_ERROR = 98005; // SOAP-ERROR: Parsing WSDL
32
+ const REQUEST_ERROR = 98006;
33
+ const CONNECTION_RESET = 98007; // SSL: Connection reset by peer
34
+ const CONNECTION_FAILED = 98008; // Could not connect to host
35
+ const SERVICE_UNAVAILABLE = 98009; // Service Temporarily Unavailable
36
+ const SOAPCLIENT_ERROR = 98010; // SoapClient::__doRequest(): %s
37
+ const SERVER_ERROR = 98500; // Internal Server Error
38
+
39
+ /* Custom */
40
+ const EMPTY_RESULT = 99001;
41
+ const NO_TOKEN = 99002;
42
+
43
+ /**
44
+ * Array of exceptions we can (maybe) recover from
45
+ * @var array
46
+ */
47
+ protected $_recoverable = array(
48
+ self::UNKNOWN_ERROR,
49
+ self::INVALID_SESSION_TOKEN,
50
+ self::INVALID_REQUEST,
51
+ self::SHARD_OFFLINE,
52
+ self::READ_ERROR,
53
+ self::HTTP_HEADER_ERROR,
54
+ self::NO_XML_DOCUMENT,
55
+ self::CONNECT_ERROR,
56
+ self::WSDL_PARSE_ERROR,
57
+ self::CONNECTION_RESET,
58
+ self::CONNECTION_FAILED,
59
+ self::SERVICE_UNAVAILABLE,
60
+ self::SERVER_ERROR,
61
+ self::SOAPCLIENT_ERROR,
62
+ );
63
+
64
+ /**
65
+ * @var string
66
+ */
67
+ protected $_request;
68
+
69
+ /**
70
+ * @var string
71
+ */
72
+ protected $_response;
73
+
74
+ /**
75
+ * For PHP <5.3.0
76
+ *
77
+ * @var Exception
78
+ */
79
+ protected $_previous;
80
+
81
+ /**
82
+ * @param string $message
83
+ * @param string $code
84
+ * @param int $tries
85
+ * @param Exception $previous
86
+ */
87
+ public function __construct($message = '', $code = 0, $tries = null, Exception $previous = null)
88
+ {
89
+ if (empty($code)) {
90
+ $parts = explode(':', $message, 2);
91
+ if (is_array($parts)) {
92
+ $parts = array_map('trim', $parts);
93
+ }
94
+ if (isset($parts[0]) && is_numeric($parts[0])) {
95
+ $code = (int) $parts[0];
96
+ $message = (string) $parts[1];
97
+ }
98
+ }
99
+
100
+ if (empty($code)) {
101
+ // Handle some SoapFault exceptions
102
+ if (stripos($message, 'Error Fetching http headers') !== false) {
103
+ $code = self::HTTP_HEADER_ERROR;
104
+ } else if (stripos($message, 'looks like we got no XML document') !== false) {
105
+ $code = self::NO_XML_DOCUMENT;
106
+ } else if (stripos($message, 'Could not connect to host') !== false) {
107
+ $code = self::CONNECT_ERROR;
108
+ } else if (stripos($message, 'Parsing WSDL') !== false) {
109
+ $code = self::WSDL_PARSE_ERROR;
110
+ } else if (stripos($message, 'There was an error in your soap request') !== false) {
111
+ $code = self::REQUEST_ERROR;
112
+ } else if (stripos($message, 'Connection reset by peer') !== false) {
113
+ $code = self::CONNECTION_RESET;
114
+ } else if (stripos($message, 'Unable to parse URL') !== false) {
115
+ $code = self::INVALID_URL;
116
+ } else if (stripos($message, 'Could not connect to host') !== false) {
117
+ $code = self::CONNECTION_FAILED;
118
+ } else if (stripos($message, 'Service Temporarily Unavailable') !== false) {
119
+ $code = self::SERVICE_UNAVAILABLE;
120
+ } else if (stripos($message, 'Internal Server Error') !== false) {
121
+ $code = self::SERVER_ERROR;
122
+ } else if (stripos($message, 'SoapClient::__doRequest()') !== false) {
123
+ $code = self::SOAPCLIENT_ERROR;
124
+ }
125
+ }
126
+
127
+ if (!empty($code)) {
128
+ $message = "{$code} : {$message}";
129
+ }
130
+
131
+ if (!empty($tries) && $tries > 1) {
132
+ $message .= " [Tried: {$tries}]";
133
+ }
134
+
135
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
136
+ parent::__construct($message, $code, $previous);
137
+ } else {
138
+ $this->_previous = $previous;
139
+ parent::__construct($message, $code);
140
+ }
141
+ }
142
+
143
+ /**
144
+ * @param string $message
145
+ */
146
+ public function setMessage($message)
147
+ {
148
+ $this->message = $message;
149
+ }
150
+
151
+ /**
152
+ * @param string $text
153
+ */
154
+ public function appendToMessage($text)
155
+ {
156
+ $this->message .= " {$text}";
157
+ }
158
+
159
+ /**
160
+ * @return bool
161
+ */
162
+ public function isRecoverable()
163
+ {
164
+ if (!$this->getCode()) {
165
+ return false;
166
+ }
167
+ return in_array($this->getCode(), $this->_recoverable);
168
+ }
169
+
170
+ /**
171
+ * @param string $request
172
+ * @return Bronto_Api_Exception
173
+ */
174
+ public function setRequest($request)
175
+ {
176
+ $this->_request = $request;
177
+ return $this;
178
+ }
179
+
180
+ /**
181
+ * @return string
182
+ */
183
+ public function getRequest()
184
+ {
185
+ return $this->_request;
186
+ }
187
+
188
+ /**
189
+ * @param string $response
190
+ * @return Bronto_Api_Exception
191
+ */
192
+ public function setResponse($response)
193
+ {
194
+ $this->_response = $response;
195
+ }
196
+
197
+ /**
198
+ * @return string
199
+ */
200
+ public function getResponse()
201
+ {
202
+ return $this->_response;
203
+ }
204
+
205
+ /**
206
+ * For PHP <5.3.0
207
+ * @return Exception|null
208
+ */
209
+ public function getPreviousException()
210
+ {
211
+ if (method_exists($this, 'getPrevious')) {
212
+ return $this->getPrevious();
213
+ }
214
+ return $this->getPreviousException();
215
+ }
216
+
217
+ /**
218
+ * @return array
219
+ */
220
+ public function getTraceSafe()
221
+ {
222
+ if (!isset($this->_trace)) {
223
+ $this->_trace = $this->getTrace();
224
+ if (empty($this->_trace)) {
225
+ $backtrace = debug_backtrace();
226
+ $this->_trace = array($backtrace[count($backtrace)-1]);
227
+ }
228
+ }
229
+ return $this->_trace;
230
+ }
231
+
232
+ /**
233
+ * @return string
234
+ */
235
+ public function getErrorClass()
236
+ {
237
+ $trace = $this->getTraceSafe();
238
+ return $trace[0]['class'];
239
+ }
240
+
241
+ /**
242
+ * @return string
243
+ */
244
+ public function getErrorMethod()
245
+ {
246
+ $trace = $this->getTraceSafe();
247
+ return $trace[0]['function'];
248
+ }
249
+ }
lib/Bronto/Api/Field.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/fieldobject
9
+ *
10
+ * @method Bronto_Api_Field_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_Field extends Bronto_Api_Object
13
+ {
14
+ /** Type */
15
+ const TYPE_TEXT = 'text';
16
+ const TYPE_TEXTAREA = 'textarea';
17
+ const TYPE_PASSWORD = 'password';
18
+ const TYPE_CHECKBOX = 'checkbox';
19
+ const TYPE_RADIO = 'radio';
20
+ const TYPE_SELECT = 'select';
21
+ const TYPE_INTEGER = 'integer';
22
+ const TYPE_CURRENCY = 'currency';
23
+ const TYPE_FLOAT = 'float';
24
+ const TYPE_DATE = 'date';
25
+
26
+ /**
27
+ * @var array
28
+ */
29
+ protected $_methods = array(
30
+ 'addFields' => 'add',
31
+ 'readFields' => 'read',
32
+ 'updateFields' => 'update',
33
+ 'deleteFields' => 'delete',
34
+ );
35
+
36
+ /**
37
+ * @var array
38
+ */
39
+ protected $_options = array(
40
+ 'type' => array(
41
+ self::TYPE_TEXT,
42
+ self::TYPE_TEXTAREA,
43
+ self::TYPE_PASSWORD,
44
+ self::TYPE_CHECKBOX,
45
+ self::TYPE_RADIO,
46
+ self::TYPE_SELECT,
47
+ self::TYPE_INTEGER,
48
+ self::TYPE_CURRENCY,
49
+ self::TYPE_FLOAT,
50
+ self::TYPE_DATE,
51
+ ),
52
+ );
53
+
54
+ /**
55
+ * @var array
56
+ */
57
+ protected $_objectCache = array();
58
+
59
+ /**
60
+ * @param array $filter
61
+ * @param int $pageNumber
62
+ * @return Bronto_Api_Rowset
63
+ */
64
+ public function readAll(array $filter = array(), $pageNumber = 1)
65
+ {
66
+ $params = array();
67
+ $params['filter'] = $filter;
68
+ $params['pageNumber'] = (int) $pageNumber;
69
+ return $this->read($params);
70
+ }
71
+
72
+ /**
73
+ * @param string $index
74
+ * @param Bronto_Api_Field_Row $field
75
+ * @return Bronto_Api_Field
76
+ */
77
+ public function addToCache($index, Bronto_Api_Field_Row $field)
78
+ {
79
+ $this->_objectCache[$index] = $field;
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * @param string $index
85
+ * @return Bronto_Api_Field_Row
86
+ */
87
+ public function getFromCache($index)
88
+ {
89
+ if (isset($this->_objectCache[$index]) && $this->_objectCache[$index] instanceOf Bronto_Api_Field_Row) {
90
+ return $this->_objectCache[$index];
91
+ }
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * @param string $name
97
+ * @return string
98
+ */
99
+ public function normalize($name)
100
+ {
101
+ $name = strtolower($name);
102
+ $name = preg_replace("/[^a-z\d_]/i", '_', $name);
103
+ $name = trim(preg_replace('/_+/', '_', $name), '_');
104
+
105
+ return $name;
106
+ }
107
+
108
+ /**
109
+ * @param string $name
110
+ * @param array $values
111
+ */
112
+ public function guessType($name, array $values)
113
+ {
114
+ // Check predefined fields first
115
+ if (isset(Bronto_Api_Field_Predefined::$normalizerMap[$name])) {
116
+ if (isset(Bronto_Api_Field_Predefined::$predefinedFields[$name])) {
117
+ return array(
118
+ $name => Bronto_Api_Field_Predefined::$predefinedFields[$name]
119
+ );
120
+ }
121
+ } else {
122
+ foreach (Bronto_Api_Field_Predefined::$normalizerMap as $key => $synonyms) {
123
+ if (in_array($name, $synonyms)) {
124
+ return array(
125
+ $key => Bronto_Api_Field_Predefined::$predefinedFields[$key]
126
+ );
127
+ }
128
+ }
129
+ }
130
+
131
+ // Try to type guess
132
+ $typeGuesser = new Bronto_Api_Field_TypeGuesser();
133
+ $typeGuesser->processValues($values);
134
+ return $typeGuesser->getChoice();
135
+ }
136
+ }
lib/Bronto/Api/Field/Exception.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_Field_Exception extends Bronto_Api_Exception
8
+ {
9
+ const INVALID_FIELD = 401; // The specified field was invalid.
10
+ const ALREADY_EXISTS = 402; // A field with this name already exists.
11
+ const INVALID_DISPLAY = 403; // The specified field type was invalid:
12
+ const INVALID_NAME = 404; // The field name was missing or invalid.
13
+ const INVALID_VISIBILITY = 405; // The specified field visibility was invalid.
14
+ const ALLOCATION_EXCEED = 408; // This operation would exceed your field allocation of %d.
15
+ const INVALID_FIELD_VALUE = 409; // The value specified for the field %%id%% was invalid.
16
+ const DATA_TRUNCATION = 410; // The value specified for the field %%id%% was too large.
17
+ const SEGMENT_DEPENDENCY = 411; // The field cannot be deleted because a segment depends upon it.
18
+ }
lib/Bronto/Api/Field/Predefined.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Api_Field_Predefined
10
+ {
11
+ /** Predefined Fields */
12
+ const FIELD_EMAIL = 'email';
13
+ const FIELD_SALUTATION = 'salutation';
14
+ const FIELD_FIRSTNAME = 'firstname';
15
+ const FIELD_LASTNAME = 'lastname';
16
+ const FIELD_AGE = 'age';
17
+ const FIELD_GENDER = 'gender';
18
+ const FIELD_BIRTHDAY = 'birthday';
19
+ const FIELD_ADDRESS1 = 'address1';
20
+ const FIELD_ADDRESS2 = 'address2';
21
+ const FIELD_CITY = 'city';
22
+ const FIELD_STATE = 'state';
23
+ const FIELD_STATE_ABBR = 'state_abbrev';
24
+ const FIELD_STATE_ABBR_UC = 'state_abbrev_uc';
25
+ const FIELD_STATE_PROVINCE = 'state_province';
26
+ const FIELD_POSTAL_CODE = 'postal_code';
27
+ const FIELD_COUNTRY = 'country';
28
+ const FIELD_COUNTRY_CODE = 'country_code';
29
+ const FIELD_PHONE_HOME = 'phone_home';
30
+ const FIELD_PHONE_WORK = 'phone_work';
31
+ const FIELD_PHONE_MOBILE = 'phone_mobile';
32
+ const FIELD_NUM_CHILDREN = 'num_children';
33
+ const FIELD_EDUCATION = 'education';
34
+ const FIELD_MARITAL_STATUS = 'marital_status';
35
+
36
+ /**
37
+ * @var array
38
+ */
39
+ public static $predefinedFields = array(
40
+ self::FIELD_SALUTATION => array(
41
+ 'label' => 'Salutation',
42
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
43
+ ),
44
+ self::FIELD_FIRSTNAME => array(
45
+ 'label' => 'First Name',
46
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
47
+ ),
48
+ self::FIELD_LASTNAME => array(
49
+ 'label' => 'Last Name',
50
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
51
+ ),
52
+ self::FIELD_AGE => array(
53
+ 'label' => 'Age',
54
+ 'type' => Bronto_Api_Field::TYPE_INTEGER,
55
+ ),
56
+ self::FIELD_GENDER => array(
57
+ 'label' => 'Gender',
58
+ 'type' => Bronto_Api_Field::TYPE_RADIO,
59
+ 'options' => array(
60
+ array(
61
+ 'value' => 'male',
62
+ 'isDefault' => false,
63
+ ),
64
+ array(
65
+ 'value' => 'female',
66
+ 'isDefault' => false,
67
+ ),
68
+ ),
69
+ ),
70
+ self::FIELD_BIRTHDAY => array(
71
+ 'label' => 'Birthday',
72
+ 'type' => Bronto_Api_Field::TYPE_DATE,
73
+ ),
74
+ self::FIELD_ADDRESS1 => array(
75
+ 'label' => 'Address',
76
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
77
+ ),
78
+ self::FIELD_ADDRESS2 => array(
79
+ 'label' => 'Address (Contd.)',
80
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
81
+ ),
82
+ self::FIELD_CITY => array(
83
+ 'label' => 'City',
84
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
85
+ ),
86
+ self::FIELD_STATE => array(
87
+ 'label' => 'State',
88
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
89
+ ),
90
+ self::FIELD_STATE_ABBR => array(
91
+ 'label' => 'State (Two-Letter Abbreviation)',
92
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
93
+ ),
94
+ self::FIELD_STATE_ABBR_UC => array(
95
+ 'label' => 'State (Uppercase Two-Letter Abbreviation)',
96
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
97
+ ),
98
+ self::FIELD_STATE_PROVINCE => array(
99
+ 'label' => 'State or Province',
100
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
101
+ ),
102
+ self::FIELD_POSTAL_CODE => array(
103
+ 'label' => 'Postal/ZIP Code',
104
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
105
+ ),
106
+ self::FIELD_COUNTRY => array(
107
+ 'label' => 'Country',
108
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
109
+ ),
110
+ self::FIELD_COUNTRY_CODE => array(
111
+ 'label' => 'Country',
112
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
113
+ ),
114
+ self::FIELD_PHONE_HOME => array(
115
+ 'label' => 'Home Phone',
116
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
117
+ ),
118
+ self::FIELD_PHONE_WORK => array(
119
+ 'label' => 'Work Phone',
120
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
121
+ ),
122
+ self::FIELD_PHONE_MOBILE => array(
123
+ 'label' => 'Mobile / Cell Phone',
124
+ 'type' => Bronto_Api_Field::TYPE_TEXT,
125
+ ),
126
+ self::FIELD_NUM_CHILDREN => array(
127
+ 'label' => 'Number of Children',
128
+ 'type' => Bronto_Api_Field::TYPE_SELECT,
129
+ 'options' => array(
130
+ array(
131
+ 'value' => 'None (0)',
132
+ 'isDefault' => true,
133
+ ),
134
+ array(
135
+ 'value' => '1',
136
+ 'isDefault' => false,
137
+ ),
138
+ array(
139
+ 'value' => '2',
140
+ 'isDefault' => false,
141
+ ),
142
+ array(
143
+ 'value' => '3',
144
+ 'isDefault' => false,
145
+ ),
146
+ array(
147
+ 'value' => '4',
148
+ 'isDefault' => false,
149
+ ),
150
+ array(
151
+ 'value' => '5',
152
+ 'isDefault' => false,
153
+ ),
154
+ array(
155
+ 'value' => '6',
156
+ 'isDefault' => false,
157
+ ),
158
+ array(
159
+ 'value' => '7',
160
+ 'isDefault' => false,
161
+ ),
162
+ array(
163
+ 'value' => '8',
164
+ 'isDefault' => false,
165
+ ),
166
+ array(
167
+ 'value' => '9',
168
+ 'isDefault' => false,
169
+ ),
170
+ array(
171
+ 'value' => '10',
172
+ 'isDefault' => false,
173
+ ),
174
+ ),
175
+ ),
176
+ self::FIELD_EDUCATION => array(
177
+ 'label' => 'Highest Level of Education',
178
+ 'type' => Bronto_Api_Field::TYPE_SELECT,
179
+ 'options' => array(
180
+ array(
181
+ 'value' => 'somehighschool',
182
+ 'isDefault' => false,
183
+ ),
184
+ array(
185
+ 'value' => 'highschool',
186
+ 'isDefault' => false,
187
+ ),
188
+ array(
189
+ 'value' => 'somecollege',
190
+ 'isDefault' => false,
191
+ ),
192
+ array(
193
+ 'value' => 'college',
194
+ 'isDefault' => false,
195
+ ),
196
+ array(
197
+ 'value' => 'somegraduate',
198
+ 'isDefault' => false,
199
+ ),
200
+ array(
201
+ 'value' => 'graduate',
202
+ 'isDefault' => false,
203
+ ),
204
+ ),
205
+ ),
206
+ self::FIELD_MARITAL_STATUS => array(
207
+ 'label' => 'Marital Status',
208
+ 'type' => Bronto_Api_Field::TYPE_SELECT,
209
+ 'options' => array(
210
+ array(
211
+ 'value' => 'single',
212
+ 'isDefault' => false,
213
+ ),
214
+ array(
215
+ 'value' => 'married',
216
+ 'isDefault' => false,
217
+ ),
218
+ array(
219
+ 'value' => 'divorced',
220
+ 'isDefault' => false,
221
+ ),
222
+ array(
223
+ 'value' => 'widowed',
224
+ 'isDefault' => false,
225
+ ),
226
+ ),
227
+ ),
228
+ );
229
+
230
+ /**
231
+ * @var array
232
+ */
233
+ public static $normalizerMap = array(
234
+ self::FIELD_EMAIL => array(
235
+ 'email_address',
236
+ 'emailaddress',
237
+ ),
238
+ self::FIELD_SALUTATION => array(),
239
+ self::FIELD_FIRSTNAME => array(
240
+ 'first_name',
241
+ 'fname',
242
+ ),
243
+ self::FIELD_LASTNAME => array(
244
+ 'last_name',
245
+ 'lname',
246
+ ),
247
+ self::FIELD_AGE => array(),
248
+ self::FIELD_GENDER => array(),
249
+ self::FIELD_BIRTHDAY => array(
250
+ 'birth_day',
251
+ 'birth_date',
252
+ 'dob',
253
+ 'birthdate',
254
+ 'dateofbirth',
255
+ 'date_of_birth',
256
+ ),
257
+ self::FIELD_ADDRESS1 => array(
258
+ 'address_line1',
259
+ 'addressline1',
260
+ 'address_1',
261
+ ),
262
+ self::FIELD_ADDRESS2 => array(
263
+ 'address_line2',
264
+ 'addressline2',
265
+ 'address_2',
266
+ ),
267
+ self::FIELD_CITY => array(
268
+ 'cityname',
269
+ 'city_name',
270
+ ),
271
+ self::FIELD_STATE => array(),
272
+ self::FIELD_STATE_ABBR => array(),
273
+ self::FIELD_STATE_ABBR_UC => array(),
274
+ self::FIELD_STATE_PROVINCE => array(),
275
+ self::FIELD_POSTAL_CODE => array(
276
+ 'zipcode',
277
+ 'zip',
278
+ 'postcode',
279
+ 'postalcode',
280
+ 'zip_code',
281
+ ),
282
+ self::FIELD_COUNTRY => array(),
283
+ self::FIELD_COUNTRY_CODE => array(),
284
+ self::FIELD_PHONE_HOME => array(
285
+ 'phonehome',
286
+ 'home_phone',
287
+ 'phone',
288
+ 'homephone',
289
+ ),
290
+ self::FIELD_PHONE_WORK => array(
291
+ 'phonework',
292
+ 'work_phone',
293
+ 'workphone',
294
+ ),
295
+ self::FIELD_PHONE_MOBILE => array(
296
+ 'mobile',
297
+ 'mobile_phone',
298
+ 'cell',
299
+ 'cellphone',
300
+ 'mobilephone',
301
+ ),
302
+ self::FIELD_NUM_CHILDREN => array(),
303
+ self::FIELD_EDUCATION => array(),
304
+ self::FIELD_MARITAL_STATUS => array(),
305
+ );
306
+ }
lib/Bronto/Api/Field/Row.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property-read string $id
8
+ * @property string $name
9
+ * @property string $label
10
+ * @property string $type
11
+ * @property string $visibility
12
+ * @property array $options
13
+ * @method Bronto_Api_Field_Row delete() delete()
14
+ * @method Bronto_Api_Field getApiObject() getApiObject()
15
+ */
16
+ class Bronto_Api_Field_Row extends Bronto_Api_Row
17
+ {
18
+ /**
19
+ * @return Bronto_Api_Field_Row
20
+ */
21
+ public function read()
22
+ {
23
+ if ($this->id) {
24
+ $params = array('id' => $this->id);
25
+ } elseif ($this->name) {
26
+ $params = array(
27
+ 'name' => array(
28
+ 'value' => $this->name,
29
+ 'operator' => 'EqualTo',
30
+ )
31
+ );
32
+ }
33
+
34
+ parent::_read($params);
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * @param bool $upsert
40
+ * @param bool $refresh
41
+ * @return Bronto_Api_Field_Row
42
+ */
43
+ public function save($upsert = true, $refresh = false)
44
+ {
45
+ if (!$upsert) {
46
+ parent::_save(false, $refresh);
47
+ }
48
+
49
+ try {
50
+ parent::_save(true, $refresh);
51
+ } catch (Bronto_Api_Field_Exception $e) {
52
+ if ($e->getCode() === Bronto_Api_Field_Exception::ALREADY_EXISTS) {
53
+ $this->_refresh();
54
+ } else {
55
+ $e->appendToMessage("(Name: {$this->name})");
56
+ $this->getApi()->throwException($e);
57
+ }
58
+ }
59
+
60
+ return $this;
61
+ }
62
+ }
lib/Bronto/Api/Field/TypeGuesser.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Api_Field_TypeGuesser
10
+ {
11
+ const DEFAULT_CHOICE = 'text';
12
+ const CONFIDENCE_THRESHOLD = 70;
13
+
14
+ /**
15
+ * @var int
16
+ */
17
+ protected $_total = 0;
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $_guesses = array();
23
+
24
+ /**
25
+ * @var array
26
+ */
27
+ protected $_defaultGuesses = array(
28
+ 'text' => 0,
29
+ 'integer' => 0,
30
+ 'currency' => 0,
31
+ 'float' => 0,
32
+ 'date' => 0,
33
+ );
34
+
35
+ /**
36
+ * @return text
37
+ */
38
+ public function getChoice()
39
+ {
40
+ if ($this->_total > 0) {
41
+ arsort($this->_guesses);
42
+
43
+ foreach ($this->_guesses as $type => $votes) {
44
+ $confidence = ($votes / $this->_total) * 100;
45
+ if ($confidence >= self::CONFIDENCE_THRESHOLD) {
46
+ return $type;
47
+ }
48
+ break;
49
+ }
50
+ }
51
+
52
+ return self::DEFAULT_CHOICE;
53
+ }
54
+
55
+ /**
56
+ * @param type $name
57
+ * @param array $values
58
+ * @param bool $inversed
59
+ */
60
+ public function processValues(array $values = array(), $inversed = true)
61
+ {
62
+ $this->_guesses = $this->_defaultGuesses;
63
+
64
+ foreach ($values as $i => $value) {
65
+ $this->_total++;
66
+
67
+ if ($inversed) {
68
+ $this->processValue($i);
69
+ } else {
70
+ $this->processValue($value);
71
+ }
72
+
73
+ if ($this->_total === 1000) {
74
+ break;
75
+ }
76
+ }
77
+ }
78
+
79
+ /**
80
+ * @param text $name
81
+ * @param mixed $value
82
+ */
83
+ protected function processValue($value)
84
+ {
85
+ if ($value === '') {
86
+ return;
87
+ }
88
+
89
+ // Only A-Z
90
+ if (!is_int($value) && ctype_alpha($value)) {
91
+ $this->_guesses['text'] += 1;
92
+ return;
93
+ }
94
+
95
+ // Only 0-9
96
+ if (is_int($value) || ctype_digit($value)) {
97
+ if (strlen($value) <= 11) {
98
+ $this->_guesses['integer'] += 1;
99
+ } else {
100
+ $this->_guesses['text'] += 1;
101
+ $this->_guesses['integer'] = 0;
102
+ }
103
+ return;
104
+ }
105
+
106
+ // 0-9 with .
107
+ if (is_numeric($value)) {
108
+ if (strlen($value) <= 15) {
109
+ $this->_guesses['currency'] += 1;
110
+ } elseif (strlen($value) <= 53) {
111
+ $this->_guesses['float'] += 1;
112
+ $this->_guesses['currency'] = 0;
113
+ } else {
114
+ $this->_guesses['text'] += 1;
115
+ $this->_guesses['float'] = 0;
116
+ $this->_guesses['currency'] = 0;
117
+ }
118
+ return;
119
+ }
120
+
121
+ if (strtotime($value) !== false) {
122
+ // Possible date
123
+ $this->_guesses['date'] += 1;
124
+ } else {
125
+ // String is last choice
126
+ $this->_guesses['text'] += 1;
127
+ }
128
+ }
129
+ }
lib/Bronto/Api/List.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/maillistobject
9
+ *
10
+ * @method Bronto_Api_List_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_List extends Bronto_Api_Object
13
+ {
14
+ /**
15
+ * The object name.
16
+ *
17
+ * @var string
18
+ */
19
+ protected $_name = 'MailList';
20
+
21
+ /**
22
+ * @var array
23
+ */
24
+ protected $_methods = array(
25
+ 'addLists' => 'add',
26
+ 'readLists' => 'read',
27
+ 'updateLists' => 'update',
28
+ 'deleteLists' => 'delete',
29
+ 'addToList' => true,
30
+ 'clearLists' => true,
31
+ );
32
+
33
+ /**
34
+ * @param array $filter
35
+ * @param int $pageNumber
36
+ * @return Bronto_Api_Rowset
37
+ */
38
+ public function readAll(array $filter = array(), $pageNumber = 1)
39
+ {
40
+ $params = array();
41
+ $params['filter'] = $filter;
42
+ $params['pageNumber'] = (int) $pageNumber;
43
+ return $this->read($params);
44
+ }
45
+
46
+ /**
47
+ * @param array $data
48
+ * @return Bronto_Api_Rowset
49
+ */
50
+ public function clear(array $data = array())
51
+ {
52
+ if (array_values($data) !== $data) {
53
+ $data = array($data);
54
+ }
55
+ return $this->doRequest('clearLists', $data);
56
+ }
57
+ }
lib/Bronto/Api/List/Exception.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_List_Exception extends Bronto_Api_Exception
8
+ {
9
+ const INVALID_LIST = 501;
10
+ const ALREADY_EXISTS = 502;
11
+ const LIST_IS_SEGMENTED = 503;
12
+ const LIST_HAS_AUTOMATORS = 504;
13
+ const LIST_HAS_DELIVERIES = 505;
14
+ const ALREADY_ON_LIST = 506;
15
+ const MAX_CONTACTS_EXCEEDED = 507;
16
+ const NO_CONTACTS_SPECIFIED = 508;
17
+ const LABEL_LENGTH_EXCEEDED = 509;
18
+ const NAME_LENGTH_EXCEEDED = 510;
19
+ }
lib/Bronto/Api/List/Row.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @property-read string $id
9
+ * @property string $name
10
+ * @property string $label
11
+ * @property int $activeCount
12
+ * @property string $status
13
+ * @property string $visibility
14
+ * @method Bronto_Api_List_Row delete() delete()
15
+ * @method Bronto_Api_List getApiObject() getApiObject()
16
+ */
17
+ class Bronto_Api_List_Row extends Bronto_Api_Row implements Bronto_Api_Delivery_Recipient
18
+ {
19
+ /**
20
+ * Retrieves contacts for current list
21
+ *
22
+ * @param bool $includeLists
23
+ * @param array $fields
24
+ * @param int $pageNumber
25
+ * @return Bronto_Api_Rowset
26
+ */
27
+ public function getContacts($includeLists = false, array $fields = array(), $pageNumber = 1)
28
+ {
29
+ $contactObject = $this->getApi()->getContactObject();
30
+ $filter = array('listId' => $this->id);
31
+ return $contactObject->readAll($filter, $fields, $includeLists, $pageNumber);
32
+ }
33
+
34
+ /**
35
+ * @return Bronto_Api_List_Row
36
+ */
37
+ public function read()
38
+ {
39
+ if ($this->id) {
40
+ $params = array('id' => $this->id);
41
+ } elseif ($this->name) {
42
+ $params = array(
43
+ 'name' => array(
44
+ 'value' => $this->name,
45
+ 'operator' => 'EqualTo',
46
+ )
47
+ );
48
+ }
49
+
50
+ parent::_read($params);
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ * @param bool $upsert
56
+ * @param bool $refresh
57
+ * @return Bronto_Api_List_Row
58
+ */
59
+ public function save($upsert = true, $refresh = false)
60
+ {
61
+ if (!$upsert) {
62
+ parent::_save(false, $refresh);
63
+ }
64
+
65
+ try {
66
+ parent::_save(true, $refresh);
67
+ } catch (Bronto_Api_List_Exception $e) {
68
+ if ($e->getCode() === Bronto_Api_List_Exception::ALREADY_EXISTS) {
69
+ $this->_refresh();
70
+ } else {
71
+ $this->getApi()->throwException($e);
72
+ }
73
+ }
74
+
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * @return Bronto_Api_List_Row
80
+ */
81
+ public function clear()
82
+ {
83
+ $data = array();
84
+ if (!$this->id) {
85
+ $this->_refresh();
86
+ }
87
+
88
+ if ($this->id) {
89
+ $data = array('id' => $this->id);
90
+ } else {
91
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
92
+ throw new $exceptionClass('Nothing to clear.');
93
+ }
94
+
95
+ $this->getApiObject()->clear($data);
96
+ return $this;
97
+ }
98
+
99
+ /**
100
+ * Required by Bronto_Api_Delivery_Recipient
101
+ *
102
+ * @return true
103
+ */
104
+ public function isList()
105
+ {
106
+ return true;
107
+ }
108
+
109
+ /**
110
+ * Required by Bronto_Api_Delivery_Recipient
111
+ *
112
+ * @return false
113
+ */
114
+ public function isContact()
115
+ {
116
+ return false;
117
+ }
118
+
119
+ /**
120
+ * Required by Bronto_Api_Delivery_Recipient
121
+ *
122
+ * @return false
123
+ */
124
+ public function isSegment()
125
+ {
126
+ return false;
127
+ }
128
+ }
lib/Bronto/Api/Login.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/accountobject
9
+ *
10
+ * @method Bronto_Api_Login_Row createRow() createRow(array $data)
11
+ */
12
+ class Bronto_Api_Login extends Bronto_Api_Object
13
+ {
14
+ /**
15
+ * @var array
16
+ */
17
+ protected $_methods = array(
18
+ 'addLogins' => 'add',
19
+ 'readLogins' => 'read',
20
+ 'updateLogins' => 'update',
21
+ 'deleteLogins' => 'delete',
22
+ );
23
+
24
+ /**
25
+ * @param array $filter
26
+ * @param int $pageNumber
27
+ * @return Bronto_Api_Rowset
28
+ */
29
+ public function readAll(array $filter = array(), $pageNumber = 1)
30
+ {
31
+ if (empty($filter)) {
32
+ $filter = array(
33
+ 'username' => array(
34
+ 'operator' => 'StartsWith',
35
+ 'value' => ''
36
+ ),
37
+ );
38
+ }
39
+
40
+ $params = array();
41
+ $params['filter'] = $filter;
42
+ $params['pageNumber'] = (int) $pageNumber;
43
+
44
+ return parent::read($params);
45
+ }
46
+ }
lib/Bronto/Api/Login/ContactInformation.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/contactinformation
9
+ */
10
+ class Bronto_Api_Login_ContactInformation
11
+ {
12
+ /**
13
+ * @var string
14
+ */
15
+ public $organization;
16
+
17
+ /**
18
+ * @var string
19
+ */
20
+ public $firstName;
21
+
22
+ /**
23
+ * @var string
24
+ */
25
+ public $lastName;
26
+
27
+ /**
28
+ * @var string
29
+ */
30
+ public $email;
31
+
32
+ /**
33
+ * @var string
34
+ */
35
+ public $phone;
36
+
37
+ /**
38
+ * @var string
39
+ */
40
+ public $address;
41
+
42
+ /**
43
+ * @var string
44
+ */
45
+ public $address2;
46
+
47
+ /**
48
+ * @var string
49
+ */
50
+ public $city;
51
+
52
+ /**
53
+ * @var string
54
+ */
55
+ public $state;
56
+
57
+ /**
58
+ * @var string
59
+ */
60
+ public $zip;
61
+
62
+ /**
63
+ * @var string
64
+ */
65
+ public $country;
66
+
67
+ /**
68
+ * @var string
69
+ */
70
+ public $notes;
71
+
72
+ /**
73
+ * @param stdClass $data
74
+ */
75
+ public function __construct($data = array())
76
+ {
77
+ $data = (array) $data;
78
+ foreach ($data as $key => $value) {
79
+ if (property_exists($this, $key)) {
80
+ $this->{$key} = $value;
81
+ }
82
+ }
83
+ }
84
+
85
+ /**
86
+ * @param string $name
87
+ * @param mixed $value
88
+ */
89
+ public function __set($name, $value)
90
+ {
91
+ throw new InvalidArgumentException('All properties of the ContactInformation are read-only (currently)');
92
+ }
93
+ }
lib/Bronto/Api/Login/Exception.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_Login_Exception extends Bronto_Api_Exception
8
+ {
9
+
10
+ }
lib/Bronto/Api/Login/Row.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ * @property string $username
8
+ * @property string $password
9
+ * @property stdClass $contactInformation
10
+ * @property bool $permissionAgencyAdmin
11
+ * @property bool $permissionAdmin
12
+ * @property bool $permissionApi
13
+ * @property bool $permissionUpgrade
14
+ * @property bool $permissionFatigueOverride
15
+ * @property bool $permissionMessageCompose
16
+ * @property bool $permissionMessageDelete
17
+ * @property bool $permissionAutomatorCompose
18
+ * @property bool $permissionListCreateSend
19
+ * @property bool $permissionListCreate
20
+ * @property bool $permissionSegmentCreate
21
+ * @property bool $permissionFieldCreate
22
+ * @property bool $permissionFieldReorder
23
+ * @property bool $permissionSubscriberCreate
24
+ * @property bool $permissionSubscriberView
25
+ * @method Bronto_Api_Login_Row read() read()
26
+ * @method Bronto_Api_Login_Row save() save()
27
+ * @method Bronto_Api_Login_Row delete() delete()
28
+ * @method Bronto_Api_Login getApiObject() getApiObject()
29
+ */
30
+ class Bronto_Api_Login_Row extends Bronto_Api_Row
31
+ {
32
+ /**
33
+ * @return Bronto_Api_Login_ContactInformation
34
+ */
35
+ public function getContactInformation()
36
+ {
37
+ return new Bronto_Api_Login_ContactInformation($this->contactInformation);
38
+ }
39
+ }
lib/Bronto/Api/Message.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/messageobject
9
+ *
10
+ * @method Bronto_Api_Message_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_Message extends Bronto_Api_Object
13
+ {
14
+ /**
15
+ * @var array
16
+ */
17
+ protected $_methods = array(
18
+ 'addMessages' => 'add',
19
+ 'readMessages' => 'read',
20
+ 'updateMessages' => 'update',
21
+ 'deleteMessages' => 'delete',
22
+ );
23
+
24
+ /**
25
+ * @param array $filter
26
+ * @param bool $includeContent
27
+ * @param int $pageNumber
28
+ * @return Bronto_Api_Rowset
29
+ */
30
+ public function readAll(array $filter = array(), $includeContent = false, $pageNumber = 1)
31
+ {
32
+ $params = array();
33
+ $params['filter'] = $filter;
34
+ $params['includeContent'] = (bool) $includeContent;
35
+ $params['pageNumber'] = (int) $pageNumber;
36
+ return $this->read($params);
37
+ }
38
+ }
lib/Bronto/Api/Message/Exception.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_Message_Exception extends Bronto_Api_Exception
8
+ {
9
+ const INVALID_FOLDER_ID = 601; // The folder id is invalid.
10
+ const INVALID_FOLDER_NAME = 602; // The folder name is invalid:
11
+ const INVALID_MESSAGEGROUP = 603; // The specified message is invalid.
12
+ const INVALID_AUTOMATOR = 604; // The specified automator is invalid.
13
+ const INVALID_SOURCE_TEMPLATE = 605; // Invalid message from template:
14
+ const INVALID_CONTENT = 606; // You must specify message content
15
+ const INVALID_TYPE = 607; // Message content type must be either 'text' or 'html'.
16
+ const INVALID_SUBJECT = 608; // You must specify a message subject.
17
+ const INVALID_DYNAMIC_CONTENT = 609; // The message's dynamic content is invalid.
18
+ const INVALID_AUTOMATOR_NAME = 610; // The message rule name is invalid.
19
+ const INVALID_AUTOMATOR_TYPE = 611; // The message rule type is invalid.
20
+ const INVALID_AUTOMATOR_STATUS = 612; // The message rule status is invalid.
21
+ const AUTOMATOR_EXISTS = 613; // A message rule with this name already exists:
22
+ const FOLDER_EXISTS = 614; // A folder with this name already exists:
23
+ const MESSAGE_EXISTS = 615; // A message with this name already exists:
24
+ }
lib/Bronto/Api/Message/Row.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @property-read string $id
9
+ * @property string $name
10
+ * @property string $status
11
+ * @property string $messageFolderId
12
+ * @property array $content
13
+ * @method Bronto_Api_Message_Row delete() delete()
14
+ * @method Bronto_Api_Message getApiObject() getApiObject()
15
+ */
16
+ class Bronto_Api_Message_Row extends Bronto_Api_Row
17
+ {
18
+ /**
19
+ * @param Bronto_Api_DeliveryGroup_Row|string $deliveryGroup
20
+ * @return bool
21
+ */
22
+ public function addToDeliveryGroup($deliveryGroup)
23
+ {
24
+ if (!$this->id) {
25
+ $exceptionClass = $this->getExceptionClass();
26
+ throw new $exceptionClass("This Message has not been saved yet (has no MessageId)");
27
+ }
28
+
29
+ $deliveryGroupId = $deliveryGroup;
30
+ if ($deliveryGroup instanceOf Bronto_Api_DeliveryGroup_Row) {
31
+ if (!$deliveryGroup->id) {
32
+ $deliveryGroup = $deliveryGroup->read();
33
+ }
34
+ $deliveryGroupId = $deliveryGroup->id;
35
+ }
36
+
37
+ $deliveryGroupObject = $this->getApi()->getDeliveryGroupObject();
38
+ return $deliveryGroupObject->addToDeliveryGroup($deliveryGroupId, array(), array($this->id));
39
+ }
40
+
41
+ /**
42
+ * @return Bronto_Api_Message_Row
43
+ */
44
+ public function read()
45
+ {
46
+ if ($this->id) {
47
+ $params = array('id' => $this->id);
48
+ } elseif ($this->name) {
49
+ $params = array(
50
+ 'name' => array(
51
+ 'value' => $this->name,
52
+ 'operator' => 'EqualTo',
53
+ )
54
+ );
55
+ }
56
+
57
+ parent::_read($params);
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * @param bool $upsert
63
+ * @param bool $refresh
64
+ * @return Bronto_Api_Message_Row
65
+ */
66
+ public function save($upsert = true, $refresh = false)
67
+ {
68
+ if (!$upsert) {
69
+ parent::_save(false, $refresh);
70
+ }
71
+
72
+ try {
73
+ parent::_save(true, $refresh);
74
+ } catch (Bronto_Api_Message_Exception $e) {
75
+ if ($e->getCode() === Bronto_Api_Message_Exception::MESSAGE_EXISTS) {
76
+ $this->_refresh();
77
+ } else {
78
+ $this->getApi()->throwException($e);
79
+ }
80
+ }
81
+
82
+ return $this;
83
+ }
84
+ }
lib/Bronto/Api/MessageRule.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/messageruleobject
9
+ *
10
+ * @method Bronto_Api_MessageRule_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_MessageRule extends Bronto_Api_Object
13
+ {
14
+ /**
15
+ * The object name.
16
+ *
17
+ * @var string
18
+ */
19
+ protected $_name = 'MessageRule';
20
+
21
+ /**
22
+ * @var array
23
+ */
24
+ protected $_methods = array(
25
+ 'addMessageRules' => 'add',
26
+ 'readMessageRules' => 'read',
27
+ 'updateMessageRules' => 'update',
28
+ 'deleteMessageRules' => 'delete',
29
+ );
30
+
31
+ /**
32
+ * @param array $filter
33
+ * @param int $pageNumber
34
+ * @return Bronto_Api_Rowset
35
+ */
36
+ public function readAll(array $filter = array(), $pageNumber = 1)
37
+ {
38
+ $params = array();
39
+ $params['filter'] = $filter;
40
+ $params['pageNumber'] = (int) $pageNumber;
41
+ return $this->read($params);
42
+ }
43
+ }
lib/Bronto/Api/MessageRule/Exception.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_MessageRule_Exception extends Bronto_Api_Exception
8
+ {
9
+ const INVALID_AUTOMATOR = 604; // The specified automator is invalid.
10
+ const INVALID_AUTOMATOR_NAME = 610; // The message rule name is invalid.
11
+ const INVALID_AUTOMATOR_TYPE = 611; // The message rule type is invalid.
12
+ const INVALID_AUTOMATOR_STATUS = 612; // The message rule status is invalid.
13
+ const AUTOMATOR_EXISTS = 613; // A message rule with this name already exists: %s
14
+ }
lib/Bronto/Api/MessageRule/Row.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @property-read id
9
+ * @property name
10
+ * @property type
11
+ * @property messagedId
12
+ * @method Bronto_Api_MessageRule_Row delete() delete()
13
+ * @method Bronto_Api_MessageRule getApiObject() getApiObject()
14
+ */
15
+ class Bronto_Api_MessageRule_Row extends Bronto_Api_Row
16
+ {
17
+ /**
18
+ * @param bool $returnData
19
+ * @return Bronto_Api_MessageRule_Row
20
+ */
21
+ public function read()
22
+ {
23
+ if ($this->id) {
24
+ $params = array('id' => $this->id);
25
+ } else {
26
+ $params = array(
27
+ 'name' => array(
28
+ 'value' => $this->name,
29
+ 'operator' => 'EqualTo',
30
+ )
31
+ );
32
+ }
33
+
34
+ return parent::_read($params, $returnData);
35
+ }
36
+
37
+ /**
38
+ * @param bool $upsert
39
+ * @param bool $refresh
40
+ * @return Bronto_Api_MessageRule_Row
41
+ */
42
+ public function save($upsert = true, $refresh = false)
43
+ {
44
+ if (!$upsert) {
45
+ parent::_save(false, $refresh);
46
+ }
47
+
48
+ try {
49
+ parent::_save(true, $refresh);
50
+ } catch (Bronto_Api_MessageRule_Exception $e) {
51
+ if ($e->getCode() === Bronto_Api_MessageRule_Exception::AUTOMATOR_EXISTS) {
52
+ $this->_refresh();
53
+ } else {
54
+ $this->getApi()->throwException($e);
55
+ }
56
+ }
57
+
58
+ return $this;
59
+ }
60
+ }
lib/Bronto/Api/Object.php ADDED
@@ -0,0 +1,582 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @method Bronto_Api_Rowset add() add(array $data)
9
+ * @method Bronto_Api_Rowset addOrUpdate() addOrUpdate(array $data)
10
+ * @method Bronto_Api_Rowset update() update(array $data)
11
+ * @method Bronto_Api_Rowset delete() delete(array $data)
12
+ * @method Bronto_Api_Rowset read() read(array $data)
13
+ */
14
+ abstract class Bronto_Api_Object
15
+ {
16
+ /** filterType */
17
+ const TYPE_AND = 'AND';
18
+ const TYPE_OR = 'OR';
19
+
20
+ /** filterOperator */
21
+ const OPER_EQ = 'EqualTo';
22
+ const OPER_NE = 'NotEqualTo';
23
+ const OPER_GT = 'GreaterThan';
24
+ const OPER_LT = 'LessThan';
25
+ const OPER_GE = 'GreaterThanEqualTo';
26
+ const OPER_LE = 'LessThanEqualTo';
27
+ const OPER_CONTAINS = 'Contains';
28
+ const OPER_NOT_CONTAINS = 'DoesNotContain';
29
+ const OPER_STARTS_WITH = 'StartsWith';
30
+ const OPER_ENDS_WITH = 'EndsWith';
31
+ const OPER_NOT_STARTS_WITH = 'DoesNotStartWith';
32
+ const OPER_NOT_ENDS_WITH = 'DoesNotEndWith';
33
+ const OPER_SAME_YEAR = 'SameYear';
34
+ const OPER_NOT_SAME_YEAR = 'NotSameYear';
35
+ const OPER_SAME_DAY = 'SameDay';
36
+ const OPER_NOT_SAME_DAY = 'NotSameDay';
37
+ const OPER_BEFORE = 'Before';
38
+ const OPER_AFTER = 'After';
39
+ const OPER_BEFORE_SAME = 'BeforeOrSameDay';
40
+ const OPER_AFTER_SAME = 'AfterOrSameDay';
41
+
42
+ /** readDirection */
43
+ const DIRECTION_FIRST = 'FIRST';
44
+ const DIRECTION_NEXT = 'NEXT';
45
+
46
+ /**
47
+ * Bronto_Api object
48
+ *
49
+ * @var Bronto_Api
50
+ */
51
+ protected $_api;
52
+
53
+ /**
54
+ * Various options for this object
55
+ *
56
+ * @var array
57
+ */
58
+ protected $_options = array();
59
+
60
+ /**
61
+ * API Methods this object supports
62
+ *
63
+ * @var array
64
+ */
65
+ protected $_methods = array();
66
+
67
+ /**
68
+ * @var array
69
+ */
70
+ protected $_methodsByType = array();
71
+
72
+ /**
73
+ * The object name
74
+ *
75
+ * @var string
76
+ */
77
+ protected $_name;
78
+
79
+ /**
80
+ * The primary key column or columns.
81
+ * A compound key should be declared as an array.
82
+ * You may declare a single-column primary key
83
+ * as a string.
84
+ *
85
+ * @var mixed
86
+ */
87
+ protected $_primary;
88
+
89
+ /**
90
+ * Classname for row
91
+ *
92
+ * @var string
93
+ */
94
+ protected $_rowClass;
95
+
96
+ /**
97
+ * Classname for rowset
98
+ *
99
+ * @var string
100
+ */
101
+ protected $_rowsetClass;
102
+
103
+ /**
104
+ * Classname for exceptions
105
+ *
106
+ * @var string
107
+ */
108
+ protected $_exceptionClass;
109
+
110
+ /**
111
+ * @var string
112
+ */
113
+ protected $_defaultRowClass = 'Bronto_Api_Row';
114
+
115
+ /**
116
+ * @var string
117
+ */
118
+ protected $_defaultRowsetClass = 'Bronto_Api_Rowset';
119
+
120
+ /**
121
+ * @var string
122
+ */
123
+ protected $_defaultExceptionClass = 'Bronto_Api_Exception';
124
+
125
+ /**
126
+ * How to iterate this object (page/date)
127
+ *
128
+ * @var int
129
+ */
130
+ protected $_iteratorType = Bronto_Api_Rowset_Iterator::TYPE_PAGE;
131
+
132
+ /**
133
+ * The key(s) to use when paginating
134
+ *
135
+ * @var array
136
+ */
137
+ protected $_iteratorParams = array(
138
+ 'pageNumber' => false,
139
+ );
140
+
141
+ /**
142
+ * Stored last request method
143
+ *
144
+ * @var string
145
+ */
146
+ protected $_lastRequestMethod;
147
+
148
+ /**
149
+ * Stored last request data
150
+ *
151
+ * @var array
152
+ */
153
+ protected $_lastRequestData;
154
+
155
+ /**
156
+ * @var array
157
+ */
158
+ protected $_writeCache = array(
159
+ 'add' => array(),
160
+ 'update' => array(),
161
+ 'addOrUpdate' => array(),
162
+ );
163
+
164
+ /**
165
+ * Constructor
166
+ *
167
+ * @param mixed $config
168
+ * @return void
169
+ */
170
+ public function __construct($config = array())
171
+ {
172
+ if (isset($config['api']) && $config['api'] instanceof Bronto_Api) {
173
+ $this->_api = $config['api'];
174
+ }
175
+
176
+ foreach ($this->_methods as $method => $type) {
177
+ if (is_string($type)) {
178
+ $this->_methodsByType[$type] = $method;
179
+ }
180
+ }
181
+
182
+ if (isset($this->_methodsByType['addOrUpdate'])) {
183
+ unset($this->_writeCache['add']);
184
+ unset($this->_writeCache['update']);
185
+ } else {
186
+ unset($this->_writeCache['addOrUpdate']);
187
+ }
188
+
189
+ $this->init();
190
+ }
191
+
192
+ /**
193
+ * Initialize object
194
+ *
195
+ * Called from {@link __construct()} as final step of object instantiation.
196
+ *
197
+ * @return void
198
+ */
199
+ public function init()
200
+ {
201
+ }
202
+
203
+ /**
204
+ * @param array $data
205
+ * @return Bronto_Api_Row
206
+ */
207
+ public function createRow(array $data = array())
208
+ {
209
+ $config = array(
210
+ 'apiObject' => $this,
211
+ 'data' => $data,
212
+ 'readOnly' => false,
213
+ 'stored' => false
214
+ );
215
+
216
+ $rowClass = $this->getRowClass();
217
+ return new $rowClass($config);
218
+ }
219
+
220
+ /**
221
+ * @param string $type
222
+ * @param array $data
223
+ * @param mixed $index
224
+ * @return Bronto_Api_Object
225
+ */
226
+ public function addToWriteCache($type, array $data, $index = false)
227
+ {
228
+ if ($index) {
229
+ $this->_writeCache[$type][$index] = $data;
230
+ } else {
231
+ $this->_writeCache[$type][] = $data;
232
+ }
233
+ return $this;
234
+ }
235
+
236
+ /**
237
+ * @return array
238
+ */
239
+ public function getWriteCache()
240
+ {
241
+ return $this->_writeCache;
242
+ }
243
+
244
+ /**
245
+ * @return int
246
+ */
247
+ public function getWriteCacheSize()
248
+ {
249
+ $total = 0;
250
+ foreach ($this->_writeCache as $type => $data) {
251
+ $total += count($this->_writeCache[$type]);
252
+ }
253
+ return $total;
254
+ }
255
+
256
+ /**
257
+ * Flush the write cache
258
+ * @return Bronto_Api_Rowset|array
259
+ */
260
+ public function flush()
261
+ {
262
+ $result = array();
263
+ foreach ($this->_writeCache as $type => $data) {
264
+ if (!empty($data)) {
265
+ $result[$type] = $this->{$type}(array_values($data));
266
+ $this->_writeCache[$type] = array();
267
+ }
268
+ }
269
+ return count($result) === 1 ? reset($result) : $result;
270
+ }
271
+
272
+ /**
273
+ * @param string $name
274
+ * @param array $arguments
275
+ * @return Bronto_Api_Rowset
276
+ */
277
+ public function __call($name, $arguments)
278
+ {
279
+ switch ($name) {
280
+ case 'add':
281
+ case 'update':
282
+ case 'delete':
283
+ case 'addOrUpdate':
284
+ $data = $arguments[0];
285
+ $method = $this->_methodsByType[$name];
286
+ if (array_values($data) !== $data) {
287
+ $data = array($data);
288
+ }
289
+ return $this->doRequest($method, $data, true);
290
+ break;
291
+ case 'read':
292
+ $data = $arguments[0];
293
+ $method = $this->_methodsByType[$name];
294
+ return $this->doRequest($method, $data, false);
295
+ break;
296
+ }
297
+
298
+ throw new BadMethodCallException("The method {$name} does not exist");
299
+ }
300
+
301
+ /**
302
+ * @param string $method
303
+ * @param array $data
304
+ */
305
+ protected function _beforeRequest($method, array $data = array())
306
+ {
307
+ if (!isset($this->_methods[$method])) {
308
+ $exceptionClass = $this->getExceptionClass();
309
+ throw new $exceptionClass("Method '{$method}' not allowed on " . $this->getName());
310
+ }
311
+ }
312
+
313
+ /**
314
+ * @param string $method
315
+ * @param array $data
316
+ * @param bool $canUseRetryer
317
+ * @return Bronto_Api_Rowset
318
+ */
319
+ public function doRequest($method, array $data, $canUseRetryer = false)
320
+ {
321
+ $this->_beforeRequest($method, $data);
322
+
323
+ $maxTries = (int) $this->getApi()->getOption('retry_limit', 5);
324
+ $tries = 0;
325
+ $success = false;
326
+
327
+ // Handle [frequent] API failures
328
+ do {
329
+ $tries++;
330
+ $error = false;
331
+
332
+ try {
333
+ // Store this request in case we need to retry later
334
+ $this->_lastRequestMethod = $method;
335
+ $this->_lastRequestData = $data;
336
+
337
+ // Attempt
338
+ $client = $this->getApi()->getSoapClient();
339
+ $result = $client->$method($data);
340
+ } catch (Exception $e) {
341
+ $error = true;
342
+ $exceptionClass = $this->getExceptionClass();
343
+ $exception = new $exceptionClass($e->getMessage(), $e->getCode(), $tries, $e);
344
+ if (!$exception->isRecoverable() || $tries === $maxTries) {
345
+ if ($canUseRetryer && $exception->isRecoverable()) {
346
+ if ($retryer = $this->getApi()->getRetryer()) {
347
+ $retryer->store($this);
348
+ }
349
+ }
350
+ return $this->getApi()->throwException($exception);
351
+ } else {
352
+ // Attempt to get a new session token
353
+ sleep(5);
354
+ $this->getApi()->login();
355
+ // If using readDirection, we have to start over
356
+ if (isset($data['filter']['readDirection'])) {
357
+ $data['filter']['readDirection'] = self::DIRECTION_FIRST;
358
+ }
359
+ }
360
+ }
361
+
362
+ if (!$error) {
363
+ $success = true;
364
+ }
365
+
366
+ } while (!$success && $tries <= $maxTries);
367
+
368
+ $result = isset($result->return) ? (array) $result->return : array();
369
+ return $this->_parseResponse($result, $data);
370
+ }
371
+
372
+ /**
373
+ * @param array $result
374
+ * @param array $params
375
+ * @return Bronto_Api_Rowset
376
+ */
377
+ public function _parseResponse(array $result, array $params = array())
378
+ {
379
+ $data = array();
380
+ if (isset($result['results'])) {
381
+ $data = (array) $result['results'];
382
+ } else {
383
+ if (isset($result[0])) {
384
+ $data = $result;
385
+ }
386
+ }
387
+
388
+ $config = array(
389
+ 'apiObject' => $this,
390
+ 'rowClass' => $this->getRowClass(),
391
+ 'data' => $data,
392
+ 'errors' => isset($result['errors']) ? (array) $result['errors'] : array(),
393
+ 'stored' => true,
394
+ 'params' => $params,
395
+ );
396
+
397
+ $rowsetClass = $this->getRowsetClass();
398
+ return new $rowsetClass($config);
399
+ }
400
+
401
+ /**
402
+ * @param Bronto_Api $api
403
+ * @return Bronto_Api_Object
404
+ */
405
+ public function setApi(Bronto_Api $api)
406
+ {
407
+ $this->_api = $api;
408
+ return $this;
409
+ }
410
+
411
+ /**
412
+ * @return Bronto_Api
413
+ */
414
+ public function getApi()
415
+ {
416
+ return $this->_api;
417
+ }
418
+
419
+ /**
420
+ * @return string
421
+ */
422
+ public function getName()
423
+ {
424
+ if ($this->_name === null) {
425
+ $className = get_class($this);
426
+ $this->_name = str_replace('Bronto_Api_', '', $className);
427
+ }
428
+
429
+ return $this->_name;
430
+ }
431
+
432
+ /**
433
+ * @return string
434
+ */
435
+ public function getRowClass()
436
+ {
437
+ if ($this->_rowClass === null) {
438
+ $className = get_class($this);
439
+ $rowClass = "{$className}_Row";
440
+ if (class_exists($rowClass)) {
441
+ $this->_rowClass = $rowClass;
442
+ } else {
443
+ $this->_rowClass = $this->_defaultRowClass;
444
+ }
445
+ }
446
+
447
+ return $this->_rowClass;
448
+ }
449
+
450
+ /**
451
+ * @return string
452
+ */
453
+ public function getRowsetClass()
454
+ {
455
+ if ($this->_rowsetClass === null) {
456
+ $className = get_class($this);
457
+ $rowsetClass = "{$className}_Rowset";
458
+ if (class_exists($rowsetClass, false)) {
459
+ $this->_rowsetClass = $rowsetClass;
460
+ } else {
461
+ $this->_rowsetClass = $this->_defaultRowsetClass;
462
+ }
463
+ }
464
+
465
+ return $this->_rowsetClass;
466
+ }
467
+
468
+ /**
469
+ * @return string
470
+ */
471
+ public function getExceptionClass()
472
+ {
473
+ if ($this->_exceptionClass === null) {
474
+ $className = get_class($this);
475
+ $exceptionClass = "{$className}_Exception";
476
+ if (class_exists($exceptionClass)) {
477
+ $this->_exceptionClass = $exceptionClass;
478
+ } else {
479
+ $this->_exceptionClass = $this->_defaultExceptionClass;
480
+ }
481
+ }
482
+
483
+ return $this->_exceptionClass;
484
+ }
485
+
486
+ /**
487
+ * @param string $key
488
+ * @return array|boolean
489
+ */
490
+ public function getOptionValues($key)
491
+ {
492
+ if (isset($this->_options[$key])) {
493
+ return $this->_options[$key];
494
+ }
495
+
496
+ return false;
497
+ }
498
+
499
+ /**
500
+ * @param string $key
501
+ * @param string $value
502
+ * @return boolean
503
+ */
504
+ public function isValidOptionValue($key, $value)
505
+ {
506
+ if ($values = $this->getOptionValues($key)) {
507
+ return in_array($value, $values);
508
+ }
509
+
510
+ return true;
511
+ }
512
+
513
+ /**
514
+ * @return int
515
+ */
516
+ public function getIteratorType()
517
+ {
518
+ return $this->_iteratorType;
519
+ }
520
+
521
+ /**
522
+ * @return array
523
+ */
524
+ public function getIteratorParams()
525
+ {
526
+ return $this->_iteratorParams;
527
+ }
528
+
529
+ /**
530
+ * @return bool
531
+ */
532
+ public function canIterate()
533
+ {
534
+ return $this->_iteratorType != Bronto_Api_Rowset_Iterator::TYPE_NONE;
535
+ }
536
+
537
+ /**
538
+ * @param string $method
539
+ * @return bool
540
+ */
541
+ public function hasMethod($method)
542
+ {
543
+ return isset($this->_methods[$method]);
544
+ }
545
+
546
+ /**
547
+ * @param string $type
548
+ * @return bool
549
+ */
550
+ public function hasMethodType($type)
551
+ {
552
+ return isset($this->_methodsByType[$type]);
553
+ }
554
+
555
+ /**
556
+ * @return string
557
+ */
558
+ public function getLastRequestMethod()
559
+ {
560
+ return $this->_lastRequestMethod;
561
+ }
562
+
563
+ /**
564
+ * @return array
565
+ */
566
+ public function getLastRequestData()
567
+ {
568
+ return $this->_lastRequestData;
569
+ }
570
+
571
+ /**
572
+ * @return array
573
+ */
574
+ public function __sleep()
575
+ {
576
+ return array(
577
+ '_api',
578
+ '_lastRequestMethod',
579
+ '_lastRequestData',
580
+ );
581
+ }
582
+ }
lib/Bronto/Api/Order.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @link http://community.bronto.com/api/v4/objects/general/orderobject
9
+ *
10
+ * @method Bronto_Api_Order_Row createRow() createRow(array $data = array())
11
+ */
12
+ class Bronto_Api_Order extends Bronto_Api_Object
13
+ {
14
+ /**
15
+ * @var array
16
+ */
17
+ protected $_methods = array(
18
+ 'addOrUpdateOrders' => 'addOrUpdate',
19
+ 'deleteOrders' => 'delete',
20
+ );
21
+ }
lib/Bronto/Api/Order/Exception.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_Order_Exception extends Bronto_Api_Exception
8
+ {
9
+
10
+ }
lib/Bronto/Api/Order/Product.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Api_Order_Product
10
+ {
11
+ /**
12
+ * @var string
13
+ */
14
+ public $id;
15
+
16
+ /**
17
+ * @var string
18
+ */
19
+ public $sku;
20
+
21
+ /**
22
+ * @var string
23
+ */
24
+ public $name;
25
+
26
+ /**
27
+ * @var string
28
+ */
29
+ public $description;
30
+
31
+ /**
32
+ * @var string
33
+ */
34
+ public $category;
35
+
36
+ /**
37
+ * @var string
38
+ */
39
+ public $image;
40
+
41
+ /**
42
+ * @var string
43
+ */
44
+ public $url;
45
+
46
+ /**
47
+ * @var int
48
+ */
49
+ public $quantity;
50
+
51
+ /**
52
+ * @var float
53
+ */
54
+ public $price;
55
+
56
+ /**
57
+ * @param array $data
58
+ */
59
+ public function __construct($data = array())
60
+ {
61
+ $data = (array) $data;
62
+ foreach ($data as $key => $value) {
63
+ if (property_exists($this, $key)) {
64
+ $this->{$key} = $value;
65
+ }
66
+ }
67
+ }
68
+ }
lib/Bronto/Api/Order/Row.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @property-read string $id
9
+ * @property string $contactId
10
+ * @property string $email
11
+ * @property array $products
12
+ * @property string $orderDate
13
+ * @property string $deliveryId
14
+ * @property string $messageId
15
+ * @property string $automatorId
16
+ * @property string $listId
17
+ * @property string $segmentId
18
+ * @property string $deliveryType
19
+ * @property-write string $tid
20
+ * @method Bronto_Api_Order_Row delete() delete()
21
+ * @method Bronto_Api_Order getApiObject() getApiObject()
22
+ */
23
+ class Bronto_Api_Order_Row extends Bronto_Api_Row
24
+ {
25
+ /**
26
+ * @param bool $upsert Ignored
27
+ * @param bool $refresh
28
+ * @return Bronto_Api_Order_Row
29
+ */
30
+ public function save($upsert = true, $refresh = false)
31
+ {
32
+ parent::_add(true);
33
+ return $this;
34
+ }
35
+
36
+ /**
37
+ * @return Bronto_Api_Order_Row
38
+ */
39
+ public function persist()
40
+ {
41
+ return parent::_persist('addOrUpdate', false);
42
+ }
43
+
44
+ /**
45
+ * Set row field value
46
+ *
47
+ * @param string $columnName The column key.
48
+ * @param mixed $value The value for the property.
49
+ */
50
+ public function __set($columnName, $value)
51
+ {
52
+ switch (strtolower($columnName)) {
53
+ case 'email':
54
+ // Trim whitespace
55
+ $value = preg_replace('/\s+/', '', $value);
56
+ // Check if email got truncated
57
+ if (substr($value, -1) === '.') {
58
+ $value .= 'com';
59
+ }
60
+ break;
61
+ }
62
+
63
+ return parent::__set($columnName, $value);
64
+ }
65
+
66
+ /**
67
+ * @param array $data
68
+ * @return Bronto_Api_Order_Product
69
+ */
70
+ public function addProduct(array $data = array())
71
+ {
72
+ $product = new Bronto_Api_Order_Product($data);
73
+ $productId = $product->id;
74
+
75
+ if (empty($productId)) {
76
+ throw new Bronto_Api_Order_Exception('Product must have a value for ID.');
77
+ }
78
+
79
+ if (isset($this->products[$productId])) {
80
+ throw new Bronto_Api_Order_Exception("Product already exists in Order with ID: {$productId}");
81
+ }
82
+
83
+ $this->products[$productId] = $product;
84
+ return $product;
85
+ }
86
+ }
lib/Bronto/Api/Row.php ADDED
@@ -0,0 +1,732 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ */
8
+ abstract class Bronto_Api_Row implements ArrayAccess, IteratorAggregate
9
+ {
10
+ /**
11
+ * The data for each column in the row (column_name => value).
12
+ * The keys must match the physical names of columns in the
13
+ * table for which this row is defined.
14
+ *
15
+ * @var array
16
+ */
17
+ protected $_data = array();
18
+
19
+ /**
20
+ * This is set to a copy of $_data when the data is fetched from
21
+ * the API, specified as a new tuple in the constructor, or
22
+ * when dirty data is posted to the database with save().
23
+ *
24
+ * @var array
25
+ */
26
+ protected $_cleanData = array();
27
+
28
+ /**
29
+ * Tracks columns where data has been updated. Allows more specific insert and
30
+ * update operations.
31
+ *
32
+ * @var array
33
+ */
34
+ protected $_modifiedFields = array();
35
+
36
+ /**
37
+ * Tracks columns that are dates.
38
+ *
39
+ * @var array
40
+ */
41
+ protected $_dateFields = array();
42
+
43
+ /**
44
+ * A row is marked read only if it contains columns that are not physically
45
+ * represented within the API schema. This can also be passed as a
46
+ * run-time config options as a means of protecting row data.
47
+ *
48
+ * @var boolean
49
+ */
50
+ protected $_readOnly = false;
51
+
52
+ /**
53
+ * Primary row key
54
+ *
55
+ * @var string
56
+ */
57
+ protected $_primary = 'id';
58
+
59
+ /**
60
+ * API Object
61
+ *
62
+ * @var Bronto_Api_Object
63
+ */
64
+ protected $_apiObject;
65
+
66
+ /**
67
+ * @var bool
68
+ */
69
+ protected $_isNew = false;
70
+
71
+ /**
72
+ * @var bool
73
+ */
74
+ protected $_isError = false;
75
+
76
+ /**
77
+ * @var int
78
+ */
79
+ protected $_errorCode;
80
+
81
+ /**
82
+ * @var string
83
+ */
84
+ protected $_errorString;
85
+
86
+ /**
87
+ * @var bool
88
+ */
89
+ protected $_isLoaded = true;
90
+
91
+ /**
92
+ * Constructor
93
+ *
94
+ * @param array $config
95
+ */
96
+ public function __construct(array $config = array())
97
+ {
98
+ if (isset($config['apiObject']) && $config['apiObject'] instanceof Bronto_Api_Object) {
99
+ $this->_apiObject = $config['apiObject'];
100
+ }
101
+
102
+ if (isset($config['data'])) {
103
+ if (!is_array($config['data'])) {
104
+ throw new Bronto_Api_Row_Exception('Data must be an array');
105
+ }
106
+ $this->setData($config['data']);
107
+ }
108
+
109
+ if (isset($config['stored']) && $config['stored'] === true) {
110
+ $this->_cleanData = $this->_data;
111
+ } else {
112
+ $this->_isLoaded = false;
113
+ $this->_cleanData = array();
114
+ foreach ($this->_data as $key => $value) {
115
+ $this->_modifiedFields[$key] = true;
116
+ }
117
+ }
118
+
119
+ if (isset($config['readOnly']) && $config['readOnly'] === true) {
120
+ $this->_readOnly = true;
121
+ }
122
+
123
+ $this->init();
124
+ }
125
+
126
+ /**
127
+ * @param array $data
128
+ * @return Bronto_Api_Row
129
+ */
130
+ public function setData(array $data = array())
131
+ {
132
+ if (isset($data['isNew'])) {
133
+ $this->_isNew = (bool) $data['isNew'];
134
+ $this->_isLoaded = true;
135
+ unset($data['isNew']);
136
+ }
137
+
138
+ if (isset($data['isError'])) {
139
+ $this->_isError = (bool) $data['isError'];
140
+ if ($this->_isError) {
141
+ $this->_readOnly = true;
142
+ $this->_isLoaded = false;
143
+ }
144
+ unset($data['isError']);
145
+ }
146
+
147
+ if (isset($data['errorCode'])) {
148
+ $this->_errorCode = (int) $data['errorCode'];
149
+ unset($data['errorCode']);
150
+ }
151
+
152
+ if (isset($data['errorString'])) {
153
+ $this->_errorString = (string) $data['errorString'];
154
+ unset($data['errorString']);
155
+ }
156
+
157
+ $this->_data = array_merge($this->_data, $data);
158
+ $this->_refresh(false);
159
+ $this->init();
160
+
161
+ return $this;
162
+ }
163
+
164
+ /**
165
+ * Initialize object
166
+ *
167
+ * Called from {@link __construct()} as final step of object instantiation.
168
+ *
169
+ * @return void
170
+ */
171
+ public function init()
172
+ {
173
+ }
174
+
175
+ /**
176
+ * Proxy to __isset
177
+ * Required by the ArrayAccess implementation
178
+ *
179
+ * @param string $offset
180
+ * @return boolean
181
+ */
182
+ public function offsetExists($offset)
183
+ {
184
+ return $this->__isset($offset);
185
+ }
186
+
187
+ /**
188
+ * Proxy to __get
189
+ * Required by the ArrayAccess implementation
190
+ *
191
+ * @param string $offset
192
+ * @return string
193
+ */
194
+ public function offsetGet($offset)
195
+ {
196
+ return $this->__get($offset);
197
+ }
198
+
199
+ /**
200
+ * Proxy to __set
201
+ * Required by the ArrayAccess implementation
202
+ *
203
+ * @param string $offset
204
+ * @param mixed $value
205
+ */
206
+ public function offsetSet($offset, $value)
207
+ {
208
+ $this->__set($offset, $value);
209
+ }
210
+
211
+ /**
212
+ * Proxy to __unset
213
+ * Required by the ArrayAccess implementation
214
+ *
215
+ * @param string $offset
216
+ */
217
+ public function offsetUnset($offset)
218
+ {
219
+ return $this->__unset($offset);
220
+ }
221
+
222
+ /**
223
+ * @return ArrayIterator
224
+ */
225
+ public function getIterator()
226
+ {
227
+ return new ArrayIterator((array) $this->_data);
228
+ }
229
+
230
+ /**
231
+ * Returns the column/value data as an array.
232
+ *
233
+ * @return array
234
+ */
235
+ public function toArray()
236
+ {
237
+ return (array) $this->_data;
238
+ }
239
+
240
+ /**
241
+ * @return array
242
+ */
243
+ public function __toArray()
244
+ {
245
+ return $this->toArray();
246
+ }
247
+
248
+ /**
249
+ * @return Bronto_Api_Row
250
+ */
251
+ public function persist()
252
+ {
253
+ if ($this->_readOnly === true) {
254
+ throw new Bronto_Api_Row_Exception(sprintf("Cannot persist a %s record.", $this->getApiObject()->getName()));
255
+ }
256
+
257
+ $type = false;
258
+ if ($this->getApiObject()->hasMethodType('addOrUpdate')) {
259
+ $type = 'addOrUpdate';
260
+ } else {
261
+ if (empty($this->_cleanData)) {
262
+ $type = 'add';
263
+ } else {
264
+ $type = 'update';
265
+ }
266
+ }
267
+
268
+ return $this->_persist($type);
269
+ }
270
+
271
+ /**
272
+ * @return Bronto_Api_Row
273
+ */
274
+ public function persistDelete()
275
+ {
276
+ if (!$this->getApiObject()->hasMethodType('delete')) {
277
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
278
+ throw new $exceptionClass('Cannot delete a row of type: ' . $this->getApiObject()->getName());
279
+ }
280
+
281
+ return $this->_persist('delete');
282
+ }
283
+
284
+ /**
285
+ * Persist an object for write caching
286
+ *
287
+ * @param string $type
288
+ * @param mixed $defaultIndex
289
+ * @return Bronto_Api_Row
290
+ */
291
+ public function _persist($type, $defaultIndex = false)
292
+ {
293
+ $data = array_intersect_key($this->_data, $this->_modifiedFields);
294
+ $tempPrimaryKey = $this->_primary;
295
+ if (!empty($this->{$tempPrimaryKey})) {
296
+ $defaultIndex = $this->{$tempPrimaryKey};
297
+ if ($type === 'delete') {
298
+ $data = array($this->_primary => $this->{$tempPrimaryKey});
299
+ } else {
300
+ $data = array_merge(array($this->_primary => $this->{$tempPrimaryKey}), $data);
301
+ }
302
+ }
303
+
304
+ $this->getApiObject()->addToWriteCache($type, $data, $defaultIndex);
305
+ return $this;
306
+ }
307
+
308
+ /**
309
+ * @return Bronto_Api_Row
310
+ */
311
+ public function read()
312
+ {
313
+ $data = array();
314
+ if ($this->id) {
315
+ $data = array('id' => $this->id);
316
+ } else {
317
+ throw new Bronto_Api_Row_Exception('Trying to read Row without unique identifier for lookup');
318
+ }
319
+
320
+ $this->_read($data);
321
+ return $this;
322
+ }
323
+
324
+ /**
325
+ * @param bool $upsert
326
+ * @param bool $refresh
327
+ * @return Bronto_Api_Row
328
+ */
329
+ public function save($upsert = false, $refresh = false)
330
+ {
331
+ $this->_save($upsert, $refresh);
332
+ return $this;
333
+ }
334
+
335
+ /**
336
+ * @return Bronto_Api_Row
337
+ */
338
+ public function delete()
339
+ {
340
+ if (!$this->getApiObject()->hasMethodType('delete')) {
341
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
342
+ throw new $exceptionClass('Cannot delete a row of type: ' . $this->getApiObject()->getName());
343
+ }
344
+
345
+ $data = array();
346
+ if (!$this->id) {
347
+ $this->_refresh();
348
+ }
349
+
350
+ if ($this->id) {
351
+ $data = array('id' => $this->id);
352
+ } else {
353
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
354
+ throw new $exceptionClass('Trying to delete Row without unique identifier for lookup');
355
+ }
356
+
357
+ $this->_delete($data);
358
+ return $this;
359
+ }
360
+
361
+ /**
362
+ * Refreshes properties from the API.
363
+ * @param bool $pull
364
+ */
365
+ protected function _refresh($pull = true)
366
+ {
367
+ if ($pull) {
368
+ $this->read();
369
+ }
370
+ $this->_cleanData = $this->_data;
371
+ $this->_modifiedFields = array();
372
+ }
373
+
374
+ /**
375
+ * @param array $filter
376
+ */
377
+ protected function _read(array $filter = array())
378
+ {
379
+ if (empty($filter)) {
380
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
381
+ throw new $exceptionClass('Trying to read Row without unique identifier for lookup');
382
+ }
383
+
384
+ /* @var $rowset Bronto_Api_Rowset */
385
+ $rowset = $this->getApiObject()->readAll($filter);
386
+
387
+ if ($rowset->hasErrors()) {
388
+ // Reset class
389
+ $error = $rowset->getError();
390
+ $this->_readOnly = true;
391
+ $this->_isLoaded = false;
392
+ $this->_isError = true;
393
+ $this->_errorCode = $error['code'];
394
+ $this->_errorString = $error['message'];
395
+
396
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
397
+ throw new $exceptionClass($error['message'], $error['code']);
398
+ }
399
+
400
+ if ($rowset->count() > 0) {
401
+ // Reset all fields
402
+ $this->_isLoaded = true;
403
+ $this->_readOnly = false;
404
+ $this->_isError = false;
405
+ $this->_isNew = false;
406
+
407
+ $data = $rowset->offsetGetData(0);
408
+ $this->setData($data);
409
+ }
410
+ }
411
+
412
+ /**
413
+ * Saves the properties to the API.
414
+ *
415
+ * This performs an intelligent add/update, and can reload the
416
+ * properties with fresh data from the API on success.
417
+ *
418
+ * @param bool $upsert
419
+ * @param bool $refresh
420
+ */
421
+ protected function _save($upsert = true, $refresh = false)
422
+ {
423
+ /**
424
+ * If the _cleanData array is empty,
425
+ * this is an ADD of a new row.
426
+ * Otherwise it is an UPDATE.
427
+ */
428
+ if (empty($this->_cleanData)) {
429
+ if ($upsert) {
430
+ if ($this->getApiObject()->hasMethodType('addOrUpdate')) {
431
+ $this->_add(true);
432
+ } else {
433
+ $this->_add(false);
434
+ }
435
+ } else {
436
+ $this->_add(false);
437
+ }
438
+ } else {
439
+ $this->_update();
440
+ }
441
+
442
+ $refreshOnSave = $this->getApi()->getOption('refresh_on_save');
443
+ if ($refreshOnSave || $refresh) {
444
+ $this->_refresh();
445
+ }
446
+ }
447
+
448
+ /**
449
+ * @param bool $upsert
450
+ */
451
+ protected function _add($upsert = false)
452
+ {
453
+ if ($this->_readOnly === true) {
454
+ throw new Bronto_Api_Row_Exception(sprintf("Cannot create %s record.", $this->getApiObject()->getName()));
455
+ }
456
+
457
+ $data = array_intersect_key($this->_data, $this->_modifiedFields);
458
+ if ($upsert) {
459
+ $tempPrimaryKey = $this->_primary;
460
+ if (!empty($this->{$tempPrimaryKey})) {
461
+ $data = array_merge(array($this->_primary => $this->{$tempPrimaryKey}), $data);
462
+ }
463
+ $rowset = $this->getApiObject()->addOrUpdate(array($data));
464
+ } else {
465
+ $rowset = $this->getApiObject()->add(array($data));
466
+ }
467
+
468
+ if ($rowset->hasErrors()) {
469
+ // Reset class
470
+ $error = $rowset->getError();
471
+ $this->_readOnly = true;
472
+ $this->_isLoaded = false;
473
+ $this->_isError = true;
474
+ $this->_errorCode = $error['code'];
475
+ $this->_errorString = $error['message'];
476
+
477
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
478
+ throw new $exceptionClass($error['message'], $error['code']);
479
+ }
480
+
481
+ if ($rowset->count() > 0) {
482
+ // Reset all fields
483
+ $this->_isLoaded = true;
484
+ $this->_readOnly = false;
485
+ $this->_isError = false;
486
+ $this->_isNew = false;
487
+
488
+ $data = $rowset->offsetGetData(0);
489
+ $this->setData($data);
490
+ }
491
+ }
492
+
493
+ protected function _update()
494
+ {
495
+ if ($this->_readOnly === true) {
496
+ throw new Bronto_Api_Row_Exception(sprintf("Cannot update %s record.", $this->getApiObject()->getName()));
497
+ }
498
+
499
+ $data = array_intersect_key($this->_data, $this->_modifiedFields);
500
+ if (count($data) > 0) {
501
+ $tempPrimaryKey = $this->_primary;
502
+ if (!empty($this->{$tempPrimaryKey})) {
503
+ $data = array_merge(array($this->_primary => $this->{$tempPrimaryKey}), $data);
504
+ }
505
+ $rowset = $this->getApiObject()->update(array($data));
506
+
507
+ if ($rowset->hasErrors()) {
508
+ // Reset class
509
+ $error = $rowset->getError();
510
+ $this->_readOnly = true;
511
+ $this->_isLoaded = false;
512
+ $this->_isError = true;
513
+ $this->_errorCode = $error['code'];
514
+ $this->_errorString = $error['message'];
515
+
516
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
517
+ throw new $exceptionClass($error['message'], $error['code']);
518
+ }
519
+
520
+ if ($rowset->count() > 0) {
521
+ // Reset all fields
522
+ $this->_isLoaded = true;
523
+ $this->_readOnly = false;
524
+ $this->_isError = false;
525
+ $this->_isNew = false;
526
+
527
+ $data = $rowset->offsetGetData(0);
528
+ $this->setData($data);
529
+ }
530
+ }
531
+ }
532
+
533
+ /**
534
+ * @param array $data
535
+ */
536
+ protected function _delete(array $data)
537
+ {
538
+ if ($this->_readOnly === true) {
539
+ throw new Bronto_Api_Row_Exception(sprintf("Cannot delete this read-only %s record.", $this->getApiObject()->getName()));
540
+ }
541
+
542
+ $rowset = $this->getApiObject()->delete(array($data));
543
+
544
+ if ($rowset->hasErrors()) {
545
+ // Reset class
546
+ $error = $rowset->getError();
547
+ $this->_readOnly = true;
548
+ $this->_isLoaded = false;
549
+ $this->_isError = true;
550
+ $this->_errorCode = $error['code'];
551
+ $this->_errorString = $error['message'];
552
+
553
+ $exceptionClass = $this->getApiObject()->getExceptionClass();
554
+ throw new $exceptionClass($error['message'], $error['code']);
555
+ }
556
+
557
+ if ($rowset->count() > 0) {
558
+ // Reset all fields to indicate that the row is not there
559
+ $this->_data = array();
560
+ $this->_cleanData = array();
561
+ $this->_modifiedFields = array();
562
+ $this->_isLoaded = false;
563
+ $this->_readOnly = true;
564
+ $this->_isError = false;
565
+ $this->_isNew = false;
566
+
567
+ $data = $rowset->offsetGetData(0);
568
+ $this->setData($data);
569
+ }
570
+ }
571
+
572
+ /**
573
+ * Retrieve row field value
574
+ *
575
+ * @param string $columnName The user-specified column name.
576
+ * @return string The corresponding column value.
577
+ */
578
+ public function __get($columnName)
579
+ {
580
+ if (!array_key_exists($columnName, $this->_data)) {
581
+ return null;
582
+ }
583
+ return $this->_data[$columnName];
584
+ }
585
+
586
+ /**
587
+ * Set row field value
588
+ *
589
+ * @param string $columnName The column key.
590
+ * @param mixed $value The value for the property.
591
+ */
592
+ public function __set($columnName, $value)
593
+ {
594
+ if ($this->_readOnly === false) {
595
+ $this->_data[$columnName] = $value;
596
+ $this->_modifiedFields[$columnName] = true;
597
+ }
598
+ }
599
+
600
+ /**
601
+ * Unset row field value
602
+ *
603
+ * @param string $columnName The column key.
604
+ */
605
+ public function __unset($columnName)
606
+ {
607
+ if ($this->_readOnly === false) {
608
+ unset($this->_data[$columnName]);
609
+ }
610
+ }
611
+
612
+ /**
613
+ * Test existence of row field
614
+ *
615
+ * @param string $columnName The column key.
616
+ * @return bool
617
+ */
618
+ public function __isset($columnName)
619
+ {
620
+ return array_key_exists($columnName, $this->_data);
621
+ }
622
+
623
+ /**
624
+ * @param Bronto_Api_Object $apiObject
625
+ * @return Bronto_Api_Row
626
+ */
627
+ public function setApiObject(Bronto_Api_Object $apiObject)
628
+ {
629
+ $this->_apiObject = $apiObject;
630
+ return $this;
631
+ }
632
+
633
+ /**
634
+ * @return Bronto_Api_Object
635
+ */
636
+ public function getApiObject()
637
+ {
638
+ return $this->_apiObject;
639
+ }
640
+
641
+ /**
642
+ * @return Bronto_Api
643
+ */
644
+ public function getApi()
645
+ {
646
+ return $this->_apiObject->getApi();
647
+ }
648
+
649
+ /**
650
+ * Test the read-only status of the row.
651
+ *
652
+ * @return boolean
653
+ */
654
+ public function isReadOnly()
655
+ {
656
+ return $this->_readOnly;
657
+ }
658
+
659
+ /**
660
+ * Set the read-only status of the row.
661
+ *
662
+ * @param boolean $flag
663
+ * @return boolean
664
+ */
665
+ public function setReadOnly($flag)
666
+ {
667
+ $this->_readOnly = (bool) $flag;
668
+ }
669
+
670
+ /**
671
+ * @return array
672
+ */
673
+ public function getData()
674
+ {
675
+ return $this->_data;
676
+ }
677
+
678
+ /**
679
+ * @return array
680
+ */
681
+ public function getDateFields()
682
+ {
683
+ return $this->_dateFields;
684
+ }
685
+
686
+ /**
687
+ * @param string $key
688
+ * @return bool
689
+ */
690
+ public function isDateField($key)
691
+ {
692
+ return (bool) isset($this->_dateFields[$key]);
693
+ }
694
+
695
+ /**
696
+ * @return bool
697
+ */
698
+ public function isNew()
699
+ {
700
+ return (bool) $this->_isNew;
701
+ }
702
+
703
+ /**
704
+ * @return bool
705
+ */
706
+ public function hasError()
707
+ {
708
+ return (bool) $this->_isError;
709
+ }
710
+
711
+ /**
712
+ * @return int|bool
713
+ */
714
+ public function getErrorCode()
715
+ {
716
+ if ($this->hasError()) {
717
+ return $this->_errorCode;
718
+ }
719
+ return false;
720
+ }
721
+
722
+ /**
723
+ * @return int|bool
724
+ */
725
+ public function getErrorMessage()
726
+ {
727
+ if ($this->hasError()) {
728
+ return $this->_errorString;
729
+ }
730
+ return false;
731
+ }
732
+ }
lib/Bronto/Api/Row/Exception.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ */
7
+ class Bronto_Api_Row_Exception extends Bronto_Api_Exception
8
+ {
9
+
10
+ }
lib/Bronto/Api/Rowset.php ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ */
8
+ class Bronto_Api_Rowset implements SeekableIterator, Countable, ArrayAccess
9
+ {
10
+ /**
11
+ * The original data for each row.
12
+ *
13
+ * @var array
14
+ */
15
+ protected $_data = array();
16
+
17
+ /**
18
+ * Any errors for each row.
19
+ *
20
+ * @var array
21
+ */
22
+ protected $_errors = false;
23
+
24
+ /**
25
+ * API Object
26
+ *
27
+ * @var Bronto_Api_Object
28
+ */
29
+ protected $_apiObject;
30
+
31
+ /**
32
+ * API Object class name
33
+ *
34
+ * @var string
35
+ */
36
+ protected $_apiObjectClass;
37
+
38
+ /**
39
+ * Row class name
40
+ *
41
+ * @var string
42
+ */
43
+ protected $_rowClass = 'Bronto_Api_Row';
44
+
45
+ /**
46
+ * Iterator pointer.
47
+ *
48
+ * @var integer
49
+ */
50
+ protected $_pointer = 0;
51
+
52
+ /**
53
+ * How many data rows there are.
54
+ *
55
+ * @var integer
56
+ */
57
+ protected $_count;
58
+
59
+ /**
60
+ * Collection of instantiated Bronto_Api_Row objects.
61
+ *
62
+ * @var array
63
+ */
64
+ protected $_rows = array();
65
+
66
+ /**
67
+ * @var boolean
68
+ */
69
+ protected $_stored = false;
70
+
71
+ /**
72
+ * @var boolean
73
+ */
74
+ protected $_readOnly = false;
75
+
76
+ /**
77
+ * @var array
78
+ */
79
+ protected $_params = array();
80
+
81
+ /**
82
+ * Constructor.
83
+ *
84
+ * @param array $config
85
+ */
86
+ public function __construct(array $config)
87
+ {
88
+ if (isset($config['apiObject'])) {
89
+ $this->_apiObject = $config['apiObject'];
90
+ $this->_apiObjectClass = get_class($this->_apiObject);
91
+ }
92
+
93
+ if (isset($config['rowClass'])) {
94
+ $this->_rowClass = (string) $config['rowClass'];
95
+ }
96
+
97
+ if (isset($config['data'])) {
98
+ $this->_data = (array) $config['data'];
99
+ foreach ($this->_data as $key => $value) {
100
+ $this->_data[$key] = (array) $value;
101
+ }
102
+ }
103
+
104
+ if (isset($config['errors'])) {
105
+ $this->_errors = (array) $config['errors'];
106
+ }
107
+
108
+ if (isset($config['readOnly'])) {
109
+ $this->_readOnly = (bool) $config['readOnly'];
110
+ }
111
+
112
+ if (isset($config['stored'])) {
113
+ $this->_stored = (bool) $config['stored'];
114
+ }
115
+
116
+ if (isset($config['params'])) {
117
+ $this->_params = $config['params'];
118
+ }
119
+
120
+ // Set the count of rows
121
+ $this->_count = count($this->_data);
122
+ $this->init();
123
+ }
124
+
125
+ /**
126
+ * Initialize object
127
+ *
128
+ * Called from {@link __construct()} as final step of object instantiation.
129
+ *
130
+ * @return void
131
+ */
132
+ public function init()
133
+ {
134
+ }
135
+
136
+ /**
137
+ * @return Bronto_Api_Object
138
+ */
139
+ public function getApiObject()
140
+ {
141
+ return $this->_apiObject;
142
+ }
143
+
144
+ /**
145
+ * @return string
146
+ */
147
+ public function getApiObjectClass()
148
+ {
149
+ return $this->_apiObjectClass;
150
+ }
151
+
152
+ /**
153
+ * @return array
154
+ */
155
+ public function getParams()
156
+ {
157
+ return $this->_params;
158
+ }
159
+
160
+ /**
161
+ * Rewind the Iterator to the first element.
162
+ * Similar to the reset() function for arrays in PHP.
163
+ * Required by interface Iterator.
164
+ *
165
+ * @return Bronto_Api_Rowset Fluent interface.
166
+ */
167
+ public function rewind()
168
+ {
169
+ $this->_pointer = 0;
170
+ return $this;
171
+ }
172
+
173
+ /**
174
+ * Return the current element.
175
+ * Similar to the current() function for arrays in PHP
176
+ * Required by interface Iterator.
177
+ *
178
+ * @return Bronto_Api_Row current element from the collection
179
+ */
180
+ public function current()
181
+ {
182
+ if ($this->valid() === false) {
183
+ return null;
184
+ }
185
+
186
+ // Do we already have a row object for this position?
187
+ if (empty($this->_rows[$this->_pointer])) {
188
+ $this->_rows[$this->_pointer] = new $this->_rowClass(
189
+ array(
190
+ 'apiObject' => $this->_apiObject,
191
+ 'data' => $this->_data[$this->_pointer],
192
+ 'stored' => $this->_stored,
193
+ 'readOnly' => $this->_readOnly
194
+ )
195
+ );
196
+ }
197
+
198
+ // return the row object
199
+ return $this->_rows[$this->_pointer];
200
+ }
201
+
202
+ /**
203
+ * Return the identifying key of the current element.
204
+ * Similar to the key() function for arrays in PHP.
205
+ * Required by interface Iterator.
206
+ *
207
+ * @return int
208
+ */
209
+ public function key()
210
+ {
211
+ return $this->_pointer;
212
+ }
213
+
214
+ /**
215
+ * Move forward to next element.
216
+ * Similar to the next() function for arrays in PHP.
217
+ * Required by interface Iterator.
218
+ *
219
+ * @return void
220
+ */
221
+ public function next()
222
+ {
223
+ ++$this->_pointer;
224
+ }
225
+
226
+ /**
227
+ * Check if there is a current element after calls to rewind() or next().
228
+ * Used to check if we've iterated to the end of the collection.
229
+ * Required by interface Iterator.
230
+ *
231
+ * @return bool False if there's nothing more to iterate over
232
+ */
233
+ public function valid()
234
+ {
235
+ return $this->_pointer >= 0 && $this->_pointer < $this->_count;
236
+ }
237
+
238
+ /**
239
+ * Returns the number of elements in the collection.
240
+ *
241
+ * Implements Countable::count()
242
+ *
243
+ * @return int
244
+ */
245
+ public function count()
246
+ {
247
+ return $this->_count;
248
+ }
249
+
250
+ /**
251
+ * Take the Iterator to position $position
252
+ * Required by interface SeekableIterator.
253
+ *
254
+ * @param int $position the position to seek to
255
+ * @return Bronto_Api_Rowset
256
+ */
257
+ public function seek($position)
258
+ {
259
+ $position = (int) $position;
260
+ if ($position < 0 || $position >= $this->_count) {
261
+ throw new Bronto_Api_Rowset_Exception("Illegal index {$position}");
262
+ }
263
+ $this->_pointer = $position;
264
+ return $this;
265
+ }
266
+
267
+ /**
268
+ * Check if an offset exists
269
+ * Required by the ArrayAccess implementation
270
+ *
271
+ * @param string $offset
272
+ * @return boolean
273
+ */
274
+ public function offsetExists($offset)
275
+ {
276
+ return isset($this->_data[(int) $offset]);
277
+ }
278
+
279
+ /**
280
+ * Get the data for the given offset
281
+ *
282
+ * @param string $offset
283
+ * @return array
284
+ */
285
+ public function offsetGetData($offset)
286
+ {
287
+ $offset = (int) $offset;
288
+ if ($offset < 0 || $offset >= $this->_count) {
289
+ throw new Bronto_Api_Rowset_Exception("Illegal index {$offset}");
290
+ }
291
+
292
+ return $this->_data[$offset];
293
+ }
294
+
295
+ /**
296
+ * Get the row for the given offset
297
+ * Required by the ArrayAccess implementation
298
+ *
299
+ * @param string $offset
300
+ * @return Bronto_Api_Row
301
+ */
302
+ public function offsetGet($offset)
303
+ {
304
+ $offset = (int) $offset;
305
+ if ($offset < 0 || $offset >= $this->_count) {
306
+ throw new Bronto_Api_Rowset_Exception("Illegal index {$offset}");
307
+ }
308
+ $this->_pointer = $offset;
309
+
310
+ return $this->current();
311
+ }
312
+
313
+ /**
314
+ * Does nothing
315
+ * Required by the ArrayAccess implementation
316
+ *
317
+ * @param string $offset
318
+ * @param mixed $value
319
+ */
320
+ public function offsetSet($offset, $value)
321
+ {
322
+ }
323
+
324
+ /**
325
+ * Does nothing
326
+ * Required by the ArrayAccess implementation
327
+ *
328
+ * @param string $offset
329
+ */
330
+ public function offsetUnset($offset)
331
+ {
332
+ }
333
+
334
+ /**
335
+ * Seamlessly iterate over this rowset
336
+ *
337
+ * @return Bronto_Api_Rowset_Iterator
338
+ */
339
+ public function iterate()
340
+ {
341
+ return new Bronto_Api_Rowset_Iterator($this);
342
+ }
343
+
344
+ /**
345
+ * @return bool
346
+ */
347
+ public function hasErrors()
348
+ {
349
+ return !empty($this->_errors);
350
+ }
351
+
352
+ /**
353
+ * @return bool|array
354
+ */
355
+ public function getErrors()
356
+ {
357
+ if ($this->hasErrors()) {
358
+ $errors = array();
359
+ foreach ($this->_errors as $pointer) {
360
+ if ($this->offsetExists($pointer)) {
361
+ $row = $this->offsetGet($pointer);
362
+ $errors[] = array(
363
+ 'code' => $row->getErrorCode(),
364
+ 'message' => $row->getErrorMessage(),
365
+ );
366
+ }
367
+ }
368
+ return $errors;
369
+ }
370
+ return false;
371
+ }
372
+
373
+ /**
374
+ * @return bool|array
375
+ */
376
+ public function getError()
377
+ {
378
+ if ($this->hasErrors()) {
379
+ $error = array(
380
+ 'code' => null,
381
+ 'message' => 'Unknown error',
382
+ );
383
+ foreach ($this->_errors as $pointer) {
384
+ if ($this->offsetExists($pointer)) {
385
+ $row = $this->offsetGet($pointer);
386
+ $error = array(
387
+ 'code' => $row->getErrorCode(),
388
+ 'message' => $row->getErrorMessage(),
389
+ );
390
+ break;
391
+ }
392
+ }
393
+ return $error;
394
+ }
395
+ return false;
396
+ }
397
+ }
lib/Bronto/Api/Rowset/Exception.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ */
8
+ class Bronto_Api_Rowset_Exception extends Bronto_Api_Exception
9
+ {
10
+
11
+ }
lib/Bronto/Api/Rowset/Iterator.php ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Api_Rowset_Iterator implements Iterator, Countable
10
+ {
11
+ /** Iterator Types */
12
+ const TYPE_NONE = 0;
13
+ const TYPE_PAGE = 1;
14
+ const TYPE_DATE = 2;
15
+ const TYPE_STREAM = 3;
16
+
17
+ /**
18
+ * API Object
19
+ *
20
+ * @var Bronto_Api_Object
21
+ */
22
+ protected $_apiObject;
23
+
24
+ /**
25
+ * @var Bronto_Api_Rowset
26
+ */
27
+ protected $_rowset;
28
+
29
+ /**
30
+ * @var int
31
+ */
32
+ protected $_page = 1;
33
+
34
+ /**
35
+ * @var bool
36
+ */
37
+ protected $_newPage = true;
38
+
39
+ /**
40
+ * How many data rows there are (currently)
41
+ *
42
+ * @var int
43
+ */
44
+ protected $_count = 0;
45
+
46
+ /**
47
+ * Iterator pointer
48
+ *
49
+ * @var integer
50
+ */
51
+ protected $_pointer = 0;
52
+
53
+ /**
54
+ * @var int
55
+ */
56
+ protected $_type = self::TYPE_NONE;
57
+
58
+ /**
59
+ * Query field(s) for paging
60
+ *
61
+ * @var array
62
+ */
63
+ protected $_params = array();
64
+
65
+ /**
66
+ * Initial paging value(s)
67
+ *
68
+ * @var array
69
+ */
70
+ protected $_initialParamValues = array();
71
+
72
+ /**
73
+ * Last used paging value(s)
74
+ *
75
+ * @var array
76
+ */
77
+ protected $_lastParamValues = array();
78
+
79
+ /**
80
+ * Next paging value(s) to be used
81
+ *
82
+ * @var array
83
+ */
84
+ protected $_nextParamValues = array();
85
+
86
+ /**
87
+ * Constructor
88
+ *
89
+ * @param array $config
90
+ */
91
+ public function __construct(Bronto_Api_Rowset $rowset)
92
+ {
93
+ $this->_apiObject = $rowset->getApiObject();
94
+
95
+ if (!$this->_apiObject->canIterate()) {
96
+ throw new Bronto_Api_Rowset_Exception(sprintf('Cannot iterate results for %s', $this->_apiObject->getName()));
97
+ }
98
+
99
+ $this->_type = $this->_apiObject->getIteratorType();
100
+ $this->_params = $this->_apiObject->getIteratorParams();
101
+ $this->_rowset = $rowset;
102
+ $this->_count = $rowset->count();
103
+
104
+ // Set initial/next values
105
+ $this->_setupParamValues();
106
+ }
107
+
108
+ /**
109
+ * @return Bronto_Api_Object
110
+ */
111
+ public function getApiObject()
112
+ {
113
+ return $this->_apiObject;
114
+ }
115
+
116
+ protected function _setupParamValues()
117
+ {
118
+ $params = $this->_rowset->getParams();
119
+ $this->_lastParamValues = $params;
120
+
121
+ if (empty($this->_initialParamValues)) {
122
+ $this->_initialParamValues = $params;
123
+ }
124
+
125
+ // Loop through each field we have to check/update
126
+ foreach ($this->_params as $queryParam => $rowField) {
127
+ // Loop through each initial API query params
128
+ foreach ($params as $key => $value) {
129
+ if (!is_array($value)) {
130
+ $value = array($value);
131
+ }
132
+ foreach ($value as $subkey => $subvalue) {
133
+ if ($subkey == $queryParam) {
134
+ switch ($queryParam) {
135
+ case 'readDirection':
136
+ $this->_nextParamValues[$queryParam] = Bronto_Api_Object::DIRECTION_NEXT;
137
+ break;
138
+ case 'pageNumber':
139
+ $this->_nextParamValues[$queryParam] = $subvalue + 1;
140
+ break;
141
+ default:
142
+ $this->_nextParamValues[$queryParam] = $subvalue;
143
+ break;
144
+ }
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ /**
152
+ * @return array
153
+ */
154
+ protected function _getNextParamValues(array $skipParams = array())
155
+ {
156
+ $params = $this->_lastParamValues;
157
+
158
+ // Loop through each field we have to update
159
+ foreach ($this->_params as $queryParam => $rowField) {
160
+ if (in_array($queryParam, $skipParams)) {
161
+ continue;
162
+ }
163
+ // Loop through each API query param
164
+ foreach ($params as $key => $value) {
165
+ if (!is_array($value)) {
166
+ if ($key == $queryParam) {
167
+ $params[$key] = $this->_nextParamValues[$queryParam];
168
+ }
169
+ } else {
170
+ foreach ($value as $subkey => $subvalue) {
171
+ if ($subkey == $queryParam) {
172
+ $params[$key][$subkey] = $this->_nextParamValues[$queryParam];
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+
179
+ return $params;
180
+ }
181
+
182
+ /**
183
+ * @param int $pad
184
+ * @return int|string
185
+ */
186
+ public function getCurrentPage($pad = false)
187
+ {
188
+ if ($pad !== false) {
189
+ $pad = (int) $pad;
190
+ return sprintf("%0{$pad}d", $this->_page);
191
+ }
192
+
193
+ return $this->_page;
194
+ }
195
+
196
+ /**
197
+ * @return int
198
+ */
199
+ public function getCurrentKey()
200
+ {
201
+ return $this->_pointer;
202
+ }
203
+
204
+ /**
205
+ * Returns the number of elements in the collection.
206
+ *
207
+ * Implements Countable::count()
208
+ *
209
+ * @return int
210
+ */
211
+ public function count()
212
+ {
213
+ return $this->_count;
214
+ }
215
+
216
+ /**
217
+ * Required by interface Iterator.
218
+ *
219
+ * @return void
220
+ */
221
+ public function rewind()
222
+ {
223
+ }
224
+
225
+ /**
226
+ * Return the current element.
227
+ * Similar to the current() function for arrays in PHP
228
+ * Required by interface Iterator.
229
+ *
230
+ * @return Bronto_Api_Row current element from the collection
231
+ */
232
+ public function current()
233
+ {
234
+ if ($this->valid() === false) {
235
+ return null;
236
+ }
237
+
238
+ /* @var $row Bronto_Api_Row */
239
+ $row = $this->_rowset->current();
240
+
241
+ // Loop through each field we have to update
242
+ foreach ($this->_params as $queryParam => $rowField) {
243
+ // Skip fields that are query only
244
+ if (!$rowField) {
245
+ continue;
246
+ }
247
+ if (isset($row->{$rowField}) && !empty($row->{$rowField})) {
248
+ $this->_nextParamValues[$queryParam] = $row->{$rowField};
249
+ if ($row->isDateField($rowField)) {
250
+ $this->_nextParamValues[$queryParam] = date('c', strtotime($row->{$rowField}));
251
+ }
252
+ }
253
+ }
254
+
255
+ return $row;
256
+ }
257
+
258
+ /**
259
+ * Return the identifying key of the current element.
260
+ * Similar to the key() function for arrays in PHP.
261
+ * Required by interface Iterator.
262
+ *
263
+ * @return int
264
+ */
265
+ public function key()
266
+ {
267
+ return $this->_rowset->key();
268
+ }
269
+
270
+ /**
271
+ * Move forward to next element.
272
+ * Similar to the next() function for arrays in PHP.
273
+ * Required by interface Iterator.
274
+ *
275
+ * @return void
276
+ */
277
+ public function next()
278
+ {
279
+ $this->_rowset->next();
280
+ ++$this->_pointer;
281
+ $this->_newPage = false;
282
+ return $this->current();
283
+ }
284
+
285
+ /**
286
+ * Check if there is a current element after calls to rewind() or next().
287
+ * Used to check if we've iterated to the end of the collection.
288
+ * Required by interface Iterator.
289
+ *
290
+ * @return bool False if there's nothing more to iterate over
291
+ */
292
+ public function valid()
293
+ {
294
+ if ($this->_rowset->valid()) {
295
+ return true;
296
+ }
297
+
298
+ return $this->_nextRowset();
299
+ }
300
+
301
+ /**
302
+ * @return bool
303
+ */
304
+ protected function _nextRowset()
305
+ {
306
+ unset($this->_rowset);
307
+
308
+ // Skip some fields under certain circumstances
309
+ $skipParams = array();
310
+ if ($this->_type == self::TYPE_STREAM) {
311
+ $skipParams = $this->_params;
312
+ unset($skipParams['readDirection']);
313
+ }
314
+
315
+ // Make request for the new rowset
316
+ try {
317
+ $params = $this->_getNextParamValues(array_keys($skipParams));
318
+ $this->_rowset = $this->_apiObject->read($params);
319
+ } catch (Exception $e) {
320
+ if ($this->_type == self::TYPE_STREAM) {
321
+ // Reset readDirection
322
+ $this->_nextParamValues['readDirection'] = Bronto_Api_Object::DIRECTION_FIRST;
323
+ // Get params again without skipping
324
+ $params = $this->_getNextParamValues();
325
+ $this->_rowset = $this->_apiObject->read($params);
326
+ } else {
327
+ throw $e;
328
+ }
329
+ }
330
+
331
+ if (!$this->_rowset) {
332
+ throw new Bronto_Api_Rowset_Exception('Retrieving the next Rowset failed');
333
+ }
334
+
335
+ // Increments
336
+ $this->_newPage = true;
337
+ $this->_page = $this->_page + 1;
338
+ $this->_count = $this->_count + $this->_rowset->count();
339
+
340
+ // Re-setup params
341
+ $this->_setupParamValues();
342
+
343
+ return $this->_rowset->valid();
344
+ }
345
+
346
+ /**
347
+ * @return bool
348
+ */
349
+ public function isNewPage()
350
+ {
351
+ return $this->_newPage;
352
+ }
353
+
354
+ /**
355
+ * @return array
356
+ */
357
+ public function getLastParamValues()
358
+ {
359
+ return $this->_lastParamValues;
360
+ }
361
+
362
+ /**
363
+ * @param string $param
364
+ * @return mixed
365
+ */
366
+ public function getLastParamValue($param)
367
+ {
368
+ if (isset($this->_lastParamValues[$param])) {
369
+ return $this->_lastParamValues[$param];
370
+ }
371
+
372
+ foreach ($this->_lastParamValues as $key => $value) {
373
+ if (is_array($value)) {
374
+ if (isset($value[$param])) {
375
+ return $value[$param];
376
+ }
377
+ }
378
+ }
379
+
380
+ return false;
381
+ }
382
+
383
+ /**
384
+ * @return Bronto_Api
385
+ */
386
+ public function getApi()
387
+ {
388
+ return $this->_apiObject->getApi();
389
+ }
390
+
391
+ /**
392
+ * @return string
393
+ */
394
+ public function getLastRequest()
395
+ {
396
+ return $this->_apiObject->getApi()->getLastRequest();
397
+ }
398
+
399
+ /**
400
+ * @return string
401
+ */
402
+ public function getLastResponse()
403
+ {
404
+ return $this->_apiObject->getApi()->getLastResponse();
405
+ }
406
+ }
lib/Bronto/Api/Segment.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @link http://community.bronto.com/api/v4/objects/general/segmentobject
6
+ * @copyright 2011-2013 Bronto Software, Inc.
7
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
8
+ */
9
+ class Bronto_Api_Segment extends Bronto_Api_Object
10
+ {
11
+ /**
12
+ * @var array
13
+ */
14
+ protected $_methods = array(
15
+ 'readSegments' => 'read',
16
+ );
17
+
18
+ /**
19
+ * @param array $filter
20
+ * @param int $pageNumber
21
+ * @return Bronto_Api_Rowset
22
+ */
23
+ public function readAll(array $filter = array(), $pageNumber = 1)
24
+ {
25
+ $params = array();
26
+ $params['filter'] = $filter;
27
+ $params['pageNumber'] = (int) $pageNumber;
28
+ return $this->read($params);
29
+ }
30
+
31
+ /**
32
+ * @param array $data
33
+ */
34
+ public function createRow(array $data = array())
35
+ {
36
+ throw new Bronto_Api_Segment_Exception('You cannot create a Segment row.');
37
+ }
38
+ }
lib/Bronto/Api/Segment/Exception.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * @copyright 2011-2013 Bronto Software, Inc.
5
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
6
+ *
7
+ */
8
+ class Bronto_Api_Segment_Exception extends Bronto_Api_Exception
9
+ {
10
+
11
+ }
lib/Bronto/Api/Segment/Row.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ * @property-read string $id
9
+ * @property-read string $name
10
+ * @property-read array $rules
11
+ * @property-read string $lastUpdated
12
+ * @property-read float $activeCount
13
+ * @method Bronto_Api_Segment getApiObject() getApiObject()
14
+ */
15
+ class Bronto_Api_Segment_Row extends Bronto_Api_Row implements Bronto_Api_Delivery_Recipient
16
+ {
17
+ /**
18
+ * @var bool
19
+ */
20
+ protected $_readOnly = true;
21
+
22
+ /**
23
+ * @return Bronto_Api_Segment_Row
24
+ */
25
+ public function read()
26
+ {
27
+ if ($this->id) {
28
+ $params = array('id' => $this->id);
29
+ } elseif ($this->name) {
30
+ $params = array(
31
+ 'name' => array(
32
+ 'value' => $this->name,
33
+ 'operator' => 'EqualTo',
34
+ )
35
+ );
36
+ }
37
+
38
+ parent::_read($params);
39
+ return $this;
40
+ }
41
+
42
+ /**
43
+ * Required by Bronto_Api_Delivery_Recipient
44
+ *
45
+ * @return false
46
+ */
47
+ public function isList()
48
+ {
49
+ return false;
50
+ }
51
+
52
+ /**
53
+ * Required by Bronto_Api_Delivery_Recipient
54
+ *
55
+ * @return false
56
+ */
57
+ public function isContact()
58
+ {
59
+ return false;
60
+ }
61
+
62
+ /**
63
+ * Required by Bronto_Api_Delivery_Recipient
64
+ *
65
+ * @return true
66
+ */
67
+ public function isSegment()
68
+ {
69
+ return true;
70
+ }
71
+ }
lib/Bronto/SoapClient.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Jared Hodak <jhodak@kadro.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ */
8
+ class Bronto_SoapClient extends SoapClient
9
+ {
10
+ /**
11
+ * Overriding to replace known invalid xml characters.
12
+ * @see http://www.w3.org/TR/xml/#charsets
13
+ * @return string
14
+ */
15
+ public function __doRequest($request, $location, $action, $version, $one_way = 0) {
16
+ $result = parent::__doRequest($request, $location, $action, $version);
17
+
18
+ // Only replace unicode characters if PCRE version is less than 8.30
19
+ if (version_compare(strstr(constant('PCRE_VERSION'), ' ', true), '8.30', '<')) {
20
+ $result = preg_replace('/[\x{0}-\x{8}\x{B}-\x{C}\x{E}-\x{1F}\x{D800}-\x{DFFF}]/u', '', $result);
21
+ }
22
+
23
+ return $result;
24
+ }
25
+ }
lib/Bronto/Util/Colors.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Util_Colors
10
+ {
11
+ /**
12
+ * @see http://media.if-not-true-then-false.com/2010/01/PHP_CLI_Coloring_Class_Example.png
13
+ * @var array
14
+ */
15
+ protected $_attributes = array(
16
+ 'black' => array(
17
+ 'ansi' => '0;30',
18
+ 'hex' => '#2e3336',
19
+ ),
20
+ 'darkgray' => array(
21
+ 'ansi' => '1;30',
22
+ 'hex' => '#1e1e1e',
23
+ ),
24
+ 'blue' => array(
25
+ 'ansi' => '0;34',
26
+ 'hex' => '#3466a5',
27
+ ),
28
+ 'lightblue' => array(
29
+ 'ansi' => '1;34',
30
+ 'hex' => '#3edde0',
31
+ ),
32
+ 'green' => array(
33
+ 'ansi' => '0;32',
34
+ 'hex' => '#4e9a06',
35
+ ),
36
+ 'lightgreen' => array(
37
+ 'ansi' => '1;32',
38
+ 'hex' => '#87d939',
39
+ ),
40
+ 'cyan' => array(
41
+ 'ansi' => '0;36',
42
+ 'hex' => '#07989b',
43
+ ),
44
+ 'lightcyan' => array(
45
+ 'ansi' => '1;36',
46
+ 'hex' => '#39d7da',
47
+ ),
48
+ 'red' => array(
49
+ 'ansi' => '0;31',
50
+ 'hex' => '#cc0000',
51
+ ),
52
+ 'lightred' => array(
53
+ 'ansi' => '1;31',
54
+ 'hex' => '#c83a39',
55
+ ),
56
+ 'purple' => array(
57
+ 'ansi' => '0;35',
58
+ 'hex' => '#75507b',
59
+ ),
60
+ 'lightpurple' => array(
61
+ 'ansi' => '1;35',
62
+ 'hex' => '#aa7faa',
63
+ ),
64
+ 'brown' => array(
65
+ 'ansi' => '0;33',
66
+ 'hex' => '#8d6736',
67
+ ),
68
+ 'yellow' => array(
69
+ 'ansi' => '1;33',
70
+ 'hex' => '#c4a001',
71
+ ),
72
+ 'lightgray' => array(
73
+ 'ansi' => '0;37',
74
+ 'hex' => '#d2d7d0',
75
+ ),
76
+ 'white' => array(
77
+ 'ansi' => '1;37',
78
+ 'hex' => '#ffffff',
79
+ ),
80
+ 'onblack' => array(
81
+ 'ansi' => '40',
82
+ 'hex' => '#2e3336',
83
+ ),
84
+ 'onred' => array(
85
+ 'ansi' => '41',
86
+ 'hex' => '#cc0001',
87
+ ),
88
+ 'ongreen' => array(
89
+ 'ansi' => '42',
90
+ 'hex' => '#4e9a06',
91
+ ),
92
+ 'onyellow' => array(
93
+ 'ansi' => '43',
94
+ 'hex' => '#c4a100',
95
+ ),
96
+ 'onblue' => array(
97
+ 'ansi' => '44',
98
+ 'hex' => '#3466a5',
99
+ ),
100
+ 'onmagenta' => array(
101
+ 'ansi' => '45',
102
+ 'hex' => '#75507b',
103
+ ),
104
+ 'oncyan' => array(
105
+ 'ansi' => '46',
106
+ 'hex' => '#07989b',
107
+ ),
108
+ 'onlightgray' => array(
109
+ 'ansi' => '47',
110
+ 'hex' => '#d4d7d0',
111
+ ),
112
+ );
113
+
114
+ /**
115
+ * @param string|array $codes
116
+ * @param bool $html
117
+ * @return string
118
+ */
119
+ public function color($codes = array(), $html = false)
120
+ {
121
+ $attribute = '';
122
+ if (is_string($codes)) {
123
+ $codes = explode(' ', $codes);
124
+ }
125
+ foreach ($codes as $code) {
126
+ $code = strtolower($code);
127
+ if ($html) {
128
+ if (isset($this->_attributes[$code]['hex'])) {
129
+ if (stripos($code, 'on') === 0) {
130
+ $attribute .= "background-color: {$this->_attributes[$code]['hex']};";
131
+ } else {
132
+ $attribute .= "color: {$this->_attributes[$code]['hex']};";
133
+ }
134
+ } else {
135
+ switch ($code) {
136
+ case 'bold':
137
+ $attribute .= 'font-weight: bold;';
138
+ break;
139
+ default:
140
+ break;
141
+ }
142
+ }
143
+ } else {
144
+ if (isset($this->_attributes[$code]['ansi'])) {
145
+ $attribute .= "{$this->_attributes[$code]['ansi']};";
146
+ }
147
+ }
148
+ }
149
+
150
+ if ($html) {
151
+ return $attribute;
152
+ } else {
153
+ $attribute = substr($attribute, 0, -1);
154
+ return empty($attribute) ? false : chr(27) . "[$attribute" . "m";
155
+ }
156
+ }
157
+
158
+ /**
159
+ * @param string $text
160
+ * @param string|array $codes
161
+ * @param bool $html
162
+ * @return string
163
+ */
164
+ public function colored($text = '', $codes = array(), $html = false)
165
+ {
166
+ $attr = $this->color($codes, $html);
167
+
168
+ if ($html) {
169
+ if (empty($attr)) {
170
+ return false;
171
+ } else {
172
+ return "<span style=\"{$attr}\">{$text}</span>";
173
+ }
174
+ } else {
175
+ return $attr . $text . chr(27) . "[0m";
176
+ }
177
+ }
178
+
179
+ /**
180
+ * @param string $text
181
+ * @param bool $html
182
+ * @return string
183
+ */
184
+ public function parse($text = '', $html = false)
185
+ {
186
+ $matches = array();
187
+ preg_match_all('/(<([\w\s]+)[^>]*>)(.*?)(<\/\\2>)/', $text, $matches, PREG_SET_ORDER);
188
+ foreach ($matches as $value) {
189
+ $codes = explode(' ', trim($value[1], '<>'));
190
+ if ($substring = $this->colored($value[3], $codes, $html)) {
191
+ $text = str_replace($value[0], $substring, $text);
192
+ }
193
+ }
194
+ return $text;
195
+ }
196
+ }
lib/Bronto/Util/CountryCodes.php ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Util_Country
10
+ {
11
+ public static $codes = array(
12
+ 'AF' => 'Afghanistan',
13
+ 'AX' => 'Aland Islands',
14
+ 'AL' => 'Albania',
15
+ 'DZ' => 'Algeria',
16
+ 'AS' => 'American Samoa',
17
+ 'AD' => 'Andorra',
18
+ 'AO' => 'Angola',
19
+ 'AI' => 'Anguilla',
20
+ 'AQ' => 'Antarctica',
21
+ 'AG' => 'Antigua and Barbuda',
22
+ 'AR' => 'Argentina',
23
+ 'AM' => 'Armenia',
24
+ 'AW' => 'Aruba',
25
+ 'AU' => 'Australia',
26
+ 'AT' => 'Austria',
27
+ 'AZ' => 'Azerbaijan',
28
+ 'BS' => 'Bahamas',
29
+ 'BH' => 'Bahrain',
30
+ 'BD' => 'Bangladesh',
31
+ 'BB' => 'Barbados',
32
+ 'BY' => 'Belarus',
33
+ 'BE' => 'Belgium',
34
+ 'BZ' => 'Belize',
35
+ 'BJ' => 'Benin',
36
+ 'BM' => 'Bermuda',
37
+ 'BT' => 'Bhutan',
38
+ 'BO' => 'Bolivia Plurinational State of',
39
+ 'BA' => 'Bosnia and Herzegovina',
40
+ 'BW' => 'Botswana',
41
+ 'BV' => 'Bouvet Island',
42
+ 'BR' => 'Brazil',
43
+ 'IO' => 'British Indian Ocean Territory',
44
+ 'BN' => 'Brunei Darussalam',
45
+ 'BG' => 'Bulgaria',
46
+ 'BF' => 'Burkina Faso',
47
+ 'BI' => 'Burundi',
48
+ 'KH' => 'Cambodia',
49
+ 'CM' => 'Cameroon',
50
+ 'CA' => 'Canada',
51
+ 'CV' => 'Cape Verde',
52
+ 'KY' => 'Cayman Islands',
53
+ 'CF' => 'Central African Republic',
54
+ 'TD' => 'Chad',
55
+ 'CL' => 'Chile',
56
+ 'CN' => 'China',
57
+ 'CX' => 'Christmas Island',
58
+ 'CC' => 'Cocos (keeling) Islands',
59
+ 'CO' => 'Colombia',
60
+ 'KM' => 'Comoros',
61
+ 'CG' => 'Congo',
62
+ 'CD' => 'Congo the Democratic Republic of the',
63
+ 'CK' => 'Cook Islands',
64
+ 'CR' => 'Costa Rica',
65
+ 'CI' => '"Cote dIvoire"',
66
+ 'HR' => 'Croatia',
67
+ 'CU' => 'Cuba',
68
+ 'CY' => 'Cyprus',
69
+ 'CZ' => 'Czech Republic',
70
+ 'DK' => 'Denmark',
71
+ 'DJ' => 'Djibouti',
72
+ 'DM' => 'Dominica',
73
+ 'DO' => 'Dominican Republic',
74
+ 'EC' => 'Ecuador',
75
+ 'EG' => 'Egypt',
76
+ 'SV' => 'El Salvador',
77
+ 'GQ' => 'Equatorial Guinea',
78
+ 'ER' => 'Eritrea',
79
+ 'EE' => 'Estonia',
80
+ 'ET' => 'Ethiopia',
81
+ 'FK' => 'Falkland Islands (malvinas)',
82
+ 'FO' => 'Faroe Islands',
83
+ 'FJ' => 'Fiji',
84
+ 'FI' => 'Finland',
85
+ 'FR' => 'France',
86
+ 'GF' => 'French Guiana',
87
+ 'PF' => 'French Polynesia',
88
+ 'TF' => 'French Southern Territories',
89
+ 'GA' => 'Gabon',
90
+ 'GM' => 'Gambia',
91
+ 'GE' => 'Georgia',
92
+ 'DE' => 'Germany',
93
+ 'GH' => 'Ghana',
94
+ 'GI' => 'Gibraltar',
95
+ 'GR' => 'Greece',
96
+ 'GL' => 'Greenland',
97
+ 'GD' => 'Grenada',
98
+ 'GP' => 'Guadeloupe',
99
+ 'GU' => 'Guam',
100
+ 'GT' => 'Guatemala',
101
+ 'GG' => 'Guernsey',
102
+ 'GN' => 'Guinea',
103
+ 'GW' => 'Guinea-bissau',
104
+ 'GY' => 'Guyana',
105
+ 'HT' => 'Haiti',
106
+ 'HM' => 'Heard Island and Mcdonald Islands',
107
+ 'VA' => 'Holy See (Vatican City State)',
108
+ 'HN' => 'Honduras',
109
+ 'HK' => 'Hong Kong',
110
+ 'HU' => 'Hungary',
111
+ 'IS' => 'Iceland',
112
+ 'IN' => 'India',
113
+ 'ID' => 'Indonesia',
114
+ 'IR' => 'Iran Islamic Republic of',
115
+ 'IQ' => 'Iraq',
116
+ 'IE' => 'Ireland',
117
+ 'IM' => 'Isle of Man',
118
+ 'IL' => 'Israel',
119
+ 'IT' => 'Italy',
120
+ 'JM' => 'Jamaica',
121
+ 'JP' => 'Japan',
122
+ 'JE' => 'Jersey',
123
+ 'JO' => 'Jordan',
124
+ 'KZ' => 'Kazakhstan',
125
+ 'KE' => 'Kenya',
126
+ 'KI' => 'Kiribati',
127
+ 'KP' => '"Korea Democratic Peoples Republic of"',
128
+ 'KR' => 'Korea Republic of',
129
+ 'KW' => 'Kuwait',
130
+ 'KG' => 'Kyrgyzstan',
131
+ 'LA' => '"Lao Peoples Democratic Republic"',
132
+ 'LV' => 'Latvia',
133
+ 'LB' => 'Lebanon',
134
+ 'LS' => 'Lesotho',
135
+ 'LR' => 'Liberia',
136
+ 'LY' => 'Libyan Arab Jamahiriya',
137
+ 'LI' => 'Liechtenstein',
138
+ 'LT' => 'Lithuania',
139
+ 'LU' => 'Luxembourg',
140
+ 'MO' => 'Macao',
141
+ 'MK' => 'Macedonia the Former Yugoslav Republic of',
142
+ 'MG' => 'Madagascar',
143
+ 'MW' => 'Malawi',
144
+ 'MY' => 'Malaysia',
145
+ 'MV' => 'Maldives',
146
+ 'ML' => 'Mali',
147
+ 'MT' => 'Malta',
148
+ 'MH' => 'Marshall Islands',
149
+ 'MQ' => 'Martinique',
150
+ 'MR' => 'Mauritania',
151
+ 'MU' => 'Mauritius',
152
+ 'YT' => 'Mayotte',
153
+ 'MX' => 'Mexico',
154
+ 'FM' => 'Micronesia Federated States of',
155
+ 'MD' => 'Moldova Republic of',
156
+ 'MC' => 'Monaco',
157
+ 'MN' => 'Mongolia',
158
+ 'ME' => 'Montenegro',
159
+ 'MS' => 'Montserrat',
160
+ 'MA' => 'Morocco',
161
+ 'MZ' => 'Mozambique',
162
+ 'MM' => 'Myanmar',
163
+ 'NA' => 'Namibia',
164
+ 'NR' => 'Nauru',
165
+ 'NP' => 'Nepal',
166
+ 'NL' => 'Netherlands',
167
+ 'AN' => 'Netherlands Antilles',
168
+ 'NC' => 'New Caledonia',
169
+ 'NZ' => 'New Zealand',
170
+ 'NI' => 'Nicaragua',
171
+ 'NE' => 'Niger',
172
+ 'NG' => 'Nigeria',
173
+ 'NU' => 'Niue',
174
+ 'NF' => 'Norfolk Island',
175
+ 'MP' => 'Northern Mariana Islands',
176
+ 'NO' => 'Norway',
177
+ 'OM' => 'Oman',
178
+ 'OT' => 'Other',
179
+ 'PK' => 'Pakistan',
180
+ 'PW' => 'Palau',
181
+ 'PS' => 'Palestinian Territory Occupied',
182
+ 'PA' => 'Panama',
183
+ 'PG' => 'Papua New Guinea',
184
+ 'PY' => 'Paraguay',
185
+ 'PE' => 'Peru',
186
+ 'PH' => 'Philippines',
187
+ 'PN' => 'Pitcairn',
188
+ 'PL' => 'Poland',
189
+ 'PT' => 'Portugal',
190
+ 'PR' => 'Puerto Rico',
191
+ 'QA' => 'Qatar',
192
+ 'RE' => 'REunion',
193
+ 'RO' => 'Romania',
194
+ 'RU' => 'Russian Federation',
195
+ 'RW' => 'Rwanda',
196
+ 'BL' => 'Saint Barthélemy',
197
+ 'SH' => 'Saint Helena Ascension and Tristan da Cunha',
198
+ 'KN' => 'Saint Kitts and Nevis',
199
+ 'LC' => 'Saint Lucia',
200
+ 'MF' => 'Saint Martin',
201
+ 'PM' => 'Saint Pierre and Miquelon',
202
+ 'VC' => 'Saint Vincent and the Grenadines',
203
+ 'WS' => 'Samoa',
204
+ 'SM' => 'San Marino',
205
+ 'ST' => 'Sao Tome and Principe',
206
+ 'SA' => 'Saudi Arabia',
207
+ 'SN' => 'Senegal',
208
+ 'RS' => 'Serbia',
209
+ 'SC' => 'Seychelles',
210
+ 'SL' => 'Sierra Leone',
211
+ 'SG' => 'Singapore',
212
+ 'SK' => 'Slovakia',
213
+ 'SI' => 'Slovenia',
214
+ 'SB' => 'Solomon Islands',
215
+ 'SO' => 'Somalia',
216
+ 'ZA' => 'South Africa',
217
+ 'GS' => 'South Georgia and the South Sandwich Islands',
218
+ 'ES' => 'Spain',
219
+ 'LK' => 'Sri Lanka',
220
+ 'SD' => 'Sudan',
221
+ 'SR' => 'Suriname',
222
+ 'SJ' => 'Svalbard and Jan Mayen',
223
+ 'SZ' => 'Swaziland',
224
+ 'SE' => 'Sweden',
225
+ 'CH' => 'Switzerland',
226
+ 'SY' => 'Syrian Arab Republic',
227
+ 'TW' => 'Taiwan Province of China',
228
+ 'TJ' => 'Tajikistan',
229
+ 'TZ' => 'Tanzania United Republic of',
230
+ 'TH' => 'Thailand',
231
+ 'TL' => 'Timor-leste',
232
+ 'TG' => 'Togo',
233
+ 'TK' => 'Tokelau',
234
+ 'TO' => 'Tonga',
235
+ 'TT' => 'Trinidad and Tobago',
236
+ 'TN' => 'Tunisia',
237
+ 'TR' => 'Turkey',
238
+ 'TM' => 'Turkmenistan',
239
+ 'TC' => 'Turks and Caicos Islands',
240
+ 'TV' => 'Tuvalu',
241
+ 'UG' => 'Uganda',
242
+ 'UA' => 'Ukraine',
243
+ 'AE' => 'United Arab Emirates',
244
+ 'GB' => 'United Kingdom',
245
+ 'US' => 'United States',
246
+ 'UM' => 'United States Minor Outlying Islands',
247
+ 'UY' => 'Uruguay',
248
+ 'UZ' => 'Uzbekistan',
249
+ 'VU' => 'Vanuatu',
250
+ 'VE' => 'Venezuela Bolivarian Republic of',
251
+ 'VN' => 'Viet Nam',
252
+ 'VG' => 'Virgin Islands British',
253
+ 'VI' => 'Virgin Islands U.S.',
254
+ 'WF' => 'Wallis and Futuna',
255
+ 'EH' => 'Western Sahara',
256
+ 'YE' => 'Yemen',
257
+ 'ZM' => 'Zambia',
258
+ 'ZW' => 'Zimbabwe',
259
+ );
260
+ }
lib/Bronto/Util/Retryer/FileRetryer.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Util_Retryer_FileRetryer implements Bronto_Util_Retryer_RetryerInterface
10
+ {
11
+ /**
12
+ * @var string
13
+ */
14
+ protected $_path;
15
+
16
+ /**
17
+ * @param array $options
18
+ */
19
+ public function __construct(array $options = array())
20
+ {
21
+ $this->_path = sys_get_temp_dir();
22
+
23
+ if (isset($options['path']) && !empty($options['path'])) {
24
+ if (@is_dir($options['path'])) {
25
+ $this->_path = $options['path'];
26
+ } else {
27
+ // Attempt to make it...
28
+ if (@mkdir($options['path'], 0766, true)) {
29
+ $this->_path = $options['path'];
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+ /**
36
+ * @param string $filename
37
+ * @return string
38
+ */
39
+ public function getPath($filename = null)
40
+ {
41
+ return $this->_path . (!empty($filename) ? DIRECTORY_SEPARATOR . $filename : '');
42
+ }
43
+
44
+ /**
45
+ * @param Bronto_Api_Object $object
46
+ * @param int $attempts
47
+ * @return string
48
+ */
49
+ public function store(Bronto_Api_Object $object, $attempts = 0)
50
+ {
51
+ if (!@is_dir($this->_path) && !@mkdir($this->_path, 0777, true)) {
52
+ throw new Bronto_Util_RetryerException(sprintf('The Retryer path is not a directory: %s', $this->_path));
53
+ } else {
54
+ if (!@is_writable($this->_path)) {
55
+ throw new Bronto_Util_RetryerException(sprintf('The Retryer path is not a writable: %s', $this->_path));
56
+ }
57
+ }
58
+
59
+ $filename = sprintf(
60
+ '%s_%s_%s_%d.php',
61
+ strtolower($object->getName()),
62
+ str_replace('.', '', microtime()),
63
+ str_pad(rand(0, 1000), 4, ' ', STR_PAD_LEFT),
64
+ (int) $attempts
65
+ );
66
+ $filename = str_replace(' ', '', $filename);
67
+ $fh = @fopen($this->_path . DIRECTORY_SEPARATOR . $filename, 'w');
68
+ $serialized = serialize($object);
69
+ $result = @fwrite($fh, sprintf("<?php return unserialize('%s'); ?>", $serialized));
70
+ @fclose($fh);
71
+
72
+ return $result ? $filename : false;
73
+ }
74
+
75
+ /**
76
+ * @param string $filePath
77
+ * @return Bronto_Api_Object
78
+ */
79
+ protected function _loadObject($filePath)
80
+ {
81
+ if (!@file_exists($filePath)) {
82
+ throw new Bronto_Util_RetryerException(sprintf('Failed to retry file path: %s', $filePath));
83
+ }
84
+
85
+ $parts = explode('_', $filePath);
86
+ $parts = explode('.', $parts[count($parts) - 1]);
87
+
88
+ return array(
89
+ 'object' => include_once $filePath,
90
+ 'attempts' => (int) $parts[0],
91
+ );
92
+ }
93
+
94
+ /**
95
+ * @param string $filePath
96
+ * @return Bronto_Api_Rowset
97
+ */
98
+ public function attempt($filePath)
99
+ {
100
+ $result = $this->_loadObject($filePath);
101
+ $object = $result['object'];
102
+ $attempts = $result['attempts'];
103
+ $method = $object->getLastRequestMethod();
104
+ $data = $object->getLastRequestData();
105
+
106
+ try {
107
+ $rowset = $object->doRequest($method, $data, true);
108
+ } catch (Exception $e) {
109
+ $this->store($object, $attempts++);
110
+ return false;
111
+ }
112
+
113
+ $this->remove($filePath);
114
+
115
+ return $rowset;
116
+ }
117
+
118
+ /**
119
+ * @param string $filePath
120
+ * @return bool
121
+ */
122
+ public function remove($filePath)
123
+ {
124
+ return @unlink($filePath);
125
+ }
126
+ }
lib/Bronto/Util/Retryer/RetryerException.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ class Bronto_Util_RetryerException extends RuntimeException
7
+ {
8
+
9
+ }
lib/Bronto/Util/Retryer/RetryerInterface.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright 2011-2013 Bronto Software, Inc.
4
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
5
+ */
6
+ interface Bronto_Util_Retryer_RetryerInterface
7
+ {
8
+ /**
9
+ * @param Bronto_Api_Object $object
10
+ * @param int $attempts
11
+ * @return string
12
+ */
13
+ function store(Bronto_Api_Object $object, $attempts = 0);
14
+
15
+ /**
16
+ * @param mixed $identifier
17
+ * @return Bronto_Api_Rowset
18
+ */
19
+ function attempt($identifier);
20
+ }
lib/Bronto/Util/Uuid.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Chris Jones <chris.jones@bronto.com>
5
+ * @copyright 2011-2013 Bronto Software, Inc.
6
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
+ *
8
+ */
9
+ class Bronto_Util_Uuid
10
+ {
11
+ /**
12
+ * @param string $value
13
+ * @return string
14
+ */
15
+ public function toString($value)
16
+ {
17
+ if ($value = $this->binaryToString($value)) {
18
+ $this->unstrip($value);
19
+ }
20
+ return false;
21
+ }
22
+
23
+ /**
24
+ * @param string $value
25
+ * @return string
26
+ */
27
+ public function toBinary($value)
28
+ {
29
+ return $this->stringToBinary($this->strip($value));
30
+ }
31
+
32
+ /**
33
+ * @param string $value
34
+ * @return string
35
+ */
36
+ public function stringToBinary($value)
37
+ {
38
+ if (!empty($value)) {
39
+ return pack('H*', $value);
40
+ }
41
+ return false;
42
+ }
43
+
44
+ /**
45
+ * @param string $value
46
+ * @return string
47
+ */
48
+ public function binaryToString($value)
49
+ {
50
+ if (!empty($value)) {
51
+ $value = unpack('H*', $value);
52
+ return array_shift($value);
53
+ }
54
+ return false;
55
+ }
56
+
57
+ /**
58
+ * @param string $value
59
+ * @return string
60
+ */
61
+ public function strip($value)
62
+ {
63
+ return str_replace('-', '', $value);
64
+ }
65
+
66
+ /**
67
+ * @param string $value
68
+ * @return string
69
+ */
70
+ public function unstrip($value)
71
+ {
72
+ if (strlen($value) === 32) {
73
+ return preg_replace('/([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})/', '$1-$2-$3-$4-$5', $value);
74
+ }
75
+
76
+ return $value;
77
+ }
78
+ }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bronto_Extension</name>
4
- <version>2.0.4.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
@@ -27,7 +27,7 @@
27
  &#xD;
28
  &lt;p&gt;&lt;strong&gt;Newsletter Opt-In&lt;/strong&gt;&lt;br /&gt;Automatically add contacts who opt-in for marketing emails on your Magento site to Bronto and keep their subscription status up-to-date.&lt;/p&gt;&#xD;
29
  &#xD;
30
- &lt;p&gt;Installation and configuration documentation for the extension may be found &lt;a href="http://a.bron.to/magento"&gt;here&lt;/a&gt;.&lt;/p&gt;&#xD;
31
  &#xD;
32
  &lt;h3&gt;Contact Us to Learn More&lt;/h3&gt;&#xD;
33
  &#xD;
@@ -53,11 +53,13 @@
53
  &#xD;
54
  &lt;h3&gt;About Bronto&lt;/h3&gt;&#xD;
55
  &lt;p /&gt;Bronto Software provides a cloud-based marketing platform for retailers to drive revenue through their email, mobile and social campaigns. The platform is used by over 1000 organizations worldwide, including Party City, Armani Exchange, Timex, Samsonite and Gander Mountain. Bronto is a Gold Magento Industry Partner and the leading self-service email marketing provider to the Internet Retailer Top 1000. Bronto is headquartered in Durham, NC with an office in London, UK. For more information, visit &lt;a href="http://bronto.com"&gt;bronto.com&lt;/a&gt;.&lt;/p&gt;</description>
56
- <notes>&lt;p /&gt;For installation and configuration instructions, as well as a full list of new features and known issues, please review the &lt;a href="http://a.bron.to/magento"&gt;Implementation Guide&lt;/a&gt;.</notes>
57
- <authors><author><name>Chris Geiss</name><user>BrontoSoftware</user><email>chris.geiss@bronto.com</email></author></authors>
 
 
58
  <date>2013-07-22</date>
59
- <time>15:37:16</time>
60
- <contents><target name="magecommunity"><dir name="Bronto"><dir name="Common"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="1c7d38084216631295a28291ab19681e"/><file name="Cron.php" hash="1a718ab7d39492ff064618f7507d35ef"/><dir name="Form"><dir name="Field"><file name="Apitoken.php" hash="d8ed503f8d22d96b0ee79f18426bb8a1"/><file name="Hidden.php" hash="18a13153df6dd084840086105f8117cc"/><file name="List.php" hash="48f36e9d06e6bc759e36ebb1128aa513"/></dir><file name="Field.php" hash="bfc0b65b927934ba54bb5225c0fb9247"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="aa0f86b84c97399bdf259935de33dca0"/><file name="Data.php" hash="d71b8a47d17b6096613b9c004eb76bd9"/><file name="DataInterface.php" hash="a6700f3a4a79f6d6468df24f714427a9"/><file name="Field.php" hash="683839cfcd4fd5cd81b0393fc67b019c"/><file name="Message.php" hash="22d6224ab354a6ed7dc13d1e6e0a2fc5"/><file name="Product.php" hash="64202787e5f0c63a38efff387ab3c325"/></dir><dir name="Model"><file name="Api.php" hash="3716948a5e50e621625714a1e3a93263"/><dir name="Email"><dir name="Message"><file name="Filter.php" hash="5758c71217e4e545af31fec29d263576"/><file name="Templatefilter.php" hash="16f44ac2a7d97b27f33a06e59de8ea30"/></dir><file name="Message.php" hash="17086fba16eed6986c0ab1fafbeffbd6"/></dir><file name="Keysentry.php" hash="fd39d0a0208668723d0c0adb0b31bd67"/><file name="Observer.php" hash="73b02a94aba279c05dd7753ac10fdb75"/><dir name="Resource"><file name="Setup.php" hash="780f5c070cbd9da2f003372ee90a0891"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="b05e28fb0cc0db0377eee68ffc712c10"/><file name="Token.php" hash="18368da2a435855841c8b5e2b10637b1"/></dir><dir name="Source"><dir name="Contact"><file name="Status.php" hash="1bf6c053f8132a36dd6882e0f1faf45f"/></dir><dir name="Cron"><file name="Frequency.php" hash="c6689871a7a8add3dc4b84e4a2ff6f10"/><file name="Minutes.php" hash="be3e3066819785b55a25f22c5bc9392a"/></dir><file name="Field.php" hash="d8a4089180cac8527bb98d831629d25c"/><file name="List.php" hash="69497100fe9f036c442b9d94133c8f4a"/><file name="Message.php" hash="4fb4e4f9deaabe4971bfcdf3e12b0da4"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="02b55ba2804a024740506c4df0ebdd42"/></dir><dir name="Model"><file name="Checkout.php" hash="9716ab2c76558e463f1a105308973b74"/><dir name="Keysentry"><dir name="fixtures"><file name="seed.yaml" hash="3a9b13b2ef5a72bea298be72edba821d"/></dir></dir><file name="Keysentry.php" hash="fe06eff7212d57057ed1ee490238694f"/></dir></dir><dir name="controllers"><file name="LogController.php" hash="d97e8dc3624053d563389b8b19c71c06"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f5792bf262cf83cc193d23c09a17a03f"/><file name="config.xml" hash="54b3267b68701bcd69b923f1a2f90c3b"/><file name="system.xml" hash="5952ce44c1df3b13c5cb5a709718df2c"/></dir><dir name="sql"><dir name="bronto_common_setup"><file name="mysql4-install-1.7.0.php" hash="c8459d26fdfea2fb9430e8829b3257e1"/></dir></dir></dir><dir name="ConflictChecker"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="9049055c03e261b2452c926d801196a6"/><file name="Conflictchecker.php" hash="c00f929ef55e95597761871674077b10"/></dir></dir></dir><file name="Printer.php" hash="cd8ef4c01028da3d690ce6f5c53d1f61"/></dir><dir name="Helper"><file name="Data.php" hash="0f5c562370c77b6cfe9579dc7fe396d0"/></dir><dir name="Model"><dir name="Config"><file name="Blocks.php" hash="78eb63947ae94be2b1dc9ee42de52152"/><file name="Checker.php" hash="a1a38b9c4a518e0be2e4ea84adab0107"/><file name="ConfigAbstract.php" hash="8bc2be8485543a17338cb953d760c71c"/><file name="ConfigInterface.php" hash="86a788c1b1971828c8f947b42f03baea"/><file name="Datastore.php" hash="d2b37735fe127d831e6055e05b232fb8"/><file name="Helpers.php" hash="3de600b842bf90c53417843e9b4c1946"/><file name="Models.php" hash="0358f506ff4e5820b61b076701f0746d"/><file name="Printer.php" hash="6d2aec31a623b943d3d982c97999be13"/><file name="Resources.php" hash="9f12487e864cd4005c53b72fe02e4cf4"/></dir><dir name="Core"><dir name="Config"><file name="Base.php" hash="b1ecb5cd90e050d1c825beb65e6d888e"/><file name="Element.php" hash="2efb1a1c022cb393ab5718c1f7eafd1f"/></dir><file name="Config.php" hash="29408203a0aa8b7afa84ba16b1416f91"/></dir><dir name="Lib"><dir name="Varien"><dir name="Simplexml"><file name="Config.php" hash="3acbdd7d7c9fa6c346688e5083569596"/><file name="Element.php" hash="f5961e7a41035851cabf7fcd8022a13a"/></dir></dir></dir><dir name="Mysql4"><dir name="Core"><file name="Config.php" hash="36685bb89b45c71cfc447727ce66ea9a"/></dir></dir><dir name="Path"><dir name="Locator"><file name="Array.php" hash="f82c5966dab92ed91a9441a0231e7ace"/><file name="Factory.php" hash="bea2e4a6bea17815a9040341209f4256"/><file name="IteratorAbstract.php" hash="9adccb7c853d80e8d64a0eb8346f3cbc"/><file name="LocatorInterface.php" hash="b3cf0d528296ee0e87e7898da44baa47"/><file name="Stack.php" hash="4524078604b43dffcf57c7a23959ef03"/></dir></dir><dir name="Resource"><dir name="Core"><file name="Config.php" hash="6b69bd1c0ce0e4c92c1c96436f79e83d"/></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="23de17a20f7a5588bb9761a2d3eb79ae"/></dir><dir name="Model"><dir name="Path"><dir name="Locator"><file name="Array.php" hash="e219f193e027d5c9a5d9cb9d7a27a6ac"/><file name="Factory.php" hash="36ffe1ec656f3f3ba1f99dd743e52c0b"/><file name="Stack.php" hash="29cbf00cd66bc61ee16c740847d9f400"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9d5cab56f52b0d12688c5787e3bfa03f"/><file name="config.xml" hash="0497e6c9bf942db62d01e0595437166b"/><file name="system.xml" hash="6d6b10860c55f815efe815d7ee0c2290"/></dir></dir><dir name="Customer"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="5874d9bf1ff106212a348815104c5244"/><file name="Cron.php" hash="41e36d043441e1e9424186c90bb4807d"/><dir name="Form"><dir name="Fieldset"><dir name="Attributes"><file name="Address.php" hash="383082bb7b45f9b250acea756b2e5758"/><file name="Customer.php" hash="cbbb4c20f3424e4f988c94335ff004c2"/></dir><file name="Attributes.php" hash="148ebebdc9b7a49319b232bfe8e64e8a"/></dir></dir></dir></dir><dir name="Widget"><dir name="Button"><file name="Reset.php" hash="74d38897533f7b4e67d476dd791a38ee"/><file name="Run.php" hash="e707627c781ea4323d1924fa33094320"/><file name="Sync.php" hash="3475e65cab50bd4b047a58f8b50bc958"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="40ab8eee7df85cfc39e2e35d07843a18"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="c74a251bc694defe14e9033da9bdc77a"/></dir><file name="Queue.php" hash="97d19f161a404e1a92e1d4f17301b162"/><file name="Setup.php" hash="615e25c2d8493dcd4301650421c87f08"/></dir><file name="Observer.php" hash="cb0872283c06f5027dcb1668706111f1"/><file name="Queue.php" hash="0b6b4e2bde336b5052007b3836c0c109"/><dir name="Resource"><file name="Customer.php" hash="9aa5ef7b70c3714cd049c9f2957ceb7c"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Brontofield.php" hash="6de9a1df609e8a7b396f4f80a7e6c764"/><file name="Cron.php" hash="dbcd55d41447d46fded27dfa2e6febb0"/><file name="Newfield.php" hash="d9a66dbc0b932fb80c7c947c3ce29bba"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="20025141111083480c8109d9619598bf"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="170274d2c7b46834e7c819983fa01156"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6cc229b440b34da710887aaf96bbcf81"/><file name="config.xml" hash="ff10a2ee4365580e3c9c509a768c23c1"/><file name="system.xml" hash="0e13fc7e0917b98b5d28aa658cd53027"/></dir><dir name="sql"><dir name="bronto_customer_setup"><file name="mysql4-install-1.0.0.php" hash="871c225318588b2804a05751bce45e1f"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="e7986d0b22a92f5df7a3480f80d7b937"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="b95305221a61733ff7617ce9307101c2"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="590cf0b5109bbbb0e745bec806463adc"/></dir></dir></dir><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="10cb51420b205c100ef46cf59edef05b"/></dir><dir name="Email"><dir name="Log"><dir name="Grid"><dir name="Renderer"><file name="Customer.php" hash="c2530287b293e05508816049586ef5c2"/><file name="Fields.php" hash="6c5d921b6c636329f035381af4c7f028"/></dir></dir><file name="Grid.php" hash="b54cada4029aa45290679e6cf69f8c47"/></dir><file name="Log.php" hash="3fa0b873d262b3d5c6161c1aef33e6ae"/><dir name="Template"><dir name="Edit"><file name="Form.php" hash="804a3fc8d0e773639f8eb2fe3df1ab1f"/></dir><file name="Edit.php" hash="bcc5b9ba9bee92a3e8f33684dd02506f"/><dir name="Grid"><dir name="Renderer"><file name="Message.php" hash="bf56f19c9f4310609fbb9a788768e222"/></dir></dir><file name="Grid.php" hash="8f1381ece5de903d48cbc7ae496028c7"/></dir><file name="Template.php" hash="b33503babba2480ca840569629dfbb07"/></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="712033409f93712e4a22cf89252d44e4"/><file name="Data.php" hash="e582e103dfe73cb4ab9e6eb675f81309"/><file name="Field.php" hash="e4714e9cc95bdfe4da9a16feb604f44c"/><file name="Message.php" hash="f328dcee7934ddc48d6f4d40afff74cc"/></dir><dir name="Model"><dir name="Email"><file name="Message.php" hash="5d2c4b3ac3120352f8424863ad176dc6"/></dir><file name="Log.php" hash="2740d9cd5073106f58880e57e84ce8ee"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="6de4819537636d3ea7816cb7c6fc250c"/></dir><file name="Log.php" hash="15ffb2c83281c77b5d427ff29abac776"/></dir><file name="Observer.php" hash="0b67950706c21220a4712bc0c279ba00"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Email"><file name="Template.php" hash="ba80e6553c61e731b85c027cd688ca8f"/></dir></dir></dir></dir><dir name="Template"><file name="Import.php" hash="f69b3458521bdb2c3bb33aa3d1c28620"/></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="8a74889c3f24c3053baefca6e7d7eddb"/></dir><dir name="Model"><dir name="Email"><file name="Message.php" hash="11a9aded1841673bdafd4675de78a19e"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="System"><dir name="Email"><file name="LogController.php" hash="386560ba30da12796614db1d0381bb7c"/><file name="TemplateController.php" hash="578112502761e70000ff10ca67502034"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35a2ffa5e273f87b6d2de172cea4a219"/><file name="config.xml" hash="37e21ee9d0458bd28379446f063457a5"/><file name="system.xml" hash="ea9e30ce8eb25b0b7e840a7933640a27"/></dir><dir name="sql"><dir name="bronto_email_setup"><file name="mysql4-install-1.0.0.php" hash="516265312ede986c1a35a19b9e5bbfea"/><file name="mysql4-install-1.0.2.php" hash="327ac219e947d608fbf9d3209dd03bab"/><file name="mysql4-install-1.0.5.php" hash="327ac219e947d608fbf9d3209dd03bab"/><file name="mysql4-install-1.0.8.php" hash="b572625c1380dfffe3b089275ac1dc7e"/><file name="mysql4-install-1.1.2.php" hash="bf80f7b12eccdad2e0e36a564e18530c"/><file name="mysql4-upgrade-1.0.0-1.0.2.php" hash="1f797c3f909d72219ef5d00017b10554"/><file name="mysql4-upgrade-1.0.2-1.0.5.php" hash="f2c83b65500d9df0fd10c2e6721f2bfe"/><file name="mysql4-upgrade-1.0.5-1.0.8.php" hash="cdbda7aa084e51b9b222c56e548462a6"/><file name="mysql4-upgrade-1.0.8-1.1.1.php" hash="f2c83b65500d9df0fd10c2e6721f2bfe"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="0538afef03b1e21d509593e2ad275c34"/></dir></dir></dir><dir name="Newsletter"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="bc44a52305e7cbe3a41c5f19e6257ede"/><file name="Cron.php" hash="2253dab9a7475df825d4bcb7849cc3e9"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Reset.php" hash="98efb50dd447e6a60db7c25846ae0432"/><file name="Run.php" hash="49efe1ee4550454366fe5631fa2c6e88"/></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Newsletter.php" hash="ed221e46e61f3312a038c022dacf5fd7"/></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="4c1dcd95ea237397ac2ee82090ce32e4"/><file name="Data.php" hash="62e5be8e1326862fee10774654daad15"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="41a203d85e16a660bf20bec8ecf157fd"/></dir><file name="Queue.php" hash="9a890d3fe569edd426ce38afe564dc7a"/></dir><file name="Observer.php" hash="7bdd91c7ee15183de3aeca1bcabc473e"/><file name="Queue.php" hash="89e6276cab088714b555c052172c4989"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="a270f0a31c390383cdabc0021baf3d3c"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="d88d07780bb3ded63c2c35439840dad5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="NewsletterController.php" hash="fb1b701c2335e82e258ed16d2a5c8975"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="253518e92554bf89fabe7b832a7a562c"/><file name="config.xml" hash="1d0adbc56975d579620dabd02394ff38"/><file name="system.xml" hash="1314e4b54d7c89a75f8ca9b7d02623b8"/></dir><dir name="sql"><dir name="bronto_newsletter_setup"><file name="mysql4-install-1.0.0.php" hash="0f21d5315bbc4c27d0d38f9cf8c99bf3"/><file name="mysql4-install-1.4.0.php" hash="9bd28347f3330b857102900adf702bed"/><file name="mysql4-upgrade-1.4.0-1.4.1.php" hash="7eeba27e7b5480c8b502c3805554e2de"/><file name="mysql4-upgrade-1.4.1-1.4.2.php" hash="32f724b99d88e037ade72c8a9f1e0da7"/><file name="mysql4-upgrade-1.4.2-1.4.3.php" hash="63c728bb0cd7fa83bb5536d4500548f4"/><file name="mysql4-upgrade-1.4.3-1.4.4.php" hash="4f08a427c7706ea0988bcdcca6072218"/></dir></dir></dir><dir name="Order"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Info.php" hash="ca80d06fb86b6bf676fc21188d5f2685"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="About.php" hash="126e3166dace48941fccbe2bb4c80264"/><file name="Cron.php" hash="c6a24643d4c35d557f87e1c51e860ef2"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Reset.php" hash="9bfbc1f1ffb38389a3a47ca009a24a35"/><file name="Run.php" hash="5b833a216bea22b962f633e33f6a86b8"/><file name="Sync.php" hash="ca0171d605d29a49445eaac37f95d1c1"/></dir></dir></dir><file name="Bta.php" hash="8c6a92894134f428e111d0cd0e99c137"/></dir><dir name="Helper"><file name="Data.php" hash="d4c020c5ad5bfee3245562c1c93fa349"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="f9fc983e670311531b8a260b78b46bc0"/></dir><file name="Queue.php" hash="c25aee2c31258eedfd5734bf1f143979"/><file name="Setup.php" hash="b3ccddc52af0695c48cff499ed112901"/></dir><file name="Observer.php" hash="9e59c3940eccca73c8b4a6a1e774970f"/><dir name="Order"><file name="Observer.php" hash="00fe5ac4fbee213403b60a33be463478"/></dir><file name="Queue.php" hash="aa7971d7f901f1e48e58bd85a44deb18"/><dir name="Quote"><file name="Observer.php" hash="73b67523786745f4ff1712375d757163"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="96199a296f15518a89fde9384cf5fb0d"/></dir><dir name="Source"><file name="Description.php" hash="67364bc17dc197e4dd2a6e0382c75722"/><file name="Limit.php" hash="789f0e42eaafa65b4970ad107206102c"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="29ce141400ea98642a0c200a721810a8"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderController.php" hash="af69420af4419a542ac3958ebe7a6956"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="0c4a0a1117117613d148157557f2abb3"/><file name="config.xml" hash="28b1b0d6b556a8c25c1e16b604c1614b"/><file name="system.xml" hash="4103906da8806c3d5bd68493ce984613"/></dir><dir name="sql"><dir name="bronto_order_setup"><file name="mysql4-install-1.0.0.php" hash="81b57488dbc44047db4099c41fdac54e"/><file name="mysql4-upgrade-1.1.5-1.1.6.php" hash="de0e97123c3183c6363c33b1344b76dd"/><file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="fe4f45d4fe4e8d90267d9bb6a6b13b03"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="2968eb24ab188a2017e230a2f3770db3"/></dir></dir></dir><dir name="PermissionChecker"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="5c0990417244c38485b5c9eda45fa80a"/><file name="Permissionchecker.php" hash="9cabf571a4dab49fa26d8ff1b35b0646"/></dir></dir></dir><file name="Printer.php" hash="7f9d480227c8211aa9e2db66ecd34f3f"/></dir><dir name="Helper"><file name="Data.php" hash="4fab093494eb9a793583e2294d2a2489"/></dir><dir name="Model"><dir name="Validator"><file name="Checker.php" hash="2a8259840b7f0e75b52bdcc93adb8922"/><file name="Directory.php" hash="89a0981e5ed7b70446054d9e8f31300e"/><file name="File.php" hash="539342c217889f7fd0f19f3b731bea23"/><dir name="Filter"><file name="PatternIterator.php" hash="9bdc50cda8d18e3335d8fc07fa72f733"/></dir><file name="Group.php" hash="8dc26a97c43fa2bbe58264b3117324a9"/><file name="Owner.php" hash="fc20d838f28c3406d74475fd4dbf33f0"/><file name="Printer.php" hash="e49b843f43f835d35ba838a2b8c7d00d"/><file name="ValidatorAbstract.php" hash="bccd4db6601922c5a632680c226e03c6"/><file name="ValidatorInterface.php" hash="877e881c030573fdbcd344174eceec8a"/></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="672ed6161380fbf88a516377e62031be"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="058c7be44feea32fc5bc646a5632b4f3"/><file name="config.xml" hash="c4df9b0d873371a626029bd25cfe1c41"/><file name="system.xml" hash="f95239748b5ef006a38b1255356c6c65"/></dir></dir><dir name="Reminder"><dir name="Block"><dir name="Adminhtml"><dir name="Promo"><file name="Notice.php" hash="d5991ebe75066fa76f23eb9464619f08"/></dir><dir name="Reminder"><dir name="Edit"><file name="Form.php" hash="779f8effae92303da303c889db9cef65"/><dir name="Tab"><file name="Bronto.php" hash="a4f19c14cddab68e1180723984f10ccb"/><file name="Conditions.php" hash="f3ad1c6438079bf43183825b52fde3f3"/><file name="Customers.php" hash="c268b9bfe4bcc17b8eb0535660c4bdb2"/><file name="General.php" hash="fa39cbe158b0e7cb7f25f956ef4c8722"/></dir><file name="Tabs.php" hash="accefd148ad3cf28d36e890c138078f2"/></dir><file name="Edit.php" hash="9cec19a303634db7cfd5477da0a9ea48"/><file name="Grid.php" hash="440c1906893c1415db30b32378ee4549"/></dir><file name="Reminder.php" hash="82d616907ffc84eed0aa688f218ed7f1"/><dir name="System"><dir name="Config"><file name="About.php" hash="ce52e60802d1b9d251cef6a7c34564ce"/><file name="Cron.php" hash="ba8f69a491407b48ec72eb7351249c98"/><file name="Settings.php" hash="93194d4c4ec0f2fbb31c281cda6a4242"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Email.php" hash="19ba2ef411e12be43a494cb0ca18549d"/><file name="Id.php" hash="1386e8186b0f78c6d7ca2023f5d0a625"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="a46c741761b5440eda28c9a8ac2df080"/><file name="Data.php" hash="346eb405e558f5c839864830b655a7a6"/><file name="Message.php" hash="a02936281f98cd990ecd17c32bfada46"/></dir><dir name="Model"><dir name="Condition"><file name="Abstract.php" hash="794cd660444a6e5bc62204e8b8c9a6eb"/><dir name="Combine"><file name="Abstract.php" hash="06a1ba8d580b9776367f6baee23e4735"/></dir></dir><dir name="Email"><file name="Message.php" hash="fe2f318ef70bd0d7be3de34b77b5ef2d"/></dir><dir name="Mysql4"><dir name="Customer"><file name="Collection.php" hash="f129346a23041cf539c0be24c1939b14"/></dir><dir name="Rule"><file name="Collection.php" hash="2969bb11fa9e83523da7b41d834381b4"/></dir><file name="Rule.php" hash="96d735544fd009433a15c998efc31b9c"/></dir><file name="Observer.php" hash="785d0bd3b5fb0f6bb672687ea4b2c79f"/><dir name="Rule"><dir name="Condition"><dir name="Cart"><file name="Amount.php" hash="0a47ca2ab522360229a27a82a08e4ebe"/><file name="Attributes.php" hash="013880cb821a38f9ee17594d0bc489de"/><file name="Combine.php" hash="add54bf57284e6c48008db605e0df3d4"/><file name="Couponcode.php" hash="d34edf42b65b21a6eb693e081d3e1401"/><file name="Itemsquantity.php" hash="2250219894b5a26ee514cbaa85c4934b"/><file name="Sku.php" hash="5abe54695f0e3a5eeb52a2c848bd9e81"/><file name="Storeview.php" hash="c82b01ab4088ba3a228af818ddf85244"/><file name="Subcombine.php" hash="b10d46333d76a881654cc6d2a67e6880"/><file name="Subselection.php" hash="4f300fbc807802056b697cdb298e6051"/><file name="Totalquantity.php" hash="ef7c0057212fbdc4d149294497aac454"/><file name="Virtual.php" hash="1f4d785f18b21269838d07046dc754c0"/></dir><file name="Cart.php" hash="e81ff749394cabba6ba8bccc3fbd1604"/><dir name="Combine"><file name="Root.php" hash="32011789213af7d776d3d8ad2fea2fa3"/></dir><file name="Combine.php" hash="74f9ec5b8560dabad1e303af18f4cff9"/><dir name="Wishlist"><file name="Attributes.php" hash="bb8205a2b00b58f2a092887db5ef8b63"/><file name="Combine.php" hash="b17a452ea9c090bea3cd1b2529171394"/><file name="Quantity.php" hash="4aef19ed0f43745e367243b7a6345749"/><file name="Sharing.php" hash="5ef1b49da3b5deb3500e74376127ba37"/><file name="Storeview.php" hash="f79daf882d9db85dc33b67ac0d754346"/><file name="Subcombine.php" hash="a063b405ed07c454b5dd0b1d71af430f"/><file name="Subselection.php" hash="d61958a79c6a381e8d636189ccea3251"/></dir><file name="Wishlist.php" hash="e5e8b80b87aeb75fe50a30fbe92c834b"/></dir></dir><file name="Rule.php" hash="9cec77c4e1aa125d7f049b9818eb8b78"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="3c9c134aee05b3b32fc64a549a3e7cb3"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="9610717f006248a90f113c699df523a6"/></dir><dir name="Helper"><file name="Contact.php" hash="e348af94ff0f5444e766fc17f3e6c774"/><file name="Data.php" hash="1b8a488f5aa2892bc39a2a3ad6ffd1d8"/><file name="Message.php" hash="4f4cc99f871c3da8ad0c1a35b7ec04df"/></dir><dir name="Model"><file name="Observer.php" hash="6740f1fa9261885c3ace0769c9dbff67"/><file name="Rule.php" hash="eb0d4025dda8b95e65fbd79df7e3d8da"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RemindersController.php" hash="f8730cf46da687f80dd64fe3b22852f0"/></dir><file name="LoadController.php" hash="24cea762b00c5992085cf21e395b533d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="772c6847e1961a7a56fdbcfbce6aaf91"/><file name="config.xml" hash="4686cba43225bbcf5f25552a5b082107"/><file name="system.xml" hash="a7a8f8e3dd6559a6e4833d21be5e58be"/></dir><dir name="sql"><dir name="bronto_reminder_setup"><file name="mysql4-install-1.4.2.php" hash="1372af1369e9608159f5b59af75f367e"/><file name="mysql4-upgrade-1.4.0-1.4.2.php" hash="fefa638ca0ed7c5bc80a1b67e27c8703"/><file name="mysql4-upgrade-1.4.10-1.4.11.php" hash="130a688eb03e4f476308d0d11c32141a"/><file name="mysql4-upgrade-1.4.11-1.4.12.php" hash="766c901369f06aaadc8ffde3befb4aaa"/><file name="mysql4-upgrade-1.4.2-1.4.9.php" hash="4692060e7c938aea129c53619f0b3c19"/><file name="mysql4-upgrade-1.4.9-1.4.10.php" hash="9698883135211d54a3c711fead02c187"/></dir><dir name="reference"><file name="saveMatchedCustomers.sql" hash="c4f32ee8be31f7a652369c148271a6c7"/></dir></dir></dir><dir name="Roundtrip"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="6adab60e3a5a4668fdf5da8d8d33a024"/><file name="Status.php" hash="c623240112f1f15200f918394f736720"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Run.php" hash="f83df57a3248439261ccf9837a5d2ff9"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="aff6979277701f2f027bc7ad565c518c"/></dir><dir name="Model"><dir name="Contact"><file name="Builder.php" hash="e81e78a7e07a81f5a0ec53990d629a31"/></dir><dir name="Roundtrip"><dir name="Test"><file name="Order.php" hash="04ebcb9f0010cab7952b08014010f721"/></dir></dir><file name="Roundtrip.php" hash="1e07a998085bb9eb367d040c4b171220"/></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="dbe4fb05bff7630d6130f8d458ed1f57"/></dir><dir name="Model"><dir name="Roundtrip"><file name="Contact.php" hash="787fe5d49eba3819e9af030bb80beeaa"/><dir name="Test"><file name="Order.php" hash="5bf175ebba99f97a93fb6755977dbfa0"/></dir></dir><file name="Roundtrip.php" hash="c515d5cf63bdfbdab39e3f23901b4e47"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RoundtripController.php" hash="15d8ce6375063346d47ad832c80fd499"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="56be6bdda5b7652427bbab1e447a0d2e"/><file name="config.xml" hash="b34c9716b4c6fee7a1d8837b8debff65"/><file name="system.xml" hash="901a0736fb1109f9092fc98daa46dde7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bronto_All.xml" hash="5a9c06b6313882589765b9bcf0402bbb"/><file name="Bronto_ConflictChecker.xml" hash="1a7dc00b830ca2cc696e67d94b85be5d"/><file name="Bronto_Customer.xml" hash="a11c20f008ee2eae14baa3b549d5adee"/><file name="Bronto_Email.xml" hash="b7cdca4b15753edcefe8b9e0abb780bd"/><file name="Bronto_Newsletter.xml" hash="2115c5225e02ab5d4e56749cc5eff6ad"/><file name="Bronto_Order.xml" hash="63f1537add6088417945657bec98ffe9"/><file name="Bronto_PermissionChecker.xml" hash="55ff239c291529be2dc05799102d24a1"/><file name="Bronto_Reminder.xml" hash="08503ab78994178b822ef9b0add243f9"/><file name="Bronto_Roundtrip.xml" hash="bd2b89f3254e995904da92f025b6321c"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="bronto"><file name="cron.css" hash="c7260d3aa14b5945ee76c72dbd914efa"/><dir name="images"><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="bg_notifications.gif" hash="df73b8aa7e48bb56e0a644245aa3683f"/><file name="logo.jpg" hash="3c6059218195679d99dbb874bdabbd07"/><file name="message_approved.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="message_not_approved.gif" hash="e4f28607f075a105e53fa3113d84bd26"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="bronto"><dir name="newsletter"><file name="js.phtml" hash="a01ed75d8aff216f753ac2b13b51a404"/></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="newsletter.xml" hash="b7d4c9b1fb4fabb4255c6df64e98d332"/><file name="order.xml" hash="db82ab15113687f36125ae95dc513ad5"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="bronto"><dir name="common"><file name="about.phtml" hash="f115cbc70309f4e3b14d33cf29bdb274"/><file name="cron.phtml" hash="f1dbdea68c377d7057230697450e16b1"/></dir><dir name="conflictchecker"><file name="errors.phtml" hash="26c9fa4332b8518141de9dab0db0c823"/></dir><dir name="email"><dir name="template"><file name="edit.phtml" hash="35c4f68337a6be7186be1aac0fbe404e"/><file name="list.phtml" hash="cf2503d79273b5a611cde3acde2bb79d"/></dir></dir><dir name="permissionchecker"><file name="errors.phtml" hash="0306e132afed0c88058be67d37dd211c"/></dir><dir name="roundtrip"><file name="status.phtml" hash="8dcb1b72071c00888c8f6ad7b6d18d9b"/></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="email.xml" hash="be77c906770a0d818898a910b03cbe4f"/><file name="reminder.xml" hash="98d835f287cb3aa2ff801f0219f88ccc"/><file name="roundtrip.xml" hash="3da91d3bcb40e1805a80fb2a18ed9cee"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="bronto"><file name="abandoned_cart.html" hash="20b0f55098c0f07bf96da3c5309d9192"/></dir></dir></dir></dir></target></contents>
61
  <compatible/>
62
  <dependencies><required><php><min>5.2.13</min><max>5.5.0</max></php><extension><name>soap</name><min></min><max></max></extension><extension><name>openssl</name><min></min><max></max></extension></required></dependencies>
63
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bronto_Extension</name>
4
+ <version>2.0.4.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
27
  &#xD;
28
  &lt;p&gt;&lt;strong&gt;Newsletter Opt-In&lt;/strong&gt;&lt;br /&gt;Automatically add contacts who opt-in for marketing emails on your Magento site to Bronto and keep their subscription status up-to-date.&lt;/p&gt;&#xD;
29
  &#xD;
30
+ &lt;p&gt;Installation and configuration documentation for the extension may be found &lt;a href="http://bronto.com/sites/default/files/Bronto-Extension-for-Magento-Implementation-Guide-v2.0.0.1.pdf"&gt;here&lt;/a&gt;.&lt;/p&gt;&#xD;
31
  &#xD;
32
  &lt;h3&gt;Contact Us to Learn More&lt;/h3&gt;&#xD;
33
  &#xD;
53
  &#xD;
54
  &lt;h3&gt;About Bronto&lt;/h3&gt;&#xD;
55
  &lt;p /&gt;Bronto Software provides a cloud-based marketing platform for retailers to drive revenue through their email, mobile and social campaigns. The platform is used by over 1000 organizations worldwide, including Party City, Armani Exchange, Timex, Samsonite and Gander Mountain. Bronto is a Gold Magento Industry Partner and the leading self-service email marketing provider to the Internet Retailer Top 1000. Bronto is headquartered in Durham, NC with an office in London, UK. For more information, visit &lt;a href="http://bronto.com"&gt;bronto.com&lt;/a&gt;.&lt;/p&gt;</description>
56
+ <notes>&lt;p /&gt;This is the first release of a new Bronto extension that replaces and deprecates the "Bronto Order Import for Magento," "Bronto Shopping Cart Abandonment," and "Bronto Newsletter Opt-In" extensions. All of the functionality of those extensions is included in this Bronto Extension for Magento.&#xD;
57
+ &#xD;
58
+ &lt;p /&gt;For installation and configuration instructions, as well as a full list of new features and known issues, please review the &lt;a href="http://bronto.com/sites/default/files/Bronto-Extension-for-Magento-Implementation-Guide-v2.0.0.1.pdf"&gt;Implementation Guide&lt;/a&gt;.</notes>
59
+ <authors><author><name>Dave Johnson</name><user>BrontoSoftware</user><email>dave.johnson@bronto.com</email></author></authors>
60
  <date>2013-07-22</date>
61
+ <time>20:52:02</time>
62
+ <contents><target name="magecommunity"><dir name="Bronto"><dir name="Common"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="1c7d38084216631295a28291ab19681e"/><file name="Cron.php" hash="1a718ab7d39492ff064618f7507d35ef"/><dir name="Form"><dir name="Field"><file name="Apitoken.php" hash="d8ed503f8d22d96b0ee79f18426bb8a1"/><file name="Hidden.php" hash="18a13153df6dd084840086105f8117cc"/><file name="List.php" hash="48f36e9d06e6bc759e36ebb1128aa513"/></dir><file name="Field.php" hash="bfc0b65b927934ba54bb5225c0fb9247"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="aa0f86b84c97399bdf259935de33dca0"/><file name="Data.php" hash="d71b8a47d17b6096613b9c004eb76bd9"/><file name="DataInterface.php" hash="a6700f3a4a79f6d6468df24f714427a9"/><file name="Field.php" hash="683839cfcd4fd5cd81b0393fc67b019c"/><file name="Message.php" hash="22d6224ab354a6ed7dc13d1e6e0a2fc5"/><file name="Product.php" hash="64202787e5f0c63a38efff387ab3c325"/></dir><dir name="Model"><file name="Api.php" hash="3716948a5e50e621625714a1e3a93263"/><dir name="Email"><dir name="Message"><file name="Filter.php" hash="5758c71217e4e545af31fec29d263576"/><file name="Templatefilter.php" hash="16f44ac2a7d97b27f33a06e59de8ea30"/></dir><file name="Message.php" hash="17086fba16eed6986c0ab1fafbeffbd6"/></dir><file name="Keysentry.php" hash="fd39d0a0208668723d0c0adb0b31bd67"/><file name="Observer.php" hash="73b02a94aba279c05dd7753ac10fdb75"/><dir name="Resource"><file name="Setup.php" hash="780f5c070cbd9da2f003372ee90a0891"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="b05e28fb0cc0db0377eee68ffc712c10"/><file name="Token.php" hash="18368da2a435855841c8b5e2b10637b1"/></dir><dir name="Source"><dir name="Contact"><file name="Status.php" hash="1bf6c053f8132a36dd6882e0f1faf45f"/></dir><dir name="Cron"><file name="Frequency.php" hash="c6689871a7a8add3dc4b84e4a2ff6f10"/><file name="Minutes.php" hash="be3e3066819785b55a25f22c5bc9392a"/></dir><file name="Field.php" hash="d8a4089180cac8527bb98d831629d25c"/><file name="List.php" hash="69497100fe9f036c442b9d94133c8f4a"/><file name="Message.php" hash="4fb4e4f9deaabe4971bfcdf3e12b0da4"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="02b55ba2804a024740506c4df0ebdd42"/></dir><dir name="Model"><file name="Checkout.php" hash="9716ab2c76558e463f1a105308973b74"/><dir name="Keysentry"><dir name="fixtures"><file name="seed.yaml" hash="3a9b13b2ef5a72bea298be72edba821d"/></dir></dir><file name="Keysentry.php" hash="fe06eff7212d57057ed1ee490238694f"/></dir></dir><dir name="controllers"><file name="LogController.php" hash="d97e8dc3624053d563389b8b19c71c06"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f5792bf262cf83cc193d23c09a17a03f"/><file name="config.xml" hash="c74de2da71815ea7bd328eda51b7747c"/><file name="system.xml" hash="5952ce44c1df3b13c5cb5a709718df2c"/></dir><dir name="sql"><dir name="bronto_common_setup"><file name="mysql4-install-1.7.0.php" hash="c8459d26fdfea2fb9430e8829b3257e1"/></dir></dir></dir><dir name="ConflictChecker"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="9049055c03e261b2452c926d801196a6"/><file name="Conflictchecker.php" hash="c00f929ef55e95597761871674077b10"/></dir></dir></dir><file name="Printer.php" hash="cd8ef4c01028da3d690ce6f5c53d1f61"/></dir><dir name="Helper"><file name="Data.php" hash="0f5c562370c77b6cfe9579dc7fe396d0"/></dir><dir name="Model"><dir name="Config"><file name="Blocks.php" hash="78eb63947ae94be2b1dc9ee42de52152"/><file name="Checker.php" hash="a1a38b9c4a518e0be2e4ea84adab0107"/><file name="ConfigAbstract.php" hash="8bc2be8485543a17338cb953d760c71c"/><file name="ConfigInterface.php" hash="86a788c1b1971828c8f947b42f03baea"/><file name="Datastore.php" hash="d2b37735fe127d831e6055e05b232fb8"/><file name="Helpers.php" hash="3de600b842bf90c53417843e9b4c1946"/><file name="Models.php" hash="0358f506ff4e5820b61b076701f0746d"/><file name="Printer.php" hash="6d2aec31a623b943d3d982c97999be13"/><file name="Resources.php" hash="9f12487e864cd4005c53b72fe02e4cf4"/></dir><dir name="Core"><dir name="Config"><file name="Base.php" hash="b1ecb5cd90e050d1c825beb65e6d888e"/><file name="Element.php" hash="2efb1a1c022cb393ab5718c1f7eafd1f"/></dir><file name="Config.php" hash="29408203a0aa8b7afa84ba16b1416f91"/></dir><dir name="Lib"><dir name="Varien"><dir name="Simplexml"><file name="Config.php" hash="3acbdd7d7c9fa6c346688e5083569596"/><file name="Element.php" hash="f5961e7a41035851cabf7fcd8022a13a"/></dir></dir></dir><dir name="Mysql4"><dir name="Core"><file name="Config.php" hash="36685bb89b45c71cfc447727ce66ea9a"/></dir></dir><dir name="Path"><dir name="Locator"><file name="Array.php" hash="f82c5966dab92ed91a9441a0231e7ace"/><file name="Factory.php" hash="bea2e4a6bea17815a9040341209f4256"/><file name="IteratorAbstract.php" hash="9adccb7c853d80e8d64a0eb8346f3cbc"/><file name="LocatorInterface.php" hash="b3cf0d528296ee0e87e7898da44baa47"/><file name="Stack.php" hash="4524078604b43dffcf57c7a23959ef03"/></dir></dir><dir name="Resource"><dir name="Core"><file name="Config.php" hash="6b69bd1c0ce0e4c92c1c96436f79e83d"/></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="23de17a20f7a5588bb9761a2d3eb79ae"/></dir><dir name="Model"><dir name="Path"><dir name="Locator"><file name="Array.php" hash="e219f193e027d5c9a5d9cb9d7a27a6ac"/><file name="Factory.php" hash="36ffe1ec656f3f3ba1f99dd743e52c0b"/><file name="Stack.php" hash="29cbf00cd66bc61ee16c740847d9f400"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9d5cab56f52b0d12688c5787e3bfa03f"/><file name="config.xml" hash="0497e6c9bf942db62d01e0595437166b"/><file name="system.xml" hash="6d6b10860c55f815efe815d7ee0c2290"/></dir></dir><dir name="Customer"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="5874d9bf1ff106212a348815104c5244"/><file name="Cron.php" hash="41e36d043441e1e9424186c90bb4807d"/><dir name="Form"><dir name="Fieldset"><dir name="Attributes"><file name="Address.php" hash="383082bb7b45f9b250acea756b2e5758"/><file name="Customer.php" hash="cbbb4c20f3424e4f988c94335ff004c2"/></dir><file name="Attributes.php" hash="148ebebdc9b7a49319b232bfe8e64e8a"/></dir></dir></dir></dir><dir name="Widget"><dir name="Button"><file name="Reset.php" hash="74d38897533f7b4e67d476dd791a38ee"/><file name="Run.php" hash="e707627c781ea4323d1924fa33094320"/><file name="Sync.php" hash="3475e65cab50bd4b047a58f8b50bc958"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="40ab8eee7df85cfc39e2e35d07843a18"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="c74a251bc694defe14e9033da9bdc77a"/></dir><file name="Queue.php" hash="97d19f161a404e1a92e1d4f17301b162"/><file name="Setup.php" hash="615e25c2d8493dcd4301650421c87f08"/></dir><file name="Observer.php" hash="cb0872283c06f5027dcb1668706111f1"/><file name="Queue.php" hash="0b6b4e2bde336b5052007b3836c0c109"/><dir name="Resource"><file name="Customer.php" hash="9aa5ef7b70c3714cd049c9f2957ceb7c"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Brontofield.php" hash="6de9a1df609e8a7b396f4f80a7e6c764"/><file name="Cron.php" hash="dbcd55d41447d46fded27dfa2e6febb0"/><file name="Newfield.php" hash="d9a66dbc0b932fb80c7c947c3ce29bba"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="20025141111083480c8109d9619598bf"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="170274d2c7b46834e7c819983fa01156"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6cc229b440b34da710887aaf96bbcf81"/><file name="config.xml" hash="ff10a2ee4365580e3c9c509a768c23c1"/><file name="system.xml" hash="0e13fc7e0917b98b5d28aa658cd53027"/></dir><dir name="sql"><dir name="bronto_customer_setup"><file name="mysql4-install-1.0.0.php" hash="871c225318588b2804a05751bce45e1f"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="e7986d0b22a92f5df7a3480f80d7b937"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="b95305221a61733ff7617ce9307101c2"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="590cf0b5109bbbb0e745bec806463adc"/></dir></dir></dir><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="10cb51420b205c100ef46cf59edef05b"/></dir><dir name="Email"><dir name="Log"><dir name="Grid"><dir name="Renderer"><file name="Customer.php" hash="c2530287b293e05508816049586ef5c2"/><file name="Fields.php" hash="6c5d921b6c636329f035381af4c7f028"/></dir></dir><file name="Grid.php" hash="b54cada4029aa45290679e6cf69f8c47"/></dir><file name="Log.php" hash="3fa0b873d262b3d5c6161c1aef33e6ae"/><dir name="Template"><dir name="Edit"><file name="Form.php" hash="804a3fc8d0e773639f8eb2fe3df1ab1f"/></dir><file name="Edit.php" hash="bcc5b9ba9bee92a3e8f33684dd02506f"/><dir name="Grid"><dir name="Renderer"><file name="Message.php" hash="bf56f19c9f4310609fbb9a788768e222"/></dir></dir><file name="Grid.php" hash="8f1381ece5de903d48cbc7ae496028c7"/></dir><file name="Template.php" hash="b33503babba2480ca840569629dfbb07"/></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="712033409f93712e4a22cf89252d44e4"/><file name="Data.php" hash="e582e103dfe73cb4ab9e6eb675f81309"/><file name="Field.php" hash="e4714e9cc95bdfe4da9a16feb604f44c"/><file name="Message.php" hash="f328dcee7934ddc48d6f4d40afff74cc"/></dir><dir name="Model"><dir name="Email"><file name="Message.php" hash="5d2c4b3ac3120352f8424863ad176dc6"/></dir><file name="Log.php" hash="2740d9cd5073106f58880e57e84ce8ee"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="6de4819537636d3ea7816cb7c6fc250c"/></dir><file name="Log.php" hash="15ffb2c83281c77b5d427ff29abac776"/></dir><file name="Observer.php" hash="0b67950706c21220a4712bc0c279ba00"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Email"><file name="Template.php" hash="ba80e6553c61e731b85c027cd688ca8f"/></dir></dir></dir></dir><dir name="Template"><file name="Import.php" hash="f69b3458521bdb2c3bb33aa3d1c28620"/></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="8a74889c3f24c3053baefca6e7d7eddb"/></dir><dir name="Model"><dir name="Email"><file name="Message.php" hash="11a9aded1841673bdafd4675de78a19e"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="System"><dir name="Email"><file name="LogController.php" hash="386560ba30da12796614db1d0381bb7c"/><file name="TemplateController.php" hash="578112502761e70000ff10ca67502034"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35a2ffa5e273f87b6d2de172cea4a219"/><file name="config.xml" hash="37e21ee9d0458bd28379446f063457a5"/><file name="system.xml" hash="ea9e30ce8eb25b0b7e840a7933640a27"/></dir><dir name="sql"><dir name="bronto_email_setup"><file name="mysql4-install-1.0.0.php" hash="516265312ede986c1a35a19b9e5bbfea"/><file name="mysql4-install-1.0.2.php" hash="327ac219e947d608fbf9d3209dd03bab"/><file name="mysql4-install-1.0.5.php" hash="327ac219e947d608fbf9d3209dd03bab"/><file name="mysql4-install-1.0.8.php" hash="b572625c1380dfffe3b089275ac1dc7e"/><file name="mysql4-install-1.1.2.php" hash="bf80f7b12eccdad2e0e36a564e18530c"/><file name="mysql4-upgrade-1.0.0-1.0.2.php" hash="1f797c3f909d72219ef5d00017b10554"/><file name="mysql4-upgrade-1.0.2-1.0.5.php" hash="f2c83b65500d9df0fd10c2e6721f2bfe"/><file name="mysql4-upgrade-1.0.5-1.0.8.php" hash="cdbda7aa084e51b9b222c56e548462a6"/><file name="mysql4-upgrade-1.0.8-1.1.1.php" hash="f2c83b65500d9df0fd10c2e6721f2bfe"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="0538afef03b1e21d509593e2ad275c34"/></dir></dir></dir><dir name="Newsletter"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="bc44a52305e7cbe3a41c5f19e6257ede"/><file name="Cron.php" hash="2253dab9a7475df825d4bcb7849cc3e9"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Reset.php" hash="98efb50dd447e6a60db7c25846ae0432"/><file name="Run.php" hash="49efe1ee4550454366fe5631fa2c6e88"/></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Newsletter.php" hash="ed221e46e61f3312a038c022dacf5fd7"/></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="4c1dcd95ea237397ac2ee82090ce32e4"/><file name="Data.php" hash="62e5be8e1326862fee10774654daad15"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="41a203d85e16a660bf20bec8ecf157fd"/></dir><file name="Queue.php" hash="9a890d3fe569edd426ce38afe564dc7a"/></dir><file name="Observer.php" hash="7bdd91c7ee15183de3aeca1bcabc473e"/><file name="Queue.php" hash="89e6276cab088714b555c052172c4989"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="a270f0a31c390383cdabc0021baf3d3c"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="d88d07780bb3ded63c2c35439840dad5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="NewsletterController.php" hash="fb1b701c2335e82e258ed16d2a5c8975"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="253518e92554bf89fabe7b832a7a562c"/><file name="config.xml" hash="1d0adbc56975d579620dabd02394ff38"/><file name="system.xml" hash="1314e4b54d7c89a75f8ca9b7d02623b8"/></dir><dir name="sql"><dir name="bronto_newsletter_setup"><file name="mysql4-install-1.0.0.php" hash="0f21d5315bbc4c27d0d38f9cf8c99bf3"/><file name="mysql4-install-1.4.0.php" hash="9bd28347f3330b857102900adf702bed"/><file name="mysql4-upgrade-1.4.0-1.4.1.php" hash="7eeba27e7b5480c8b502c3805554e2de"/><file name="mysql4-upgrade-1.4.1-1.4.2.php" hash="32f724b99d88e037ade72c8a9f1e0da7"/><file name="mysql4-upgrade-1.4.2-1.4.3.php" hash="63c728bb0cd7fa83bb5536d4500548f4"/><file name="mysql4-upgrade-1.4.3-1.4.4.php" hash="4f08a427c7706ea0988bcdcca6072218"/></dir></dir></dir><dir name="Order"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Info.php" hash="ca80d06fb86b6bf676fc21188d5f2685"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="About.php" hash="126e3166dace48941fccbe2bb4c80264"/><file name="Cron.php" hash="c6a24643d4c35d557f87e1c51e860ef2"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Reset.php" hash="9bfbc1f1ffb38389a3a47ca009a24a35"/><file name="Run.php" hash="5b833a216bea22b962f633e33f6a86b8"/><file name="Sync.php" hash="ca0171d605d29a49445eaac37f95d1c1"/></dir></dir></dir><file name="Bta.php" hash="8c6a92894134f428e111d0cd0e99c137"/></dir><dir name="Helper"><file name="Data.php" hash="d4c020c5ad5bfee3245562c1c93fa349"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="f9fc983e670311531b8a260b78b46bc0"/></dir><file name="Queue.php" hash="c25aee2c31258eedfd5734bf1f143979"/><file name="Setup.php" hash="b3ccddc52af0695c48cff499ed112901"/></dir><file name="Observer.php" hash="9e59c3940eccca73c8b4a6a1e774970f"/><dir name="Order"><file name="Observer.php" hash="00fe5ac4fbee213403b60a33be463478"/></dir><file name="Queue.php" hash="aa7971d7f901f1e48e58bd85a44deb18"/><dir name="Quote"><file name="Observer.php" hash="73b67523786745f4ff1712375d757163"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="96199a296f15518a89fde9384cf5fb0d"/></dir><dir name="Source"><file name="Description.php" hash="67364bc17dc197e4dd2a6e0382c75722"/><file name="Limit.php" hash="789f0e42eaafa65b4970ad107206102c"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="29ce141400ea98642a0c200a721810a8"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderController.php" hash="af69420af4419a542ac3958ebe7a6956"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="0c4a0a1117117613d148157557f2abb3"/><file name="config.xml" hash="28b1b0d6b556a8c25c1e16b604c1614b"/><file name="system.xml" hash="4103906da8806c3d5bd68493ce984613"/></dir><dir name="sql"><dir name="bronto_order_setup"><file name="mysql4-install-1.0.0.php" hash="81b57488dbc44047db4099c41fdac54e"/><file name="mysql4-upgrade-1.1.5-1.1.6.php" hash="de0e97123c3183c6363c33b1344b76dd"/><file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="fe4f45d4fe4e8d90267d9bb6a6b13b03"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="2968eb24ab188a2017e230a2f3770db3"/></dir></dir></dir><dir name="PermissionChecker"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="5c0990417244c38485b5c9eda45fa80a"/><file name="Permissionchecker.php" hash="9cabf571a4dab49fa26d8ff1b35b0646"/></dir></dir></dir><file name="Printer.php" hash="7f9d480227c8211aa9e2db66ecd34f3f"/></dir><dir name="Helper"><file name="Data.php" hash="4fab093494eb9a793583e2294d2a2489"/></dir><dir name="Model"><dir name="Validator"><file name="Checker.php" hash="2a8259840b7f0e75b52bdcc93adb8922"/><file name="Directory.php" hash="89a0981e5ed7b70446054d9e8f31300e"/><file name="File.php" hash="539342c217889f7fd0f19f3b731bea23"/><dir name="Filter"><file name="PatternIterator.php" hash="9bdc50cda8d18e3335d8fc07fa72f733"/></dir><file name="Group.php" hash="8dc26a97c43fa2bbe58264b3117324a9"/><file name="Owner.php" hash="fc20d838f28c3406d74475fd4dbf33f0"/><file name="Printer.php" hash="e49b843f43f835d35ba838a2b8c7d00d"/><file name="ValidatorAbstract.php" hash="bccd4db6601922c5a632680c226e03c6"/><file name="ValidatorInterface.php" hash="877e881c030573fdbcd344174eceec8a"/></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="672ed6161380fbf88a516377e62031be"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="058c7be44feea32fc5bc646a5632b4f3"/><file name="config.xml" hash="c4df9b0d873371a626029bd25cfe1c41"/><file name="system.xml" hash="f95239748b5ef006a38b1255356c6c65"/></dir></dir><dir name="Reminder"><dir name="Block"><dir name="Adminhtml"><dir name="Promo"><file name="Notice.php" hash="d5991ebe75066fa76f23eb9464619f08"/></dir><dir name="Reminder"><dir name="Edit"><file name="Form.php" hash="779f8effae92303da303c889db9cef65"/><dir name="Tab"><file name="Bronto.php" hash="a4f19c14cddab68e1180723984f10ccb"/><file name="Conditions.php" hash="f3ad1c6438079bf43183825b52fde3f3"/><file name="Customers.php" hash="c268b9bfe4bcc17b8eb0535660c4bdb2"/><file name="General.php" hash="fa39cbe158b0e7cb7f25f956ef4c8722"/></dir><file name="Tabs.php" hash="accefd148ad3cf28d36e890c138078f2"/></dir><file name="Edit.php" hash="9cec19a303634db7cfd5477da0a9ea48"/><file name="Grid.php" hash="440c1906893c1415db30b32378ee4549"/></dir><file name="Reminder.php" hash="82d616907ffc84eed0aa688f218ed7f1"/><dir name="System"><dir name="Config"><file name="About.php" hash="ce52e60802d1b9d251cef6a7c34564ce"/><file name="Cron.php" hash="ba8f69a491407b48ec72eb7351249c98"/><file name="Settings.php" hash="93194d4c4ec0f2fbb31c281cda6a4242"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Email.php" hash="19ba2ef411e12be43a494cb0ca18549d"/><file name="Id.php" hash="1386e8186b0f78c6d7ca2023f5d0a625"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="a46c741761b5440eda28c9a8ac2df080"/><file name="Data.php" hash="346eb405e558f5c839864830b655a7a6"/><file name="Message.php" hash="a02936281f98cd990ecd17c32bfada46"/></dir><dir name="Model"><dir name="Condition"><file name="Abstract.php" hash="794cd660444a6e5bc62204e8b8c9a6eb"/><dir name="Combine"><file name="Abstract.php" hash="06a1ba8d580b9776367f6baee23e4735"/></dir></dir><dir name="Email"><file name="Message.php" hash="fe2f318ef70bd0d7be3de34b77b5ef2d"/></dir><dir name="Mysql4"><dir name="Customer"><file name="Collection.php" hash="f129346a23041cf539c0be24c1939b14"/></dir><dir name="Rule"><file name="Collection.php" hash="2969bb11fa9e83523da7b41d834381b4"/></dir><file name="Rule.php" hash="96d735544fd009433a15c998efc31b9c"/></dir><file name="Observer.php" hash="785d0bd3b5fb0f6bb672687ea4b2c79f"/><dir name="Rule"><dir name="Condition"><dir name="Cart"><file name="Amount.php" hash="0a47ca2ab522360229a27a82a08e4ebe"/><file name="Attributes.php" hash="013880cb821a38f9ee17594d0bc489de"/><file name="Combine.php" hash="add54bf57284e6c48008db605e0df3d4"/><file name="Couponcode.php" hash="d34edf42b65b21a6eb693e081d3e1401"/><file name="Itemsquantity.php" hash="2250219894b5a26ee514cbaa85c4934b"/><file name="Sku.php" hash="5abe54695f0e3a5eeb52a2c848bd9e81"/><file name="Storeview.php" hash="c82b01ab4088ba3a228af818ddf85244"/><file name="Subcombine.php" hash="b10d46333d76a881654cc6d2a67e6880"/><file name="Subselection.php" hash="4f300fbc807802056b697cdb298e6051"/><file name="Totalquantity.php" hash="ef7c0057212fbdc4d149294497aac454"/><file name="Virtual.php" hash="1f4d785f18b21269838d07046dc754c0"/></dir><file name="Cart.php" hash="e81ff749394cabba6ba8bccc3fbd1604"/><dir name="Combine"><file name="Root.php" hash="32011789213af7d776d3d8ad2fea2fa3"/></dir><file name="Combine.php" hash="74f9ec5b8560dabad1e303af18f4cff9"/><dir name="Wishlist"><file name="Attributes.php" hash="bb8205a2b00b58f2a092887db5ef8b63"/><file name="Combine.php" hash="b17a452ea9c090bea3cd1b2529171394"/><file name="Quantity.php" hash="4aef19ed0f43745e367243b7a6345749"/><file name="Sharing.php" hash="5ef1b49da3b5deb3500e74376127ba37"/><file name="Storeview.php" hash="f79daf882d9db85dc33b67ac0d754346"/><file name="Subcombine.php" hash="a063b405ed07c454b5dd0b1d71af430f"/><file name="Subselection.php" hash="d61958a79c6a381e8d636189ccea3251"/></dir><file name="Wishlist.php" hash="e5e8b80b87aeb75fe50a30fbe92c834b"/></dir></dir><file name="Rule.php" hash="9cec77c4e1aa125d7f049b9818eb8b78"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="3c9c134aee05b3b32fc64a549a3e7cb3"/></dir></dir></dir></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="9610717f006248a90f113c699df523a6"/></dir><dir name="Helper"><file name="Contact.php" hash="e348af94ff0f5444e766fc17f3e6c774"/><file name="Data.php" hash="1b8a488f5aa2892bc39a2a3ad6ffd1d8"/><file name="Message.php" hash="4f4cc99f871c3da8ad0c1a35b7ec04df"/></dir><dir name="Model"><file name="Observer.php" hash="6740f1fa9261885c3ace0769c9dbff67"/><file name="Rule.php" hash="eb0d4025dda8b95e65fbd79df7e3d8da"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RemindersController.php" hash="f8730cf46da687f80dd64fe3b22852f0"/></dir><file name="LoadController.php" hash="24cea762b00c5992085cf21e395b533d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="772c6847e1961a7a56fdbcfbce6aaf91"/><file name="config.xml" hash="4686cba43225bbcf5f25552a5b082107"/><file name="system.xml" hash="a7a8f8e3dd6559a6e4833d21be5e58be"/></dir><dir name="sql"><dir name="bronto_reminder_setup"><file name="mysql4-install-1.4.2.php" hash="1372af1369e9608159f5b59af75f367e"/><file name="mysql4-upgrade-1.4.0-1.4.2.php" hash="fefa638ca0ed7c5bc80a1b67e27c8703"/><file name="mysql4-upgrade-1.4.10-1.4.11.php" hash="130a688eb03e4f476308d0d11c32141a"/><file name="mysql4-upgrade-1.4.11-1.4.12.php" hash="766c901369f06aaadc8ffde3befb4aaa"/><file name="mysql4-upgrade-1.4.2-1.4.9.php" hash="4692060e7c938aea129c53619f0b3c19"/><file name="mysql4-upgrade-1.4.9-1.4.10.php" hash="9698883135211d54a3c711fead02c187"/></dir><dir name="reference"><file name="saveMatchedCustomers.sql" hash="c4f32ee8be31f7a652369c148271a6c7"/></dir></dir></dir><dir name="Roundtrip"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="6adab60e3a5a4668fdf5da8d8d33a024"/><file name="Status.php" hash="c623240112f1f15200f918394f736720"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Run.php" hash="f83df57a3248439261ccf9837a5d2ff9"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="aff6979277701f2f027bc7ad565c518c"/></dir><dir name="Model"><dir name="Contact"><file name="Builder.php" hash="e81e78a7e07a81f5a0ec53990d629a31"/></dir><dir name="Roundtrip"><dir name="Test"><file name="Order.php" hash="04ebcb9f0010cab7952b08014010f721"/></dir></dir><file name="Roundtrip.php" hash="1e07a998085bb9eb367d040c4b171220"/></dir><dir name="Test"><dir name="Config"><file name="Config.php" hash="dbe4fb05bff7630d6130f8d458ed1f57"/></dir><dir name="Model"><dir name="Roundtrip"><file name="Contact.php" hash="787fe5d49eba3819e9af030bb80beeaa"/><dir name="Test"><file name="Order.php" hash="5bf175ebba99f97a93fb6755977dbfa0"/></dir></dir><file name="Roundtrip.php" hash="c515d5cf63bdfbdab39e3f23901b4e47"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RoundtripController.php" hash="15d8ce6375063346d47ad832c80fd499"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="56be6bdda5b7652427bbab1e447a0d2e"/><file name="config.xml" hash="b34c9716b4c6fee7a1d8837b8debff65"/><file name="system.xml" hash="901a0736fb1109f9092fc98daa46dde7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bronto_All.xml" hash="5a9c06b6313882589765b9bcf0402bbb"/><file name="Bronto_ConflictChecker.xml" hash="1a7dc00b830ca2cc696e67d94b85be5d"/><file name="Bronto_Customer.xml" hash="a11c20f008ee2eae14baa3b549d5adee"/><file name="Bronto_Email.xml" hash="b7cdca4b15753edcefe8b9e0abb780bd"/><file name="Bronto_Newsletter.xml" hash="2115c5225e02ab5d4e56749cc5eff6ad"/><file name="Bronto_Order.xml" hash="63f1537add6088417945657bec98ffe9"/><file name="Bronto_PermissionChecker.xml" hash="55ff239c291529be2dc05799102d24a1"/><file name="Bronto_Reminder.xml" hash="08503ab78994178b822ef9b0add243f9"/><file name="Bronto_Roundtrip.xml" hash="bd2b89f3254e995904da92f025b6321c"/></dir></target><target name="magelib"><dir name="Bronto"><dir name="Api"><dir name="Account"><file name="Exception.php" hash="1a851457b2a032fb6d149fe9ef111c57"/><file name="Row.php" hash="3ab1e97019ef87bcd464eeaabf652886"/></dir><file name="Account.php" hash="33b9ba8867fe69135391c26f98b5852a"/><dir name="Activity"><file name="Exception.php" hash="3ac1f2caea6465931cbf927f1033ec06"/><file name="Row.php" hash="de166130c57670bf486a783a4501e2d4"/></dir><file name="Activity.php" hash="f5f48488e40507bc108b35c599e4e5a2"/><dir name="ApiToken"><file name="Exception.php" hash="e06d0a4c9469da7333e6a596e9c37c5d"/><file name="Row.php" hash="f3742811cec1cbf0be583296b617dfbd"/></dir><file name="ApiToken.php" hash="65bbd18974bbbf620dc2df23bdeb4469"/><dir name="Contact"><file name="Exception.php" hash="809bdce6db3bb9c72a3173bb08c1b19e"/><file name="Row.php" hash="2e360d131c2abe19e154b5f3795a58f0"/></dir><file name="Contact.php" hash="55bab8398154e96db6b0ca3ed88718e0"/><dir name="ContentTag"><file name="Exception.php" hash="5a8bc58af480a574e8061c62ad5590b4"/><file name="Row.php" hash="e470d8bcd686d42a886e59d5184b5eed"/></dir><file name="ContentTag.php" hash="14f1cbefe1027338d28db301a1c2df3d"/><dir name="Conversion"><file name="Exception.php" hash="73dd991a663b99050428f54fc13fb433"/><file name="Row.php" hash="115d01ea0e0e6ade42fcab76dff71c35"/></dir><file name="Conversion.php" hash="60ec52dcfeda92294d1ab10bb29a486a"/><dir name="Delivery"><file name="Exception.php" hash="003dbb49ea3be65fe35dfa9b7ec743c5"/><file name="Recipient.php" hash="562bdc8d86b92ec293a338fdd7bf928a"/><file name="Row.php" hash="9c6149e74a305f62b9806df5a20e6a00"/></dir><file name="Delivery.php" hash="668dc6493cefe960c7dc8fe1fe87bf08"/><dir name="DeliveryGroup"><file name="Exception.php" hash="9291b2adb576a6781a0d624cc3288453"/><file name="Row.php" hash="29adb1f866cf1d24ef0abac19f95fbd0"/></dir><file name="DeliveryGroup.php" hash="7dd295b65f22e65dff3bf45c4336e985"/><file name="Exception.php" hash="bacb7c782ef7f612edaf3d39c20118ef"/><dir name="Field"><file name="Exception.php" hash="db651b9fa4b5161e3a32af49cc12cc64"/><file name="Predefined.php" hash="15fadb32175098d9ded60550d1748a4a"/><file name="Row.php" hash="6871d05f399a8a9dfa0742952eaa6481"/><file name="TypeGuesser.php" hash="1027ea97675a16cc964aa0d8ba63e642"/></dir><file name="Field.php" hash="32d5876335ec815acb50d3b4e7bf3ccd"/><dir name="List"><file name="Exception.php" hash="0f964fac998c89a0d4d515979bd81b98"/><file name="Row.php" hash="6516df43a1a94beee7b57fae71c27134"/></dir><file name="List.php" hash="ef240fe5e1422479a83291ad30b468ac"/><dir name="Login"><file name="ContactInformation.php" hash="bc1ce7f57c67fa21cd0881d0384a1cac"/><file name="Exception.php" hash="fff7546235b416b7008a9e4bd646fc19"/><file name="Row.php" hash="578553fcbf1941d0eb5890614c57ae91"/></dir><file name="Login.php" hash="a663864b51795799ff1a61528f380c80"/><dir name="Message"><file name="Exception.php" hash="755f7f14cdb234931708968ac0bad4a4"/><file name="Row.php" hash="5732b5550c8c6444790f2f20e626ff08"/></dir><file name="Message.php" hash="cc3c9939757371ad7fd2d297df394621"/><dir name="MessageRule"><file name="Exception.php" hash="b0398ee96ed70c483f38b50f305e82a8"/><file name="Row.php" hash="8e7532184ee265a927a195ac36e5a518"/></dir><file name="MessageRule.php" hash="ae1b3f16683656066a83bcf9f2863710"/><file name="Object.php" hash="19e3a4bcfd9031fa2c576f9c7f2cd27e"/><dir name="Order"><file name="Exception.php" hash="8312e1a1ab46bcf88b72983bb11a6493"/><file name="Product.php" hash="3785f2f460fec6c18c6164176de52449"/><file name="Row.php" hash="1400de022188806bb94e98544c054ef6"/></dir><file name="Order.php" hash="ad690b37bc577879020d10e5ac70ef3d"/><dir name="Row"><file name="Exception.php" hash="4c1a45512e0912644f94a88d4298d3a9"/></dir><file name="Row.php" hash="259418b11987939378747a9c46fae1ae"/><dir name="Rowset"><file name="Exception.php" hash="b5202ed6f61bfe06b90f73c03ca28ffa"/><file name="Iterator.php" hash="9ea7a244b83e7b9318bfe8ed371a149f"/></dir><file name="Rowset.php" hash="3f40382933e2f392b6320fd79db720cd"/><dir name="Segment"><file name="Exception.php" hash="bd5c2302ef222ff55981cc38477a9310"/><file name="Row.php" hash="b840493b8b2c3cb6686de0e5bedfa2ba"/></dir><file name="Segment.php" hash="0cf99babff6169afa427f302c76023dd"/></dir><file name="Api.php" hash="b3e620a235da149281430a92eb2a1a3c"/><file name="SoapClient.php" hash="c9e56dc7f88d71cfbb98b3476bad5ead"/><dir name="Util"><file name="Colors.php" hash="14313213b3a70c79a56c574523b9b90b"/><file name="CountryCodes.php" hash="4efb9c354d29a901368c46aab40f79d4"/><dir name="Retryer"><file name="FileRetryer.php" hash="bdc72ace54ace32081115442d28cb972"/><file name="RetryerException.php" hash="54b70d7abbc32b55649a193e8e70dcb5"/><file name="RetryerInterface.php" hash="cc57d5a02a55811a13a31ed9beff126f"/></dir><file name="Uuid.php" hash="ba62bdec6488ccb621e0bfd726c6107a"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="bronto"><file name="cron.css" hash="c7260d3aa14b5945ee76c72dbd914efa"/><dir name="images"><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="bg_notifications.gif" hash="df73b8aa7e48bb56e0a644245aa3683f"/><file name="logo.jpg" hash="3c6059218195679d99dbb874bdabbd07"/><file name="message_approved.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="message_not_approved.gif" hash="e4f28607f075a105e53fa3113d84bd26"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="bronto"><dir name="newsletter"><file name="js.phtml" hash="a01ed75d8aff216f753ac2b13b51a404"/></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="newsletter.xml" hash="b7d4c9b1fb4fabb4255c6df64e98d332"/><file name="order.xml" hash="db82ab15113687f36125ae95dc513ad5"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="bronto"><dir name="common"><file name="about.phtml" hash="f115cbc70309f4e3b14d33cf29bdb274"/><file name="cron.phtml" hash="f1dbdea68c377d7057230697450e16b1"/></dir><dir name="conflictchecker"><file name="errors.phtml" hash="26c9fa4332b8518141de9dab0db0c823"/></dir><dir name="email"><dir name="template"><file name="edit.phtml" hash="35c4f68337a6be7186be1aac0fbe404e"/><file name="list.phtml" hash="cf2503d79273b5a611cde3acde2bb79d"/></dir></dir><dir name="permissionchecker"><file name="errors.phtml" hash="0306e132afed0c88058be67d37dd211c"/></dir><dir name="roundtrip"><file name="status.phtml" hash="8dcb1b72071c00888c8f6ad7b6d18d9b"/></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="email.xml" hash="be77c906770a0d818898a910b03cbe4f"/><file name="reminder.xml" hash="98d835f287cb3aa2ff801f0219f88ccc"/><file name="roundtrip.xml" hash="3da91d3bcb40e1805a80fb2a18ed9cee"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="bronto"><file name="abandoned_cart.html" hash="20b0f55098c0f07bf96da3c5309d9192"/></dir></dir></dir></dir></target></contents>
63
  <compatible/>
64
  <dependencies><required><php><min>5.2.13</min><max>5.5.0</max></php><extension><name>soap</name><min></min><max></max></extension><extension><name>openssl</name><min></min><max></max></extension></required></dependencies>
65
  </package>