Bronto_Extension - Version 2.4.2

Version Notes

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.4.2
Comparing to
See all releases


Code changes from version 2.4.1 to 2.4.2

Files changed (257) hide show
  1. app/code/community/Bronto/Common/Block/Adminhtml/System/Config/About.php +0 -1
  2. app/code/community/Bronto/Common/Block/Adminhtml/System/Config/Form/Field/Image.php +1 -1
  3. app/code/community/Bronto/Common/Helper/Api.php +15 -22
  4. app/code/community/Bronto/Common/Helper/Contact.php +40 -83
  5. app/code/community/Bronto/Common/Helper/Data.php +6 -8
  6. app/code/community/Bronto/Common/Helper/Field.php +14 -10
  7. app/code/community/Bronto/Common/Helper/Message.php +36 -41
  8. app/code/community/Bronto/Common/Helper/Support.php +6 -4
  9. app/code/community/Bronto/Common/Model/Api.php +10 -16
  10. app/code/community/Bronto/Common/Model/Delivery.php +0 -57
  11. app/code/community/Bronto/Common/Model/Email/Template.php +76 -57
  12. app/code/community/Bronto/Common/Model/Email/Template/Filter.php +64 -105
  13. app/code/community/Bronto/Common/Model/Email/Template/Templatefilter.php +5 -6
  14. app/code/community/Bronto/Common/Model/Error.php +22 -60
  15. app/code/community/Bronto/Common/Model/Flusher.php +134 -0
  16. app/code/community/Bronto/Common/Model/Keysentry.php +0 -3
  17. app/code/community/Bronto/Common/Model/Observer.php +3 -0
  18. app/code/community/Bronto/Common/Model/Queue.php +13 -17
  19. app/code/community/Bronto/Common/Model/System/Config/Backend/Token.php +3 -0
  20. app/code/community/Bronto/Common/Model/System/Config/Source/Field.php +5 -11
  21. app/code/community/Bronto/Common/Model/System/Config/Source/List.php +4 -4
  22. app/code/community/Bronto/Common/Model/System/Config/Source/Message.php +6 -6
  23. app/code/community/Bronto/Common/etc/config.xml +3 -5
  24. app/code/community/Bronto/Common/etc/system.xml +0 -3
  25. app/code/community/Bronto/Common/sql/bronto_common_setup/mysql4-install-2.4.2.php +13 -0
  26. app/code/community/Bronto/Common/sql/bronto_common_setup/mysql4-upgrade-2.4.0-2.4.2.php +7 -0
  27. app/code/community/Bronto/Customer/Helper/Data.php +2 -11
  28. app/code/community/Bronto/Customer/Model/Observer.php +64 -144
  29. app/code/community/Bronto/Customer/Model/Queue.php +1 -1
  30. app/code/community/Bronto/Customer/Model/System/Config/Backend/Newfield.php +13 -11
  31. app/code/community/Bronto/Email/Block/Adminhtml/System/Email/Import/Grid/Renderer/Action.php +0 -32
  32. app/code/community/Bronto/Email/Model/Resource/Setup.php +7 -0
  33. app/code/community/Bronto/Email/Model/Template.php +7 -7
  34. app/code/community/Bronto/Email/Model/Template/Import.php +55 -41
  35. app/code/community/Bronto/Email/Model/Template/Mailer.php +2 -2
  36. app/code/community/Bronto/Email/etc/config.xml +1 -1
  37. app/code/community/Bronto/Email/sql/bronto_email_setup/mysql4-install-1.2.2.php +13 -0
  38. app/code/community/Bronto/Email/sql/bronto_email_setup/mysql4-upgrade-1.2.1-1.2.2.php +13 -0
  39. app/code/community/Bronto/Newsletter/Block/Checkout/Onepage/Newsletter.php +2 -2
  40. app/code/community/Bronto/Newsletter/Helper/Contact.php +25 -4
  41. app/code/community/Bronto/Newsletter/Model/Observer.php +22 -33
  42. app/code/community/Bronto/Newsletter/controllers/IndexController.php +3 -3
  43. app/code/community/Bronto/Newsletter/etc/config.xml +1 -0
  44. app/code/community/Bronto/Order/Model/Observer.php +38 -221
  45. app/code/community/Bronto/Order/sql/bronto_order_setup/mysql4-upgrade-1.0.0-1.1.6.php +1 -1
  46. app/code/community/Bronto/Product/Helper/Data.php +9 -19
  47. app/code/community/Bronto/Product/Model/Collect/Bestseller.php +3 -1
  48. app/code/community/Bronto/Product/Model/Collect/Mostviewed.php +2 -1
  49. app/code/community/Bronto/Product/Model/Observer.php +4 -6
  50. app/code/community/Bronto/Product/controllers/Adminhtml/RecommendationsController.php +14 -8
  51. app/code/community/Bronto/Reminder/Block/Adminhtml/Reminder/Edit/Tab/Bronto.php +1 -1
  52. app/code/community/Bronto/Reminder/Model/Email/Message.php +5 -15
  53. app/code/community/Bronto/Reminder/Model/Mysql4/Customer/Collection.php +2 -0
  54. app/code/community/Bronto/Reminder/controllers/LoadController.php +5 -30
  55. app/code/community/Bronto/Reviews/Model/Log.php +11 -9
  56. app/code/community/Bronto/Reviews/Model/Message.php +3 -7
  57. app/code/community/Bronto/Reviews/Model/Observer.php +23 -4
  58. app/code/community/Bronto/Reviews/sql/bronto_reviews_setup/mysql4-upgrade-0.0.1-0.0.2.php +0 -1
  59. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/About.php +0 -1
  60. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Advanced/Observersearch.php +0 -1
  61. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Conflictchecker.php +0 -1
  62. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Apitoken.php +0 -1
  63. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Classpath.php +0 -1
  64. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Conflict.php +0 -1
  65. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Events.php +0 -1
  66. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Roundtrip.php +0 -1
  67. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Installs.php +0 -1
  68. app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Permissionchecker.php +0 -1
  69. app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Classpath.php +0 -1
  70. app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Conflict.php +0 -1
  71. app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Events.php +0 -1
  72. app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Permissions.php +0 -1
  73. app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Runroundtrip.php +0 -1
  74. app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Runtoken.php +0 -1
  75. app/code/community/Bronto/Verify/Block/Conflictprinter.php +0 -1
  76. app/code/community/Bronto/Verify/Block/Permissionprinter.php +0 -1
  77. app/code/community/Bronto/Verify/Helper/Apitoken.php +2 -4
  78. app/code/community/Bronto/Verify/Helper/Conflictchecker.php +0 -1
  79. app/code/community/Bronto/Verify/Helper/Data.php +0 -1
  80. app/code/community/Bronto/Verify/Helper/Permissionchecker.php +0 -1
  81. app/code/community/Bronto/Verify/Helper/Roundtrip.php +0 -1
  82. app/code/community/Bronto/Verify/Model/Config/Blocks.php +0 -1
  83. app/code/community/Bronto/Verify/Model/Config/Checker.php +0 -1
  84. app/code/community/Bronto/Verify/Model/Config/ConfigAbstract.php +0 -1
  85. app/code/community/Bronto/Verify/Model/Config/ConfigInterface.php +0 -1
  86. app/code/community/Bronto/Verify/Model/Config/Datastore.php +0 -1
  87. app/code/community/Bronto/Verify/Model/Config/Helpers.php +0 -1
  88. app/code/community/Bronto/Verify/Model/Config/Models.php +0 -1
  89. app/code/community/Bronto/Verify/Model/Config/Printer.php +0 -1
  90. app/code/community/Bronto/Verify/Model/Config/Resources.php +0 -1
  91. app/code/community/Bronto/Verify/Model/Contact/Builder.php +0 -1
  92. app/code/community/Bronto/Verify/Model/Core/Config.php +0 -1
  93. app/code/community/Bronto/Verify/Model/Core/Config/Base.php +0 -1
  94. app/code/community/Bronto/Verify/Model/Core/Config/Element.php +0 -1
  95. app/code/community/Bronto/Verify/Model/Lib/Varien/Simplexml/Config.php +0 -1
  96. app/code/community/Bronto/Verify/Model/Lib/Varien/Simplexml/Element.php +0 -1
  97. app/code/community/Bronto/Verify/Model/Mysql4/Core/Config.php +0 -1
  98. app/code/community/Bronto/Verify/Model/Path/Locator/Array.php +0 -1
  99. app/code/community/Bronto/Verify/Model/Path/Locator/Factory.php +0 -1
  100. app/code/community/Bronto/Verify/Model/Path/Locator/IteratorAbstract.php +0 -1
  101. app/code/community/Bronto/Verify/Model/Path/Locator/LocatorInterface.php +0 -1
  102. app/code/community/Bronto/Verify/Model/Path/Locator/Stack.php +0 -1
  103. app/code/community/Bronto/Verify/Model/Resource/Core/Config.php +0 -1
  104. app/code/community/Bronto/Verify/Model/Resource/Db/Abstract.php +0 -1
  105. app/code/community/Bronto/Verify/Model/Roundtrip.php +1 -2
  106. app/code/community/Bronto/Verify/Model/Validator/Checker.php +0 -1
  107. app/code/community/Bronto/Verify/Model/Validator/Directory.php +0 -1
  108. app/code/community/Bronto/Verify/Model/Validator/File.php +0 -1
  109. app/code/community/Bronto/Verify/Model/Validator/Filter/PatternIterator.php +0 -1
  110. app/code/community/Bronto/Verify/Model/Validator/Group.php +0 -1
  111. app/code/community/Bronto/Verify/Model/Validator/Owner.php +0 -1
  112. app/code/community/Bronto/Verify/Model/Validator/Printer.php +0 -1
  113. app/code/community/Bronto/Verify/Model/Validator/ValidatorAbstract.php +0 -1
  114. app/code/community/Bronto/Verify/Model/Validator/ValidatorInterface.php +0 -1
  115. app/code/community/Bronto/Verify/controllers/Adminhtml/AdvancedController.php +0 -1
  116. app/code/community/Bronto/Verify/controllers/Adminhtml/ApitokenController.php +0 -1
  117. app/code/community/Bronto/Verify/controllers/Adminhtml/ConflictcheckerController.php +0 -1
  118. app/code/community/Bronto/Verify/controllers/Adminhtml/PermissioncheckerController.php +0 -1
  119. app/code/community/Bronto/Verify/controllers/Adminhtml/RoundtripController.php +0 -1
  120. app/code/community/Bronto/Verify/etc/adminhtml.xml +0 -1
  121. app/code/community/Bronto/Verify/etc/config.xml +0 -1
  122. app/code/community/Bronto/Verify/etc/system.xml +0 -1
  123. app/design/adminhtml/default/default/template/bronto/email/template/list.phtml +0 -26
  124. app/design/adminhtml/default/default/template/bronto/product/recommendation/preview.phtml +2 -2
  125. app/design/adminhtml/default/default/template/bronto/reminder/grid/container.phtml +1 -27
  126. app/design/frontend/base/default/template/bronto/common/recovery.phtml +2 -1
  127. lib/Bronto/Api.php +148 -571
  128. lib/Bronto/Api/Account.php +0 -58
  129. lib/Bronto/Api/Account/Exception.php +0 -13
  130. lib/Bronto/Api/Account/Row.php +0 -24
  131. lib/Bronto/Api/Activity.php +0 -216
  132. lib/Bronto/Api/Activity/Exception.php +0 -12
  133. lib/Bronto/Api/Activity/Row.php +0 -139
  134. lib/Bronto/Api/ApiToken.php +0 -129
  135. lib/Bronto/Api/ApiToken/Exception.php +0 -9
  136. lib/Bronto/Api/ApiToken/Row.php +0 -83
  137. lib/Bronto/Api/Contact.php +0 -107
  138. lib/Bronto/Api/Contact/Exception.php +0 -23
  139. lib/Bronto/Api/Contact/Row.php +0 -399
  140. lib/Bronto/Api/ContentTag.php +0 -45
  141. lib/Bronto/Api/ContentTag/Exception.php +0 -14
  142. lib/Bronto/Api/ContentTag/Row.php +0 -59
  143. lib/Bronto/Api/Conversion.php +0 -46
  144. lib/Bronto/Api/Conversion/Exception.php +0 -11
  145. lib/Bronto/Api/Conversion/Row.php +0 -105
  146. lib/Bronto/Api/Delivery.php +0 -86
  147. lib/Bronto/Api/Delivery/Exception.php +0 -23
  148. lib/Bronto/Api/Delivery/Recipient.php +0 -22
  149. lib/Bronto/Api/Delivery/Row.php +0 -238
  150. lib/Bronto/Api/DeliveryGroup.php +0 -100
  151. lib/Bronto/Api/DeliveryGroup/Exception.php +0 -21
  152. lib/Bronto/Api/DeliveryGroup/Row.php +0 -58
  153. lib/Bronto/Api/Exception.php +95 -142
  154. lib/Bronto/Api/Field.php +0 -136
  155. lib/Bronto/Api/Field/Exception.php +0 -18
  156. lib/Bronto/Api/Field/Predefined.php +0 -306
  157. lib/Bronto/Api/Field/Row.php +0 -62
  158. lib/Bronto/Api/Field/TypeGuesser.php +0 -129
  159. lib/Bronto/Api/List.php +0 -57
  160. lib/Bronto/Api/List/Exception.php +0 -19
  161. lib/Bronto/Api/List/Row.php +0 -128
  162. lib/Bronto/Api/Login.php +0 -38
  163. lib/Bronto/Api/Login/ContactInformation.php +0 -93
  164. lib/Bronto/Api/Login/Exception.php +0 -10
  165. lib/Bronto/Api/Login/Row.php +0 -39
  166. lib/Bronto/Api/Message.php +0 -38
  167. lib/Bronto/Api/Message/Exception.php +0 -24
  168. lib/Bronto/Api/Message/Row.php +0 -84
  169. lib/Bronto/Api/MessageRule.php +0 -43
  170. lib/Bronto/Api/MessageRule/Exception.php +0 -14
  171. lib/Bronto/Api/MessageRule/Row.php +0 -60
  172. lib/Bronto/Api/Model/Contact.php +159 -0
  173. lib/Bronto/Api/Model/Delivery.php +48 -0
  174. lib/Bronto/Api/Model/DeliveryAbstract.php +117 -0
  175. lib/Bronto/Api/Model/Field.php +111 -0
  176. lib/Bronto/Api/Model/Message.php +71 -0
  177. lib/Bronto/Api/Model/Order.php +38 -0
  178. lib/Bronto/Api/Model/SMSDelivery.php +44 -0
  179. lib/Bronto/Api/Object.php +21 -562
  180. lib/Bronto/Api/Observer.php +35 -0
  181. lib/Bronto/Api/Operation.php +300 -0
  182. lib/Bronto/Api/Operation/Account.php +40 -0
  183. lib/Bronto/Api/Operation/Activity.php +45 -0
  184. lib/Bronto/Api/Operation/Contact.php +58 -0
  185. lib/Bronto/Api/Operation/ContentTag.php +36 -0
  186. lib/Bronto/Api/Operation/Conversion.php +27 -0
  187. lib/Bronto/Api/Operation/Delivery.php +40 -0
  188. lib/Bronto/Api/Operation/DeliveryGroup.php +41 -0
  189. lib/Bronto/Api/Operation/HeaderFooter.php +36 -0
  190. lib/Bronto/Api/Operation/InboundActivity.php +45 -0
  191. lib/Bronto/Api/Operation/MailList.php +45 -0
  192. lib/Bronto/Api/Operation/Message.php +36 -0
  193. lib/Bronto/Api/Operation/Order.php +49 -0
  194. lib/Bronto/Api/Operation/OutboundActivity.php +45 -0
  195. lib/Bronto/Api/Operation/SMSDelivery.php +48 -0
  196. lib/Bronto/Api/Operation/SMSKeyword.php +55 -0
  197. lib/Bronto/Api/Operation/SMSMessage.php +46 -0
  198. lib/Bronto/Api/Options.php +161 -0
  199. lib/Bronto/Api/Order.php +0 -21
  200. lib/Bronto/Api/Order/Exception.php +0 -10
  201. lib/Bronto/Api/Order/Product.php +0 -68
  202. lib/Bronto/Api/Order/Row.php +0 -86
  203. lib/Bronto/Api/Read.php +189 -0
  204. lib/Bronto/Api/Read/ByDirection.php +45 -0
  205. lib/Bronto/Api/Read/ByPage.php +44 -0
  206. lib/Bronto/Api/Read/Filter.php +179 -0
  207. lib/Bronto/Api/Read/Pager.php +189 -0
  208. lib/Bronto/Api/Read/Transform.php +108 -0
  209. lib/Bronto/Api/Request.php +38 -0
  210. lib/Bronto/Api/Retryer.php +36 -0
  211. lib/Bronto/Api/Row.php +0 -732
  212. lib/Bronto/Api/Row/Exception.php +0 -10
  213. lib/Bronto/Api/Rowset.php +0 -397
  214. lib/Bronto/Api/Rowset/Exception.php +0 -11
  215. lib/Bronto/Api/Rowset/Iterator.php +0 -406
  216. lib/Bronto/Api/Segment.php +0 -38
  217. lib/Bronto/Api/Segment/Exception.php +0 -11
  218. lib/Bronto/Api/Segment/Row.php +0 -71
  219. lib/Bronto/Api/Strategy/Error.php +30 -0
  220. lib/Bronto/Api/Strategy/Standard.php +44 -0
  221. lib/Bronto/Api/Write.php +256 -0
  222. lib/Bronto/Api/Write/Flusher.php +26 -0
  223. lib/Bronto/Api/Write/Overflow.php +42 -0
  224. lib/Bronto/Api/Write/Pager.php +164 -0
  225. lib/Bronto/Functional/Monadic.php +44 -0
  226. lib/Bronto/Functional/None.php +33 -0
  227. lib/Bronto/Functional/Option.php +108 -0
  228. lib/Bronto/Functional/Some.php +45 -0
  229. lib/Bronto/Functional/functions.php +30 -0
  230. lib/Bronto/ImportManager.php +6 -0
  231. lib/Bronto/Object.php +243 -0
  232. lib/Bronto/Observer.php +0 -35
  233. lib/Bronto/Resource/Proxy.php +116 -0
  234. lib/Bronto/Serialize/BiDirectional.php +25 -0
  235. lib/Bronto/Serialize/Decode.php +25 -0
  236. lib/Bronto/Serialize/Encode.php +25 -0
  237. lib/Bronto/Serialize/Exception.php +68 -0
  238. lib/Bronto/Serialize/Json/Standard.php +74 -0
  239. lib/Bronto/SoapClient.php +0 -26
  240. lib/Bronto/Transfer/Adapter.php +26 -0
  241. lib/Bronto/Transfer/Curl/Adapter.php +41 -0
  242. lib/Bronto/Transfer/Curl/Multi.php +146 -0
  243. lib/Bronto/Transfer/Curl/Request.php +224 -0
  244. lib/Bronto/Transfer/Curl/Response.php +93 -0
  245. lib/Bronto/Transfer/Exception.php +37 -0
  246. lib/Bronto/Transfer/Headers.php +23 -0
  247. lib/Bronto/Transfer/Request.php +64 -0
  248. lib/Bronto/Transfer/Response.php +50 -0
  249. lib/Bronto/Util/Colors.php +0 -196
  250. lib/Bronto/Util/CountryCodes.php +0 -260
  251. lib/Bronto/Util/Retryer/FileRetryer.php +0 -126
  252. lib/Bronto/Util/Retryer/RetryerException.php +0 -9
  253. lib/Bronto/Util/Retryer/RetryerInterface.php +0 -20
  254. lib/Bronto/Util/Uuid.php +0 -78
  255. lib/Bronto/Utils.php +60 -0
  256. lib/Bronto/functions.php +32 -0
  257. package.xml +6 -6
app/code/community/Bronto/Common/Block/Adminhtml/System/Config/About.php CHANGED
@@ -3,7 +3,6 @@
3
  /**
4
  * @package Bronto\Common
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_Common_Block_Adminhtml_System_Config_About extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
9
  {
3
  /**
4
  * @package Bronto\Common
5
  * @copyright 2011-2013 Bronto Software, Inc.
 
6
  */
7
  class Bronto_Common_Block_Adminhtml_System_Config_About extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
8
  {
app/code/community/Bronto/Common/Block/Adminhtml/System/Config/Form/Field/Image.php CHANGED
@@ -13,7 +13,7 @@ class Bronto_Common_Block_Adminhtml_System_Config_Form_Field_Image extends Bront
13
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
14
  {
15
  $defaultSizes = array(
16
- 'image' => array('width' => '265', 'height' => ''),
17
  'small_image' => array('width' => '88', 'height' => '77'),
18
  'thumbnail' => array('width' => '75', 'height' => '75'),
19
  );
13
  protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
14
  {
15
  $defaultSizes = array(
16
+ 'image' => array('width' => '', 'height' => ''),
17
  'small_image' => array('width' => '88', 'height' => '77'),
18
  'thumbnail' => array('width' => '75', 'height' => '75'),
19
  );
app/code/community/Bronto/Common/Helper/Api.php CHANGED
@@ -30,7 +30,8 @@ class Bronto_Common_Helper_Api extends Bronto_Common_Helper_Data
30
  const XML_PATH_SOAP_EXCEPTIONS = 'bronto_api/soap_options/exceptions';
31
  const XML_PATH_WSDL_CACHE = 'bronto_api/soap_options/wsdl_cache';
32
 
33
- const DEFAULT_SOAP_CLIENT = 'Bronto_SoapClient';
 
34
 
35
  /**
36
  * Gets the Canonical name of the helper
@@ -148,15 +149,16 @@ class Bronto_Common_Helper_Api extends Bronto_Common_Helper_Data
148
  {
149
  // Return Default Options
150
  return array(
151
- 'soap_client' => $this->getSoapClient(),
152
  'observer' => $this->getApiObserver(),
153
- 'retry_limit' => $this->getSoapRetryLimit(),
154
- 'connection_timeout' => $this->getSoapConnectionTimeout(),
155
- 'trace' => $this->getSoapTrace(),
156
- 'exceptions' => $this->getSoapExceptions(),
157
- 'cache_wsdl' => $this->getSoapCacheWsdl(),
158
- 'debug' => $this->isDebugEnabled(),
159
- 'retryer' => $this->getApiRetryer()
 
160
  );
161
  }
162
 
@@ -168,13 +170,10 @@ class Bronto_Common_Helper_Api extends Bronto_Common_Helper_Data
168
  public function getApiRetryer()
169
  {
170
  $class = $this->getAdminScopedConfig(self::XML_PATH_API_RETRYER);
171
- $options = array('type' => 'custom');
172
- if (empty($class) || !class_exists($class)) {
173
- $options['object'] = Mage::getModel('bronto_common/error');
174
- } else {
175
- $options['path'] = $class;
176
  }
177
- return $options;
178
  }
179
 
180
  /**
@@ -185,15 +184,9 @@ class Bronto_Common_Helper_Api extends Bronto_Common_Helper_Data
185
  public function getSoapClient()
186
  {
187
  $class = $this->getAdminScopedConfig(self::XML_PATH_SOAP_CLIENT);
188
- if (empty($class)) {
189
  $class = self::DEFAULT_SOAP_CLIENT;
190
  }
191
- if (
192
- $this->isStreamContextOverride() &&
193
- $class == self::DEFAULT_SOAP_CLIENT
194
- ) {
195
- $class = 'Bronto_Common_Model_SoapClient';
196
- }
197
  return $class;
198
  }
199
 
30
  const XML_PATH_SOAP_EXCEPTIONS = 'bronto_api/soap_options/exceptions';
31
  const XML_PATH_WSDL_CACHE = 'bronto_api/soap_options/wsdl_cache';
32
 
33
+ const DEFAULT_SOAP_CLIENT = 'SoapClient';
34
+ const DEFAULT_OLD_SOAP_CLIENT = 'Bronto_SoapClient';
35
 
36
  /**
37
  * Gets the Canonical name of the helper
149
  {
150
  // Return Default Options
151
  return array(
152
+ 'soapClass' => $this->getSoapClient(),
153
  'observer' => $this->getApiObserver(),
154
+ 'retries' => $this->getSoapRetryLimit(),
155
+ 'retryer' => $this->getApiRetryer(),
156
+ 'soapOptions' => array(
157
+ 'connection_timeout' => $this->getSoapConnectionTimeout(),
158
+ 'trace' => $this->getSoapTrace() || $this->isVerboseEnabled(),
159
+ 'exceptions' => $this->getSoapExceptions(),
160
+ 'cache_wsdl' => $this->getSoapCacheWsdl()
161
+ )
162
  );
163
  }
164
 
170
  public function getApiRetryer()
171
  {
172
  $class = $this->getAdminScopedConfig(self::XML_PATH_API_RETRYER);
173
+ if (!empty($class) && class_exists($class)) {
174
+ return Mage::getModel('bronto_common/error');
 
 
 
175
  }
176
+ return '';
177
  }
178
 
179
  /**
184
  public function getSoapClient()
185
  {
186
  $class = $this->getAdminScopedConfig(self::XML_PATH_SOAP_CLIENT);
187
+ if (empty($class) || $class == self::DEFAULT_OLD_SOAP_CLIENT || !class_exists($class)) {
188
  $class = self::DEFAULT_SOAP_CLIENT;
189
  }
 
 
 
 
 
 
190
  return $class;
191
  }
192
 
app/code/community/Bronto/Common/Helper/Contact.php CHANGED
@@ -19,25 +19,19 @@ class Bronto_Common_Helper_Contact extends Bronto_Common_Helper_Data
19
  return false;
20
  }
21
 
22
- /* @var $contactObject Bronto_Api_Contact */
23
- $api = $this->getApi(null, 'store', $store);
24
- $contactObject = $api->getContactObject();
25
-
26
- // Load Contact
27
- $contact = $contactObject->createRow(array('email' => $email));
28
- $contact->email = $email;
29
  try {
30
- $contact = $contact->read();
 
 
 
31
  } catch (Exception $e) {
32
- // Contact doesn't exist
33
- $this->writeDebug('No Contact exists with email: ' . $email);
34
- // Set customSource if available
35
- if (!empty($customSource)) {
36
- $contact->customSource = $customSource;
37
- }
38
  }
39
-
40
- return $contact;
 
41
  }
42
 
43
  /**
@@ -57,105 +51,68 @@ class Bronto_Common_Helper_Contact extends Bronto_Common_Helper_Data
57
  }
58
 
59
  $api = $this->getApi(null, 'store', $store);
60
- $contactObject = $api->getContactObject();
61
- $filter = array(
62
- 'type' => 'OR',
63
- 'email' => array(),
64
- );
65
  foreach ($emails as $email) {
66
- $filter['email'][] = array(
67
- 'operator' => 'EqualTo',
68
- 'value' => $email
69
- );
70
  }
71
-
72
- $results = $contactObject->readAll($filter);
73
  if (count($results) != count($emails)) {
74
  $contacts = array();
75
  foreach ($results as $contact) {
76
- $contacts[$contact->email] = $contact;
77
  }
78
 
79
  $newContacts = array();
80
  foreach ($emails as $email) {
81
  if (!isset($contacts[$email])) {
82
- $contact = $contactObject->createRow(array('email' => $email));
83
- $contact->customSource = $customSource;
84
- $newContacts[$email] = $contact;
 
 
85
  }
86
  }
87
 
88
  if ($createNonExistent) {
89
- return $contacts + $this->saveContacts($newContacts);
90
  } else {
91
- return $contacts + $newContacts;
92
  }
93
  } else {
94
  return $results;
95
  }
96
  }
97
 
98
- /**
99
- * @param Bronto_Api_Contact_Row $contact
100
- * @param bool $persistOnly
101
- *
102
- * @return Bronto_Api_Contact_Row
103
- */
104
- public function saveContact(Bronto_Api_Contact_Row $contact, $persistOnly = false)
105
- {
106
-
107
- if ($persistOnly) {
108
- $contact->persist();
109
- } else {
110
- try {
111
- if ($contact->id) {
112
- $this->writeDebug("Updating existing Contact: ({$contact->email})...");
113
- } else {
114
- $this->writeDebug("Saving new Contact: ({$contact->email})...");
115
- }
116
- $contact->save(false);
117
- } catch (Exception $e) {
118
- $this->writeError($e);
119
- }
120
- $this->_flushApiLogs($contact->getApi());
121
- }
122
-
123
- return $contact;
124
- }
125
-
126
  /**
127
  * More efficient way add saving multiple contacts
128
  *
129
  * @param array Bronto_Api_Contact_Row
130
  * @return array Bronto_Api_Contact_Row
131
  */
132
- public function saveContacts($contacts)
133
  {
134
- $contactObject = null;
135
- $lookupTable = array();
136
- foreach ($contacts as $index => $contact) {
137
- $contactObject = $contact->getApiObject();
138
- $this->saveContact($contact, true);
139
- $lookupTable[] = $index;
140
  }
141
-
142
- if ($contactObject) {
143
- try {
144
- $results = $contactObject->flush();
145
- foreach ($results as $index => $result) {
146
- $contact = $contacts[$lookupTable[$index]];
147
- if ($result->hasError()) {
148
- $this->writeError("Failed to create contact {$contact->email}: ({$result->getErrorCode()}): {$result->getErrorMessage()}");
149
- $contact->error = $result->getErrorMessage();
150
- } else {
151
- $contact->id = $result->id;
152
- }
153
  }
154
- } catch (Exception $e) {
155
- $this->writeError($e);
156
  }
157
- $this->_flushApiLogs($contactObject->getApi());
 
 
158
  }
 
159
  return $contacts;
160
  }
161
 
19
  return false;
20
  }
21
 
22
+ $api = $this->getApi(null, 'store', $store);
23
+ $contacts = $api->transferContact();
 
 
 
 
 
24
  try {
25
+ return $contacts->read()
26
+ ->withIncludeLists(true)
27
+ ->where->email->equalTo($email)
28
+ ->first();
29
  } catch (Exception $e) {
30
+ $this->writeError('Failed to read contact ' . $email . ': ' . $e->getMessage());
 
 
 
 
 
31
  }
32
+ return $contacts->createObject()
33
+ ->withEmail($email)
34
+ ->withCustomSource($customSource);
35
  }
36
 
37
  /**
51
  }
52
 
53
  $api = $this->getApi(null, 'store', $store);
54
+ $contactObject = $api->transferContact();
55
+ $readContacts = $contactObject->read();
 
 
 
56
  foreach ($emails as $email) {
57
+ $readContacts->or->email->equalTo($email);
 
 
 
58
  }
59
+ $results = $readContacts->getIterator()->toArray();
 
60
  if (count($results) != count($emails)) {
61
  $contacts = array();
62
  foreach ($results as $contact) {
63
+ $contacts[$contact->getEmail()] = $contact;
64
  }
65
 
66
  $newContacts = array();
67
  foreach ($emails as $email) {
68
  if (!isset($contacts[$email])) {
69
+ $contact = $contactObject->createObject()
70
+ ->withEmail($email)
71
+ ->withStatus('transactional')
72
+ ->withCustomSource($customSource);
73
+ $newContacts[] = $contact;
74
  }
75
  }
76
 
77
  if ($createNonExistent) {
78
+ return array_merge($contacts, $this->saveContacts($contactObject, $newContacts));
79
  } else {
80
+ return array_merge($contacts, $newContacts);
81
  }
82
  } else {
83
  return $results;
84
  }
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  /**
88
  * More efficient way add saving multiple contacts
89
  *
90
  * @param array Bronto_Api_Contact_Row
91
  * @return array Bronto_Api_Contact_Row
92
  */
93
+ public function saveContacts($contactObject, $contacts)
94
  {
95
+ if (empty($contacts)) {
96
+ return $contacts;
 
 
 
 
97
  }
98
+ try {
99
+ $newContacts = array();
100
+ foreach ($contactObject->addOrUpdate()->push($contacts) as $result) {
101
+ $item = $result->getItem();
102
+ $contact = $result->getOriginal();
103
+ if ($item->getIsError()) {
104
+ $this->writeError("Failed to create contact {$contact->getEmail()}: ({$item->getErrorCode()}): {$item->getErrorString()}");
105
+ $contact->withError($item->getErrorMessage());
106
+ } else {
107
+ $contact->withId($item->getId());
 
 
108
  }
109
+ $newContacts[] = $contact;
 
110
  }
111
+ return $newContacts;
112
+ } catch (Exception $e) {
113
+ $this->writeError($e);
114
  }
115
+ $this->_flushApiLogs($contactObject->getApi());
116
  return $contacts;
117
  }
118
 
app/code/community/Bronto/Common/Helper/Data.php CHANGED
@@ -354,9 +354,6 @@ class Bronto_Common_Helper_Data
354
  }
355
  }
356
 
357
- Mage::getConfig()->reinit();
358
- Mage::app()->reinitStores();
359
-
360
  return $this;
361
  }
362
 
@@ -474,6 +471,7 @@ class Bronto_Common_Helper_Data
474
  }
475
 
476
  return Mage::getModel('bronto_common/api')
 
477
  ->setToken($token)
478
  ->getClient();
479
  }
@@ -524,9 +522,9 @@ class Bronto_Common_Helper_Data
524
 
525
  try {
526
  $api = $this->getApi($token, $scope, $scopeId);
527
- $tokenRow = $api->getTokenInfo();
528
 
529
- return $tokenRow->hasPermissions(7);
530
  } catch (Exception $e) {
531
  $helper = Mage::helper('bronto_common/api');
532
  if (
@@ -906,7 +904,7 @@ class Bronto_Common_Helper_Data
906
  );
907
 
908
  // Update Scope based on what has been set
909
- if ($scopeParams['store'] !== false) {
910
  $store = Mage::app()->getStore($scopeParams['store']);
911
  if ($store->getId()) {
912
  $scopeParams['store_id'] = $store->getId();
@@ -914,13 +912,13 @@ class Bronto_Common_Helper_Data
914
  $scopeParams['store_id'] = Mage::app()->getStore()->getId();
915
  }
916
  $scopeParams['scope'] = 'store';
917
- } elseif ($scopeParams['website'] !== false) {
918
  $website = Mage::app()->getWebsite($scopeParams['website']);
919
  if ($website->getId()) {
920
  $scopeParams['website_id'] = $website->getId();
921
  }
922
  $scopeParams['scope'] = 'website';
923
- } elseif ($scopeParams['group'] !== false) {
924
  $group = Mage::app()->getGroup($scopeParams['group']);
925
  if ($group->getId()) {
926
  $scopeParams['group_id'] = $group->getId();
354
  }
355
  }
356
 
 
 
 
357
  return $this;
358
  }
359
 
471
  }
472
 
473
  return Mage::getModel('bronto_common/api')
474
+ ->load($token)
475
  ->setToken($token)
476
  ->getClient();
477
  }
522
 
523
  try {
524
  $api = $this->getApi($token, $scope, $scopeId);
525
+ $tokenRow = $api->transferApiToken()->getById($token);
526
 
527
+ return $tokenRow->getPermissions() == 7;
528
  } catch (Exception $e) {
529
  $helper = Mage::helper('bronto_common/api');
530
  if (
904
  );
905
 
906
  // Update Scope based on what has been set
907
+ if (!empty($scopeParams['store'])) {
908
  $store = Mage::app()->getStore($scopeParams['store']);
909
  if ($store->getId()) {
910
  $scopeParams['store_id'] = $store->getId();
912
  $scopeParams['store_id'] = Mage::app()->getStore()->getId();
913
  }
914
  $scopeParams['scope'] = 'store';
915
+ } elseif (!empty($scopeParams['website'])) {
916
  $website = Mage::app()->getWebsite($scopeParams['website']);
917
  if ($website->getId()) {
918
  $scopeParams['website_id'] = $website->getId();
919
  }
920
  $scopeParams['scope'] = 'website';
921
+ } elseif (!empty($scopeParams['group'])) {
922
  $group = Mage::app()->getGroup($scopeParams['group']);
923
  if ($group->getId()) {
924
  $scopeParams['group_id'] = $group->getId();
app/code/community/Bronto/Common/Helper/Field.php CHANGED
@@ -6,6 +6,7 @@
6
  */
7
  class Bronto_Common_Helper_Field extends Bronto_Common_Helper_Data
8
  {
 
9
  /**
10
  * @param string $name
11
  * @param array $options
@@ -15,19 +16,22 @@ class Bronto_Common_Helper_Field extends Bronto_Common_Helper_Data
15
  public function getFieldByName($name, $options)
16
  {
17
  /* @var $fieldObject Bronto_Api_Field */
18
- $fieldObject = $this->getApi()->getFieldObject();
19
 
20
- if (!($field = $fieldObject->getFromCache($name))) {
21
- $field = $fieldObject->createRow();
22
- $field->name = $name;
23
- $field->label = $options['label'];
24
- $field->type = $options['type'];
25
- if (!empty($options['options'])) {
26
- $field->options = $options['options'];
 
 
27
  }
 
28
  try {
29
- $field->save();
30
- $fieldObject->addToCache($name, $field);
31
  } catch (Exception $e) {
32
  $this->writeError($e);
33
  }
6
  */
7
  class Bronto_Common_Helper_Field extends Bronto_Common_Helper_Data
8
  {
9
+ private static $_fieldCache = array();
10
  /**
11
  * @param string $name
12
  * @param array $options
16
  public function getFieldByName($name, $options)
17
  {
18
  /* @var $fieldObject Bronto_Api_Field */
19
+ $fieldObject = $this->getApi()->transferField();
20
 
21
+ if (!array_key_exists($name, self::$_fieldCache)) {
22
+ $field = $fieldObject->getByName($name);
23
+ if (!$field) {
24
+ $field = $fieldObject->createObject()
25
+ ->withName($name)
26
+ ->withType($options['type']);
27
+ if (!empty($options['options'])) {
28
+ $field->withOptions($options['options']);
29
+ }
30
  }
31
+ $field->withLabel($label);
32
  try {
33
+ $fieldObject->save($field);
34
+ $self::$_fieldCache[$name] = $field;
35
  } catch (Exception $e) {
36
  $this->writeError($e);
37
  }
app/code/community/Bronto/Common/Helper/Message.php CHANGED
@@ -6,6 +6,8 @@
6
  */
7
  class Bronto_Common_Helper_Message extends Bronto_Common_Helper_Data
8
  {
 
 
9
  /**
10
  * Get Bronto Message Object by ID
11
  *
@@ -29,19 +31,19 @@ class Bronto_Common_Helper_Message extends Bronto_Common_Helper_Data
29
  }
30
 
31
  /* @var $messageObject Bronto_Api_Message */
32
- $messageObject = $this->getApi(null, $scope, $scopeId)->getMessageObject();
33
 
34
  // Load Message
35
  try {
36
- /* @var $message Bronto_Api_Message_Row */
37
- $message = $messageObject->createRow();
38
- $message->id = $messageId;
39
- $message->read();
40
  } catch (Exception $e) {
41
  $this->writeError($e);
42
  }
43
 
44
- return $message;
45
  }
46
 
47
  /**
@@ -105,52 +107,45 @@ class Bronto_Common_Helper_Message extends Bronto_Common_Helper_Data
105
 
106
  /* @var $api Bronto_Api */
107
  $api = $this->getApi(null, $scope, $scopeId);
108
-
109
- if ($api) {
110
  /* @var $messageObject Bronto_Api_Message */
111
- $messageObject = $api->getMessageObject();
112
-
113
- $options = array();
114
- $pageNumber = 1;
115
 
116
  try {
117
- while ($messages = $messageObject->readAll($filter, false, $pageNumber)) {
118
- if ($messages->count() <= 0) {
119
- break;
120
- }
121
- foreach ($messages as $message/* @var $message Bronto_Api_Message_Row */) {
122
- if ($message->status == 'active') {
123
- $options[] = array(
124
- 'label' => $message->name,
125
- 'value' => $message->id,
126
- );
127
- }
128
- }
129
- $pageNumber++;
130
  }
131
  } catch (Exception $e) {
132
  Mage::helper('bronto_common')->writeError($e);
133
  }
134
- }
135
 
136
- if ($withCreateNew) {
137
- // Add Create New.. Option
138
- array_unshift($options, array(
139
- 'label' => '** Create New...',
140
- 'value' => '_new_'
141
- ));
 
 
 
 
 
 
 
 
 
 
142
  } else {
143
- // Add -- None Selected -- Option
144
- array_unshift($options, array(
145
- 'label' => '-- None Selected --',
146
- 'value' => ''
147
- ));
148
  }
149
 
150
-
151
- // Sort Alphabetically
152
- sort($options);
153
-
154
  return $options;
155
  }
156
  }
6
  */
7
  class Bronto_Common_Helper_Message extends Bronto_Common_Helper_Data
8
  {
9
+ protected static $_options = array();
10
+
11
  /**
12
  * Get Bronto Message Object by ID
13
  *
31
  }
32
 
33
  /* @var $messageObject Bronto_Api_Message */
34
+ $messageObject = $this->getApi(null, $scope, $scopeId)->transferMessage();
35
 
36
  // Load Message
37
  try {
38
+ return $messageObject->read()
39
+ ->where->id->is($messageId)
40
+ ->withIncludeContent(false)
41
+ ->first();
42
  } catch (Exception $e) {
43
  $this->writeError($e);
44
  }
45
 
46
+ return $messageObject->createObject();
47
  }
48
 
49
  /**
107
 
108
  /* @var $api Bronto_Api */
109
  $api = $this->getApi(null, $scope, $scopeId);
110
+ $options = array();
111
+ if ($api && !array_key_exists($api->getToken(), self::$_options)) {
112
  /* @var $messageObject Bronto_Api_Message */
113
+ $messageObject = $api->transferMessage();
114
+ $readMessages = $messageObject->read(array('filter' => $filter))
115
+ ->withIncludeContent(false)
116
+ ->withStatus('active');
117
 
118
  try {
119
+ foreach ($readMessages as $message) {
120
+ $options[] = array(
121
+ 'label' => $message->getName(),
122
+ 'value' => $message->getId()
123
+ );
 
 
 
 
 
 
 
 
124
  }
125
  } catch (Exception $e) {
126
  Mage::helper('bronto_common')->writeError($e);
127
  }
 
128
 
129
+ if ($withCreateNew) {
130
+ // Add Create New.. Option
131
+ array_unshift($options, array(
132
+ 'label' => '** Create New...',
133
+ 'value' => '_new_'
134
+ ));
135
+ } else {
136
+ // Add -- None Selected -- Option
137
+ array_unshift($options, array(
138
+ 'label' => '-- None Selected --',
139
+ 'value' => ''
140
+ ));
141
+ }
142
+ // Sort Alphabetically
143
+ sort($options);
144
+ self::$_options[$api->getToken()] = $options;
145
  } else {
146
+ $options = self::$_options[$api->getToken()];
 
 
 
 
147
  }
148
 
 
 
 
 
149
  return $options;
150
  }
151
  }
app/code/community/Bronto/Common/Helper/Support.php CHANGED
@@ -235,10 +235,12 @@ class Bronto_Common_Helper_Support extends Bronto_Common_Helper_Data
235
 
236
  $yesNo = Mage::getModel('adminhtml/system_config_source_yesno');
237
  foreach (array('using_solution_partner', 'terms') as $formKey) {
238
- $selectedValue = $formData[$formKey];
239
- foreach ($yesNo->toOptionArray() as $option) {
240
- if ($option['value'] == $selectedValue) {
241
- $formData[$formKey] = $option['label'];
 
 
242
  }
243
  }
244
  }
235
 
236
  $yesNo = Mage::getModel('adminhtml/system_config_source_yesno');
237
  foreach (array('using_solution_partner', 'terms') as $formKey) {
238
+ if (array_key_exists($formKey, $formData)) {
239
+ $selectedValue = $formData[$formKey];
240
+ foreach ($yesNo->toOptionArray() as $option) {
241
+ if ($option['value'] == $selectedValue) {
242
+ $formData[$formKey] = $option['label'];
243
+ }
244
  }
245
  }
246
  }
app/code/community/Bronto/Common/Model/Api.php CHANGED
@@ -4,11 +4,10 @@
4
  * @category Bronto
5
  * @package Common
6
  */
7
- class Bronto_Common_Model_Api extends Mage_Core_Model_Abstract implements Bronto_Observer
8
  {
9
 
10
  protected static $_instances = array();
11
- protected $_setOnce = false;
12
 
13
  /**
14
  * @see parent
@@ -34,17 +33,12 @@ class Bronto_Common_Model_Api extends Mage_Core_Model_Abstract implements Bronto
34
  }
35
  self::$_instances[$token] = new Bronto_Api($token, $options);
36
  }
 
 
 
37
  return self::$_instances[$token];
38
  }
39
 
40
- /**
41
- * @return bool
42
- */
43
- public function hasSetSession()
44
- {
45
- return $this->_setOnce;
46
- }
47
-
48
  /**
49
  * @see parent
50
  *
@@ -74,14 +68,14 @@ class Bronto_Common_Model_Api extends Mage_Core_Model_Abstract implements Bronto
74
  /**
75
  * @see parent
76
  *
77
- * @param Bronto_Api $api
78
  * @param string $sessionId
79
  */
80
- public function onAfterLogin($api, $sessionId)
81
  {
82
  try {
83
  $this
84
- ->setToken($api->getToken())
85
  ->setSessionId($sessionId)
86
  ->setCreatedAt(Mage::getSingleton('core/date')->gmtDate())
87
  ->save();
@@ -97,14 +91,14 @@ class Bronto_Common_Model_Api extends Mage_Core_Model_Abstract implements Bronto
97
  * @param Bronto_Api $api
98
  * @param Bronto_Api_Exception $exception
99
  */
100
- public function onError($api, $exception)
101
  {
102
  if ($exception instanceOf Bronto_Api_Exception) {
103
- if ($request = $exception->getRequest()) {
104
  Mage::helper('bronto_common')->writeDebug(var_export($request, true));
105
  }
106
 
107
- if ($response = $exception->getResponse()) {
108
  Mage::helper('bronto_common')->writeDebug(var_export($response, true));
109
  }
110
  }
4
  * @category Bronto
5
  * @package Common
6
  */
7
+ class Bronto_Common_Model_Api extends Mage_Core_Model_Abstract implements Bronto_Api_Observer
8
  {
9
 
10
  protected static $_instances = array();
 
11
 
12
  /**
13
  * @see parent
33
  }
34
  self::$_instances[$token] = new Bronto_Api($token, $options);
35
  }
36
+ if ($this->hasSessionId()) {
37
+ self::$_instances[$token]->setSessionId($this->getSessionId());
38
+ }
39
  return self::$_instances[$token];
40
  }
41
 
 
 
 
 
 
 
 
 
42
  /**
43
  * @see parent
44
  *
68
  /**
69
  * @see parent
70
  *
71
+ * @param string $apiToken
72
  * @param string $sessionId
73
  */
74
+ public function onLogin($apiToken, $sessionId)
75
  {
76
  try {
77
  $this
78
+ ->setToken($apiToken)
79
  ->setSessionId($sessionId)
80
  ->setCreatedAt(Mage::getSingleton('core/date')->gmtDate())
81
  ->save();
91
  * @param Bronto_Api $api
92
  * @param Bronto_Api_Exception $exception
93
  */
94
+ public function onError(Bronto_Api $api, Bronto_Api_Exception $exception)
95
  {
96
  if ($exception instanceOf Bronto_Api_Exception) {
97
+ if ($request = $api->getLastRequest()) {
98
  Mage::helper('bronto_common')->writeDebug(var_export($request, true));
99
  }
100
 
101
+ if ($response = $api->getLastResponse()) {
102
  Mage::helper('bronto_common')->writeDebug(var_export($response, true));
103
  }
104
  }
app/code/community/Bronto/Common/Model/Delivery.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- class Bronto_Common_Model_Delivery extends Bronto_Api_Delivery
4
- {
5
- /**
6
- * @var string
7
- */
8
- protected $_emailClass;
9
-
10
- /**
11
- * @see parent
12
- *
13
- * @param array $config
14
- */
15
- public function __construct($config = array())
16
- {
17
- parent::__construct($config);
18
- if (isset($config['email_class'])) {
19
- $this->_emailClass = $config['email_class'];
20
- }
21
- }
22
-
23
- /**
24
- * @see parent
25
- * @return string
26
- */
27
- public function getExceptionClass()
28
- {
29
- return 'Bronto_Api_Delivery_Exception';
30
- }
31
-
32
- /**
33
- * Expose the email template associated with this delivery
34
- *
35
- * @return string
36
- */
37
- public function getEmailClass()
38
- {
39
- return $this->_emailClass;
40
- }
41
-
42
- /**
43
- * @return string
44
- */
45
- public function getName()
46
- {
47
- return 'Delivery';
48
- }
49
-
50
- /**
51
- * @return string
52
- */
53
- public function getRowClass()
54
- {
55
- return 'Bronto_Api_Delivery_Row';
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Bronto/Common/Model/Email/Template.php CHANGED
@@ -12,7 +12,7 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
12
  protected $_helper = 'bronto_common';
13
 
14
  /**
15
- * @var Bronto_Api_Message_Row
16
  */
17
  protected $_message;
18
 
@@ -29,9 +29,9 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
29
  /**
30
  * Set the message
31
  *
32
- * @param Bronto_Api_Message_Row $message
33
  */
34
- public function setMessage(Bronto_Api_Message_Row $message)
35
  {
36
  $this->_message = $message;
37
  }
@@ -39,7 +39,7 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
39
  /**
40
  * Get the message currently set
41
  *
42
- * @return boolean|Bronto_Api_Message_Row False if no message is set
43
  */
44
  public function getMessage()
45
  {
@@ -70,6 +70,11 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
70
 
71
  if (empty($this->_templateFilter)) {
72
  $this->_templateFilter = Mage::getModel('bronto_common/email_template_filter');
 
 
 
 
 
73
  }
74
 
75
  return $this->_templateFilter;
@@ -145,12 +150,12 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
145
  /**
146
  * Process email template code
147
  *
148
- * @param Bronto_Api_Delivery_Row $delivery
149
  * @param array $variables
150
  *
151
- * @return Bronto_Api_Delivery_Row
152
  */
153
- public function getProcessedDelivery(Bronto_Api_Delivery_Row $delivery, array $variables = array())
154
  {
155
  $processor = $this->getTemplateFilter($variables['store']->getId());
156
 
@@ -162,10 +167,25 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
162
  $processor->setMessageId($this->getBrontoMessageId());
163
  }
164
 
 
 
 
 
165
  $processor->setVariables($variables);
166
  $processor->setAvailable($this->getVariablesOptionArray());
167
 
168
- return $processor->filter($delivery);
 
 
 
 
 
 
 
 
 
 
 
169
  }
170
 
171
  /**
@@ -230,8 +250,8 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
230
 
231
  $this->setSendQueue($queue);
232
  $this->setMessage($message);
233
- $this->setBrontoMessageId($message->id);
234
- $this->setBrontoMessageName($message->name);
235
  $this->setBrontoMessageApproved(1);
236
  $this->_setRelatedFields($queue);
237
 
@@ -243,40 +263,28 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
243
  continue;
244
  }
245
  try {
246
- $delivery = $queue->prepareDelivery();
247
- $delivery->start = $this->_startTime($queue->getStoreId());
248
- $recipients = array(
249
- array(
250
- 'type' => 'contact',
251
- 'id' => $contact->id,
252
- 'deliveryType' => 'selected'
253
- ),
254
- );
255
  $list = Mage::getModel('bronto_common/list', array(
256
  $this->_helper,
257
  $queue->getAdditionalData()->getExclusionList()
258
  ));
259
  $excludes = $list->addAdditionalRecipients($queue->getStoreId());
260
  foreach ($excludes as $exclude) {
261
- $recipients[] = $exclude;
262
- }
263
- $delivery->recipients = $recipients;
264
- $delivery->save();
265
-
266
- if ($delivery->id) {
267
- $this->setLastDeliveryId($delivery->id);
268
- $this->_afterSend(true, null, $delivery);
269
- } else {
270
- $this->_afterSend(false, null, $delivery);
271
  }
 
 
 
272
  } catch (Exception $e) {
273
  $deliveryErrors++;
274
  $errorMessage = $e->getMessage();
275
- if ($e->getCode() === Bronto_Api_Delivery_Exception::MESSAGE_NOT_TRANSACTIONAL_APPROVED) {
276
  // Replace message id with message name
277
  if (preg_match_all("/([a-zA-Z0-9\-]){36}/", $errorMessage, $matches)) { // Grab field id if exists
278
  foreach ($matches[0] as $match) {
279
- $errorMessage = str_replace($match, $message->name, $errorMessage);
280
  }
281
  }
282
  }
@@ -284,10 +292,25 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
284
  Mage::helper($this->_helper)->writeError($errorMessage);
285
  $this->_afterSend(false, $errorMessage, $delivery);
286
  }
 
287
  }
288
  return $deliveryErrors == 0;
289
  }
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  /**
292
  * Send mail to recipient
293
  *
@@ -310,10 +333,9 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
310
  return parent::send($email, $name, $variables);
311
  }
312
 
313
- /* @var $message Bronto_Api_Message_Row */
314
  $messageId = $this->getBrontoMessageId();
315
  $sendType = $this->getTemplateSendType();
316
- if ($sendType == 'marketing') {
317
  $sendType = 'triggered';
318
  }
319
 
@@ -339,11 +361,12 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
339
 
340
  $variables['email'] = reset($emails);
341
  $variables['name'] = reset($names);
 
342
 
343
  $apiHelper = Mage::helper('bronto_common/api');
344
  $api = $apiHelper->getApi(null, 'store', $variables['store']->getId());
345
 
346
- $delivery = $api->getDeliveryObject()->createRow();
347
  $delivery = $this->getProcessedDelivery($delivery, $variables);
348
  $this->_additionalFields($delivery, $variables);
349
  $productContext = Mage::helper('bronto_product')
@@ -370,7 +393,7 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
370
  'fromEmail' => $this->getSenderEmail(),
371
  'fromName' => $this->getSenderName(),
372
  'replyEmail' => $this->getSenderEmail(),
373
- ) + $delivery->getData()
374
  );
375
 
376
  $queue = Mage::getModel('bronto_common/queue')
@@ -417,7 +440,7 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
417
  return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
418
  } else {
419
  // If module enabled and template ID is not an instance of the api row, see if we can pull an instance
420
- if (!($templateId instanceof Bronto_Api_Message_Row)) {
421
  $emailTemplate = Mage::getModel('bronto_email/template')
422
  ->setDesignConfig($this->getDesignConfig()->getData());
423
 
@@ -434,8 +457,8 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
434
  return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
435
  }
436
 
437
- $message = new Bronto_Api_Message_Row();
438
- $message->id = $emailTemplate->getBrontoMessageId();
439
 
440
  // Send through main template model
441
  $emailTemplate->sendTransactional(
@@ -501,7 +524,6 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
501
  public function setLastDeliveryId($deliveryId)
502
  {
503
  $this->_lastDeliveryId = $deliveryId;
504
-
505
  return $this;
506
  }
507
 
@@ -517,21 +539,18 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
517
  * Allows the retryer to trigger
518
  *
519
  * @param Bronto_Api_Delivery $deliveryObject
 
520
  */
521
- public function triggerBeforeAfterSend(Bronto_Api_Delivery_Row $delivery)
522
  {
523
- $contactObject = $delivery->getApi()->getContactObject();
524
- $messageObject = $delivery->getApi()->getMessageObject();
525
-
526
- $contact = $contactObject->createRow();
527
- $message = $messageObject->createRow();
528
-
529
- $message->id = $delivery->messageId;
530
- $contact->id = $delivery->recipients[0]['id'];
531
 
532
  try {
533
- $message->read();
534
- $contact->read();
 
 
535
 
536
  $this->_beforeSend($contact, $message);
537
  $this->_afterSend(true, null, $delivery);
@@ -592,19 +611,19 @@ class Bronto_Common_Model_Email_Template extends Mage_Core_Model_Email_Template
592
  }
593
 
594
  /**
595
- * @param Bronto_Api_Contact_Row $contact
596
- * @param Bronto_Api_Message_Row $message
597
  */
598
- protected function _beforeSend(Bronto_Api_Contact_Row $contact, Bronto_Api_Message_Row $message)
599
  {
600
  }
601
 
602
  /**
603
- * @param int $success
604
- * @param string $error
605
- * @param Bronto_Api_Delivery_Row $delivery
606
  */
607
- protected function _afterSend($success, $error = null, Bronto_Api_Delivery_Row $delivery = null)
608
  {
609
  }
610
  }
12
  protected $_helper = 'bronto_common';
13
 
14
  /**
15
+ * @var Bronto_Api_Model_Message
16
  */
17
  protected $_message;
18
 
29
  /**
30
  * Set the message
31
  *
32
+ * @param Bronto_Api_Model_Message $message
33
  */
34
+ public function setMessage(Bronto_Api_Model_Message $message)
35
  {
36
  $this->_message = $message;
37
  }
39
  /**
40
  * Get the message currently set
41
  *
42
+ * @return boolean|Bronto_Api_Model_Message False if no message is set
43
  */
44
  public function getMessage()
45
  {
70
 
71
  if (empty($this->_templateFilter)) {
72
  $this->_templateFilter = Mage::getModel('bronto_common/email_template_filter');
73
+ if (method_exists($this->_templateFilter, 'getInlineCssFile')) {
74
+ $this->_templateFilter
75
+ ->setUseAbsoluteLinks($this->getUseAbsoluteLinks())
76
+ ->setStoreId($this->getDesignConfig()->getStore());
77
+ }
78
  }
79
 
80
  return $this->_templateFilter;
150
  /**
151
  * Process email template code
152
  *
153
+ * @param Bronto_Api_Model_Delivery $delivery
154
  * @param array $variables
155
  *
156
+ * @return Bronto_Api_Model_Delivery
157
  */
158
+ public function getProcessedDelivery(Bronto_Api_Model_Delivery $delivery, array $variables = array())
159
  {
160
  $processor = $this->getTemplateFilter($variables['store']->getId());
161
 
167
  $processor->setMessageId($this->getBrontoMessageId());
168
  }
169
 
170
+ if (method_exists($this, '_addEmailVariables')) {
171
+ $variables = $this->_addEmailVariables($variables, $processor->getStoreId());
172
+ }
173
+
174
  $processor->setVariables($variables);
175
  $processor->setAvailable($this->getVariablesOptionArray());
176
 
177
+ $appEmu = Mage::getSingleton('core/app_emulation');
178
+ $emuInfo = $appEmu->startEnvironmentEmulation($processor->getStoreId(), 'frontend');
179
+ try {
180
+ $this->setInlineCssFile($this->getInlineCss());
181
+ $processor->setBaseTemplate($this);
182
+ $delivery = $processor->filter($delivery);
183
+ } catch (Exception $e) {
184
+ $appEmu->stopEnvironmentEmulation($emuInfo);
185
+ throw $e;
186
+ }
187
+ $appEmu->stopEnvironmentEmulation($emuInfo);
188
+ return $delivery;
189
  }
190
 
191
  /**
250
 
251
  $this->setSendQueue($queue);
252
  $this->setMessage($message);
253
+ $this->setBrontoMessageId($message->getId());
254
+ $this->setBrontoMessageName($message->getName());
255
  $this->setBrontoMessageApproved(1);
256
  $this->_setRelatedFields($queue);
257
 
263
  continue;
264
  }
265
  try {
266
+ $delivery = $queue->prepareDelivery()
267
+ ->withStart($this->_startTime($queue->getStoreId()))
268
+ ->addContact($contact->getId());
 
 
 
 
 
 
269
  $list = Mage::getModel('bronto_common/list', array(
270
  $this->_helper,
271
  $queue->getAdditionalData()->getExclusionList()
272
  ));
273
  $excludes = $list->addAdditionalRecipients($queue->getStoreId());
274
  foreach ($excludes as $exclude) {
275
+ $delivery->ineligibleList($exclude['id']);
 
 
 
 
 
 
 
 
 
276
  }
277
+ $queue->getDeliveryObject()->save($delivery);
278
+ $this->setLastDeliveryId($delivery->getId());
279
+ $this->_afterSend(true, null, $delivery);
280
  } catch (Exception $e) {
281
  $deliveryErrors++;
282
  $errorMessage = $e->getMessage();
283
+ if ($e->getCode() === 215) {
284
  // Replace message id with message name
285
  if (preg_match_all("/([a-zA-Z0-9\-]){36}/", $errorMessage, $matches)) { // Grab field id if exists
286
  foreach ($matches[0] as $match) {
287
+ $errorMessage = str_replace($match, $message->getName(), $errorMessage);
288
  }
289
  }
290
  }
292
  Mage::helper($this->_helper)->writeError($errorMessage);
293
  $this->_afterSend(false, $errorMessage, $delivery);
294
  }
295
+ $this->_flushLogs($queue->getDeliveryObject()->getApi());
296
  }
297
  return $deliveryErrors == 0;
298
  }
299
 
300
+ /**
301
+ * Write the API delivery flush
302
+ *
303
+ * @param Bronto_Api $api
304
+ */
305
+ protected function _flushLogs(Bronto_Api $api)
306
+ {
307
+ $helper = Mage::helper($this->_helper);
308
+ $apiLog = "{$this->_helper}_api.log";
309
+ $helper->writeVerboseDebug("===== {$helper->getName()} Delivery =====", $apiLog);
310
+ $helper->writeVerboseDebug(var_export($api->getLastRequest(), true), $apiLog);
311
+ $helper->writeVerboseDebug(var_export($api->getLastResponse(), true), $apiLog);
312
+ }
313
+
314
  /**
315
  * Send mail to recipient
316
  *
333
  return parent::send($email, $name, $variables);
334
  }
335
 
 
336
  $messageId = $this->getBrontoMessageId();
337
  $sendType = $this->getTemplateSendType();
338
+ if ($sendType != 'transactional') {
339
  $sendType = 'triggered';
340
  }
341
 
361
 
362
  $variables['email'] = reset($emails);
363
  $variables['name'] = reset($names);
364
+ $this->setUseAbsoluteLinks(true);
365
 
366
  $apiHelper = Mage::helper('bronto_common/api');
367
  $api = $apiHelper->getApi(null, 'store', $variables['store']->getId());
368
 
369
+ $delivery = $api->transferDelivery()->createObject();
370
  $delivery = $this->getProcessedDelivery($delivery, $variables);
371
  $this->_additionalFields($delivery, $variables);
372
  $productContext = Mage::helper('bronto_product')
393
  'fromEmail' => $this->getSenderEmail(),
394
  'fromName' => $this->getSenderName(),
395
  'replyEmail' => $this->getSenderEmail(),
396
+ ) + $delivery->toArray()
397
  );
398
 
399
  $queue = Mage::getModel('bronto_common/queue')
440
  return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
441
  } else {
442
  // If module enabled and template ID is not an instance of the api row, see if we can pull an instance
443
+ if (!($templateId instanceof Bronto_Api_Model_Message)) {
444
  $emailTemplate = Mage::getModel('bronto_email/template')
445
  ->setDesignConfig($this->getDesignConfig()->getData());
446
 
457
  return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
458
  }
459
 
460
+ $message = new Bronto_Api_Model_Message();
461
+ $message->withId($emailTemplate->getBrontoMessageId());
462
 
463
  // Send through main template model
464
  $emailTemplate->sendTransactional(
524
  public function setLastDeliveryId($deliveryId)
525
  {
526
  $this->_lastDeliveryId = $deliveryId;
 
527
  return $this;
528
  }
529
 
539
  * Allows the retryer to trigger
540
  *
541
  * @param Bronto_Api_Delivery $deliveryObject
542
+ * TODO: API fix
543
  */
544
+ public function triggerBeforeAfterSend(Bronto_Api_Operation_Delivery $deliveryOps, Bronto_Api_Model_Delivery $delivery)
545
  {
546
+ $contactObject = $deliveryOps->getApi()->transferContact();
547
+ $messageObject = $deliveryOps->getApi()->transferMessage();
 
 
 
 
 
 
548
 
549
  try {
550
+ $this->_flushLogs($deliveryOps->getApi());
551
+
552
+ $message = $messageObject->getById($delivery->getMessageId());
553
+ $contact = $contactObject->getById($delivery->recipients[0]['id']);
554
 
555
  $this->_beforeSend($contact, $message);
556
  $this->_afterSend(true, null, $delivery);
611
  }
612
 
613
  /**
614
+ * @param Bronto_Api_Model_Contact $contact
615
+ * @param Bronto_Api_Model_Message $message
616
  */
617
+ protected function _beforeSend(Bronto_Api_Model_Contact $contact, Bronto_Api_Model_Message $message)
618
  {
619
  }
620
 
621
  /**
622
+ * @param int $success
623
+ * @param string $error
624
+ * @param Bronto_Api_Model_Delivery $delivery
625
  */
626
+ protected function _afterSend($success, $error = null, Bronto_Api_Model_Delivery $delivery = null)
627
  {
628
  }
629
  }
app/code/community/Bronto/Common/Model/Email/Template/Filter.php CHANGED
@@ -43,13 +43,6 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
43
 
44
  protected $_items = array();
45
 
46
- /**
47
- * Assigned template variables
48
- *
49
- * @var array
50
- */
51
- protected $_variables = array();
52
-
53
  /**
54
  * Available template variables
55
  *
@@ -72,6 +65,8 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
72
  */
73
  protected $_queryParams = array();
74
 
 
 
75
  /**
76
  * Map of keys that we would rather have a pretty name for.
77
  * Rather than a 25 character truncated value.
@@ -114,6 +109,34 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
114
  return $this;
115
  }
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  /**
118
  * Filter using this recommendation
119
  *
@@ -169,8 +192,11 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
169
  }
170
  }
171
 
172
- $variable = implode('_', $parts);
173
- $this->_processedAvailable[] = $this->_camelize($variable);
 
 
 
174
 
175
  }
176
 
@@ -185,9 +211,9 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
185
  $this->_queryParams = array();
186
 
187
  // Add rule_id (if available)
188
- if (isset($this->_variables['rule'])) {
189
- if (class_exists('Bronto_Reminder_Model_Rule', false) && $this->_variables['rule'] instanceOf Bronto_Reminder_Model_Rule) {
190
- $this->_queryParams['rule_id'] = $this->_variables['rule']->getId();
191
  }
192
  }
193
 
@@ -206,7 +232,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
206
  */
207
  public function filter($delivery)
208
  {
209
- if (!$delivery instanceof Bronto_Api_Delivery_Row) {
210
  return parent::filter($delivery);
211
  }
212
 
@@ -216,7 +242,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
216
  $this->_processAvailable();
217
  $this->_processQueryParams();
218
 
219
- foreach ($this->_variables as $var => $value) {
220
 
221
  //
222
  // Handle strings
@@ -553,7 +579,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
553
 
554
  $this->_respectDesignTheme();
555
  $totals = $this->_getTotalsBlock(Mage::getSingleton('core/layout'), $order, 'sales/order_totals', 'order_totals');
556
- $this->setField('orderTotals', $totals->toHtml());
557
 
558
  $this->_filteredObjects[] = 'order';
559
  }
@@ -724,7 +750,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
724
  $items->setQuote($item->getQuote());
725
 
726
  $this->_respectDesignTheme();
727
- $this->setField("cartItems", $items->toHtml());
728
  }
729
 
730
  $this->_filteredObjects[] = 'quote';
@@ -807,7 +833,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
807
  $items->setWishlist($item->getWishlist());
808
 
809
  $this->_respectDesignTheme();
810
- $this->setField("wishlistItems", $items->toHtml());
811
  }
812
 
813
  $this->_filteredObjects[] = 'wishlist';
@@ -854,23 +880,10 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
854
  */
855
  protected function _filterOrderItems(Mage_Sales_Model_Order $order)
856
  {
857
- $layout = Mage::getSingleton('core/layout');
858
-
859
- /* @var $items Mage_Sales_Block_Items_Abstract */
860
- $items = $layout->createBlock('sales/order_email_items', 'items');
861
- $items->setTemplate('email/order/items.phtml');
862
- $items->setOrder($order);
863
-
864
- // Setup templates to use for products
865
- $items->addItemRender('default', 'sales/order_email_items_order_default', 'email/order/items/order/default.phtml');
866
- $items->addItemRender('grouped', 'sales/order_email_items_order_grouped', 'email/order/items/order/default.phtml');
867
- $items->addItemRender('bundle', 'bundle/sales_order_items_renderer', 'bundle/email/order/items/order/default.phtml');
868
-
869
- $this->_respectDesignTheme();
870
- $totals = $this->_getTotalsBlock($layout, $order, 'sales/order_totals', 'order_totals');
871
- $items->append($totals, 'order_totals');
872
-
873
- return $items->toHtml();
874
  }
875
 
876
  /**
@@ -937,25 +950,10 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
937
  */
938
  protected function _filterInvoiceItems(Mage_Sales_Model_Order_Invoice $invoice)
939
  {
940
- $order = $invoice->getOrder();
941
- $layout = Mage::getSingleton('core/layout');
942
-
943
- /* @var $items Mage_Sales_Block_Items_Abstract */
944
- $items = $layout->createBlock('sales/order_email_invoice_items', 'items');
945
- $items->setTemplate('email/order/invoice/items.phtml');
946
- $items->setOrder($order);
947
- $items->setInvoice($invoice);
948
-
949
- // Setup templates to use for products
950
- $items->addItemRender('default', 'sales/order_email_items_order_default', 'email/order/items/invoice/default.phtml');
951
- $items->addItemRender('grouped', 'sales/order_email_items_order_grouped', 'email/order/items/invoice/default.phtml');
952
- $items->addItemRender('bundle', 'bundle/sales_order_items_renderer', 'bundle/email/order/items/invoice/default.phtml');
953
-
954
- $this->_respectDesignTheme();
955
- $totals = $this->_getTotalsBlock($layout, $order, 'sales/order_invoice_totals', 'invoice_totals');
956
- $items->append($totals, 'invoice_totals');
957
-
958
- return $items->toHtml();
959
  }
960
 
961
  /**
@@ -1022,22 +1020,10 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
1022
  */
1023
  protected function _filterShipmentItems(Mage_Sales_Model_Order_Shipment $shipment)
1024
  {
1025
- $order = $shipment->getOrder();
1026
- $layout = Mage::getSingleton('core/layout');
1027
-
1028
- /* @var $items Mage_Sales_Block_Items_Abstract */
1029
- $items = $layout->createBlock('sales/order_email_shipment_items', 'items');
1030
- $items->setTemplate('email/order/shipment/items.phtml');
1031
- $items->setOrder($order);
1032
- $items->setShipment($shipment);
1033
-
1034
- // Setup templates to use for products
1035
- $items->addItemRender('default', 'sales/order_email_items_order_default', 'email/order/items/shipment/default.phtml');
1036
- $items->addItemRender('grouped', 'sales/order_email_items_order_grouped', 'email/order/items/shipment/default.phtml');
1037
- $items->addItemRender('bundle', 'bundle/sales_order_items_renderer', 'bundle/email/order/items/shipment/default.phtml');
1038
-
1039
- $this->_respectDesignTheme();
1040
- return $items->toHtml();
1041
  }
1042
 
1043
  /**
@@ -1054,7 +1040,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
1054
  $block->setShipment($shipment);
1055
  $block->setArea('frontend');
1056
 
1057
- return $block->toHtml();
1058
  }
1059
 
1060
  /**
@@ -1064,25 +1050,10 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
1064
  */
1065
  protected function _filterCreditmemoItems(Mage_Sales_Model_Order_Creditmemo $creditmemo)
1066
  {
1067
- $order = $creditmemo->getOrder();
1068
- $layout = Mage::getSingleton('core/layout');
1069
-
1070
- /* @var $items Mage_Sales_Block_Items_Abstract */
1071
- $items = $layout->createBlock('sales/order_email_creditmemo_items', 'items');
1072
- $items->setTemplate('email/order/creditmemo/items.phtml');
1073
- $items->setOrder($order);
1074
- $items->setCreditmemo($creditmemo);
1075
-
1076
- // Setup templates to use for products
1077
- $items->addItemRender('default', 'sales/order_email_items_order_default', 'email/order/items/creditmemo/default.phtml');
1078
- $items->addItemRender('grouped', 'sales/order_email_items_order_grouped', 'email/order/items/creditmemo/default.phtml');
1079
- $items->addItemRender('bundle', 'bundle/sales_order_items_renderer', 'bundle/email/order/items/creditmemo/default.phtml');
1080
-
1081
- $this->_respectDesignTheme();
1082
- $totals = $this->_getTotalsBlock($layout, $order, 'sales/order_creditmemo_totals', 'creditmemo_totals');
1083
- $items->append($totals, 'creditmemo_totals');
1084
-
1085
- return $items->toHtml();
1086
  }
1087
 
1088
  /**
@@ -1099,6 +1070,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
1099
  {
1100
  // Change this path for order totals
1101
  $templatePath = 'sales/order/totals.phtml';
 
1102
  switch ($totals_block_name) {
1103
  case 'creditmemo_totals':
1104
  case 'invoice_totals':
@@ -1106,6 +1078,7 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
1106
  // inplace of 'totals' here
1107
  $templatePath = str_replace('totals', $totals_block_name, $templatePath);
1108
  }
 
1109
 
1110
  $totals = $layout->createBlock($totals_block_type, $totals_block_name);
1111
  $totals->setOrder($order);
@@ -1267,14 +1240,14 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
1267
  $new_value .= $value['region'] . $delim;
1268
  $new_value .= $value['postcode'] . $delim;
1269
  $new_value .= $value['country_id'];
1270
- $this->_delivery->setField($key, $new_value, $type);
1271
  }
1272
  } else {
1273
  if (isset($this->_prettyMap[$key])) {
1274
  // Overwrite $key if we have a mapped overridden value
1275
  $key = $this->_prettyMap[$key];
1276
  }
1277
- $this->_delivery->setField($key, $value, $type);
1278
  }
1279
 
1280
  return $this;
@@ -1367,20 +1340,6 @@ class Bronto_Common_Model_Email_Template_Filter extends Mage_Core_Model_Email_Te
1367
  return $this->_messageId;
1368
  }
1369
 
1370
- /**
1371
- * @param array $variables
1372
- *
1373
- * @return Bronto_Common_Model_Email_Template_Filter
1374
- */
1375
- public function setVariables(array $variables)
1376
- {
1377
- foreach ($variables as $name => $value) {
1378
- $this->_variables[$name] = $value;
1379
- }
1380
-
1381
- return $this;
1382
- }
1383
-
1384
  /**
1385
  * @param array $variables
1386
  *
43
 
44
  protected $_items = array();
45
 
 
 
 
 
 
 
 
46
  /**
47
  * Available template variables
48
  *
65
  */
66
  protected $_queryParams = array();
67
 
68
+ protected $_baseTemplate;
69
+
70
  /**
71
  * Map of keys that we would rather have a pretty name for.
72
  * Rather than a 25 character truncated value.
109
  return $this;
110
  }
111
 
112
+ /**
113
+ * Sets the base template model for the processor
114
+ *
115
+ * @param Mage_Core_Model_Email_Template $_baseTemplate
116
+ * @return Bronto_Common_Model_Email_Template_Filter
117
+ */
118
+ public function setBaseTemplate($_baseTemplate)
119
+ {
120
+ $this->_baseTemplate = $_baseTemplate;
121
+ return $this;
122
+ }
123
+
124
+ /**
125
+ * Sets the inline CSS for this processor
126
+ *
127
+ * @param string $text
128
+ * @return string
129
+ */
130
+ protected function _applyInlineCssStyles($text)
131
+ {
132
+ if (method_exists($this->_baseTemplate, 'getInlineCssFile')) {
133
+ $stripDocType = preg_replace('/^<!DOCTYPE.+?>/', '', $this->_baseTemplate->getPreparedTemplateText($text));
134
+ $stripHtmlBody = preg_replace('/<html(?:[^>]+)>|<body(?:[^>]+)>/', '', $stripDocType);
135
+ return str_replace(array('</html>', '</body>'), array('', ''), $stripHtmlBody);
136
+ }
137
+ return $text;
138
+ }
139
+
140
  /**
141
  * Filter using this recommendation
142
  *
192
  }
193
  }
194
 
195
+ $variable = $this->_camelize(implode('_', $parts));
196
+ if (strlen($variable) > 25) {
197
+ $variable = substr($variable, 0, 25);
198
+ }
199
+ $this->_processedAvailable[] = $variable;
200
 
201
  }
202
 
211
  $this->_queryParams = array();
212
 
213
  // Add rule_id (if available)
214
+ if (isset($this->_templateVars['rule'])) {
215
+ if (class_exists('Bronto_Reminder_Model_Rule', false) && $this->_templateVars['rule'] instanceOf Bronto_Reminder_Model_Rule) {
216
+ $this->_queryParams['rule_id'] = $this->_templateVars['rule']->getId();
217
  }
218
  }
219
 
232
  */
233
  public function filter($delivery)
234
  {
235
+ if (!$delivery instanceof Bronto_Api_Model_Delivery) {
236
  return parent::filter($delivery);
237
  }
238
 
242
  $this->_processAvailable();
243
  $this->_processQueryParams();
244
 
245
+ foreach ($this->_templateVars as $var => $value) {
246
 
247
  //
248
  // Handle strings
579
 
580
  $this->_respectDesignTheme();
581
  $totals = $this->_getTotalsBlock(Mage::getSingleton('core/layout'), $order, 'sales/order_totals', 'order_totals');
582
+ $this->setField('orderTotals', $this->_applyInlineCssStyles($totals->toHtml()));
583
 
584
  $this->_filteredObjects[] = 'order';
585
  }
750
  $items->setQuote($item->getQuote());
751
 
752
  $this->_respectDesignTheme();
753
+ $this->setField("cartItems", $this->_applyInlineCssStyles($items->toHtml()));
754
  }
755
 
756
  $this->_filteredObjects[] = 'quote';
833
  $items->setWishlist($item->getWishlist());
834
 
835
  $this->_respectDesignTheme();
836
+ $this->setField("wishlistItems", $this->_applyInlineCssStyles($items->toHtml()));
837
  }
838
 
839
  $this->_filteredObjects[] = 'wishlist';
880
  */
881
  protected function _filterOrderItems(Mage_Sales_Model_Order $order)
882
  {
883
+ $html = parent::layoutDirective(array(
884
+ 2 => ' handle="sales_email_order_items" order=$order'
885
+ ));
886
+ return $this->_applyInlineCssStyles($html);
 
 
 
 
 
 
 
 
 
 
 
 
 
887
  }
888
 
889
  /**
950
  */
951
  protected function _filterInvoiceItems(Mage_Sales_Model_Order_Invoice $invoice)
952
  {
953
+ $html = parent::layoutDirective(array(
954
+ 2 => ' area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order'
955
+ ));
956
+ return $this->_applyInlineCssStyles($html);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
957
  }
958
 
959
  /**
1020
  */
1021
  protected function _filterShipmentItems(Mage_Sales_Model_Order_Shipment $shipment)
1022
  {
1023
+ $html = parent::layoutDirective(array(
1024
+ 2 => ' handle="sales_email_order_shipment_items" shipment=$shipment order=$order'
1025
+ ));
1026
+ return $this->_applyInlineCssStyles($html);
 
 
 
 
 
 
 
 
 
 
 
 
1027
  }
1028
 
1029
  /**
1040
  $block->setShipment($shipment);
1041
  $block->setArea('frontend');
1042
 
1043
+ return $this->_applyInlineCssStyles($block->toHtml());
1044
  }
1045
 
1046
  /**
1050
  */
1051
  protected function _filterCreditmemoItems(Mage_Sales_Model_Order_Creditmemo $creditmemo)
1052
  {
1053
+ $html = parent::layoutDirective(array(
1054
+ 2 => ' handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order'
1055
+ ));
1056
+ return $this->_applyInlineCssStyles($html);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1057
  }
1058
 
1059
  /**
1070
  {
1071
  // Change this path for order totals
1072
  $templatePath = 'sales/order/totals.phtml';
1073
+ /*
1074
  switch ($totals_block_name) {
1075
  case 'creditmemo_totals':
1076
  case 'invoice_totals':
1078
  // inplace of 'totals' here
1079
  $templatePath = str_replace('totals', $totals_block_name, $templatePath);
1080
  }
1081
+ */
1082
 
1083
  $totals = $layout->createBlock($totals_block_type, $totals_block_name);
1084
  $totals->setOrder($order);
1240
  $new_value .= $value['region'] . $delim;
1241
  $new_value .= $value['postcode'] . $delim;
1242
  $new_value .= $value['country_id'];
1243
+ $this->_delivery->withField($key, $new_value, $type);
1244
  }
1245
  } else {
1246
  if (isset($this->_prettyMap[$key])) {
1247
  // Overwrite $key if we have a mapped overridden value
1248
  $key = $this->_prettyMap[$key];
1249
  }
1250
+ $this->_delivery->withField($key, $value, $type);
1251
  }
1252
 
1253
  return $this;
1340
  return $this->_messageId;
1341
  }
1342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1343
  /**
1344
  * @param array $variables
1345
  *
app/code/community/Bronto/Common/Model/Email/Template/Templatefilter.php CHANGED
@@ -237,11 +237,6 @@ class Bronto_Common_Model_Email_Template_Templatefilter extends Mage_Core_Model_
237
  return $value;
238
  }
239
 
240
- public function includeDirective($construction)
241
- {
242
- return '';
243
- }
244
-
245
  public function dependDirective($construction)
246
  {
247
  return $this->filter($construction[2]);
@@ -272,6 +267,10 @@ class Bronto_Common_Model_Email_Template_Templatefilter extends Mage_Core_Model_
272
 
273
  protected function _addBrontoStyle($string)
274
  {
275
- return '%%#' . $this->_camelize($string) . '%%';
 
 
 
 
276
  }
277
  }
237
  return $value;
238
  }
239
 
 
 
 
 
 
240
  public function dependDirective($construction)
241
  {
242
  return $this->filter($construction[2]);
267
 
268
  protected function _addBrontoStyle($string)
269
  {
270
+ $variable = $this->_camelize($string);
271
+ if (strlen($variable) > 25) {
272
+ $variable = substr($variable, 0, 25);
273
+ }
274
+ return '%%#' . $variable . '%%';
275
  }
276
  }
app/code/community/Bronto/Common/Model/Error.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Bronto_Common_Model_Error extends Mage_Core_Model_Abstract implements Bronto_Util_Retryer_RetryerInterface
4
  {
5
  protected $_api;
6
 
@@ -13,54 +13,24 @@ class Bronto_Common_Model_Error extends Mage_Core_Model_Abstract implements Bron
13
  $this->_init('bronto_common/error');
14
  }
15
 
16
- /**
17
- * @param Bronto_Api
18
- * @return Bronto_Common_Model_Error
19
- */
20
- public function setClient(Bronto_Api $api)
21
- {
22
- $this->_api = $api;
23
- return $this;
24
- }
25
-
26
- /**
27
- * Gets the API client matching this token
28
- *
29
- * @param string $token
30
- * @return Bronto_Api
31
- */
32
- protected function _client($token)
33
- {
34
- if (empty($this->_api) || $this->_api->getToken() != $token) {
35
- $this->setClient(Mage::helper('bronto_common')->getApi($token));
36
- }
37
-
38
- return $this->_api;
39
- }
40
-
41
  /**
42
  * @see parent
43
  *
44
- * @param Bronto_Api_Object $object
 
45
  * @param int $attempts
46
  * @return int|false
47
  */
48
- public function store(Bronto_Api_Object $object, $attempts = 0)
49
  {
50
  // Only deliveries are retried
51
- if ($object instanceOf Bronto_Api_Delivery) {
52
  if ($this->hasId() && empty($attempts)) {
53
- $this
54
- ->unsId()
55
- ->unsEmailClass();
56
- }
57
- // Retry for an email template
58
- if (method_exists($object, 'getEmailClass')) {
59
- $this->setEmailClass($object->getEmailClass());
60
  }
61
  try {
62
  $this
63
- ->setObject(serialize($object))
64
  ->setAttempts($attempts)
65
  ->setLastAttempt(Mage::getSingleton('core/date')->gmtDate())
66
  ->save();
@@ -73,19 +43,6 @@ class Bronto_Common_Model_Error extends Mage_Core_Model_Abstract implements Bron
73
  }
74
  }
75
 
76
- /**
77
- * Restores the serialized object to its former glory
78
- *
79
- * @return Bronto_Api_Delivery
80
- */
81
- public function restoreObject()
82
- {
83
- $delivery = unserialize($this->getObject());
84
- // Restore the API in all of its glory
85
- $delivery->setApi($this->_client($delivery->getApi()->getToken()));
86
- return $delivery;
87
- }
88
-
89
  /**
90
  * @see parent
91
  *
@@ -94,21 +51,26 @@ class Bronto_Common_Model_Error extends Mage_Core_Model_Abstract implements Bron
94
  */
95
  public function attempt($identifier)
96
  {
97
- $delivery = $this->restoreObject();
98
- $method = $delivery->getLastRequestMethod();
99
- $data = $delivery->getLastRequestData();
100
 
101
  try {
102
- $rowset = $delivery->doRequest($method, $data, true);
103
  $this->delete();
104
- if ($this->hasEmailClass()) {
105
- // Tie in the request data with a new id
106
- $deliveryRow = $delivery->createRow(array('id' => $rowset->current()->id) + $data[0]);
107
- $email = Mage::getModel($this->getEmailClass());
108
- $email->triggerBeforeAfterSend($deliveryRow);
 
 
 
 
 
 
 
109
  }
110
  } catch (Exception $e) {
111
- $this->store($delivery, $this->getAttempts() + 1);
112
  return false;
113
  }
114
 
1
  <?php
2
 
3
+ class Bronto_Common_Model_Error extends Mage_Core_Model_Abstract implements Bronto_Api_Retryer
4
  {
5
  protected $_api;
6
 
13
  $this->_init('bronto_common/error');
14
  }
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /**
17
  * @see parent
18
  *
19
+ * @param Bronto_Object $object
20
+ * @param string $apiToken
21
  * @param int $attempts
22
  * @return int|false
23
  */
24
+ public function store(Bronto_Object $object, $apiToken, $attempts = 0)
25
  {
26
  // Only deliveries are retried
27
+ if ($object->getTransferType() == 'Delivery') {
28
  if ($this->hasId() && empty($attempts)) {
29
+ $this->unsId();
 
 
 
 
 
 
30
  }
31
  try {
32
  $this
33
+ ->setObject(serialize($object->withToken($apiToken)))
34
  ->setAttempts($attempts)
35
  ->setLastAttempt(Mage::getSingleton('core/date')->gmtDate())
36
  ->save();
43
  }
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * @see parent
48
  *
51
  */
52
  public function attempt($identifier)
53
  {
54
+ $request = unserialize($this->getObject());
55
+ $api = new Bronto_Api($request->getToken());
 
56
 
57
  try {
 
58
  $this->delete();
59
+ $deliveryOps = $api->transferDelivery();
60
+ foreach ($deliveryOps->createWritePager($request) as $result) {
61
+ $delivery = $result->getOriginal();
62
+ $item = $result->getItem();
63
+ if ($item->getIsError()) {
64
+ Mage::throwException("Failed to send failed delivery {$item->getErrorString()}");
65
+ }
66
+ if ($delivery->hasEmailClass()) {
67
+ $delivery->withId($item->getId());
68
+ $email = Mage::getModel($delivery->getEmailClass());
69
+ $email->triggerBeforeAfterSend($deliveryOps, $delivery);
70
+ }
71
  }
72
  } catch (Exception $e) {
73
+ $this->store($delivery, $request->getToken(), $this->getAttempts() + 1);
74
  return false;
75
  }
76
 
app/code/community/Bronto/Common/Model/Flusher.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bronto_Common_Model_Flusher implements Bronto_Api_Write_Flusher
4
+ {
5
+ private $_result;
6
+ private $_helper;
7
+
8
+ public function __construct()
9
+ {
10
+ $this->_result = new Bronto_Object(array(
11
+ 'success' => 0,
12
+ 'error' => 0,
13
+ 'total' => 0
14
+ ));
15
+ }
16
+
17
+ /**
18
+ * @see parent
19
+ */
20
+ public function onFlush($iterator)
21
+ {
22
+ $now = Mage::getSingleton('core/date')->gmtDate();
23
+ try {
24
+ foreach ($iterator as $result) {
25
+ $queueRow = $this->_queueEntry($result->getOriginal()->getQueueRow());
26
+ $item = $result->getItem();
27
+ if ($item->getIsError()) {
28
+ $queueRow
29
+ ->setBrontoImported(null)
30
+ ->setBrontoSuppressed("{$item->getErrorCode()}: {$item->getErrorString()}");
31
+ $this->_result->incrementError();
32
+ } else {
33
+ $queueRow
34
+ ->setBrontoImported($now)
35
+ ->setBrontoSuppressed(null);
36
+ $this->_result->incrementSuccess();
37
+ }
38
+ $queueRow->save();
39
+ $this->_result->incrementTotal();
40
+ }
41
+ $this->_flushLogs($iterator->getOperation()->getApi());
42
+ } catch (InvalidArgumentException $iae) {
43
+ Mage::helper($this->_helper)->writeDebug("Client error: {$iae->getMessage()}");
44
+ } catch (Exception $e) {
45
+ $request = $iterator->getRequest();
46
+ $requestData = $request->getData();
47
+ $objects = $requestData[$request->getKey()];
48
+ switch ($e->getCode()) {
49
+ case 107:
50
+ foreach ($objects as $object) {
51
+ $queueRow = $this->_queueEntry($object->getQueueRow());
52
+ try {
53
+ $iterator->getOperation()->getApi()->execute(new Bronto_Object(array(
54
+ 'method' => $request->getMethod(),
55
+ 'data' => array($request->getKey() => array($object)),
56
+ 'hasUpdates' => true
57
+ )));
58
+ $queueRow
59
+ ->setBrontoImported($now)
60
+ ->setBrontoSuppressed(null);
61
+ $this->_result->incrementSuccess();
62
+ } catch (Exception $e) {
63
+ $queueRow
64
+ ->setBrontoImported(null)
65
+ ->setBrontoSuppressed("Failed to process contact.");
66
+ $this->_result->incrementError();
67
+ }
68
+ $queueRow->save();
69
+ $this->_result->incrementTotal();
70
+ $this->_flushLogs($iterator->getOperation()->getApi());
71
+ }
72
+ break;
73
+ default:
74
+ if ($e->getCode() > 200) {
75
+ foreach ($objects as $object) {
76
+ $this->_queueEntry($object->getQueueRow())
77
+ ->setBrontoImported(null)
78
+ ->setBrontoSuppressed($e->getMessage())
79
+ ->save();
80
+ $this->_result->incrementError();
81
+ $this->_result->incrementTotal();
82
+ }
83
+ }
84
+ Mage::helper($this->_helper)->writeError($e);
85
+ $this->_flushLogs($iterator->getOperation()->getApi());
86
+ }
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Extracts entry and returns the original queue model
92
+ *
93
+ * @return mixed
94
+ */
95
+ protected function _queueEntry($originalRow)
96
+ {
97
+ $queueRow = Mage::getModel("{$this->_helper}/queue");
98
+ $queueRow->setData($originalRow);
99
+ return $queueRow;
100
+ }
101
+
102
+ /**
103
+ * Verbose log the API flush
104
+ *
105
+ * @param Bronto_Api $api
106
+ */
107
+ protected function _flushLogs($api)
108
+ {
109
+ $helper = Mage::helper($this->_helper);
110
+ $apiLog = "{$this->_helper}_api.log";
111
+ $helper->writeVerboseDebug("===== FLUSH =====", $apiLog);
112
+ $helper->writeVerboseDebug(var_export($api->getLastRequest(), true), $apiLog);
113
+ $helper->writeVerboseDebug(var_export($api->getLastResponse(), true), $apiLog);
114
+ }
115
+
116
+ /**
117
+ * Gets the cached results from the consequtive write calls
118
+ *
119
+ * @return array
120
+ */
121
+ public function getResult()
122
+ {
123
+ return $this->_result->toArray();
124
+ }
125
+
126
+ /**
127
+ * @return
128
+ */
129
+ public function setHelper($helperName)
130
+ {
131
+ $this->_helper = $helperName;
132
+ return $this;
133
+ }
134
+ }
app/code/community/Bronto/Common/Model/Keysentry.php CHANGED
@@ -80,9 +80,6 @@ class Bronto_Common_Model_Keysentry extends Mage_Core_Model_Abstract
80
  Mage::helper(self::COUPON)->disableModule($scope, $scopeId, $deleteChildren);
81
  Mage::helper(self::API)->disableModule($scope, $scopeId, $deleteChildren);
82
 
83
- Mage::getConfig()->reinit();
84
- Mage::app()->reinitStores();
85
-
86
  // Get Child Items
87
  if ('website' == $scope) {
88
  $website = Mage::app()->getWebsite($scopeId);
80
  Mage::helper(self::COUPON)->disableModule($scope, $scopeId, $deleteChildren);
81
  Mage::helper(self::API)->disableModule($scope, $scopeId, $deleteChildren);
82
 
 
 
 
83
  // Get Child Items
84
  if ('website' == $scope) {
85
  $website = Mage::app()->getWebsite($scopeId);
app/code/community/Bronto/Common/Model/Observer.php CHANGED
@@ -49,6 +49,9 @@ class Bronto_Common_Model_Observer
49
  $scopeId
50
  );
51
  }
 
 
 
52
  }
53
 
54
  /**
49
  $scopeId
50
  );
51
  }
52
+
53
+ Mage::getConfig()->reinit();
54
+ Mage::app()->reinitStores();
55
  }
56
 
57
  /**
app/code/community/Bronto/Common/Model/Queue.php CHANGED
@@ -10,12 +10,7 @@ class Bronto_Common_Model_Queue extends Mage_Core_Model_Abstract
10
  protected $_api;
11
 
12
  /**
13
- * @var Bronto_Api_Delivery_Object
14
- */
15
- protected $_deliveryObject;
16
-
17
- /**
18
- * @var array Bronto_Api_Contact_Row
19
  */
20
  protected $_contacts;
21
 
@@ -24,6 +19,11 @@ class Bronto_Common_Model_Queue extends Mage_Core_Model_Abstract
24
  */
25
  protected $_message;
26
 
 
 
 
 
 
27
  /**
28
  * @var array
29
  */
@@ -83,17 +83,12 @@ class Bronto_Common_Model_Queue extends Mage_Core_Model_Abstract
83
  }
84
 
85
  /**
86
- * Gets the delivery object for this delivery
87
- *
88
- * @return Bronto_Api_Delivery_Object
89
  */
90
- protected function _deliveryObject()
91
  {
92
  if (is_null($this->_deliveryObject)) {
93
- $this->_deliveryObject = Mage::getModel('bronto_common/delivery', array(
94
- 'api' => $this->_api(),
95
- 'email_class' => $this->getEmailClass()
96
- ));
97
  }
98
  return $this->_deliveryObject;
99
  }
@@ -173,14 +168,15 @@ class Bronto_Common_Model_Queue extends Mage_Core_Model_Abstract
173
  }
174
 
175
  /**
176
- * Creates a Bronto_Api_Delivery_Row from internals
177
  *
178
  * @param array $additionalFields
179
- * @return Bronto_Api_Delivery_Row
180
  */
181
  public function prepareDelivery($additionalFields = array())
182
  {
183
- $delivery = $this->_deliveryObject()->createRow();
 
184
  $deliveryData = $this->getUnserializedEmailData()->getDelivery();
185
  foreach ($deliveryData as $field => $value) {
186
  if ($field == 'fields' && !empty($additionalFields)) {
10
  protected $_api;
11
 
12
  /**
13
+ * @var array Bronto_Api_Model_Contact
 
 
 
 
 
14
  */
15
  protected $_contacts;
16
 
19
  */
20
  protected $_message;
21
 
22
+ /**
23
+ * @var Bronto_Api_Operation_Delivery
24
+ */
25
+ protected $_deliveryObject;
26
+
27
  /**
28
  * @var array
29
  */
83
  }
84
 
85
  /**
86
+ * @return Bronto_Api_Operation_Delivery
 
 
87
  */
88
+ public function getDeliveryObject()
89
  {
90
  if (is_null($this->_deliveryObject)) {
91
+ $this->_deliveryObject = $this->_api()->transferDelivery();
 
 
 
92
  }
93
  return $this->_deliveryObject;
94
  }
168
  }
169
 
170
  /**
171
+ * Creates a Bronto_Api_Model_Delivery from internals
172
  *
173
  * @param array $additionalFields
174
+ * @return Bronto_Api_Model_Delivery
175
  */
176
  public function prepareDelivery($additionalFields = array())
177
  {
178
+ $delivery = $this->getDeliveryObject()->createObject()
179
+ ->withEmailClass($this->getEmailClass());
180
  $deliveryData = $this->getUnserializedEmailData()->getDelivery();
181
  foreach ($deliveryData as $field => $value) {
182
  if ($field == 'fields' && !empty($additionalFields)) {
app/code/community/Bronto/Common/Model/System/Config/Backend/Token.php CHANGED
@@ -92,5 +92,8 @@ class Bronto_Common_Model_System_Config_Backend_Token extends Mage_Core_Model_Co
92
  $this->getScopeId()
93
  );
94
  }
 
 
 
95
  }
96
  }
92
  $this->getScopeId()
93
  );
94
  }
95
+
96
+ Mage::getConfig()->reinit();
97
+ Mage::app()->reinitStores();
98
  }
99
  }
app/code/community/Bronto/Common/Model/System/Config/Source/Field.php CHANGED
@@ -23,11 +23,11 @@ class Bronto_Common_Model_System_Config_Source_Field
23
  try {
24
  if ($api = Mage::helper('bronto_common')->getApi()) {
25
  /* @var $fieldObject Bronto_Api_Field */
26
- $fieldObject = $api->getFieldObject();
27
- foreach ($fieldObject->readAll()->iterate() as $field/* @var $field Bronto_Api_Field_Row */) {
28
  $this->_options[] = array(
29
- 'value' => $field->id,
30
- 'label' => $field->label,
31
  );
32
  }
33
  }
@@ -59,13 +59,7 @@ class Bronto_Common_Model_System_Config_Source_Field
59
  {
60
  try {
61
  if ($api = Mage::helper('bronto_common')->getApi()) {
62
- /* @var $fieldObject Bronto_Api_Field */
63
- $fieldObject = $api->getFieldObject();
64
- foreach ($fieldObject->readAll()->iterate() as $field/* @var $field Bronto_Api_Field_Row */) {
65
- if ($field->id == $id) {
66
- return $field;
67
- }
68
- }
69
  }
70
  } catch (Exception $e) {
71
  Mage::helper('bronto_common')->writeError($e);
23
  try {
24
  if ($api = Mage::helper('bronto_common')->getApi()) {
25
  /* @var $fieldObject Bronto_Api_Field */
26
+ $fieldObject = $api->transferField();
27
+ foreach ($fieldObject->read() as $field) {
28
  $this->_options[] = array(
29
+ 'value' => $field->getId(),
30
+ 'label' => $field->getLabel(),
31
  );
32
  }
33
  }
59
  {
60
  try {
61
  if ($api = Mage::helper('bronto_common')->getApi()) {
62
+ return $api->transferField()->getById($id);
 
 
 
 
 
 
63
  }
64
  } catch (Exception $e) {
65
  Mage::helper('bronto_common')->writeError($e);
app/code/community/Bronto/Common/Model/System/Config/Source/List.php CHANGED
@@ -22,11 +22,11 @@ class Bronto_Common_Model_System_Config_Source_List
22
  self::$_options[$token] = array();
23
  try {
24
  if ($api = Mage::helper('bronto_common')->getApi($token)) {
25
- $listObject = $api->getListObject();
26
- foreach ($listObject->readAll()->iterate() as $list) {
27
  self::$_options[$token][] = array(
28
- 'value' => $list->id,
29
- 'label' => $list->label,
30
  );
31
  }
32
  }
22
  self::$_options[$token] = array();
23
  try {
24
  if ($api = Mage::helper('bronto_common')->getApi($token)) {
25
+ $listObject = $api->transferMailList();
26
+ foreach ($listObject->read() as $list) {
27
  self::$_options[$token][] = array(
28
+ 'value' => $list->getId(),
29
+ 'label' => $list->getLabel(),
30
  );
31
  }
32
  }
app/code/community/Bronto/Common/Model/System/Config/Source/Message.php CHANGED
@@ -22,19 +22,19 @@ class Bronto_Common_Model_System_Config_Source_Message
22
  {
23
  $helper = Mage::helper('bronto_common');
24
  $key = empty($token) ? $helper->getApiToken() : $token;
25
- if (!isset(self::$_options[$key])) {
26
  self::$_options[$key] = array();
27
  try {
28
  if ($api = Mage::helper('bronto_common')->getApi($key)) {
29
  /* @var $messageObject Bronto_Api_Message */
30
- $messageObject = $api->getMessageObject();
31
- foreach ($messageObject->readAll()->iterate() as $message) {
32
  $_option = array(
33
- 'label' => $message->name,
34
- 'value' => $message->id,
35
  );
36
 
37
- if ($message->status != 'active') {
38
  $_option['disabled'] = true;
39
  }
40
 
22
  {
23
  $helper = Mage::helper('bronto_common');
24
  $key = empty($token) ? $helper->getApiToken() : $token;
25
+ if (!array_key_exists($key, self::$_options)) {
26
  self::$_options[$key] = array();
27
  try {
28
  if ($api = Mage::helper('bronto_common')->getApi($key)) {
29
  /* @var $messageObject Bronto_Api_Message */
30
+ $messageObject = $api->transferMessage();
31
+ foreach ($messageObject->read()->withIncludeContent(false) as $message) {
32
  $_option = array(
33
+ 'label' => $message->getName(),
34
+ 'value' => $message->getId(),
35
  );
36
 
37
+ if ($message->getStatus() != 'active') {
38
  $_option['disabled'] = true;
39
  }
40
 
app/code/community/Bronto/Common/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Bronto_Common>
5
- <version>2.4.1</version>
6
  </Bronto_Common>
7
  </modules>
8
  <global>
@@ -144,9 +144,7 @@
144
  <notices>0</notices>
145
  </settings>
146
  <format>
147
- <image_type>small_image</image_type>
148
- <image_width>88</image_width>
149
- <image_height>77</image_height>
150
  <default_greeting>Valued Customer</default_greeting>
151
  <default_greeting_prefix></default_greeting_prefix>
152
  <default_greeting_firstname></default_greeting_firstname>
@@ -195,7 +193,7 @@
195
  <limit>50</limit>
196
  </queue_settings>
197
  <soap_options>
198
- <soap_client>Bronto_SoapClient</soap_client>
199
  <observer>Bronto_Common_Model_Api</observer>
200
  <retryer>Bronto_Common_Model_Error</retryer>
201
  <stream_context>0</stream_context>
2
  <config>
3
  <modules>
4
  <Bronto_Common>
5
+ <version>2.4.2</version>
6
  </Bronto_Common>
7
  </modules>
8
  <global>
144
  <notices>0</notices>
145
  </settings>
146
  <format>
147
+ <image_type>image</image_type>
 
 
148
  <default_greeting>Valued Customer</default_greeting>
149
  <default_greeting_prefix></default_greeting_prefix>
150
  <default_greeting_firstname></default_greeting_firstname>
193
  <limit>50</limit>
194
  </queue_settings>
195
  <soap_options>
196
+ <soap_client>SoapClient</soap_client>
197
  <observer>Bronto_Common_Model_Api</observer>
198
  <retryer>Bronto_Common_Model_Error</retryer>
199
  <stream_context>0</stream_context>
app/code/community/Bronto/Common/etc/system.xml CHANGED
@@ -1007,7 +1007,6 @@
1007
  <show_in_default>1</show_in_default>
1008
  <show_in_website>1</show_in_website>
1009
  <show_in_store>1</show_in_store>
1010
- <default_value>small_image</default_value>
1011
  <comment>The product image to use.</comment>
1012
  </image_type>
1013
  <image_width>
@@ -1018,7 +1017,6 @@
1018
  <show_in_default>1</show_in_default>
1019
  <show_in_website>1</show_in_website>
1020
  <show_in_store>1</show_in_store>
1021
- <default_value>88</default_value>
1022
  <comment>Product image width in pixels.</comment>
1023
  </image_width>
1024
  <image_height>
@@ -1029,7 +1027,6 @@
1029
  <show_in_default>1</show_in_default>
1030
  <show_in_website>1</show_in_website>
1031
  <show_in_store>1</show_in_store>
1032
- <default_value>77</default_value>
1033
  <comment>Product image height in pixels.</comment>
1034
  </image_height>
1035
  <default_greeting>
1007
  <show_in_default>1</show_in_default>
1008
  <show_in_website>1</show_in_website>
1009
  <show_in_store>1</show_in_store>
 
1010
  <comment>The product image to use.</comment>
1011
  </image_type>
1012
  <image_width>
1017
  <show_in_default>1</show_in_default>
1018
  <show_in_website>1</show_in_website>
1019
  <show_in_store>1</show_in_store>
 
1020
  <comment>Product image width in pixels.</comment>
1021
  </image_width>
1022
  <image_height>
1027
  <show_in_default>1</show_in_default>
1028
  <show_in_website>1</show_in_website>
1029
  <show_in_store>1</show_in_store>
 
1030
  <comment>Product image height in pixels.</comment>
1031
  </image_height>
1032
  <default_greeting>
app/code/community/Bronto/Common/sql/bronto_common_setup/mysql4-install-2.4.2.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ try {
8
+ $installer->createTables();
9
+ } catch (Exception $e) {
10
+ Mage::helper('bronto_common')->writeError($e->getMessage());
11
+ }
12
+
13
+ $installer->endSetup();
app/code/community/Bronto/Common/sql/bronto_common_setup/mysql4-upgrade-2.4.0-2.4.2.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+ $installer->resubmitFormInfo();
7
+ $installer->endSetup();
app/code/community/Bronto/Customer/Helper/Data.php CHANGED
@@ -304,18 +304,9 @@ class Bronto_Customer_Helper_Data extends Bronto_Common_Helper_Data implements B
304
  */
305
  public function getAttributeAdminLabel($attribute, $attributeValueId)
306
  {
307
- $_collection = Mage::getResourceModel('eav/entity_attribute_option_collection')
308
- ->setStoreFilter(0)
309
- ->setAttributeFilter($attribute->getId())
310
- ->load();
311
-
312
- foreach ($_collection->toOptionArray() as $_cur_option) {
313
- if ($_cur_option['value'] == $attributeValueId) {
314
- return $_cur_option['label'];
315
- }
316
-
317
  }
318
-
319
  return false;
320
  }
321
 
304
  */
305
  public function getAttributeAdminLabel($attribute, $attributeValueId)
306
  {
307
+ if ($attribute->getFrontendInput() == 'select') {
308
+ return $attribute->getSource()->getOptionText($attributeValueId);
 
 
 
 
 
 
 
 
309
  }
 
310
  return false;
311
  }
312
 
app/code/community/Bronto/Customer/Model/Observer.php CHANGED
@@ -45,23 +45,23 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
45
  $store = Mage::app()->getStore($storeId);
46
  $storeId = $store->getId();
47
 
48
- $result = array('total' => 0, 'success' => 0, 'error' => 0);
49
  Mage::helper('bronto_customer')->writeDebug("Starting Customer Import process for store: {$store->getName()} ({$storeId})");
50
 
51
  if (!$store->getConfig(Bronto_Customer_Helper_Data::XML_PATH_ENABLED)) {
52
  Mage::helper('bronto_customer')->writeDebug(' Module disabled for this store. Skipping...');
53
 
54
- return false;
55
  }
56
 
57
  // Retrieve Store's configured API Token
58
  $token = $store->getConfig(Bronto_Common_Helper_Data::XML_PATH_API_TOKEN);
59
 
60
  /** @var Bronto_Common_Model_Api $api */
61
- $api = Mage::helper('bronto_customer')->getApi($token);
62
 
63
- /** @var Bronto_Api_Contact $contactObject */
64
- $contactObject = $api->getContactObject();
65
 
66
  // Get all customers in queue who haven't been imported into bronto
67
  $customerRows = Mage::getModel('bronto_customer/queue')
@@ -76,7 +76,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
76
  if (empty($customerRows)) {
77
  Mage::helper('bronto_customer')->writeVerboseDebug(' No Customers to process. Skipping...');
78
 
79
- return $result;
80
  }
81
 
82
  /** @var Mage_Customer_Model_Entity_Attribute_Collection $customerAttributes */
@@ -84,19 +84,19 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
84
  /** @var Mage_Customer_Model_Entity_Address_Attribute_Collection $addressAttributes */
85
  $addressAttributes = Mage::getModel('customer/entity_address_attribute_collection')->addVisibleFilter();
86
  $this->_buildValidFieldMapForStore($store, $customerAttributes, $addressAttributes);
87
- $customerCache = array();
 
88
 
89
  // For each Customer...
90
  foreach ($customerRows as $customerRow) {
91
  $customerId = $customerRow->getCustomerId();
92
  if ($customer = Mage::getModel('customer/customer')->load($customerId)/* @var $customer Mage_Customer_Model_Customer */) {
93
  Mage::helper('bronto_customer')->writeDebug(" Processing Customer ID: {$customerId} for Store ID: {$storeId}");
94
- $customerCache[] = array('customerId' => $customerId, 'storeId' => $storeId);
95
-
96
- /** @var Bronto_Api_Contact_Row $brontoContact */
97
- $brontoContact = $contactObject->createRow(array());
98
- $brontoContact->email = $customer->getEmail();
99
 
 
 
 
 
100
  /* Process Customer Attributes */
101
  try {
102
  $brontoContact = $this->_processAttributes($brontoContact, $customer, $customerAttributes, $store, 'customer');
@@ -109,34 +109,15 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
109
  }
110
  }
111
 
112
- $brontoContact->persist();
113
  } catch (Exception $e) {
114
  Mage::helper('bronto_customer')->writeError($e);
115
  }
116
-
117
- $result['total']++;
118
- try {
119
- // Flush every 100 Customers
120
- if ($result['total'] % 100 === 0) {
121
- $result = $this->_flushCustomers($contactObject, $customerCache, $result);
122
- $customerCache = array();
123
- }
124
- } catch (Exception $e) {
125
- Mage::helper('bronto_customer')->writeError($e);
126
-
127
- // Mark Customer as *not* imported
128
- $customerRow->setBrontoImported(null)
129
- ->save();
130
-
131
- $result['error']++;
132
- }
133
  }
134
  }
135
 
136
- // Final flush (for any we miss)
137
- if (!empty($customerCache)) {
138
- $result = $this->_flushCustomers($contactObject, $customerCache, $result);
139
- }
140
 
141
  Mage::helper('bronto_customer')->writeDebug(' Success: ' . $result['success']);
142
  Mage::helper('bronto_customer')->writeDebug(' Error: ' . $result['error']);
@@ -253,9 +234,9 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
253
  $configData = Mage::getModel('core/config_data');
254
  $fieldIds = array_keys($fieldsToCheck);
255
  $api = $helper->getApi($token, 'store', $store->getId());
256
- $fieldObject = $api->getFieldObject();
257
- $filter = array('id' => $fieldIds, 'type' => 'OR');
258
- foreach ($fieldObject->readAll($filter)->iterate() as $field) {
259
  $this->_fieldMap[$token][$field->id] = $field->label;
260
  unset($fieldsToCheck[$field->id]);
261
  }
@@ -276,13 +257,13 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
276
  }
277
 
278
  /**
279
- * @param Bronto_Api_Contact_Row $brontoContact
280
  * @param Mage_Customer_Model_Customer $customer
281
  * @param Mage_Core_Model_Store $store
282
  *
283
- * @return Bronto_Api_Contact_Row
284
  */
285
- protected function _processRewardPoints(Bronto_Api_Contact_Row $brontoContact, Mage_Customer_Model_Customer $customer, Mage_Core_Model_Store $store)
286
  {
287
  // If Reward Points is installed
288
  if (Mage::helper('bronto_common')->isModuleInstalled('Enterprise_Reward')) {
@@ -297,7 +278,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
297
  continue;
298
  }
299
 
300
- $brontoContact->setField($_fieldName, $_attributeValue);
301
  }
302
  }
303
 
@@ -305,13 +286,13 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
305
  }
306
 
307
  /**
308
- * @param Bronto_Api_Contact_Row $brontoContact
309
  * @param Mage_Customer_Model_Customer $customer
310
  * @param Mage_Core_Model_Store $store
311
  *
312
- * @return Bronto_Api_Contact_Row
313
  */
314
- protected function _processStoreCredit(Bronto_Api_Contact_Row $brontoContact, Mage_Customer_Model_Customer $customer, Mage_Core_Model_Store $store)
315
  {
316
  // If Store Credit is installed
317
  if (Mage::helper('bronto_common')->isModuleInstalled('Enterprise_CustomerBalance')) {
@@ -327,7 +308,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
327
  return $brontoContact;
328
  }
329
 
330
- $brontoContact->setField($_fieldName, $_attributeValue);
331
  }
332
 
333
  return $brontoContact;
@@ -336,15 +317,15 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
336
  /**
337
  * Cycle through attributes and validate against Bronto Field type
338
  *
339
- * @param Bronto_Api_Contact_Row $brontoContact
340
- * @param $source
341
- * @param $attributes
342
- * @param Mage_Core_Model_Store $store
343
- * @param string $type 'customer' or 'address'
344
  *
345
- * @return Bronto_Api_Contact_Row
346
  */
347
- protected function _processAttributes(Bronto_Api_Contact_Row $brontoContact, $source, $attributes, Mage_Core_Model_Store $store, $type = 'customer')
348
  {
349
  $helper = Mage::helper('bronto_customer');
350
  // For each Customer attribute
@@ -365,7 +346,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
365
  $_attributeValue = strtolower($source->$method());
366
  $_brontoField = $helper->getPrefixedAttributeField($field, $type, 'store', $store->getId());
367
  if (!$this->_skippableProcessValue($_brontoField, $_attributeValue)) {
368
- $brontoContact->setField($_brontoField, $_attributeValue);
369
  }
370
  }
371
  break;
@@ -382,7 +363,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
382
  continue;
383
  }
384
 
385
- $brontoContact->setField($_fieldName, $_attributeValue);
386
  }
387
 
388
  return $brontoContact;
@@ -439,7 +420,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
439
  // Format Attribute Values
440
  switch ($_attributeType) {
441
  case 'select':
442
- return strtolower(Mage::helper('bronto_customer')->getAttributeAdminLabel($attribute, $value));
443
  break;
444
  case 'boolean':
445
  return $value == 1 ? 'true' : 'false';
@@ -452,8 +433,9 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
452
  $value = array($value);
453
  }
454
 
 
455
  foreach ($value as $val) {
456
- $values[] = strtolower(Mage::helper('bronto_customer')->getAttributeAdminLabel($attribute, $val));
457
  }
458
 
459
  return implode(', ', $values);
@@ -472,84 +454,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
472
  */
473
  protected function _formatDateValue($value)
474
  {
475
- $dates = explode(' ', $value);
476
- $date = $dates[0];
477
-
478
- if (!preg_match('/^[\d]{4}-[\d]{2}-[\d]{2}$/', $date)) {
479
- return '';
480
- } else {
481
- return implode('T', $dates) . Mage::getSingleton('core/date')->date('P');
482
- }
483
- }
484
-
485
- /**
486
- * @param Bronto_Api_Contact $customerObject
487
- * @param array $customerCache
488
- * @param array $result
489
- *
490
- * @return array
491
- */
492
- protected function _flushCustomers($customerObject, $customerCache, $result)
493
- {
494
- $fieldModel = Mage::getModel('bronto_common/system_config_source_field');
495
- $flushResult = $customerObject->flush();
496
- $flushCount = count($flushResult);
497
- Mage::helper('bronto_customer')->writeDebug(" Flush resulted in {$flushCount} customers processed");
498
- Mage::helper('bronto_customer')->writeVerboseDebug('===== FLUSH =====', 'bronto_customer_api.log');
499
- Mage::helper('bronto_customer')->writeVerboseDebug(var_export($customerObject->getApi()->getLastRequest(), true), 'bronto_customer_api.log');
500
- Mage::helper('bronto_customer')->writeVerboseDebug(var_export($customerObject->getApi()->getLastResponse(), true), 'bronto_customer_api.log');
501
- foreach ($flushResult as $i => $flushResultRow) {
502
- if ($flushResultRow->hasError()) {
503
- $hasError = true;
504
- $errorCode = $flushResultRow->getErrorCode();
505
- $errorMessage = $flushResultRow->getErrorMessage();
506
- } else {
507
- $hasError = false;
508
- $errorCode = false;
509
- $errorMessage = false;
510
- }
511
-
512
- if (isset($customerCache[$i])) {
513
- // Get Customer Object
514
- $customer = Mage::getModel('customer/customer')->load($customerCache[$i]['customerId']);
515
- $store = Mage::getModel('core/store')->load($customerCache[$i]['storeId']);
516
- $website = Mage::getModel('core/website')->load($store->getWebsiteId());
517
- $storeMessage = "For `{$website->getName()}`:`{$store->getName()}`: ";
518
-
519
- $customerRow = Mage::getModel('bronto_customer/queue')
520
- ->getCustomerRow($customerCache[$i]['customerId'], $customerCache[$i]['storeId']);
521
- } else {
522
- if ($hasError) {
523
- Mage::helper('bronto_customer')->writeError("[{$errorCode}] {$errorMessage}");
524
- $result['error']++;
525
- }
526
-
527
- continue;
528
- }
529
-
530
- if ($hasError) {
531
- // If Error Code In specified Array, suppress contact
532
- if (in_array($errorCode, array(302, 303, 314, 315, 317))) {
533
- $customerRow->setBrontoSuppressed($errorMessage);
534
- }
535
-
536
- Mage::helper('bronto_customer')->writeError("[{$errorCode}] {$storeMessage}{$errorMessage} ({$customer->getEmail()})");
537
-
538
- // Mark Customer as not imported
539
- $customerRow->setBrontoImported(null);
540
- $customerRow->save();
541
- $result['error']++;
542
- } else {
543
- Mage::helper('bronto_customer')->writeDebug(" {$customerCache[$i]['customerId']} = SUCCESS");
544
-
545
- // Mark Customer as imported
546
- $customerRow->setBrontoImported(Mage::getSingleton('core/date')->gmtDate());
547
- $customerRow->save();
548
- $result['success']++;
549
- }
550
- }
551
-
552
- return $result;
553
  }
554
 
555
  /**
@@ -678,6 +583,10 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
678
  // Get Array of Attributes that are hard-coded into system.xml
679
  $ignore = Mage::helper('bronto_customer')->getSystemAttributes();
680
 
 
 
 
 
681
  // Cycle Through Attribute Fields to Find and Save Dynamic Fields
682
  foreach ($attributesFields as $fieldId => $field) {
683
  // Save Dynamic 'Create New...' Fields
@@ -697,14 +606,25 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
697
 
698
  try {
699
  /* @var $fieldObject Bronto_Api_Field */
700
- $fieldObject = Mage::helper('bronto_common')->getApi()->getFieldObject();
701
- $brontoField = $fieldObject->createRow();
702
- $brontoField->name = $fieldObject->normalize($value);
703
- $brontoField->label = $value;
704
- $brontoField->type = Bronto_Api_Field::TYPE_TEXT;
705
-
706
- $brontoField->save();
707
- $fieldObject->addToCache($brontoField->name, $brontoField);
 
 
 
 
 
 
 
 
 
 
 
708
 
709
  $scope = $scopeParams['scope'];
710
  if ($scope != 'default') {
@@ -714,7 +634,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
714
  // Save Field To Config
715
  $config->saveConfig(
716
  $section . '/' . $group . '/' . $realField,
717
- $brontoField->id,
718
  $scope,
719
  $scopeParams[$scopeParams['scope'] . '_id']
720
  );
@@ -724,7 +644,7 @@ class Bronto_Customer_Model_Observer extends Mage_Core_Model_Abstract
724
  unset($attributesFields[$fieldId]);
725
  unset($fieldObject);
726
  } catch (Exception $e) {
727
- Mage::helper('bronto_customer')->writeError("Unable to save new field: {$value}");
728
  }
729
  } // Save Dynamic Fields
730
  elseif (array_key_exists('value', $field) && !in_array($fieldId, $ignore[$group])) {
45
  $store = Mage::app()->getStore($storeId);
46
  $storeId = $store->getId();
47
 
48
+ $contactFlusher = Mage::getModel('bronto_common/flusher')->setHelper('bronto_customer');
49
  Mage::helper('bronto_customer')->writeDebug("Starting Customer Import process for store: {$store->getName()} ({$storeId})");
50
 
51
  if (!$store->getConfig(Bronto_Customer_Helper_Data::XML_PATH_ENABLED)) {
52
  Mage::helper('bronto_customer')->writeDebug(' Module disabled for this store. Skipping...');
53
 
54
+ return $contactFlusher->getResult();
55
  }
56
 
57
  // Retrieve Store's configured API Token
58
  $token = $store->getConfig(Bronto_Common_Helper_Data::XML_PATH_API_TOKEN);
59
 
60
  /** @var Bronto_Common_Model_Api $api */
61
+ $api = Mage::helper('bronto_customer')->getApi($token, 'store', $store->getId());
62
 
63
+ /** @var Bronto_Api_Operation_Contact $contactObject */
64
+ $contactObject = $api->transferContact();
65
 
66
  // Get all customers in queue who haven't been imported into bronto
67
  $customerRows = Mage::getModel('bronto_customer/queue')
76
  if (empty($customerRows)) {
77
  Mage::helper('bronto_customer')->writeVerboseDebug(' No Customers to process. Skipping...');
78
 
79
+ return $contactFlusher->getResult();
80
  }
81
 
82
  /** @var Mage_Customer_Model_Entity_Attribute_Collection $customerAttributes */
84
  /** @var Mage_Customer_Model_Entity_Address_Attribute_Collection $addressAttributes */
85
  $addressAttributes = Mage::getModel('customer/entity_address_attribute_collection')->addVisibleFilter();
86
  $this->_buildValidFieldMapForStore($store, $customerAttributes, $addressAttributes);
87
+ // Flush every 100 Customers
88
+ $addOrUpdate = $contactObject->addOrUpdate(100)->withFlusher($contactFlusher);
89
 
90
  // For each Customer...
91
  foreach ($customerRows as $customerRow) {
92
  $customerId = $customerRow->getCustomerId();
93
  if ($customer = Mage::getModel('customer/customer')->load($customerId)/* @var $customer Mage_Customer_Model_Customer */) {
94
  Mage::helper('bronto_customer')->writeDebug(" Processing Customer ID: {$customerId} for Store ID: {$storeId}");
 
 
 
 
 
95
 
96
+ $brontoContact = $contactObject->createObject()
97
+ ->withStatus(Bronto_Api_Model_Contact::STATUS_TRANSACTIONAL)
98
+ ->withEmail($customer->getEmail())
99
+ ->withQueueRow($customerRow->getData());
100
  /* Process Customer Attributes */
101
  try {
102
  $brontoContact = $this->_processAttributes($brontoContact, $customer, $customerAttributes, $store, 'customer');
109
  }
110
  }
111
 
112
+ $addOrUpdate->addContact($brontoContact);
113
  } catch (Exception $e) {
114
  Mage::helper('bronto_customer')->writeError($e);
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
  }
118
 
119
+ $addOrUpdate->flush();
120
+ $result = $contactFlusher->getResult();
 
 
121
 
122
  Mage::helper('bronto_customer')->writeDebug(' Success: ' . $result['success']);
123
  Mage::helper('bronto_customer')->writeDebug(' Error: ' . $result['error']);
234
  $configData = Mage::getModel('core/config_data');
235
  $fieldIds = array_keys($fieldsToCheck);
236
  $api = $helper->getApi($token, 'store', $store->getId());
237
+ $fieldObject = $api->transferField();
238
+ $readFields = $fieldObject->read()->where->id->in($fieldIds);
239
+ foreach ($readFields as $field) {
240
  $this->_fieldMap[$token][$field->id] = $field->label;
241
  unset($fieldsToCheck[$field->id]);
242
  }
257
  }
258
 
259
  /**
260
+ * @param Bronto_Api_Model_Contact $brontoContact
261
  * @param Mage_Customer_Model_Customer $customer
262
  * @param Mage_Core_Model_Store $store
263
  *
264
+ * @return Bronto_Api_Model_Contact
265
  */
266
+ protected function _processRewardPoints(Bronto_Api_Model_Contact $brontoContact, Mage_Customer_Model_Customer $customer, Mage_Core_Model_Store $store)
267
  {
268
  // If Reward Points is installed
269
  if (Mage::helper('bronto_common')->isModuleInstalled('Enterprise_Reward')) {
278
  continue;
279
  }
280
 
281
+ $brontoContact->addField($_fieldName, $_attributeValue);
282
  }
283
  }
284
 
286
  }
287
 
288
  /**
289
+ * @param Bronto_Api_Model_Contact $brontoContact
290
  * @param Mage_Customer_Model_Customer $customer
291
  * @param Mage_Core_Model_Store $store
292
  *
293
+ * @return Bronto_Api_Model_Contact
294
  */
295
+ protected function _processStoreCredit(Bronto_Api_Model_Contact $brontoContact, Mage_Customer_Model_Customer $customer, Mage_Core_Model_Store $store)
296
  {
297
  // If Store Credit is installed
298
  if (Mage::helper('bronto_common')->isModuleInstalled('Enterprise_CustomerBalance')) {
308
  return $brontoContact;
309
  }
310
 
311
+ $brontoContact->addField($_fieldName, $_attributeValue);
312
  }
313
 
314
  return $brontoContact;
317
  /**
318
  * Cycle through attributes and validate against Bronto Field type
319
  *
320
+ * @param Bronto_Api_Model_Contact $brontoContact
321
+ * @param $source
322
+ * @param $attributes
323
+ * @param Mage_Core_Model_Store $store
324
+ * @param string $type 'customer' or 'address'
325
  *
326
+ * @return Bronto_Api_Model_Contact
327
  */
328
+ protected function _processAttributes(Bronto_Api_Model_Contact $brontoContact, $source, $attributes, Mage_Core_Model_Store $store, $type = 'customer')
329
  {
330
  $helper = Mage::helper('bronto_customer');
331
  // For each Customer attribute
346
  $_attributeValue = strtolower($source->$method());
347
  $_brontoField = $helper->getPrefixedAttributeField($field, $type, 'store', $store->getId());
348
  if (!$this->_skippableProcessValue($_brontoField, $_attributeValue)) {
349
+ $brontoContact->addField($_brontoField, $_attributeValue);
350
  }
351
  }
352
  break;
363
  continue;
364
  }
365
 
366
+ $brontoContact->addField($_fieldName, $_attributeValue);
367
  }
368
 
369
  return $brontoContact;
420
  // Format Attribute Values
421
  switch ($_attributeType) {
422
  case 'select':
423
+ return strtolower($attribute->getSource()->getOptionText($value));
424
  break;
425
  case 'boolean':
426
  return $value == 1 ? 'true' : 'false';
433
  $value = array($value);
434
  }
435
 
436
+ $source = $attribute->getSource();
437
  foreach ($value as $val) {
438
+ $values[] = strtolower($source->getOptionText($val));
439
  }
440
 
441
  return implode(', ', $values);
454
  */
455
  protected function _formatDateValue($value)
456
  {
457
+ return date('c', strtotime($value));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  }
459
 
460
  /**
583
  // Get Array of Attributes that are hard-coded into system.xml
584
  $ignore = Mage::helper('bronto_customer')->getSystemAttributes();
585
 
586
+ $api = Mage::helper('bronto_common')->getApi();
587
+
588
+ $fieldCache = array();
589
+
590
  // Cycle Through Attribute Fields to Find and Save Dynamic Fields
591
  foreach ($attributesFields as $fieldId => $field) {
592
  // Save Dynamic 'Create New...' Fields
606
 
607
  try {
608
  /* @var $fieldObject Bronto_Api_Field */
609
+ $fieldObject = $api->transferField();
610
+ $fieldName = Bronto_Utils::normalize($value);
611
+
612
+ if (!array_key_exists($fieldName, $fieldCache)) {
613
+ $brontoField = $fieldObject->getByName($fieldName);
614
+ if (!$brontoField) {
615
+ $brontoField = $fieldObject->createObject()
616
+ ->withName($fieldName)
617
+ ->withLabel($value)->asText()->asHidden();
618
+ foreach ($fieldObject->add()->addField($brontoField) as $result) {
619
+ $item = $result->getItem();
620
+ if ($item->getIsError()) {
621
+ Mage::throwException("{$item->getErrorCode()}: {$item->getErrorMessage()}");
622
+ }
623
+ $brontoField->withId($item->getId());
624
+ }
625
+ }
626
+ $fieldCache[$fieldName] = $brontoField;
627
+ }
628
 
629
  $scope = $scopeParams['scope'];
630
  if ($scope != 'default') {
634
  // Save Field To Config
635
  $config->saveConfig(
636
  $section . '/' . $group . '/' . $realField,
637
+ $brontoField->getId(),
638
  $scope,
639
  $scopeParams[$scopeParams['scope'] . '_id']
640
  );
644
  unset($attributesFields[$fieldId]);
645
  unset($fieldObject);
646
  } catch (Exception $e) {
647
+ Mage::helper('bronto_customer')->writeError("Unable to save new field: {$value}: {$e->getMessage()}");
648
  }
649
  } // Save Dynamic Fields
650
  elseif (array_key_exists('value', $field) && !in_array($fieldId, $ignore[$group])) {
app/code/community/Bronto/Customer/Model/Queue.php CHANGED
@@ -114,4 +114,4 @@ class Bronto_Customer_Model_Queue extends Mage_Core_Model_Abstract
114
 
115
  return $result;
116
  }
117
- }
114
 
115
  return $result;
116
  }
117
+ }
app/code/community/Bronto/Customer/Model/System/Config/Backend/Newfield.php CHANGED
@@ -6,6 +6,8 @@
6
  */
7
  class Bronto_Customer_Model_System_Config_Backend_Newfield extends Mage_Core_Model_Config_Data
8
  {
 
 
9
  /**
10
  * Processing object before save data
11
  *
@@ -15,17 +17,17 @@ class Bronto_Customer_Model_System_Config_Backend_Newfield extends Mage_Core_Mod
15
  {
16
  if ($this->isValueChanged()) {
17
  try {
18
- /* @var $fieldObject Bronto_Api_Field */
19
- $fieldObject = Mage::helper('bronto_common')->getApi()->getFieldObject();
20
-
21
- $field = $fieldObject->createRow();
22
- $field->name = $fieldObject->normalize($this->getValue());
23
- $field->label = $this->getValue();
24
- $field->type = Bronto_Api_Field::TYPE_TEXT;
25
-
26
- $field->save();
27
- $fieldObject->addToCache($field->name, $field);
28
- $this->_saveConfigData(str_replace('_new', '', $this->getPath()), $field->id);
29
  $this->setValue(null);
30
  } catch (Exception $e) {
31
  Mage::throwException(Mage::helper('adminhtml')->__('Unable to save new field: ') . $e->getMessage());
6
  */
7
  class Bronto_Customer_Model_System_Config_Backend_Newfield extends Mage_Core_Model_Config_Data
8
  {
9
+ private static $_fieldCache = array();
10
+
11
  /**
12
  * Processing object before save data
13
  *
17
  {
18
  if ($this->isValueChanged()) {
19
  try {
20
+ $fieldObject = Mage::helper('bronto_common')->getApi()->transferField();
21
+ $fieldName = Bronto_Utils::normalize($this->getValue());
22
+ if (!array_key_exists($fieldName, self::$_fieldCache)) {
23
+ $field = $fieldObject->getByName($fieldName);
24
+ if (!$field) {
25
+ $field->withName($fieldName)->withLabel($this->getValue())->asText()->asHidden();
26
+ $field->withId($fieldObject->add()->addField($field)->first()->getItem()->getId());
27
+ }
28
+ self::$_fieldCache[$fieldName] = $field;
29
+ }
30
+ $this->_saveConfigData(str_replace('_new', '', $this->getPath()), $field->getId());
31
  $this->setValue(null);
32
  } catch (Exception $e) {
33
  Mage::throwException(Mage::helper('adminhtml')->__('Unable to save new field: ') . $e->getMessage());
app/code/community/Bronto/Email/Block/Adminhtml/System/Email/Import/Grid/Renderer/Action.php CHANGED
@@ -1,36 +1,4 @@
1
  <?php
2
- /**
3
- * Magento Enterprise Edition
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Magento Enterprise Edition License
8
- * that is bundled with this package in the file LICENSE_EE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://www.magentocommerce.com/license/enterprise-edition
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://www.magentocommerce.com/license/enterprise-edition
25
- */
26
-
27
- /**
28
- * Adminhtml newsletter templates grid block action item renderer
29
- *
30
- * @category Mage
31
- * @package Mage_Adminhtml
32
- * @author Magento Core Team <core@magentocommerce.com>
33
- */
34
 
35
  class Bronto_Email_Block_Adminhtml_System_Email_Import_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
36
  {
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class Bronto_Email_Block_Adminhtml_System_Email_Import_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
4
  {
app/code/community/Bronto/Email/Model/Resource/Setup.php CHANGED
@@ -29,6 +29,7 @@ class Bronto_Email_Model_Resource_Setup extends Bronto_Common_Model_Resource_Abs
29
  `sales_rule` int(10) NULL COMMENT 'Sales Rule for Coupon Codes',
30
  `product_recommendation` int(11) unsigned DEFAULT NULL COMMENT 'Product Recommendations',
31
  `send_flags` int(3) unsigned DEFAULT NULL COMMENT 'Delivery Flags',
 
32
  PRIMARY KEY (`core_template_id`),
33
  KEY `IDX_BRONTO_STORE_ID` (`store_id`),
34
  CONSTRAINT `FK_BRONTO_EMAIL_TEMPLATE_ID_CORE_EMAIL_TEMPLATE_ID` FOREIGN KEY (`core_template_id`)
@@ -72,6 +73,12 @@ class Bronto_Email_Model_Resource_Setup extends Bronto_Common_Model_Resource_Abs
72
  'sql' =>
73
  "ALTER TABLE {table} ADD COLUMN `send_flags` int(3) unsigned DEFAULT NULL AFTER `product_recommendation`;"
74
  )
 
 
 
 
 
 
75
  )
76
  );
77
  }
29
  `sales_rule` int(10) NULL COMMENT 'Sales Rule for Coupon Codes',
30
  `product_recommendation` int(11) unsigned DEFAULT NULL COMMENT 'Product Recommendations',
31
  `send_flags` int(3) unsigned DEFAULT NULL COMMENT 'Delivery Flags',
32
+ `inline_css` varchar(255) DEFAULT NULL COMMENT 'Inline CSS file used in the lastest version of Magento',
33
  PRIMARY KEY (`core_template_id`),
34
  KEY `IDX_BRONTO_STORE_ID` (`store_id`),
35
  CONSTRAINT `FK_BRONTO_EMAIL_TEMPLATE_ID_CORE_EMAIL_TEMPLATE_ID` FOREIGN KEY (`core_template_id`)
73
  'sql' =>
74
  "ALTER TABLE {table} ADD COLUMN `send_flags` int(3) unsigned DEFAULT NULL AFTER `product_recommendation`;"
75
  )
76
+ ),
77
+ '1.2.2' => array(
78
+ 'message' => array(
79
+ 'sql' =>
80
+ 'ALTER TABLE {table} ADD COLUMN `inline_css` varchar(255) DEFAULT NULL AFTER `send_flags`;'
81
+ )
82
  )
83
  );
84
  }
app/code/community/Bronto/Email/Model/Template.php CHANGED
@@ -177,12 +177,12 @@ class Bronto_Email_Model_Template extends Bronto_Common_Model_Email_Template
177
  /**
178
  * Log about the functionality of sending the email before it goes out
179
  *
180
- * @param Bronto_Api_Contact_Row $contact
181
- * @param Bronto_Api_Message_Row $message
182
  *
183
  * @return void
184
  */
185
- protected function _beforeSend(Bronto_Api_Contact_Row $contact, Bronto_Api_Message_Row $message)
186
  {
187
  Mage::dispatchEvent('bronto_email_send_before');
188
 
@@ -201,13 +201,13 @@ class Bronto_Email_Model_Template extends Bronto_Common_Model_Email_Template
201
  /**
202
  * Log data on sending message
203
  *
204
- * @param bool $success
205
- * @param string $error
206
- * @param Bronto_Api_Delivery_Row $delivery
207
  *
208
  * @return void
209
  */
210
- protected function _afterSend($success, $error = null, Bronto_Api_Delivery_Row $delivery = null)
211
  {
212
  Mage::dispatchEvent('bronto_email_send_after');
213
 
177
  /**
178
  * Log about the functionality of sending the email before it goes out
179
  *
180
+ * @param Bronto_Api_Model_Contact $contact
181
+ * @param Bronto_Api_Model_Message $message
182
  *
183
  * @return void
184
  */
185
+ protected function _beforeSend(Bronto_Api_Model_Contact $contact, Bronto_Api_Model_Message $message)
186
  {
187
  Mage::dispatchEvent('bronto_email_send_before');
188
 
201
  /**
202
  * Log data on sending message
203
  *
204
+ * @param bool $success
205
+ * @param string $error
206
+ * @param Bronto_Api_Model_Delivery $delivery
207
  *
208
  * @return void
209
  */
210
+ protected function _afterSend($success, $error = null, Bronto_Api_Model_Delivery $delivery = null)
211
  {
212
  Mage::dispatchEvent('bronto_email_send_after');
213
 
app/code/community/Bronto/Email/Model/Template/Import.php CHANGED
@@ -46,50 +46,57 @@ class Bronto_Email_Model_Template_Import extends Bronto_Email_Model_Template
46
  $emt = Mage::getModel('bronto_common/email_template_templatefilter');
47
 
48
  // Get Store
 
49
  if ($storeId) {
50
  $store = Mage::app()->getStore($storeId);
51
- } elseif (isset($data['store_id'])) {
52
  $store = Mage::app()->getStore($data['store_id']);
53
- } else {
 
 
54
  $store = Mage::app()->getDefaultStoreView();
55
  }
56
 
 
 
 
 
57
  // If module is not enabled for this store, don't proceed
58
  if (!$force && !Mage::helper('bronto_email')->isEnabled('store', $store->getId())) {
59
  return false;
60
  }
61
 
62
  // Get Token
63
- $token = Mage::helper('bronto_common')->getApiToken('store', $store->getId());
64
- if ($token) {
65
- $this->_apiObject = new Bronto_Api_Message(array(
66
- 'api' => Mage::helper('bronto_common')->getApi($token, 'store', $store->getId())
67
- ));
68
- } else {
69
  return false;
70
  }
71
 
72
- // Send message template to Bronto
73
- try {
74
- $message = new Bronto_Api_Message_Row(array(
75
- 'apiObject' => $this->_apiObject
76
- ));
77
- } catch (Exception $e) {
78
- Mage::log('Bronto Failed creating apiObject:' . $e->getMessage());
79
-
80
- return false;
81
  }
82
 
 
 
 
83
  // Add Check for required fields
84
  if (array_key_exists('template_text', $data) && array_key_exists('template_subject', $data)) {
85
- $message->name = $data['template_code'];
86
- $message->status = 'active';
87
-
88
  // Define variables for filtered Subject and Text
89
  $templateSubject = $emt->filter($data['template_subject']);
90
  $templateText = $emt->filter($data['template_text']);
91
  $templateTextRip = $emt->filter($this->ripTags($data['template_text']));
92
 
 
 
 
 
 
93
  // If message missing subject, use template code
94
  if ('' == $templateSubject) {
95
  $templateSubject = $data['template_code'];
@@ -102,27 +109,32 @@ class Bronto_Email_Model_Template_Import extends Bronto_Email_Model_Template
102
  Mage::throwException('Template is missing body');
103
  }
104
 
105
- $message->content = array(
106
- array(
107
- 'type' => 'html',
108
- 'subject' => $templateSubject,
109
- 'content' => $templateText,
110
- ),
111
- array(
112
- 'type' => 'text',
113
- 'subject' => $templateSubject,
114
- 'content' => $templateTextRip,
115
- )
116
- );
117
- $message->subject = $templateSubject;
118
- $message->save();
119
-
120
- if ($message->hasError()) {
121
- Mage::throwException($message->getErrorCode() . ' ' . $message->getErrorMessage());
122
-
123
- return false;
 
 
 
 
124
  }
125
  } catch (Exception $e) {
 
126
  Mage::throwException("Failed Importing Template `{$data['template_code']}` : [Bronto] " . $e->getMessage());
127
 
128
  return false;
@@ -133,15 +145,17 @@ class Bronto_Email_Model_Template_Import extends Bronto_Email_Model_Template
133
  ->load($template->getId())
134
  ->setCoreTemplateId($template->getId())
135
  ->setOrigTemplateText($templateText)
136
- ->setBrontoMessageId($message->id)
137
- ->setBrontoMessageName($message->name)
138
  ->setBrontoMessageApproved(1)
139
  ->setStoreId($store->getId())
 
140
  ->save();
141
 
142
  // Clean Up
143
  unset($brontoTemplate);
144
  }
 
145
 
146
  return true;
147
  }
46
  $emt = Mage::getModel('bronto_common/email_template_templatefilter');
47
 
48
  // Get Store
49
+ $store = null;
50
  if ($storeId) {
51
  $store = Mage::app()->getStore($storeId);
52
+ } else if (isset($data['store_id'])) {
53
  $store = Mage::app()->getStore($data['store_id']);
54
+ }
55
+
56
+ if (empty($store)) {
57
  $store = Mage::app()->getDefaultStoreView();
58
  }
59
 
60
+ if (!$store) {
61
+ $store = Mage::app()->getStore();
62
+ }
63
+
64
  // If module is not enabled for this store, don't proceed
65
  if (!$force && !Mage::helper('bronto_email')->isEnabled('store', $store->getId())) {
66
  return false;
67
  }
68
 
69
  // Get Token
70
+ $api = Mage::helper('bronto_common')->getApi(null, 'store', $store->getId());
71
+ if (!$api) {
 
 
 
 
72
  return false;
73
  }
74
 
75
+ $messageOps = $api->transferMessage();
76
+ if (method_exists($emt, 'getInlineCssFile')) {
77
+ $emt
78
+ ->setTemplateProcessor(array($template, 'getTemplateByConfigPath'))
79
+ ->setIncludeProcessor(array($template, 'getInclude'))
80
+ ->setUseAbsoluteLinks(true)
81
+ ->setStoreId($store->getId())
82
+ ->setUseSessionInUrl(false);
 
83
  }
84
 
85
+ $appEmu = Mage::getSingleton('core/app_emulation');
86
+ $emuInfo = $appEmu->startEnvironmentEmulation($store->getId(), 'frontend');
87
+
88
  // Add Check for required fields
89
  if (array_key_exists('template_text', $data) && array_key_exists('template_subject', $data)) {
 
 
 
90
  // Define variables for filtered Subject and Text
91
  $templateSubject = $emt->filter($data['template_subject']);
92
  $templateText = $emt->filter($data['template_text']);
93
  $templateTextRip = $emt->filter($this->ripTags($data['template_text']));
94
 
95
+ if (method_exists($emt, 'getInlineCssFile')) {
96
+ $template->setInlineCssFile($emt->getInlineCssFile());
97
+ $templateText = $template->getPreparedTemplateText($templateText);
98
+ }
99
+
100
  // If message missing subject, use template code
101
  if ('' == $templateSubject) {
102
  $templateSubject = $data['template_code'];
109
  Mage::throwException('Template is missing body');
110
  }
111
 
112
+ $message = $messageOps->read()
113
+ ->where->name->equalTo($data['template_code'])
114
+ ->withIncludeContent(true)
115
+ ->first();
116
+ if (!$message) {
117
+ $message = $messageOps->createObject()
118
+ ->withName($data['template_code'])
119
+ ->withStatus('active');
120
+ }
121
+ $message
122
+ ->addHtml($templateSubject, $templateText)
123
+ ->addText($templateSubject, $templateTextRip);
124
+
125
+ $writeOps = $message->hasId() ?
126
+ $messageOps->update()->updateMessage($message) :
127
+ $messageOps->add()->addMessage($message);
128
+ foreach ($writeOps as $result) {
129
+ $item = $result->getItem();
130
+ if ($item->getIsError()) {
131
+ Mage::throwException($item->getErrorCode() . ' ' . $item->getErrorMessage());
132
+ } else if ($item->getIsNew()) {
133
+ $message->withId($item->getId());
134
+ }
135
  }
136
  } catch (Exception $e) {
137
+ $appEmu->stopEnvironmentEmulation($emuInfo);
138
  Mage::throwException("Failed Importing Template `{$data['template_code']}` : [Bronto] " . $e->getMessage());
139
 
140
  return false;
145
  ->load($template->getId())
146
  ->setCoreTemplateId($template->getId())
147
  ->setOrigTemplateText($templateText)
148
+ ->setBrontoMessageId($message->getId())
149
+ ->setBrontoMessageName($message->getName())
150
  ->setBrontoMessageApproved(1)
151
  ->setStoreId($store->getId())
152
+ ->setInlineCss($template->getInlineCssFile())
153
  ->save();
154
 
155
  // Clean Up
156
  unset($brontoTemplate);
157
  }
158
+ $appEmu->stopEnvironmentEmulation($emuInfo);
159
 
160
  return true;
161
  }
app/code/community/Bronto/Email/Model/Template/Mailer.php CHANGED
@@ -29,8 +29,8 @@ class Bronto_Email_Model_Template_Mailer
29
  return parent::send();
30
  }
31
 
32
- $message = new Bronto_Api_Message_Row();
33
- $message->id = $emailTemplate->getBrontoMessageId();
34
 
35
  // Send all emails from corresponding list
36
  while (!empty($this->_emailInfos)) {
29
  return parent::send();
30
  }
31
 
32
+ $message = new Bronto_Api_Model_Message();
33
+ $message->withId($emailTemplate->getBrontoMessageId());
34
 
35
  // Send all emails from corresponding list
36
  while (!empty($this->_emailInfos)) {
app/code/community/Bronto/Email/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Bronto_Email>
5
- <version>1.2.1</version>
6
  </Bronto_Email>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Bronto_Email>
5
+ <version>1.2.2</version>
6
  </Bronto_Email>
7
  </modules>
8
  <global>
app/code/community/Bronto/Email/sql/bronto_email_setup/mysql4-install-1.2.2.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ try {
8
+ $installer->createTables();
9
+ } catch (Exception $e) {
10
+ Mage::helper('bronto_email')->writeError($e->getMessage());
11
+ }
12
+
13
+ $installer->endSetup();
app/code/community/Bronto/Email/sql/bronto_email_setup/mysql4-upgrade-1.2.1-1.2.2.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ try {
8
+ $installer->updateTables('1.2.2');
9
+ } catch (Exception $e) {
10
+ Mage::helper('bronto_email')->writeError('Failed to upgrade email to 1.2.2: ' . $e->getMessage());
11
+ }
12
+
13
+ $installer->endSetup();
app/code/community/Bronto/Newsletter/Block/Checkout/Onepage/Newsletter.php CHANGED
@@ -201,11 +201,11 @@ class Bronto_Newsletter_Block_Checkout_Onepage_Newsletter extends Mage_Checkout_
201
 
202
  // Set Initial subscription status to active
203
  Mage::getSingleton('checkout/session')
204
- ->setIsSubscribed(Bronto_Api_Contact::STATUS_ACTIVE);
205
  } else {
206
  // Set Initial subscription status to transactional
207
  Mage::getSingleton('checkout/session')
208
- ->setIsSubscribed(Bronto_Api_Contact::STATUS_TRANSACTIONAL);
209
  }
210
 
211
  // If module enabled and checkbox enabled for checkout method, show it
201
 
202
  // Set Initial subscription status to active
203
  Mage::getSingleton('checkout/session')
204
+ ->setIsSubscribed(Bronto_Api_Model_Contact::STATUS_ACTIVE);
205
  } else {
206
  // Set Initial subscription status to transactional
207
  Mage::getSingleton('checkout/session')
208
+ ->setIsSubscribed(Bronto_Api_Model_Contact::STATUS_TRANSACTIONAL);
209
  }
210
 
211
  // If module enabled and checkbox enabled for checkout method, show it
app/code/community/Bronto/Newsletter/Helper/Contact.php CHANGED
@@ -87,6 +87,27 @@ class Bronto_Newsletter_Helper_Contact extends Bronto_Common_Helper_Contact
87
  return false;
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  /**
91
  * Retrieve helper module name
92
  *
@@ -109,20 +130,20 @@ class Bronto_Newsletter_Helper_Contact extends Bronto_Common_Helper_Contact
109
  // Set correct status based on subscriber status
110
  switch ($subscriber->getStatus()) {
111
  case Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED:
112
- $status = Bronto_Api_Contact::STATUS_ACTIVE;
113
  break;
114
 
115
  case Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED:
116
- $status = Bronto_Api_Contact::STATUS_UNSUBSCRIBED;
117
  break;
118
 
119
  case Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED:
120
- $status = Bronto_Api_Contact::STATUS_UNCONFIRMED;
121
  break;
122
 
123
  case Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE:
124
  default:
125
- $status = Bronto_Api_Contact::STATUS_TRANSACTIONAL;
126
  break;
127
  }
128
 
87
  return false;
88
  }
89
 
90
+ /**
91
+ * Supercedes the previous method
92
+ *
93
+ * @param string $scope
94
+ * @param string $scopeId
95
+ * @return array
96
+ */
97
+ public function getActualLists($scope = 'default', $scopeId = 0)
98
+ {
99
+ $listIds = $this->getListIds($scope, $scopeId);
100
+ if (!empty($listIds) && $api = $this->getApi(null, $scope, $scopeId)) {
101
+ $listObject = $api->transferMailList();
102
+ try {
103
+ return $listObject->read()->where->id->in($listIds)->getIterator()->toArray();
104
+ } catch (Exception $e) {
105
+ Mage::helper('bronto_newsletter')->writeError('Failed to retrieve lists: ' . $e->getMessage());
106
+ }
107
+ }
108
+ return array();
109
+ }
110
+
111
  /**
112
  * Retrieve helper module name
113
  *
130
  // Set correct status based on subscriber status
131
  switch ($subscriber->getStatus()) {
132
  case Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED:
133
+ $status = Bronto_Api_Model_Contact::STATUS_ACTIVE;
134
  break;
135
 
136
  case Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED:
137
+ $status = Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED;
138
  break;
139
 
140
  case Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED:
141
+ $status = Bronto_Api_Model_Contact::STATUS_UNCONFIRMED;
142
  break;
143
 
144
  case Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE:
145
  default:
146
+ $status = Bronto_Api_Model_Contact::STATUS_TRANSACTIONAL;
147
  break;
148
  }
149
 
app/code/community/Bronto/Newsletter/Model/Observer.php CHANGED
@@ -95,10 +95,8 @@ class Bronto_Newsletter_Model_Observer
95
  try {
96
  // Get e-mail address we are working with
97
  $email = $observer->getEvent()->getOrder()->getData('customer_email');
98
-
99
  if (empty($email)) {
100
  $this->_helper->writeError('No customer email was provided.');
101
-
102
  return false;
103
  }
104
 
@@ -106,16 +104,16 @@ class Bronto_Newsletter_Model_Observer
106
  $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
107
  // Determine action
108
  switch ($isSubscribed) {
109
- case Bronto_Api_Contact::STATUS_ACTIVE:
110
- case Bronto_Api_Contact::STATUS_ONBOARDING:
111
  if ($subscriber->getStatus() != Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) {
112
  $subscriber->subscribe($email);
113
  }
114
  break;
115
- case Bronto_Api_Contact::STATUS_UNSUBSCRIBED:
116
  return $subscriber->unsubscribe();
117
  break;
118
- case Bronto_Api_Contact::STATUS_TRANSACTIONAL:
119
  default:
120
  // No-op
121
  break;
@@ -162,14 +160,13 @@ class Bronto_Newsletter_Model_Observer
162
  ->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE)
163
  ->save();
164
 
165
- if ($contact->status == Bronto_Api_Contact::STATUS_UNSUBSCRIBED) {
166
  $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
167
  } else {
168
  $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE);
169
  }
170
 
171
  $subscriber->save();
172
-
173
  return $subscriber;
174
  }
175
 
@@ -287,8 +284,6 @@ class Bronto_Newsletter_Model_Observer
287
 
288
  $helper = Mage::helper('bronto_newsletter/contact');
289
 
290
- $lists = $helper->getListIds('store', $storeId);
291
-
292
  // Get Subscriber Queue for store
293
  /* var $subscribers Bronto_Newsletter_Model_Mysql4_Queue_Collection */
294
  $subscribers = Mage::getModel('bronto_newsletter/queue')
@@ -300,18 +295,11 @@ class Bronto_Newsletter_Model_Observer
300
  ->setPageSize($limit)
301
  ->getItems();
302
 
303
- $actualLists = array();
304
- foreach ($lists as $listId) {
305
- if ($list = $helper->getListData($listId, 'store', $storeId)) {
306
- $actualLists[$listId] = $list->label;
307
- } else {
308
- $this->_helper->writeError("The list ({$listId}) was not found. This may indicate that is does not exist. Try re-saving the config.");
309
- }
310
- }
311
-
312
  foreach ($subscribers as $subscriber) {
313
  try {
314
- /* @var $contact Bronto_Api_Contact_Row */
315
  $contact = $helper->getContactByEmail($subscriber->getSubscriberEmail(), null, $storeId);
316
 
317
  // If Contact returns false, handle it.
@@ -322,30 +310,30 @@ class Bronto_Newsletter_Model_Observer
322
  }
323
 
324
  // If Bronto Status is 'Bounced', mark suppressed, show error and continue foreach
325
- if ($contact->status == Bronto_Api_Contact::STATUS_BOUNCE) {
326
  $bounceMessage = "Subscriber {$contact->email} Has Been Bounced in Bronto";
327
  $subscriber->setBrontoSuppressed($bounceMessage)->save();
328
  Mage::throwException($bounceMessage);
329
  }
330
 
331
  // Get List Details
332
- if ($subscriber->getStatus() == Bronto_Api_Contact::STATUS_ACTIVE || ($helper->isRemoveUnsubs('store', $storeId) && $subscriber->getStatus() == Bronto_Api_Contact::STATUS_UNSUBSCRIBED)) {
333
  foreach ($actualLists as $listId => $listName) {
334
- if ($subscriber->getStatus() == Bronto_Api_Contact::STATUS_ACTIVE) {
335
  $helper->writeInfo(" Adding Contact to list: {$listName}");
336
- $contact->addToList($listId);
337
  } else {
338
  $helper->writeInfo(" Removing Contact from list: {$listName}");
339
- $contact->removeFromList($listId);
340
  }
341
  }
342
  }
343
 
344
  if ($helper->getUpdateStatus('store', $storeId)) {
345
  switch ($subscriber->getStatus()) {
346
- case Bronto_Api_Contact::STATUS_UNCONFIRMED:
347
- case Bronto_Api_Contact::STATUS_TRANSACTIONAL:
348
- if ($contact->id && $contact->status != Bronto_Api_Contact::STATUS_UNSUBSCRIBED) {
349
  $helper->writeInfo(
350
  " Keeping Contact ({$contact->email}) status as: {$contact->status}"
351
  );
@@ -355,8 +343,8 @@ class Bronto_Newsletter_Model_Observer
355
  $helper->writeInfo(" Setting Contact ({$contact->email}) status to: {$contact->status}");
356
  break;
357
 
358
- case Bronto_Api_Contact::STATUS_ACTIVE:
359
- if ($contact->status == Bronto_Api_Contact::STATUS_UNSUBSCRIBED &&
360
  $subscriber->getImported() == 2
361
  ) {
362
  $helper->writeInfo(
@@ -376,12 +364,13 @@ class Bronto_Newsletter_Model_Observer
376
  }
377
 
378
  // Don't add contacts to be unsubscribed
379
- if (!$contact->id && $contact->status == Bronto_Api_Contact::STATUS_UNSUBSCRIBED) {
380
  $subscriber->setImported(1)->save();
381
  $result['success']++;
382
  continue;
383
  }
384
- $contact->save();
 
385
  $subscriber->setImported(1)->save();
386
 
387
  $result['success']++;
@@ -389,7 +378,7 @@ class Bronto_Newsletter_Model_Observer
389
  // 303 = invalid email address
390
  // 315 = on suppression list
391
  // 317 = email over 100 characters in length
392
- if (in_array($e->getCode(), array(303, 315, 317))) {
393
  $subscriber->setBrontoSuppressed($e->getMessage());
394
  }
395
 
95
  try {
96
  // Get e-mail address we are working with
97
  $email = $observer->getEvent()->getOrder()->getData('customer_email');
 
98
  if (empty($email)) {
99
  $this->_helper->writeError('No customer email was provided.');
 
100
  return false;
101
  }
102
 
104
  $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
105
  // Determine action
106
  switch ($isSubscribed) {
107
+ case Bronto_Api_Model_Contact::STATUS_ACTIVE:
108
+ case Bronto_Api_Model_Contact::STATUS_ONBOARDING:
109
  if ($subscriber->getStatus() != Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) {
110
  $subscriber->subscribe($email);
111
  }
112
  break;
113
+ case Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED:
114
  return $subscriber->unsubscribe();
115
  break;
116
+ case Bronto_Api_Model_Contact::STATUS_TRANSACTIONAL:
117
  default:
118
  // No-op
119
  break;
160
  ->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE)
161
  ->save();
162
 
163
+ if ($contact->status == Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED) {
164
  $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
165
  } else {
166
  $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE);
167
  }
168
 
169
  $subscriber->save();
 
170
  return $subscriber;
171
  }
172
 
284
 
285
  $helper = Mage::helper('bronto_newsletter/contact');
286
 
 
 
287
  // Get Subscriber Queue for store
288
  /* var $subscribers Bronto_Newsletter_Model_Mysql4_Queue_Collection */
289
  $subscribers = Mage::getModel('bronto_newsletter/queue')
295
  ->setPageSize($limit)
296
  ->getItems();
297
 
298
+ $contactOps = $helper->getApi(null, 'store', $storeId)->transferContact();
299
+ $actualLists = $helper->getActualLists('store', $storeId);
 
 
 
 
 
 
 
300
  foreach ($subscribers as $subscriber) {
301
  try {
302
+ /* @var $contact Bronto_Api_Model_Contact */
303
  $contact = $helper->getContactByEmail($subscriber->getSubscriberEmail(), null, $storeId);
304
 
305
  // If Contact returns false, handle it.
310
  }
311
 
312
  // If Bronto Status is 'Bounced', mark suppressed, show error and continue foreach
313
+ if ($contact->status == Bronto_Api_Model_Contact::STATUS_BOUNCE) {
314
  $bounceMessage = "Subscriber {$contact->email} Has Been Bounced in Bronto";
315
  $subscriber->setBrontoSuppressed($bounceMessage)->save();
316
  Mage::throwException($bounceMessage);
317
  }
318
 
319
  // Get List Details
320
+ if ($subscriber->getStatus() == Bronto_Api_Model_Contact::STATUS_ACTIVE || ($helper->isRemoveUnsubs('store', $storeId) && $subscriber->getStatus() == Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED)) {
321
  foreach ($actualLists as $listId => $listName) {
322
+ if ($subscriber->getStatus() == Bronto_Api_Model_Contact::STATUS_ACTIVE) {
323
  $helper->writeInfo(" Adding Contact to list: {$listName}");
324
+ $contact->addList($listId);
325
  } else {
326
  $helper->writeInfo(" Removing Contact from list: {$listName}");
327
+ $contact->removeList($listId);
328
  }
329
  }
330
  }
331
 
332
  if ($helper->getUpdateStatus('store', $storeId)) {
333
  switch ($subscriber->getStatus()) {
334
+ case Bronto_Api_Model_Contact::STATUS_UNCONFIRMED:
335
+ case Bronto_Api_Model_Contact::STATUS_TRANSACTIONAL:
336
+ if ($contact->id && $contact->status != Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED) {
337
  $helper->writeInfo(
338
  " Keeping Contact ({$contact->email}) status as: {$contact->status}"
339
  );
343
  $helper->writeInfo(" Setting Contact ({$contact->email}) status to: {$contact->status}");
344
  break;
345
 
346
+ case Bronto_Api_Model_Contact::STATUS_ACTIVE:
347
+ if ($contact->status == Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED &&
348
  $subscriber->getImported() == 2
349
  ) {
350
  $helper->writeInfo(
364
  }
365
 
366
  // Don't add contacts to be unsubscribed
367
+ if (!$contact->hasId() && $contact->getStatus() == Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED) {
368
  $subscriber->setImported(1)->save();
369
  $result['success']++;
370
  continue;
371
  }
372
+ // Force an add or update on the individual contact
373
+ $contactOps->save($contact, true);
374
  $subscriber->setImported(1)->save();
375
 
376
  $result['success']++;
378
  // 303 = invalid email address
379
  // 315 = on suppression list
380
  // 317 = email over 100 characters in length
381
+ if (in_array($e->getCode(), array(303, 305, 314, 315, 317))) {
382
  $subscriber->setBrontoSuppressed($e->getMessage());
383
  }
384
 
app/code/community/Bronto/Newsletter/controllers/IndexController.php CHANGED
@@ -73,11 +73,11 @@ class Bronto_Newsletter_IndexController extends Mage_Core_Controller_Front_Actio
73
 
74
  // If customer is logged in, and subscribed, and checkbox is unchecked, and starting is not unchecked
75
  if ($subscribed && 0 == $checked && 0 != $starting) {
76
- $status = Bronto_Api_Contact::STATUS_UNSUBSCRIBED;
77
  } elseif (1 == $checked || 1 == $subscribed) {
78
- $status = Bronto_Api_Contact::STATUS_ACTIVE;
79
  } else {
80
- $status = Bronto_Api_Contact::STATUS_TRANSACTIONAL;
81
  }
82
 
83
  // Get Previous status from session
73
 
74
  // If customer is logged in, and subscribed, and checkbox is unchecked, and starting is not unchecked
75
  if ($subscribed && 0 == $checked && 0 != $starting) {
76
+ $status = Bronto_Api_Model_Contact::STATUS_UNSUBSCRIBED;
77
  } elseif (1 == $checked || 1 == $subscribed) {
78
+ $status = Bronto_Api_Model_Contact::STATUS_ACTIVE;
79
  } else {
80
+ $status = Bronto_Api_Model_Contact::STATUS_TRANSACTIONAL;
81
  }
82
 
83
  // Get Previous status from session
app/code/community/Bronto/Newsletter/etc/config.xml CHANGED
@@ -104,6 +104,7 @@
104
  <checkout>
105
  <show_to_guests>1</show_to_guests>
106
  <show_to_registrars>1</show_to_registrars>
 
107
  <default_checked>0</default_checked>
108
  <show_if_subscribed>0</show_if_subscribed>
109
  <label_text>Sign up for our newsletter</label_text>
104
  <checkout>
105
  <show_to_guests>1</show_to_guests>
106
  <show_to_registrars>1</show_to_registrars>
107
+ <show_to_loggedin>1</show_to_loggedin>
108
  <default_checked>0</default_checked>
109
  <show_if_subscribed>0</show_if_subscribed>
110
  <label_text>Sign up for our newsletter</label_text>
app/code/community/Bronto/Order/Model/Observer.php CHANGED
@@ -61,41 +61,14 @@ class Bronto_Order_Model_Observer
61
  return $stateMap;
62
  }
63
 
64
- /**
65
- * Function to delete orders in Bronto
66
- *
67
- * @param Mage_Sales_Model_Order $order
68
- * @param Bronto_Api_Order $brontoOrder
69
- * @param Bronto_Order_Model_Queue $orderRow
70
- * @return boolean;
71
- */
72
- protected function _deleteOrder($order, $brontoOrder, $orderRow)
73
- {
74
- try {
75
- $deleteDate = Mage::getSingleton('core/date')->gmtDate();
76
- $brontoOrder->delete();
77
- $orderRow->setBrontoImported($deleteDate)->save();
78
- $this->_helper->writeDebug(" Successfully deleted order...");
79
- return true;
80
- } catch (Exception $e) {
81
- $this->_helper->writeError(" Failed to delete order: {$e->getMessage()}");
82
- $orderRow
83
- ->setBrontoImported(null)
84
- ->setBrontoSuppressed($e->getMessage())
85
- ->save();
86
- }
87
- return false;
88
- }
89
-
90
  /**
91
  * Function to persist orders to be flushed to Bronto
92
  *
93
  * @param Mage_Sales_Model_Order $order
94
  * @param Bronto_Api_Order $brontoOrder
95
- * @param Bronto_Order_Model_Queue $orderRow
96
  * @param array $context
97
  */
98
- protected function _persistOrder($order, $brontoOrder, $orderRow, $context)
99
  {
100
  extract($context);
101
  // Get visible items from order
@@ -248,8 +221,7 @@ class Bronto_Order_Model_Observer
248
  );
249
  $brontoOrderItems[] = $shipmentItem;
250
  }
251
- $brontoOrder->products = $brontoOrderItems;
252
- $brontoOrder->persist();
253
  }
254
 
255
  /**
@@ -262,44 +234,10 @@ class Bronto_Order_Model_Observer
262
  protected function _skipOrder($order, $orderRow, $reason)
263
  {
264
  $importDate = Mage::getSingleton('core/date')->gmtDate();
265
- $orderRow->setBrontoImported($importDate)->save();
266
  $this->_helper->writeInfo(" Skipping order id {$order->getId()} #{$order->getIncrementId()}: {$reason}");
267
  }
268
 
269
- /**
270
- * Supressed the order
271
- *
272
- * @param Mage_Sales_Model_Order $order
273
- * @param Bronto_Order_Model_Queue $orderRow
274
- * @param string $reason
275
- */
276
- protected function _supressOrder($order, $orderRow, $reason)
277
- {
278
- $orderRow
279
- ->setBrontoImported(null)
280
- ->setBrontoSuppressed($reason)
281
- ->save();
282
- $this->_helper->writeInfo(" Supressing order id {$order->getId()} #{$order->getIncrementId()}: {$reason}");
283
- }
284
-
285
- /**
286
- * Skips all of the orders in the cache
287
- *
288
- * @param array $orderCache
289
- * @param string $message
290
- */
291
- protected function _suppressedOrders($orderCache, $message)
292
- {
293
- foreach ($orderCache as $cachedOrder) {
294
- $order = Mage::getModel('sales/order')->load($cachedOrder['orderId']);
295
- $row = Mage::getModel('bronto_order/queue')->getOrderRow(
296
- $cachedOrder['orderId'],
297
- $cachedOrder['quoteId'],
298
- $cachedOrder['storeId']);
299
- $this->_supressOrder($order, $row, $message);
300
- }
301
- }
302
-
303
  /**
304
  * Process specified number of items for specified store
305
  *
@@ -339,10 +277,14 @@ class Bronto_Order_Model_Observer
339
  $token = $store->getConfig(Bronto_Common_Helper_Data::XML_PATH_API_TOKEN);
340
 
341
  /* @var $api Bronto_Common_Model_Api */
342
- $api = $this->_helper->getApi($token);
 
343
 
344
- /* @var $orderObject Bronto_Api_Order */
345
- $orderObject = $api->getOrderObject();
 
 
 
346
 
347
  // Retrieve order queue rows limited to current limit and filtered
348
  // Filter out imported, suppressed, other stores, and items without order ids
@@ -370,8 +312,6 @@ class Bronto_Order_Model_Observer
370
  $inclTaxes = $this->_helper->isTaxIncluded('store', $store->getId());
371
  $inclDiscounts = $this->_helper->isDiscountIncluded('store', $store->getId());
372
  $inclShipping = $this->_helper->isShippingIncluded('store', $store->getId());
373
- $uploadMax = $this->_helper->getBulkLimit('store', $store->getId());
374
- $orderCache = array();
375
  $allStates = Mage::getModel('bronto_order/system_config_source_order_state')->toArray();
376
  $importStateMap = $this->_createStateMap($allStates, $this->_helper->getImportStates('store', $store->getId()));
377
  $deleteStateMap = $this->_createStateMap($allStates, $this->_helper->getDeleteStates('store', $store->getId()));
@@ -389,86 +329,54 @@ class Bronto_Order_Model_Observer
389
  // Log that we are processing the current order
390
  $this->_helper->writeDebug(" Processing Order ID: {$orderId} \t #{$order->getIncrementId()}");
391
 
392
- /* @var $brontoOrder Bronto_Api_Order_Row */
393
- $brontoOrder = $orderObject->createRow();
394
- $brontoOrder->email = $order->getCustomerEmail();
395
- $brontoOrder->id = $order->getIncrementId();
396
- $brontoOrder->orderDate = date('c', strtotime($order->getCreatedAt()));
 
397
 
398
  // If there is a conversion tracking id attached to this order, add it to the row
399
  if ($tid = $orderRow->getBrontoTid()) {
400
- $brontoOrder->tid = $tid;
401
  }
402
 
403
- if (empty($brontoOrder->id)) {
404
  $this->_skipOrder($order, $orderRow, "Invalid increment ID");
405
  $result['success']++;
 
406
  } else if (array_key_exists($order->getState(), $importStateMap)) {
407
- try {
408
- $this->_persistOrder($order, $brontoOrder, $orderRow, array(
409
- 'productHelper' => $productHelper,
410
- 'descriptionAttr' => $descriptionAttr,
411
- 'basePrefix' => $basePrefix,
412
- 'inclTaxes' => $inclTaxes,
413
- 'inclDiscounts' => $inclDiscounts,
414
- 'inclShipping' => $inclShipping,
415
- 'storeId' => $storeId,
416
- ));
417
- $orderCache[] = array('orderId' => $orderId, 'quoteId' => $quoteId, 'storeId' => $storeId);
418
- } catch (Exception $e) {
419
- // Mark import as *not* imported
420
- $orderRow->setBrontoImported(null);
421
- $orderRow->save();
422
-
423
- // increment number of errors
424
- $result['error']++;
425
- }
426
  } else if (array_key_exists($order->getState(), $deleteStateMap)) {
427
- if ($this->_deleteOrder($order, $brontoOrder, $orderRow)) {
428
- $result['success']++;
429
- } else {
430
- $result['error']++;
431
- }
432
  } else {
433
  $this->_skipOrder($order, $orderRow, "Invalid state {$allStates[$order->getState()]}");
434
  $result['success']++;
 
435
  }
436
 
437
- // increment total number of items processed
438
- $result['total']++;
439
-
440
- try {
441
- if (count($orderCache) == $uploadMax) {
442
- $result = $this->_flushOrders($orderObject, $orderCache, $result);
443
- $orderCache = array();
444
- }
445
- } catch (Exception $e) {
446
- $this->_helper->writeError($e);
447
- $this->_helper->writeVerboseDebug('===== FAILED IMPORT =====', 'bronto_order_api.log');
448
- $this->_helper->writeVerboseDebug(var_export($orderObject->getApi()->getLastRequest(), true), 'bronto_order_api.log');
449
- if ($e->getCode() == 107) {
450
- $this->_suppressedOrders($orderCache, $e->getMessage() . self::ERROR_APPENDER);
451
- }
452
- }
453
  } else {
454
  $this->_skipOrder($order, $orderRow, "Invalid order");
455
  $result['success']++;
 
456
  }
457
  }
458
 
459
- // Final flush (for any we miss)
460
- if (!empty($orderCache)) {
461
- try {
462
- $result = $this->_flushOrders($orderObject, $orderCache, $result);
463
- } catch (Exception $e) {
464
- $this->_helper->writeError($e);
465
- $this->_helper->writeVerboseDebug('===== FAILED IMPORT =====', 'bronto_order_api.log');
466
- $this->_helper->writeVerboseDebug(var_export($orderObject->getApi()->getLastRequest(), true), 'bronto_order_api.log');
467
- if ($e->getCode() == 107) {
468
- $this->_suppressedOrders($orderCache, $e->getMessage() . self::ERROR_APPENDER);
469
- }
470
- }
471
- }
472
 
473
  // Log results
474
  $this->_helper->writeDebug(' Success: ' . $result['success']);
@@ -478,97 +386,6 @@ class Bronto_Order_Model_Observer
478
  return $result;
479
  }
480
 
481
- /**
482
- * @param Bronto_Api_Order $orderObject
483
- * @param array $orderCache
484
- * @param array $result
485
- *
486
- * @return array
487
- * @access protected
488
- */
489
- protected function _flushOrders($orderObject, $orderCache, $result)
490
- {
491
- // Get delivery results from order object
492
- $flushResult = $orderObject->flush();
493
- $flushCount = count($flushResult);
494
-
495
- // Log Order import flush process starting
496
- $this->_helper->writeDebug(" Flush resulted in {$flushCount} orders processed");
497
- $this->_helper->writeVerboseDebug('===== FLUSH =====', 'bronto_order_api.log');
498
- $this->_helper->writeVerboseDebug(var_export($orderObject->getApi()->getLastRequest(), true), 'bronto_order_api.log');
499
- $this->_helper->writeVerboseDebug(var_export($orderObject->getApi()->getLastResponse(), true), 'bronto_order_api.log');
500
-
501
- // Cycle through flush results and handle any errors that were returned
502
- foreach ($flushResult as $i => $flushResultRow) {
503
- if ($flushResultRow->hasError()) {
504
- $hasError = true;
505
- $errorCode = $flushResultRow->getErrorCode();
506
- $errorMessage = $flushResultRow->getErrorMessage();
507
- } else {
508
- $hasError = false;
509
- $errorCode = false;
510
- $errorMessage = false;
511
- }
512
-
513
- if (isset($orderCache[$i])) {
514
- /** @var Mage_Sales_Model_Order $order */
515
- $order = Mage::getModel('sales/order')->load($orderCache[$i]['orderId']);
516
-
517
- /** @var Mage_Core_Model_Store $store */
518
- $store = Mage::getModel('core/store')->load($orderCache[$i]['storeId']);
519
-
520
- /** @var Mage_Core_Model_Website $website */
521
- $website = Mage::getModel('core/website')->load($store->getWebsiteId());
522
-
523
- $storeMessage = "For `{$website->getName()}`:`{$store->getName()}`: ";
524
-
525
- /** @var Bronto_Order_Model_Queue $orderRow */
526
- $orderRow = Mage::getModel('bronto_order/queue')
527
- ->getOrderRow($order->getId(), $order->getQuoteId(), $order->getStoreId());
528
- } else {
529
- if ($hasError) {
530
- Mage::helper('bronto_order')->writeError("[{$errorCode}] {$errorMessage}");
531
- $result['error']++;
532
- }
533
-
534
- continue;
535
- }
536
-
537
- if ($hasError) {
538
- // If error code is 915, try to pull customer email address
539
- if (915 == $errorCode) {
540
- if ($customerEmail = $order->getCustomerEmail()) {
541
- $errorMessage = "Invalid Email Address: `{$customerEmail}`";
542
- } else {
543
- $errorMessage = "Email Address is empty for this order";
544
- }
545
- }
546
-
547
- // Append order id to message to assist troubleshooting
548
- $errorMessage .= " (Order #: {$order->getIncrementId()})";
549
-
550
- // Log and Display error message
551
- $this->_helper->writeError("[{$errorCode}] {$storeMessage}{$errorMessage}");
552
-
553
- // Reset Bronto Import status
554
- $orderRow->setBrontoImported(null)
555
- ->setBrontoSuppressed($errorMessage)
556
- ->save();
557
-
558
- // Increment number of errors
559
- $result['error']++;
560
- } else {
561
- $orderRow->setBrontoImported(Mage::getSingleton('core/date')->gmtDate());
562
- $orderRow->save();
563
-
564
- // Increment number of successes
565
- $result['success']++;
566
- }
567
- }
568
-
569
- return $result;
570
- }
571
-
572
  /**
573
  * Process Orders for all stores
574
  *
61
  return $stateMap;
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  /**
65
  * Function to persist orders to be flushed to Bronto
66
  *
67
  * @param Mage_Sales_Model_Order $order
68
  * @param Bronto_Api_Order $brontoOrder
 
69
  * @param array $context
70
  */
71
+ protected function _persistOrder($order, $brontoOrder, $context)
72
  {
73
  extract($context);
74
  // Get visible items from order
221
  );
222
  $brontoOrderItems[] = $shipmentItem;
223
  }
224
+ $brontoOrder->withProducts($brontoOrderItems);
 
225
  }
226
 
227
  /**
234
  protected function _skipOrder($order, $orderRow, $reason)
235
  {
236
  $importDate = Mage::getSingleton('core/date')->gmtDate();
237
+ $orderRow->setBrontoImported($importDate)->setBrontoSuppressed(null)->save();
238
  $this->_helper->writeInfo(" Skipping order id {$order->getId()} #{$order->getIncrementId()}: {$reason}");
239
  }
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  /**
242
  * Process specified number of items for specified store
243
  *
277
  $token = $store->getConfig(Bronto_Common_Helper_Data::XML_PATH_API_TOKEN);
278
 
279
  /* @var $api Bronto_Common_Model_Api */
280
+ $uploadMax = $this->_helper->getBulkLimit('store', $store->getId());
281
+ $api = $this->_helper->getApi($token, 'store', $store->getId());
282
 
283
+ /* @var $orderObject Bronto_Api_Operation_Order */
284
+ $orderObject = $api->transferOrder();
285
+ $apiFlusher = Mage::getModel('bronto_common/flusher')->setHelper('bronto_order');
286
+ $deleteOrders = $orderObject->delete($uploadMax)->withFlusher($apiFlusher);
287
+ $addOrUpdateOrders = $orderObject->addOrUpdate($uploadMax)->withFlusher($apiFlusher);
288
 
289
  // Retrieve order queue rows limited to current limit and filtered
290
  // Filter out imported, suppressed, other stores, and items without order ids
312
  $inclTaxes = $this->_helper->isTaxIncluded('store', $store->getId());
313
  $inclDiscounts = $this->_helper->isDiscountIncluded('store', $store->getId());
314
  $inclShipping = $this->_helper->isShippingIncluded('store', $store->getId());
 
 
315
  $allStates = Mage::getModel('bronto_order/system_config_source_order_state')->toArray();
316
  $importStateMap = $this->_createStateMap($allStates, $this->_helper->getImportStates('store', $store->getId()));
317
  $deleteStateMap = $this->_createStateMap($allStates, $this->_helper->getDeleteStates('store', $store->getId()));
329
  // Log that we are processing the current order
330
  $this->_helper->writeDebug(" Processing Order ID: {$orderId} \t #{$order->getIncrementId()}");
331
 
332
+ /* @var $brontoOrder Bronto_Api_Model_Order */
333
+ $brontoOrder = $orderObject->createObject()
334
+ ->withEmail($order->getCustomerEmail())
335
+ ->withId($order->getIncrementId())
336
+ ->withOrderDate(date('c', strtotime($order->getCreatedAt())))
337
+ ->withQueueRow($orderRow->getData());
338
 
339
  // If there is a conversion tracking id attached to this order, add it to the row
340
  if ($tid = $orderRow->getBrontoTid()) {
341
+ $brontoOrder->withTid($tid);
342
  }
343
 
344
+ if (!$brontoOrder->hasId()) {
345
  $this->_skipOrder($order, $orderRow, "Invalid increment ID");
346
  $result['success']++;
347
+ $result['total']++;
348
  } else if (array_key_exists($order->getState(), $importStateMap)) {
349
+ $this->_persistOrder($order, $brontoOrder, array(
350
+ 'productHelper' => $productHelper,
351
+ 'descriptionAttr' => $descriptionAttr,
352
+ 'basePrefix' => $basePrefix,
353
+ 'inclTaxes' => $inclTaxes,
354
+ 'inclDiscounts' => $inclDiscounts,
355
+ 'inclShipping' => $inclShipping,
356
+ 'storeId' => $storeId,
357
+ ));
358
+ $addOrUpdateOrders->addOrder($brontoOrder);
 
 
 
 
 
 
 
 
 
359
  } else if (array_key_exists($order->getState(), $deleteStateMap)) {
360
+ $deleteOrders->deleteOrder($brontoOrder);
 
 
 
 
361
  } else {
362
  $this->_skipOrder($order, $orderRow, "Invalid state {$allStates[$order->getState()]}");
363
  $result['success']++;
364
+ $result['total']++;
365
  }
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  } else {
368
  $this->_skipOrder($order, $orderRow, "Invalid order");
369
  $result['success']++;
370
+ $result['total']++;
371
  }
372
  }
373
 
374
+ $deleteOrders->flush();
375
+ $addOrUpdateOrders->flush();
376
+ extract($apiFlusher->getResult());
377
+ $result['success'] += $success;
378
+ $result['error'] += $error;
379
+ $result['total'] += $total;
 
 
 
 
 
 
 
380
 
381
  // Log results
382
  $this->_helper->writeDebug(' Success: ' . $result['success']);
386
  return $result;
387
  }
388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  /**
390
  * Process Orders for all stores
391
  *
app/code/community/Bronto/Order/sql/bronto_order_setup/mysql4-upgrade-1.0.0-1.1.6.php CHANGED
@@ -45,7 +45,7 @@ try {
45
  $installer->removeAttribute('order', 'bronto_tid');
46
  $installer->removeAttribute('order', 'bronto_imported');
47
  } catch (Exception $e) {
48
- throw new RuntimeException('Failed Creating and Populating Table: ' . $e->getMessage());
49
  }
50
 
51
  $installer->endSetup();
45
  $installer->removeAttribute('order', 'bronto_tid');
46
  $installer->removeAttribute('order', 'bronto_imported');
47
  } catch (Exception $e) {
48
+ Mage::helper('bronto_order')->writeError('Failed Creating and Populating Table: ' . $e->getMessage());
49
  }
50
 
51
  $installer->endSetup();
app/code/community/Bronto/Product/Helper/Data.php CHANGED
@@ -139,7 +139,7 @@ class Bronto_Product_Helper_Data extends Bronto_Common_Helper_Data
139
  if (is_numeric($item)) {
140
  $item = $helper->getProduct($item, $storeId);
141
  }
142
- if ($item->getParentItem()) {
143
  continue;
144
  }
145
  if (!$item instanceof Mage_Catalog_Model_Product) {
@@ -307,15 +307,12 @@ class Bronto_Product_Helper_Data extends Bronto_Common_Helper_Data
307
  */
308
  public function setRelatedFields($delivery, $productHash, $storeId = null)
309
  {
310
- $currentData = $delivery->getData();
311
- if (empty($currentData['fields'])) {
312
- $currentData['fields'] = array();
313
- }
314
  foreach ($this->relatedFields($productHash, $storeId) as $fields) {
315
- $currentData['fields'] = array_merge($currentData['fields'], $fields);
316
  }
317
  // By passing the setField call on the API is far more efficient
318
- $delivery->setData($currentData);
319
  }
320
 
321
  /**
@@ -341,23 +338,16 @@ class Bronto_Product_Helper_Data extends Bronto_Common_Helper_Data
341
  */
342
  public function getContentTagForRecommendation($tagObject, $rec)
343
  {
344
- $filter = array(
345
- 'type' => 'OR',
346
- 'name' => array(
347
- 'value' => $rec->getName(),
348
- 'operator' => 'EqualTo',
349
- )
350
- );
351
  if ($rec->hasTagId()) {
352
- $filter['id'] = array($rec->getTagId());
353
  }
354
- $tags = $tagObject->readAll($filter, false);
355
- $tag = $tags->current();
356
  if (count($tags) > 1) {
357
  Mage::throwException("Unable to find unique tag for {$rec->getName()}.");
358
  } else if (!$tag) {
359
- $tag = $tagObject->createRow();
360
- $tag->name = $rec->getName();
361
  }
362
  return $tag;
363
  }
139
  if (is_numeric($item)) {
140
  $item = $helper->getProduct($item, $storeId);
141
  }
142
+ if (!$item || $item->getParentItem()) {
143
  continue;
144
  }
145
  if (!$item instanceof Mage_Catalog_Model_Product) {
307
  */
308
  public function setRelatedFields($delivery, $productHash, $storeId = null)
309
  {
310
+ $currentData = $delivery->hasFields() ? $delivery->getFields() : array();
 
 
 
311
  foreach ($this->relatedFields($productHash, $storeId) as $fields) {
312
+ $currentData = array_merge($currentData, $fields);
313
  }
314
  // By passing the setField call on the API is far more efficient
315
+ $delivery->withFields($currentData);
316
  }
317
 
318
  /**
338
  */
339
  public function getContentTagForRecommendation($tagObject, $rec)
340
  {
341
+ $readTags = $tagObject->read()->where->name->equalTo($rec->getName());
 
 
 
 
 
 
342
  if ($rec->hasTagId()) {
343
+ $readTags->or->id->is($rec->getTagId());
344
  }
345
+ $tags = $readTags->withIncludeContent(true)->getIterator()->toArray();
346
+ $tag = current($tags);
347
  if (count($tags) > 1) {
348
  Mage::throwException("Unable to find unique tag for {$rec->getName()}.");
349
  } else if (!$tag) {
350
+ $tag = $tagObject->createObject()->withName($rec->getName());
 
351
  }
352
  return $tag;
353
  }
app/code/community/Bronto/Product/Model/Collect/Bestseller.php CHANGED
@@ -13,7 +13,9 @@ class Bronto_Product_Model_Collect_Bestseller extends Bronto_Product_Model_Colle
13
  ->setPeriod('day')
14
  ->addStoreFilter(array($this->getStoreId()))
15
  ->setDateRange(date('Y-m-d', strtotime('-' . self::DAYS_THRESHOLD . 'days')), date('Y-m-d'))
16
- ->setPageSize($this->getRemainingCount());
 
 
17
 
18
  if (!empty($this->_excluded)) {
19
  $bestSellers->addFieldToFilter('product_id', array('nin' => array_keys($this->_excluded)));
13
  ->setPeriod('day')
14
  ->addStoreFilter(array($this->getStoreId()))
15
  ->setDateRange(date('Y-m-d', strtotime('-' . self::DAYS_THRESHOLD . 'days')), date('Y-m-d'))
16
+ ->setPageSize($this->getRemainingCount())
17
+ ->setOrder('qty_ordered', 'DESC');
18
+
19
 
20
  if (!empty($this->_excluded)) {
21
  $bestSellers->addFieldToFilter('product_id', array('nin' => array_keys($this->_excluded)));
app/code/community/Bronto/Product/Model/Collect/Mostviewed.php CHANGED
@@ -12,7 +12,8 @@ class Bronto_Product_Model_Collect_Mostviewed extends Bronto_Product_Model_Colle
12
  $mostViewed = Mage::getResourceModel('reports/report_product_viewed_collection')
13
  ->addStoreFilter(array($this->getStoreId()))
14
  ->setDateRange(date('Y-m-d', strtotime('-' . self::DAYS_THRESHOLD . ' days')), date('Y-m-d'))
15
- ->setPageSize($this->getRemainingCount());
 
16
 
17
  // Add Status and visibility filters
18
  return $this->_fillProducts($mostViewed);
12
  $mostViewed = Mage::getResourceModel('reports/report_product_viewed_collection')
13
  ->addStoreFilter(array($this->getStoreId()))
14
  ->setDateRange(date('Y-m-d', strtotime('-' . self::DAYS_THRESHOLD . ' days')), date('Y-m-d'))
15
+ ->setPageSize($this->getRemainingCount())
16
+ ->setOrder('views_num', 'DESC');
17
 
18
  // Add Status and visibility filters
19
  return $this->_fillProducts($mostViewed);
app/code/community/Bronto/Product/Model/Observer.php CHANGED
@@ -93,18 +93,16 @@ class Bronto_Product_Model_Observer
93
  }
94
 
95
  $api = $helper->getApi(null, 'store', $store->getId());
96
- $tagObject = $api->getContentTagObject();
97
  $appEmulation = Mage::getSingleton('core/app_emulation');
98
  $emulatedInfo = $appEmulation->startEnvironmentEmulation($store->getId());
99
  foreach ($recTags as $recTag) {
100
  $results['total']++;
101
  try {
102
  $tag = $helper->getContentTagForRecommendation($tagObject, $recTag);
103
- $tag->value = $helper->processTagContent($recTag, $store->getId());
104
- $tag->save();
105
- $recTag
106
- ->setTagId($tag->id)
107
- ->save();
108
  $results['success']++;
109
  } catch (Exception $e) {
110
  $message = $e->getMessage();
93
  }
94
 
95
  $api = $helper->getApi(null, 'store', $store->getId());
96
+ $tagObject = $api->transferContentTag();
97
  $appEmulation = Mage::getSingleton('core/app_emulation');
98
  $emulatedInfo = $appEmulation->startEnvironmentEmulation($store->getId());
99
  foreach ($recTags as $recTag) {
100
  $results['total']++;
101
  try {
102
  $tag = $helper->getContentTagForRecommendation($tagObject, $recTag);
103
+ $tag->withValue($helper->processTagContent($recTag, $store->getId()));
104
+ $newTag = $tagObject->save($tag);
105
+ $recTag->setTagId($newTag->getId())->save();
 
 
106
  $results['success']++;
107
  } catch (Exception $e) {
108
  $message = $e->getMessage();
app/code/community/Bronto/Product/controllers/Adminhtml/RecommendationsController.php CHANGED
@@ -395,15 +395,16 @@ class Bronto_Product_Adminhtml_RecommendationsController extends Mage_Adminhtml_
395
  throw new RuntimeException('Please select a message ID.');
396
  }
397
 
 
 
398
  $contact = Mage::helper('bronto_common/contact')->getContactByEmail($emailAddress, 'Magento Test Delivery', $storeId);
399
- if (empty($contact->id)) {
400
- $contact->status = Bronto_Api_Contact::STATUS_ONBOARDING;
401
- $contact->save();
402
  }
403
 
404
- $api = Mage::helper('bronto_common')->getApi(null, 'store', $storeId);
405
- $deliveryObject = $api->getDeliveryObject();
406
- $delivery = $deliveryObject->createRow();
407
  $delivery->messageId = $messageId;
408
  $delivery->fromEmail = $emailAddress;
409
  $delivery->fromName = 'Product Recommendation';
@@ -425,8 +426,7 @@ class Bronto_Product_Adminhtml_RecommendationsController extends Mage_Adminhtml_
425
  $delivery,
426
  $storeId);
427
  $appEmulation->stopEnvironmentEmulation($emulatedInfo);
428
-
429
- $deliveryObject->add($delivery);
430
  $json['success'] = true;
431
  $json['message'] = Mage::getBlockSingleton('core/messages')
432
  ->addSuccess($this->__('Test message successfully send to ' . $emailAddress . '.'))
@@ -440,6 +440,12 @@ class Bronto_Product_Adminhtml_RecommendationsController extends Mage_Adminhtml_
440
  $e->getMessage();
441
  }
442
 
 
 
 
 
 
 
443
  $this->getResponse()
444
  ->setHeader('Content-Type', 'application/json')
445
  ->setBody(Mage::helper('core')->jsonEncode($json));
395
  throw new RuntimeException('Please select a message ID.');
396
  }
397
 
398
+ $api = Mage::helper('bronto_common')->getApi(null, 'store', $storeId);
399
+
400
  $contact = Mage::helper('bronto_common/contact')->getContactByEmail($emailAddress, 'Magento Test Delivery', $storeId);
401
+ if (!$contact->hasId()) {
402
+ $contact->status = Bronto_Api_Model_Contact::STATUS_ONBOARDING;
403
+ $api->transferContact()->save($contact);
404
  }
405
 
406
+ $deliveryObject = $api->transferDelivery();
407
+ $delivery = $deliveryObject->createObject();
 
408
  $delivery->messageId = $messageId;
409
  $delivery->fromEmail = $emailAddress;
410
  $delivery->fromName = 'Product Recommendation';
426
  $delivery,
427
  $storeId);
428
  $appEmulation->stopEnvironmentEmulation($emulatedInfo);
429
+ $deliveryObject->add()->addDelivery($delivery)->first();
 
430
  $json['success'] = true;
431
  $json['message'] = Mage::getBlockSingleton('core/messages')
432
  ->addSuccess($this->__('Test message successfully send to ' . $emailAddress . '.'))
440
  $e->getMessage();
441
  }
442
 
443
+ if ($api) {
444
+ Mage::helper('bronto_product')->writeVerboseDebug("===== Test Send =====", "bronto_product_api.log");
445
+ Mage::helper('bronto_product')->writeVerboseDebug(var_export($api->getLastRequest(), true), "bronto_product_api.log");
446
+ Mage::helper('bronto_product')->writeVerboseDebug(var_export($api->getLastResponse(), true), "bronto_product_api.log");
447
+ }
448
+
449
  $this->getResponse()
450
  ->setHeader('Content-Type', 'application/json')
451
  ->setBody(Mage::helper('core')->jsonEncode($json));
app/code/community/Bronto/Reminder/Block/Adminhtml/Reminder/Edit/Tab/Bronto.php CHANGED
@@ -74,7 +74,7 @@ class Bronto_Reminder_Block_Adminhtml_Reminder_Edit_Tab_Bronto extends Mage_Admi
74
  'value' => 'transactional',
75
  'values' => array(
76
  array('value' => 'transactional', 'label' => ' Send as Transactional'),
77
- array('value' => 'marketing', 'label' => ' Send as Marketing'),
78
  ),
79
  'fieldset_html_class' => 'store',
80
  'disabled' => $disabled
74
  'value' => 'transactional',
75
  'values' => array(
76
  array('value' => 'transactional', 'label' => ' Send as Transactional'),
77
+ array('value' => 'triggered', 'label' => ' Send as Marketing'),
78
  ),
79
  'fieldset_html_class' => 'store',
80
  'disabled' => $disabled
app/code/community/Bronto/Reminder/Model/Email/Message.php CHANGED
@@ -35,12 +35,12 @@ class Bronto_Reminder_Model_Email_Message extends Bronto_Common_Model_Email_Temp
35
  /**
36
  * Log about the functionality of sending the email before it goes out
37
  *
38
- * @param Bronto_Api_Contact_Row $contact
39
- * @param Bronto_Api_Message_Row $message
40
  *
41
  * @return void
42
  */
43
- protected function _beforeSend(Bronto_Api_Contact_Row $contact, Bronto_Api_Message_Row $message)
44
  {
45
  Mage::dispatchEvent('bronto_reminder_send_before');
46
 
@@ -61,23 +61,13 @@ class Bronto_Reminder_Model_Email_Message extends Bronto_Common_Model_Email_Temp
61
  *
62
  * @param bool $success
63
  * @param string $error (optional)
64
- * @param Bronto_Api_Delivery_Row $delivery (optional)
65
  *
66
  * @return void
67
  */
68
- protected function _afterSend($success, $error = null, Bronto_Api_Delivery_Row $delivery = null)
69
  {
70
  Mage::dispatchEvent('bronto_reminder_send_after');
71
-
72
- if (!is_null($delivery)) {
73
- $helper = Mage::helper($this->_helper);
74
- $status = $success ? "Successful" : "Failed";
75
-
76
- $helper->writeVerboseDebug("===== $status Reminder Delivery =====", $this->_apiLogFile);
77
- $helper->writeVerboseDebug(var_export($delivery->getApi()->getLastRequest(), true), $this->_apiLogFile);
78
- $helper->writeVerboseDebug(var_export($delivery->getApi()->getLastResponse(), true), $this->_apiLogFile);
79
- }
80
-
81
  if (Mage::helper('bronto_reminder')->isLogEnabled()) {
82
  $this->_log->setSuccess((int)$success);
83
  if (!empty($error)) {
35
  /**
36
  * Log about the functionality of sending the email before it goes out
37
  *
38
+ * @param Bronto_Api_Model_Contact $contact
39
+ * @param Bronto_Api_Model_Message $message
40
  *
41
  * @return void
42
  */
43
+ protected function _beforeSend(Bronto_Api_Model_Contact $contact, Bronto_Api_Model_Message $message)
44
  {
45
  Mage::dispatchEvent('bronto_reminder_send_before');
46
 
61
  *
62
  * @param bool $success
63
  * @param string $error (optional)
64
+ * @param Bronto_Api_ $delivery (optional)
65
  *
66
  * @return void
67
  */
68
+ protected function _afterSend($success, $error = null, Bronto_Api_Model_Delivery $delivery = null)
69
  {
70
  Mage::dispatchEvent('bronto_reminder_send_after');
 
 
 
 
 
 
 
 
 
 
71
  if (Mage::helper('bronto_reminder')->isLogEnabled()) {
72
  $this->_log->setSuccess((int)$success);
73
  if (!empty($error)) {
app/code/community/Bronto/Reminder/Model/Mysql4/Customer/Collection.php CHANGED
@@ -18,6 +18,7 @@ class Bronto_Reminder_Model_Mysql4_Customer_Collection extends Mage_Customer_Mod
18
 
19
  $couponTable = $this->getTable('bronto_reminder/coupon');
20
  $logTable = $this->getTable('bronto_reminder/log');
 
21
 
22
  try {
23
  $salesRuleCouponTable = $this->getTable('salesrule/coupon');
@@ -27,6 +28,7 @@ class Bronto_Reminder_Model_Mysql4_Customer_Collection extends Mage_Customer_Mod
27
 
28
  $select->from(array('c' => $couponTable), array('store_id', 'unique_id', 'customer_id', 'customer_email', 'associated_at', 'emails_failed', 'is_active'));
29
  $select->where('c.rule_id = ?', $rule->getId());
 
30
 
31
  $subSelect = $this->getConnection()->select();
32
  $subSelect->from(array('g' => $logTable), array(
18
 
19
  $couponTable = $this->getTable('bronto_reminder/coupon');
20
  $logTable = $this->getTable('bronto_reminder/log');
21
+ $sendThreshold = Mage::helper('bronto_reminder')->getSendFailureThreshold();
22
 
23
  try {
24
  $salesRuleCouponTable = $this->getTable('salesrule/coupon');
28
 
29
  $select->from(array('c' => $couponTable), array('store_id', 'unique_id', 'customer_id', 'customer_email', 'associated_at', 'emails_failed', 'is_active'));
30
  $select->where('c.rule_id = ?', $rule->getId());
31
+ $select->where('c.emails_failed < ?', $sendThreshold);
32
 
33
  $subSelect = $this->getConnection()->select();
34
  $subSelect->from(array('g' => $logTable), array(
app/code/community/Bronto/Reminder/controllers/LoadController.php CHANGED
@@ -13,30 +13,26 @@ class Bronto_Reminder_LoadController extends Mage_Core_Controller_Front_Action
13
  public function indexAction()
14
  {
15
  // Acquire Parameters
16
- $storeCode = $this->getRequest()->getParam('___store', 'default');
17
  $quoteId = $this->getRequest()->getParam('id', false);
18
  $wishlistId = $this->getRequest()->getParam('wishlist_id', false);
19
  $ruleId = $this->getRequest()->getParam('rule_id', 0);
20
  $messageId = $this->getRequest()->getParam('message_id', 0);
21
 
22
  // Load store from store code and get ID
23
- $store = Mage::getModel('core/store')->load($storeCode);
24
  $storeId = $store->getId();
25
 
26
  // Set Defaults
27
  $wishlist = false;
28
  $redirectUrl = false;
29
 
30
- // Set Current Store to the acquired store id
31
- Mage::app()->setCurrentStore($storeId);
32
-
33
  // If quote ID is good, send to cart; If wishlist ID is good, send to wishlist
34
  if ($quote = $this->_handleQuote($quoteId, $storeId)) {
35
- $redirectUrl = Mage::app()->getStore()->getUrl('checkout/cart');
36
  } else if ($wishlist = $this->_handleWishlist($wishlistId, $storeId)) {
37
- $redirectUrl = Mage::app()->getStore()->getUrl('wishlist');
38
  } else {
39
- $this->_redirectUrl(Mage::app()->getStore()->getUrl('checkout/cart'));
40
  return;
41
  }
42
 
@@ -75,34 +71,13 @@ class Bronto_Reminder_LoadController extends Mage_Core_Controller_Front_Action
75
  }
76
  if ($forceLogin || (!$loggedIn && (!$pCookie || ($pCookie && !$isClear)))) {
77
  $session->setBeforeAuthUrl($redirectUrl);
78
- $redirectUrl = Mage::app()->getStore()->getUrl('customer/account/login');
79
  }
80
  }
81
 
82
  $this->_redirectUrl($redirectUrl);
83
  }
84
 
85
- /**
86
- * Use Store Code to pull Store Object
87
- *
88
- * @param string $storeCode
89
- *
90
- * @return boolean
91
- */
92
- protected function _getStoreByCode($storeCode)
93
- {
94
- $stores = array_keys(Mage::app()->getStores());
95
- foreach ($stores as $id) {
96
-
97
- $store = Mage::app()->getStore($id);
98
- if ($store->getCode() == $storeCode) {
99
- return $store;
100
- }
101
- }
102
-
103
- return false;
104
- }
105
-
106
  /**
107
  * Handle Quote
108
  *
13
  public function indexAction()
14
  {
15
  // Acquire Parameters
 
16
  $quoteId = $this->getRequest()->getParam('id', false);
17
  $wishlistId = $this->getRequest()->getParam('wishlist_id', false);
18
  $ruleId = $this->getRequest()->getParam('rule_id', 0);
19
  $messageId = $this->getRequest()->getParam('message_id', 0);
20
 
21
  // Load store from store code and get ID
22
+ $store = Mage::app()->getStore();
23
  $storeId = $store->getId();
24
 
25
  // Set Defaults
26
  $wishlist = false;
27
  $redirectUrl = false;
28
 
 
 
 
29
  // If quote ID is good, send to cart; If wishlist ID is good, send to wishlist
30
  if ($quote = $this->_handleQuote($quoteId, $storeId)) {
31
+ $redirectUrl = $store->getUrl('checkout/cart');
32
  } else if ($wishlist = $this->_handleWishlist($wishlistId, $storeId)) {
33
+ $redirectUrl = $store->getUrl('wishlist');
34
  } else {
35
+ $this->_redirectUrl($store->getUrl('checkout/cart'));
36
  return;
37
  }
38
 
71
  }
72
  if ($forceLogin || (!$loggedIn && (!$pCookie || ($pCookie && !$isClear)))) {
73
  $session->setBeforeAuthUrl($redirectUrl);
74
+ $redirectUrl = $store->getUrl('customer/account/login');
75
  }
76
  }
77
 
78
  $this->_redirectUrl($redirectUrl);
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  /**
82
  * Handle Quote
83
  *
app/code/community/Bronto/Reviews/Model/Log.php CHANGED
@@ -106,17 +106,19 @@ class Bronto_Reviews_Model_Log extends Mage_Core_Model_Abstract
106
  {
107
  if (array_key_exists($storeId, self::$_cancelableDeliveries)) {
108
  $api = Mage::helper('bronto_common')->getApi(null, 'store', $storeId);
109
- $deliveryObject = $api->getDeliveryObject();
110
  $deliveryRows = self::$_cancelableDeliveries[$storeId];
111
  try {
112
- $result = $deliveryObject->update($deliveryRows);
113
- if ($result->hasErrors()) {
114
- $errors = array();
115
- foreach ($result->getErrors() as $soapFault) {
116
- $errors[] = $soapFault['code'] . ": " . $soapFault['message'];
117
- }
118
- $error = implode('<br />', $errors);
119
- Mage::throwException($error);
 
 
120
  }
121
  } catch (Exception $e) {
122
  Mage::helper('bronto_reviews')->writeError('Failed Cancelling Deliveries: ' . $e->getMessage());
106
  {
107
  if (array_key_exists($storeId, self::$_cancelableDeliveries)) {
108
  $api = Mage::helper('bronto_common')->getApi(null, 'store', $storeId);
109
+ $deliveryObject = $api->transferDelivery();
110
  $deliveryRows = self::$_cancelableDeliveries[$storeId];
111
  try {
112
+ $results = $deliveryObject->update()
113
+ ->push($deliveryRows)
114
+ ->getIterator()
115
+ ->errorsOnly();
116
+ $errors = array();
117
+ foreach ($results as $result) {
118
+ $errors[] = "{$result->getItem()->getErrorCode()}: {$result->getItem()->getErrorString}";
119
+ }
120
+ if (count($errors) > 1) {
121
+ Mage::throwException(implode('<br/>', $errors));
122
  }
123
  } catch (Exception $e) {
124
  Mage::helper('bronto_reviews')->writeError('Failed Cancelling Deliveries: ' . $e->getMessage());
app/code/community/Bronto/Reviews/Model/Message.php CHANGED
@@ -127,15 +127,16 @@ class Bronto_Reviews_Model_Message extends Bronto_Common_Model_Email_Template
127
  /**
128
  * @see parent
129
  */
130
- protected function _afterSend($success, $error = null, Bronto_Api_Delivery_Row $delivery = null)
131
  {
132
  $helper = Mage::helper($this->_helper);
133
  if (!is_null($delivery)) {
134
  if ($success) {
135
  $queue = $this->getSendQueue();
 
136
  $orderId = $queue->getAdditionalData()->getOrderId();
137
  $log = Mage::getModel('bronto_reviews/log')
138
- ->loadByOrderAndDeliveryId($orderId, $queue->getId());
139
  $logId = $log->getId();
140
  $log->setData($queue->getAdditionalData()->getData());
141
  $log->setId($logId)
@@ -146,11 +147,6 @@ class Bronto_Reviews_Model_Message extends Bronto_Common_Model_Email_Template
146
  ->setDeliveryDate(date('Y-m-d H:i:s', strtotime($delivery->start)));
147
  $log->save();
148
  }
149
- $status = $success ? 'Successful' : 'Failed';
150
-
151
- $helper->writeVerboseDebug("===== $status Reviews Delivery =====", $this->_apiLogFile);
152
- $helper->writeVerboseDebug(var_export($delivery->getApi()->getLastRequest(), true), $this->_apiLogFile);
153
- $helper->writeVerboseDebug(var_export($delivery->getApi()->getLastResponse(), true), $this->_apiLogFile);
154
  }
155
  }
156
  }
127
  /**
128
  * @see parent
129
  */
130
+ protected function _afterSend($success, $error = null, Bronto_Api_Model_Delivery $delivery = null)
131
  {
132
  $helper = Mage::helper($this->_helper);
133
  if (!is_null($delivery)) {
134
  if ($success) {
135
  $queue = $this->getSendQueue();
136
+ $deliveryId = $queue->getId() ? $queue->getId() : $delivery->id;
137
  $orderId = $queue->getAdditionalData()->getOrderId();
138
  $log = Mage::getModel('bronto_reviews/log')
139
+ ->loadByOrderAndDeliveryId($orderId, $deliveryId);
140
  $logId = $log->getId();
141
  $log->setData($queue->getAdditionalData()->getData());
142
  $log->setId($logId)
147
  ->setDeliveryDate(date('Y-m-d H:i:s', strtotime($delivery->start)));
148
  $log->save();
149
  }
 
 
 
 
 
150
  }
151
  }
152
  }
app/code/community/Bronto/Reviews/Model/Observer.php CHANGED
@@ -29,7 +29,7 @@ class Bronto_Reviews_Model_Observer
29
  {
30
  if ($observer->getOrder()) {
31
  $appEmulation = Mage::getSingleton('core/app_emulation');
32
- $emulatedInfo = $appEmulation->startEnvironmentEmulation($observer->getOrder()->getStoreId());
33
  try {
34
  $this->_processOrder($observer->getOrder());
35
  } catch (Exception $e) {
@@ -125,7 +125,7 @@ class Bronto_Reviews_Model_Observer
125
  $productUrl = $productHelper->getProductAttribute($product, 'url', $storeId) . $urlSuffix;
126
  $reviewUrl = $this->_helper->getReviewsUrl($product, $storeId) . $urlSuffix;
127
  $reviewMessage->addDeliveryField("reviewUrl_{$index}", $reviewUrl);
128
- $reviewMessage->addDeliveryField("productUrl_{$index}", $reviewUrl);
129
  }
130
  $index++;
131
  }
@@ -220,10 +220,29 @@ class Bronto_Reviews_Model_Observer
220
  $this->_helper->isPostEnabled($postType, 'store', $storeId) &&
221
  $this->_helper->getPostTrigger($postType, 'store', $storeId) == $status &&
222
  $context->isSendingUnlocked() &&
 
223
  $this->_passSendLimitCheck($context)
224
  );
225
  }
226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  /**
228
  * Makes a check for the send limit
229
  *
@@ -287,8 +306,8 @@ class Bronto_Reviews_Model_Observer
287
  );
288
  }
289
 
290
- $message = new Bronto_Api_Message_Row();
291
- $message->id = $this->_helper->getDefaultMessage($context->getPost(), $storeId);
292
  $filterData = array('order' => $order) + $context->getExtra();
293
  if ($context->hasPost()) {
294
  unset($filterData['order']);
29
  {
30
  if ($observer->getOrder()) {
31
  $appEmulation = Mage::getSingleton('core/app_emulation');
32
+ $emulatedInfo = $appEmulation->startEnvironmentEmulation($observer->getOrder()->getStoreId(), 'frontend');
33
  try {
34
  $this->_processOrder($observer->getOrder());
35
  } catch (Exception $e) {
125
  $productUrl = $productHelper->getProductAttribute($product, 'url', $storeId) . $urlSuffix;
126
  $reviewUrl = $this->_helper->getReviewsUrl($product, $storeId) . $urlSuffix;
127
  $reviewMessage->addDeliveryField("reviewUrl_{$index}", $reviewUrl);
128
+ $reviewMessage->addDeliveryField("productUrl_{$index}", $productUrl);
129
  }
130
  $index++;
131
  }
220
  $this->_helper->isPostEnabled($postType, 'store', $storeId) &&
221
  $this->_helper->getPostTrigger($postType, 'store', $storeId) == $status &&
222
  $context->isSendingUnlocked() &&
223
+ !$this->_alreadyScheduledForOrder($context) &&
224
  $this->_passSendLimitCheck($context)
225
  );
226
  }
227
 
228
+ /**
229
+ * Check to see if a delivery is scheduled for this post type and order
230
+ *
231
+ * @param Bronto_Reviews_Model_Process_Context $context
232
+ * @return boolean
233
+ */
234
+ protected function _alreadyScheduledForOrder($context)
235
+ {
236
+ $orderId = $context->getOrder()->getId();
237
+ $postId = null;
238
+ if ($context->hasPost()) {
239
+ $postId = $context->getPost()->getId();
240
+ }
241
+ $log = Mage::getModel('bronto_reviews/log')
242
+ ->loadByOrderAndPost($orderId, $postId);
243
+ return $log->isQueued() || $log->isCancelable();
244
+ }
245
+
246
  /**
247
  * Makes a check for the send limit
248
  *
306
  );
307
  }
308
 
309
+ $message = new Bronto_Api_Model_Message();
310
+ $message->withId($this->_helper->getDefaultMessage($context->getPost(), $storeId));
311
  $filterData = array('order' => $order) + $context->getExtra();
312
  if ($context->hasPost()) {
313
  unset($filterData['order']);
app/code/community/Bronto/Reviews/sql/bronto_reviews_setup/mysql4-upgrade-0.0.1-0.0.2.php CHANGED
@@ -5,7 +5,6 @@ $installer = $this;
5
  $installer->startSetup();
6
 
7
  try {
8
- $installer->updateTables('0.0.2');
9
  $installer->setCustomEmail();
10
  $installer->createTable('log');
11
  $installer->createTable('post_purchase');
5
  $installer->startSetup();
6
 
7
  try {
 
8
  $installer->setCustomEmail();
9
  $installer->createTable('log');
10
  $installer->createTable('post_purchase');
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/About.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_About
13
  extends Bronto_Common_Block_Adminhtml_System_Config_About
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_About
12
  extends Bronto_Common_Block_Adminhtml_System_Config_About
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Advanced/Observersearch.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Advanced_Observersearch
13
  extends Mage_Adminhtml_Block_Template
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_Advanced_Observersearch
12
  extends Mage_Adminhtml_Block_Template
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Conflictchecker.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Conflictchecker
13
  extends Mage_Adminhtml_Block_Abstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_Conflictchecker
12
  extends Mage_Adminhtml_Block_Abstract
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Apitoken.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Apitoken
13
  extends Mage_Adminhtml_Block_System_Config_Form_Field
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Apitoken
12
  extends Mage_Adminhtml_Block_System_Config_Form_Field
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Classpath.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Classpath extends Mage_Adminhtml_Block_System_Config_Form_Field
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Classpath extends Mage_Adminhtml_Block_System_Config_Form_Field
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Conflict.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Conflict extends Mage_Adminhtml_Block_System_Config_Form_Field
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Conflict extends Mage_Adminhtml_Block_System_Config_Form_Field
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Events.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Events extends Mage_Adminhtml_Block_System_Config_Form_Field
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Events extends Mage_Adminhtml_Block_System_Config_Form_Field
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Form/Field/Roundtrip.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Roundtrip extends Mage_Adminhtml_Block_System_Config_Form_Field
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_System_Config_Form_Field_Roundtrip extends Mage_Adminhtml_Block_System_Config_Form_Field
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Installs.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  *
12
  */
13
  class Bronto_Verify_Block_Adminhtml_System_Config_Installs
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  *
11
  */
12
  class Bronto_Verify_Block_Adminhtml_System_Config_Installs
app/code/community/Bronto/Verify/Block/Adminhtml/System/Config/Permissionchecker.php CHANGED
@@ -10,7 +10,6 @@
10
  * @package Bronto_Verify
11
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
12
  * @copyright 2013 Adam Daniels
13
- * @license http://www.atlanticbt.com/ Atlantic BT
14
  */
15
  class Bronto_Verify_Block_Adminhtml_System_Config_Permissionchecker
16
  extends Mage_Adminhtml_Block_Abstract
10
  * @package Bronto_Verify
11
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
12
  * @copyright 2013 Adam Daniels
 
13
  */
14
  class Bronto_Verify_Block_Adminhtml_System_Config_Permissionchecker
15
  extends Mage_Adminhtml_Block_Abstract
app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Classpath.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Classpath extends Mage_Adminhtml_Block_Widget_Button
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Classpath extends Mage_Adminhtml_Block_Widget_Button
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Conflict.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Conflict extends Mage_Adminhtml_Block_Widget_Button
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Conflict extends Mage_Adminhtml_Block_Widget_Button
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Events.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Events extends Mage_Adminhtml_Block_Widget_Button
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Events extends Mage_Adminhtml_Block_Widget_Button
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Permissions.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Permissions extends Mage_Adminhtml_Block_Widget_Button
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Permissions extends Mage_Adminhtml_Block_Widget_Button
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Runroundtrip.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Runroundtrip extends Mage_Adminhtml_Block_Widget_Button
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Runroundtrip extends Mage_Adminhtml_Block_Widget_Button
12
  {
app/code/community/Bronto/Verify/Block/Adminhtml/Widget/Button/Runtoken.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Runtoken extends Mage_Adminhtml_Block_Widget_Button
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Adminhtml_Widget_Button_Runtoken extends Mage_Adminhtml_Block_Widget_Button
12
  {
app/code/community/Bronto/Verify/Block/Conflictprinter.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Conflictprinter
13
  extends Mage_Adminhtml_Block_Template
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Conflictprinter
12
  extends Mage_Adminhtml_Block_Template
app/code/community/Bronto/Verify/Block/Permissionprinter.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Block_Permissionprinter
13
  extends Mage_Adminhtml_Block_Template
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Block_Permissionprinter
12
  extends Mage_Adminhtml_Block_Template
app/code/community/Bronto/Verify/Helper/Apitoken.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Helper_Apitoken
13
  extends Bronto_Verify_Helper_Data
@@ -124,10 +123,9 @@ class Bronto_Verify_Helper_Apitoken
124
  {
125
  try {
126
  $api = $this->getApi($this->_token);
127
- $tokenRow = $api->getTokenInfo();
128
-
129
- $access = $tokenRow->hasPermissions(7);
130
 
 
131
  if (!$access) {
132
  $this->_status = 0;
133
  $this->_reason = 'Token Does Not Have Full Access';
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Helper_Apitoken
12
  extends Bronto_Verify_Helper_Data
123
  {
124
  try {
125
  $api = $this->getApi($this->_token);
126
+ $tokenRow = $api->transferApiToken()->getById($this->_token);
 
 
127
 
128
+ $access = $tokenRow->getPermissions() == 7;
129
  if (!$access) {
130
  $this->_status = 0;
131
  $this->_reason = 'Token Does Not Have Full Access';
app/code/community/Bronto/Verify/Helper/Conflictchecker.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Helper_Conflictchecker
13
  extends Bronto_Verify_Helper_Data
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Helper_Conflictchecker
12
  extends Bronto_Verify_Helper_Data
app/code/community/Bronto/Verify/Helper/Data.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Helper_Data
13
  extends Bronto_Common_Helper_Data
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Helper_Data
12
  extends Bronto_Common_Helper_Data
app/code/community/Bronto/Verify/Helper/Permissionchecker.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Helper_Permissionchecker
13
  extends Bronto_Verify_Helper_Data
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Helper_Permissionchecker
12
  extends Bronto_Verify_Helper_Data
app/code/community/Bronto/Verify/Helper/Roundtrip.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Helper_Roundtrip
13
  extends Bronto_Verify_Helper_Data
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Helper_Roundtrip
12
  extends Bronto_Verify_Helper_Data
app/code/community/Bronto/Verify/Model/Config/Blocks.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Config_Blocks
13
  extends Bronto_Verify_Model_Config_ConfigAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Config_Blocks
12
  extends Bronto_Verify_Model_Config_ConfigAbstract
app/code/community/Bronto/Verify/Model/Config/Checker.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Config_Checker
13
  extends Bronto_Verify_Model_Config_ConfigAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Config_Checker
12
  extends Bronto_Verify_Model_Config_ConfigAbstract
app/code/community/Bronto/Verify/Model/Config/ConfigAbstract.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  abstract class Bronto_Verify_Model_Config_ConfigAbstract
13
  extends Mage_Core_Model_Abstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  abstract class Bronto_Verify_Model_Config_ConfigAbstract
12
  extends Mage_Core_Model_Abstract
app/code/community/Bronto/Verify/Model/Config/ConfigInterface.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  interface Bronto_Verify_Model_Config_ConfigInterface
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  interface Bronto_Verify_Model_Config_ConfigInterface
12
  {
app/code/community/Bronto/Verify/Model/Config/Datastore.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Config_Datastore
13
  extends Mage_Core_Model_Abstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Config_Datastore
12
  extends Mage_Core_Model_Abstract
app/code/community/Bronto/Verify/Model/Config/Helpers.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Config_Helpers
13
  extends Bronto_Verify_Model_Config_ConfigAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Config_Helpers
12
  extends Bronto_Verify_Model_Config_ConfigAbstract
app/code/community/Bronto/Verify/Model/Config/Models.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Config_Models
13
  extends Bronto_Verify_Model_Config_ConfigAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Config_Models
12
  extends Bronto_Verify_Model_Config_ConfigAbstract
app/code/community/Bronto/Verify/Model/Config/Printer.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Config_Printer
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Config_Printer
12
  {
app/code/community/Bronto/Verify/Model/Config/Resources.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Config_Resources
13
  extends Bronto_Verify_Model_Config_ConfigAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Config_Resources
12
  extends Bronto_Verify_Model_Config_ConfigAbstract
app/code/community/Bronto/Verify/Model/Contact/Builder.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Contact_Builder
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Contact_Builder
12
  {
app/code/community/Bronto/Verify/Model/Core/Config.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Core_Config
13
  extends Bronto_Verify_Model_Core_Config_Base
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Core_Config
12
  extends Bronto_Verify_Model_Core_Config_Base
app/code/community/Bronto/Verify/Model/Core/Config/Base.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Core_Config_Base
13
  extends Bronto_Verify_Model_Lib_Varien_Simplexml_Config
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Core_Config_Base
12
  extends Bronto_Verify_Model_Lib_Varien_Simplexml_Config
app/code/community/Bronto/Verify/Model/Core/Config/Element.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Core_Config_Element
13
  extends Bronto_Verify_Model_Lib_Varien_Simplexml_Element
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Core_Config_Element
12
  extends Bronto_Verify_Model_Lib_Varien_Simplexml_Element
app/code/community/Bronto/Verify/Model/Lib/Varien/Simplexml/Config.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Lib_Varien_Simplexml_Config
13
  extends Varien_Simplexml_Config
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Lib_Varien_Simplexml_Config
12
  extends Varien_Simplexml_Config
app/code/community/Bronto/Verify/Model/Lib/Varien/Simplexml/Element.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Lib_Varien_Simplexml_Element
13
  extends Varien_Simplexml_Element
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Lib_Varien_Simplexml_Element
12
  extends Varien_Simplexml_Element
app/code/community/Bronto/Verify/Model/Mysql4/Core/Config.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Mysql4_Core_Config
13
  extends Bronto_Verify_Model_Resource_Core_Config
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Mysql4_Core_Config
12
  extends Bronto_Verify_Model_Resource_Core_Config
app/code/community/Bronto/Verify/Model/Path/Locator/Array.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Path_Locator_Array
13
  extends Bronto_Verify_Model_Path_Locator_IteratorAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Path_Locator_Array
12
  extends Bronto_Verify_Model_Path_Locator_IteratorAbstract
app/code/community/Bronto/Verify/Model/Path/Locator/Factory.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Path_Locator_Factory
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Path_Locator_Factory
12
  {
app/code/community/Bronto/Verify/Model/Path/Locator/IteratorAbstract.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  abstract class Bronto_Verify_Model_Path_Locator_IteratorAbstract
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  abstract class Bronto_Verify_Model_Path_Locator_IteratorAbstract
12
  {
app/code/community/Bronto/Verify/Model/Path/Locator/LocatorInterface.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  interface Bronto_Verify_Model_Path_Locator_LocatorInterface
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  interface Bronto_Verify_Model_Path_Locator_LocatorInterface
12
  {
app/code/community/Bronto/Verify/Model/Path/Locator/Stack.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Path_Locator_Stack
13
  extends Bronto_Verify_Model_Path_Locator_IteratorAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Path_Locator_Stack
12
  extends Bronto_Verify_Model_Path_Locator_IteratorAbstract
app/code/community/Bronto/Verify/Model/Resource/Core/Config.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Resource_Core_Config
13
  extends Bronto_Verify_Model_Resource_Db_Abstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Resource_Core_Config
12
  extends Bronto_Verify_Model_Resource_Db_Abstract
app/code/community/Bronto/Verify/Model/Resource/Db/Abstract.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  abstract class Bronto_Verify_Model_Resource_Db_Abstract extends Mage_Core_Model_Resource_Abstract
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  abstract class Bronto_Verify_Model_Resource_Db_Abstract extends Mage_Core_Model_Resource_Abstract
12
  {
app/code/community/Bronto/Verify/Model/Roundtrip.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Roundtrip
13
  {
@@ -40,7 +39,7 @@ class Bronto_Verify_Model_Roundtrip
40
  // Commented out due to a 500 error when not requesting body
41
  // curl_setopt($ch, CURLOPT_NOBODY, true); // don't return body, just return header
42
 
43
- $ch = curl_init(Bronto_Api::BASE_WSDL);
44
  curl_exec($ch);
45
  $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
46
  curl_close($ch);
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Roundtrip
12
  {
39
  // Commented out due to a 500 error when not requesting body
40
  // curl_setopt($ch, CURLOPT_NOBODY, true); // don't return body, just return header
41
 
42
+ $ch = curl_init(Bronto_Api::BASE_URI);
43
  curl_exec($ch);
44
  $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
45
  curl_close($ch);
app/code/community/Bronto/Verify/Model/Validator/Checker.php CHANGED
@@ -9,7 +9,6 @@
9
  * @package Bronto_Verify
10
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
11
  * @copyright 2013 Adam Daniels
12
- * @license http://www.atlanticbt.com/ Atlantic BT
13
  */
14
  class Bronto_Verify_Model_Validator_Checker
15
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
9
  * @package Bronto_Verify
10
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
11
  * @copyright 2013 Adam Daniels
 
12
  */
13
  class Bronto_Verify_Model_Validator_Checker
14
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
app/code/community/Bronto/Verify/Model/Validator/Directory.php CHANGED
@@ -9,7 +9,6 @@
9
  * @package Bronto_Verify
10
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
11
  * @copyright 2013 Adam Daniels
12
- * @license http://www.atlanticbt.com/ Atlantic BT
13
  */
14
  class Bronto_Verify_Model_Validator_Directory
15
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
9
  * @package Bronto_Verify
10
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
11
  * @copyright 2013 Adam Daniels
 
12
  */
13
  class Bronto_Verify_Model_Validator_Directory
14
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
app/code/community/Bronto/Verify/Model/Validator/File.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Validator_File
13
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Validator_File
12
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
app/code/community/Bronto/Verify/Model/Validator/Filter/PatternIterator.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Validator_Filter_PatternIterator
13
  extends RecursiveFilterIterator
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Validator_Filter_PatternIterator
12
  extends RecursiveFilterIterator
app/code/community/Bronto/Verify/Model/Validator/Group.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Validator_Group
13
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Validator_Group
12
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
app/code/community/Bronto/Verify/Model/Validator/Owner.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Validator_Owner
13
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Validator_Owner
12
  extends Bronto_Verify_Model_Validator_ValidatorAbstract
app/code/community/Bronto/Verify/Model/Validator/Printer.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Model_Validator_Printer
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Model_Validator_Printer
12
  {
app/code/community/Bronto/Verify/Model/Validator/ValidatorAbstract.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  abstract class Bronto_Verify_Model_Validator_ValidatorAbstract
13
  extends Mage_Core_Model_Abstract
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  abstract class Bronto_Verify_Model_Validator_ValidatorAbstract
12
  extends Mage_Core_Model_Abstract
app/code/community/Bronto/Verify/Model/Validator/ValidatorInterface.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  interface Bronto_Verify_Model_Validator_ValidatorInterface
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  interface Bronto_Verify_Model_Validator_ValidatorInterface
12
  {
app/code/community/Bronto/Verify/controllers/Adminhtml/AdvancedController.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Adminhtml_AdvancedController extends Mage_Adminhtml_Controller_Action
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Adminhtml_AdvancedController extends Mage_Adminhtml_Controller_Action
12
  {
app/code/community/Bronto/Verify/controllers/Adminhtml/ApitokenController.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Adminhtml_ApitokenController extends Mage_Adminhtml_Controller_Action
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Adminhtml_ApitokenController extends Mage_Adminhtml_Controller_Action
12
  {
app/code/community/Bronto/Verify/controllers/Adminhtml/ConflictcheckerController.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Adminhtml_ConflictcheckerController extends Mage_Adminhtml_Controller_Action
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Adminhtml_ConflictcheckerController extends Mage_Adminhtml_Controller_Action
12
  {
app/code/community/Bronto/Verify/controllers/Adminhtml/PermissioncheckerController.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Adminhtml_PermissioncheckerController extends Mage_Adminhtml_Controller_Action
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Adminhtml_PermissioncheckerController extends Mage_Adminhtml_Controller_Action
12
  {
app/code/community/Bronto/Verify/controllers/Adminhtml/RoundtripController.php CHANGED
@@ -7,7 +7,6 @@
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
10
- * @license http://www.atlanticbt.com/ Atlantic BT
11
  */
12
  class Bronto_Verify_Adminhtml_RoundtripController extends Mage_Adminhtml_Controller_Action
13
  {
7
  * @package Bronto_Verify
8
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
9
  * @copyright 2013 Adam Daniels
 
10
  */
11
  class Bronto_Verify_Adminhtml_RoundtripController extends Mage_Adminhtml_Controller_Action
12
  {
app/code/community/Bronto/Verify/etc/adminhtml.xml CHANGED
@@ -5,7 +5,6 @@
5
  * @package Bronto_Verify
6
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
7
  * @copyright 2012 Atlantic BT
8
- * @license http://www.atlanticbt.com/ Atlantic BT
9
  */
10
  -->
11
  <config>
5
  * @package Bronto_Verify
6
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
7
  * @copyright 2012 Atlantic BT
 
8
  */
9
  -->
10
  <config>
app/code/community/Bronto/Verify/etc/config.xml CHANGED
@@ -5,7 +5,6 @@
5
  * @package Bronto_Verify
6
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
7
  * @copyright 2013 Adam Daniels
8
- * @license http://www.atlanticbt.com/ Atlantic BT
9
  */
10
  -->
11
  <config>
5
  * @package Bronto_Verify
6
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
7
  * @copyright 2013 Adam Daniels
 
8
  */
9
  -->
10
  <config>
app/code/community/Bronto/Verify/etc/system.xml CHANGED
@@ -5,7 +5,6 @@
5
  * @package Bronto_Verify
6
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
7
  * @copyright 2013 Adam Daniels
8
- * @license http://www.atlanticbt.com/ Atlantic BT
9
  */
10
  -->
11
  <config>
5
  * @package Bronto_Verify
6
  * @author Adam Daniels <adam.daniels@atlanticbt.com>
7
  * @copyright 2013 Adam Daniels
 
8
  */
9
  -->
10
  <config>
app/design/adminhtml/default/default/template/bronto/email/template/list.phtml CHANGED
@@ -1,29 +1,3 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
  <?php /** @var $this Bronto_Email_Block_Adminhtml_System_Email_Template */ ?>
28
  <div style="padding:6px; margin-bottom:10px; background-color:#eee; border:1px solid #dedede">See <?php echo $this->getConfigLink() ?> for additional configuration </td></div>
29
  <div class="content-header">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php /** @var $this Bronto_Email_Block_Adminhtml_System_Email_Template */ ?>
2
  <div style="padding:6px; margin-bottom:10px; background-color:#eee; border:1px solid #dedede">See <?php echo $this->getConfigLink() ?> for additional configuration </td></div>
3
  <div class="content-header">
app/design/adminhtml/default/default/template/bronto/product/recommendation/preview.phtml CHANGED
@@ -86,8 +86,8 @@ function messagePicker() {
86
  method: 'post',
87
  parameters: {
88
  entity_id: $('entity_id').value,
89
- message_id: $('hmessage_idh').value,
90
- email_address: $('hemail_addressh').value,
91
  'product_ids[]': $('product_ids').value.split(/\s*,\s*/)
92
  },
93
  onSuccess: function(resp) {
86
  method: 'post',
87
  parameters: {
88
  entity_id: $('entity_id').value,
89
+ message_id: $('message_id').value,
90
+ email_address: $('email_address').value,
91
  'product_ids[]': $('product_ids').value.split(/\s*,\s*/)
92
  },
93
  onSuccess: function(resp) {
app/design/adminhtml/default/default/template/bronto/reminder/grid/container.phtml CHANGED
@@ -1,29 +1,3 @@
1
- <?php
2
- /**
3
- * Magento Enterprise Edition
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Magento Enterprise Edition License
8
- * that is bundled with this package in the file LICENSE_EE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://www.magentocommerce.com/license/enterprise-edition
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://www.magentocommerce.com/license/enterprise-edition
25
- */
26
- ?>
27
  <?php /** @var $this Bronto_Reminder_Block_Adminhtml_Reminder */ ?>
28
  <div style="padding:6px; margin-bottom:10px; background-color:#eee; border:1px solid #dedede">See <?php echo $this->getConfigLink() ?> for additional configuration </td></div>
29
  <div class="content-header">
@@ -36,4 +10,4 @@
36
  </div>
37
  <div>
38
  <?php echo $this->getGridHtml() ?>
39
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php /** @var $this Bronto_Reminder_Block_Adminhtml_Reminder */ ?>
2
  <div style="padding:6px; margin-bottom:10px; background-color:#eee; border:1px solid #dedede">See <?php echo $this->getConfigLink() ?> for additional configuration </td></div>
3
  <div class="content-header">
10
  </div>
11
  <div>
12
  <?php echo $this->getGridHtml() ?>
13
+ </div>
app/design/frontend/base/default/template/bronto/common/recovery.phtml CHANGED
@@ -32,7 +32,8 @@
32
  <div id="bronto-cart-recovery-discount-amount"><?php echo $this->getDiscountAmount(); ?></div>
33
  <div id="bronto-cart-recovery-subtotal"><?php echo $this->getSalesObject()->getSubtotal(); ?></div>
34
  <div id="bronto-cart-recovery-tax-amount"><?php echo $this->getSalesObject()->getTaxAmount(); ?></div>
 
35
  <div id="bronto-cart-recovery-grand-total"><?php echo $this->getSalesObject()->getGrandTotal(); ?></div>
36
  </div>
37
- <?php echo $this->getCartRecoveryCode(); ?>
38
  <?php endif; ?>
 
32
  <div id="bronto-cart-recovery-discount-amount"><?php echo $this->getDiscountAmount(); ?></div>
33
  <div id="bronto-cart-recovery-subtotal"><?php echo $this->getSalesObject()->getSubtotal(); ?></div>
34
  <div id="bronto-cart-recovery-tax-amount"><?php echo $this->getSalesObject()->getTaxAmount(); ?></div>
35
+ <div id="bronto-cart-recovery-email-address"><?php echo htmlentities($this->getSalesObject()->getCustomerEmail()); ?></div>
36
  <div id="bronto-cart-recovery-grand-total"><?php echo $this->getSalesObject()->getGrandTotal(); ?></div>
37
  </div>
 
38
  <?php endif; ?>
39
+ <?php echo $this->getCartRecoveryCode(); ?>
lib/Bronto/Api.php CHANGED
@@ -1,684 +1,261 @@
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
- 'observer' => false,
41
- // SoapClient
42
- 'soap_version' => SOAP_1_1,
43
- 'compression' => true,
44
- 'encoding' => 'UTF-8',
45
- 'trace' => false,
46
- 'exceptions' => true,
47
- 'cache_wsdl' => WSDL_CACHE_BOTH,
48
- 'user_agent' => 'Bronto_Api <https://github.com/leek/bronto_service>',
49
- 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
50
- 'connection_timeout' => 30,
51
- );
52
-
53
- /**
54
- * Cache of class objects
55
- *
56
- * @var array
57
- */
58
- protected $_classCache = array();
59
-
60
- /**
61
- * @var bool
62
- */
63
- protected $_connected = false;
64
-
65
- /**
66
- * @var bool
67
- */
68
- protected $_authenticated = false;
69
-
70
- /**
71
- * @var Bronto_Util_Retryer_RetryerInterface
72
- */
73
- protected $_retryer;
74
-
75
- /**
76
- * @var Bronto_Util_Uuid
77
- */
78
- protected $_uuid;
79
-
80
- /**
81
- * @var Bronto_Observer
82
- */
83
- protected $_observer;
84
 
85
  /**
86
  * @param string $token
87
- * @param array $options
88
  */
89
- public function __construct($token = null, array $options = array())
90
  {
91
- if (!extension_loaded('soap')) {
92
- throw new Bronto_Api_Exception('SOAP extension is not loaded.');
93
- }
94
-
95
- if (!extension_loaded('openssl')) {
96
- throw new Bronto_Api_Exception('OpenSSL extension is not loaded.');
97
- }
98
-
99
- $this->_options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
100
- $this->_setOptions($options);
101
-
102
- if ($token !== null) {
103
- $this->setToken($token);
104
  }
105
-
106
- ini_set('default_socket_timeout', 120);
107
  }
108
 
109
  /**
110
- * Login with API token
111
  *
112
- * @return Bronto_Api
113
  */
114
  public function login()
115
  {
116
- $token = $this->getToken();
117
- if (empty($token)) {
118
- throw new Bronto_Api_Exception('Token is empty or invalid.', Bronto_Api_Exception::NO_TOKEN);
119
- }
120
-
121
- try {
122
- // Get a new SoapClient
123
- $this->reset();
124
- $client = $this->getSoapClient(false);
125
- // Allow observer to inject a session before login
126
- if ($this->getObserver()) {
127
- $this->getObserver()->onBeforeLogin($this);
128
- }
129
- // Check for auth changes
130
- if (!$this->isAuthenticated()) {
131
- $sessionId = $client->login(array('apiToken' => $token))->return;
132
- $this->setSessionId($sessionId);
133
-
134
- // Allow observer to store session
135
- if ($this->getObserver()) {
136
- $this->getObserver()->onAfterLogin($this, $sessionId);
137
- }
138
- }
139
- } catch (Exception $e) {
140
- $this->throwException($e);
141
- }
142
-
143
- return $this;
144
  }
145
 
146
  /**
147
- * Resuse an existing session, if possible
148
  *
149
  * @param string $sessionId
150
- * @return Bronto_Api
151
  */
152
  public function setSessionId($sessionId)
153
  {
154
- $client = $this->getSoapClient(false);
155
- $client->__setSoapHeaders(array(
156
- new SoapHeader(self::BASE_URL, 'sessionHeader', array('sessionId' => $sessionId))
157
- ));
158
  $this->_authenticated = true;
159
  return $this;
160
  }
161
 
162
  /**
163
- * We want all Exceptions to be Bronto_Api_Exception for request/response
164
  *
165
- * @param string|Exception $exception
166
- * @param string $message
167
- * @param string $code
168
- * @return Bronto_Api_Exception
169
- */
170
- public function throwException($exception, $message = null, $code = null)
171
- {
172
- if ($exception instanceOf Exception) {
173
- if ($exception instanceOf Bronto_Api_Exception) {
174
- // Good
175
- } else {
176
- // Convert
177
- $exception = new Bronto_Api_Exception($exception->getMessage(), $exception->getCode(), null, $exception);
178
- }
179
- } else {
180
- if (is_string($exception)) {
181
- if (class_exists($exception, false)) {
182
- $exception = new $exception($message, $code);
183
- } else {
184
- $exception = new Bronto_Api_Exception($exception);
185
- }
186
- }
187
- }
188
-
189
- // For tracking request/response in debug mode
190
- if ($this->getDebug()) {
191
- /* @var $exception Bronto_Api_Exception */
192
- $exception->setRequest($this->getLastRequest());
193
- $exception->setResponse($this->getLastResponse());
194
- }
195
-
196
- // Allow observer to handle exception cases
197
- if ($this->getObserver()) {
198
- $this->getObserver()->onError($this, $exception);
199
- }
200
-
201
- throw $exception;
202
- }
203
-
204
- /**
205
- * Set API token
206
- *
207
- * @param string $token
208
- * @return Bronto_Api
209
- */
210
- public function setToken($token)
211
- {
212
- $this->reset();
213
- $this->_token = $token;
214
- return $this;
215
- }
216
-
217
- /**
218
- * Get token
219
  *
220
- * @return string
221
- */
222
- public function getToken()
223
- {
224
- return $this->_token;
225
- }
226
-
227
- /**
228
- * @return Bronto_Api_ApiToken_Row
229
- */
230
- public function getTokenInfo()
231
- {
232
- $apiToken = $this->getApiTokenObject()->createRow();
233
- $apiToken->id = $this->getToken();
234
- $apiToken->read();
235
-
236
- return $apiToken;
237
- }
238
-
239
- /**
240
- * @param array $options
241
- * @return Bronto_Api
242
  */
243
- protected function _setOptions(array $options = array())
244
  {
245
- foreach ($options as $name => $value) {
246
- $this->_setOption($name, $value);
 
 
 
 
247
  }
248
- return $this;
249
- }
250
-
251
- /**
252
- * @param string $name
253
- * @param mixed $value
254
- * @return Bronto_Api
255
- */
256
- protected function _setOption($name, $value)
257
- {
258
- if (isset($this->_options[$name])) {
259
- // Some settings need checked
260
- switch ($name) {
261
- case 'soap_client':
262
- if (!class_exists($value)) {
263
- $this->throwException("Unable to load class: {$value} as SoapClient.");
264
- }
265
- break;
266
- case 'soap_version':
267
- if (!in_array($value, array(SOAP_1_1, SOAP_1_2))) {
268
- $this->throwException('Invalid soap_version value specified. Use SOAP_1_1 or SOAP_1_2 constants.');
269
- }
270
- break;
271
- case 'cache_wsdl':
272
- if (!in_array($value, array(WSDL_CACHE_NONE, WSDL_CACHE_DISK, WSDL_CACHE_MEMORY, WSDL_CACHE_BOTH))) {
273
- $this->throwException('Invalid cache_wsdl value specified.');
274
- }
275
- // If debug mode, ignore WSDL cache setting
276
- if ($this->getDebug()) {
277
- $value = WSDL_CACHE_NONE;
278
- }
279
- break;
280
- case 'debug':
281
- if ($value == true) {
282
- $this->_options['trace'] = true;
283
- $this->_options['cache_wsdl'] = WSDL_CACHE_NONE;
284
- }
285
- break;
286
  }
287
-
288
- $this->_options[$name] = $value;
289
- }
290
- return $this;
291
  }
292
 
293
  /**
 
 
294
  * @param string $name
295
- * @param mixed $default
296
- * @return mixed
297
  */
298
- public function getOption($name, $default = null)
299
  {
300
- if (isset($this->_options[$name])) {
301
- return $this->_options[$name];
302
  }
303
- return $default;
304
- }
305
-
306
- /**
307
- * Proxy for intellisense
308
- *
309
- * @return Bronto_Api_Account
310
- */
311
- public function getAccountObject()
312
- {
313
- return $this->getObject('account');
314
- }
315
-
316
- /**
317
- * Proxy for intellisense
318
- *
319
- * @return Bronto_Api_Activity
320
- */
321
- public function getActivityObject()
322
- {
323
- return $this->getObject('activity');
324
- }
325
-
326
- /**
327
- * Proxy for intellisense
328
- *
329
- * @return Bronto_Api_ApiToken
330
- */
331
- public function getApiTokenObject()
332
- {
333
- return $this->getObject('apiToken');
334
- }
335
-
336
- /**
337
- * Proxy for intellisense
338
- *
339
- * @return Bronto_Api_Contact
340
- */
341
- public function getContactObject()
342
- {
343
- return $this->getObject('contact');
344
- }
345
-
346
- /**
347
- * Proxy for intellisense
348
- *
349
- * @return Bronto_Api_ContentTag
350
- */
351
- public function getContentTagObject()
352
- {
353
- return $this->getObject('contentTag');
354
  }
355
 
356
  /**
357
- * Proxy for intellisense
358
- *
359
- * @return Bronto_Api_Conversion
360
- */
361
- public function getConversionObject()
362
- {
363
- return $this->getObject('conversion');
364
- }
365
-
366
- /**
367
- * Proxy for intellisense
368
- *
369
- * @return Bronto_Api_Delivery
370
- */
371
- public function getDeliveryObject()
372
- {
373
- return $this->getObject('delivery');
374
- }
375
-
376
- /**
377
- * Proxy for intellisense
378
- *
379
- * @return Bronto_Api_DeliveryGroup
380
- */
381
- public function getDeliveryGroupObject()
382
- {
383
- return $this->getObject('deliveryGroup');
384
- }
385
-
386
- /**
387
- * Proxy for intellisense
388
- *
389
- * @return Bronto_Api_Field
390
- */
391
- public function getFieldObject()
392
- {
393
- return $this->getObject('field');
394
- }
395
-
396
- /**
397
- * Proxy for intellisense
398
- *
399
- * @return Bronto_Api_Message
400
- */
401
- public function getMessageObject()
402
- {
403
- return $this->getObject('message');
404
- }
405
-
406
- /**
407
- * Proxy for intellisense
408
- *
409
- * @return Bronto_Api_MessageRule
410
- */
411
- public function getMessageRuleObject()
412
- {
413
- return $this->getObject('messageRule');
414
- }
415
-
416
- /**
417
- * Proxy for intellisense
418
- *
419
- * @return Bronto_Api_List
420
- */
421
- public function getListObject()
422
- {
423
- return $this->getObject('list');
424
- }
425
-
426
- /**
427
- * Proxy for intellisense
428
- *
429
- * @return Bronto_Api_Login
430
- */
431
- public function getLoginObject()
432
- {
433
- return $this->getObject('login');
434
- }
435
-
436
- /**
437
- * Proxy for intellisense
438
- *
439
- * @return Bronto_Api_Order
440
- */
441
- public function getOrderObject()
442
- {
443
- return $this->getObject('order');
444
- }
445
-
446
- /**
447
- * Proxy for intellisense
448
- *
449
- * @return Bronto_Api_Segment
450
- */
451
- public function getSegmentObject()
452
- {
453
- return $this->getObject('segment');
454
- }
455
-
456
- /**
457
- * Lazy loads our API objects
458
  *
459
  * @param string $object
460
- * @return Bronto_Api_Object
461
- */
462
- public function getObject($object)
463
- {
464
- $object = ucfirst($object);
465
-
466
- if (!isset($this->_classCache[$object])) {
467
- $className = "Bronto_Api_{$object}";
468
- if (class_exists($className)) {
469
- $this->_classCache[$object] = new $className(array('api' => $this));
 
 
 
470
  } else {
471
- $this->throwException("Unable to load class: {$className}");
472
  }
473
  }
474
-
475
- return $this->_classCache[$object];
476
- }
477
-
478
- /**
479
- * @param bool $authenticate
480
- * @return SoapClient
481
- */
482
- public function getSoapClient($authenticate = true)
483
- {
484
- if ($this->_soapClient == null) {
485
- $this->_connected = false;
486
- $soapClientClass = $this->getOption('soap_client', 'Bronto_SoapClient');
487
- $this->_soapClient = new $soapClientClass(self::BASE_WSDL, array(
488
- 'soap_version' => $this->_options['soap_version'],
489
- 'compression' => $this->_options['compression'],
490
- 'encoding' => $this->_options['encoding'],
491
- 'trace' => $this->_options['trace'],
492
- 'exceptions' => $this->_options['exceptions'],
493
- 'cache_wsdl' => $this->_options['cache_wsdl'],
494
- 'user_agent' => $this->_options['user_agent'],
495
- 'features' => $this->_options['features'],
496
- ));
497
- $this->_soapClient->__setLocation(self::BASE_LOCATION);
498
- $this->_connected = true;
499
- if ($authenticate && !$this->_authenticated && $this->getToken()) {
500
- $this->login();
501
- }
502
  }
503
- return $this->_soapClient;
504
- }
505
-
506
- /**
507
- * @return Bronto_Api
508
- */
509
- public function reset()
510
- {
511
- $this->_connected = false;
512
- $this->_authenticated = false;
513
- $this->_soapClient = null;
514
- return $this;
515
- }
516
-
517
- /**
518
- * @param bool $value
519
- * @return Bronto_Api
520
- */
521
- public function setDebug($value)
522
- {
523
- return $this->_setOption('debug', (bool) $value);
524
  }
525
 
526
  /**
527
- * @return bool
528
  */
529
- public function getDebug()
530
  {
531
- return (bool) $this->_options['debug'];
532
  }
533
 
534
  /**
535
- * @param array $options
536
- * @return Bronto_Util_Retryer_RetryerInterface
537
  */
538
- public function getRetryer(array $options = array())
539
  {
540
- if (!($this->_retryer instanceOf Bronto_Util_Retryer_RetryerInterface)) {
541
- $options = array_merge($this->_options['retryer'], $options);
542
- switch ($options['type']) {
543
- case 'custom':
544
- if ($options['object']) {
545
- $this->_retryer = $options['object'];
546
- } else {
547
- $this->_retryer = new $options['path'];
548
- }
549
- break;
550
- case 'file':
551
- $this->_retryer = new Bronto_Util_Retryer_FileRetryer($options);
552
- break;
553
- default:
554
- return false;
555
- break;
556
- }
557
- }
558
-
559
- return $this->_retryer;
560
  }
561
 
562
  /**
563
- * Gets the observer for the API client
564
  *
565
- * @return Bronto_Observer
566
- */
567
- public function getObserver()
568
- {
569
- if (!$this->_observer) {
570
- if (isset($this->_options['observer'])) {
571
- $observer = $this->_options['observer'];
572
- if (is_string($observer) && class_exists($observer)) {
573
- $observer = new $observer();
574
- }
575
- if ($observer instanceOf Bronto_Observer) {
576
- $this->_observer = $observer;
577
- }
578
- }
579
- }
580
- return $this->_observer;
581
- }
582
-
583
- /**
584
- * @return Bronto_Util_Retryer_RetryerInterface
585
- */
586
- public function getUuid()
587
- {
588
- if (!$this->_uuid) {
589
- $this->_uuid = new Bronto_Util_Uuid();
590
- }
591
-
592
- return $this->_uuid;
593
- }
594
-
595
- /**
596
- * @return bool
597
- */
598
- public function isConnected()
599
- {
600
- return (bool) $this->_connected;
601
- }
602
-
603
- /**
604
- * @return bool
605
  */
606
- public function isAuthenticated()
607
  {
608
- return (bool) $this->_authenticated;
609
  }
610
 
611
  /**
612
- * Seamlessly iterate over a rowset.
613
  *
614
- * @param Bronto_Api_Rowset $rowset
615
- * @return Bronto_Api_Rowset_Iterator
616
  */
617
- public function iterate(Bronto_Api_Rowset $rowset)
618
  {
619
- return new Bronto_Api_Rowset_Iterator($rowset);
620
  }
621
 
622
  /**
623
- * Retrieve request XML
624
  *
625
  * @return string
626
  */
627
- public function getLastRequest()
628
  {
629
- if ($this->_soapClient !== null) {
630
- return $this->_soapClient->__getLastRequest();
631
- }
632
- return '';
633
  }
634
 
635
  /**
636
- * Get response XML
637
  *
638
  * @return string
639
  */
640
- public function getLastResponse()
641
  {
642
- if ($this->_soapClient !== null) {
643
- return $this->_soapClient->__getLastResponse();
644
- }
645
- return '';
646
  }
647
 
648
  /**
649
- * Retrieve request headers
650
  *
651
  * @return string
652
  */
653
- public function getLastRequestHeaders()
654
  {
655
- if ($this->_soapClient !== null) {
656
- return $this->_soapClient->__getLastRequestHeaders();
657
- }
658
- return '';
659
  }
660
 
661
  /**
662
- * Retrieve response headers (as string)
663
  *
664
- * @return string
665
  */
666
- public function getLastResponseHeaders()
667
  {
668
- if ($this->_soapClient !== null) {
669
- return $this->_soapClient->__getLastResponseHeaders();
 
 
 
 
 
670
  }
671
- return '';
672
  }
673
 
674
  /**
 
 
675
  * @return array
676
  */
677
  public function __sleep()
678
  {
679
- return array(
680
- '_token',
681
- '_options',
682
- );
683
  }
684
  }
1
  <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api.php
9
+ */
10
+
11
 
12
  /**
13
+ * Library entry point and complete wrapper around the SPL SoapClient.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
  */
17
  class Bronto_Api
18
  {
19
+ const BASE_URI = 'http://api.bronto.com/v4';
20
+ private $_options;
21
+ private $_token;
22
+ private $_soapClient;
23
+ private $_authenticated = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  /**
26
  * @param string $token
27
+ * @param array|Options (Optional)
28
  */
29
+ public function __construct($token, $options = null)
30
  {
31
+ $this->_token = $token;
32
+ if (is_null($options)) {
33
+ $this->_options = new Bronto_Api_Options();
34
+ } else if (is_array($options)) {
35
+ $this->_options = new Bronto_Api_Options($options);
36
+ } else if ($options instanceof Bronto_Api_Options) {
37
+ $this->_options = $options;
38
+ } else {
39
+ throw new InvalidArgumentException(sprintf('$options must either be an array or Bronto_Api_Options: %s given', $options));
 
 
 
 
40
  }
 
 
41
  }
42
 
43
  /**
44
+ * Authenticates the SoapClient
45
  *
46
+ * @return string
47
  */
48
  public function login()
49
  {
50
+ $apiToken = $this->_token;
51
+ $sessionId = $this->getSoapClient()->login(array('apiToken' => $apiToken))->return;
52
+ $this->_options->safeObserver()->each(function($observer) use ($apiToken, $sessionId) {
53
+ $observer->onLogin($apiToken, $sessionId);
54
+ });
55
+ $this->setSessionId($sessionId);
56
+ return $sessionId;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  /**
60
+ * If an existing session ID is available, register it with the client
61
  *
62
  * @param string $sessionId
63
+ * @return Api
64
  */
65
  public function setSessionId($sessionId)
66
  {
67
+ $this->getSoapClient()->__setSoapHeaders(array(new SoapHeader(self::BASE_URI, 'sessionHeader', array('sessionId' => $sessionId))));
 
 
 
68
  $this->_authenticated = true;
69
  return $this;
70
  }
71
 
72
  /**
73
+ * Executes an API request that have at least the following information:
74
  *
75
+ * - method: string method if the SOAP function
76
+ * - data: data container for the SOAP function
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  *
78
+ * @param Object $request
79
+ * @return stdClass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  */
81
+ public function execute(Bronto_Object $request)
82
  {
83
+ $tries = 0;
84
+ $maxTries = $this->_options->getRetries();
85
+ $method = $request->getMethod();
86
+ $data = $request->getData();
87
+ if ($data instanceof Bronto_Object) {
88
+ $data = $data->toArray();
89
  }
90
+ do {
91
+ try {
92
+ if (!$this->isAuthenticated()) {
93
+ $this->login();
94
+ }
95
+ return $this->getSoapClient()->$method($data);
96
+ } catch (Exception $e) {
97
+ $tries++;
98
+ $api = $this;
99
+ $exception = new Bronto_Api_Exception($e->getMessage(), $e->getCode(), $e, $tries, $request);
100
+ $this->_options
101
+ ->safeError()
102
+ ->filter(function($error) use ($exception, $api, $request) {
103
+ // Filter on a recoverable strategy
104
+ return $error->recover($exception, $api, $request);
105
+ })
106
+ ->orElse(function() use ($exception, $api, $request) {
107
+ // A write failed due to network reasons... store it
108
+ if ($request->hasUpdates() && $exception->isNetworkRelated()) {
109
+ $this->_options->safeRetryer(function($retryer) use ($request, $api) {
110
+ $retryer->store($request, $api->getToken());
111
+ });
112
+ }
113
+ $api->getOptions()
114
+ ->safeObserver()->each(function($observer) use ($api, $exception) {
115
+ $observer->onError($api, $exception);
116
+ });
117
+ throw $exception;
118
+ });
 
 
 
 
 
 
 
 
 
119
  }
120
+ } while ($tries < $maxTries);
121
+ // It should never reach here, but we'll safely terminate
122
+ throw new Bronto_Api_Exception("Max attempts have been reached.");
 
123
  }
124
 
125
  /**
126
+ * To be used solely as a convenience to $api->transfer('Object')
127
+ *
128
  * @param string $name
129
+ * @param array $arguments
130
+ * @return Bronto_Api_Operation
131
  */
132
+ public function __call($name, $arguments)
133
  {
134
+ if (preg_match('/^transfer(.*)/', $name, $match)) {
135
+ return $this->transfer($match[1]);
136
  }
137
+ throw new BadMethodCallException("Method {$name} does not exist.");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  }
139
 
140
  /**
141
+ * Create an operation object that wraps all CRUD requests
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  *
143
  * @param string $object
144
+ * @param array $methods (Optional)
145
+ * @return Bronto_Api_Operation
146
+ */
147
+ public function transfer($object, array $methods = null)
148
+ {
149
+ $tempClass = "Bronto_Api_Operation_{$object}";
150
+ // Note: This snippet was generated with legacy conversion
151
+ if (is_string($tempClass) && !array_key_exists($tempClass, Bronto_ImportManager::$_fileCache)) {
152
+ $dir = str_replace(str_replace("_", "/", "Bronto"), '', dirname(__FILE__));
153
+ $file = $dir . str_replace("_", "/", $tempClass) . '.php';
154
+ if (file_exists($file)) {
155
+ require_once $file;
156
+ Bronto_ImportManager::$_fileCache[$tempClass] = true;
157
  } else {
158
+ Bronto_ImportManager::$_fileCache[$tempClass] = false;
159
  }
160
  }
161
+ // End Conversion Snippet
162
+ if (Bronto_ImportManager::$_fileCache[$tempClass]) {
163
+ return new $tempClass($this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
+ return new Bronto_Api_Operation($this, $object, $methods);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  }
167
 
168
  /**
169
+ * @return Bronto_Api_Options
170
  */
171
+ public function getOptions()
172
  {
173
+ return $this->_options;
174
  }
175
 
176
  /**
177
+ * @return boolean
 
178
  */
179
+ public function isAuthenticated()
180
  {
181
+ return $this->_authenticated;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  }
183
 
184
  /**
185
+ * If trace is flagged, will return the last SOAP request
186
  *
187
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  */
189
+ public function getLastRequest()
190
  {
191
+ return $this->getSoapClient()->__getLastRequest();
192
  }
193
 
194
  /**
195
+ * If trace is flagged, will return the last headers sent
196
  *
197
+ * @return string
 
198
  */
199
+ public function getLastRequestHeaders()
200
  {
201
+ return $this->getSoapClient()->__getLastRequestHeaders();
202
  }
203
 
204
  /**
205
+ * If trace is flagged, will return the last raw response
206
  *
207
  * @return string
208
  */
209
+ public function getLastResponse()
210
  {
211
+ return $this->getSoapClient()->__getLastResponse();
 
 
 
212
  }
213
 
214
  /**
215
+ * If trace is flagged, will return the last response headers
216
  *
217
  * @return string
218
  */
219
+ public function getLastResponseHeaders()
220
  {
221
+ return $this->getSoapClient()->__getLastResponseHeaders();
 
 
 
222
  }
223
 
224
  /**
225
+ * APIv4 token used
226
  *
227
  * @return string
228
  */
229
+ public function getToken()
230
  {
231
+ return $this->_token;
 
 
 
232
  }
233
 
234
  /**
235
+ * Gets or creates the underlying SoapClient used to make calls
236
  *
237
+ * @return SoapClient
238
  */
239
+ public function getSoapClient()
240
  {
241
+ if (is_null($this->_soapClient)) {
242
+ $options = $this->_options;
243
+ $soapClient = $this->_options->safeSoapClient()->orElse(function() use ($options) {
244
+ $soapClass = $options->getSoapClass();
245
+ return new $soapClass($options->getWsdl(), $options->getSoapOptions());
246
+ });
247
+ $this->_soapClient = $soapClient->get();
248
  }
249
+ return $this->_soapClient;
250
  }
251
 
252
  /**
253
+ * Fields necesary to deserialize the API wrapper
254
+ *
255
  * @return array
256
  */
257
  public function __sleep()
258
  {
259
+ return array('_token', '_options');
 
 
 
260
  }
261
  }
lib/Bronto/Api/Account.php DELETED
@@ -1,58 +0,0 @@
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 DELETED
@@ -1,13 +0,0 @@
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 DELETED
@@ -1,24 +0,0 @@
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 DELETED
@@ -1,216 +0,0 @@
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 DELETED
@@ -1,12 +0,0 @@
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 DELETED
@@ -1,139 +0,0 @@
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 DELETED
@@ -1,129 +0,0 @@
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 DELETED
@@ -1,9 +0,0 @@
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 DELETED
@@ -1,83 +0,0 @@
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 DELETED
@@ -1,107 +0,0 @@
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 DELETED
@@ -1,23 +0,0 @@
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 DELETED
@@ -1,399 +0,0 @@
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 DELETED
@@ -1,45 +0,0 @@
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 DELETED
@@ -1,14 +0,0 @@
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 DELETED
@@ -1,59 +0,0 @@
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 DELETED
@@ -1,46 +0,0 @@
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 DELETED
@@ -1,11 +0,0 @@
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 DELETED
@@ -1,105 +0,0 @@
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 DELETED
@@ -1,86 +0,0 @@
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 DELETED
@@ -1,23 +0,0 @@
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 DELETED
@@ -1,22 +0,0 @@
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 DELETED
@@ -1,238 +0,0 @@
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 DELETED
@@ -1,100 +0,0 @@
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 DELETED
@@ -1,21 +0,0 @@
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 DELETED
@@ -1,58 +0,0 @@
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 CHANGED
@@ -1,53 +1,55 @@
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,
@@ -62,43 +64,27 @@ class Bronto_Api_Exception extends Exception
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) {
@@ -108,13 +94,11 @@ class Bronto_Api_Exception extends Exception
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) {
@@ -125,60 +109,48 @@ class Bronto_Api_Exception extends Exception
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
  {
@@ -186,64 +158,45 @@ class Bronto_Api_Exception extends Exception
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
  }
1
  <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Exception.php
9
+ */
10
 
11
  /**
12
+ * General API exception wrapper and exposes a few convenience
13
+ * methods helpful for debugging.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
  */
17
+ class Bronto_Api_Exception extends RuntimeException
18
  {
19
+ const UNKNOWN_ERROR = 101;
20
+ const INVALID_TOKEN = 102;
21
+ const INVALID_SESSION_TOKEN = 103;
22
+ const INVALID_ACCESS = 104;
23
+ const INVALID_INPUT_ARRAY = 105;
24
+ const INVALID_PARAMETER = 106;
25
+ const INVALID_REQUEST = 107;
26
+ const SHARD_OFFLINE = 108;
27
+ const SITE_INACTIVE = 109;
28
+ const REQUIRED_FIELDS = 110;
29
+ const UNAUTHORIZED_IP = 111;
30
+ const INVALID_FILTER = 112;
31
+ const READ_ERROR = 113;
32
+ const INVALID_PAGE_SIZE = 115;
33
+
34
+ const HTTP_HEADER_ERROR = 98001;
35
+ const NO_XML_DOCUMENT = 98002;
36
+ const INVALID_URL = 98003;
37
+ const CONNECT_ERROR = 98004;
38
+ const WSDL_PARSE_ERROR = 98005;
39
+ const REQUEST_ERROR = 98006;
40
+ const CONNECTION_RESET = 98007;
41
+ const CONNECTION_FAILED = 98008;
42
+ const SERVICE_UNAVAILABLE = 98009;
43
+ const SOAPCLIENT_ERROR = 98010;
44
+ const SERVER_ERROR = 98500;
45
+
46
+ private $_tries;
47
+ private $_previous;
48
+ private $_request;
49
+ private $_recoverable = false;
50
+ private static $_recoverables = array(
 
 
 
 
 
 
51
  self::UNKNOWN_ERROR,
52
  self::INVALID_SESSION_TOKEN,
 
53
  self::SHARD_OFFLINE,
54
  self::READ_ERROR,
55
  self::HTTP_HEADER_ERROR,
64
  );
65
 
66
  /**
67
+ * @see parent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  * @param string $message
69
+ * @param int code
 
70
  * @param Exception $previous
71
+ * @param int tries
72
+ * @param Bronto_Object $request
73
  */
74
+ public function __construct($message = "", $code = 0, Exception $previous = null, $tries = 0, $request = null)
75
  {
76
  if (empty($code)) {
77
  $parts = explode(':', $message, 2);
78
  if (is_array($parts)) {
79
  $parts = array_map('trim', $parts);
80
+ if (is_numeric($parts[0])) {
81
+ $code = (int) $parts[0];
82
+ $message = $parts[1];
83
+ }
84
  }
85
  }
86
 
87
  if (empty($code)) {
 
88
  if (stripos($message, 'Error Fetching http headers') !== false) {
89
  $code = self::HTTP_HEADER_ERROR;
90
  } else if (stripos($message, 'looks like we got no XML document') !== false) {
94
  } else if (stripos($message, 'Parsing WSDL') !== false) {
95
  $code = self::WSDL_PARSE_ERROR;
96
  } else if (stripos($message, 'There was an error in your soap request') !== false) {
97
+ $code = self::INVALID_REQUEST;
98
  } else if (stripos($message, 'Connection reset by peer') !== false) {
99
  $code = self::CONNECTION_RESET;
100
  } else if (stripos($message, 'Unable to parse URL') !== false) {
101
  $code = self::INVALID_URL;
 
 
102
  } else if (stripos($message, 'Service Temporarily Unavailable') !== false) {
103
  $code = self::SERVICE_UNAVAILABLE;
104
  } else if (stripos($message, 'Internal Server Error') !== false) {
109
  }
110
 
111
  if (!empty($code)) {
112
+ $message = "{$code}: {$message}";
113
  }
114
 
115
  if (!empty($tries) && $tries > 1) {
116
  $message .= " [Tried: {$tries}]";
117
  }
118
 
119
+ $this->_previous = $previous;
120
  if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
121
  parent::__construct($message, $code, $previous);
122
  } else {
 
123
  parent::__construct($message, $code);
124
  }
125
+ $this->_tries = $tries;
126
+ $this->_recoverable = in_array($this->getCode(), self::$_recoverables);
127
+ $this->_request;
128
  }
129
 
130
  /**
131
+ * Returns the number of attempts made with this request
132
+ *
133
+ * @return int
 
 
 
 
 
 
134
  */
135
+ public function getAttempts()
136
  {
137
+ return $this->_tries;
138
  }
139
 
140
  /**
141
+ * Determines if the exception is recoverable
142
+ *
143
+ * @return boolean
144
  */
145
  public function isRecoverable()
146
  {
147
+ return $this->_recoverable;
 
 
 
148
  }
149
 
150
  /**
151
+ * The actual request object used by the SoapClient
152
+ *
153
+ * @return Bronto_Object
 
 
 
 
 
 
 
 
154
  */
155
  public function getRequest()
156
  {
158
  }
159
 
160
  /**
161
+ * Determines if the exception is a SPL SoapFault
162
+ *
163
+ * @return boolean
 
 
 
 
 
 
 
164
  */
165
+ public function isSoapFault()
166
  {
167
+ return $this->_previous instanceof SoapFault;
168
  }
169
 
170
  /**
171
+ * Is this session invalid?
172
+ *
173
+ * @return boolean
 
 
 
 
 
 
 
 
 
 
174
  */
175
+ public function isInvalidSession()
176
  {
177
+ return $this->getCode() == self::INVALID_SESSION_TOKEN;
 
 
 
 
 
 
 
178
  }
179
 
180
  /**
181
+ * Is the exception caused by Bronto maintenance?
182
+ *
183
+ * @return boolean
184
  */
185
+ public function isMaintenance()
186
  {
187
+ return $this->getCode() == self::SHARD_OFFLINE;
 
188
  }
189
 
190
  /**
191
+ * Is the exception caused by general network issues?
192
+ *
193
+ * @return boolean
194
  */
195
+ public function isNetworkRelated()
196
  {
197
+ return (
198
+ $this->isMaintenance() ||
199
+ ($this->isSoapFault() && $this->isRecoverable())
200
+ );
201
  }
202
  }
lib/Bronto/Api/Field.php DELETED
@@ -1,136 +0,0 @@
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 DELETED
@@ -1,18 +0,0 @@
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 DELETED
@@ -1,306 +0,0 @@
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 DELETED
@@ -1,62 +0,0 @@
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 DELETED
@@ -1,129 +0,0 @@
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 DELETED
@@ -1,57 +0,0 @@
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 DELETED
@@ -1,19 +0,0 @@
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 DELETED
@@ -1,128 +0,0 @@
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 DELETED
@@ -1,38 +0,0 @@
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
-
32
- $params = array();
33
- $params['filter'] = $filter;
34
- $params['pageNumber'] = (int) $pageNumber;
35
-
36
- return parent::read($params);
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Bronto/Api/Login/ContactInformation.php DELETED
@@ -1,93 +0,0 @@
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 DELETED
@@ -1,10 +0,0 @@
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 DELETED
@@ -1,39 +0,0 @@
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 DELETED
@@ -1,38 +0,0 @@
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 DELETED
@@ -1,24 +0,0 @@
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 DELETED
@@ -1,84 +0,0 @@
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 DELETED
@@ -1,43 +0,0 @@
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 DELETED
@@ -1,14 +0,0 @@
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 DELETED
@@ -1,60 +0,0 @@
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/Model/Contact.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Model/Contact.php
9
+ */
10
+
11
+ /**
12
+ * Model class for contact level convenience methods
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Model_Contact extends Bronto_Api_Object
17
+ {
18
+ const STATUS_ACTIVE = 'active';
19
+ const STATUS_ONBOARDING = 'onboarding';
20
+ const STATUS_TRANSACTIONAL = 'transactional';
21
+ const STATUS_BOUNCE = 'bounce';
22
+ const STATUS_UNSUBSCRIBED = 'unsub';
23
+ const STATUS_UNCONFIRMED = 'unconfirmed';
24
+
25
+ const VARCHAR_LIMIT = 65535;
26
+
27
+ protected $_apiFields = array();
28
+ protected $_fieldIdToIndex = array();
29
+
30
+ /**
31
+ * @see parent
32
+ */
33
+ public function __construct(array $data = array())
34
+ {
35
+ parent::__construct('Contact', $data);
36
+ }
37
+
38
+ /**
39
+ * To take advantage of field conversions you must set
40
+ * a hash table of fieldId => Bronto_Api_Object (Bronto_Api_Model_Field)
41
+ *
42
+ * @param Bronto_Api_Read|array $apiFields
43
+ * @return Bronto_Api_Model_Contact
44
+ */
45
+ public function setFieldTable($apiFields)
46
+ {
47
+ if ($apiFields instanceof Bronto_Api_Read) {
48
+ $apiFields = $apiFields->getIterator()->toArray();
49
+ }
50
+ $this->_apiFields = $apiFields;
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ * Convenience method for adding/setting field values for contact
56
+ *
57
+ * @param Bronto_Object|string $fieldId
58
+ * @param mixed $content
59
+ * @return Bronto_Api_Model_Contact
60
+ */
61
+ public function addField($fieldId, $content = null)
62
+ {
63
+ if (!array_key_exists('fields', $this->_data)) {
64
+ $this->_set('fields', array());
65
+ }
66
+ if ($fieldId instanceof Bronto_Object) {
67
+ $data = $fieldId->toArray();
68
+ } else {
69
+ $data = array('fieldId' => $fieldId, 'content' => $content);
70
+ }
71
+ $data['content'] = $this->_convert($data['fieldId'], $data['content']);
72
+ if (array_key_exists($data['fieldId'], $this->_fieldIdToIndex)) {
73
+ $this->_data['fields'][$this->_fieldIdToIndex[$data['fieldId']]] = $data;
74
+ } else {
75
+ $this->_fieldIdToIndex[$data['fieldId']] = array_push($this->_data['fields'], $data) - 1;
76
+ }
77
+ return $this;
78
+ }
79
+
80
+ /**
81
+ * Convenience method for adding list membership directly
82
+ *
83
+ * @param mixed $listIdOrList
84
+ * @return Bronto_Api_Model_Contact
85
+ */
86
+ public function addList($listIdOrList)
87
+ {
88
+ if ($listIdOrList instanceof Bronto_Object) {
89
+ $listIdOrList = $listIdOrList->getId();
90
+ }
91
+ if (!array_key_exists('listIds', $this->_data)) {
92
+ $this->_set('listIds', array());
93
+ }
94
+ if (!in_array($listIdOrList, $this->_data['listIds'])) {
95
+ $this->_data['listIds'][] = $listIdOrList;
96
+ }
97
+ return $this;
98
+ }
99
+
100
+ /**
101
+ * Convenience method for removing list membership directly
102
+ *
103
+ * @param mixed $listIdOrList
104
+ * @return Bronto_Api_Model_Contact
105
+ */
106
+ public function removeList($listIdOrList)
107
+ {
108
+ if ($listIdOrList instanceof Bronto_Object) {
109
+ $listIdOrList = $listIdOrList->getId();
110
+ }
111
+ if (!array_key_exists('listIds', $this->_data)) {
112
+ return $this;
113
+ }
114
+ $index = array_search($listIdOrList, $this->_data['listIds']);
115
+ if ($index === false) {
116
+ return $this;
117
+ }
118
+ array_splice($this->_data['listIds'], $index, 1);
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * Internal helper to convert the contact field value to
124
+ * an APIv4 friendly value
125
+ *
126
+ * @param string $fieldId
127
+ * @param mixed $content
128
+ * @return string
129
+ */
130
+ protected function _convert($fieldId, $content)
131
+ {
132
+ // Short circuit, as this means to unset field value
133
+ if (is_null($content) || $content === '') {
134
+ return '';
135
+ }
136
+ $type = Bronto_Api_Model_Field::TYPE_TEXT;
137
+ if (array_key_exists($fieldId, $this->_apiFields)) {
138
+ $type = $this->_apiFields[$fieldId]->getType();
139
+ }
140
+ switch ($type) {
141
+ case Bronto_Api_Model_Field::TYPE_CHECKBOX:
142
+ return empty($content) ? '0' : '1';
143
+ case Bronto_Api_Model_Field::TYPE_DATE:
144
+ if (is_string($content)) {
145
+ $content = strtotime($content);
146
+ }
147
+ return date('c', $content);
148
+ case Bronto_Api_Model_Field::TYPE_TEXT:
149
+ case Bronto_Api_Model_Field::TYPE_TEXTAREA:
150
+ case Bronto_Api_Model_Field::TYPE_PASSWORD:
151
+ default:
152
+ $content = (string)$content;
153
+ if (strlen($content) > self::VARCHAR_LIMIT) {
154
+ throw new InvalidArgumentException("Bronto_Api_Model_Field length is greater than " . self::VARCHAR_LIMIT . " characters.");
155
+ }
156
+ return $content;
157
+ }
158
+ }
159
+ }
lib/Bronto/Api/Model/Delivery.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Model/Delivery.php
9
+ */
10
+
11
+ /**
12
+ * Model class for delivery level convenience methods
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Model_Delivery extends Bronto_Api_Model_DeliveryAbstract
17
+ {
18
+ const TYPE_TRANSACTIONAL = 'transactional';
19
+ const TYPE_TRIGGERED = 'triggered';
20
+ const TYPE_NORMAL = 'normal';
21
+ const TYPE_TEST = 'test';
22
+ const TYPE_FTAF = 'ftaf';
23
+ const TYPE_AUTOMATED = 'automated';
24
+ const TYPE_SPLIT = 'split';
25
+
26
+ const STATUS_SENT = 'sent';
27
+ const STATUS_SENDING = 'sending';
28
+ const STATUS_UNSENT = 'unsent';
29
+ const STATUS_ARCHIVED = 'archived';
30
+ const STATUS_SKIPPED = 'skipped';
31
+ const STATUS_TMP = 'tmp';
32
+
33
+ /**
34
+ * @see parent
35
+ */
36
+ public function __construct(array $data = array())
37
+ {
38
+ parent::__construct('Delivery', $data);
39
+ }
40
+
41
+ /**
42
+ * @see parent
43
+ */
44
+ public function isTransactional()
45
+ {
46
+ return $this->hasType() && $this->getType() == self::TYPE_TRANSACTIONAL;
47
+ }
48
+ }
lib/Bronto/Api/Model/DeliveryAbstract.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Model/DeliveryAbstract.php
9
+ */
10
+
11
+ /**
12
+ * Model class for delivery level convenience methods
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ abstract class Bronto_Api_Model_DeliveryAbstract extends Bronto_Api_Object
17
+ {
18
+ const TARGET_CONTACT = 'contact';
19
+ const TARGET_LIST = 'list';
20
+ const TARGET_SEGMENT = 'segment';
21
+ const TARGET_KEYWORD = 'keyword';
22
+
23
+ const DELIVERY_SELECTED = 'selected';
24
+ const DELIVERY_ELIGIBLE = 'eligible';
25
+ const DELIVERY_INELIGIBLE = 'ineligible';
26
+
27
+ protected $_tagToIndex = array();
28
+
29
+ /**
30
+ * Determines if the type of the delivery is transactional
31
+ *
32
+ * @return boolean
33
+ */
34
+ public abstract function isTransactional();
35
+
36
+ /**
37
+ * Convenience method for adding message field tags to deliveries
38
+ *
39
+ * @param mixed $name
40
+ * @param mixed $content
41
+ * @param string $type
42
+ * @return Bronto_Api_Model_Delivery
43
+ */
44
+ public function withField($name, $content = null, $type = 'html')
45
+ {
46
+ if (($name instanceof Bronto_Object) && is_null($content)) {
47
+ $name = $name->toArray();
48
+ }
49
+ if (is_array($name)) {
50
+ extract($name);
51
+ }
52
+ if (strlen($name) > 25) {
53
+ throw new InvalidArgumentException("Bronto_Api_Model_Field `{$name}` is more than 25 characters.");
54
+ }
55
+ $messageField = array(
56
+ 'name' => $name,
57
+ 'content' => $content,
58
+ 'type' => $type
59
+ );
60
+ if (array_key_exists($name, $this->_tagToIndex)) {
61
+ $this->_data['fields'][$this->_tagToIndex[$name]] = $messageField;
62
+ } else {
63
+ if (!array_key_exists('fields', $this->_data)) {
64
+ $this->_data['fields'] = array();
65
+ }
66
+ $this->_tagToIndex[$name] = array_push($this->_data['fields'], $messageField) - 1;
67
+ }
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * Convenience method for adding a collection of fields to a delivery
73
+ *
74
+ * @param array $fields
75
+ * @return Bronto_Api_Model_Delivery
76
+ */
77
+ public function withFields($fields)
78
+ {
79
+ foreach ($fields as $field) {
80
+ $this->withField($field);
81
+ }
82
+ return $this;
83
+ }
84
+
85
+ /**
86
+ * Allows chaining recipients together through function calls, ie:
87
+ * $delivery->addContact($contactId)->ineligibleList($listId);
88
+ *
89
+ * @see parent
90
+ */
91
+ protected function _defaultMethod($prefix, $camelized, $arguments)
92
+ {
93
+ switch ($prefix) {
94
+ case 'add':
95
+ case self::DELIVERY_SELECTED:
96
+ case self::DELIVERY_ELIGIBLE:
97
+ case self::DELIVERY_INELIGIBLE:
98
+ $objectId = $arguments[0];
99
+ if ($objectId instanceof Bronto_Object) {
100
+ $objectId = $objectId->getId();
101
+ }
102
+ if (!array_key_exists('recipients', $this->_data)) {
103
+ $this->_data['recipients'] = array();
104
+ }
105
+ // TODO: we'll probably want to very here before sending
106
+ // if the types set are valid or not
107
+ $this->_data['recipients'][] = array(
108
+ 'type' => $camelized,
109
+ 'id' => $objectId,
110
+ 'deliveryType' => $prefix == 'add' ? self::DELIVERY_SELECTED : $prefix
111
+ );
112
+ return $this;
113
+ default:
114
+ return parent::_defaultMethod($prefix, $camelized, $arguments);
115
+ }
116
+ }
117
+ }
lib/Bronto/Api/Model/Field.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Model/Field.php
9
+ */
10
+
11
+ /**
12
+ * Model class for field level convenience methods
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Model_Field extends Bronto_Api_Object
17
+ {
18
+ const TYPE_INTEGER = 'integer';
19
+ const TYPE_TEXT = 'text';
20
+ const TYPE_TEXTAREA = 'textarea';
21
+ const TYPE_PASSWORD = 'password';
22
+ const TYPE_CHECKBOX = 'checkbox';
23
+ const TYPE_RADIO = 'radio';
24
+ const TYPE_SELECT = 'select';
25
+ const TYPE_CURRENCY = 'currency';
26
+ const TYPE_FLOAT = 'float';
27
+ const TYPE_DATE = 'date';
28
+
29
+ const VISIBLE_PRIVATE = 'private';
30
+ const VISIBLE_PUBLIC = 'public';
31
+
32
+ private static $_mappedWords = array(
33
+ 'hidden' => self::VISIBLE_PRIVATE,
34
+ 'notVisible' => self::VISIBLE_PRIVATE,
35
+ 'discreet' => self::VISIBLE_PRIVATE,
36
+ 'private' => self::VISIBLE_PRIVATE,
37
+ 'visible' => self::VISIBLE_PUBLIC,
38
+ 'notHidden' => self::VISIBLE_PUBLIC,
39
+ 'public' => self::VISIBLE_PUBLIC,
40
+ );
41
+
42
+ /**
43
+ * @see parent
44
+ */
45
+ public function __construct(array $data = array())
46
+ {
47
+ parent::__construct('Field', array_merge(array('visibility' => 'private'), $data));
48
+ }
49
+
50
+ /**
51
+ * Allows an addtional prefix 'as' to set the type of field, ie: asText()
52
+ * Also visibility, ie: asPublic(), asPrivate()
53
+ *
54
+ * @see parent
55
+ */
56
+ protected function _defaultMethod($prefix, $camelized, $arguments)
57
+ {
58
+ switch ($prefix) {
59
+ case 'as':
60
+ if (array_key_exists($camelized, self::$_mappedWords)) {
61
+ return $this->_set('visibility', self::$_mappedWords[$camelized]);
62
+ } else {
63
+ return $this->_set('type', $camelized);
64
+ }
65
+ case 'is':
66
+ if (array_key_exists($camelized, self::$_mappedWords)) {
67
+ return $this->_data['visibility'] == $camelized;
68
+ }
69
+ return $this->_data['type'] == $camelized;
70
+ default:
71
+ return parent::_defaultMethod($prefix, $camelized, $arguments);
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Adds field options to the field as a chainable property
77
+ *
78
+ * @param Bronto_Object|string $value
79
+ * @param mixed $label
80
+ * @param boolean $isDefault
81
+ * @return Bronto_Api_Model_Field
82
+ */
83
+ public function addOption($value, $label = null, $isDefault = false)
84
+ {
85
+ if (!array_key_exists('options', $this->_data)) {
86
+ $this->_data['options'] = array();
87
+ }
88
+ if ($value instanceof Bronto_Object) {
89
+ extract($value->toArray());
90
+ }
91
+ if (is_bool($label)) {
92
+ $isDefault = $label;
93
+ $label = null;
94
+ }
95
+ if (is_null($label)) {
96
+ $label = (string) $value;
97
+ }
98
+ if ($isDefault) {
99
+ foreach ($this->_data['options'] as &$option) {
100
+ $option['isDefault'] = false;
101
+ }
102
+ }
103
+
104
+ $this->_data['options'][] = array(
105
+ 'value' => $value,
106
+ 'label' => $label,
107
+ 'isDefault' => $isDefault
108
+ );
109
+ return $this;
110
+ }
111
+ }
lib/Bronto/Api/Model/Message.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Model/Message.php
9
+ */
10
+
11
+ /**
12
+ * Model class for Bronto_Api_Model_Message level convenience methods
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Model_Message extends Bronto_Api_Object
17
+ {
18
+ const TYPE_TEXT = 'text';
19
+ const TYPE_HTML = 'html';
20
+
21
+ private static $_supportedTypes = array(self::TYPE_TEXT, self::TYPE_HTML);
22
+
23
+ protected $_contentTypesToIndex = array();
24
+
25
+ /**
26
+ * @see parent
27
+ */
28
+ public function __construct(array $data = array())
29
+ {
30
+ parent::__construct('Message', $data);
31
+ }
32
+
33
+ /**
34
+ * Convenience method for adding different contents
35
+ *
36
+ * @see parent
37
+ */
38
+ protected function _defaultMethod($prefix, $camelized, $arguments)
39
+ {
40
+ switch ($prefix) {
41
+ case 'add':
42
+ case 'content':
43
+ if (!in_array($camelized, self::$_supportedTypes)) {
44
+ throw new InvalidArgumentException("Message object only supports " . implode (', ', self::$_supportedTypes) . " but provided {$camelized}.");
45
+ }
46
+ $object = $arguments[0];
47
+ if ($object instanceof Bronto_Object) {
48
+ $object = $object->toArray();
49
+ }
50
+ if (is_array($object)) {
51
+ extract($object);
52
+ }
53
+ $object = array(
54
+ 'type' => $camelized,
55
+ 'subject' => empty($subject) ? $arguments[0] : $subject,
56
+ 'content' => empty($content) ? $arguments[1] : $content
57
+ );
58
+ if (!array_key_exists('content', $this->_data)) {
59
+ $this->_data['content'] = array();
60
+ }
61
+ if (!array_key_exists($camelized, $this->_contentTypesToIndex)) {
62
+ $this->_contentTypesToIndex[$camelized] = array_push($this->_data['content'], $object) - 1;
63
+ } else {
64
+ $this->_data['content'][$this->_contentTypesToIndex[$camelized]] = $object;
65
+ }
66
+ return $this;
67
+ default:
68
+ return parent::_defaultMethod($prefix, $camelized, $arguments);
69
+ }
70
+ }
71
+ }
lib/Bronto/Api/Model/Order.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Model/Order.php
9
+ */
10
+
11
+ class Bronto_Api_Model_Order extends Bronto_Api_Object
12
+ {
13
+ /**
14
+ * @see parent
15
+ */
16
+ public function __construct(array $data = array())
17
+ {
18
+ parent::__construct('Order', $data);
19
+ }
20
+
21
+ /**
22
+ * Convenience method for adding additional products to
23
+ * the order
24
+ *
25
+ * @return Bronto_Object
26
+ */
27
+ public function addProduct($product)
28
+ {
29
+ if ($product instanceof Bronto_Object) {
30
+ $product = $product->toArray();
31
+ }
32
+ if (!array_key_exists('products', $this->_data)) {
33
+ $this->_data['products'] = array();
34
+ }
35
+ $this->_data['products'][] = $product;
36
+ return $this;
37
+ }
38
+ }
lib/Bronto/Api/Model/SMSDelivery.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Model/SMSDelivery.php
9
+ */
10
+
11
+ /**
12
+ * Model class for Bronto_Api_Model_SMSDelivery level convenience methods
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Model_SMSDelivery extends Bronto_Api_Model_DeliveryAbstract
17
+ {
18
+ const TYPE_BULK = 'bulk';
19
+ const TYPE_WORKFLOW = 'workflow';
20
+ const TYPE_TRANSACTION = 'transaction';
21
+ const TYPE_TEST = 'test';
22
+
23
+ const STATUS_SENT = 'sent';
24
+ const STATUS_SENDING = 'sending';
25
+ const STATUS_UNSENT = 'unsent';
26
+ const STATUS_ARCHIVED = 'archived';
27
+ const STATUS_SKIPPED = 'skipped';
28
+
29
+ /**
30
+ * @see parent
31
+ */
32
+ public function __construct(array $data = array())
33
+ {
34
+ parent::__construct('SMSDelivery', $data);
35
+ }
36
+
37
+ /**
38
+ * @see parent
39
+ */
40
+ public function isTransactional()
41
+ {
42
+ return $this->hasDeliveryType() && $this->getDeliveryType() == self::TYPE_TRANSACTION;
43
+ }
44
+ }
lib/Bronto/Api/Object.php CHANGED
@@ -1,582 +1,41 @@
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
  }
1
  <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Object.php
9
+ */
10
 
11
  /**
12
+ * The API Bronto_Api_Object represent data returned by the API
 
 
13
  *
14
+ * @author Philip Cali <philip.cali@bronto.com>
 
 
 
 
15
  */
16
+ class Bronto_Api_Object extends Bronto_Object
17
  {
18
+ protected $_rawType;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  /**
21
+ * @see parent
22
  *
23
+ * @param string $rawType
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  * @param array $data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  */
26
+ public function __construct($rawType, array $data = array())
27
  {
28
+ parent::__construct($data);
29
+ $this->_rawType = $rawType;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
  /**
33
+ * The transfer type of the API object
34
+ *
35
  * @return string
36
  */
37
+ public function getTransferType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  {
39
+ return $this->_rawType;
 
 
 
 
40
  }
41
  }
lib/Bronto/Api/Observer.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Observer.php
9
+ */
10
+
11
+ /**
12
+ * General login and failure observation
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Api_Observer
17
+ {
18
+ /**
19
+ * Called whenever there's an implicit or explicit API login
20
+ *
21
+ * @param string $apiToken
22
+ * @param string $sessionId
23
+ * @return void
24
+ */
25
+ public function onLogin($apiToken, $sessionId);
26
+
27
+ /**
28
+ * Called whenever an API exception is about to be thrown
29
+ *
30
+ * @param Bronto_Api $api
31
+ * @param Bronto_Api_Exception $exception
32
+ * @return void
33
+ */
34
+ public function onError(Bronto_Api $api, Bronto_Api_Exception $exception);
35
+ }
lib/Bronto/Api/Operation.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Typed insteraction with APIv4 is achieved through an Bronto_Api_Operation.
14
+ * In its generic form, the Bronto_Api_Operation can handle:
15
+ *
16
+ * - read
17
+ * - add
18
+ * - update
19
+ * - delete
20
+ *
21
+ * @author Philip Cali <philip.cali@bronto.com>
22
+ */
23
+ class Bronto_Api_Operation
24
+ {
25
+ protected $_api;
26
+ protected $_type;
27
+ protected $_pluralized;
28
+ protected $_methodsToPrefix = array();
29
+ protected $_uniqueKey = array('name');
30
+ protected $_writeLimit = 100;
31
+
32
+ /**
33
+ * Wraps the Bronto_Api and transfer type
34
+ *
35
+ * @param Bronto_Api $api
36
+ * @param string $transferType
37
+ * @param array $methods (Optional)
38
+ */
39
+ public function __construct(Bronto_Api $api, $transferType, array $methods = null)
40
+ {
41
+ $this->_api = $api;
42
+ $this->_type = $transferType;
43
+ $this->_pluralized = $this->_pluralize($transferType);
44
+ $methods = is_null($methods) ? array('add', 'update', 'delete') : $methods;
45
+
46
+ foreach ($methods as $key => $method) {
47
+ $writeKey = "$method";
48
+ if (is_string($key)) {
49
+ $method = $key;
50
+ }
51
+ if ($this->_supportedPrefix($method)) {
52
+ $this->_methodsToPrefix["{$method}{$this->_pluralized}"] = $writeKey;
53
+ } else {
54
+ $this->_methodsToPrefix[$method] = $writeKey;
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Returns the pluralized type of this transfer type
61
+ *
62
+ * @param string $type
63
+ * @return string
64
+ */
65
+ protected function _pluralize($type)
66
+ {
67
+ if (preg_match('/y$/', $type)) {
68
+ $type = preg_replace('/y$/', 'ies', $type);
69
+ } else {
70
+ $type .= 's';
71
+ }
72
+ return $type;
73
+ }
74
+
75
+ /**
76
+ * A supported prefix will allow the shorted variations of the API commands
77
+ *
78
+ * @param string $method
79
+ * @return boolean
80
+ */
81
+ protected function _supportedPrefix($method)
82
+ {
83
+ switch ($method) {
84
+ case 'add':
85
+ case 'update':
86
+ case 'delete':
87
+ case 'addOrUpdate':
88
+ return true;
89
+ default:
90
+ return false;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Determines if the method name is supported
96
+ *
97
+ * @param string $name
98
+ * @return boolean
99
+ */
100
+ protected function _supportedMethod($name)
101
+ {
102
+ return array_key_exists($name, $this->_methodsToPrefix);
103
+ }
104
+
105
+ /**
106
+ * Returns the write key in update operations
107
+ *
108
+ * @param string $writeMethod
109
+ * @return string
110
+ */
111
+ protected function _resolvedWriteKey($writeMethod)
112
+ {
113
+ $value = "{$this->_pluralized}";
114
+ $value[0] = strtolower($value[0]);
115
+ return $value;
116
+ }
117
+
118
+ /**
119
+ * Allows for acceptable methods to be called on the Operation
120
+ * Default read methods:
121
+ *
122
+ * - getById
123
+ * - getByName
124
+ * - read
125
+ *
126
+ * @param string $name
127
+ * @param array $arguments
128
+ * @return mixed
129
+ */
130
+ public function __call($name, $arguments)
131
+ {
132
+ if (preg_match('/^getBy(.*)/', $name, $match)) {
133
+ switch ($match[1]) {
134
+ case 'Id':
135
+ return $this->createRead()->withId(array($arguments[0]))->first();
136
+ default:
137
+ return $this->createRead()->{"with{$match[1]}"}(array('operator' => 'EqualTo', 'value' => $arguments[0]))->first();
138
+ }
139
+ }
140
+ switch ($name) {
141
+ case 'read':
142
+ $readData = array();
143
+ if (count($arguments) > 0) {
144
+ $readData = $arguments[0];
145
+ }
146
+ return $this->createRead($readData);
147
+ case 'save':
148
+ $thing = $arguments[0];
149
+ if (count($arguments) > 1) {
150
+ $upsert = (boolean) $arguments[1];
151
+ }
152
+ if (!$thing->hasId() && !$this->_supportedPrefix('add') && $this->_supportedPrefix('addOrUpdate')) {
153
+ $writeOps = $this->addOrUpdate();
154
+ } else if (!$thing->hasId()) {
155
+ if ($upsert) {
156
+ $existingRead = $this->createRead()->withType('AND');
157
+ foreach ($this->_uniqueKey as $key) {
158
+ if ($thing->{$key}) {
159
+ $existingRead->where->{$key}->equalTo($thing->{$key});
160
+ }
161
+ }
162
+ $existingThing = $existingRead->first();
163
+ if ($existingThing) {
164
+ $thing = $this->createObject(array_merge($existingThing->toArray(), $thing->toArray()));
165
+ $writeOps = $this->update();
166
+ }
167
+ }
168
+ if (!$thing->hasId()) {
169
+ $writeOps = $this->add();
170
+ }
171
+ } else {
172
+ $writeOps = $this->update();
173
+ }
174
+ foreach ($writeOps->push($thing) as $result) {
175
+ $item = $result->getItem();
176
+ if ($item->getIsError()) {
177
+ throw new Bronto_Api_Exception($item->getErrorString(), $item->getErrorCode());
178
+ }
179
+ $thing->withId($item->getId());
180
+ }
181
+ return $thing;
182
+ default:
183
+ if ($this->_supportedPrefix($name)) {
184
+ $name = "{$name}{$this->_pluralized}";
185
+ }
186
+ $limit = null;
187
+ if (count($arguments) > 0) {
188
+ $limit = $arguments[0];
189
+ }
190
+ return $this->createWrite($name, $limit, $this->_methodsToPrefix[$name]);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Get the Bronto_Api client issuing the requests
196
+ *
197
+ * @return Bronto_Api
198
+ */
199
+ public function getApi()
200
+ {
201
+ return $this->_api;
202
+ }
203
+
204
+ /**
205
+ * Gets the transfer type associated with this operation
206
+ *
207
+ * @return string
208
+ */
209
+ public function getTransferType()
210
+ {
211
+ return $this->_type;
212
+ }
213
+
214
+ /**
215
+ * Gets the pluralized type associated with this operation
216
+ *
217
+ * @return string
218
+ */
219
+ public function getPluralizedType()
220
+ {
221
+ return $this->_pluralized;
222
+ }
223
+
224
+ /**
225
+ * Creates an API object belonging to this transfer type
226
+ *
227
+ * @param array $data
228
+ * @return Bronto_Api_Object
229
+ */
230
+ public function createObject(array $data = array())
231
+ {
232
+ $modelClass = "Bronto_Api_Model_{$this->getTransferType()}";
233
+ // Note: This snippet was generated with legacy conversion
234
+ if (is_string($modelClass) && !array_key_exists($modelClass, Bronto_ImportManager::$_fileCache)) {
235
+ $dir = str_replace(str_replace("_", "/", "Bronto_Api"), '', dirname(__FILE__));
236
+ $file = $dir . str_replace("_", "/", $modelClass) . '.php';
237
+ if (file_exists($file)) {
238
+ require_once $file;
239
+ Bronto_ImportManager::$_fileCache[$modelClass] = true;
240
+ } else {
241
+ Bronto_ImportManager::$_fileCache[$modelClass] = false;
242
+ }
243
+ }
244
+ // End Conversion Snippet
245
+ if (Bronto_ImportManager::$_fileCache[$modelClass]) {
246
+ return new $modelClass($data);
247
+ }
248
+ return new Bronto_Api_Object($this->_type, $data);
249
+ }
250
+
251
+ /**
252
+ * Creates a read pager for the read request
253
+ *
254
+ * @param Bronto_Object $request
255
+ * @return Bronto_Api_Read_Pager
256
+ */
257
+ public function createReadPager($request)
258
+ {
259
+ return new Bronto_Api_Read_ByPage($this, $request);
260
+ }
261
+
262
+ /**
263
+ * Creates a write pager for the varying write requests
264
+ *
265
+ * @param Bronto_Object $request
266
+ * @return Bronto_Api_Write_Pager
267
+ */
268
+ public function createWritePager($request)
269
+ {
270
+ return new Bronto_Api_Write_Pager($this, $request);
271
+ }
272
+
273
+ /**
274
+ * Creates a read request with default request parameters
275
+ *
276
+ * @param array $readData
277
+ * @param array $requestFields
278
+ * @return Bronto_Api_Read
279
+ */
280
+ public function createRead(array $readData = array(), array $requestFields = array())
281
+ {
282
+ $requestFields = array('filter' => true, 'pageNumber' => true) + $requestFields;
283
+ return new Bronto_Api_Read($this, "read{$this->_pluralized}", $readData, $requestFields);
284
+ }
285
+
286
+ /**
287
+ * Creates a write request with default request parameters
288
+ *
289
+ * @return Bronto_Api_Write
290
+ */
291
+ public function createWrite($method, $limit = null, $original = null)
292
+ {
293
+ if (!$this->_supportedMethod($method)) {
294
+ throw new BadMethodCallException("Method $method is not supported.");
295
+ }
296
+ $limit = $limit ?: $this->_writeLimit;
297
+ $original = $original ?: $method;
298
+ return new Bronto_Api_Write($this, $method, $limit, $original, $this->_resolvedWriteKey($original));
299
+ }
300
+ }
lib/Bronto/Api/Operation/Account.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/Account.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_Account specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_Account extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'Account');
25
+ $this->_writeLimit = 10;
26
+ }
27
+
28
+ /**
29
+ * @see parent
30
+ * @return Bronto_Api_Read
31
+ */
32
+ public function createRead(array $readData = array(), array $requestFields = array())
33
+ {
34
+ return parent::createRead($readData, $requestFields)
35
+ ->setRequestFields(array(
36
+ 'includeInfo' => true,
37
+ 'status' => false
38
+ ));
39
+ }
40
+ }
lib/Bronto/Api/Operation/Activity.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/Activity.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_Activity specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_Activity extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'Activity', array());
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @param Bronto_Object $request
30
+ * @return Bronto_Api_Read_ByDirection
31
+ */
32
+ public function createReadPager($request)
33
+ {
34
+ return new Bronto_Api_Read_ByDirection($this, $request);
35
+ }
36
+
37
+ /**
38
+ * @see parent
39
+ * @return Bronto_Api_Read
40
+ */
41
+ public function createRead(array $readData = array(), array $requestFields = array())
42
+ {
43
+ return parent::createRead($readData, $requestFields)->withSize(1000);
44
+ }
45
+ }
lib/Bronto/Api/Operation/Contact.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/Contact.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_Contact specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_Contact extends Bronto_Api_Operation
18
+ {
19
+ protected $_uniqueKey = array('email', 'mobileNumber');
20
+
21
+ /**
22
+ * @see parent
23
+ */
24
+ public function __construct(Bronto_Api $api)
25
+ {
26
+ parent::__construct($api, 'Contact', array(
27
+ 'add',
28
+ 'update',
29
+ 'addOrUpdate',
30
+ 'delete',
31
+ 'addContactsToWorkflow' => 'add',
32
+ 'addContactEvent' => 'add',
33
+ 'addToList' => 'add',
34
+ 'removeFromList' => 'remove',
35
+ 'addToSMSKeyword' => 'add',
36
+ 'removeFromSMSKeyword' => 'remove'
37
+ ));
38
+ }
39
+
40
+ /**
41
+ * @see parent
42
+ * @return Bronto_Api_Read
43
+ */
44
+ public function createRead(array $readData = array(), array $requestFields = array())
45
+ {
46
+ return parent::createRead($readData, $requestFields)
47
+ ->setRequestFields(array(
48
+ 'includeLists' => false,
49
+ 'includeSegments' => false,
50
+ 'includeSMSKeywords' => false,
51
+ 'includeGeoIPData' => false,
52
+ 'includeRFMData' => false,
53
+ 'includeTechnologyData' => false,
54
+ 'includeEngagementData' => false,
55
+ 'fields' => false,
56
+ ));
57
+ }
58
+ }
lib/Bronto/Api/Operation/ContentTag.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/ContentTag.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Content Tag specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_ContentTag extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'ContentTag');
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @return Bronto_Api_Read
30
+ */
31
+ public function createRead(array $readData = array(), array $requestFields = array())
32
+ {
33
+ return parent::createRead($readData, $requestFields)
34
+ ->setRequestFields(array('includeContent' => true));
35
+ }
36
+ }
lib/Bronto/Api/Operation/Conversion.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/Conversion.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_Conversion specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_Conversion extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'Conversion', array('add'));
25
+ $this->_writeLimit = 10;
26
+ }
27
+ }
lib/Bronto/Api/Operation/Delivery.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/Delivery.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_Delivery specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_Delivery extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'Delivery');
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @return Bronto_Api_Read
30
+ */
31
+ public function createRead(array $readData = array(), array $requestFields = array())
32
+ {
33
+ return parent::createRead($readData, $requestFields)
34
+ ->setRequestFields(array(
35
+ 'includeRecipients' => true,
36
+ 'includeContent' => true,
37
+ 'includeOrderIds' => false
38
+ ));
39
+ }
40
+ }
lib/Bronto/Api/Operation/DeliveryGroup.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/DeliveryGroup.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_DeliveryGroup specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_DeliveryGroup extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'DeliveryGroup', array(
25
+ 'add',
26
+ 'update',
27
+ 'delete',
28
+ 'addOrUpdate',
29
+ 'addToDeliveryGroup' => 'add',
30
+ ));
31
+ }
32
+
33
+ /**
34
+ * @see parent
35
+ * @return string
36
+ */
37
+ protected function _resolvedWriteKey($method)
38
+ {
39
+ return 'deliveryGroup';
40
+ }
41
+ }
lib/Bronto/Api/Operation/HeaderFooter.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/HeaderFooter.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_HeaderFooter specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_HeaderFooter extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'HeaderFooter');
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @return Bronto_Api_Read
30
+ */
31
+ public function createRead(array $readData = array(), array $requestFields = array())
32
+ {
33
+ return parent::createRead($readData, $requestFields)
34
+ ->setRequestFields(array('includeContent' => true));
35
+ }
36
+ }
lib/Bronto/Api/Operation/InboundActivity.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/InboundActivity.php
9
+ */
10
+
11
+
12
+ /**
13
+ * RecentInboundActivity specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_InboundActivity extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'RecentInboundActivity', array());
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @param Bronto_Object $request
30
+ * @return Bronto_Api_Read_ByDirection
31
+ */
32
+ public function createReadPager($request)
33
+ {
34
+ return new Bronto_Api_Read_ByDirection($this, $request);
35
+ }
36
+
37
+ /**
38
+ * @see parent
39
+ * @return Bronto_Api_Read
40
+ */
41
+ public function createRead(array $readData = array(), array $requestFields = array())
42
+ {
43
+ return parent::createRead($readData, $requestFields)->withSize(1000);
44
+ }
45
+ }
lib/Bronto/Api/Operation/MailList.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/MailList.php
9
+ */
10
+
11
+
12
+ /**
13
+ * List specific operations
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_MailList extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'List', array(
25
+ 'add',
26
+ 'update',
27
+ 'delete',
28
+ 'clear',
29
+ ));
30
+ }
31
+
32
+ /**
33
+ * @see parent
34
+ * @param string $method
35
+ * @return boolean
36
+ */
37
+ protected function _supportedPrefix($method)
38
+ {
39
+ if ($method == 'clear') {
40
+ return true;
41
+ } else {
42
+ return parent::_supportedPrefix($method);
43
+ }
44
+ }
45
+ }
lib/Bronto/Api/Operation/Message.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/Message.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_Message specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_Message extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'Message');
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @return Bronto_Api_Read
30
+ */
31
+ public function createRead(array $readData = array(), array $requestFields = array())
32
+ {
33
+ return parent::createRead($readData, $requestFields)
34
+ ->setRequestFields(array('includeContent' => true));
35
+ }
36
+ }
lib/Bronto/Api/Operation/Order.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/Order.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_Order specific operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_Order extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'Order', array(
25
+ 'delete',
26
+ 'addOrUpdate'
27
+ ));
28
+ $this->_writeLimit = 10;
29
+ }
30
+
31
+ /**
32
+ * Creates a chainable product object
33
+ *
34
+ * @return Bronto_Object
35
+ */
36
+ public function createProduct(array $data = array())
37
+ {
38
+ return new Bronto_Object($data);
39
+ }
40
+
41
+ /**
42
+ * @see parent
43
+ * @throws BadMethodCallException
44
+ */
45
+ public function createRead(array $readData = array(), array $requestFields = array())
46
+ {
47
+ throw new BadMethodCallException('The read request is not allowed for Order type.');
48
+ }
49
+ }
lib/Bronto/Api/Operation/OutboundActivity.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/OutboundActivity.php
9
+ */
10
+
11
+
12
+ /**
13
+ * RecentOutboundActivity specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_OutboundActivity extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'RecentOutboundActivity', array());
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @param Bronto_Object $request
30
+ * @return Bronto_Api_Read_ByDirection
31
+ */
32
+ public function createReadPager($request)
33
+ {
34
+ return new Bronto_Api_Read_ByDirection($this, $request);
35
+ }
36
+
37
+ /**
38
+ * @see parent
39
+ * @return Bronto_Api_Read
40
+ */
41
+ public function createRead(array $readData = array(), array $requestFields = array())
42
+ {
43
+ return parent::createRead($readData, $requestFields)->withSize(1000);
44
+ }
45
+ }
lib/Bronto/Api/Operation/SMSDelivery.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/SMSDelivery.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_SMSDelivery specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_SMSDelivery extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'SMSDelivery');
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @return string
30
+ */
31
+ protected function _resolvedWriteKey($method)
32
+ {
33
+ return 'deliveries';
34
+ }
35
+
36
+ /**
37
+ * @see parent
38
+ * @return Bronto_Api_Read
39
+ */
40
+ public function createRead(array $readData = array(), array $requestFields = array())
41
+ {
42
+ return parent::createRead($readData, $requestFields)
43
+ ->setRequestFields(array(
44
+ 'includeContent' => true,
45
+ 'includeRecipients' => true
46
+ ));
47
+ }
48
+ }
lib/Bronto/Api/Operation/SMSKeyword.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/SMSKeyword.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_SMSKeyword specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_SMSKeyword extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'SMSKeyword', array(
25
+ 'add',
26
+ 'update',
27
+ 'delete',
28
+ ));
29
+ }
30
+
31
+ /**
32
+ * @see parent
33
+ * @param string $method
34
+ * @return string
35
+ */
36
+ protected function _resolvedWriteKey($method)
37
+ {
38
+ switch ($method) {
39
+ case 'add':
40
+ return 'keyword';
41
+ default:
42
+ return 'keywords';
43
+ }
44
+ }
45
+
46
+ /**
47
+ * @see parent
48
+ * @return Bronto_Api_Read
49
+ */
50
+ public function createRead(array $readData = array(), array $requestFields = array())
51
+ {
52
+ return parent::createRead($readData, $requestFields)
53
+ ->setRequestFields(array('includeDeleted' => false));
54
+ }
55
+ }
lib/Bronto/Api/Operation/SMSMessage.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Operation/SMSMessage.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Api_Operation_SMSMessage specific Bronto_Api_Operation
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Operation_SMSMessage extends Bronto_Api_Operation
18
+ {
19
+ /**
20
+ * @see parent
21
+ */
22
+ public function __construct(Bronto_Api $api)
23
+ {
24
+ parent::__construct($api, 'SMSMessage');
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ * @param string $method
30
+ * @return string
31
+ */
32
+ protected function _resolvedWriteKey($method)
33
+ {
34
+ return 'messages';
35
+ }
36
+
37
+ /**
38
+ * @see parent
39
+ * @return Bronto_Api_Read
40
+ */
41
+ public function createRead(array $readData = array(), array $requestFields = array())
42
+ {
43
+ return parent::createRead($readData, $requestFields)
44
+ ->setRequestFields(array('includeContent' => true));
45
+ }
46
+ }
lib/Bronto/Api/Options.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Options.php
9
+ */
10
+
11
+
12
+ /**
13
+ * An options container class for the Api client
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Options extends Bronto_Object
18
+ {
19
+ public static $defaultOptions = array(
20
+ 'soapClass' => 'SoapClient',
21
+ 'wsdl' => 'https://api.bronto.com/v4?wsdl',
22
+ 'error' => 'Bronto_Api_Strategy_Standard',
23
+ 'retries' => 5,
24
+ 'backOff' => 5,
25
+ 'soapOptions' => array(
26
+ 'trace' => true,
27
+ 'exceptions' => true,
28
+ 'encoding' => 'UTF-8',
29
+ 'connection_timeout' => 30,
30
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
31
+ 'cache_wsdl' => WSDL_CACHE_NONE
32
+ )
33
+ );
34
+
35
+ private $_observer;
36
+ private $_retryer;
37
+ private $_error;
38
+ private $_soapClient;
39
+
40
+ /**
41
+ * Create a options with a data array that overrides settings
42
+ *
43
+ * @param array $data
44
+ */
45
+ public function __construct(array $data = array())
46
+ {
47
+ parent::__construct($this->_mergeData(self::$defaultOptions, $data));
48
+ $this->_init();
49
+ }
50
+
51
+ /**
52
+ * Fix for array_merge_recursive
53
+ */
54
+ protected function _mergeData($returnArray, $data)
55
+ {
56
+ foreach ($data as $key => $value) {
57
+ if (is_array($value)) {
58
+ if (array_key_exists($key, $returnArray)) {
59
+ $value = $this->_mergeData($returnArray[$key], $value);
60
+ }
61
+ }
62
+ $returnArray[$key] = $value;
63
+ }
64
+ return $returnArray;
65
+ }
66
+
67
+ /**
68
+ * @see parent
69
+ *
70
+ * @param string $name
71
+ * @param array $args
72
+ * @return mixed
73
+ */
74
+ public function __call($name, $args)
75
+ {
76
+ $result = parent::__call($name, $args);
77
+ if (preg_match('/(?:SoapClient|Observer|Retryer|Error)$/', $name)) {
78
+ $this->_init();
79
+ }
80
+ return $result;
81
+ }
82
+
83
+ /**
84
+ * Gets an option type that represents the API observer
85
+ *
86
+ * @return Bronto_Functional_Option[Bronto_Api_Observer]
87
+ */
88
+ public function safeObserver()
89
+ {
90
+ if (is_null($this->_observer)) {
91
+ return new Bronto_Functional_None();
92
+ }
93
+ return new Bronto_Functional_Some($this->_observer);
94
+ }
95
+
96
+ /**
97
+ * Gets an option type that represents the API retryer
98
+ *
99
+ * @return Bronto_Functional_Option[Bronto_Api_Retryer]
100
+ */
101
+ public function safeRetryer()
102
+ {
103
+ if (is_null($this->_retryer)) {
104
+ return new Bronto_Functional_None();
105
+ }
106
+ return new Bronto_Functional_Some($this->_retryer);
107
+ }
108
+
109
+ /**
110
+ * Gets an option type that represents the error strategy
111
+ *
112
+ * @return Bronto_Functional_Option[Bronto_Api_Strategy_Error]
113
+ */
114
+ public function safeError()
115
+ {
116
+ if (is_null($this->_error)) {
117
+ return new Bronto_Functional_None();
118
+ }
119
+ return new Bronto_Functional_Some($this->_error);
120
+ }
121
+
122
+ /**
123
+ * Internal init to set implementation from data details
124
+ * for the retryer, observer, and error strategy
125
+ *
126
+ * @return void
127
+ */
128
+ protected function _init()
129
+ {
130
+ $classChecks = array(
131
+ 'observer' => 'Bronto_Api_Observer',
132
+ 'retryer' => 'Bronto_Api_Retryer',
133
+ 'error' => 'Bronto_Api_Strategy_Error'
134
+ );
135
+ foreach ($classChecks as $field => $className) {
136
+ if (array_key_exists($field, $this->_data)) {
137
+ $value = $this->_data[$field];
138
+ // Note: This snippet was generated with legacy conversion
139
+ if (is_string($value) && !array_key_exists($value, Bronto_ImportManager::$_fileCache)) {
140
+ $dir = str_replace(str_replace("_", "/", "Bronto_Api"), '', dirname(__FILE__));
141
+ $file = $dir . str_replace("_", "/", $value) . '.php';
142
+ if (file_exists($file)) {
143
+ require_once $file;
144
+ Bronto_ImportManager::$_fileCache[$value] = true;
145
+ } else {
146
+ Bronto_ImportManager::$_fileCache[$value] = false;
147
+ }
148
+ }
149
+ // End Conversion Snippet
150
+ if (is_string($value) && Bronto_ImportManager::$_fileCache[$value]) {
151
+ $value = new $value();
152
+ }
153
+ if (is_a($value, $className)) {
154
+ $this->{"_$field"} = $value;
155
+ } else {
156
+ unset($this->{"_$field"});
157
+ }
158
+ }
159
+ }
160
+ }
161
+ }
lib/Bronto/Api/Order.php DELETED
@@ -1,21 +0,0 @@
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 DELETED
@@ -1,10 +0,0 @@
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 DELETED
@@ -1,68 +0,0 @@
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 DELETED
@@ -1,86 +0,0 @@
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/Read.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Read.php
9
+ */
10
+
11
+ /**
12
+ * An implementing read request builder. The actual request
13
+ * will come in the form of the aggregated iterator.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Read extends Bronto_Object implements Bronto_Api_Request, IteratorAggregate
18
+ {
19
+ protected $_method;
20
+ protected $_operation;
21
+ protected $_requestFields;
22
+
23
+ /**
24
+ * @param Bronto_Api_Operation $operation
25
+ * @param string $method
26
+ * @param array originalData
27
+ * @param array $requestFields
28
+ */
29
+ public function __construct(Bronto_Api_Operation $operation, $method, array $originalData = array(), array $requestFields = array())
30
+ {
31
+ parent::__construct(array('filter' => new Bronto_Api_Read_Filter($this, array('type' => 'OR'))));
32
+ foreach ($originalData as $field => $value) {
33
+ if ($field === 'filter') {
34
+ $this->_data['filter']->replace($value);
35
+ } else {
36
+ $this->_set($field, $value);
37
+ }
38
+ }
39
+ $this->_method = $method;
40
+ $this->_operation = $operation;
41
+ $this->_requestFields = $requestFields;
42
+ }
43
+
44
+ /**
45
+ * @see parent
46
+ * @return string
47
+ */
48
+ public function getMethod()
49
+ {
50
+ return $this->_method;
51
+ }
52
+
53
+ /**
54
+ * @see parent
55
+ * @return boolean
56
+ */
57
+ public function hasUpdates()
58
+ {
59
+ return false;
60
+ }
61
+
62
+ /**
63
+ * @see parent
64
+ * @return array
65
+ */
66
+ public function getData()
67
+ {
68
+ $data = $this->toArray();
69
+ unset($data['filter']);
70
+ return array_merge(array('filter' => $this->getFilter()->toArray()), $data);
71
+ }
72
+
73
+ /**
74
+ * Adds additional white labeled request fields,
75
+ * with default parameters
76
+ *
77
+ * @param array $requestFields
78
+ * @return Bronto_Api_Read
79
+ */
80
+ public function setRequestFields(array $requestFields)
81
+ {
82
+ $this->_requestFields += $requestFields;
83
+ return $this;
84
+ }
85
+
86
+ /**
87
+ * @see parent
88
+ *
89
+ * @param string $name
90
+ * @param array $arguments
91
+ * @return mixed
92
+ */
93
+ public function __call($name, $arguments)
94
+ {
95
+ list($prefix, $camelized) = $this->_camelizedValue($name);
96
+ if (array_key_exists($camelized, $this->_requestFields)) {
97
+ return parent::__call($name, $arguments);
98
+ } else {
99
+ $filter = $this->_data['filter'];
100
+ $return = $filter->__call($name, $arguments);
101
+ if ($return == $filter) {
102
+ return $this;
103
+ } else {
104
+ return $return;
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Convenience method for setting the page number in a
111
+ * SQL like expression.
112
+ *
113
+ * @param int $offset
114
+ * @return Bronto_Api_Read
115
+ */
116
+ public function offset($value)
117
+ {
118
+ return $this->withPageNumber($value);
119
+ }
120
+
121
+ /**
122
+ * Convenience method for setting a limit on certain read
123
+ * results in a SQL like expression.
124
+ * Note: Only works for SOAP function filters that support the size parameter
125
+ *
126
+ * @param int $value
127
+ * @return Bronto_Api_Read
128
+ */
129
+ public function limit($value)
130
+ {
131
+ if ($value < 1000 || $value > 5000) {
132
+ throw new InvalidArgumentException("Read limit must be between 1000 and 5000: $value");
133
+ }
134
+ return $this->withSize($value);
135
+ }
136
+
137
+ /**
138
+ * Creates or continues a SQL like filter expression.
139
+ * Supported keywords are:
140
+ *
141
+ * - where
142
+ * - and
143
+ * - or
144
+ *
145
+ * @param string $name
146
+ * @return Bronto_Api_Read_Filter
147
+ * @throws LogicException
148
+ */
149
+ public function __get($name)
150
+ {
151
+ switch ($name) {
152
+ case 'where':
153
+ return $this->getFilter()->open();
154
+ case 'and':
155
+ case 'or':
156
+ return $this->getFilter()->open(strtoupper($name));
157
+ default:
158
+ throw new LogicException("Unsupported query verb $name");
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Retrieves the first entry in the aggregated iterator
164
+ *
165
+ * @return Bronto_Api_Object|null
166
+ */
167
+ public function first()
168
+ {
169
+ $firstEntry = null;
170
+ foreach ($this as $first) {
171
+ return $first;
172
+ }
173
+ return $firstEntry;
174
+ }
175
+
176
+ /**
177
+ * Creates the aggregated iterator that performs the read ops
178
+ *
179
+ * @return Bronto_Api_Read_Pager
180
+ */
181
+ public function getIterator()
182
+ {
183
+ $clonedRequest = new Bronto_Object(array(
184
+ 'method' => $this->_method,
185
+ 'data' => new Bronto_Object($this->getData())
186
+ ));
187
+ return $this->_operation->createReadPager($clonedRequest);
188
+ }
189
+ }
lib/Bronto/Api/Read/ByDirection.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Read/ByDirection.php
9
+ */
10
+
11
+ /**
12
+ * Implementing pager that uses the readDirection in reads.
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Read_ByDirection extends Bronto_Api_Read_Pager
17
+ {
18
+ const FIRST = 'FIRST';
19
+ const NEXT = 'NEXT';
20
+
21
+ /**
22
+ * @see parent
23
+ * @return string
24
+ */
25
+ protected function _getPage($request)
26
+ {
27
+ return $request->safeReadDirection()->getOrElse(self::FIRST);
28
+ }
29
+
30
+ /**
31
+ * @see parent
32
+ */
33
+ protected function _nextPage($request)
34
+ {
35
+ $request->withReadDirection(self::NEXT);
36
+ }
37
+
38
+ /**
39
+ * @see parent
40
+ */
41
+ protected function _setPage($request, $pageNumber)
42
+ {
43
+ $request->withReadDirection($pageNumber);
44
+ }
45
+ }
lib/Bronto/Api/Read/ByPage.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Read/ByPage.php
9
+ */
10
+
11
+ /**
12
+ * Implementing pager using tradition pageNumber for reads.
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Read_ByPage extends Bronto_Api_Read_Pager
17
+ {
18
+ /**
19
+ * @see parent
20
+ * @return int
21
+ */
22
+ protected function _getPage($request)
23
+ {
24
+ return $request->getData()->safePageNumber()->getOrElse(1);
25
+ }
26
+
27
+ /**
28
+ * @see parent
29
+ */
30
+ protected function _nextPage($request)
31
+ {
32
+ $pageNumber = $this->_getPage($request);
33
+ $pageNumber++;
34
+ $request->getData()->setPageNumber($pageNumber);
35
+ }
36
+
37
+ /**
38
+ * @see parent
39
+ */
40
+ protected function _setPage($request, $pageNumber)
41
+ {
42
+ $request->getData()->setPageNumber($pageNumber);
43
+ }
44
+ }
lib/Bronto/Api/Read/Filter.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Read/Filter.php
9
+ */
10
+
11
+ /**
12
+ * The filter wrapper used in performing SQL like expressions
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Api_Read_Filter extends Bronto_Object {
17
+ private $_request;
18
+ private $_opened = false;
19
+ private $_openedType;
20
+ private $_currentField;
21
+ private $_previousField;
22
+
23
+ /**
24
+ * @see parent
25
+ * @param Bronto_Api_Read $request
26
+ * @param array $data
27
+ */
28
+ public function __construct($request, array $data = array())
29
+ {
30
+ parent::__construct($data);
31
+ $this->_request = $request;
32
+ }
33
+
34
+ /**
35
+ * Declares the SQL expression as open
36
+ *
37
+ * @param string $type
38
+ * @return Filter
39
+ * @throws LogicException
40
+ */
41
+ public function open($type = null)
42
+ {
43
+ if ($this->isOpened()) {
44
+ throw new LogicException("Filter statement was never completed.");
45
+ }
46
+ $this->_opened = true;
47
+ $this->_openedType = $type ?: $this->getType();
48
+ return $this;
49
+ }
50
+
51
+ /**
52
+ * Declares the SQL expression as closed
53
+ *
54
+ * @return Bronto_Api_Read
55
+ */
56
+ public function close()
57
+ {
58
+ $this->_opened = false;
59
+ if (!is_null($this->_currentField)) {
60
+ $this->_previousField = "{$this->_currentField}";
61
+ }
62
+ $this->_currentField = null;
63
+ return $this->_request;
64
+ }
65
+
66
+ /**
67
+ * Whether or not this expression is open
68
+ *
69
+ * @return boolean
70
+ */
71
+ public function isOpened()
72
+ {
73
+ return $this->_opened;
74
+ }
75
+
76
+ /**
77
+ * The previous field used in an expression
78
+ *
79
+ * @return string
80
+ */
81
+ public function getPreviousField()
82
+ {
83
+ return $this->_previousField;
84
+ }
85
+
86
+ /**
87
+ * Magic getter is used to determine the field name
88
+ *
89
+ * @param string $name
90
+ * @return Filter
91
+ * @throws LogicException
92
+ */
93
+ public function __get($name)
94
+ {
95
+ if ($this->isOpened() && is_null($this->_currentField)) {
96
+ $this->_currentField = $name;
97
+ } else {
98
+ throw new LogicException("Filter statement was not properly opened.");
99
+ }
100
+ return $this;
101
+ }
102
+
103
+ /**
104
+ * Magic invocation is used in field names where filter operators
105
+ * are applicable.
106
+ *
107
+ * @param string $name
108
+ * @param array $arguments
109
+ * @return Bronto_Api_Read
110
+ * @throws LogicException
111
+ */
112
+ public function __call($name, $arguments)
113
+ {
114
+ switch ($name) {
115
+ case 'equalTo':
116
+ case 'notEqualTo':
117
+ case 'startsWith':
118
+ case 'endsWith':
119
+ case 'doesNotStartWith':
120
+ case 'doesNotEndWith':
121
+ case 'greaterThan':
122
+ case 'lessThan':
123
+ case 'contains':
124
+ case 'doesNotContain':
125
+ case 'sameYear':
126
+ case 'notSameYear':
127
+ case 'sameDay':
128
+ case 'notSameDay':
129
+ case 'before':
130
+ case 'after':
131
+ case 'beforeOrSameDay':
132
+ case 'afterOrSameDay':
133
+ $this->_protectStatement($name);
134
+ if (!array_key_exists($this->_currentField, $this->_data)) {
135
+ $this->_data[$this->_currentField] = array();
136
+ }
137
+ array_push($this->_data[$this->_currentField], array(
138
+ 'operator' => ucfirst($name),
139
+ 'value' => $arguments[0]
140
+ ));
141
+ return $this->close();
142
+ case 'in':
143
+ $this->_protectStatement($name);
144
+ $value = is_array($arguments[0]) ? $arguments[0] : $arguments;
145
+ return $this->_set('type', 'OR')->_set($this->_currentField, $value)->close();
146
+ case 'is':
147
+ $this->_protectStatement($name);
148
+ if (is_array($arguments[0])) {
149
+ $value = $arguments[0];
150
+ } else if (count($arguments) > 1) {
151
+ $value = $arguments;
152
+ } else {
153
+ $value = array($arguments[0]);
154
+ }
155
+ return $this->_set($this->_currentField, $value)->close();
156
+ default:
157
+ return parent::__call($name, $arguments);
158
+ }
159
+ }
160
+
161
+ /**
162
+ * Protects the state of the expression.
163
+ *
164
+ * @param string $name
165
+ * @return void
166
+ * @throws LogicException
167
+ */
168
+ protected function _protectStatement($name)
169
+ {
170
+ if (is_null($this->_currentField)) {
171
+ if (is_null($this->_previousField)) {
172
+ throw new LogicException("Trying to filter $name on a an empty statement.");
173
+ }
174
+ $this->_currentField = "{$this->_previousField}";
175
+ $this->_set('type', $this->_openedType);
176
+ $this->_previousField = null;
177
+ }
178
+ }
179
+ }
lib/Bronto/Api/Read/Pager.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Read/Pager.php
9
+ */
10
+
11
+
12
+ /**
13
+ * The read pager wraps a Bronto_Api_Read_Transform iterator for every page.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ abstract class Bronto_Api_Read_Pager implements Iterator
18
+ {
19
+ private $_operation;
20
+ private $_request;
21
+ private $_page;
22
+ private $_startingPoint;
23
+ private $_flatten;
24
+
25
+ /**
26
+ * For implementors, determine the current page based on request
27
+ *
28
+ * @param Bronto_Object $request
29
+ * @return mixed
30
+ */
31
+ protected abstract function _getPage($request);
32
+
33
+ /**
34
+ * For implementors, determine the next page based on request
35
+ *
36
+ * @param Bronto_Object $request
37
+ * @return void
38
+ */
39
+ protected abstract function _nextPage($request);
40
+
41
+ /**
42
+ * For implementors, set the page number on the request
43
+ *
44
+ * @param Bronto_Object $request
45
+ * @param mixed $page
46
+ * @return void
47
+ */
48
+ protected abstract function _setPage($request, $page);
49
+
50
+ /**
51
+ * @param Bronto_Api_Operation $operation
52
+ * @param Bronto_Object $request
53
+ */
54
+ public function __construct(Bronto_Api_Operation $operation, Bronto_Object $request)
55
+ {
56
+ $this->_operation = $operation;
57
+ $this->_request = $request;
58
+ $this->_flatten = true;
59
+ $this->_startingPoint = $this->_getPage($request);
60
+ }
61
+
62
+ /**
63
+ * Determines if this iterator operates on the Bronto_Api_Read_Transform page.
64
+ *
65
+ * @return Bronto_Api_Read_Pager
66
+ */
67
+ public function flatten()
68
+ {
69
+ $this->_flatten = true;
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ * Determines if this iterator operates on the page.
75
+ *
76
+ * @return Bronto_Api_Read_Pager
77
+ */
78
+ public function paginate()
79
+ {
80
+ $this->_flatten = false;
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * Gets the current page as a Bronto_Api_Read_Transform iterator
86
+ *
87
+ * @return Bronto_Api_Read_Transform
88
+ */
89
+ public function getCurrentPage()
90
+ {
91
+ if (is_null($this->_page)) {
92
+ $this->rewind();
93
+ }
94
+ return $this->_page;
95
+ }
96
+
97
+ /**
98
+ * Creates an internal pager from an API read request
99
+ *
100
+ * @return void
101
+ */
102
+ protected function _currentPage()
103
+ {
104
+ $result = $this->_operation->getApi()->execute($this->_request);
105
+ $this->_page = new Bronto_Api_Read_Transform($this->_operation, $result);
106
+ }
107
+
108
+ /**
109
+ * Bumps the read request page and executes
110
+ *
111
+ * @return void
112
+ */
113
+ protected function _next()
114
+ {
115
+ $this->_nextPage($this->_request);
116
+ $this->_currentPage();
117
+ }
118
+
119
+ /**
120
+ * @see parent
121
+ * @return boolean
122
+ */
123
+ public function valid()
124
+ {
125
+ if ($this->_flatten && !$this->getCurrentPage()->valid()) {
126
+ $this->_next();
127
+ }
128
+ return $this->getCurrentPage()->valid();
129
+ }
130
+
131
+ /**
132
+ * @see parent
133
+ * @return mixed
134
+ */
135
+ public function current()
136
+ {
137
+ return $this->_flatten ? $this->_page->current() : $this->_page;
138
+ }
139
+
140
+ /**
141
+ * @see parent
142
+ * @return scalar
143
+ */
144
+ public function key()
145
+ {
146
+ return $this->_flatten ? $this->_page->key() : $this->_operation->getPage($this->_request);
147
+ }
148
+
149
+ /**
150
+ * @see parent
151
+ * @return void
152
+ */
153
+ public function next()
154
+ {
155
+ if ($this->_flatten) {
156
+ $this->_page->next();
157
+ } else {
158
+ $this->_next();
159
+ }
160
+ }
161
+
162
+ /**
163
+ * @see parent
164
+ * @return void
165
+ */
166
+ public function rewind()
167
+ {
168
+ $this->_setPage($this->_request, $this->_startingPoint);
169
+ $this->_currentPage();
170
+ }
171
+
172
+ /**
173
+ * Loads this entire pager into a memory hashtable
174
+ *
175
+ * @return array
176
+ */
177
+ public function toArray()
178
+ {
179
+ if (function_exists('iterator_to_array')) {
180
+ return iterator_to_array($this->getCurrentPage(), true);
181
+ } else {
182
+ $hashTable = array();
183
+ foreach ($this->getCurrentPage() as $id => $object) {
184
+ $hashTable[$id] = $object;
185
+ }
186
+ return $hashTable;
187
+ }
188
+ }
189
+ }
lib/Bronto/Api/Read/Transform.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Read/Transform.php
9
+ */
10
+
11
+
12
+ /**
13
+ * A simple iterator that simply transform the result on
14
+ * the fly.
15
+ *
16
+ * @author Philip Cali <philip.cali@bronto.com>
17
+ */
18
+ class Bronto_Api_Read_Transform implements Iterator, Countable
19
+ {
20
+ private $_operation;
21
+ private $_result;
22
+ private $_iter;
23
+
24
+ /**
25
+ * @param Bronto_Api_Operation $operation
26
+ * @param stdClass $result
27
+ */
28
+ public function __construct(Bronto_Api_Operation $operation, $result)
29
+ {
30
+ $this->_operation = $operation;
31
+ $this->_result = $result;
32
+ $this->_iter = new ArrayIterator(property_exists($result, 'return') ? $result->return : array());
33
+ $this->_iter->rewind();
34
+ }
35
+
36
+ /**
37
+ * Gets the raw results from the API
38
+ *
39
+ * @return stdClass
40
+ */
41
+ public function getResult()
42
+ {
43
+ return $this->_result;
44
+ }
45
+
46
+ /**
47
+ * Gets the operation associated with this read
48
+ *
49
+ * @return Bronto_Api_Operation
50
+ */
51
+ public function getOperation()
52
+ {
53
+ return $this->_operation;
54
+ }
55
+
56
+ /**
57
+ * Counts the records in this iterator
58
+ *
59
+ * @return int
60
+ */
61
+ public function count()
62
+ {
63
+ return $this->_iter->count();
64
+ }
65
+
66
+ /**
67
+ * @see parent
68
+ */
69
+ public function rewind()
70
+ {
71
+ $this->_iter->rewind();
72
+ }
73
+
74
+ /**
75
+ * @see parent
76
+ */
77
+ public function next()
78
+ {
79
+ $this->_iter->next();
80
+ }
81
+
82
+ /**
83
+ * @see parent
84
+ * @return boolean
85
+ */
86
+ public function valid()
87
+ {
88
+ return $this->_iter->valid();
89
+ }
90
+
91
+ /**
92
+ * @see parent
93
+ * @return scalar
94
+ */
95
+ public function key()
96
+ {
97
+ return $this->_iter->current()->id;
98
+ }
99
+
100
+ /**
101
+ * @see parent
102
+ * @return Bronto_Api_Object
103
+ */
104
+ public function current()
105
+ {
106
+ return $this->_operation->createObject((array) $this->_iter->current());
107
+ }
108
+ }
lib/Bronto/Api/Request.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Request.php
9
+ */
10
+
11
+ /**
12
+ * Represents an API read or write request
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Api_Request
17
+ {
18
+ /**
19
+ * SOAP function to be called in string format
20
+ *
21
+ * @return string
22
+ */
23
+ public function getMethod();
24
+
25
+ /**
26
+ * Whether or not this request is changing data on the server
27
+ *
28
+ * @return boolean
29
+ */
30
+ public function hasUpdates();
31
+
32
+ /**
33
+ * The SOAP parameters in the SOAP request
34
+ *
35
+ * @return array
36
+ */
37
+ public function getData();
38
+ }
lib/Bronto/Api/Retryer.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Retryer.php
9
+ */
10
+
11
+ /**
12
+ * Bronto_Api_Retryer interface that allows the Api client to save
13
+ * a failed request or deserialize the same request
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ interface Bronto_Api_Retryer
18
+ {
19
+ /**
20
+ * Serialize a write request with an optional try count
21
+ *
22
+ * @param Bronto_Object $object
23
+ * @param string $apiToken
24
+ * @param int $attempts
25
+ * @return boolean
26
+ */
27
+ public function store(Bronto_Object $object, $apiToken, $attempts = 0);
28
+
29
+ /**
30
+ * Deserialize an attempt with a provided identifier
31
+ *
32
+ * @param mixed $identifier
33
+ * @return boolean
34
+ */
35
+ public function attempt($identifier);
36
+ }
lib/Bronto/Api/Row.php DELETED
@@ -1,732 +0,0 @@
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 DELETED
@@ -1,10 +0,0 @@
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 DELETED
@@ -1,397 +0,0 @@
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 DELETED
@@ -1,11 +0,0 @@
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 DELETED
@@ -1,406 +0,0 @@
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 DELETED
@@ -1,38 +0,0 @@
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 DELETED
@@ -1,11 +0,0 @@
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 DELETED
@@ -1,71 +0,0 @@
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/Api/Strategy/Error.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Strategy/Error.php
9
+ */
10
+
11
+
12
+ /**
13
+ * OO style error recover strategy
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ interface Bronto_Api_Strategy_Error
18
+ {
19
+ /**
20
+ * Gets called whenever the Bronto_Api client encounters an
21
+ * Bronto_Api_Exception. This recover returns whether or not it
22
+ * can recover by attempting the same request.
23
+ *
24
+ * @param Bronto_Api_Exception $e
25
+ * @param Bronto_Api $api
26
+ * @param Bronto_Object $request
27
+ * @return boolean
28
+ */
29
+ public function recover(Bronto_Api_Exception $e, Bronto_Api $api, Bronto_Object $request);
30
+ }
lib/Bronto/Api/Strategy/Standard.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Strategy/Standard.php
9
+ */
10
+
11
+
12
+ /**
13
+ * The standard error recover strategy shipped with the library
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Strategy_Standard implements Bronto_Api_Strategy_Error
18
+ {
19
+ /**
20
+ * @see parent
21
+ * @param Bronto_Api_Exception $exception
22
+ * @param Bronto_Api $api
23
+ * @param Bronto_Object $request
24
+ * @return boolean
25
+ */
26
+ public function recover(Bronto_Api_Exception $exception, Bronto_Api $api, Bronto_Object $request)
27
+ {
28
+ $canRetry = $exception->getAttempts() < $api->getOptions()->getRetries();
29
+ if ($exception->isRecoverable() && $canRetry) {
30
+ if ($exception->isInvalidSession()) {
31
+ $api->login();
32
+ return true;
33
+ } else {
34
+ if ($exception->isNetworkRelated() && !$request->hasUpdates()) {
35
+ // Incrementally backoff the read request
36
+ $backOff = $api->getOptions()->getBackOff() * $exception->getAttempts();
37
+ sleep($backOff);
38
+ return true;
39
+ }
40
+ }
41
+ }
42
+ return false;
43
+ }
44
+ }
lib/Bronto/Api/Write.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Write.php
9
+ */
10
+
11
+
12
+ /**
13
+ * The implementing write request builder. The actual request
14
+ * will come in the form of the aggregated iterator.
15
+ *
16
+ * @author Philip Cali <philip.cali@bronto.com>
17
+ */
18
+ class Bronto_Api_Write extends Bronto_Object implements Bronto_Api_Request, IteratorAggregate
19
+ {
20
+ protected $_method;
21
+ protected $_operation;
22
+ protected $_limit;
23
+ protected $_flusher;
24
+ protected $_acceptablePrefixes;
25
+ protected $_resolvedKey;
26
+
27
+ /**
28
+ * @param Bronto_Api_Operation $operation
29
+ * @param string $method
30
+ * @param int $limit
31
+ * @param string $dynamicMethod
32
+ * @param string $resolvedKey
33
+ */
34
+ public function __construct(Bronto_Api_Operation $operation, $method, $limit, $dynamicMethod, $resolvedKey)
35
+ {
36
+ parent::__construct();
37
+ $this->_operation = $operation;
38
+ $this->_method = $method;
39
+ $this->_limit = $limit;
40
+ $this->_resolvedKey = $resolvedKey;
41
+
42
+ if ($method == $dynamicMethod) {
43
+ $this->_acceptablePrefixes = array($method);
44
+ } else {
45
+ $this->_acceptablePrefixes = array(
46
+ $dynamicMethod,
47
+ $dynamicMethod . $this->_operation->getTransferType(),
48
+ $dynamicMethod . $this->_operation->getPluralizedType());
49
+ if ($dynamicMethod == 'addOrUpdate') {
50
+ foreach (array('add', 'update') as $write) {
51
+ $this->_acceptablePrefixes[] = $write;
52
+ $this->_acceptablePrefixes[] = $write . $this->_operation->getTransferType();
53
+ $this->_acceptablePrefixes[] = $write . $this->_operation->getPluralizedType();
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @see parent
61
+ * @return string
62
+ */
63
+ public function getMethod()
64
+ {
65
+ return $this->_method;
66
+ }
67
+
68
+ /**
69
+ * @see parent
70
+ * @return boolean
71
+ */
72
+ public function hasUpdates()
73
+ {
74
+ return true;
75
+ }
76
+
77
+ /**
78
+ * @see parent
79
+ * @return array
80
+ */
81
+ public function getData()
82
+ {
83
+ return $this->toArray();
84
+ }
85
+
86
+ /**
87
+ * The write key used in the SOAP function.
88
+ *
89
+ * @return string
90
+ */
91
+ public function getKey()
92
+ {
93
+ return $this->_resolvedKey;
94
+ }
95
+
96
+ /**
97
+ * Set a callback on the write request that will
98
+ * flush the results when the limit has been reached
99
+ *
100
+ * @param Bronto_Api_Write_Flusher|callable $callback
101
+ * @return Bronto_Api_Write
102
+ */
103
+ public function withFlusher($callback = null)
104
+ {
105
+ $this->_flusher = $callback ?: array($this, '_autoFlusher');
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * The default flusher that simply checks for errors and throws
111
+ *
112
+ * @param Bronto_Api_Write_Pager $iterator
113
+ * @return void
114
+ */
115
+ protected function _autoFlusher($iterator)
116
+ {
117
+ foreach ($iterator as $entry) {
118
+ $result = $entry->getItem();
119
+ if ($result->getIsError()) {
120
+ throw new Bronto_Api_Exception($result->getErrorString(), $result->getErrorCode());
121
+ }
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Convenience that unwraps any Bronto_Object for the transfer
127
+ *
128
+ * @param mixed $object
129
+ * @return mixed
130
+ */
131
+ protected function _unwrapObject($object)
132
+ {
133
+ if (is_array($object)) {
134
+ $object = array_map(array($this, '_unwrapObject'), $object);
135
+ }
136
+ if ($object instanceof Bronto_Object) {
137
+ return $object->toArray();
138
+ }
139
+ return $object;
140
+ }
141
+
142
+ /**
143
+ * @see parent
144
+ * @return Bronto_Api_Write
145
+ */
146
+ protected function _set($camelized, $value)
147
+ {
148
+ return parent::_set($camelized, $this->_unwrapObject($value));
149
+ }
150
+
151
+ /**
152
+ * Pushing write objects
153
+ *
154
+ * @param mixed $arguments
155
+ * @return Bronto_Api_Write
156
+ */
157
+ public function push($arguments = array())
158
+ {
159
+ if (!is_array($arguments)) {
160
+ $arguments = array($arguments);
161
+ }
162
+ $camelized = $this->_resolvedKey;
163
+ if (!array_key_exists($camelized, $this->_data)) {
164
+ $this->_data[$camelized] = array();
165
+ }
166
+ if (count($this->_data[$camelized]) >= $this->_limit) {
167
+ if ($this->flush()) {
168
+ $this->_data[$camelized] = array();
169
+ } else {
170
+ throw new Bronto_Api_Write_Overflow("Cannot add more $camelized to {$this->_operation->getTransferType()}", $arguments);
171
+ }
172
+ }
173
+ $unwrapped = array_map(array($this, '_unwrapObject'), $arguments);
174
+ $this->_data[$camelized] = array_merge($this->_data[$camelized], $unwrapped);
175
+ return $this;
176
+ }
177
+
178
+ /**
179
+ * @see parent
180
+ * @param string $name
181
+ * @param array $arguments
182
+ * @return mixed
183
+ */
184
+ public function __call($name, $arguments)
185
+ {
186
+ if (in_array($name, $this->_acceptablePrefixes)) {
187
+ return $this->push($arguments);
188
+ } else if (preg_match("/^isFullOf{$this->_operation->getPluralizedType()}/", $name)) {
189
+ $camelized = $this->_resolvedKey;
190
+ if (!array_key_exists($camelized, $this->_data)) {
191
+ return false;
192
+ }
193
+ return count($this->_data[$camelized]) >= $this->_limit;
194
+ } else {
195
+ try {
196
+ parent::__call($name, $arguments);
197
+ } catch (BadMethodCallException $bme) {
198
+ throw new BadMethodCallException("For {$this->_method}, supported chains are: " . implode(', ', $this->_acceptablePrefixes), 0, $bme);
199
+ }
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Retrieves the first entry in the aggregated iterator
205
+ *
206
+ * @return Bronto_Object['item' => resultItem, 'original' => array]
207
+ */
208
+ public function first()
209
+ {
210
+ $firstEntry = null;
211
+ foreach ($this as $entry) {
212
+ return $entry;
213
+ }
214
+ return $firstEntry;
215
+ }
216
+
217
+ /**
218
+ * Flushes any writes using the flusher defined. Will otherwise
219
+ * NOT flush anything. Whether or not it used the flusher is returned
220
+ * as a boolean.
221
+ *
222
+ * @return boolean
223
+ */
224
+ public function flush()
225
+ {
226
+ $flushed = false;
227
+ if (is_callable($this->_flusher)) {
228
+ call_user_func($this->_flusher, $this->getIterator());
229
+ $flushed = true;
230
+ } else if ($this->_flusher instanceof Bronto_Api_Write_Flusher) {
231
+ $this->_flusher->onFlush($this->getIterator());
232
+ $flushed = true;
233
+ }
234
+ if ($flushed) {
235
+ unset($this->_data[$this->_resolvedKey]);
236
+ }
237
+ return $flushed;
238
+ }
239
+
240
+ /**
241
+ * Creates the aggregated iterator that performs the write ops.
242
+ *
243
+ * @return Bronto_Api_Write_Pager
244
+ */
245
+ public function getIterator()
246
+ {
247
+ $clonedRequest = new Bronto_Object(array(
248
+ 'transferType' => $this->_operation->getTransferType(),
249
+ 'key' => $this->_resolvedKey,
250
+ 'data' => $this->getData(),
251
+ 'method' => $this->_method,
252
+ 'updates' => true,
253
+ ));
254
+ return $this->_operation->createWritePager($clonedRequest);
255
+ }
256
+ }
lib/Bronto/Api/Write/Flusher.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Write/Flusher.php
9
+ */
10
+
11
+ /**
12
+ * OO style flusher observer
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Api_Write_Flusher
17
+ {
18
+ /**
19
+ * Gets called whenever the write request hit a limit
20
+ * and must now handle the current items to be written.
21
+ *
22
+ * @param Bronto_Api_Write_Pager $iterator
23
+ * @return void
24
+ */
25
+ public function onFlush($iterator);
26
+ }
lib/Bronto/Api/Write/Overflow.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Write/Overflow.php
9
+ */
10
+
11
+ /**
12
+ * A write overflow exception occuring with a write request
13
+ * hits the write limit without an assigned Bronto_Api_Write_Flusher.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Write_Overflow extends OverflowException
18
+ {
19
+ private $_arguments;
20
+
21
+ /**
22
+ * @see parent
23
+ *
24
+ * @param string $message
25
+ * @param array $arguments
26
+ */
27
+ public function __construct($message, $arguments)
28
+ {
29
+ parent::__construct($message, 0, null);
30
+ $this->_arguments = $arguments;
31
+ }
32
+
33
+ /**
34
+ * Gets the arguments that were going to be set be the write.
35
+ *
36
+ * @return array
37
+ */
38
+ public function getArguments()
39
+ {
40
+ return $this->_arguments;
41
+ }
42
+ }
lib/Bronto/Api/Write/Pager.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Api/Write/Pager.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Iterator housing the writeResult from the APIv4.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Api_Write_Pager implements Iterator
18
+ {
19
+ private $_operation;
20
+ private $_request;
21
+ private $_result;
22
+ private $_data;
23
+ private $_errorsOnly = false;
24
+ private $_iter;
25
+
26
+ /**
27
+ * @param Bronto_Api_Operation $operation
28
+ * @param Bronto_Object $request
29
+ */
30
+ public function __construct(Bronto_Api_Operation $operation, Bronto_Object $request)
31
+ {
32
+ $this->_operation = $operation;
33
+ $this->_request = $request;
34
+ }
35
+
36
+ /**
37
+ * Init method that sets the internal writeResult
38
+ *
39
+ * @return void
40
+ */
41
+ protected function _init()
42
+ {
43
+ if (is_null($this->_result)) {
44
+ $data = $this->_request->getData();
45
+ if (array_key_exists($this->_request->getKey(), $data)) {
46
+ $this->_data = $data[$this->_request->getKey()];
47
+ }
48
+ if (empty($this->_data)) {
49
+ throw new InvalidArgumentException("No {$this->_request->getKey()} set in this request to transfer{$this->_operation->getTransferType()}.");
50
+ }
51
+ $this->_result = $this->_operation->getApi()->execute($this->_request);
52
+ $resultSize = count($this->_result->return->results);
53
+ if ($this->_errorsOnly) {
54
+ $this->_iter = new ArrayIterator($this->_result->return->errors);
55
+ } else {
56
+ $this->_iter = new ArrayIterator($this->_result->return->results);
57
+ }
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Gets the API operation used to make this request
63
+ *
64
+ * @return Bronto_Api_Operation
65
+ */
66
+ public function getOperation()
67
+ {
68
+ return $this->_operation;
69
+ }
70
+
71
+ /**
72
+ * Gets the original write request
73
+ *
74
+ * @return Bronto_Object
75
+ */
76
+ public function getRequest()
77
+ {
78
+ return $this->_request;
79
+ }
80
+
81
+ /**
82
+ * Gets the raw API writeResult
83
+ *
84
+ * @return stdClass
85
+ */
86
+ public function getResult()
87
+ {
88
+ if (is_null($this->_result)) {
89
+ $this->_init;
90
+ }
91
+ return $this->_result;
92
+ }
93
+
94
+ /**
95
+ * Iterates only on errors.
96
+ *
97
+ * @return Pager
98
+ */
99
+ public function errorsOnly()
100
+ {
101
+ $this->_errorsOnly = true;
102
+ return $this;
103
+ }
104
+
105
+ /**
106
+ * Iterates on all result items
107
+ *
108
+ * @return Pager
109
+ */
110
+ public function allResults()
111
+ {
112
+ $this->_errorsOnly = false;
113
+ return $this;
114
+ }
115
+
116
+ /**
117
+ * @see parent
118
+ */
119
+ public function rewind()
120
+ {
121
+ $this->_init();
122
+ $this->_iter->rewind();
123
+ }
124
+
125
+ /**
126
+ * @see parent
127
+ */
128
+ public function next()
129
+ {
130
+ $this->_iter->next();
131
+ }
132
+
133
+ /**
134
+ * @see parent
135
+ * @return boolean
136
+ */
137
+ public function valid()
138
+ {
139
+ return $this->_iter->valid();
140
+ }
141
+
142
+ /**
143
+ * @see parent
144
+ * @return scalar
145
+ */
146
+ public function key()
147
+ {
148
+ return $this->_errorsOnly ? $this->_iter->current() : $this->_iter->key();
149
+ }
150
+
151
+ /**
152
+ * @see parent
153
+ * @return mixed
154
+ */
155
+ public function current()
156
+ {
157
+ $item = (array) $this->_result->return->results[$this->key()];
158
+ $original = !isset($this->_data[$this->key()]) ? array() : $this->_data[$this->key()];
159
+ return new Bronto_Object(array(
160
+ 'item' => new Bronto_Object($item),
161
+ 'original' => $this->_operation->createObject($original)
162
+ ));
163
+ }
164
+ }
lib/Bronto/Functional/Monadic.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Functional/Monadic.php
9
+ */
10
+
11
+ /**
12
+ * Simple monadic interface that provides filtering,
13
+ * transform, and iterative capabilities
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ interface Bronto_Functional_Monadic
18
+ {
19
+ /**
20
+ * If the contained type is wrapping something, invoke the function
21
+ *
22
+ * @param callable $function
23
+ * @return Monadic
24
+ */
25
+ public function each(callable $function);
26
+
27
+ /**
28
+ * Run a filter function on the contained type, to produce another
29
+ * contained Monadic type
30
+ *
31
+ * @param callable $function
32
+ * @return Monadic
33
+ */
34
+ public function filter(callable $function);
35
+
36
+ /**
37
+ * Run a transform on the contained type, to produce another
38
+ * contained Monadic type
39
+ *
40
+ * @param callable $function
41
+ * @return Monadic
42
+ */
43
+ public function map(callable $function);
44
+ }
lib/Bronto/Functional/None.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Functional/None.php
9
+ */
10
+
11
+ /**
12
+ * The Bronto_Functional_None type represents a "Nothing" container
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Functional_None extends Bronto_Functional_Option
17
+ {
18
+ /**
19
+ * @return boolean
20
+ */
21
+ public function isDefined()
22
+ {
23
+ return false;
24
+ }
25
+
26
+ /**
27
+ * @throws BadMethodCallException
28
+ */
29
+ public function get()
30
+ {
31
+ throw new BadMethodCallException('None->get() cannot not be invoked.');
32
+ }
33
+ }
lib/Bronto/Functional/Option.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Functional/Option.php
9
+ */
10
+
11
+ /**
12
+ * Container type that implements Bronto_Functional_Monadic operations
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ abstract class Bronto_Functional_Option implements Bronto_Functional_Monadic
17
+ {
18
+ /**
19
+ * Whether or not the container contains a value
20
+ *
21
+ * @return boolean
22
+ */
23
+ public abstract function isDefined();
24
+
25
+ /**
26
+ * Retrieves the contained value
27
+ *
28
+ * @return mixed
29
+ */
30
+ public abstract function get();
31
+
32
+ /**
33
+ * Whether or not the container is empty
34
+ *
35
+ * @return boolean
36
+ */
37
+ public function isEmpty()
38
+ {
39
+ return !$this->isDefined();
40
+ }
41
+
42
+ /**
43
+ * @see parent
44
+ * @param callable $function
45
+ * @return Bronto_Functional_Monadic
46
+ */
47
+ public function each(callable $function)
48
+ {
49
+ if ($this->isDefined()) {
50
+ $function($this->get());
51
+ }
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ * @see parent
57
+ * @param callable $function
58
+ * @return Bronto_Functional_Monadic
59
+ */
60
+ public function filter(callable $function)
61
+ {
62
+ if ($this->isDefined() && $function($this->get())) {
63
+ return $this;
64
+ }
65
+ return new Bronto_Functional_None();
66
+ }
67
+
68
+ /**
69
+ * @see parent
70
+ * @param callable $function
71
+ * @return Bronto_Functional_Monadic
72
+ */
73
+ public function map(callable $function)
74
+ {
75
+ if ($this->isDefined()) {
76
+ return new Bronto_Functional_Some($function($this->get()));
77
+ }
78
+ return $this;
79
+ }
80
+
81
+ /**
82
+ * Gets the contained value or a defined default
83
+ *
84
+ * @param mixed $default
85
+ * @return mixed
86
+ */
87
+ public function getOrElse($default)
88
+ {
89
+ if ($this->isDefined()) {
90
+ return $this->get();
91
+ }
92
+ return $default;
93
+ }
94
+
95
+ /**
96
+ * Convert this potentially empty container into a full container
97
+ *
98
+ * @param callable $function
99
+ * @return Bronto_Functional_Some
100
+ */
101
+ public function orElse(callable $function)
102
+ {
103
+ if ($this->isEmpty()) {
104
+ return new Bronto_Functional_Some($function());
105
+ }
106
+ return $this;
107
+ }
108
+ }
lib/Bronto/Functional/Some.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Functional/Some.php
9
+ */
10
+
11
+ /**
12
+ * The Bronto_Functional_Some type contains some kind of value
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Functional_Some extends Bronto_Functional_Option
17
+ {
18
+ private $_id;
19
+
20
+ /**
21
+ * Create the some with a contained value
22
+ *
23
+ * @param mixed $identity
24
+ */
25
+ public function __construct($identity)
26
+ {
27
+ $this->_id = $identity;
28
+ }
29
+
30
+ /**
31
+ * @return boolean
32
+ */
33
+ public function isDefined()
34
+ {
35
+ return true;
36
+ }
37
+
38
+ /**
39
+ * @return mixed
40
+ */
41
+ public function get()
42
+ {
43
+ return $this->_id;
44
+ }
45
+ }
lib/Bronto/Functional/functions.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Functional/functions.php
9
+ */
10
+
11
+ /**
12
+ * Package level convenience for creating the some option
13
+ *
14
+ * @param mixed $value
15
+ * @retun Bronto_Functional_Some
16
+ */
17
+ function some($value)
18
+ {
19
+ return new Bronto_Functional_Some($value);
20
+ }
21
+
22
+ /**
23
+ * Package level convenience for creating the none type
24
+ *
25
+ * @return Bronto_Functional_None
26
+ */
27
+ function none()
28
+ {
29
+ return new Bronto_Functional_None();
30
+ }
lib/Bronto/ImportManager.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bronto_ImportManager
4
+ {
5
+ public static $_fileCache = array();
6
+ }
lib/Bronto/Object.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Object.php
9
+ */
10
+
11
+ /**
12
+ * Upgraded data container with chainable setters menthods
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Object
17
+ {
18
+ protected $_data;
19
+ protected $_underscore;
20
+
21
+ /**
22
+ * Wrap an array holding the concrete data
23
+ *
24
+ * @param array $data
25
+ */
26
+ public function __construct(array $data = array(), $underscore = false)
27
+ {
28
+ $this->_data = $data;
29
+ $this->_underscore = $underscore;
30
+ }
31
+
32
+ /**
33
+ * A host of magic methods for dealing with internal data:
34
+ *
35
+ * @param string $name
36
+ * - getSomething(): $this->_data['something']
37
+ * - safeSomething(): Option version of the previous
38
+ * - unsetSomething(): unset($this->_data['something'])
39
+ * - hasSomething(): isset($this->_data['something'])
40
+ * - setSomething($value): $this->_data['something'] = $value
41
+ * - withSomething($value): ''
42
+ * - incrementSomething(): Will add 1 or more values to 'something'
43
+ * - decrementSomething(): Will decrement 1 or more values to 'something'
44
+ * @param array $args
45
+ * @return mixed
46
+ */
47
+ public function __call($name, $args)
48
+ {
49
+ list($prefix, $camelized) = $this->_camelizedValue($name);
50
+ switch ($prefix) {
51
+ case 'get':
52
+ $option = $this->_safe($camelized);
53
+ if (!$option->isEmpty()) {
54
+ return $option->get();
55
+ }
56
+ $this->_throwException("BadMethodCallException", "Could not find a value for $name in %s");
57
+ break;
58
+ case 'safe':
59
+ return $this->_safe($camelized);
60
+ case 'unset':
61
+ unset($this->_data[$camelized]);
62
+ break;
63
+ case 'has':
64
+ return array_key_exists($camelized, $this->_data);
65
+ case 'set':
66
+ case 'with':
67
+ $this->_set($camelized, $args[0]);
68
+ break;
69
+ case 'increment':
70
+ case 'decrement':
71
+ $amount = isset($args[0]) ? $args[0] : 1;
72
+ $amount *= ($prefix == 'decrement' ? -1 : 1);
73
+ $original = $this->_safe($camelized)->getOrElse(0);
74
+ $this->_set($camelized, $original + $amount);
75
+ break;
76
+ default:
77
+ return $this->_defaultMethod($prefix, $camelized, $args);
78
+ }
79
+ return $this;
80
+ }
81
+
82
+ /**
83
+ * Safely retrieves the data for the camelized key
84
+ *
85
+ * @param string $camelized
86
+ * @return Bronto_Functional_Option
87
+ */
88
+ protected function _safe($camelized)
89
+ {
90
+ if (array_key_exists($camelized, $this->_data)) {
91
+ return new Bronto_Functional_Some($this->_data[$camelized]);
92
+ }
93
+ return new Bronto_Functional_None();
94
+ }
95
+
96
+ /**
97
+ * Gets the value associated with the data array
98
+ *
99
+ * @param string $name
100
+ * @return mixed
101
+ */
102
+ public function __get($name)
103
+ {
104
+ if (!array_key_exists($name, $this->_data)) {
105
+ return null;
106
+ }
107
+ return $this->_data[$name];
108
+ }
109
+
110
+ /**
111
+ * Sets the value associated on the data array
112
+ *
113
+ * @param string $name
114
+ * @param mixed $value
115
+ */
116
+ public function __set($name, $value)
117
+ {
118
+ $this->_data[$name] = $value;
119
+ }
120
+
121
+ /**
122
+ * Allows the complete replacement of underlying data
123
+ *
124
+ * @param array $data
125
+ * @return Object
126
+ */
127
+ public function replace(array $data = array())
128
+ {
129
+ $this->_data = $data;
130
+ return $this;
131
+ }
132
+
133
+ /**
134
+ * Checks if the underlying data is empty
135
+ *
136
+ * @return boolean
137
+ */
138
+ public function isEmpty()
139
+ {
140
+ return empty($this->_data);
141
+ }
142
+
143
+ /**
144
+ * Converts this object to an array
145
+ * Note: Simply returns the underlying hash table
146
+ *
147
+ * @return array
148
+ */
149
+ public function toArray()
150
+ {
151
+ return $this->_data;
152
+ }
153
+
154
+ /**
155
+ * Converts this object to a JSON string
156
+ * Note: Simply calls json_encode on the hash table
157
+ *
158
+ * @return array
159
+ */
160
+ public function toJSON()
161
+ {
162
+ return json_encode($this->_data);
163
+ }
164
+
165
+ /**
166
+ * Generic exception thrower
167
+ *
168
+ * @param string $exception
169
+ * @param string $msg
170
+ * @throws mixed
171
+ */
172
+ private function _throwException($exception, $msg)
173
+ {
174
+ $className = get_class($this);
175
+ throw new $exception(sprintf($msg, $className));
176
+ }
177
+
178
+ /**
179
+ * Internal chainable setter
180
+ *
181
+ * @param string $camelized
182
+ * @param mixed $value
183
+ * @return Object
184
+ */
185
+ protected function _set($camelized, $value)
186
+ {
187
+ $this->_data[$camelized] = $value;
188
+ return $this;
189
+ }
190
+
191
+ /**
192
+ * The fallback to be used with __call could not resolve.
193
+ *
194
+ * @param string $prefix
195
+ * @param string $camelized
196
+ * @param array $arguments
197
+ * @throws BadMethodCallException
198
+ */
199
+ protected function _defaultMethod($prefix, $camelized, $arguments)
200
+ {
201
+ $this->_throwException("BadMethodCallException", "Unsupport method $prefix $camelized in %s");
202
+ }
203
+
204
+ /**
205
+ * Returns a tuple of a prefixed camel-case name, ie:
206
+ * $this->_camelizedValue('addSomething') == array('add', 'something')
207
+ *
208
+ * @param string $name
209
+ * @return array($prefixed, $camelized)
210
+ */
211
+ protected function _camelizedValue($name)
212
+ {
213
+ if (preg_match('/^([^A-Z0-9]+).+/', $name, $match)) {
214
+ $modified = $this->_stripAndLower($name, strlen($match[1]));
215
+ return array($match[1], $this->_underscore ? Bronto_Utils::underscore($modified) : $modified);
216
+ }
217
+ return array("", "");
218
+ }
219
+
220
+ /**
221
+ * Strips any prefix length, and lower cases the name.
222
+ *
223
+ * @param string $name
224
+ * @param int $length
225
+ * @return string
226
+ */
227
+ protected function _stripAndLower($name, $length)
228
+ {
229
+ $value = substr($name, $length);
230
+ $value[0] = strtolower($value[0]);
231
+ return $value;
232
+ }
233
+
234
+ /**
235
+ * Bronto_Serialized Object's should always be able to deserialize
236
+ *
237
+ * @return array
238
+ */
239
+ public function __sleep()
240
+ {
241
+ return array('_data');
242
+ }
243
+ }
lib/Bronto/Observer.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * @author Philip Cali <philip.cali@bronto.com>
5
- * @copyright 2011-2014 Bronto Software, Inc.
6
- * @license http://opensource.org/licenses/OSL-3.0 Open Software License v. 3.0 (OSL-3.0)
7
- */
8
- interface Bronto_Observer
9
- {
10
- /**
11
- * Observe when the Bronto_Api is about to perform the login
12
- *
13
- * @param Bronto_Api $api
14
- * @return void
15
- */
16
- public function onBeforeLogin($api);
17
-
18
- /**
19
- * Observe when the Bronto_Api client makes a login call
20
- *
21
- * @param Bronto_Api $api
22
- * @param string $sessionId
23
- * @return void
24
- */
25
- public function onAfterLogin($api, $sessionId);
26
-
27
- /**
28
- * Observe when the Bronto_Api client throws an exception
29
- *
30
- * @param Bronto_Api $api
31
- * @param string $sessionId
32
- * @return void
33
- */
34
- public function onError($api, $exception);
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Bronto/Resource/Proxy.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Resource/Proxy.php
9
+ */
10
+
11
+
12
+ /**
13
+ * A resource proxy is to "classify" certain PHP functions
14
+ * to make them both Object Oriented and testable.
15
+ *
16
+ * @author Philip Cali <philip.cali@bronto.com>
17
+ */
18
+ class Bronto_Resource_Proxy
19
+ {
20
+ protected $_resource;
21
+ protected $_prefix;
22
+ protected $_excluded;
23
+
24
+ /**
25
+ * Construct the resource proxy with a prefix
26
+ *
27
+ * @param string $prefix
28
+ * @param resource $resource
29
+ */
30
+ public function __construct($prefix, $excluded = array(), $resource = null)
31
+ {
32
+ $this->_prefix = $prefix;
33
+ $this->_excluded = $excluded;
34
+ $this->_resource = $resource;
35
+ }
36
+
37
+ /**
38
+ * Gets the underlying PHP resource
39
+ *
40
+ * @return resource
41
+ */
42
+ public function getResource()
43
+ {
44
+ return $this->_resource;
45
+ }
46
+
47
+ /**
48
+ * Sets the exclusion name
49
+ *
50
+ * @param string $name
51
+ * @return self
52
+ */
53
+ public function addExcluded($name)
54
+ {
55
+ $this->_excluded[$name] = true;
56
+ return $this;
57
+ }
58
+
59
+ /**
60
+ * Get the underlying PHP function prefix
61
+ *
62
+ * @return string
63
+ */
64
+ public function getPrefix()
65
+ {
66
+ return $this->_prefix;
67
+ }
68
+
69
+ public function byRef($name, &$value)
70
+ {
71
+ $function = $this->_prefix . Bronto_Utils::underscore($name);
72
+ $return = call_user_func_array($function, array($this->_resource, &$value));
73
+ return $return;
74
+ }
75
+
76
+ /**
77
+ * Proxy PHP functions
78
+ *
79
+ * @param string $name
80
+ * @param array $args
81
+ * @return mixed
82
+ */
83
+ public function __call($name, $args)
84
+ {
85
+ $function = $this->_prefix . Bronto_Utils::underscore($name);
86
+ if (!function_exists($function)) {
87
+ throw new BadMethodCallException("Resource function {$function} does not exist.");
88
+ }
89
+ if (!array_key_exists($name, $this->_excluded) && !is_null($this->_resource)) {
90
+ array_unshift($args, $this->_resource);
91
+ }
92
+ $return = call_user_func_array($function, $args);
93
+ if ($name == 'close') {
94
+ unset($this->_resource);
95
+ $this->_resource = null;
96
+ return $this;
97
+ }
98
+ if (is_resource($return)) {
99
+ $this->_resource = $return;
100
+ return $this;
101
+ }
102
+ return $return;
103
+ }
104
+
105
+ /**
106
+ * Set a cleanup to close the attached resource
107
+ *
108
+ * @see parent
109
+ */
110
+ public function __destruct()
111
+ {
112
+ if (!is_null($this->_resource)) {
113
+ $this->close();
114
+ }
115
+ }
116
+ }
lib/Bronto/Serialize/BiDirectional.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Serialize/BiDirectional.php
9
+ */
10
+
11
+ /**
12
+ * Interface that represents a complete bi-directional
13
+ * serailizer with associated MIME type.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ interface Bronto_Serialize_BiDirectional extends Bronto_Serialize_Encode, Bronto_Serialize_Decode
18
+ {
19
+ /**
20
+ * Gets the MIME type for this bi-directional serializer
21
+ *
22
+ * @return string
23
+ */
24
+ public function getMimeType();
25
+ }
lib/Bronto/Serialize/Decode.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Serialize/Decode.php
9
+ */
10
+
11
+ /**
12
+ * Interface that defines a decoder
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Serialize_Decode
17
+ {
18
+ /**
19
+ * Decodes a string into an associative state
20
+ *
21
+ * @param string $input
22
+ * @return mixed
23
+ */
24
+ public function decode($input);
25
+ }
lib/Bronto/Serialize/Encode.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Serialize/Encode.php
9
+ */
10
+
11
+ /**
12
+ * Interface that defines an encoder
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Serialize_Encode
17
+ {
18
+ /**
19
+ * Encodes some value into a string state
20
+ *
21
+ * @param mixed $thing
22
+ * @return string
23
+ */
24
+ public function encode($thing);
25
+ }
lib/Bronto/Serialize/Exception.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Serialize/Exception.php
9
+ */
10
+
11
+ /**
12
+ * An exception representative of a serialization problem
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Serialize_Exception extends RuntimeException
17
+ {
18
+ protected $_thing;
19
+ protected $_input;
20
+ protected $_encoding;
21
+
22
+ /**
23
+ * @param string $errorMessage
24
+ * @param int $errorNo
25
+ * @param mixed|string $thingOrInput
26
+ * @param boolean $encoding
27
+ */
28
+ public function __construct($errorMessage, $errorNo, $thingOrInput, $encoding)
29
+ {
30
+ parent::__construct($errorMessage, $errorNo);
31
+ $this->_encoding = $encoding;
32
+ if ($encoding) {
33
+ $this->_thing = $thingOrInput;
34
+ } else {
35
+ $this->_input = $thingOrInput;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Did the exception occured while encoding an object
41
+ *
42
+ * @return boolean
43
+ */
44
+ public function isEncoding()
45
+ {
46
+ return $this->_encoding;
47
+ }
48
+
49
+ /**
50
+ * Retrieves the object to be encoded
51
+ *
52
+ * @return mixed
53
+ */
54
+ public function getThing()
55
+ {
56
+ return $this->_thing;
57
+ }
58
+
59
+ /**
60
+ * Retrieves the input to be decoded
61
+ *
62
+ * @return string
63
+ */
64
+ public function getInput()
65
+ {
66
+ return $this->_input;
67
+ }
68
+ }
lib/Bronto/Serialize/Json/Standard.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Serialize/Json/Standard.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Bronto_Serialize_Json_Standard PCL bidirectional serializer
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Serialize_Json_Standard implements Bronto_Serialize_BiDirectional
18
+ {
19
+ private static $_enumToMsg = array(
20
+ JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
21
+ JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
22
+ JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
23
+ JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
24
+ JSON_ERROR_UTF8 => 'Malformed UTF-8 characters',
25
+ );
26
+
27
+ /**
28
+ * Reads the last json error for parsing or encoding and throws
29
+ * an exception containing the input.
30
+ *
31
+ * @param mixed $thingOrInput
32
+ * @param boolean $encoding
33
+ * @throws Bronto_Serialize_Exception
34
+ */
35
+ protected function _catchAndThrowError($thingOrInput, $encoding)
36
+ {
37
+ $erroNo = json_last_error();
38
+ if ($erroNo) {
39
+ $error = 'Unknown error';
40
+ if (array_key_exists($erroNo, self::$_enumToMsg)) {
41
+ $error = self::$_enumToMsg[$erroNo];
42
+ throw new Bronto_Serialize_Exception($error, $erroNo, $thingOrInput, $encoding);
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * @see parent
49
+ */
50
+ public function getMimeType()
51
+ {
52
+ return 'application/json';
53
+ }
54
+
55
+ /**
56
+ * @see parent
57
+ */
58
+ public function encode($thing)
59
+ {
60
+ $return = json_encode($thing);
61
+ $this->_catchAndThrowError($thing, true);
62
+ return $return;
63
+ }
64
+
65
+ /**
66
+ * @see parent
67
+ */
68
+ public function decode($input)
69
+ {
70
+ $return = json_decode($input, true);
71
+ $this->_catchAndThrowError($input, false);
72
+ return $return;
73
+ }
74
+ }
lib/Bronto/SoapClient.php DELETED
@@ -1,26 +0,0 @@
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
- $parts = explode(' ', constant('PCRE_VERSION'));
20
- $version = reset($parts);
21
- if (version_compare($version, '8.30', '<')) {
22
- $result = preg_replace('/[\x{0}-\x{8}\x{B}-\x{C}\x{E}-\x{1F}\x{D800}-\x{DFFF}]/u', '', $result);
23
- }
24
- return $result;
25
- }
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Bronto/Transfer/Adapter.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Adapter.php
9
+ */
10
+
11
+ /**
12
+ * Adapater factory to generate new transfer requests
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Transfer_Adapter
17
+ {
18
+ /**
19
+ * Initialize a request with a method and uri
20
+ *
21
+ * @param string $method
22
+ * @param string $uri
23
+ * @return Bronto_Transfer_Request
24
+ */
25
+ public function createRequest($method, $uri);
26
+ }
lib/Bronto/Transfer/Curl/Adapter.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Curl/Adapter.php
9
+ */
10
+
11
+ /**
12
+ * Implemented transfer adapter that handles cURL requests
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Transfer_Curl_Adapter implements Bronto_Transfer_Adapter
17
+ {
18
+ protected $_options;
19
+
20
+ /**
21
+ * Set any additional cURL parameters in the option collection
22
+ *
23
+ * @param mixed $options
24
+ */
25
+ public function __construct($options = array())
26
+ {
27
+ if (is_array($options)) {
28
+ $this->_options = new Bronto_Object($options);
29
+ } else {
30
+ $this->_options = $options;
31
+ }
32
+ }
33
+
34
+ /**
35
+ * @see parent
36
+ */
37
+ public function createRequest($method, $uri)
38
+ {
39
+ return new Bronto_Transfer_Curl_Request($method, $uri, $this->_options);
40
+ }
41
+ }
lib/Bronto/Transfer/Curl/Multi.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Curl/Multi.php
9
+ */
10
+
11
+ /**
12
+ * Simple wrapper class around curl_multi
13
+ *
14
+ * @author philip Cali <philip.cali@bronto.com>
15
+ */
16
+ class Bronto_Transfer_Curl_Multi
17
+ {
18
+ protected $_multi;
19
+ protected $_requests;
20
+ protected $_threshold = 10;
21
+ protected $_executeEagerly = true;
22
+ protected $_error;
23
+
24
+ /**
25
+ * Create a multi wrapper, optionally with a proxy object
26
+ *
27
+ * @param mixed $multi
28
+ */
29
+ public function __construct($multi = null)
30
+ {
31
+ $this->_multi = $multi ?: new Bronto_Resource_Proxy('curl_multi_');
32
+ $this->_multi->addExcluded('getcontent');
33
+ $this->_multi->init();
34
+ }
35
+
36
+ /**
37
+ * Set the max number of concurrent connections
38
+ * Note: This also sets the reaper threshold
39
+ *
40
+ * @param int $cons
41
+ * @return self
42
+ */
43
+ public function setMaxConnections($cons)
44
+ {
45
+ if (function_exists('curl_multi_setopt')) {
46
+ $this->_multi->setopt(CURLMOPT_MAXCONNECTS, $cons);
47
+ }
48
+ $this->_threshold = $cons;
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * Designate connection pool pipe-lining
54
+ *
55
+ * @param boolean
56
+ * @return self
57
+ */
58
+ public function setPipeLining($pipeLining)
59
+ {
60
+ $this->_multi->setopt(CURLMOPT_PIPELINING, $pipeLining);
61
+ return $this;
62
+ }
63
+
64
+ /**
65
+ * Flag to execute eagerly or not
66
+ *
67
+ * @param boolean $boolean
68
+ * @return self
69
+ */
70
+ public function setExecuteEagerly($boolean)
71
+ {
72
+ $this->_executeEagerly = $boolean;
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Add a request to the multi handle
78
+ *
79
+ * @param Bronto_Transfer_Curl_Request $request
80
+ * @return self
81
+ */
82
+ public function add(Bronto_Transfer_Curl_Request $request)
83
+ {
84
+ $handle = $request->prepare()->getHandle();
85
+ $this->_requests[(int)$handle->getResource()] = $request;
86
+ $this->_multi->addHandle($handle->getResource());
87
+ if ($this->_executeEagerly) {
88
+ $running = 0;
89
+ $this->_multi->byRef('exec', $running);
90
+ }
91
+ // Reap enough to clear out the threshold
92
+ if (count($this->_requests) > $this->_threshold) {
93
+ $this->complete($this->_threshold);
94
+ }
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * Remove a request from the multi handle
100
+ *
101
+ * @param Bronto_Transfer_Curl_Request $request
102
+ * @return self
103
+ */
104
+ public function remove(Bronto_Transfer_Curl_Request $request)
105
+ {
106
+ $this->_multi->removeHandle($request->getHandle()->getResource());
107
+ unset($this->_requests[(int)$request->getHandle()->getResource()]);
108
+ return $this;
109
+ }
110
+
111
+ /**
112
+ * Block, scan, and reap a certain number of requests
113
+ *
114
+ * @param $threshold
115
+ */
116
+ public function complete($threshold = 0)
117
+ {
118
+ $running = 0;
119
+ do {
120
+ $this->_multi->byRef('exec', $running);
121
+ } while ($running > $threshold);
122
+ $this->_scanAndReap();
123
+ }
124
+
125
+ /**
126
+ * Typical scap and reaper for threaded cURL requests
127
+ */
128
+ protected function _scanAndReap()
129
+ {
130
+ while ($info = $this->_multi->infoRead()) {
131
+ $handle = $info['handle'];
132
+ $result = $info['result'];
133
+ $request = $this->_requests[(int)$handle];
134
+
135
+ if ($result !== CURLE_OK) {
136
+ $message = $request->getHandle()->error();
137
+ $request->error(new Bronto_Transfer_Exception($message, $result, $request));
138
+ } else {
139
+ $content = $this->_multi->getcontent($handle);
140
+ $info = $request->getHandle()->getinfo();
141
+ $request->complete(new Bronto_Transfer_Curl_Response($content, $info));
142
+ }
143
+ $this->remove($request);
144
+ }
145
+ }
146
+ }
lib/Bronto/Transfer/Curl/Request.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Curl/Request.php
9
+ */
10
+
11
+ /**
12
+ * Simple request builder implementation that builds
13
+ * and completes a cURL request to a server.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Transfer_Curl_Request implements Bronto_Transfer_Request
18
+ {
19
+ private $_method;
20
+ private $_uri;
21
+ private $_options;
22
+ private $_curl;
23
+ private $_body;
24
+ private $_headers = array();
25
+ private $_params = array();
26
+ private $_query = array();
27
+ private $_listeners = array();
28
+
29
+ /**
30
+ * Create a request builder with a method, uri, and options
31
+ *
32
+ * @param string $method
33
+ * @param string $uri
34
+ * @param Bronto_Object $options
35
+ * @param Bronto_Resource_Proxy $curl
36
+ */
37
+ public function __construct($method, $uri, $options, $curl = null)
38
+ {
39
+ $this->_uri = $uri;
40
+ $this->_method = $method;
41
+ $this->_options = new Bronto_Object($options->toArray());
42
+ if (is_null($curl)) {
43
+ $curl = new Bronto_Resource_Proxy("curl_");
44
+ }
45
+ $this->_curl = $curl;
46
+ }
47
+
48
+ /**
49
+ * Add event observers
50
+ *
51
+ * @param string $name
52
+ * @param array $args
53
+ * @return mixed
54
+ */
55
+ public function __call($name, $args)
56
+ {
57
+ $return = array_shift($args);
58
+ if ($name == 'on') {
59
+ $callback = array_shift($args);
60
+ if (!array_key_exists($return, $this->_listeners)) {
61
+ $this->_listeners[$return] = array();
62
+ }
63
+ $this->_listeners[$return][] = $callback;
64
+ return $this;
65
+ } else if (array_key_exists($name, $this->_listeners)) {
66
+ foreach ($this->_listeners[$name] as $callback) {
67
+ $callback($return);
68
+ }
69
+ }
70
+ return $return;
71
+ }
72
+
73
+ /**
74
+ * Gets the cURL Options
75
+ *
76
+ * @return Bronto_Object
77
+ */
78
+ public function getOptions()
79
+ {
80
+ return $this->_options;
81
+ }
82
+
83
+ /**
84
+ * Gets the proxy handle
85
+ *
86
+ * @return Bronto_Resource_Proxy
87
+ */
88
+ public function getHandle()
89
+ {
90
+ return $this->_curl;
91
+ }
92
+
93
+ /**
94
+ * Prepares the underlying cURL request proxy
95
+ *
96
+ * @return self
97
+ */
98
+ public function prepare()
99
+ {
100
+ $this->_curl->init($this->_createUri());
101
+ $this->_prepareCurl();
102
+ $this->_curl->setopt(CURLOPT_RETURNTRANSFER, true);
103
+ $this->_curl->setopt(CURLOPT_HEADER, true);
104
+ if ($this->_method != self::POST) {
105
+ $this->_headers[] = "X-HTTP-Method-Override: {$this->_method}";
106
+ }
107
+ if (!empty($this->_headers)) {
108
+ $this->_curl->setopt(CURLOPT_HTTPHEADER, $this->_headers);
109
+ }
110
+ if (!empty($this->_params) || !empty($this->_body)) {
111
+ $this->_curl->setopt(CURLOPT_POSTFIELDS, empty($this->_body) ? $this->_params : $this->_body);
112
+ }
113
+ return $this;
114
+ }
115
+
116
+ /**
117
+ * @see parent
118
+ */
119
+ public function header($name, $value)
120
+ {
121
+ $this->_headers[] = "$name: $value";
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * @see parent
127
+ */
128
+ public function param($name, $value)
129
+ {
130
+ $this->_params[$name] = $value;
131
+ if (!empty($this->_body)) {
132
+ $this->_body = null;
133
+ }
134
+ return $this;
135
+ }
136
+
137
+ /**
138
+ * @see parent
139
+ */
140
+ public function query($name, $value)
141
+ {
142
+ $this->_query[$name] = $value;
143
+ return $this;
144
+ }
145
+
146
+ /**
147
+ * @see parent
148
+ */
149
+ public function body($data)
150
+ {
151
+ $this->_body = $data;
152
+ if (!empty($this->_params)) {
153
+ $this->_params = array();
154
+ }
155
+ return $this;
156
+ }
157
+
158
+ /**
159
+ * Adds the query parameters URL encoded to the base URI
160
+ *
161
+ * @return string
162
+ */
163
+ protected function _createUri()
164
+ {
165
+ $suffix = '';
166
+ if (!empty($this->_query)) {
167
+ if (strpos($this->_uri, '?') === false) {
168
+ $suffix .= '?';
169
+ } else {
170
+ $suffix .= '&';
171
+ }
172
+ $suffix .= http_build_query($this->_query);
173
+ }
174
+ return $this->_uri . $suffix;
175
+ }
176
+
177
+ /**
178
+ * Prepares the cURL handle with all of the set options
179
+ */
180
+ protected function _prepareCurl()
181
+ {
182
+ $prefix = "CURLOPT_";
183
+ $pattern = '/([a-z0-9])([A-Z])/';
184
+ foreach ($this->_options->toArray() as $curlOpt => $value) {
185
+ // Assume we got a camelcase without a prefix
186
+ if (!preg_match("/^{$prefix}/", $curlOpt)) {
187
+ $words = preg_replace($pattern, "$1_$2", $curlOpt);
188
+ $curlOpt = $prefix . strtoupper($words);
189
+ }
190
+ if (defined($curlOpt)) {
191
+ $this->_curl->setopt(constant($curlOpt), $value);
192
+ }
193
+ }
194
+ }
195
+
196
+ /**
197
+ * Sends the cURL request and reads response
198
+ *
199
+ * @return array(string, array)
200
+ */
201
+ protected function _completeRequest()
202
+ {
203
+ $this->prepare();
204
+ $results = $this->_curl->exec();
205
+ $code = $this->_curl->errno();
206
+ if ($code) {
207
+ $message = $this->_curl->error();
208
+ $this->_curl->close();
209
+ throw $this->error(new Bronto_Transfer_Exception($message, $code, $this));
210
+ }
211
+ $info = $this->_curl->getinfo();
212
+ $this->_curl->close();
213
+ return array($results, $info);
214
+ }
215
+
216
+ /**
217
+ * @see parent
218
+ */
219
+ public function respond()
220
+ {
221
+ list($content, $info) = $this->_completeRequest();
222
+ return $this->complete(new Bronto_Transfer_Curl_Response($content, $info));
223
+ }
224
+ }
lib/Bronto/Transfer/Curl/Response.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Curl/Response.php
9
+ */
10
+
11
+ /**
12
+ * Simple response object implementation that
13
+ * reads results from the cURL response
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Transfer_Curl_Response implements Bronto_Transfer_Response
18
+ {
19
+ private $_results;
20
+ private $_headers;
21
+ private $_info;
22
+
23
+ /**
24
+ * Everything needed to read results
25
+ *
26
+ * @param string $content
27
+ * @param array $info
28
+ */
29
+ public function __construct($content, $info)
30
+ {
31
+ list($results, $headers) = $this->_parseHeaders($content, $info);
32
+ $this->_results = $results;
33
+ $this->_headers = $headers;
34
+ $this->_info = new Bronto_Object($info, true);
35
+ }
36
+
37
+ /**
38
+ * Parse the response headers from the response body
39
+ *
40
+ * @param string $results
41
+ * @param array $info
42
+ * @return array(string, array)
43
+ */
44
+ protected function _parseHeaders($results, $info)
45
+ {
46
+ $headers = substr($results, 0, $info['header_size']);
47
+ $body = substr($results, $info['header_size']);
48
+ $table = array();
49
+ foreach (preg_split('/\r?\n/', $headers) as $header) {
50
+ if (!preg_match('/\:\s*/', $header)) {
51
+ continue;
52
+ }
53
+ list($name, $value) = preg_split("/\\:\\s*/", $header);
54
+ $table[$name] = $value;
55
+ }
56
+ return array(trim($body), $table);
57
+ }
58
+
59
+
60
+ /**
61
+ * @see parent
62
+ */
63
+ public function body()
64
+ {
65
+ return $this->_results;
66
+ }
67
+
68
+ /**
69
+ * @see parent
70
+ */
71
+ public function header($name)
72
+ {
73
+ return $this->_headers[$name];
74
+ }
75
+
76
+ /**
77
+ * @see parent
78
+ */
79
+ public function code()
80
+ {
81
+ return $this->_info->getHttpCode();
82
+ }
83
+
84
+ /**
85
+ * Gets the cURL info for the transfer
86
+ *
87
+ * @return Bronto_Object
88
+ */
89
+ public function info()
90
+ {
91
+ return $this->_info;
92
+ }
93
+ }
lib/Bronto/Transfer/Exception.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Exception.php
9
+ */
10
+
11
+ /**
12
+ * Transfer related exceptions. May or may not
13
+ * contain information about the request
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Transfer_Exception extends RuntimeException
18
+ {
19
+ private $_request;
20
+
21
+ /**
22
+ * @see parent
23
+ */
24
+ public function __construct($message, $code, $request)
25
+ {
26
+ parent::__construct($message, $code);
27
+ $this->_request = $request;
28
+ }
29
+
30
+ /**
31
+ * @return Bronto_Transfer_Request
32
+ */
33
+ public function getRequest()
34
+ {
35
+ return $this->_request;
36
+ }
37
+ }
lib/Bronto/Transfer/Headers.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Headers.php
9
+ */
10
+
11
+ /**
12
+ * Enum for common HTTP headers
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Transfer_Headers
17
+ {
18
+ const ACCEPT = 'Accept';
19
+ const APPLICATION_JSON = 'application/json';
20
+ const APPLICATION_FORM_URLENCODED = 'application/x-www-form-urlencoded';
21
+ const AUTHORIZATION = 'Authorization';
22
+ const CONTENT_TYPE = 'Content-Type';
23
+ }
lib/Bronto/Transfer/Request.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Request.php
9
+ */
10
+
11
+ /**
12
+ * Interface that defines a transferable request entity
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Transfer_Request
17
+ {
18
+ const GET = 'GET';
19
+ const POST = 'POST';
20
+ const PUT = 'PUT';
21
+ const DELETE = 'DELETE';
22
+
23
+ /**
24
+ * Add/set a new transfer header
25
+ *
26
+ * @param string $name
27
+ * @param mixed $value
28
+ * @return Bronto_Transfer_Request
29
+ */
30
+ public function header($name, $value);
31
+
32
+ /**
33
+ * Add/set a new transfer POST param
34
+ *
35
+ * @param string $name
36
+ * @param mixed $value
37
+ * @return Bronto_Transfer_Request
38
+ */
39
+ public function param($name, $value);
40
+
41
+ /**
42
+ * Add/set a new transfer query parameter
43
+ *
44
+ * @param string $name
45
+ * @param mixed $value
46
+ * @return Bronto_Transfer_Request
47
+ */
48
+ public function query($name, $value);
49
+
50
+ /**
51
+ * Some raw data to send
52
+ *
53
+ * @param string $data
54
+ */
55
+ public function body($data);
56
+
57
+ /**
58
+ * Completes the built request and returns a
59
+ * Bronto_Transfer_Response entity to interact with
60
+ *
61
+ * @return Bronto_Transfer_Response
62
+ */
63
+ public function respond();
64
+ }
lib/Bronto/Transfer/Response.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Transfer/Response.php
9
+ */
10
+
11
+ /**
12
+ * Interface that defines a transfered response entity
13
+ *
14
+ * @author Philip Cali <philip.cali@bronto.com>
15
+ */
16
+ interface Bronto_Transfer_Response
17
+ {
18
+ const OK = 200;
19
+ const CREATED = 201;
20
+ const NO_CONTENT = 204;
21
+ const BAD_REQUEST = 400;
22
+ const UNAUTHORIZED = 401;
23
+ const FORBIDDEN = 403;
24
+ const NOT_FOUND = 404;
25
+ const METHOD_NOT_ALLOWED = 405;
26
+ const CONFLICT = 409;
27
+ const INTERNAL_ERROR = 500;
28
+
29
+ /**
30
+ * Gets the response body as a string
31
+ *
32
+ * @return string
33
+ */
34
+ public function body();
35
+
36
+ /**
37
+ * Gets the response header as a string
38
+ *
39
+ * @param string $name
40
+ * @return string
41
+ */
42
+ public function header($name);
43
+
44
+ /**
45
+ * Gets the response code as an integer
46
+ *
47
+ * @return int
48
+ */
49
+ public function code();
50
+ }
lib/Bronto/Util/Colors.php DELETED
@@ -1,196 +0,0 @@
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 DELETED
@@ -1,260 +0,0 @@
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 DELETED
@@ -1,126 +0,0 @@
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 DELETED
@@ -1,9 +0,0 @@
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 DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,78 +0,0 @@
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Bronto/Utils.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/Utils.php
9
+ */
10
+
11
+ /**
12
+ * A simple utility class containing simple string
13
+ * manipulations.
14
+ *
15
+ * @author Philip Cali <philip.cali@bronto.com>
16
+ */
17
+ class Bronto_Utils
18
+ {
19
+ /**
20
+ * Camel case to underscore conversion
21
+ *
22
+ * @param string $name
23
+ * @return string
24
+ */
25
+ public static function underscore($name)
26
+ {
27
+ $pattern = '/([a-z0-9])([A-Z])/';
28
+ $underscores = preg_replace($pattern, "$1_$2", $name);
29
+ return strtolower($underscores);
30
+ }
31
+
32
+ /**
33
+ * Normalize the name to use no punctuation and underscores
34
+ *
35
+ * @param string $name
36
+ * @return string
37
+ */
38
+ public static function normalize($name)
39
+ {
40
+ $name = preg_replace("/[^a-z0-9_]/i", '_', strtolower($name));
41
+ $name = trim(preg_replace('/_+/', '_', $name), ' _');
42
+ return $name;
43
+ }
44
+
45
+ /**
46
+ * Simple pluralization for common names
47
+ *
48
+ * @param string $name
49
+ * @return string
50
+ */
51
+ public static function pluralize($name)
52
+ {
53
+ if (preg_match('/y$/', $name)) {
54
+ $name = preg_replace('/y$/', 'ies', $name);
55
+ } else {
56
+ $name .= 's';
57
+ }
58
+ return $name;
59
+ }
60
+ }
lib/Bronto/functions.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file was generated by the ConvertToLegacy class in bronto-legacy.
4
+ * The purpose of the conversion was to maintain PSR-0 compliance while
5
+ * the main development focuses on modern styles found in PSR-4.
6
+ *
7
+ * For the original:
8
+ * @see src/Bronto/functions.php
9
+ */
10
+
11
+
12
+ /**
13
+ * Package level convenience for creating chainable objects
14
+ *
15
+ * @param array $data
16
+ * @return Bronto_Object
17
+ */
18
+ function object(array $data = array())
19
+ {
20
+ return new Bronto_Object($data);
21
+ }
22
+
23
+ /**
24
+ * Package level convenience for creating API options
25
+ *
26
+ * @param array $data
27
+ * @return Bronto_Api_Options
28
+ */
29
+ function options(array $data = array())
30
+ {
31
+ return new Bronto_Api_Options($data);
32
+ }
package.xml CHANGED
@@ -1,9 +1,9 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bronto_Extension</name>
4
- <version>2.4.1</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Drive sales with targeted lifecycle marketing campaigns that convert one-time buyers into repeat customers.</summary>
@@ -55,9 +55,9 @@
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>2015-01-12</date>
59
- <time>18:55:26</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="ceee3ef00dcfde90f82ce80a5119ed56"/><dir name="Cron"><file name="Error.php" hash="ccaf02afd320c2a60b271bcf728c723a"/><file name="Queue.php" hash="07a829044a251dbfdcc39fcdd0d643b9"/></dir><file name="Cron.php" hash="ff26632f20d0474d45ae0549634b4f7c"/><dir name="Form"><file name="Coupon.php" hash="aeb7bc95aa5404c25679a5dfe165f9fe"/><dir name="Field"><file name="Apitoken.php" hash="48fe102c7d74b7646de1e256f87cfe87"/><file name="Debug.php" hash="6b3e65c774d25184e88c43e7364d68b4"/><file name="Download.php" hash="6521c641550b7c747632fe25dd5982ed"/><file name="Hidden.php" hash="c514ae120d4dced7b92ea30a13f0e4ea"/><file name="Image.php" hash="9de445fac8d262bb023f123d1e4df9e5"/><file name="List.php" hash="907853b5009661b6b63a3a2947fc9c59"/><dir name="Support"><file name="Site.php" hash="9e0b6acae1053a90a7513a3791ee258c"/></dir><file name="Support.php" hash="f680904d05213ec4d43726b714cf2b69"/></dir><file name="Field.php" hash="932af08da6e8dc20e74e97894b1a2518"/><file name="Fieldset.php" hash="a3d41e7bfc09bd81942c6f32bc1d1782"/></dir><file name="Form.php" hash="557e5db7e358a42dd04fe737b6436393"/><file name="Guide.php" hash="136a2d9269011bbc00296da0d5561379"/><file name="Support.php" hash="be33bc95f1f713205dd11fb59598e166"/><dir name="Suppressed"><file name="Reset.php" hash="50dfcb14e043c3128ac9c33dc14c2951"/></dir><file name="Suppressed.php" hash="064ad003588f58f65d6b827109ea2d94"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Abstract.php" hash="8c082611a7e4131c897ae9f2ed1d6dcf"/><file name="Debug.php" hash="e841017705d9b45a33e8475144ff0587"/><file name="Download.php" hash="78de702f642111af6feb725b4dd0bf08"/></dir><dir name="Queue"><dir name="Button"><file name="Run.php" hash="d05c28fcd3f1ee0fb031ebb9d4fcfe39"/></dir></dir></dir></dir><dir name="Cart"><file name="Recovery.php" hash="6e30e1f4269e1911c74b5a954b627c01"/></dir><file name="Popup.php" hash="37f63a3196ff4e533069753569b83ff6"/></dir><dir name="Helper"><file name="Api.php" hash="d384dce8135210e87a43505c95d4308f"/><file name="Contact.php" hash="261a6f75641e8b523f9732642244e8ce"/><file name="Coupon.php" hash="3b9ef8450dcd629293a9e8dce3a98cae"/><file name="Data.php" hash="d302f1d7e9d2e86fe1bb3df7d53c6e08"/><file name="DataInterface.php" hash="d1691f590c315abd3178e769cf51fe2a"/><file name="Field.php" hash="7c208abd6c77057e1e400f6699be77df"/><file name="Message.php" hash="5484ec49ce8ab8fda12d9dc6c4c29c65"/><file name="Product.php" hash="65a1d59b68d8d80404bdb301362eee9d"/><file name="Salesrule.php" hash="6b7fcccb7b96f27b02ff864e7d9640dd"/><file name="Support.php" hash="8508894dcf753978b204a9748be64492"/></dir><dir name="Model"><file name="Api.php" hash="72817e825da18d2c88800385cd3c6eca"/><file name="Archive.php" hash="b613e811bb673c72e6cec6770ed48fa5"/><dir name="Coupon"><file name="Observer.php" hash="dbb4c8c3c5cebf1d519f28eca07d6e01"/></dir><file name="Delivery.php" hash="1c43e226d7c174f655533299bbf15359"/><dir name="Email"><dir name="Template"><file name="Filter.php" hash="e9db9d6c9cbaf06b3ca77a76bfd07313"/><file name="Templatefilter.php" hash="c3acf3b4be3dcce490b1e07c0ab68e38"/></dir><file name="Template.php" hash="b37d650d971388c8531d1384092c9dc5"/></dir><file name="Error.php" hash="8270252828229cad2c3b35f22e898b4d"/><file name="Keysentry.php" hash="706a60958eacbc7892757698a07eaf38"/><file name="List.php" hash="7355915bd78f36d18c863f57dc9b4953"/><dir name="Mysql4"><dir name="Api"><file name="Collection.php" hash="9b589f17c2efee2866369d6fd0c73279"/></dir><file name="Api.php" hash="79e25f0be61ef7ce5066c676545ab19d"/><dir name="Error"><file name="Collection.php" hash="cdd8617db0383a5dd23787850c26bfe3"/></dir><file name="Error.php" hash="2959715e0def582a6a0ecdf6f6442701"/><dir name="Queue"><file name="Collection.php" hash="f01c3c398021de80f48482067aa00f83"/></dir><file name="Queue.php" hash="3cdfeee0097797c9fc5955f4e777b2b5"/></dir><file name="Observer.php" hash="65972074d1bedffeee30e6be05422566"/><file name="Queue.php" hash="ae1b3a518644d3b246b3e3c97332bb82"/><dir name="Resource"><file name="Abstract.php" hash="a490783520f05a9e6f20b29320941119"/><file name="Setup.php" hash="5b767cf65fc9a497fb6a407dde5c76f0"/></dir><file name="SoapClient.php" hash="38ea95b32c1271d3ac329979c4f5d7a0"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Cron"><file name="Error.php" hash="38bbbcde58aa89e3f7be043a773feb26"/><file name="Queue.php" hash="4c869a3fcddd597d217f3c3d721ee272"/></dir><file name="Cron.php" hash="744f5d4fbfe19200fd07de86f9021c38"/><file name="Enable.php" hash="2b641958cfa59bd18992a8b92af99301"/><file name="Token.php" hash="fd46bd6b8654464753b8df647c7a38d9"/></dir><dir name="Source"><file name="Attributes.php" hash="38e2196286eb891dd2c7dd0da82b66e3"/><dir name="Contact"><file name="Status.php" hash="811a360bffa20b92d4a7bdea66a73168"/></dir><file name="Coupon.php" hash="acfb1c6c7c5d80170bda4a6852c4e140"/><dir name="Cron"><file name="Frequency.php" hash="3ef5bda79548019f9a7cb2007c6792f5"/><file name="Minutes.php" hash="136df1bc4c4723efdbe144ed7a08806e"/></dir><file name="Field.php" hash="7a4660fbc812dca134b69b3cef76ea57"/><file name="Image.php" hash="acb902acd1f8573887ed9d5a00410467"/><file name="Limit.php" hash="a84376a6e570e6929ed653ea2624b146"/><file name="List.php" hash="0f67a87fd2db14424d7981e647a0214b"/><file name="Message.php" hash="df1e893d9a4e065a729def494116306e"/><file name="Related.php" hash="abcdf472699f5857d7755f0423bd27dd"/><file name="Role.php" hash="5a55bad277b8723130035d79d6e5b98b"/><file name="SendOptions.php" hash="b30161eccdcb5fec0f25f41c4f6f3ed6"/><file name="Synclimit.php" hash="7a39c86388440f401437b23aeba2e740"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DebugController.php" hash="475d0fe8b46eb8a85c25d4f511a25196"/><file name="GuidersController.php" hash="8eae4825b247191bd166224ac79ea655"/></dir><file name="CouponController.php" hash="621b110ec7f3a3ef9729ee769f8b875b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1487643f106928738498f9e37a8d5fc9"/><file name="config.xml" hash="dae4fa80552945001e4227151d5f0a47"/><file name="system.xml" hash="07499197419eb705f2f9648818e152a6"/></dir><dir name="sql"><dir name="bronto_common_setup"><file name="mysql4-install-1.7.0.php" hash="c8459d26fdfea2fb9430e8829b3257e1"/><file name="mysql4-install-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-install-2.3.0.php" hash="f0f0313161b5b70ccd9f05d59f8f5e2b"/><file name="mysql4-install-2.3.1.php" hash="f0f0313161b5b70ccd9f05d59f8f5e2b"/><file name="mysql4-upgrade-1.7.0-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.0.4-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.0.4.2-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.1.0-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.2.0-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.2.2-2.3.0.php" hash="a12992a210e88d94ee8a7a601b67e98a"/><file name="mysql4-upgrade-2.3.0-2.4.0.php" hash="ab9575fa7f6fef723f8fae321d34c982"/></dir></dir></dir><dir name="Customer"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="bc63c93b5ff46fe2e6cb84a8c3249d12"/><file name="Cron.php" hash="418068c27078a2a4e56cdc36469f660b"/><dir name="Form"><dir name="Field"><file name="Rewardpoints.php" hash="c1918f7478737dcfba6b543fa006a4bc"/><file name="Storecredit.php" hash="489625264fff9d5a37621f1b80203099"/></dir><dir name="Fieldset"><dir name="Attributes"><file name="Address.php" hash="7871298d7b7410d5202b436a1f536d7c"/><file name="Customer.php" hash="b0060f6c8c71ec321387aa8071a5c483"/></dir><file name="Attributes.php" hash="ac2d13d9a181129592341a3fd022bcaf"/></dir></dir><file name="Suppressed.php" hash="490d859076b067d91edc13eee7b91de8"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Mark.php" hash="0c84d1f0e6ce3867e76d19ac7c451218"/><file name="Reset.php" hash="6dd540765670c2955160365319b9af22"/><file name="Run.php" hash="2b6332568132b633a1ee208e8b555b5a"/><file name="Sync.php" hash="be611c057f18b5da9e31927fc1788365"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="9ab5f7d8f3b0c859291804fc30f68bd0"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="5564536b725040d0652cba23e13e546e"/></dir><file name="Queue.php" hash="5aff6d99b2f3bf24cd2db7d0586f96ab"/><file name="Setup.php" hash="cb74c44bd42f407925a800fe3996d7a3"/></dir><file name="Observer.php" hash="062562816df0ce310c121c28bff6480b"/><file name="Queue.php" hash="7851ed2790e205473cf848c63a4f13a8"/><dir name="Resource"><file name="Customer.php" hash="86f081e728c9d9f22e28018406d9f601"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Brontofield.php" hash="8f75a714e862b9ab1dfdabc6a3fce986"/><file name="Cron.php" hash="44d12cea40d1342ad065bd4aad936193"/><file name="Newfield.php" hash="118d2622277e919e1f316f0713f5a2b7"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="7600760ed4af3e251efb533b3d3b8471"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bb58fa0df1e07c2d88527fed1920ffc2"/><file name="config.xml" hash="e1a4673cdc939b1177c5ee2e8af678f6"/><file name="system.xml" hash="682080ce412a65f6bb7edf88504e5d45"/></dir><dir name="sql"><dir name="bronto_customer_setup"><file name="mysql4-install-1.0.0.php" hash="871c225318588b2804a05751bce45e1f"/><file name="mysql4-install-1.0.3.php" hash="439f1eee0d34f172197b78b787e1e983"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="1c00e987c9a1b1da70ad035ccdef194b"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="144999a033695bd72601f1f0e10de5e3"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="6e3c57a1c9272aa4b2d7d051a24ed87f"/></dir></dir></dir><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="ab71e0649d5af1fe64f665ada8895be9"/><file name="Settings.php" hash="59f952e7baeff59ef013a9f39572370e"/><dir name="Templates"><file name="Field.php" hash="0b4d17701e352b6c28cd5262d3cd8e0e"/><file name="Fieldset.php" hash="01fa6905eec117df32519c7e461e05f8"/><file name="Label.php" hash="fed0e19a1dde5592ba2efcc3aa6a2bba"/><file name="Sendtype.php" hash="d93029708ba002781e365cb0215022ce"/></dir><file name="Templates.php" hash="5811fe4b83f7dd5d6f0c7c78314cd31c"/></dir><dir name="Email"><dir name="Import"><file name="Edit.php" hash="32d4219613247ff59a59b5031284159c"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="4227539615a40aa44810dc58f98b0ee8"/></dir></dir><file name="Grid.php" hash="68e5bc81c99bc9cb5667384526743ee9"/></dir><file name="Import.php" hash="a2f378383faebc5c0fabcd46feb4d7e3"/><dir name="Log"><dir name="Grid"><dir name="Renderer"><file name="Customer.php" hash="ee83b754d1a91920a79918991aa76ca6"/><file name="Fields.php" hash="dc0d7cbd5065382ccf51ff3f84054563"/></dir></dir><file name="Grid.php" hash="591f4aefd4fa2f7b5f53653f0d7780a7"/></dir><file name="Log.php" hash="755439eace3c8e1f5ee3c657562c476d"/><dir name="Template"><dir name="Edit"><file name="Form.php" hash="c1b63c327ad420f175683b377c8574d4"/></dir><file name="Edit.php" hash="e76c3c82fc3c180041eeeb6251fecbaa"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="543cf476631d073e4de5ec59f1faf5b5"/><file name="Storename.php" hash="c5111a20ed0b3aed0078cecb1ae3d739"/></dir></dir><file name="Grid.php" hash="dd12032078cf00d0c65fc6d9d563492f"/></dir><file name="Template.php" hash="ea39c46962381b34377efa05ecbfa075"/></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="60d8707e923f59ad7af130aa09557be0"/><file name="Data.php" hash="97923779bd8c367d572745d96b030cd5"/><file name="Field.php" hash="fc67415cbe73614fe0bbc29df7f93148"/><file name="Message.php" hash="7f5a80ce2a9a75324f8e5df9b3a318f4"/></dir><dir name="Model"><file name="Log.php" hash="1c9b060a801312c0b929806708a9ac1a"/><file name="Message.php" hash="02bf1f9bef1f4ce1909cc3d5c6331969"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="0cc3245eea5df5ca8607fc4ca8aabf99"/></dir><file name="Log.php" hash="aef3718e6ea1de42152099aeb444782f"/><dir name="Message"><file name="Collection.php" hash="4ad21710a8a2c403e83dcf40ad6eda22"/></dir><file name="Message.php" hash="f225d9ac332aa3b0fea5ff094a336926"/><dir name="Template"><file name="Collection.php" hash="339fb475d2beb88a65051f043a1b73ff"/></dir><file name="Template.php" hash="496380271268f9f949afb2a2ce1bdbf9"/></dir><file name="Observer.php" hash="cd5b5e10dabdc615d77a99cb695d685c"/><dir name="Resource"><file name="Setup.php" hash="1379cb13744acc937302fb5c2c237b7f"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Templates"><file name="Field.php" hash="e6f28eb62a469792eb61ca1044aae764"/><file name="Sendtype.php" hash="18dadd39cdf47f6cdc95e168fe2012bc"/></dir><file name="Usebronto.php" hash="d9c1e9b77810c922b058d5f03f03b02e"/></dir><dir name="Source"><dir name="Email"><file name="Template.php" hash="a55d4003789eed3feebad2251c0484c1"/></dir><file name="Sendtype.php" hash="4cc496295bd5b4c2bf71eae9fd87f803"/></dir></dir></dir><dir name="Template"><file name="Import.php" hash="54b58a617a783f66493793a041abef2f"/><file name="Mailer.php" hash="4792fa983cec3d29aca946c393232b3b"/></dir><file name="Template.php" hash="f74e29c0fcc7528488e19f6aa89c57d7"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="System"><dir name="Email"><file name="LogController.php" hash="471e58f342857be6f023527c0a1d2981"/><file name="TemplateController.php" hash="22815e046154c7216adc85fa5411033d"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2343ec1b1ac91db90d522cd64e797aa6"/><file name="config.xml" hash="d0c6a1e08711f87e72cedc0cf1abc5ff"/><file name="system.xml" hash="46419a7c31b60bd8a1e56a0ebaa2f184"/></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="2824a3ef8b9308e577c792398598e08c"/><file name="mysql4-install-1.1.7.php" hash="f49bc2913b1c2375499f21f2ac9727cd"/><file name="mysql4-install-1.1.8.php" hash="afa3c83fbfe45fc193a7eda4af6afacb"/><file name="mysql4-install-1.1.9.php" hash="4509540dda05675ee192e0330effddd3"/><file name="mysql4-install-1.2.0.php" hash="153fc8a27833bda06046231eb0293230"/><file name="mysql4-install-1.2.1.php" hash="153fc8a27833bda06046231eb0293230"/><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="53cf783db35699cdc1fee692752fe8de"/><file name="mysql4-upgrade-1.1.2-1.1.7.php" hash="105868a6253471d3eeeea46c7af18aa9"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="0a4abaf8c787bf656e3163489eb5d29e"/><file name="mysql4-upgrade-1.1.8-1.1.9.php" hash="65b7c540763c1817fef6e4eb1ca6cb9b"/><file name="mysql4-upgrade-1.1.9-1.2.0.php" hash="41aa0b0e87d7f3d97388d5d2733defbd"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="4b67cf347973a21c234d04bd4d0aa904"/></dir></dir></dir><dir name="Emailcapture"><dir name="Block"><file name="Emailcapture.php" hash="9184205597ec0ff5b30732e39a8cb167"/></dir><dir name="Helper"><file name="Data.php" hash="4968f32e599a6fefe7b6876c486264ba"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="104fe48ab81aa32769c95aae1b4e4988"/></dir><file name="Queue.php" hash="97ad38464595ed8a25aee9148d703e51"/></dir><file name="Observer.php" hash="041d29358d884b6a4444200d3a6e6b00"/><file name="Queue.php" hash="f95570e6972a31e17c9b4eb1d99aad07"/></dir><dir name="controllers"><file name="IndexController.php" hash="2162c4ce867cba627a66ba4c1b549e55"/></dir><dir name="etc"><file name="config.xml" hash="953a38982ad1ad62107558218b78d121"/><file name="system.xml" hash="7f748cfe607ca50519e51f8a9739feef"/></dir><dir name="sql"><dir name="bronto_emailcapture_setup"><file name="mysql4-install-1.0.0.php" hash="ff0cda179382b958d6a566963faae637"/></dir></dir></dir><dir name="News"><dir name="Block"><dir name="Adminhtml"><file name="ItemRender.php" hash="147c1b256abc1a3f0ffc9018d8af713d"/><file name="Redirect.php" hash="0b6928d1529e41c4e2ccc3a415e53bb8"/><dir name="System"><dir name="Config"><file name="About.php" hash="757f06422ff513218a9dfad2ff91cd0d"/><file name="Form.php" hash="853d55a3d7d5e73e87ae09f87f4764b9"/><file name="General.php" hash="8a19eee62442466ff28f23aa782e68c5"/><file name="News.php" hash="4fdda30cd100f4d1b57a74cb38a9b371"/><file name="Releases.php" hash="30f7b23081c69219473326620e6ccd06"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="79dd892352cda62c69ede789dcade61a"/></dir><dir name="Model"><file name="Item.php" hash="e3ce20de8f0422dcf00f389f5491e788"/><dir name="Mysql4"><dir name="Item"><file name="Collection.php" hash="6a79699559ffe750643c3f6da90d0280"/></dir><file name="Item.php" hash="bf9fae7b7e2241259dbdbe83623c3e6e"/></dir><file name="Observer.php" hash="236e8cec018d29f50c4aeff1f23f4880"/><dir name="Resource"><file name="Setup.php" hash="cb9d37d047d535b4928b279623283f30"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AnnouncementController.php" hash="ca98e801e5503b04f4f60286e19edb2e"/></dir><file name="RouteController.php" hash="4819b7cab294e952238e2edb43a73c52"/></dir><dir name="etc"><file name="adminhtml.xml" hash="079a3f745967cc14906151cfcdc2c816"/><file name="config.xml" hash="590d56fb32cdb7460cbff22ab1bffa69"/><file name="system.xml" hash="ecd3a0edd0de407c85bb537a78c2380a"/></dir><dir name="sql"><dir name="bronto_news_setup"><file name="mysql4-install-1.0.0.php" hash="f574c4b2432334d0202d75ef71cb0006"/></dir></dir></dir><dir name="Newsletter"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="b5d17d62df37034cd48ea3022e546724"/><file name="Cron.php" hash="4085792ad95b00e5c49a6d9226c6f1c2"/><file name="Suppressed.php" hash="981094eef35a29b7ee10d9ccf395d975"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Mark.php" hash="fc5b7ca0c406b2677b8af8d19539ffa2"/><file name="Reset.php" hash="a2827fc3f6af2b94e1ed3bcc5989b015"/><file name="Run.php" hash="21e4d1c9eb2c882b967c5de6def6a97b"/><file name="Sync.php" hash="89112c7b858e9031050bcba50527b4d7"/></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Newsletter.php" hash="cc98f4590cf2dfb4cbb584a47e440906"/></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="bc7ec83130b8614881cf9476b4884bbf"/><file name="Data.php" hash="b34622a3ed7fd6df8277b4079e763697"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="b9c6858b2045ad66b7c331afba125d19"/></dir><file name="Queue.php" hash="4cf426f02c1e2889b77be9b6a105c91b"/></dir><file name="Observer.php" hash="bafcd4f67e0a32ab871f024b82a0feec"/><file name="Queue.php" hash="a9ef5813d95abcd1ee89a0372a0cfeb8"/><dir name="Resource"><file name="Setup.php" hash="1f72a1f56aca455ea0d0289450e9edf5"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="282c40a155af7ea22f646e931fdb6732"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="NewsletterController.php" hash="0a2ba62ab4c23e62111543769a4d8e1b"/></dir><file name="IndexController.php" hash="1a0abafaaa208e0d7600e340d0f829ce"/></dir><dir name="etc"><file name="adminhtml.xml" hash="b685d64860bf37a09330bd9f89f5bc3d"/><file name="config.xml" hash="4f33f6124fb207fab0f5b37d97bbfd25"/><file name="system.xml" hash="6d6b708cf242e608d93a141a5709a5d6"/></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="4a779a923947af258688d01143a16362"/><file name="mysql4-install-1.4.4.php" hash="089b40f9419c2fd21af62df207327a20"/><file name="mysql4-install-1.4.5.php" hash="8e97902e5e83992e678ba6144ed130b5"/><file name="mysql4-install-1.4.6.php" hash="74d29bc9655aeafa381ba5dc5f53df69"/><file name="mysql4-install-1.4.7.php" hash="74d29bc9655aeafa381ba5dc5f53df69"/><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"/><file name="mysql4-upgrade-1.4.4-1.4.5.php" hash="c49018730275134d72f0802e1bc4da47"/><file name="mysql4-upgrade-1.4.5-1.4.6.php" hash="7de96310cf9bfe375e3026ed5c934ce2"/><file name="mysql4-upgrade-1.4.6-1.4.7.php" hash="6e40d94220fc0f2305546f7a8d5e754a"/></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="4caacae5f31c84f898be5798cc85b7b7"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="About.php" hash="332c01d15a8b75f9add5988f35519135"/><file name="Cron.php" hash="62d625df775ca2b81503b1c97c4f7e79"/><file name="Suppressed.php" hash="fd39306031d9b20dc050a69afbd32cd0"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Mark.php" hash="beb088031b04ff6b168670efb129b229"/><file name="Reset.php" hash="4d64995d0f43ff3f3829287f8b8780f9"/><file name="Run.php" hash="700e3f9645a9e25e56ae1deb6764bf44"/><file name="Sync.php" hash="2ff1bf077cc56b3620fe87a494d7f770"/></dir></dir></dir><file name="Bta.php" hash="2ec920ce5a6ea57aff16c8d9cf89f7e9"/><file name="Redemption.php" hash="cb6bfc3d06e4f7287c8314f539fce0c5"/></dir><dir name="Helper"><file name="Data.php" hash="46abcc5bc67e8e7b204875811785a315"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="d041d29b798d10821e041c5b89fb5889"/></dir><file name="Queue.php" hash="2b0ba0993a43cc6856647684ac30add9"/><file name="Setup.php" hash="05b0a2d4806e712410479a3e7c709fd8"/></dir><file name="Observer.php" hash="ce318e134a99243a238465c8489fd0d5"/><dir name="Order"><file name="Observer.php" hash="5a05f37813b04968a2274098fdf8b1f7"/></dir><file name="Queue.php" hash="a544dd6bc3525c82cdf98791c49da91a"/><dir name="Quote"><file name="Observer.php" hash="1633b1031f19bdd36145b1040d9d6692"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="9bc2a90d644af8334aa22b952132b08f"/></dir><dir name="Source"><file name="Bulk.php" hash="77b7aa28a1e7912c2a23b45155a46623"/><file name="Description.php" hash="7f497c17388c360f239e2aa90d943b9c"/><dir name="Order"><file name="State.php" hash="8a570c595207a4ea2410372322717339"/></dir><file name="Price.php" hash="283cc883ded57664870d89b22b547b19"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderController.php" hash="6b380e7c6d0905f29812e3a8bcaefc75"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="784d322d920c63e63bed37c50e1c04d1"/><file name="config.xml" hash="9fffc146d55066071d574cfd4160eba2"/><file name="system.xml" hash="07759a0ba254ff1bc632205b0b2b92aa"/></dir><dir name="sql"><dir name="bronto_order_setup"><file name="mysql4-install-1.0.0.php" hash="4988c452cc0d367f34e9c33df0d4256d"/><file name="mysql4-install-1.1.8.php" hash="afd415c7bb5a81b18c6705293f3978e6"/><file name="mysql4-upgrade-1.0.0-1.1.6.php" hash="0c42c6e3539b0f07c76b4f2c582d110f"/><file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="7c4d2c1feed28b964ea82373e625a11f"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="ae58d4271deb9c60e61214020d46e755"/></dir></dir></dir><dir name="Product"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="f3e3d3f6bca7f3b065e25f22b5578d2e"/><file name="Cron.php" hash="53c81d5081e3d4204694c468eff18c39"/><file name="Information.php" hash="cc968073e785221272c6f924e7105036"/></dir><dir name="Recommendation"><file name="Default.php" hash="907b566bfb4bbe4e1c46749182556d77"/><dir name="Edit"><file name="Button.php" hash="d6685785f649dde452fca3a18c78530d"/><file name="Form.php" hash="e8f4faa97ff7dd334c1c5048c30e850d"/></dir><file name="Edit.php" hash="87c571a236297ce4d9b6e692a4ffa852"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="486077c93f6a3b2dd076bd3c9e7d529c"/><file name="Description.php" hash="2eeb64ad510ac9d4cdbb5edf99211b82"/><file name="Image.php" hash="122e3ae80a3a4c260d09374476174c84"/><file name="Price.php" hash="c4af2d40e24f895bba7681851ec8aec2"/><file name="Url.php" hash="b03b06cf5eea764706db123a4b55aefc"/></dir></dir><file name="Grid.php" hash="a8b024f5a89e2bffdd94db2220392fdb"/><dir name="Message"><file name="Form.php" hash="81f6f8f259e940a82f6626c2b74e89ca"/></dir><dir name="Preview"><file name="Form.php" hash="4c24d8207c53bca40dd7760c2402d9c6"/><file name="Grid.php" hash="e638266ee7e7c523b747bfb25fb834c2"/><file name="GridElement.php" hash="251201019431ab9596778b0290c71395"/></dir><file name="Preview.php" hash="abc472e9d896a6f417b2ffaa735ce373"/><dir name="Selected"><file name="Grid.php" hash="843022c5636af8e962503e53479f15c0"/><file name="Js.php" hash="dba81b98bd95dbebd22709efc1a3655c"/></dir></dir><file name="Recommendation.php" hash="121626c24b44ad88a918db07f97cfa66"/></dir><dir name="Widget"><dir name="Button"><file name="Run.php" hash="fe948d6a6a08f2876eeccd7db0c3a8b5"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ffd05a5b97598c57462ef788aee89127"/></dir><dir name="Model"><dir name="Collect"><file name="Abstract.php" hash="d91208de5e721412953683696b797d58"/><file name="Bestseller.php" hash="8f820a534f047f52a0e94f9ec9663150"/><file name="Crosssell.php" hash="3479888fc18d4160ee7695ac5fd4face"/><file name="Custom.php" hash="fdebb77a3ab630498c605bc028f370ac"/><file name="Mostviewed.php" hash="620174efce65c65bd0eb6ab6b3c75f5f"/><file name="New.php" hash="da42c2190202e931a46f9730398b42fe"/><file name="Recentlyviewed.php" hash="2e5c66216ccd815a9a90e33994cc0f9a"/><file name="Related.php" hash="bed15693d124080b58efe577517f7815"/><file name="Upsell.php" hash="d34c4852b4729fed13e34191f7e43671"/></dir><file name="Collect.php" hash="9e0fbec2533bd5f9b50f7dd5a8f0e67a"/><file name="Content.php" hash="da798d9df324c6919460983f8c2e378b"/><file name="Filter.php" hash="b52b98c7cd452bfdc779b70deb09eafa"/><dir name="Mysql4"><dir name="Recommendation"><file name="Collection.php" hash="92ae6f624c68d971439d16c79e3e1d08"/></dir><file name="Recommendation.php" hash="e99ebd40f8c942a33b743ad276db23c7"/></dir><file name="Observer.php" hash="364dbb516837a32ac6f219a8c8fffec8"/><file name="Recommendation.php" hash="50a473fd05c4871da36eb09b0a0f68e9"/><dir name="Resource"><file name="Setup.php" hash="336419abffb7d42a7a5c448c22242fdb"/></dir><dir name="System"><dir name="Config"><file name="Cron.php" hash="df7c9a3ff5318013f9afa0148d41fe84"/><dir name="Source"><file name="Recommendation.php" hash="479472b2ed049a745c12c6f499f13cc9"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RecommendationsController.php" hash="90653d0cf64d919756246ab4fcd3c50f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e8eeed8f3589872c7e6e374557cfc613"/><file name="config.xml" hash="2e7dd871d1364b24106579513a341d2c"/><file name="system.xml" hash="8b2714eba1acaff27c046b082d9d97c8"/></dir><dir name="sql"><dir name="bronto_product_setup"><file name="mysql4-install-1.0.0.php" hash="d04672913acece60326290535f677514"/><file name="mysql4-install-1.0.1.php" hash="d04672913acece60326290535f677514"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="f7d62d97c57094418e943c62aebe9296"/></dir></dir></dir><dir name="Reminder"><dir name="Block"><dir name="Adminhtml"><dir name="Delivery"><dir name="Grid"><dir name="Renderer"><file name="Customer.php" hash="be1537b58943a2cc27982deb03ec9e39"/><file name="Fields.php" hash="04f0dc7c4a24769cfc68f1508e0d338b"/></dir></dir><file name="Grid.php" hash="472fa8302dae712fbf9a6b6f5ea80dd0"/></dir><file name="Delivery.php" hash="b0bd1dcede57f8dad8ba4416b26d3986"/><dir name="Promo"><file name="Notice.php" hash="437ce674b25c14e33e17e09a0d471176"/></dir><dir name="Reminder"><dir name="Edit"><file name="Form.php" hash="2db520c0f438affbf477801ddde7f9cf"/><dir name="Tab"><file name="Bronto.php" hash="70de5a5bf9647f67ce2f684e3f87c863"/><file name="Conditions.php" hash="71d7c0a13352ec3d5b19b6bc059238bb"/><file name="Customers.php" hash="2ba680131f4b31175c7425c0648c6807"/><file name="General.php" hash="eb05a598a2eafd88d2a199c286b11836"/></dir><file name="Tabs.php" hash="106e44febc4b6a7a3928c5dec68d6123"/></dir><file name="Edit.php" hash="783ca6f21744c56da930fd44ddc6e3a5"/><file name="Grid.php" hash="c87a852ef998ea17af709c0221abd15d"/></dir><file name="Reminder.php" hash="a55e63b29f9cafd9053696f60ffe993f"/><dir name="System"><dir name="Config"><file name="About.php" hash="8380b5e750fe0f2b5b95407c99d2e195"/><file name="Cron.php" hash="84100d0bffc2e16d84bc24577ba9c6bf"/><file name="Settings.php" hash="5d0042b1b2ad5df43856c0a68d63b3b4"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Email.php" hash="bcc3abd5bbbb5e8f6e19454850d2e8dd"/><file name="Id.php" hash="c35c0feeac92dce912bb8e3ad2cc7e6e"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="4b3e67cf3a0ce095ca454fe4513c6e89"/><file name="Data.php" hash="240771ed9bd56278eb99731e29b9bfca"/><file name="Message.php" hash="b65f0a4095ab4671c57a26451b3cc524"/></dir><dir name="Model"><dir name="Condition"><file name="Abstract.php" hash="3e164c6f67c1ca26c0be533cd9fc1b0c"/><dir name="Combine"><file name="Abstract.php" hash="2a43ca00f8bc4ab36bc87654ad9c6191"/></dir></dir><file name="Delivery.php" hash="41c3912dc5b5cb28d828358c1e0f7bc4"/><dir name="Email"><file name="Message.php" hash="41a2e2068a8452d624df1b2e9343be2a"/></dir><dir name="Mysql4"><dir name="Customer"><file name="Collection.php" hash="577bd12e2df9940fe551fe41c96133cf"/></dir><dir name="Delivery"><file name="Collection.php" hash="1247c3f58061d41f66ee6b9483c200ca"/></dir><file name="Delivery.php" hash="3639d2739b29734ba8aa8950e67e9621"/><dir name="Rule"><file name="Collection.php" hash="a99264c81d15780f305b02cde1564461"/></dir><file name="Rule.php" hash="beee42ebadb7d20371dd06a23f5adae6"/></dir><file name="Observer.php" hash="299bca8979d361a027fe4ac1598df2f4"/><dir name="Resource"><file name="Setup.php" hash="71ad578ef666cd9810bad2ab8d854bed"/></dir><dir name="Rule"><dir name="Condition"><dir name="Cart"><file name="Amount.php" hash="b1bd2bd9aabb863184461b0594dad9b0"/><file name="Attributes.php" hash="74cfde1032d8d75241f7522ddc12e11d"/><file name="Combine.php" hash="660f6842b8c1a5acff2c3b4f12fc73a9"/><file name="Couponcode.php" hash="84ef3ecb8bcd57412af80a0d137335bb"/><file name="Itemsquantity.php" hash="50eae47f28bf3660ee0684c9037f5bf8"/><file name="Sku.php" hash="12a7af32e16e21d2a2e4e157c469d1e5"/><file name="Storeview.php" hash="c2310efcb3060e91bf2aab73b0ac8ca9"/><file name="Subcombine.php" hash="c8ad5b2c46116793e2f2df17fe0862c0"/><file name="Subselection.php" hash="0142065f76b4e24ec75b6685eea82642"/><file name="Totalquantity.php" hash="8e492fb70a94549b8d6adbc50b2a4e50"/><file name="Virtual.php" hash="cd12a3218daf4a447b4fd49141101305"/></dir><file name="Cart.php" hash="4d534abf3f1cf1459fe6713788efe66e"/><dir name="Combine"><file name="Root.php" hash="eb4b22b6554b507b61f3e6be30048b07"/></dir><file name="Combine.php" hash="2f15f1241aa71fd76bb511415c6882a3"/><dir name="Wishlist"><file name="Attributes.php" hash="0ecf162a2fc4225ce37de714da9e6210"/><file name="Combine.php" hash="279af17bec3eeb6a97243a93eb4e3f85"/><file name="Quantity.php" hash="8de8793029340cb8c813e0cf034f372d"/><file name="Sharing.php" hash="ad302122deb2065aa28b68748cfae492"/><file name="Storeview.php" hash="83716681ba30c6d4c48dada3a0973971"/><file name="Subcombine.php" hash="4804ad602e3cc622dbfcab4030dff1c2"/><file name="Subselection.php" hash="68d96f6943becdc728f2aa436a8ac4c7"/></dir><file name="Wishlist.php" hash="f5c474dd7b126d69a3e0f7000abd3a95"/></dir></dir><file name="Rule.php" hash="dfc573a119a05809d468cf555bc03390"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Allowsend.php" hash="61965e981ddd79976f0ee21b01e6a0ae"/><file name="Cron.php" hash="6e527885884985fca33236f40a7f3689"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeliveryController.php" hash="d4630eff20209e0d46b08a29b543979a"/><file name="RemindersController.php" hash="6cd60b0a9c33075640c5926d94a78405"/></dir><file name="LoadController.php" hash="0f94e459c7dc5858ffefb92f4238a663"/></dir><dir name="etc"><file name="adminhtml.xml" hash="baaae901f8ff9d2ab12b0158ed5a4ca7"/><file name="config.xml" hash="1803dc082d4ff31d2a653c8c5cf25e89"/><file name="system.xml" hash="794fa3826fa84526997e4f8c3ef2e4ef"/></dir><dir name="sql"><dir name="bronto_reminder_setup"><file name="mysql4-install-1.4.12.php" hash="eae3eb4a69de44df200c52001783a4f0"/><file name="mysql4-install-1.4.13.php" hash="12419b6117a9e0e10f565453feed8740"/><file name="mysql4-install-1.4.14.php" hash="be67c1c55e1781c652d0036984fd0866"/><file name="mysql4-install-1.4.15.php" hash="f2bc98906fc36bf0640b292851ab99e1"/><file name="mysql4-install-1.4.16.php" hash="e34c42b202a7435abe2fa46f01bde257"/><file name="mysql4-install-1.4.17.php" hash="26c94634150797a07af197a4a81f45f8"/><file name="mysql4-install-1.4.18.php" hash="00c690a98400102491ab8f998902960b"/><file name="mysql4-install-1.4.2.php" hash="07b5a7b8ef247def75617e92738f0950"/><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.12-1.4.13.php" hash="172b48942497efd2305eff260bc28d9c"/><file name="mysql4-upgrade-1.4.13-1.4.14.php" hash="3218dae864cac00ff74655160ad31663"/><file name="mysql4-upgrade-1.4.14-1.4.15.php" hash="2e842e4c18259590cdafd2139dd4eb7e"/><file name="mysql4-upgrade-1.4.15-1.4.16.php" hash="671f39e2f90faf1165d50b517be8e04f"/><file name="mysql4-upgrade-1.4.16-1.4.17.php" hash="d789e8fbb7e9dad163643b7b7d2f37b1"/><file name="mysql4-upgrade-1.4.17-1.4.18.php" hash="e80e8b4e0856af9bb2105c786eb99ee6"/><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="Reviews"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Abstract.php" hash="3bed66cfc7fa08358689299710826822"/><file name="Caretip.php" hash="3b18b5be0df73c006d6744ebf87fbfc5"/><file name="Reorder.php" hash="4fc01c619252f25c2f38607acd5bdaaa"/></dir></dir></dir></dir><dir name="Reviews"><file name="Delivery.php" hash="e5dde6fc2d949812bcbbe71ec74e8cca"/><dir name="Form"><file name="Abstract.php" hash="cd621c8bcd6249be74a4f1b166eb6eeb"/><file name="Caretip.php" hash="b8487305d93c4eebfbd4ae52eb4a5021"/><file name="Reorder.php" hash="5f402890386bf6f4f698cb1c15c83841"/></dir><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="9772c271c5fbb9e6d732ca96a90b602c"/><file name="Order.php" hash="c4c1549d9c8848207de6801866d2a790"/><file name="Product.php" hash="274e7ff5c86adccc850cc174df0a0f49"/></dir></dir><file name="Grid.php" hash="907429dc104e71ead6a53445d20173c7"/><file name="Typer.php" hash="9b9b9783a2f33ca31638c940fba83297"/></dir><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><dir name="Post"><file name="Purchase.php" hash="31ac1dabea3ec76bf0ba0f2bd01f2ae1"/></dir></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="About.php" hash="b62835e11224c3e8cb7256715d145814"/></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="a85da1e1cc10dd48ac88b84d91cb9a1d"/><file name="Data.php" hash="addf95ab338da5e5cd2c2152f1eeaaf0"/><file name="Message.php" hash="df3015f886b4dd283d280cf26ee69cc7"/></dir><dir name="Model"><file name="Log.php" hash="559f8faa8207e04b716c99efb39f3008"/><file name="Message.php" hash="ed6509dd6c71ff2ad62b5b129a949055"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="4ffa6e9e2ce58805c19b3358062c68f0"/></dir><file name="Log.php" hash="b755cddb0b8827e5517402223b740815"/><dir name="Post"><dir name="Purchase"><file name="Collection.php" hash="58f2786d8436c66e453d50376b7bf969"/></dir><file name="Purchase.php" hash="2b6a01151a5d551dfe07442f3860ff86"/></dir><dir name="Queue"><file name="Collection.php" hash="76c646f42045cdc209e1a3487d69436a"/></dir><file name="Queue.php" hash="069d32dfa162f3ceca48aa85ceded03c"/></dir><file name="Observer.php" hash="602790255a33b998fa946c02d8249537"/><dir name="Post"><file name="Purchase.php" hash="afef25c85f0978430d8c3b1c5324a555"/></dir><dir name="Process"><file name="Context.php" hash="781abce4f8ada1a39808c7527f92e98f"/></dir><file name="Queue.php" hash="841ccaa124236a203c89bce120183537"/><dir name="Resource"><file name="Setup.php" hash="5a0fd912d40b0feb2260fe8c426b9bdf"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Hours.php" hash="4f249b60a8e753b6f052eb85349d4436"/><file name="Identity.php" hash="50db4cbe29f4d79f78e69fd961eaa7bc"/><file name="Message.php" hash="9a5e15326017cbebd7b59b5c80693685"/><file name="Orderstatus.php" hash="a6df006770b4e732ddb75e0d22bfa6fd"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PostpurchaseController.php" hash="5bbd132ee44c0c56c06235b9c0f06dbf"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="751e6e96c1dc6287ac558dae15e94fd8"/><file name="config.xml" hash="34a124317dfcd4bd779e7d38900ce316"/><file name="system.xml" hash="131ac89e2df8e5f0cd577bc6f4d86ead"/></dir><dir name="sql"><dir name="bronto_reviews_setup"><file name="mysql4-install-0.0.1.php" hash="b3a6870f118426b57d1d71ebb55f2994"/><file name="mysql4-install-0.0.2.php" hash="692022168a3f54e94bf9520279842986"/><file name="mysql4-install-0.1.0.php" hash="5a9cc972bae0a0ae32cd4847b18ec73a"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="b3be98f252442e251544e2f7a5d196a8"/><file name="mysql4-upgrade-0.0.2-0.1.0.php" hash="966a8efde0345cebe7c6f783d6dd4987"/></dir></dir></dir><dir name="Verify"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="b50a08cd24985483cad82c76305da5ce"/><dir name="Advanced"><file name="Observersearch.php" hash="0351378eb6fbfa8e9b1cde55a9b589e5"/></dir><file name="Conflictchecker.php" hash="cf1736b689d1ef2b3f0b7d7d84b703ba"/><dir name="Form"><dir name="Field"><file name="Apitoken.php" hash="cb84fee5b4e18ca0092f385d6ede6711"/><file name="Button.php" hash="7041c0e923d9929796597160679bc94c"/><file name="Classpath.php" hash="c9c60b09c180960dd107d74f79b63edc"/><file name="Conflict.php" hash="3797f7f88329ecf4d5c9e3e48c9c89e5"/><file name="Events.php" hash="c88df55f9105d0aa5a1574bc37c5a8f8"/><file name="Index.php" hash="612cf825df2f10c0d4d00ac54f413aba"/><file name="Roundtrip.php" hash="4b84fb21a59f5939ab7361dcc816ce1d"/></dir><file name="Magecron.php" hash="109e8427d968973ec3d4b0e5de6e4064"/><file name="Permission.php" hash="e5185de6bc1976ee7497956cc9162a17"/></dir><file name="Installs.php" hash="522badf3dc895a2a914f5060daceb35f"/><file name="Permissionchecker.php" hash="6f0be4f5594afe1f6924b839db582180"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Classpath.php" hash="1687def566fccc786c263d94b4c9c9b5"/><file name="Conflict.php" hash="473cda5cc65b9302efb3618c3b5af973"/><file name="Events.php" hash="3da5bc0026613dfd921a25a942fb3d7c"/><file name="Permissions.php" hash="b89e87e9b6848cde87a4f6343b3feb1a"/><file name="Runroundtrip.php" hash="5a98f930b382a7a0c01f3b346def4955"/><file name="Runtoken.php" hash="63a721c0a25bdbd58be941ba7c5d21c8"/></dir></dir></dir><file name="Conflictprinter.php" hash="05a32eca413a0eda87bcdb7bd0661642"/><file name="Permissionprinter.php" hash="8925da12d1e8dc5f180327dd94d18310"/></dir><dir name="Helper"><file name="Apitoken.php" hash="bc1f30a551a958011fbba91310cab77d"/><file name="Conflictchecker.php" hash="55e0aacf4cd6e9d2b4d52ebe21fe7850"/><file name="Data.php" hash="6622f73bf7af3e1e68ad27551fb7d920"/><file name="Permissionchecker.php" hash="da5fc3a69e6477299084d210aaaad6b7"/><file name="Roundtrip.php" hash="b5566d978e4e24cf06bee83ab92772fc"/></dir><dir name="Model"><dir name="Config"><file name="Blocks.php" hash="0000df779f3e1fb60350b14b8a6185e3"/><file name="Checker.php" hash="a38555d682b302967410b73ebab04b4f"/><file name="ConfigAbstract.php" hash="79024697562751ff46c939d9d680fc86"/><file name="ConfigInterface.php" hash="45cecfde48e4ef0657a6418019f02e4a"/><file name="Datastore.php" hash="fb5ea494075ce81380d1447c07fa052c"/><file name="Helpers.php" hash="1dc143d542d3fd85ccff785f913556f1"/><file name="Models.php" hash="3062f1f3c4950d965054afe6b75b4b0f"/><file name="Printer.php" hash="dfd6bfdcc94a1afb83ae6c3599abb21c"/><file name="Resources.php" hash="24bbf7de88b25250a81a2d7380d5baa2"/></dir><dir name="Contact"><file name="Builder.php" hash="9d578480a7e4c8fde2a33e698a9efced"/></dir><dir name="Core"><dir name="Config"><file name="Base.php" hash="c11b6cbaf1802d3c6ab58853b468f5d7"/><file name="Element.php" hash="8a7c9221a95c1317a8ae166e692a4ee0"/></dir><file name="Config.php" hash="91877cb5fb11c545f4c0b2069e1407b0"/></dir><dir name="Lib"><dir name="Varien"><dir name="Simplexml"><file name="Config.php" hash="076958ed612323869d2437872744ed2a"/><file name="Element.php" hash="a8c28fd3b6b00ad689d4850e79441dec"/></dir></dir></dir><dir name="Mysql4"><dir name="Core"><file name="Config.php" hash="3b8fb36a66a675c4d12926bceadb4ea5"/></dir></dir><dir name="Path"><dir name="Locator"><file name="Array.php" hash="42fd6c7004b0f02f954956563edde9a0"/><file name="Factory.php" hash="46007808ba897fa6816fb7771a2b18dd"/><file name="IteratorAbstract.php" hash="1debe4adc34aa5d60a94328fd67032da"/><file name="LocatorInterface.php" hash="b775ce0d189ef276c9bbeade7da67b4f"/><file name="Stack.php" hash="328481c9d963f653a95f333fb440bea5"/></dir></dir><dir name="Resource"><dir name="Core"><file name="Config.php" hash="aa2fb8c4fb153e742c690ab8bc8b5a75"/></dir><dir name="Db"><file name="Abstract.php" hash="d668c24c90f80bc197c83eb0a3e10aa6"/></dir></dir><file name="Roundtrip.php" hash="f2166b39afed3e32de4e03cfa3416ff6"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Magecron.php" hash="ba8b8f5ef43bed77ed03dba3e98df1df"/></dir><dir name="Source"><file name="Classtypes.php" hash="772cab11a7470a2dd68ece3688c68d6a"/><file name="Wsdlcache.php" hash="b7d9c1c4d271c03a7486fc86eec3b6d9"/></dir></dir></dir><dir name="Validator"><file name="Checker.php" hash="35799249fcc93b31ff12da539cfb0d84"/><file name="Directory.php" hash="aa05ae40ad0b7aaffffaa6063bd8561e"/><file name="File.php" hash="c29c1cd2140186dc67c5e62064b79c0f"/><dir name="Filter"><file name="PatternIterator.php" hash="c129a6ee0fb4a45ff52644da2c0abfa1"/></dir><file name="Group.php" hash="59ad6dd4232ee113e1fe8161a82148ba"/><file name="Owner.php" hash="69e1c54dca88532208ce1f35f4491d99"/><file name="Printer.php" hash="23a00ec415b8665e5457ac09939e2ab2"/><file name="ValidatorAbstract.php" hash="d043c743309f5d64640698953269ece6"/><file name="ValidatorInterface.php" hash="02f543af08eda65263f4b005f3b3bdaf"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AdvancedController.php" hash="0942ed5d83442e97af40d4572c3e21f8"/><file name="ApitokenController.php" hash="f804594b22260cb597cc0e5cfe633093"/><file name="ConflictcheckerController.php" hash="1d23621c640eecf2a813121cfc23850b"/><file name="PermissioncheckerController.php" hash="2e254bd755cd9d05d7eb6865a2ffb0e7"/><file name="RoundtripController.php" hash="efb601f3ceca89885d031f06218b2a4d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6daf92d1a6b994898af427448c6c1e44"/><file name="config.xml" hash="a4e251c636842385f7e9e9a1370ed8b5"/><file name="system.xml" hash="855eb0390cb0a198236cba9383749d54"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bronto_All.xml" hash="5a9c06b6313882589765b9bcf0402bbb"/><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_Reminder.xml" hash="08503ab78994178b822ef9b0add243f9"/><file name="Bronto_Verify.xml" hash="ad72ea2ebfd99dbe2773b2735d0ec973"/><file name="Bronto_News.xml" hash="3496cd7578991889909fbd8daa170d2d"/><file name="Bronto_Reviews.xml" hash="23a398c055d062c4a5e19e72a0c2df95"/><file name="Bronto_Product.xml" hash="2805533fff08aef167af474799bd4faf"/><file name="Bronto_Emailcapture.xml" hash="98b59bbf388d6c715f345b8906bd2fa1"/></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="a61cf5ac4c3ea76b03a71750e085df88"/><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="4ea2880431ac5761cbf7478d809577f6"/><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="17aace21dbebcab84a80091230ca03e9"/><file name="Observer.php" hash="21bc70d405fcd47b0473ac89fd3d4ae2"/><file name="SoapClient.php" hash="81dd0a8a8c15ac96280d2f1b6bb3311e"/><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="bronto.css" hash="ebc2f1ade554e3cad4bf0b091ff674d1"/><file name="cron.css" hash="99b49b9ec245e75b81e62e78605f106f"/><dir name="images"><file name="BrontoGuide.png" hash="be2bb3605cc5f1899ad996fcd2ceae84"/><file name="InstallStatusDisabled.png" hash="5cf8d7dd8ed623f8b38e6ea3ed89861a"/><file name="InstallStatusEnabled.png" hash="11ea6d1f0ba319b62ed1728e9b747108"/><file name="InstallStatusError.png" hash="91fdd0af3ffd20d0b8a77645bb9cfcdc"/><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="bg_notifications.gif" hash="df73b8aa7e48bb56e0a644245aa3683f"/><file name="bronto-mini-off.png" hash="af2c6a5434604db0bb3a2cc4a51b5c77"/><file name="bronto-mini.png" hash="7989c68c0e83b7b04af308780aa82259"/><file name="bronto_contact-mini.png" hash="e221b304ad42cba129a9dcf17ce5180e"/><file name="bronto_contact_import-mini.png" hash="a9e0904f7219be45fd1ed88c5b9a1650"/><file name="bronto_general-mini.png" hash="aca50d84fe324abbb36ff2853d9cad01"/><file name="bronto_help.png" hash="d0ed63d7c68e8b52583ce428b3846afc"/><file name="bronto_news-mini.png" hash="bb8b3beb16c10d8b38ddb11f3f4347e8"/><file name="bronto_newsletter-mini.png" hash="9c45a6dd689ad758cf927cb381621b35"/><file name="bronto_order_import-mini.png" hash="a2b13488fccfdd5b2194843800abadda"/><file name="bronto_reminders-mini.png" hash="c85bafdc82718769c8b801fd64e7bd72"/><file name="guide.png" hash="10c880d9e40f1283f99e02ce2d025a4f"/><file name="logo.png" hash="3b7c4cb9faf220091a5fbae3c7f87afa"/><file name="message_approved.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="message_not_approved.gif" hash="e4f28607f075a105e53fa3113d84bd26"/><file name="section_logo.png" hash="98f2570d14580cee2c6cf66cca540b39"/><file name="site_name.png" hash="fb2cc4e1e00cdc95a94c04fccfa5e1b3"/><file name="support.png" hash="0910e2eb718379d037ead6e0af9c4855"/></dir><dir name="js"><dir name="guider"><file name="README.html" hash="be17cdbc961dc921944cef4e7daa33c3"/><file name="README.md" hash="1c11ec7951035fe0611edded566901a0"/><file name="changelog.txt" hash="4c107fe228a620f6f3118b128e62c0b5"/><file name="clock.gif" hash="12aa3f72e722ac8e5eeb68823024278f"/><file name="component.json" hash="05fe7fcf63c00abd58efa072baa8248f"/><file name="guiders.css" hash="a6df4a6e2d4f3075e29841a6844ee30b"/><file name="guiders.jquery.json" hash="261d2b3a2d3a21e49a0153f0c8f2c3e9"/><file name="guiders.js" hash="42b1675f9d1a93b89d62e97f2db895bb"/><file name="guiders_arrows.png" hash="757812709656e9592d9d724a63624d0d"/><file name="guiders_x_button.jpg" hash="2af6c2b68534a8b2c48d0ddc14a5b801"/><file name="jquery.min.js" hash="0652da382b6fceb033dfe2b6c06d4d11"/><file name="promo_gmail.png" hash="4837435633204a9001b88c2d8ef451ed"/></dir><file name="jquery-1.10.2.js" hash="91515770ce8c55de23b306444d8ea998"/><file name="jquery-1.10.2.min.js" hash="628072e7212db1e8cdacb22b21752cda"/><file name="jquery-1.10.2.min.map" hash="6c3ccfc221d36777d383b6e04d0b8af9"/><file name="jquery-noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir><file name="news.css" hash="84d2866b08b706164c6e545767ff331a"/></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="common"><file name="popup.phtml" hash="996c1d74465c319465bdfd1ee0b5845d"/><file name="recovery.phtml" hash="1967fd5ba3540ce9dd34570057ba4cf0"/></dir><dir name="emailcapture"><file name="js.phtml" hash="37b3d102efdd3685e09822615c72db3e"/></dir><dir name="newsletter"><file name="checkbox.phtml" hash="281d8b8a7a078965f6b8386c5a1c6136"/><file name="js.phtml" hash="c88851be407f642e13d0c563f537e3c2"/></dir><dir name="order"><file name="js.phtml" hash="e398cfbfe9df41feeadb251216422cd9"/><file name="redemption.phtml" hash="4a344720766b9ea957210fbb5059c605"/></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="common.xml" hash="5abd7674010ee88a46cac057eaf5ebfd"/><file name="emailcapture.xml" hash="b5d3b0efc5daffb5fa66561f690013d0"/><file name="newsletter.xml" hash="30e90ef74659bafca7f1cb7d36a63717"/><file name="order.xml" hash="2c74121ed741ca74dbb6958f59cb3d3b"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="bronto"><dir name="api"><file name="guide.phtml" hash="2bd6d0a65c67190e388c18aef0acfcc3"/></dir><dir name="cartrecovery"><file name="guide.phtml" hash="86be232bf3705d4fe83c262fbcbb759f"/></dir><dir name="common"><file name="about.phtml" hash="fa5886d9dba15226eec520916b7c4aa2"/><file name="cron.phtml" hash="80af8ca4a8e2c74449904748aeaf718b"/><file name="guide.phtml" hash="07bcf3ad2e6a9136888bbf4a8bf0b51d"/><file name="guiders.phtml" hash="790ac5e5f8df13753db5ac3e68d08d76"/><file name="suppressed.phtml" hash="3c724d43b2cef9b13532e6d2b8e05f06"/></dir><dir name="coupon"><file name="guide.phtml" hash="3835858f4375e45d8e41b472c466b099"/></dir><dir name="customer"><file name="guide.phtml" hash="14e9b74f62bde430a6df96cf04ee94dc"/></dir><dir name="email"><file name="guide.phtml" hash="c8fe9f3cadf5e50d6f0e69979462c407"/><dir name="template"><file name="edit.phtml" hash="802ef394d1943f18d33d39d0b85dcc3d"/><file name="list.phtml" hash="e9eb7ffc48f9d17a21917d86ff18b0fc"/></dir></dir><dir name="news"><file name="guide.phtml" hash="19026e62d49476371edc4f9e7f68d2c1"/><file name="item.phtml" hash="7146fcc10eeb0bdc33a78ea8fe060f74"/></dir><dir name="newsletter"><file name="guide.phtml" hash="4d4ac3dc42265d9521ec75383da40a10"/></dir><dir name="order"><file name="guide.phtml" hash="831ff327cf49d198bec62ad968587593"/></dir><dir name="popup"><file name="guide.phtml" hash="6bd6240f1402a03dd0d5022b8c39b3ab"/></dir><dir name="product"><file name="guide.phtml" hash="db1f4d377f1026bd187270d6661f0d47"/><dir name="recommendation"><file name="button.phtml" hash="3583ae800ae50fcdee59cff78d2fe1d9"/><file name="default.phtml" hash="b90f72f90eb11e32c0a7c31cf04ee301"/><file name="edit.phtml" hash="74cfbb9a25506210ad1a446dbdaa8e89"/><file name="grid.phtml" hash="51e74eba64b3e2a898114c2ffb42f588"/><file name="preview.phtml" hash="0fbfb3c0834c2103a4e68e6d726c679b"/><file name="selected.js.phtml" hash="9a0e17f82f5745c531a58784c33a9ac9"/></dir></dir><dir name="reminder"><dir name="grid"><file name="container.phtml" hash="28518ad2522f1b213102eb52071ef247"/></dir><file name="guide.phtml" hash="db033c357b5e335b6d65a44fa78c7c7e"/></dir><dir name="reviews"><file name="guide.phtml" hash="d31d5473d270a1b473e50d28f8947d1f"/></dir><dir name="verify"><dir name="advanced"><file name="observer.phtml" hash="775deb643169f76f72793873a258eac1"/></dir><file name="advanced.phtml" hash="8479f4762de8943de234407bbc80b679"/><dir name="conflictchecker"><file name="errors.phtml" hash="91adf7e31ce9ec1ae06c18adb489bf54"/></dir><file name="guide.phtml" hash="664368c479f04ef022e9f0f96b2b9eca"/><file name="installs.phtml" hash="34b6bd602043376f8c17ef7744a27537"/><dir name="permissionchecker"><file name="button.phtml" hash="0a98a58dcb6d28d768e83556e6e690bc"/><file name="errors.phtml" hash="6da7357831323392e3badcb1cc8268aa"/><file name="index.phtml" hash="628a80e9245642cb92cc75a6dd07d1d7"/></dir></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="common.xml" hash="5c9c6512ba73ab619c0417a1c51a28e0"/><file name="email.xml" hash="be77c906770a0d818898a910b03cbe4f"/><file name="news.xml" hash="96d679b735d551a3e83fb71bfe2a7fca"/><file name="reminder.xml" hash="07186394676c6db016d00bdee53e8394"/><file name="reviews.xml" hash="f0d9d6536228329145755af91cb8626a"/><file name="verify.xml" hash="e5676df09f0a79bdedc314e2bfdb4b59"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="shell"><dir name="bronto"><file name="cron.php" hash="675049a8c5b735fcf35ea19e85b593ae"/><file name="fix.php" hash="40b6636ea955d6ccacdd68432776a5f9"/><file name="review_migrate.php" hash="c4d7c4531bc2ac553535e8094da91b95"/><file name="rewrite.php" hash="38f1c593dfc30e60d68f59381fd36d04"/></dir></dir></target></contents>
61
  <compatible/>
62
- <dependencies><required><php><min>5.2.13</min><max>6.0.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.4.2</version>
5
  <stability>stable</stability>
6
+ <license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Drive sales with targeted lifecycle marketing campaigns that convert one-time buyers into repeat customers.</summary>
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>2015-06-01</date>
59
+ <time>17:49:27</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="88e8451ee44cd9e057adda4384a16e8c"/><dir name="Cron"><file name="Error.php" hash="ccaf02afd320c2a60b271bcf728c723a"/><file name="Queue.php" hash="07a829044a251dbfdcc39fcdd0d643b9"/></dir><file name="Cron.php" hash="ff26632f20d0474d45ae0549634b4f7c"/><dir name="Form"><file name="Coupon.php" hash="aeb7bc95aa5404c25679a5dfe165f9fe"/><dir name="Field"><file name="Apitoken.php" hash="48fe102c7d74b7646de1e256f87cfe87"/><file name="Debug.php" hash="6b3e65c774d25184e88c43e7364d68b4"/><file name="Download.php" hash="6521c641550b7c747632fe25dd5982ed"/><file name="Hidden.php" hash="c514ae120d4dced7b92ea30a13f0e4ea"/><file name="Image.php" hash="26ebf8d7eaf01fc8c453156cda795e62"/><file name="List.php" hash="907853b5009661b6b63a3a2947fc9c59"/><dir name="Support"><file name="Site.php" hash="9e0b6acae1053a90a7513a3791ee258c"/></dir><file name="Support.php" hash="f680904d05213ec4d43726b714cf2b69"/></dir><file name="Field.php" hash="932af08da6e8dc20e74e97894b1a2518"/><file name="Fieldset.php" hash="a3d41e7bfc09bd81942c6f32bc1d1782"/></dir><file name="Form.php" hash="557e5db7e358a42dd04fe737b6436393"/><file name="Guide.php" hash="136a2d9269011bbc00296da0d5561379"/><file name="Support.php" hash="be33bc95f1f713205dd11fb59598e166"/><dir name="Suppressed"><file name="Reset.php" hash="50dfcb14e043c3128ac9c33dc14c2951"/></dir><file name="Suppressed.php" hash="064ad003588f58f65d6b827109ea2d94"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Abstract.php" hash="8c082611a7e4131c897ae9f2ed1d6dcf"/><file name="Debug.php" hash="e841017705d9b45a33e8475144ff0587"/><file name="Download.php" hash="78de702f642111af6feb725b4dd0bf08"/></dir><dir name="Queue"><dir name="Button"><file name="Run.php" hash="d05c28fcd3f1ee0fb031ebb9d4fcfe39"/></dir></dir></dir></dir><dir name="Cart"><file name="Recovery.php" hash="6e30e1f4269e1911c74b5a954b627c01"/></dir><file name="Popup.php" hash="37f63a3196ff4e533069753569b83ff6"/></dir><dir name="Helper"><file name="Api.php" hash="29701eb61c78d7d7f2dee1680e7488ff"/><file name="Contact.php" hash="cc8cc8bf771193c9a6764ff3e32ec5df"/><file name="Coupon.php" hash="3b9ef8450dcd629293a9e8dce3a98cae"/><file name="Data.php" hash="87ea3be7675b9f80a52659d6a93f60e2"/><file name="DataInterface.php" hash="d1691f590c315abd3178e769cf51fe2a"/><file name="Field.php" hash="a4978ff9734cc8e4820ba83fb7c399ea"/><file name="Message.php" hash="dd26a41247c43a6b50b34eb2e176f6df"/><file name="Product.php" hash="65a1d59b68d8d80404bdb301362eee9d"/><file name="Salesrule.php" hash="6b7fcccb7b96f27b02ff864e7d9640dd"/><file name="Support.php" hash="0216d55b5c90672e80ab08f4f61cc851"/></dir><dir name="Model"><file name="Api.php" hash="43523a11d232ae8fc2d3cdd85b69f290"/><file name="Archive.php" hash="b613e811bb673c72e6cec6770ed48fa5"/><dir name="Coupon"><file name="Observer.php" hash="dbb4c8c3c5cebf1d519f28eca07d6e01"/></dir><dir name="Email"><dir name="Template"><file name="Filter.php" hash="5c881a34f235160703bb5aab7d654b81"/><file name="Templatefilter.php" hash="2bf78c58ea2c26a0de92090e2bf7a1f9"/></dir><file name="Template.php" hash="cf51e32f0ff50a3bfd1debac517cd129"/></dir><file name="Error.php" hash="5fb58700178e8b79d7a4f62f6ed3e45f"/><file name="Flusher.php" hash="6566be0b204e5207c0dd4fe1cbe47d05"/><file name="Keysentry.php" hash="0199b9ec132359820dab712e657a8c95"/><file name="List.php" hash="7355915bd78f36d18c863f57dc9b4953"/><dir name="Mysql4"><dir name="Api"><file name="Collection.php" hash="9b589f17c2efee2866369d6fd0c73279"/></dir><file name="Api.php" hash="79e25f0be61ef7ce5066c676545ab19d"/><dir name="Error"><file name="Collection.php" hash="cdd8617db0383a5dd23787850c26bfe3"/></dir><file name="Error.php" hash="2959715e0def582a6a0ecdf6f6442701"/><dir name="Queue"><file name="Collection.php" hash="f01c3c398021de80f48482067aa00f83"/></dir><file name="Queue.php" hash="3cdfeee0097797c9fc5955f4e777b2b5"/></dir><file name="Observer.php" hash="62aea449f25d8bd7d0c7b06b49f3f722"/><file name="Queue.php" hash="dd1a478fb4afc7cca11c1f25c67ce8cf"/><dir name="Resource"><file name="Abstract.php" hash="a490783520f05a9e6f20b29320941119"/><file name="Setup.php" hash="5b767cf65fc9a497fb6a407dde5c76f0"/></dir><file name="SoapClient.php" hash="38ea95b32c1271d3ac329979c4f5d7a0"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Cron"><file name="Error.php" hash="38bbbcde58aa89e3f7be043a773feb26"/><file name="Queue.php" hash="4c869a3fcddd597d217f3c3d721ee272"/></dir><file name="Cron.php" hash="744f5d4fbfe19200fd07de86f9021c38"/><file name="Enable.php" hash="2b641958cfa59bd18992a8b92af99301"/><file name="Token.php" hash="1e867298939e9ca55cf5cbc1b7a65c71"/></dir><dir name="Source"><file name="Attributes.php" hash="38e2196286eb891dd2c7dd0da82b66e3"/><dir name="Contact"><file name="Status.php" hash="811a360bffa20b92d4a7bdea66a73168"/></dir><file name="Coupon.php" hash="acfb1c6c7c5d80170bda4a6852c4e140"/><dir name="Cron"><file name="Frequency.php" hash="3ef5bda79548019f9a7cb2007c6792f5"/><file name="Minutes.php" hash="136df1bc4c4723efdbe144ed7a08806e"/></dir><file name="Field.php" hash="42153a25a2552edc898d16b632fe3641"/><file name="Image.php" hash="acb902acd1f8573887ed9d5a00410467"/><file name="Limit.php" hash="a84376a6e570e6929ed653ea2624b146"/><file name="List.php" hash="382c1a3db0f460fbd1442b08dbbf0e6e"/><file name="Message.php" hash="4299d19acb20509e6a3064284327eb8d"/><file name="Related.php" hash="abcdf472699f5857d7755f0423bd27dd"/><file name="Role.php" hash="5a55bad277b8723130035d79d6e5b98b"/><file name="SendOptions.php" hash="b30161eccdcb5fec0f25f41c4f6f3ed6"/><file name="Synclimit.php" hash="7a39c86388440f401437b23aeba2e740"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DebugController.php" hash="475d0fe8b46eb8a85c25d4f511a25196"/><file name="GuidersController.php" hash="8eae4825b247191bd166224ac79ea655"/></dir><file name="CouponController.php" hash="621b110ec7f3a3ef9729ee769f8b875b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1487643f106928738498f9e37a8d5fc9"/><file name="config.xml" hash="ae8598e4bafecc2113e28479ce2241ca"/><file name="system.xml" hash="4902a976082886fa65b730f6f6db14b5"/></dir><dir name="sql"><dir name="bronto_common_setup"><file name="mysql4-install-1.7.0.php" hash="c8459d26fdfea2fb9430e8829b3257e1"/><file name="mysql4-install-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-install-2.3.0.php" hash="f0f0313161b5b70ccd9f05d59f8f5e2b"/><file name="mysql4-install-2.3.1.php" hash="f0f0313161b5b70ccd9f05d59f8f5e2b"/><file name="mysql4-install-2.4.2.php" hash="f0f0313161b5b70ccd9f05d59f8f5e2b"/><file name="mysql4-upgrade-1.7.0-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.0.4-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.0.4.2-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.1.0-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.2.0-2.2.1.php" hash="f2a33e687c2a2ee784c63ca9ba58ad5f"/><file name="mysql4-upgrade-2.2.2-2.3.0.php" hash="a12992a210e88d94ee8a7a601b67e98a"/><file name="mysql4-upgrade-2.3.0-2.4.0.php" hash="ab9575fa7f6fef723f8fae321d34c982"/><file name="mysql4-upgrade-2.4.0-2.4.2.php" hash="ab9575fa7f6fef723f8fae321d34c982"/></dir></dir></dir><dir name="Customer"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="bc63c93b5ff46fe2e6cb84a8c3249d12"/><file name="Cron.php" hash="418068c27078a2a4e56cdc36469f660b"/><dir name="Form"><dir name="Field"><file name="Rewardpoints.php" hash="c1918f7478737dcfba6b543fa006a4bc"/><file name="Storecredit.php" hash="489625264fff9d5a37621f1b80203099"/></dir><dir name="Fieldset"><dir name="Attributes"><file name="Address.php" hash="7871298d7b7410d5202b436a1f536d7c"/><file name="Customer.php" hash="b0060f6c8c71ec321387aa8071a5c483"/></dir><file name="Attributes.php" hash="ac2d13d9a181129592341a3fd022bcaf"/></dir></dir><file name="Suppressed.php" hash="490d859076b067d91edc13eee7b91de8"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Mark.php" hash="0c84d1f0e6ce3867e76d19ac7c451218"/><file name="Reset.php" hash="6dd540765670c2955160365319b9af22"/><file name="Run.php" hash="2b6332568132b633a1ee208e8b555b5a"/><file name="Sync.php" hash="be611c057f18b5da9e31927fc1788365"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="66d6483f8a28c4c8f3dd37b69cbcb9a8"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="5564536b725040d0652cba23e13e546e"/></dir><file name="Queue.php" hash="5aff6d99b2f3bf24cd2db7d0586f96ab"/><file name="Setup.php" hash="cb74c44bd42f407925a800fe3996d7a3"/></dir><file name="Observer.php" hash="d6366a38a98a4308ca66014b2e0077ee"/><file name="Queue.php" hash="18a6f49b28212da7af986a14e12ec8c5"/><dir name="Resource"><file name="Customer.php" hash="86f081e728c9d9f22e28018406d9f601"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Brontofield.php" hash="8f75a714e862b9ab1dfdabc6a3fce986"/><file name="Cron.php" hash="44d12cea40d1342ad065bd4aad936193"/><file name="Newfield.php" hash="92bfe8bc7dffac8c91068754cb92f1ee"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="7600760ed4af3e251efb533b3d3b8471"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bb58fa0df1e07c2d88527fed1920ffc2"/><file name="config.xml" hash="e1a4673cdc939b1177c5ee2e8af678f6"/><file name="system.xml" hash="682080ce412a65f6bb7edf88504e5d45"/></dir><dir name="sql"><dir name="bronto_customer_setup"><file name="mysql4-install-1.0.0.php" hash="871c225318588b2804a05751bce45e1f"/><file name="mysql4-install-1.0.3.php" hash="439f1eee0d34f172197b78b787e1e983"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="1c00e987c9a1b1da70ad035ccdef194b"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="144999a033695bd72601f1f0e10de5e3"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="6e3c57a1c9272aa4b2d7d051a24ed87f"/></dir></dir></dir><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="ab71e0649d5af1fe64f665ada8895be9"/><file name="Settings.php" hash="59f952e7baeff59ef013a9f39572370e"/><dir name="Templates"><file name="Field.php" hash="0b4d17701e352b6c28cd5262d3cd8e0e"/><file name="Fieldset.php" hash="01fa6905eec117df32519c7e461e05f8"/><file name="Label.php" hash="fed0e19a1dde5592ba2efcc3aa6a2bba"/><file name="Sendtype.php" hash="d93029708ba002781e365cb0215022ce"/></dir><file name="Templates.php" hash="5811fe4b83f7dd5d6f0c7c78314cd31c"/></dir><dir name="Email"><dir name="Import"><file name="Edit.php" hash="32d4219613247ff59a59b5031284159c"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="e88588a5f5270301178626632fd1591a"/></dir></dir><file name="Grid.php" hash="68e5bc81c99bc9cb5667384526743ee9"/></dir><file name="Import.php" hash="a2f378383faebc5c0fabcd46feb4d7e3"/><dir name="Log"><dir name="Grid"><dir name="Renderer"><file name="Customer.php" hash="ee83b754d1a91920a79918991aa76ca6"/><file name="Fields.php" hash="dc0d7cbd5065382ccf51ff3f84054563"/></dir></dir><file name="Grid.php" hash="591f4aefd4fa2f7b5f53653f0d7780a7"/></dir><file name="Log.php" hash="755439eace3c8e1f5ee3c657562c476d"/><dir name="Template"><dir name="Edit"><file name="Form.php" hash="c1b63c327ad420f175683b377c8574d4"/></dir><file name="Edit.php" hash="e76c3c82fc3c180041eeeb6251fecbaa"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="543cf476631d073e4de5ec59f1faf5b5"/><file name="Storename.php" hash="c5111a20ed0b3aed0078cecb1ae3d739"/></dir></dir><file name="Grid.php" hash="dd12032078cf00d0c65fc6d9d563492f"/></dir><file name="Template.php" hash="ea39c46962381b34377efa05ecbfa075"/></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="60d8707e923f59ad7af130aa09557be0"/><file name="Data.php" hash="97923779bd8c367d572745d96b030cd5"/><file name="Field.php" hash="fc67415cbe73614fe0bbc29df7f93148"/><file name="Message.php" hash="7f5a80ce2a9a75324f8e5df9b3a318f4"/></dir><dir name="Model"><file name="Log.php" hash="1c9b060a801312c0b929806708a9ac1a"/><file name="Message.php" hash="02bf1f9bef1f4ce1909cc3d5c6331969"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="0cc3245eea5df5ca8607fc4ca8aabf99"/></dir><file name="Log.php" hash="aef3718e6ea1de42152099aeb444782f"/><dir name="Message"><file name="Collection.php" hash="4ad21710a8a2c403e83dcf40ad6eda22"/></dir><file name="Message.php" hash="f225d9ac332aa3b0fea5ff094a336926"/><dir name="Template"><file name="Collection.php" hash="339fb475d2beb88a65051f043a1b73ff"/></dir><file name="Template.php" hash="496380271268f9f949afb2a2ce1bdbf9"/></dir><file name="Observer.php" hash="cd5b5e10dabdc615d77a99cb695d685c"/><dir name="Resource"><file name="Setup.php" hash="137fc32a4feaac09785e30cf31b6092c"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Templates"><file name="Field.php" hash="e6f28eb62a469792eb61ca1044aae764"/><file name="Sendtype.php" hash="18dadd39cdf47f6cdc95e168fe2012bc"/></dir><file name="Usebronto.php" hash="d9c1e9b77810c922b058d5f03f03b02e"/></dir><dir name="Source"><dir name="Email"><file name="Template.php" hash="a55d4003789eed3feebad2251c0484c1"/></dir><file name="Sendtype.php" hash="4cc496295bd5b4c2bf71eae9fd87f803"/></dir></dir></dir><dir name="Template"><file name="Import.php" hash="1a9d9cecebc712f0fef531cbd5923f55"/><file name="Mailer.php" hash="756738104f7212e8da355e002244355a"/></dir><file name="Template.php" hash="1ca5989d7107e3b7a8591f2fe286c8f8"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="System"><dir name="Email"><file name="LogController.php" hash="471e58f342857be6f023527c0a1d2981"/><file name="TemplateController.php" hash="22815e046154c7216adc85fa5411033d"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2343ec1b1ac91db90d522cd64e797aa6"/><file name="config.xml" hash="222577d405742cf03b8d6780a424b086"/><file name="system.xml" hash="46419a7c31b60bd8a1e56a0ebaa2f184"/></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="2824a3ef8b9308e577c792398598e08c"/><file name="mysql4-install-1.1.7.php" hash="f49bc2913b1c2375499f21f2ac9727cd"/><file name="mysql4-install-1.1.8.php" hash="afa3c83fbfe45fc193a7eda4af6afacb"/><file name="mysql4-install-1.1.9.php" hash="4509540dda05675ee192e0330effddd3"/><file name="mysql4-install-1.2.0.php" hash="153fc8a27833bda06046231eb0293230"/><file name="mysql4-install-1.2.1.php" hash="153fc8a27833bda06046231eb0293230"/><file name="mysql4-install-1.2.2.php" hash="153fc8a27833bda06046231eb0293230"/><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="53cf783db35699cdc1fee692752fe8de"/><file name="mysql4-upgrade-1.1.2-1.1.7.php" hash="105868a6253471d3eeeea46c7af18aa9"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="0a4abaf8c787bf656e3163489eb5d29e"/><file name="mysql4-upgrade-1.1.8-1.1.9.php" hash="65b7c540763c1817fef6e4eb1ca6cb9b"/><file name="mysql4-upgrade-1.1.9-1.2.0.php" hash="41aa0b0e87d7f3d97388d5d2733defbd"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="4b67cf347973a21c234d04bd4d0aa904"/><file name="mysql4-upgrade-1.2.1-1.2.2.php" hash="a55f2c77a5b729dcce117aa79ac0db77"/></dir></dir></dir><dir name="Emailcapture"><dir name="Block"><file name="Emailcapture.php" hash="9184205597ec0ff5b30732e39a8cb167"/></dir><dir name="Helper"><file name="Data.php" hash="4968f32e599a6fefe7b6876c486264ba"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="104fe48ab81aa32769c95aae1b4e4988"/></dir><file name="Queue.php" hash="97ad38464595ed8a25aee9148d703e51"/></dir><file name="Observer.php" hash="041d29358d884b6a4444200d3a6e6b00"/><file name="Queue.php" hash="f95570e6972a31e17c9b4eb1d99aad07"/></dir><dir name="controllers"><file name="IndexController.php" hash="2162c4ce867cba627a66ba4c1b549e55"/></dir><dir name="etc"><file name="config.xml" hash="953a38982ad1ad62107558218b78d121"/><file name="system.xml" hash="7f748cfe607ca50519e51f8a9739feef"/></dir><dir name="sql"><dir name="bronto_emailcapture_setup"><file name="mysql4-install-1.0.0.php" hash="ff0cda179382b958d6a566963faae637"/></dir></dir></dir><dir name="News"><dir name="Block"><dir name="Adminhtml"><file name="ItemRender.php" hash="147c1b256abc1a3f0ffc9018d8af713d"/><file name="Redirect.php" hash="0b6928d1529e41c4e2ccc3a415e53bb8"/><dir name="System"><dir name="Config"><file name="About.php" hash="757f06422ff513218a9dfad2ff91cd0d"/><file name="Form.php" hash="853d55a3d7d5e73e87ae09f87f4764b9"/><file name="General.php" hash="8a19eee62442466ff28f23aa782e68c5"/><file name="News.php" hash="4fdda30cd100f4d1b57a74cb38a9b371"/><file name="Releases.php" hash="30f7b23081c69219473326620e6ccd06"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="79dd892352cda62c69ede789dcade61a"/></dir><dir name="Model"><file name="Item.php" hash="e3ce20de8f0422dcf00f389f5491e788"/><dir name="Mysql4"><dir name="Item"><file name="Collection.php" hash="6a79699559ffe750643c3f6da90d0280"/></dir><file name="Item.php" hash="bf9fae7b7e2241259dbdbe83623c3e6e"/></dir><file name="Observer.php" hash="236e8cec018d29f50c4aeff1f23f4880"/><dir name="Resource"><file name="Setup.php" hash="cb9d37d047d535b4928b279623283f30"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AnnouncementController.php" hash="ca98e801e5503b04f4f60286e19edb2e"/></dir><file name="RouteController.php" hash="4819b7cab294e952238e2edb43a73c52"/></dir><dir name="etc"><file name="adminhtml.xml" hash="079a3f745967cc14906151cfcdc2c816"/><file name="config.xml" hash="590d56fb32cdb7460cbff22ab1bffa69"/><file name="system.xml" hash="ecd3a0edd0de407c85bb537a78c2380a"/></dir><dir name="sql"><dir name="bronto_news_setup"><file name="mysql4-install-1.0.0.php" hash="f574c4b2432334d0202d75ef71cb0006"/></dir></dir></dir><dir name="Newsletter"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="b5d17d62df37034cd48ea3022e546724"/><file name="Cron.php" hash="4085792ad95b00e5c49a6d9226c6f1c2"/><file name="Suppressed.php" hash="981094eef35a29b7ee10d9ccf395d975"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Mark.php" hash="fc5b7ca0c406b2677b8af8d19539ffa2"/><file name="Reset.php" hash="a2827fc3f6af2b94e1ed3bcc5989b015"/><file name="Run.php" hash="21e4d1c9eb2c882b967c5de6def6a97b"/><file name="Sync.php" hash="89112c7b858e9031050bcba50527b4d7"/></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Newsletter.php" hash="1366f6fd62a00e52e9f46bc9eb8176c2"/></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="54761b3a9f3b0d02d9ec75809ddf77b2"/><file name="Data.php" hash="b34622a3ed7fd6df8277b4079e763697"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="b9c6858b2045ad66b7c331afba125d19"/></dir><file name="Queue.php" hash="4cf426f02c1e2889b77be9b6a105c91b"/></dir><file name="Observer.php" hash="830db514f5218f71580d5c9a930acae4"/><file name="Queue.php" hash="a9ef5813d95abcd1ee89a0372a0cfeb8"/><dir name="Resource"><file name="Setup.php" hash="1f72a1f56aca455ea0d0289450e9edf5"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="282c40a155af7ea22f646e931fdb6732"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="NewsletterController.php" hash="0a2ba62ab4c23e62111543769a4d8e1b"/></dir><file name="IndexController.php" hash="14ee4d0fb012af23805d6851f4ce567b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="b685d64860bf37a09330bd9f89f5bc3d"/><file name="config.xml" hash="7d184a9f4d100d9c4a8954c14f2b6447"/><file name="system.xml" hash="6d6b708cf242e608d93a141a5709a5d6"/></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="4a779a923947af258688d01143a16362"/><file name="mysql4-install-1.4.4.php" hash="089b40f9419c2fd21af62df207327a20"/><file name="mysql4-install-1.4.5.php" hash="8e97902e5e83992e678ba6144ed130b5"/><file name="mysql4-install-1.4.6.php" hash="74d29bc9655aeafa381ba5dc5f53df69"/><file name="mysql4-install-1.4.7.php" hash="74d29bc9655aeafa381ba5dc5f53df69"/><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"/><file name="mysql4-upgrade-1.4.4-1.4.5.php" hash="c49018730275134d72f0802e1bc4da47"/><file name="mysql4-upgrade-1.4.5-1.4.6.php" hash="7de96310cf9bfe375e3026ed5c934ce2"/><file name="mysql4-upgrade-1.4.6-1.4.7.php" hash="6e40d94220fc0f2305546f7a8d5e754a"/></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="4caacae5f31c84f898be5798cc85b7b7"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="About.php" hash="332c01d15a8b75f9add5988f35519135"/><file name="Cron.php" hash="62d625df775ca2b81503b1c97c4f7e79"/><file name="Suppressed.php" hash="fd39306031d9b20dc050a69afbd32cd0"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Mark.php" hash="beb088031b04ff6b168670efb129b229"/><file name="Reset.php" hash="4d64995d0f43ff3f3829287f8b8780f9"/><file name="Run.php" hash="700e3f9645a9e25e56ae1deb6764bf44"/><file name="Sync.php" hash="2ff1bf077cc56b3620fe87a494d7f770"/></dir></dir></dir><file name="Bta.php" hash="2ec920ce5a6ea57aff16c8d9cf89f7e9"/><file name="Redemption.php" hash="cb6bfc3d06e4f7287c8314f539fce0c5"/></dir><dir name="Helper"><file name="Data.php" hash="46abcc5bc67e8e7b204875811785a315"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Queue"><file name="Collection.php" hash="d041d29b798d10821e041c5b89fb5889"/></dir><file name="Queue.php" hash="2b0ba0993a43cc6856647684ac30add9"/><file name="Setup.php" hash="05b0a2d4806e712410479a3e7c709fd8"/></dir><file name="Observer.php" hash="bcb72af25dd1fc1652c0c62f047c7ea1"/><dir name="Order"><file name="Observer.php" hash="5a05f37813b04968a2274098fdf8b1f7"/></dir><file name="Queue.php" hash="a544dd6bc3525c82cdf98791c49da91a"/><dir name="Quote"><file name="Observer.php" hash="1633b1031f19bdd36145b1040d9d6692"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="9bc2a90d644af8334aa22b952132b08f"/></dir><dir name="Source"><file name="Bulk.php" hash="77b7aa28a1e7912c2a23b45155a46623"/><file name="Description.php" hash="7f497c17388c360f239e2aa90d943b9c"/><dir name="Order"><file name="State.php" hash="8a570c595207a4ea2410372322717339"/></dir><file name="Price.php" hash="283cc883ded57664870d89b22b547b19"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderController.php" hash="6b380e7c6d0905f29812e3a8bcaefc75"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="784d322d920c63e63bed37c50e1c04d1"/><file name="config.xml" hash="9fffc146d55066071d574cfd4160eba2"/><file name="system.xml" hash="07759a0ba254ff1bc632205b0b2b92aa"/></dir><dir name="sql"><dir name="bronto_order_setup"><file name="mysql4-install-1.0.0.php" hash="4988c452cc0d367f34e9c33df0d4256d"/><file name="mysql4-install-1.1.8.php" hash="afd415c7bb5a81b18c6705293f3978e6"/><file name="mysql4-upgrade-1.0.0-1.1.6.php" hash="8b8f5f923c5b9cde9d7dfa7d9e75ddad"/><file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="7c4d2c1feed28b964ea82373e625a11f"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="ae58d4271deb9c60e61214020d46e755"/></dir></dir></dir><dir name="Product"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="f3e3d3f6bca7f3b065e25f22b5578d2e"/><file name="Cron.php" hash="53c81d5081e3d4204694c468eff18c39"/><file name="Information.php" hash="cc968073e785221272c6f924e7105036"/></dir><dir name="Recommendation"><file name="Default.php" hash="907b566bfb4bbe4e1c46749182556d77"/><dir name="Edit"><file name="Button.php" hash="d6685785f649dde452fca3a18c78530d"/><file name="Form.php" hash="e8f4faa97ff7dd334c1c5048c30e850d"/></dir><file name="Edit.php" hash="87c571a236297ce4d9b6e692a4ffa852"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="486077c93f6a3b2dd076bd3c9e7d529c"/><file name="Description.php" hash="2eeb64ad510ac9d4cdbb5edf99211b82"/><file name="Image.php" hash="122e3ae80a3a4c260d09374476174c84"/><file name="Price.php" hash="c4af2d40e24f895bba7681851ec8aec2"/><file name="Url.php" hash="b03b06cf5eea764706db123a4b55aefc"/></dir></dir><file name="Grid.php" hash="a8b024f5a89e2bffdd94db2220392fdb"/><dir name="Message"><file name="Form.php" hash="81f6f8f259e940a82f6626c2b74e89ca"/></dir><dir name="Preview"><file name="Form.php" hash="4c24d8207c53bca40dd7760c2402d9c6"/><file name="Grid.php" hash="e638266ee7e7c523b747bfb25fb834c2"/><file name="GridElement.php" hash="251201019431ab9596778b0290c71395"/></dir><file name="Preview.php" hash="abc472e9d896a6f417b2ffaa735ce373"/><dir name="Selected"><file name="Grid.php" hash="843022c5636af8e962503e53479f15c0"/><file name="Js.php" hash="dba81b98bd95dbebd22709efc1a3655c"/></dir></dir><file name="Recommendation.php" hash="121626c24b44ad88a918db07f97cfa66"/></dir><dir name="Widget"><dir name="Button"><file name="Run.php" hash="fe948d6a6a08f2876eeccd7db0c3a8b5"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="c881a436bf03ce77b9506edf112fb4f7"/></dir><dir name="Model"><dir name="Collect"><file name="Abstract.php" hash="d91208de5e721412953683696b797d58"/><file name="Bestseller.php" hash="0a17a37ca8c00e5ee09c310604d2f817"/><file name="Crosssell.php" hash="3479888fc18d4160ee7695ac5fd4face"/><file name="Custom.php" hash="fdebb77a3ab630498c605bc028f370ac"/><file name="Mostviewed.php" hash="5545b099befbb7e76ef5ae71ec918dc9"/><file name="New.php" hash="da42c2190202e931a46f9730398b42fe"/><file name="Recentlyviewed.php" hash="2e5c66216ccd815a9a90e33994cc0f9a"/><file name="Related.php" hash="bed15693d124080b58efe577517f7815"/><file name="Upsell.php" hash="d34c4852b4729fed13e34191f7e43671"/></dir><file name="Collect.php" hash="9e0fbec2533bd5f9b50f7dd5a8f0e67a"/><file name="Content.php" hash="da798d9df324c6919460983f8c2e378b"/><file name="Filter.php" hash="b52b98c7cd452bfdc779b70deb09eafa"/><dir name="Mysql4"><dir name="Recommendation"><file name="Collection.php" hash="92ae6f624c68d971439d16c79e3e1d08"/></dir><file name="Recommendation.php" hash="e99ebd40f8c942a33b743ad276db23c7"/></dir><file name="Observer.php" hash="7d9ecf7aed4e1c851e8b54dbcc857d87"/><file name="Recommendation.php" hash="50a473fd05c4871da36eb09b0a0f68e9"/><dir name="Resource"><file name="Setup.php" hash="336419abffb7d42a7a5c448c22242fdb"/></dir><dir name="System"><dir name="Config"><file name="Cron.php" hash="df7c9a3ff5318013f9afa0148d41fe84"/><dir name="Source"><file name="Recommendation.php" hash="479472b2ed049a745c12c6f499f13cc9"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RecommendationsController.php" hash="7b965a9de3ffcd816b4b9ef315b5dc77"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="e8eeed8f3589872c7e6e374557cfc613"/><file name="config.xml" hash="2e7dd871d1364b24106579513a341d2c"/><file name="system.xml" hash="8b2714eba1acaff27c046b082d9d97c8"/></dir><dir name="sql"><dir name="bronto_product_setup"><file name="mysql4-install-1.0.0.php" hash="d04672913acece60326290535f677514"/><file name="mysql4-install-1.0.1.php" hash="d04672913acece60326290535f677514"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="f7d62d97c57094418e943c62aebe9296"/></dir></dir></dir><dir name="Reminder"><dir name="Block"><dir name="Adminhtml"><dir name="Delivery"><dir name="Grid"><dir name="Renderer"><file name="Customer.php" hash="be1537b58943a2cc27982deb03ec9e39"/><file name="Fields.php" hash="04f0dc7c4a24769cfc68f1508e0d338b"/></dir></dir><file name="Grid.php" hash="472fa8302dae712fbf9a6b6f5ea80dd0"/></dir><file name="Delivery.php" hash="b0bd1dcede57f8dad8ba4416b26d3986"/><dir name="Promo"><file name="Notice.php" hash="437ce674b25c14e33e17e09a0d471176"/></dir><dir name="Reminder"><dir name="Edit"><file name="Form.php" hash="2db520c0f438affbf477801ddde7f9cf"/><dir name="Tab"><file name="Bronto.php" hash="f6e00c29ad55d22ac0936c51c626c9cd"/><file name="Conditions.php" hash="71d7c0a13352ec3d5b19b6bc059238bb"/><file name="Customers.php" hash="2ba680131f4b31175c7425c0648c6807"/><file name="General.php" hash="eb05a598a2eafd88d2a199c286b11836"/></dir><file name="Tabs.php" hash="106e44febc4b6a7a3928c5dec68d6123"/></dir><file name="Edit.php" hash="783ca6f21744c56da930fd44ddc6e3a5"/><file name="Grid.php" hash="c87a852ef998ea17af709c0221abd15d"/></dir><file name="Reminder.php" hash="a55e63b29f9cafd9053696f60ffe993f"/><dir name="System"><dir name="Config"><file name="About.php" hash="8380b5e750fe0f2b5b95407c99d2e195"/><file name="Cron.php" hash="84100d0bffc2e16d84bc24577ba9c6bf"/><file name="Settings.php" hash="5d0042b1b2ad5df43856c0a68d63b3b4"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Email.php" hash="bcc3abd5bbbb5e8f6e19454850d2e8dd"/><file name="Id.php" hash="c35c0feeac92dce912bb8e3ad2cc7e6e"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="4b3e67cf3a0ce095ca454fe4513c6e89"/><file name="Data.php" hash="240771ed9bd56278eb99731e29b9bfca"/><file name="Message.php" hash="b65f0a4095ab4671c57a26451b3cc524"/></dir><dir name="Model"><dir name="Condition"><file name="Abstract.php" hash="3e164c6f67c1ca26c0be533cd9fc1b0c"/><dir name="Combine"><file name="Abstract.php" hash="2a43ca00f8bc4ab36bc87654ad9c6191"/></dir></dir><file name="Delivery.php" hash="41c3912dc5b5cb28d828358c1e0f7bc4"/><dir name="Email"><file name="Message.php" hash="1e3ef096ba76f5422a97ede324432a63"/></dir><dir name="Mysql4"><dir name="Customer"><file name="Collection.php" hash="6ea153cef5d24b727519cda57d2e6acb"/></dir><dir name="Delivery"><file name="Collection.php" hash="1247c3f58061d41f66ee6b9483c200ca"/></dir><file name="Delivery.php" hash="3639d2739b29734ba8aa8950e67e9621"/><dir name="Rule"><file name="Collection.php" hash="a99264c81d15780f305b02cde1564461"/></dir><file name="Rule.php" hash="beee42ebadb7d20371dd06a23f5adae6"/></dir><file name="Observer.php" hash="299bca8979d361a027fe4ac1598df2f4"/><dir name="Resource"><file name="Setup.php" hash="71ad578ef666cd9810bad2ab8d854bed"/></dir><dir name="Rule"><dir name="Condition"><dir name="Cart"><file name="Amount.php" hash="b1bd2bd9aabb863184461b0594dad9b0"/><file name="Attributes.php" hash="74cfde1032d8d75241f7522ddc12e11d"/><file name="Combine.php" hash="660f6842b8c1a5acff2c3b4f12fc73a9"/><file name="Couponcode.php" hash="84ef3ecb8bcd57412af80a0d137335bb"/><file name="Itemsquantity.php" hash="50eae47f28bf3660ee0684c9037f5bf8"/><file name="Sku.php" hash="12a7af32e16e21d2a2e4e157c469d1e5"/><file name="Storeview.php" hash="c2310efcb3060e91bf2aab73b0ac8ca9"/><file name="Subcombine.php" hash="c8ad5b2c46116793e2f2df17fe0862c0"/><file name="Subselection.php" hash="0142065f76b4e24ec75b6685eea82642"/><file name="Totalquantity.php" hash="8e492fb70a94549b8d6adbc50b2a4e50"/><file name="Virtual.php" hash="cd12a3218daf4a447b4fd49141101305"/></dir><file name="Cart.php" hash="4d534abf3f1cf1459fe6713788efe66e"/><dir name="Combine"><file name="Root.php" hash="eb4b22b6554b507b61f3e6be30048b07"/></dir><file name="Combine.php" hash="2f15f1241aa71fd76bb511415c6882a3"/><dir name="Wishlist"><file name="Attributes.php" hash="0ecf162a2fc4225ce37de714da9e6210"/><file name="Combine.php" hash="279af17bec3eeb6a97243a93eb4e3f85"/><file name="Quantity.php" hash="8de8793029340cb8c813e0cf034f372d"/><file name="Sharing.php" hash="ad302122deb2065aa28b68748cfae492"/><file name="Storeview.php" hash="83716681ba30c6d4c48dada3a0973971"/><file name="Subcombine.php" hash="4804ad602e3cc622dbfcab4030dff1c2"/><file name="Subselection.php" hash="68d96f6943becdc728f2aa436a8ac4c7"/></dir><file name="Wishlist.php" hash="f5c474dd7b126d69a3e0f7000abd3a95"/></dir></dir><file name="Rule.php" hash="dfc573a119a05809d468cf555bc03390"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Allowsend.php" hash="61965e981ddd79976f0ee21b01e6a0ae"/><file name="Cron.php" hash="6e527885884985fca33236f40a7f3689"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeliveryController.php" hash="d4630eff20209e0d46b08a29b543979a"/><file name="RemindersController.php" hash="6cd60b0a9c33075640c5926d94a78405"/></dir><file name="LoadController.php" hash="5c17854f6da03cce7658ae9f6b558c7d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="baaae901f8ff9d2ab12b0158ed5a4ca7"/><file name="config.xml" hash="1803dc082d4ff31d2a653c8c5cf25e89"/><file name="system.xml" hash="794fa3826fa84526997e4f8c3ef2e4ef"/></dir><dir name="sql"><dir name="bronto_reminder_setup"><file name="mysql4-install-1.4.12.php" hash="eae3eb4a69de44df200c52001783a4f0"/><file name="mysql4-install-1.4.13.php" hash="12419b6117a9e0e10f565453feed8740"/><file name="mysql4-install-1.4.14.php" hash="be67c1c55e1781c652d0036984fd0866"/><file name="mysql4-install-1.4.15.php" hash="f2bc98906fc36bf0640b292851ab99e1"/><file name="mysql4-install-1.4.16.php" hash="e34c42b202a7435abe2fa46f01bde257"/><file name="mysql4-install-1.4.17.php" hash="26c94634150797a07af197a4a81f45f8"/><file name="mysql4-install-1.4.18.php" hash="00c690a98400102491ab8f998902960b"/><file name="mysql4-install-1.4.2.php" hash="07b5a7b8ef247def75617e92738f0950"/><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.12-1.4.13.php" hash="172b48942497efd2305eff260bc28d9c"/><file name="mysql4-upgrade-1.4.13-1.4.14.php" hash="3218dae864cac00ff74655160ad31663"/><file name="mysql4-upgrade-1.4.14-1.4.15.php" hash="2e842e4c18259590cdafd2139dd4eb7e"/><file name="mysql4-upgrade-1.4.15-1.4.16.php" hash="671f39e2f90faf1165d50b517be8e04f"/><file name="mysql4-upgrade-1.4.16-1.4.17.php" hash="d789e8fbb7e9dad163643b7b7d2f37b1"/><file name="mysql4-upgrade-1.4.17-1.4.18.php" hash="e80e8b4e0856af9bb2105c786eb99ee6"/><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="Reviews"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Abstract.php" hash="3bed66cfc7fa08358689299710826822"/><file name="Caretip.php" hash="3b18b5be0df73c006d6744ebf87fbfc5"/><file name="Reorder.php" hash="4fc01c619252f25c2f38607acd5bdaaa"/></dir></dir></dir></dir><dir name="Reviews"><file name="Delivery.php" hash="e5dde6fc2d949812bcbbe71ec74e8cca"/><dir name="Form"><file name="Abstract.php" hash="cd621c8bcd6249be74a4f1b166eb6eeb"/><file name="Caretip.php" hash="b8487305d93c4eebfbd4ae52eb4a5021"/><file name="Reorder.php" hash="5f402890386bf6f4f698cb1c15c83841"/></dir><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="9772c271c5fbb9e6d732ca96a90b602c"/><file name="Order.php" hash="c4c1549d9c8848207de6801866d2a790"/><file name="Product.php" hash="274e7ff5c86adccc850cc174df0a0f49"/></dir></dir><file name="Grid.php" hash="907429dc104e71ead6a53445d20173c7"/><file name="Typer.php" hash="9b9b9783a2f33ca31638c940fba83297"/></dir><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><dir name="Post"><file name="Purchase.php" hash="31ac1dabea3ec76bf0ba0f2bd01f2ae1"/></dir></dir></dir></dir></dir><dir name="System"><dir name="Config"><file name="About.php" hash="b62835e11224c3e8cb7256715d145814"/></dir></dir></dir></dir><dir name="Helper"><file name="Contact.php" hash="a85da1e1cc10dd48ac88b84d91cb9a1d"/><file name="Data.php" hash="addf95ab338da5e5cd2c2152f1eeaaf0"/><file name="Message.php" hash="df3015f886b4dd283d280cf26ee69cc7"/></dir><dir name="Model"><file name="Log.php" hash="6d60712195958708ef4f89e59871bbf6"/><file name="Message.php" hash="50542a5b6db10e3a7fab5445c4a3600f"/><dir name="Mysql4"><dir name="Log"><file name="Collection.php" hash="4ffa6e9e2ce58805c19b3358062c68f0"/></dir><file name="Log.php" hash="b755cddb0b8827e5517402223b740815"/><dir name="Post"><dir name="Purchase"><file name="Collection.php" hash="58f2786d8436c66e453d50376b7bf969"/></dir><file name="Purchase.php" hash="2b6a01151a5d551dfe07442f3860ff86"/></dir><dir name="Queue"><file name="Collection.php" hash="76c646f42045cdc209e1a3487d69436a"/></dir><file name="Queue.php" hash="069d32dfa162f3ceca48aa85ceded03c"/></dir><file name="Observer.php" hash="418d9115146071629a6cc9b3c480c430"/><dir name="Post"><file name="Purchase.php" hash="afef25c85f0978430d8c3b1c5324a555"/></dir><dir name="Process"><file name="Context.php" hash="781abce4f8ada1a39808c7527f92e98f"/></dir><file name="Queue.php" hash="841ccaa124236a203c89bce120183537"/><dir name="Resource"><file name="Setup.php" hash="5a0fd912d40b0feb2260fe8c426b9bdf"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Hours.php" hash="4f249b60a8e753b6f052eb85349d4436"/><file name="Identity.php" hash="50db4cbe29f4d79f78e69fd961eaa7bc"/><file name="Message.php" hash="9a5e15326017cbebd7b59b5c80693685"/><file name="Orderstatus.php" hash="a6df006770b4e732ddb75e0d22bfa6fd"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PostpurchaseController.php" hash="5bbd132ee44c0c56c06235b9c0f06dbf"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="751e6e96c1dc6287ac558dae15e94fd8"/><file name="config.xml" hash="34a124317dfcd4bd779e7d38900ce316"/><file name="system.xml" hash="131ac89e2df8e5f0cd577bc6f4d86ead"/></dir><dir name="sql"><dir name="bronto_reviews_setup"><file name="mysql4-install-0.0.1.php" hash="b3a6870f118426b57d1d71ebb55f2994"/><file name="mysql4-install-0.0.2.php" hash="692022168a3f54e94bf9520279842986"/><file name="mysql4-install-0.1.0.php" hash="5a9cc972bae0a0ae32cd4847b18ec73a"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="47646fea020e6b14feccb0407b3a94b8"/><file name="mysql4-upgrade-0.0.2-0.1.0.php" hash="966a8efde0345cebe7c6f783d6dd4987"/></dir></dir></dir><dir name="Verify"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="About.php" hash="2790ac02ba8b5f1b1e42c5dce0e5f312"/><dir name="Advanced"><file name="Observersearch.php" hash="a6983a02e204e1aa86848813ba4bfe73"/></dir><file name="Conflictchecker.php" hash="6931883320051f467af47237ed380819"/><dir name="Form"><dir name="Field"><file name="Apitoken.php" hash="fbcfc38011d777e8ed23194467a14a7a"/><file name="Button.php" hash="7041c0e923d9929796597160679bc94c"/><file name="Classpath.php" hash="4164fd70f7d6e0a777a476c49f46378d"/><file name="Conflict.php" hash="6928704ae346db6dd308b7813f2f861e"/><file name="Events.php" hash="26903c8ebaae7b64aa1146262d567107"/><file name="Index.php" hash="612cf825df2f10c0d4d00ac54f413aba"/><file name="Roundtrip.php" hash="75fa1a82c5112c630afc1f992e6e0552"/></dir><file name="Magecron.php" hash="109e8427d968973ec3d4b0e5de6e4064"/><file name="Permission.php" hash="e5185de6bc1976ee7497956cc9162a17"/></dir><file name="Installs.php" hash="98d3da4c58b317c0ae1eed0aa8a0b63f"/><file name="Permissionchecker.php" hash="445244a71368f50814f4f1eed865b5e5"/></dir></dir><dir name="Widget"><dir name="Button"><file name="Classpath.php" hash="70db18f460c81d2247ed90c2a0bb7213"/><file name="Conflict.php" hash="0f42bb864122ab034320c35a8409b951"/><file name="Events.php" hash="69d441ca2504b4b17793f2eb5763b7ef"/><file name="Permissions.php" hash="68eb92e7649d4f65bdc9c6b794adc97e"/><file name="Runroundtrip.php" hash="44e193ef0edabb5b3e9c7a9e75947468"/><file name="Runtoken.php" hash="9aa3b16aaf5e6110586758406bd3d3f1"/></dir></dir></dir><file name="Conflictprinter.php" hash="8c2886fe329724e869a3693b91eb3341"/><file name="Permissionprinter.php" hash="39ca6a66f041327851b417076e2e0763"/></dir><dir name="Helper"><file name="Apitoken.php" hash="482a0aca45e90c231f324e116b0e3a39"/><file name="Conflictchecker.php" hash="4807ae1112af3aead25e269e497506bf"/><file name="Data.php" hash="d3dbd2307c4d873d0b43d598a35ad728"/><file name="Permissionchecker.php" hash="80e73e34d864b2d780f8cd3215a98e27"/><file name="Roundtrip.php" hash="09951849fa48b10c0f5fca5e79066ffe"/></dir><dir name="Model"><dir name="Config"><file name="Blocks.php" hash="7a881e09e0f2c18a2cbe9e0287f3b9bf"/><file name="Checker.php" hash="233336dc5f140d9890798b9a44047f50"/><file name="ConfigAbstract.php" hash="6d08d6d40af07e143f4fef762c64d84b"/><file name="ConfigInterface.php" hash="a99be958735b2aa6bbddbd8021024a06"/><file name="Datastore.php" hash="2bb9d912ff931f6f932be475f12fe407"/><file name="Helpers.php" hash="c2546e31e51bf39929e129932bd9fe2f"/><file name="Models.php" hash="c2d3448808613b0273cd6f7f890f17b6"/><file name="Printer.php" hash="9c3e7e626041b95238e0f67bd0d95f1b"/><file name="Resources.php" hash="e467e8cc47d72b7e49a1522a523093ee"/></dir><dir name="Contact"><file name="Builder.php" hash="078042707348ef9dc57840bcab27b564"/></dir><dir name="Core"><dir name="Config"><file name="Base.php" hash="7cd9c1f3c5db60fbdb1cdc1f7d3a0c96"/><file name="Element.php" hash="15b5a29de9ca808da05d8ec58642502d"/></dir><file name="Config.php" hash="d65ed16bbc441f8f5bcf33d23516054e"/></dir><dir name="Lib"><dir name="Varien"><dir name="Simplexml"><file name="Config.php" hash="a057d216ec0ae5bca64dcf95615908bd"/><file name="Element.php" hash="56aa78c6e16ccc3b9275f16a108540e6"/></dir></dir></dir><dir name="Mysql4"><dir name="Core"><file name="Config.php" hash="7fc775d92c78892bb37d365b344bf52b"/></dir></dir><dir name="Path"><dir name="Locator"><file name="Array.php" hash="4a7ab9df2ee0c28fc466cf819317e84b"/><file name="Factory.php" hash="4e66f2684a5b5de1d88d924c1119de6e"/><file name="IteratorAbstract.php" hash="dccd796bf58507e2a6ebb6dfda129a8c"/><file name="LocatorInterface.php" hash="980f225fc4aa1a18ce7185b77b6c5d41"/><file name="Stack.php" hash="5e357e88b51642f4c914a29f2d9886a4"/></dir></dir><dir name="Resource"><dir name="Core"><file name="Config.php" hash="db3f4135c5f52dd57096b559b971be4c"/></dir><dir name="Db"><file name="Abstract.php" hash="4cb24a1cd1bce572265d4bd664ead0d7"/></dir></dir><file name="Roundtrip.php" hash="937e3fe99fdb8114523dff3053ed005e"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Magecron.php" hash="ba8b8f5ef43bed77ed03dba3e98df1df"/></dir><dir name="Source"><file name="Classtypes.php" hash="772cab11a7470a2dd68ece3688c68d6a"/><file name="Wsdlcache.php" hash="b7d9c1c4d271c03a7486fc86eec3b6d9"/></dir></dir></dir><dir name="Validator"><file name="Checker.php" hash="398352b4b1e89214ee1f08e355ab18fe"/><file name="Directory.php" hash="d45b6a097aac3776473e99616c42dafa"/><file name="File.php" hash="7bb22ae1b05422aa984a7341bfa02678"/><dir name="Filter"><file name="PatternIterator.php" hash="6fd21a0f56d01c194478ce32ab1bf69b"/></dir><file name="Group.php" hash="7e5be8465c62884492911c0497b57da1"/><file name="Owner.php" hash="769ebe00872fec34db512121360f9558"/><file name="Printer.php" hash="9e17e3e63bfef1a825091ec51d97b364"/><file name="ValidatorAbstract.php" hash="77ab1c7128dca518555da9bb2e51aec0"/><file name="ValidatorInterface.php" hash="11b4ac4c9dfcdb50a0a6e3265417e1a5"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AdvancedController.php" hash="0569f41c0592674e71929f35aa27fdf2"/><file name="ApitokenController.php" hash="8d8d1558a358abb63089cb550c817067"/><file name="ConflictcheckerController.php" hash="143520b8f3f02016657de0da0368a306"/><file name="PermissioncheckerController.php" hash="9bd80716fd83de4127cc8a8630f94077"/><file name="RoundtripController.php" hash="ced4c9274f314180ca33b657b53ae66c"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bc768007763a69afd67db7de7fd722f1"/><file name="config.xml" hash="0273f84e28eb6d959d776dc62c1f1fb1"/><file name="system.xml" hash="2457f372252012ff038b6714132032a9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bronto_All.xml" hash="5a9c06b6313882589765b9bcf0402bbb"/><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_Reminder.xml" hash="08503ab78994178b822ef9b0add243f9"/><file name="Bronto_Verify.xml" hash="ad72ea2ebfd99dbe2773b2735d0ec973"/><file name="Bronto_News.xml" hash="3496cd7578991889909fbd8daa170d2d"/><file name="Bronto_Reviews.xml" hash="23a398c055d062c4a5e19e72a0c2df95"/><file name="Bronto_Product.xml" hash="2805533fff08aef167af474799bd4faf"/><file name="Bronto_Emailcapture.xml" hash="98b59bbf388d6c715f345b8906bd2fa1"/></dir></target><target name="magelib"><dir name="Bronto"><dir name="Api"><file name="Exception.php" hash="2c8d6a86362c5b48dfd922071d4a8c85"/><dir name="Model"><file name="Contact.php" hash="d3a8ab194c54f657b9ba3605853f67ef"/><file name="Delivery.php" hash="ece62028bcb1eb09abe8801fa13e2155"/><file name="DeliveryAbstract.php" hash="33c438cad32a7948d5c408c68e756284"/><file name="Field.php" hash="29a0e8c2fdac1d91884515393b519d42"/><file name="Message.php" hash="4a2809047e132e64f02a6ff01709aaf4"/><file name="Order.php" hash="b62836d2676b7bed79177191cace5682"/><file name="SMSDelivery.php" hash="f116bd6192ab10ebb1f235383907ecf4"/></dir><file name="Object.php" hash="0015dea620b12755dfe2939db5737bf4"/><file name="Observer.php" hash="74fd76ad7e6a184e2ee568f8deaa7557"/><dir name="Operation"><file name="Account.php" hash="0bb024f37da29bf76838d8b041bd498e"/><file name="Activity.php" hash="877e35a43fa1fcdaf1eb9ecf9480cd80"/><file name="Contact.php" hash="a9ec7c94ae57d4e9ce0765deaefee11f"/><file name="ContentTag.php" hash="d3c9b16720ea84e12e6d23f613670d12"/><file name="Conversion.php" hash="d9d355e48131b36351585516e0974c21"/><file name="Delivery.php" hash="c8d2e4c692c20bcc287e661ed2464547"/><file name="DeliveryGroup.php" hash="c8f6aed24529016204a48de844cb21dc"/><file name="HeaderFooter.php" hash="3366eacc26bf0143f8d7c5128c20ff85"/><file name="InboundActivity.php" hash="d1d822f7d44c208aa81fb223e23a2882"/><file name="MailList.php" hash="4238a18f472c07171c1ae6b7157fb43f"/><file name="Message.php" hash="0783e59b6948c4a31adfb065222f0ced"/><file name="Order.php" hash="9cf92768f7d7c194fce99e7370a05431"/><file name="OutboundActivity.php" hash="fda3b68c6859112927b5f6dcb9c5b108"/><file name="SMSDelivery.php" hash="d794790f7defe45cc0e55322ecf07fc9"/><file name="SMSKeyword.php" hash="997ab695ac47f637a111592ab46a6920"/><file name="SMSMessage.php" hash="c6049d37c6cd56b283f4cfaf55646fa5"/></dir><file name="Operation.php" hash="85bed29602bd2b4b44ef4142c2d1f2ea"/><file name="Options.php" hash="a0de11fa70bf55d42def00c3ae0c67af"/><dir name="Read"><file name="ByDirection.php" hash="00bbbc61a4ff2f322e9465c357e469d6"/><file name="ByPage.php" hash="56e71a21d1221d855ede725a1ba8e608"/><file name="Filter.php" hash="394e9ffc0f46224a22175e4fb5d0826d"/><file name="Pager.php" hash="2f19a04d8e9b9ea0c5c2f822120b82e1"/><file name="Transform.php" hash="1f6faf449dafdfe23722f5b73ff537da"/></dir><file name="Read.php" hash="01102be9ecced066334268055a329ecc"/><file name="Request.php" hash="3926df3facd087eebd8c74d3afe26122"/><file name="Retryer.php" hash="104fe80d1422e3ec99552f5692c035d7"/><dir name="Strategy"><file name="Error.php" hash="8c5d3cfdf9ec4cbfd59cfd10b55dbc44"/><file name="Standard.php" hash="5adb922ba5b168d0543f6b80b03207bd"/></dir><dir name="Write"><file name="Flusher.php" hash="c62e368c5907fabfdcac656a116f6c66"/><file name="Overflow.php" hash="e69802c407d0bab1357016f9800cdfac"/><file name="Pager.php" hash="d918dbe53be67756c104fbe07e87fdf0"/></dir><file name="Write.php" hash="0100e3ff0291514ce5f0f8459ec532f6"/></dir><file name="Api.php" hash="7ce6b8e53fe75db41906ef7b42be671e"/><dir name="Functional"><file name="Monadic.php" hash="d8f4d01f275d2692dc8ea00ae0b490be"/><file name="None.php" hash="686e25a1b884e356e51d65be15b8e27d"/><file name="Option.php" hash="138dccac31bdbd928ebdfdba2767618a"/><file name="Some.php" hash="f04193b0a44151c1d99223230c03f2fd"/><file name="functions.php" hash="1eadeafb7568ea12c6c883b40432b60b"/></dir><file name="ImportManager.php" hash="6f0079ab56f864fafa2f841ce2ed0d78"/><file name="Object.php" hash="d3d27d53d72c43fc090fb82addd41cc6"/><dir name="Resource"><file name="Proxy.php" hash="5382a251817b178f99048190c546b56e"/></dir><dir name="Serialize"><file name="BiDirectional.php" hash="b201a6572aea07b931f57008ed728c6c"/><file name="Decode.php" hash="18cbd7039e289d01101e0655e084c988"/><file name="Encode.php" hash="eda82d17430009d304d5a9ec6422b154"/><file name="Exception.php" hash="4d6451e69e9afdcd3906871de39c412f"/><dir name="Json"><file name="Standard.php" hash="7320f1551e85a5b2473dd789e122c401"/></dir></dir><dir name="Transfer"><file name="Adapter.php" hash="500dbca93f201f8f480983a985d45e4b"/><dir name="Curl"><file name="Adapter.php" hash="175f8c0262dd77bb98c95b1fe73df704"/><file name="Multi.php" hash="7e63bd3ab3a60ad12b83738860cc28ad"/><file name="Request.php" hash="5be46df7e53c5b2c680ac0e54a26b8c4"/><file name="Response.php" hash="3e9320974fd30d956b1643d30a575e4f"/></dir><file name="Exception.php" hash="58b3eb6b8ce8d16cc81c3a6c02679060"/><file name="Headers.php" hash="1c04fca41b0112f7f7c11d5eff86ef3f"/><file name="Request.php" hash="23c38990c8ca8846ba152d22e4eb323c"/><file name="Response.php" hash="f321d123cb2027070174421efdec5ef8"/></dir><file name="Utils.php" hash="03c0ced03e3c09efbf792e65b453a56d"/><file name="functions.php" hash="d59df2c8c45ba6e7393b57f7759379ad"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="bronto"><file name="bronto.css" hash="ebc2f1ade554e3cad4bf0b091ff674d1"/><file name="cron.css" hash="99b49b9ec245e75b81e62e78605f106f"/><dir name="images"><file name="BrontoGuide.png" hash="be2bb3605cc5f1899ad996fcd2ceae84"/><file name="InstallStatusDisabled.png" hash="5cf8d7dd8ed623f8b38e6ea3ed89861a"/><file name="InstallStatusEnabled.png" hash="11ea6d1f0ba319b62ed1728e9b747108"/><file name="InstallStatusError.png" hash="91fdd0af3ffd20d0b8a77645bb9cfcdc"/><file name="ajax-loader-tr.gif" hash="1ae32bc8232ff2527c627e5b38eb319a"/><file name="bg_notifications.gif" hash="df73b8aa7e48bb56e0a644245aa3683f"/><file name="bronto-mini-off.png" hash="af2c6a5434604db0bb3a2cc4a51b5c77"/><file name="bronto-mini.png" hash="7989c68c0e83b7b04af308780aa82259"/><file name="bronto_contact-mini.png" hash="e221b304ad42cba129a9dcf17ce5180e"/><file name="bronto_contact_import-mini.png" hash="a9e0904f7219be45fd1ed88c5b9a1650"/><file name="bronto_general-mini.png" hash="aca50d84fe324abbb36ff2853d9cad01"/><file name="bronto_help.png" hash="d0ed63d7c68e8b52583ce428b3846afc"/><file name="bronto_news-mini.png" hash="bb8b3beb16c10d8b38ddb11f3f4347e8"/><file name="bronto_newsletter-mini.png" hash="9c45a6dd689ad758cf927cb381621b35"/><file name="bronto_order_import-mini.png" hash="a2b13488fccfdd5b2194843800abadda"/><file name="bronto_reminders-mini.png" hash="c85bafdc82718769c8b801fd64e7bd72"/><file name="guide.png" hash="10c880d9e40f1283f99e02ce2d025a4f"/><file name="logo.png" hash="3b7c4cb9faf220091a5fbae3c7f87afa"/><file name="message_approved.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="message_not_approved.gif" hash="e4f28607f075a105e53fa3113d84bd26"/><file name="section_logo.png" hash="98f2570d14580cee2c6cf66cca540b39"/><file name="site_name.png" hash="fb2cc4e1e00cdc95a94c04fccfa5e1b3"/><file name="support.png" hash="0910e2eb718379d037ead6e0af9c4855"/></dir><dir name="js"><dir name="guider"><file name="README.html" hash="be17cdbc961dc921944cef4e7daa33c3"/><file name="README.md" hash="1c11ec7951035fe0611edded566901a0"/><file name="changelog.txt" hash="4c107fe228a620f6f3118b128e62c0b5"/><file name="clock.gif" hash="12aa3f72e722ac8e5eeb68823024278f"/><file name="component.json" hash="05fe7fcf63c00abd58efa072baa8248f"/><file name="guiders.css" hash="a6df4a6e2d4f3075e29841a6844ee30b"/><file name="guiders.jquery.json" hash="261d2b3a2d3a21e49a0153f0c8f2c3e9"/><file name="guiders.js" hash="42b1675f9d1a93b89d62e97f2db895bb"/><file name="guiders_arrows.png" hash="757812709656e9592d9d724a63624d0d"/><file name="guiders_x_button.jpg" hash="2af6c2b68534a8b2c48d0ddc14a5b801"/><file name="jquery.min.js" hash="0652da382b6fceb033dfe2b6c06d4d11"/><file name="promo_gmail.png" hash="4837435633204a9001b88c2d8ef451ed"/></dir><file name="jquery-1.10.2.js" hash="91515770ce8c55de23b306444d8ea998"/><file name="jquery-1.10.2.min.js" hash="628072e7212db1e8cdacb22b21752cda"/><file name="jquery-1.10.2.min.map" hash="6c3ccfc221d36777d383b6e04d0b8af9"/><file name="jquery-noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir><file name="news.css" hash="84d2866b08b706164c6e545767ff331a"/></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="common"><file name="popup.phtml" hash="996c1d74465c319465bdfd1ee0b5845d"/><file name="recovery.phtml" hash="a67cc89c3def6900475f5cc69f110823"/></dir><dir name="emailcapture"><file name="js.phtml" hash="37b3d102efdd3685e09822615c72db3e"/></dir><dir name="newsletter"><file name="checkbox.phtml" hash="281d8b8a7a078965f6b8386c5a1c6136"/><file name="js.phtml" hash="c88851be407f642e13d0c563f537e3c2"/></dir><dir name="order"><file name="js.phtml" hash="e398cfbfe9df41feeadb251216422cd9"/><file name="redemption.phtml" hash="4a344720766b9ea957210fbb5059c605"/></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="common.xml" hash="5abd7674010ee88a46cac057eaf5ebfd"/><file name="emailcapture.xml" hash="b5d3b0efc5daffb5fa66561f690013d0"/><file name="newsletter.xml" hash="30e90ef74659bafca7f1cb7d36a63717"/><file name="order.xml" hash="2c74121ed741ca74dbb6958f59cb3d3b"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="bronto"><dir name="api"><file name="guide.phtml" hash="2bd6d0a65c67190e388c18aef0acfcc3"/></dir><dir name="cartrecovery"><file name="guide.phtml" hash="86be232bf3705d4fe83c262fbcbb759f"/></dir><dir name="common"><file name="about.phtml" hash="fa5886d9dba15226eec520916b7c4aa2"/><file name="cron.phtml" hash="80af8ca4a8e2c74449904748aeaf718b"/><file name="guide.phtml" hash="07bcf3ad2e6a9136888bbf4a8bf0b51d"/><file name="guiders.phtml" hash="790ac5e5f8df13753db5ac3e68d08d76"/><file name="suppressed.phtml" hash="3c724d43b2cef9b13532e6d2b8e05f06"/></dir><dir name="coupon"><file name="guide.phtml" hash="3835858f4375e45d8e41b472c466b099"/></dir><dir name="customer"><file name="guide.phtml" hash="14e9b74f62bde430a6df96cf04ee94dc"/></dir><dir name="email"><file name="guide.phtml" hash="c8fe9f3cadf5e50d6f0e69979462c407"/><dir name="template"><file name="edit.phtml" hash="802ef394d1943f18d33d39d0b85dcc3d"/><file name="list.phtml" hash="231eea8188338785f9625f4b8f738518"/></dir></dir><dir name="news"><file name="guide.phtml" hash="19026e62d49476371edc4f9e7f68d2c1"/><file name="item.phtml" hash="7146fcc10eeb0bdc33a78ea8fe060f74"/></dir><dir name="newsletter"><file name="guide.phtml" hash="4d4ac3dc42265d9521ec75383da40a10"/></dir><dir name="order"><file name="guide.phtml" hash="831ff327cf49d198bec62ad968587593"/></dir><dir name="popup"><file name="guide.phtml" hash="6bd6240f1402a03dd0d5022b8c39b3ab"/></dir><dir name="product"><file name="guide.phtml" hash="db1f4d377f1026bd187270d6661f0d47"/><dir name="recommendation"><file name="button.phtml" hash="3583ae800ae50fcdee59cff78d2fe1d9"/><file name="default.phtml" hash="b90f72f90eb11e32c0a7c31cf04ee301"/><file name="edit.phtml" hash="74cfbb9a25506210ad1a446dbdaa8e89"/><file name="grid.phtml" hash="51e74eba64b3e2a898114c2ffb42f588"/><file name="preview.phtml" hash="abdfe3aaf254eed3441d17f16acc337f"/><file name="selected.js.phtml" hash="9a0e17f82f5745c531a58784c33a9ac9"/></dir></dir><dir name="reminder"><dir name="grid"><file name="container.phtml" hash="a12228a3b95cce42a618f41efa92a819"/></dir><file name="guide.phtml" hash="db033c357b5e335b6d65a44fa78c7c7e"/></dir><dir name="reviews"><file name="guide.phtml" hash="d31d5473d270a1b473e50d28f8947d1f"/></dir><dir name="verify"><dir name="advanced"><file name="observer.phtml" hash="775deb643169f76f72793873a258eac1"/></dir><file name="advanced.phtml" hash="8479f4762de8943de234407bbc80b679"/><dir name="conflictchecker"><file name="errors.phtml" hash="91adf7e31ce9ec1ae06c18adb489bf54"/></dir><file name="guide.phtml" hash="664368c479f04ef022e9f0f96b2b9eca"/><file name="installs.phtml" hash="34b6bd602043376f8c17ef7744a27537"/><dir name="permissionchecker"><file name="button.phtml" hash="0a98a58dcb6d28d768e83556e6e690bc"/><file name="errors.phtml" hash="6da7357831323392e3badcb1cc8268aa"/><file name="index.phtml" hash="628a80e9245642cb92cc75a6dd07d1d7"/></dir></dir></dir></dir><dir name="layout"><dir name="bronto"><file name="common.xml" hash="5c9c6512ba73ab619c0417a1c51a28e0"/><file name="email.xml" hash="be77c906770a0d818898a910b03cbe4f"/><file name="news.xml" hash="96d679b735d551a3e83fb71bfe2a7fca"/><file name="reminder.xml" hash="07186394676c6db016d00bdee53e8394"/><file name="reviews.xml" hash="f0d9d6536228329145755af91cb8626a"/><file name="verify.xml" hash="e5676df09f0a79bdedc314e2bfdb4b59"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="shell"><dir name="bronto"><file name="cron.php" hash="675049a8c5b735fcf35ea19e85b593ae"/><file name="fix.php" hash="40b6636ea955d6ccacdd68432776a5f9"/><file name="review_migrate.php" hash="c4d7c4531bc2ac553535e8094da91b95"/><file name="rewrite.php" hash="38f1c593dfc30e60d68f59381fd36d04"/></dir></dir></target></contents>
61
  <compatible/>
62
+ <dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php><extension><name>soap</name><min/><max/></extension><extension><name>openssl</name><min/><max/></extension></required></dependencies>
63
  </package>