Flexible Shipping for WooCommerce - Version 3.0.6

Version Description

  • 2018-11-29 =
  • Added Flexible Shipping Connect to create packages and generate shipping labels automatically from WooCommerce Orders list and manually from each order
  • Added integration with UPS (Worldwide). Now you can connect your shop with your UPS account. No extra software is needed. You can cover the whole shipping process directly from your UPS WooCommerce environment.
Download this release

Release Info

Developer jablonowski
Plugin Icon 128x128 Flexible Shipping for WooCommerce
Version 3.0.6
Comparing to
See all releases

Code changes from version 2.1.10 to 3.0.6

Files changed (274) hide show
  1. README.md +11 -0
  2. assets/css/admin.css +473 -1
  3. assets/css/admin.min.css +1 -1
  4. assets/js/admin.js +46 -1
  5. assets/js/admin.min.js +1 -1
  6. assets/js/admin_saas_platform.js +106 -0
  7. assets/js/admin_saas_platform.min.js +1 -0
  8. bootstrap.php +0 -12
  9. classes/admin-notices.php +3 -3
  10. classes/bulk-actions.php +1 -0
  11. classes/class-flexible-shipping-plugin.php +423 -0
  12. classes/class-menu.php +43 -0
  13. classes/class-order-add-shipping.php +140 -0
  14. classes/class-shipping-zone-data-extractor.php +50 -0
  15. classes/class-shortcode-unit-dimension.php +26 -0
  16. classes/class-shortcode-unit-weight.php +26 -0
  17. classes/class-uk-states.php +154 -0
  18. classes/flexible-shipping-export.php +3 -3
  19. classes/flexible-shipping-factory.php +0 -43
  20. classes/flexible-shipping-plugin.php +0 -328
  21. classes/logger/class-logger-factory.php +36 -0
  22. classes/logger/class-saas-logger-downloader.php +65 -0
  23. classes/logger/class-saas-logger-settings.php +115 -0
  24. classes/logger/class-woocommerce-context-logger.php +56 -0
  25. classes/manifest/cpt-shipping-manifest.php +1 -1
  26. classes/multicurrency.php +3 -3
  27. classes/multilingual.php +3 -3
  28. classes/order-add-shipping.php +0 -116
  29. classes/saas/class-saas-add-shipping-handler.php +43 -0
  30. classes/saas/class-saas-auth-params.php +29 -0
  31. classes/saas/class-saas-bad-credentials-exception.php +23 -0
  32. classes/saas/class-saas-connection-status-ajax.php +93 -0
  33. classes/saas/class-saas-connection-status-field.php +81 -0
  34. classes/saas/class-saas-connection.php +609 -0
  35. classes/saas/class-saas-country-state-field.php +118 -0
  36. classes/saas/class-saas-custom-services-setting.php +170 -0
  37. classes/saas/class-saas-default-value-compute-handler.php +51 -0
  38. classes/saas/class-saas-free-shipping-metadata-handler.php +71 -0
  39. classes/saas/class-saas-live-rates-fallback-metadata-handler.php +75 -0
  40. classes/saas/class-saas-live-rates-handler.php +563 -0
  41. classes/saas/class-saas-maintenance-mode-exception.php +37 -0
  42. classes/saas/class-saas-platform-factory.php +49 -0
  43. classes/saas/class-saas-platform-links.php +186 -0
  44. classes/saas/class-saas-registration-second-notice.php +88 -0
  45. classes/saas/class-saas-service-settings-not-found-exception.php +7 -0
  46. classes/saas/class-saas-settings-service-checkbox.php +145 -0
  47. classes/saas/class-saas-settings.php +327 -0
  48. classes/saas/class-saas-shipment-auto-create.php +74 -0
  49. classes/saas/class-saas-shipment-order-auto-complete.php +66 -0
  50. classes/saas/class-saas-shipment-settings-field.php +93 -0
  51. classes/saas/class-saas-shipping-method-integration-settings.php +357 -0
  52. classes/saas/class-saas-shipping-service-settings.php +445 -0
  53. classes/saas/class-saas-shipping-service.php +764 -0
  54. classes/saas/class-saas-shipping-services-manager.php +475 -0
  55. classes/saas/class-saas-shipping-services.php +157 -0
  56. classes/saas/class-saas-user-registration.php +419 -0
  57. classes/saas/interface-saas-connection-aware.php +22 -0
  58. classes/saas/tracker/class-saas-tracker.php +192 -0
  59. classes/saas/views/html-boxes-content.php +63 -0
  60. classes/saas/views/html-field-connection-status.php +36 -0
  61. classes/saas/views/html-field-saas-connection.php +31 -0
  62. classes/saas/views/html-flexible-shipping-connect-notice.php +178 -0
  63. classes/saas/views/html-flexible-shipping-connect-second-notice.php +1 -0
  64. classes/saas/views/html-order-fallback-message.php +1 -0
  65. classes/saas/views/html-order-free-shipping.php +1 -0
  66. classes/saas/views/html-registration-page.php +45 -0
  67. classes/saas/views/html-saas-connection-form.php +50 -0
  68. classes/saas/views/html-settings-connect-script.php +12 -0
  69. classes/saas/views/html-shipping-method-info-description.php +72 -0
  70. classes/settings/flexible-shipping.php +1 -1
  71. classes/settings/shipping-method-form.php +28 -6
  72. classes/shipment/ajax.php +5 -2
  73. classes/shipment/class-cancel-shipment-exception.php +7 -0
  74. classes/shipment/class-get-label-exception.php +7 -0
  75. classes/shipment/class-label-not-available-exception.php +7 -0
  76. classes/shipment/class-money-formatter.php +44 -0
  77. classes/shipment/class-send-shipment-exception.php +7 -0
  78. classes/shipment/class-shipment-counter.php +91 -0
  79. classes/shipment/class-shipment-plan-exceeded-exception.php +7 -0
  80. classes/shipment/class-shipment-request-fields.php +120 -0
  81. classes/shipment/class-shipment.php +150 -10
  82. classes/shipment/cpt-shipment.php +14 -6
  83. classes/shipment/functions.php +6 -4
  84. classes/shipment/saas/class-shipment-saas-ajax.php +200 -0
  85. classes/shipment/saas/class-shipment-saas-message-formatter.php +48 -0
  86. classes/shipment/saas/class-shipment-saas-metabox.php +122 -0
  87. classes/shipment/saas/class-shipment-saas-send.php +180 -0
  88. classes/shipment/saas/class-shipment-saas.php +721 -0
  89. classes/shipment/saas/views/order-metabox-actions.php +32 -0
  90. classes/shipment/saas/views/order-metabox-connection-error.php +3 -0
  91. classes/shipment/saas/views/order-metabox-fieldset-replicable.php +2 -0
  92. classes/shipment/saas/views/order-metabox-fieldset.php +43 -0
  93. classes/shipment/views/order-metabox.php +4 -4
  94. classes/shipping-method-info.php +0 -47
  95. classes/shipping-method.php +106 -22
  96. classes/tracker.php +3 -3
  97. classes/views/html-ads.php +2 -2
  98. classes/views/html-column-shipping-shipping.php +2 -5
  99. classes/views/html-custom-services.php +45 -0
  100. classes/views/html-shipping-method-info-description.php +0 -62
  101. classes/views/html-shipping-method-rules.php +4 -5
  102. classes/views/html-shipping-method-settings.php +1 -1
  103. classes/wpdesk/assets/css/admin-settings.min.css +0 -1
  104. classes/wpdesk/assets/js/admin-settings.min.js +0 -1
  105. classes/wpdesk/class-helper.php +0 -75
  106. classes/wpdesk/class-plugin.php +0 -277
  107. classes/wpdesk/class-requirement-checker.php +0 -356
  108. classes/wpdesk/class-settings.php +0 -352
  109. classes/wpdesk/functions.php +0 -17
  110. classes/wpdesk/interface-plugin-factory.php +0 -15
  111. classes/wpdesk/lang/wpdesk-plugin-pl_PL.mo +0 -0
  112. classes/wpdesk/lang/wpdesk-plugin-pl_PL.po +0 -145
  113. classes/wpdesk/settings-api/assets/css/admin.min.css +0 -1
  114. classes/wpdesk/settings-api/assets/js/admin.min.js +0 -1
  115. flexible-shipping.php +39 -31
  116. lang/flexible-shipping-pl_PL.mo +0 -0
  117. lang/flexible-shipping-pl_PL.po +2153 -0
  118. languages/flexible-shipping-pl_PL.mo +0 -0
  119. languages/flexible-shipping-pl_PL.po +0 -1302
  120. plugin-create.php +51 -0
  121. plugin-load.php +36 -0
  122. readme.md +0 -2
  123. readme.txt +44 -18
  124. templates/email/after_order_table.php +17 -0
  125. templates/myaccount/after_order_table.php +17 -0
  126. vendor/autoload.php +1 -1
  127. vendor/composer/autoload_classmap.php +455 -12
  128. vendor/composer/autoload_files.php +11 -0
  129. vendor/composer/autoload_psr4.php +10 -0
  130. vendor/composer/autoload_real.php +22 -4
  131. vendor/composer/autoload_static.php +523 -16
  132. vendor/composer/installed.json +752 -9
  133. vendor/composer/installers/LICENSE +19 -0
  134. vendor/composer/installers/composer.json +105 -0
  135. vendor/composer/installers/src/Composer/Installers/AglInstaller.php +21 -0
  136. vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php +9 -0
  137. vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php +11 -0
  138. vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php +49 -0
  139. vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php +9 -0
  140. vendor/composer/installers/src/Composer/Installers/BaseInstaller.php +136 -0
  141. vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php +126 -0
  142. vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php +9 -0
  143. vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php +82 -0
  144. vendor/composer/installers/src/Composer/Installers/ChefInstaller.php +11 -0
  145. vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php +9 -0
  146. vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php +10 -0
  147. vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php +34 -0
  148. vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php +11 -0
  149. vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php +13 -0
  150. vendor/composer/installers/src/Composer/Installers/CraftInstaller.php +35 -0
  151. vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php +21 -0
  152. vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php +10 -0
  153. vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php +50 -0
  154. vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php +16 -0
  155. vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php +16 -0
  156. vendor/composer/installers/src/Composer/Installers/ElggInstaller.php +9 -0
  157. vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php +12 -0
  158. vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php +29 -0
  159. vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php +10 -0
  160. vendor/composer/installers/src/Composer/Installers/FuelInstaller.php +11 -0
  161. vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php +9 -0
  162. vendor/composer/installers/src/Composer/Installers/GravInstaller.php +30 -0
  163. vendor/composer/installers/src/Composer/Installers/HuradInstaller.php +25 -0
  164. vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php +11 -0
  165. vendor/composer/installers/src/Composer/Installers/Installer.php +274 -0
  166. vendor/composer/installers/src/Composer/Installers/ItopInstaller.php +9 -0
  167. vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php +15 -0
  168. vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php +18 -0
  169. vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php +11 -0
  170. vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php +10 -0
  171. vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php +9 -0
  172. vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php +27 -0
  173. vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php +9 -0
  174. vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php +10 -0
  175. vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php +10 -0
  176. vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php +9 -0
  177. vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php +16 -0
  178. vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php +11 -0
  179. vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php +37 -0
  180. vendor/composer/installers/src/Composer/Installers/MakoInstaller.php +9 -0
  181. vendor/composer/installers/src/Composer/Installers/MauticInstaller.php +25 -0
  182. vendor/composer/installers/src/Composer/Installers/MayaInstaller.php +33 -0
  183. vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php +51 -0
  184. vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php +111 -0
  185. vendor/composer/installers/src/Composer/Installers/ModxInstaller.php +12 -0
  186. vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php +57 -0
  187. vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php +47 -0
  188. vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php +24 -0
  189. vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php +14 -0
  190. vendor/composer/installers/src/Composer/Installers/OxidInstaller.php +59 -0
  191. vendor/composer/installers/src/Composer/Installers/PPIInstaller.php +9 -0
  192. vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php +11 -0
  193. vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php +11 -0
  194. vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php +21 -0
  195. vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php +32 -0
  196. vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php +29 -0
  197. vendor/composer/installers/src/Composer/Installers/Plugin.php +17 -0
  198. vendor/composer/installers/src/Composer/Installers/PortoInstaller.php +9 -0
  199. vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php +10 -0
  200. vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php +11 -0
  201. vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php +63 -0
  202. vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php +24 -0
  203. vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php +10 -0
  204. vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php +10 -0
  205. vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php +22 -0
  206. vendor/composer/installers/src/Composer/Installers/SMFInstaller.php +10 -0
  207. vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +60 -0
  208. vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php +35 -0
  209. vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php +25 -0
  210. vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php +49 -0
  211. vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php +26 -0
  212. vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php +16 -0
  213. vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php +38 -0
  214. vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php +12 -0
  215. vendor/composer/installers/src/Composer/Installers/TuskInstaller.php +14 -0
  216. vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php +9 -0
  217. vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php +10 -0
  218. vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php +49 -0
  219. vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php +10 -0
  220. vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php +9 -0
  221. vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php +12 -0
  222. vendor/composer/installers/src/Composer/Installers/YawikInstaller.php +32 -0
  223. vendor/composer/installers/src/Composer/Installers/ZendInstaller.php +11 -0
  224. vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php +10 -0
  225. vendor/composer/installers/src/bootstrap.php +13 -0
  226. vendor/moneyphp/money/.scrutinizer.yml +9 -0
  227. vendor/moneyphp/money/CHANGELOG.md +302 -0
  228. vendor/moneyphp/money/Dockerfile +18 -0
  229. vendor/moneyphp/money/LICENSE +19 -0
  230. vendor/moneyphp/money/README.md +116 -0
  231. vendor/moneyphp/money/composer.json +76 -0
  232. vendor/moneyphp/money/resources/currency.php +1248 -0
  233. vendor/moneyphp/money/src/Calculator.php +127 -0
  234. vendor/moneyphp/money/src/Calculator/BcMathCalculator.php +243 -0
  235. vendor/moneyphp/money/src/Calculator/GmpCalculator.php +307 -0
  236. vendor/moneyphp/money/src/Calculator/PhpCalculator.php +213 -0
  237. vendor/moneyphp/money/src/Converter.php +54 -0
  238. vendor/moneyphp/money/src/Currencies.php +33 -0
  239. vendor/moneyphp/money/src/Currencies/AggregateCurrencies.php +76 -0
  240. vendor/moneyphp/money/src/Currencies/BitcoinCurrencies.php +47 -0
  241. vendor/moneyphp/money/src/Currencies/CachedCurrencies.php +98 -0
  242. vendor/moneyphp/money/src/Currencies/CurrencyList.php +76 -0
  243. vendor/moneyphp/money/src/Currencies/ISOCurrencies.php +103 -0
  244. vendor/moneyphp/money/src/Currency.php +84 -0
  245. vendor/moneyphp/money/src/CurrencyPair.php +139 -0
  246. vendor/moneyphp/money/src/Exception.php +12 -0
  247. vendor/moneyphp/money/src/Exception/FormatterException.php +14 -0
  248. vendor/moneyphp/money/src/Exception/ParserException.php +14 -0
  249. vendor/moneyphp/money/src/Exception/UnknownCurrencyException.php +14 -0
  250. vendor/moneyphp/money/src/Exception/UnresolvableCurrencyPairException.php +33 -0
  251. vendor/moneyphp/money/src/Exchange.php +25 -0
  252. vendor/moneyphp/money/src/Exchange/FixedExchange.php +45 -0
  253. vendor/moneyphp/money/src/Exchange/IndirectExchange.php +207 -0
  254. vendor/moneyphp/money/src/Exchange/ReversedCurrenciesExchange.php +49 -0
  255. vendor/moneyphp/money/src/Exchange/SwapExchange.php +45 -0
  256. vendor/moneyphp/money/src/Formatter/AggregateMoneyFormatter.php +56 -0
  257. vendor/moneyphp/money/src/Formatter/BitcoinMoneyFormatter.php +88 -0
  258. vendor/moneyphp/money/src/Formatter/DecimalMoneyFormatter.php +62 -0
  259. vendor/moneyphp/money/src/Formatter/IntlLocalizedDecimalFormatter.php +69 -0
  260. vendor/moneyphp/money/src/Formatter/IntlMoneyFormatter.php +69 -0
  261. vendor/moneyphp/money/src/Money.php +563 -0
  262. vendor/moneyphp/money/src/MoneyFormatter.php +22 -0
  263. vendor/moneyphp/money/src/MoneyParser.php +23 -0
  264. vendor/moneyphp/money/src/Number.php +337 -0
  265. vendor/moneyphp/money/src/PHPUnit/Comparator.php +71 -0
  266. vendor/moneyphp/money/src/Parser/AggregateMoneyParser.php +52 -0
  267. vendor/moneyphp/money/src/Parser/BitcoinMoneyParser.php +67 -0
  268. vendor/moneyphp/money/src/Parser/DecimalMoneyParser.php +108 -0
  269. vendor/moneyphp/money/src/Parser/IntlLocalizedDecimalParser.php +102 -0
  270. vendor/moneyphp/money/src/Parser/IntlMoneyParser.php +103 -0
  271. vendor/monolog/monolog/.php_cs +59 -0
  272. vendor/monolog/monolog/CHANGELOG.md +370 -0
  273. vendor/monolog/monolog/LICENSE +19 -0
  274. vendor/monolog/monolog/README.md +68 -0
README.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Branch feature/saas
2
+ ===================
3
+
4
+ [![pipeline status](https://gitlab.com/wpdesk/flexible-shipping/badges/feature/saas/pipeline.svg)](https://gitlab.com/wpdesk/flexible-shipping/commits/feature/saas)
5
+
6
+ [![coverage report](https://gitlab.com/wpdesk/flexible-shipping/badges/feature/saas/coverage.svg?job=integration+test+lastest+coverage)](https://gitlab.com/wpdesk/flexible-shipping/commits/feature/saas) Integration
7
+
8
+ [![coverage report](https://gitlab.com/wpdesk/flexible-shipping/badges/feature/saas/coverage.svg?job=unit+test+lastest+coverage)](https://gitlab.com/wpdesk/flexible-shipping/commits/feature/saas) Unit
9
+
10
+ Flexibe Shipping Plugin
11
+ =======================
assets/css/admin.css CHANGED
@@ -27,6 +27,19 @@ table.flexible_shipping_methods.wc_shipping th {
27
  width: auto;
28
  }
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  /* Rules Table */
31
 
32
  table.flexible_shipping_method_rules th, table.flexible_shipping_method_rules th {
@@ -204,7 +217,12 @@ table.flexible_shipping_method_rules tfoot th {
204
  }
205
 
206
  .flexible_shipping_shipment_message_error {
207
- color: red;
 
 
 
 
 
208
  }
209
 
210
  /** select */
@@ -250,3 +268,457 @@ table.flexible_shipping_method_rules tfoot th {
250
  #wpbody-content .flexible-shipping-info .metabox-holder {
251
  padding-top: 0;
252
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  width: auto;
28
  }
29
 
30
+ table.flexible_shipping_methods td.ui-sortable-handle:before, table.flexible_shipping_services td.ui-sortable-handle:before {
31
+ content: '\f333';
32
+ font-family: Dashicons;
33
+ text-align: center;
34
+ line-height: 1;
35
+ color: #999;
36
+ display: block;
37
+ width: 17px;
38
+ float: left;
39
+ height: 100%;
40
+ line-height: 24px;
41
+ }
42
+
43
  /* Rules Table */
44
 
45
  table.flexible_shipping_method_rules th, table.flexible_shipping_method_rules th {
217
  }
218
 
219
  .flexible_shipping_shipment_message_error {
220
+ color: #a00;
221
+ }
222
+
223
+ .flexible_shipping_shipment_message_error span {
224
+ color: #444;
225
+ font-weight: bold;
226
  }
227
 
228
  /** select */
268
  #wpbody-content .flexible-shipping-info .metabox-holder {
269
  padding-top: 0;
270
  }
271
+
272
+ /* menu */
273
+
274
+ #adminmenu #toplevel_page_flexible-shipping .menu-icon-generic div.wp-menu-image::before {
275
+ font-family: WooCommerce!important;
276
+ content: '\e01d';
277
+ }
278
+
279
+ /* Flexible shipping settings */
280
+ .fs-new-service {
281
+ color: #006799;
282
+ }
283
+
284
+ /* integration settings */
285
+
286
+ span.flexible_shipping_saas_connection_error {
287
+ color: #a00;
288
+ font-weight: bold;
289
+ }
290
+
291
+ /* Order shipping */
292
+ .fs-order-item-fallback {
293
+ margin-top: .5em;
294
+ color: #888;
295
+ }
296
+
297
+ /* order metabox */
298
+ .flexible_shipping_shipment_content p select {
299
+ max-width: 95%;
300
+ }
301
+
302
+ .flexible_shipping_shipment_content span.description {
303
+ display: block;
304
+ }
305
+
306
+ .fs-saas-button-cancel-created {
307
+ float: right;
308
+ color: #a00;
309
+ margin-top: 5px;
310
+ }
311
+
312
+ .fs-saas-button-cancel-created:hover {
313
+ color: #a00;
314
+ cursor: pointer;
315
+ }
316
+
317
+ .flexible_shipping_shipment_content input[type=checkbox] {
318
+ float: left;
319
+ margin-right: 5px;
320
+ margin-top: 2px !important;
321
+ opacity: 1;
322
+ border-color: #888;
323
+ }
324
+
325
+ .flexible_shipping_shipment_content input[type=checkbox]:disabled {
326
+ opacity: 0.7;
327
+ border-color: rgba( 51, 51, 51, 0.5 );
328
+ }
329
+
330
+ .flexible_shipping_shipment_content p.fs-saas-status {
331
+ }
332
+
333
+ .flexible_shipping_shipment_content p.fs-saas-status span {
334
+ font-weight: bold;
335
+ color: #444;
336
+ }
337
+
338
+ .flexible_shipping_shipment_content p.fs-saas-status-fs-new {
339
+ color: #ffba00;
340
+ }
341
+
342
+ .flexible_shipping_shipment_content p.fs-saas-status-fs-created {
343
+ color: #d0c21f;
344
+ }
345
+
346
+ .flexible_shipping_shipment_content p.fs-saas-status-fs-confirmed {
347
+ color: #444;
348
+ }
349
+
350
+ .flexible_shipping_shipment_content p.fs-saas-status-fs-failed {
351
+ color: #a00;
352
+ }
353
+
354
+ .flexible_shipping_shipment_content p.fs-saas-status-fs-manifest {
355
+ color: #2ea2cc;
356
+ }
357
+
358
+ .flexible_shipping_shipment_content p.connection-error {
359
+ font-weight: bold;
360
+ color: #a00;
361
+ }
362
+
363
+ .fs-saas-shipment span {
364
+ font-weight: bold;
365
+ }
366
+
367
+ .fs-saas-charges span {
368
+ }
369
+
370
+ .fs-saas-labels-counts span {
371
+ font-weight: bold;
372
+ }
373
+
374
+ .fs-saas-no-labels-left {
375
+ color: #a00;
376
+ }
377
+
378
+
379
+ table.flexible_shipping_services {
380
+ max-width: 550px;
381
+ }
382
+
383
+ table.flexible_shipping_services .sort {
384
+ width: 1%;
385
+ }
386
+
387
+ table.flexible_shipping_services .service_code {
388
+ width: 30px;
389
+ }
390
+
391
+ table.flexible_shipping_services .select {
392
+ text-align: center;
393
+ width: 1%;
394
+ }
395
+
396
+ table.flexible_shipping_services .select input {
397
+ margin: 0 8px 0 8px;
398
+ }
399
+
400
+ .woocommerce table.form-table table.flexible_shipping_services td.service_name input {
401
+ width: 100%;
402
+ }
403
+
404
+ input.woocommerce_flexible_shipping_service_name {
405
+ width: 100%;
406
+ }
407
+
408
+
409
+
410
+ /* Connect Global Notice */
411
+ .updated .fs-banner__button-container {
412
+ padding: 0.75rem 0 0;
413
+ }
414
+
415
+ .notice-info.fs-connect__container {
416
+ border-left: none;
417
+ padding: 0;
418
+ box-shadow: 0 0 0 1px #dfdfdf, 0 1px 2px #dfdfdf;
419
+ }
420
+
421
+ @media screen and (max-width: 782px) {
422
+ .notice-info.fs-connect__container {
423
+ padding: 0 !important;
424
+ }
425
+ }
426
+
427
+ .fs-connect__container {
428
+ display: block;
429
+ position: relative;
430
+ box-sizing: border-box;
431
+ }
432
+
433
+ .fs-connect__inner-container > a:first-child {
434
+ z-index: 1;
435
+ }
436
+
437
+ .fs-connect__inner-container {
438
+ display: -ms-flexbox;
439
+ display: flex;
440
+ -ms-flex-direction: row;
441
+ flex-direction: row;
442
+ -ms-flex-wrap: nowrap;
443
+ flex-wrap: nowrap;
444
+ -ms-flex-pack: left;
445
+ justify-content: left;
446
+ }
447
+
448
+ .fs-connect__content-container {
449
+ width: 1250px;
450
+ position: relative;
451
+ padding: 2rem;
452
+ z-index: 0;
453
+ }
454
+
455
+ @media (min-width: 782px) {
456
+ .fs-connect__content-container {
457
+ padding: 2rem 2rem 4rem 2rem;
458
+ }
459
+ }
460
+
461
+ .fs-connect__content-container p {
462
+ color: #555;
463
+ font-size: 0.875rem;
464
+ }
465
+
466
+ .fs-connect__content-container h2 {
467
+ margin-top: 0;
468
+ color: #555;
469
+ line-height: 1.6;
470
+ }
471
+
472
+ .fs-connect__content-icon {
473
+ float: right;
474
+ margin: 0 1.5rem 0 2.25rem;
475
+ }
476
+
477
+ .fs-connect__content-icon svg {
478
+ fill: #0085ba;
479
+ height: 180px;
480
+ width: auto;
481
+ }
482
+
483
+ @media (max-width: 782px) {
484
+ .fs-connect__content-icon.fs-connect-illo {
485
+ float: none;
486
+ width: 100%;
487
+ text-align: center;
488
+ margin: 2.25rem 0 1.5rem;
489
+ }
490
+ }
491
+
492
+ .fs-connect__slide {
493
+ display: none;
494
+ }
495
+
496
+ .fs-connect__slide.fs__slide-is-active {
497
+ display: block;
498
+ }
499
+
500
+ @media (min-width: 782px) {
501
+ .fs-connect__content-container .fs-banner__button-container {
502
+ position: absolute;
503
+ bottom: 0.5rem;
504
+ }
505
+ }
506
+
507
+ .fs-banner__button-container .button-primary {
508
+ margin: 0 0.3125rem 0.3125rem 0;
509
+ }
510
+
511
+ .fs-connect__vertical-nav {
512
+ background-color: #f1f1f1;
513
+ }
514
+
515
+ @media (min-width: 600px) {
516
+ .fs-connect__vertical-nav {
517
+ -ms-flex-direction: column;
518
+ flex-direction: column;
519
+ -ms-flex-pack: start;
520
+ justify-content: flex-start;
521
+ }
522
+ }
523
+
524
+ @media (max-width: 600px) {
525
+ .fs-connect__vertical-nav {
526
+ display: none;
527
+ }
528
+ }
529
+
530
+ .fs-connect__vertical-nav-container {
531
+ width: 15rem;
532
+ }
533
+
534
+ .vertical-menu__feature-item-label {
535
+ display: none;
536
+ }
537
+
538
+ @media (min-width: 600px) {
539
+ .vertical-menu__feature-item {
540
+ display: -ms-flexbox;
541
+ display: flex;
542
+ -ms-flex-direction: row;
543
+ flex-direction: row;
544
+ -ms-flex-align: center;
545
+ align-items: center;
546
+ border: none;
547
+ padding: 0.5rem;
548
+ border-bottom: 1px solid #dfdfdf;
549
+ border-right: 1px solid #dfdfdf;
550
+ border-left: 3px solid #f9f9f9;
551
+ background-color: #f9f9f9;
552
+ color: #555;
553
+ cursor: pointer;
554
+ }
555
+
556
+ .vertical-menu__feature-item:last-of-type {
557
+ position: relative;
558
+ top: 1px;
559
+ }
560
+
561
+ .vertical-menu__feature-item-is-selected {
562
+ border-left: 3px solid #0085ba;
563
+ border-right: 1px solid #fff;
564
+ background-color: #fff;
565
+ color: #2e4453;
566
+ }
567
+
568
+ .vertical-menu__feature-item-is-selected.fs-feature-intro {
569
+ border-left: 3px solid #00BE28;
570
+ }
571
+
572
+ .vertical-menu__feature-item-icon {
573
+ width: 1.25rem;
574
+ height: 1.25rem;
575
+ padding: 0.25rem;
576
+ text-align: center;
577
+ }
578
+
579
+ .vertical-menu__feature-item svg {
580
+ fill: #555;
581
+ vertical-align: middle;
582
+ }
583
+
584
+ .vertical-menu__feature-item-is-selected svg {
585
+ fill: #0085ba;
586
+ }
587
+
588
+ .vertical-menu__feature-item-label {
589
+ display: block;
590
+ padding: 0.5rem;
591
+ }
592
+ }
593
+
594
+ .fs-couriers {
595
+ margin-top: 2.5em;
596
+ }
597
+
598
+ .fs-courier {
599
+ position: relative;
600
+ margin-bottom: 2.5em;
601
+ text-align: center;
602
+ }
603
+
604
+ .fs-courier img {
605
+ height: 50px;
606
+ width: auto;
607
+ }
608
+
609
+ .fs-courier-label {
610
+ background-color: #333;
611
+ border-radius: 3px;
612
+ color: #fff;
613
+ padding: 0 4px 1px;
614
+ position: absolute;
615
+ right: 0;
616
+ top: -10px;
617
+ }
618
+
619
+ @media (min-width: 1200px) {
620
+ .fs-couriers {
621
+ align-items: center;
622
+ display: flex;
623
+ flex-wrap: wrap;
624
+ justify-content: flex-start;
625
+ }
626
+
627
+ .fs-courier {
628
+ width: 20%;
629
+ }
630
+ }
631
+
632
+ /* Connect Register */
633
+ .admin_page_flexible_shipping_connect_register .notice.is-dismissible,
634
+ .admin_page_flexible_shipping_connect_register .update-nag,
635
+ .admin_page_flexible_shipping_connect_register .updated,
636
+ .admin_page_flexible_shipping_connect_register .settings-error {
637
+ display: none !important;
638
+ }
639
+
640
+ .fs-page-wrap {
641
+ margin: 0 auto;
642
+ max-width: 45rem;
643
+ padding: 1.5rem;
644
+ }
645
+
646
+ .fs-page-wrap h1 {
647
+ font-weight: normal;
648
+ margin-bottom: .67em;
649
+ text-align: center;
650
+ }
651
+
652
+ .fs-box {
653
+ display: block;
654
+ position: relative;
655
+ margin: 0 auto 20px;
656
+ padding: 16px;
657
+ box-sizing: border-box;
658
+ background: white;
659
+ box-shadow: 0 0 0 1px #dfdfdf, 0 1px 2px #dfdfdf;
660
+ }
661
+
662
+ .fs-box:after {
663
+ content: ".";
664
+ display: block;
665
+ height: 0;
666
+ clear: both;
667
+ visibility: hidden;
668
+ }
669
+
670
+ .admin_page_flexible_shipping_connect_register .fs-box,
671
+ .fs-box.text-center {
672
+ text-align: center;
673
+ }
674
+
675
+ .admin_page_flexible_shipping_connect_register .fs-box p {
676
+ margin: 1.5em 0;
677
+ }
678
+
679
+ .fs-box input[type="email"] {
680
+ padding: 8px 10px;
681
+ }
682
+
683
+ .fs-actions {
684
+ padding-left: 40px;
685
+ }
686
+
687
+ .fs-actions button:active {
688
+ vertical-align: inherit !important;
689
+ }
690
+
691
+ .fs-actions .spinner {
692
+ float: none;
693
+ margin-top: 0;
694
+
695
+ }
696
+
697
+ .fs-cols {
698
+ display: flex;
699
+ flex-wrap: wrap;
700
+ justify-content: space-between;
701
+ }
702
+
703
+ .fs-inner-box {
704
+ box-sizing: border-box;
705
+ margin-top: 30px;
706
+ padding: 0 20px;
707
+ }
708
+
709
+ .fs-inner-box h4 {
710
+ font-size: 1.2em;
711
+ margin-bottom: .37em;
712
+ }
713
+
714
+ .fs-inner-box svg {
715
+ fill: #0085ba;
716
+ height: 70px;
717
+ width: auto;
718
+ }
719
+
720
+ @media (min-width: 600px) {
721
+ .fs-inner-box {
722
+ width: 33.33%;
723
+ }
724
+ }
assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- table.flexible_shipping_methods th.select,table.flexible_shipping_methods td.select{text-align:center;width:40px;margin-top:-7px;margin-left:-6px;padding:2px}table.flexible_shipping_methods .checkbox-select-all{margin:0 12px 0 8px}table.flexible_shipping_methods th.integration,table.flexible_shipping_methods td.integration{text-align:center;width:130px}table.flexible_shipping_methods tr.highlight td{background-color:#e4f2fd}table.flexible_shipping_methods.wc_shipping th{font-weight:400;width:auto}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules th{padding:5px 10px 5px 0}table.flexible_shipping_method_rules td p,table.flexible_shipping_method_rules td p input,table.flexible_shipping_method_rules td p select{margin:0;width:100%;box-shadow:none;padding:0 !important}table.flexible_shipping_method_rules td p input[type=text]{text-align:right;padding:0 5px 0 5px !important;width:100% !important}table.flexible_shipping_method_rules td p select{margin:0;width:100% !important;box-shadow:none;line-height:28px;height:37px;vertical-align:middle}table.flexible_shipping_method_rules td p input[type=checkbox]{margin:0;width:auto}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules td{text-align:center}table.flexible_shipping_method_rules th.shipping_class,table.flexible_shipping_method_rules td.shipping_class{text-align:center;width:200px}table.flexible_shipping_method_rules td.shipping_class span{border:0}table.flexible_shipping_method_rules th.stop,table.flexible_shipping_method_rules td.stop{text-align:center;width:30px}table.flexible_shipping_method_rules th.cancel,table.flexible_shipping_method_rules td.cancel{text-align:center;width:60px}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none;margin:0}.woocommerce table.form-table .flexible_shipping_method_rules .select2-container{margin:0}.woocommerce table.form-table .fs-locations-table .select2-container{max-width:none}.woocommerce table.form-table .fs-locations-table th .woocommerce-help-tip{float:none}div.flexilble_shipping_export_import{float:right}table.flexible_shipping_method_rules tfoot th{padding:10px}.woocommerce_page_wc-settings #mainform{position:relative}.flexible-shipping-pro-box{max-width:280px;min-width:180px;right:0;position:absolute;top:135px}@media screen and (max-width:1199px){.flexible-shipping-pro-box{display:none}}.column-flexible_shipping{width:130px}.column-flexible_shipping .shipping-status{float:left;margin-right:8px;margin-top:4px;text-align:left;width:18px}.column-flexible_shipping .shipping-status .created:after{color:#d0c21f !important}.column-flexible_shipping .shipping-actions a.button{float:left;margin:0 4px 2px 0;display:block;height:2em !important;padding:0 !important;position:relative;text-indent:-9999px;width:2em}.column-flexible_shipping .shipping-actions a.button:after{font-family:WooCommerce;font-variant:normal;font-weight:400;height:100%;left:0;line-height:1.85;margin:0;position:absolute;text-align:center;text-indent:0;text-transform:none;top:0;width:100%}.column-flexible_shipping .shipping-actions a.button.get-label:after{content:"\e01e"}.column-flexible_shipping .shipping-actions a.button.track:after{content:"\e01b"}.column-flexible_shipping mark.failed:after{color:#a00 !important}.column-flexible_shipping mark.manifest:after{color:#2ea2cc !important}.flexible_shipping_shipment_message{color:green}.flexible_shipping_shipment_message_error{color:red}.wp-admin select{height:100%}.button.flexible-printing-button-print{height:auto !important;white-space:normal !important;word-wrap:break-word !important}.inspire-settings{display:table;width:100%}.inspire-settings .inspire-main-content,.inspire-settings .inspire-sidebar{display:table-cell;height:500px;margin:0;padding:0;vertical-align:top}.inspire-settings .inspire-main-content{min-width:800px}.inspire-settings .inspire-sidebar{padding-left:30px;width:250px}.flexible-shipping-info ol{margin-top:0}#wpbody-content .flexible-shipping-info .metabox-holder{padding-top:0}
1
+ table.flexible_shipping_methods th.select,table.flexible_shipping_methods td.select{text-align:center;width:40px;margin-top:-7px;margin-left:-6px;padding:2px}table.flexible_shipping_methods .checkbox-select-all{margin:0 12px 0 8px}table.flexible_shipping_methods th.integration,table.flexible_shipping_methods td.integration{text-align:center;width:130px}table.flexible_shipping_methods tr.highlight td{background-color:#e4f2fd}table.flexible_shipping_methods.wc_shipping th{font-weight:400;width:auto}table.flexible_shipping_methods td.ui-sortable-handle:before,table.flexible_shipping_services td.ui-sortable-handle:before{content:'\f333';font-family:Dashicons;text-align:center;line-height:1;color:#999;display:block;width:17px;float:left;height:100%;line-height:24px}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules th{padding:5px 10px 5px 0}table.flexible_shipping_method_rules td p,table.flexible_shipping_method_rules td p input,table.flexible_shipping_method_rules td p select{margin:0;width:100%;box-shadow:none;padding:0 !important}table.flexible_shipping_method_rules td p input[type=text]{text-align:right;padding:0 5px 0 5px !important;width:100% !important}table.flexible_shipping_method_rules td p select{margin:0;width:100% !important;box-shadow:none;line-height:28px;height:37px;vertical-align:middle}table.flexible_shipping_method_rules td p input[type=checkbox]{margin:0;width:auto}table.flexible_shipping_method_rules th,table.flexible_shipping_method_rules td{text-align:center}table.flexible_shipping_method_rules th.shipping_class,table.flexible_shipping_method_rules td.shipping_class{text-align:center;width:200px}table.flexible_shipping_method_rules td.shipping_class span{border:0}table.flexible_shipping_method_rules th.stop,table.flexible_shipping_method_rules td.stop{text-align:center;width:30px}table.flexible_shipping_method_rules th.cancel,table.flexible_shipping_method_rules td.cancel{text-align:center;width:60px}.woocommerce table.form-table .flexible_shipping_method_rules th span.woocommerce-help-tip{float:none;margin:0}.woocommerce table.form-table .flexible_shipping_method_rules .select2-container{margin:0}.woocommerce table.form-table .fs-locations-table .select2-container{max-width:none}.woocommerce table.form-table .fs-locations-table th .woocommerce-help-tip{float:none}div.flexilble_shipping_export_import{float:right}table.flexible_shipping_method_rules tfoot th{padding:10px}.woocommerce_page_wc-settings #mainform{position:relative}.flexible-shipping-pro-box{max-width:280px;min-width:180px;right:0;position:absolute;top:135px}@media screen and (max-width:1199px){.flexible-shipping-pro-box{display:none}}.column-flexible_shipping{width:130px}.column-flexible_shipping .shipping-status{float:left;margin-right:8px;margin-top:4px;text-align:left;width:18px}.column-flexible_shipping .shipping-status .created:after{color:#d0c21f !important}.column-flexible_shipping .shipping-actions a.button{float:left;margin:0 4px 2px 0;display:block;height:2em !important;padding:0 !important;position:relative;text-indent:-9999px;width:2em}.column-flexible_shipping .shipping-actions a.button:after{font-family:WooCommerce;font-variant:normal;font-weight:400;height:100%;left:0;line-height:1.85;margin:0;position:absolute;text-align:center;text-indent:0;text-transform:none;top:0;width:100%}.column-flexible_shipping .shipping-actions a.button.get-label:after{content:"\e01e"}.column-flexible_shipping .shipping-actions a.button.track:after{content:"\e01b"}.column-flexible_shipping mark.failed:after{color:#a00 !important}.column-flexible_shipping mark.manifest:after{color:#2ea2cc !important}.flexible_shipping_shipment_message{color:green}.flexible_shipping_shipment_message_error{color:#a00}.flexible_shipping_shipment_message_error span{color:#444;font-weight:bold}.wp-admin select{height:100%}.button.flexible-printing-button-print{height:auto !important;white-space:normal !important;word-wrap:break-word !important}.inspire-settings{display:table;width:100%}.inspire-settings .inspire-main-content,.inspire-settings .inspire-sidebar{display:table-cell;height:500px;margin:0;padding:0;vertical-align:top}.inspire-settings .inspire-main-content{min-width:800px}.inspire-settings .inspire-sidebar{padding-left:30px;width:250px}.flexible-shipping-info ol{margin-top:0}#wpbody-content .flexible-shipping-info .metabox-holder{padding-top:0}#adminmenu #toplevel_page_flexible-shipping .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce !important;content:'\e01d'}.fs-new-service{color:#006799}span.flexible_shipping_saas_connection_error{color:#a00;font-weight:bold}.fs-order-item-fallback{margin-top:.5em;color:#888}.flexible_shipping_shipment_content p select{max-width:95%}.flexible_shipping_shipment_content span.description{display:block}.fs-saas-button-cancel-created{float:right;color:#a00;margin-top:5px}.fs-saas-button-cancel-created:hover{color:#a00;cursor:pointer}.flexible_shipping_shipment_content input[type=checkbox]{float:left;margin-right:5px;margin-top:2px !important;opacity:1;border-color:#888}.flexible_shipping_shipment_content input[type=checkbox]:disabled{opacity:.7;border-color:rgba(51,51,51,0.5)}.flexible_shipping_shipment_content p.fs-saas-status span{font-weight:bold;color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-new{color:#ffba00}.flexible_shipping_shipment_content p.fs-saas-status-fs-created{color:#d0c21f}.flexible_shipping_shipment_content p.fs-saas-status-fs-confirmed{color:#444}.flexible_shipping_shipment_content p.fs-saas-status-fs-failed{color:#a00}.flexible_shipping_shipment_content p.fs-saas-status-fs-manifest{color:#2ea2cc}.flexible_shipping_shipment_content p.connection-error{font-weight:bold;color:#a00}.fs-saas-shipment span{font-weight:bold}.fs-saas-labels-counts span{font-weight:bold}.fs-saas-no-labels-left{color:#a00}table.flexible_shipping_services{max-width:550px}table.flexible_shipping_services .sort{width:1%}table.flexible_shipping_services .service_code{width:30px}table.flexible_shipping_services .select{text-align:center;width:1%}table.flexible_shipping_services .select input{margin:0 8px 0 8px}.woocommerce table.form-table table.flexible_shipping_services td.service_name input{width:100%}input.woocommerce_flexible_shipping_service_name{width:100%}.updated .fs-banner__button-container{padding:.75rem 0 0}.notice-info.fs-connect__container{border-left:0;padding:0;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}@media screen and (max-width:782px){.notice-info.fs-connect__container{padding:0 !important}}.fs-connect__container{display:block;position:relative;box-sizing:border-box}.fs-connect__inner-container>a:first-child{z-index:1}.fs-connect__inner-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-pack:left;justify-content:left}.fs-connect__content-container{width:1250px;position:relative;padding:2rem;z-index:0}@media(min-width:782px){.fs-connect__content-container{padding:2rem 2rem 4rem 2rem}}.fs-connect__content-container p{color:#555;font-size:.875rem}.fs-connect__content-container h2{margin-top:0;color:#555;line-height:1.6}.fs-connect__content-icon{float:right;margin:0 1.5rem 0 2.25rem}.fs-connect__content-icon svg{fill:#0085ba;height:180px;width:auto}@media(max-width:782px){.fs-connect__content-icon.fs-connect-illo{float:none;width:100%;text-align:center;margin:2.25rem 0 1.5rem}}.fs-connect__slide{display:none}.fs-connect__slide.fs__slide-is-active{display:block}@media(min-width:782px){.fs-connect__content-container .fs-banner__button-container{position:absolute;bottom:.5rem}}.fs-banner__button-container .button-primary{margin:0 .3125rem .3125rem 0}.fs-connect__vertical-nav{background-color:#f1f1f1}@media(min-width:600px){.fs-connect__vertical-nav{-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:start;justify-content:flex-start}}@media(max-width:600px){.fs-connect__vertical-nav{display:none}}.fs-connect__vertical-nav-container{width:15rem}.vertical-menu__feature-item-label{display:none}@media(min-width:600px){.vertical-menu__feature-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;border:0;padding:.5rem;border-bottom:1px solid #dfdfdf;border-right:1px solid #dfdfdf;border-left:3px solid #f9f9f9;background-color:#f9f9f9;color:#555;cursor:pointer}.vertical-menu__feature-item:last-of-type{position:relative;top:1px}.vertical-menu__feature-item-is-selected{border-left:3px solid #0085ba;border-right:1px solid #fff;background-color:#fff;color:#2e4453}.vertical-menu__feature-item-is-selected.fs-feature-intro{border-left:3px solid #00be28}.vertical-menu__feature-item-icon{width:1.25rem;height:1.25rem;padding:.25rem;text-align:center}.vertical-menu__feature-item svg{fill:#555;vertical-align:middle}.vertical-menu__feature-item-is-selected svg{fill:#0085ba}.vertical-menu__feature-item-label{display:block;padding:.5rem}}.fs-couriers{margin-top:2.5em}.fs-courier{position:relative;margin-bottom:2.5em;text-align:center}.fs-courier img{height:50px;width:auto}.fs-courier-label{background-color:#333;border-radius:3px;color:#fff;padding:0 4px 1px;position:absolute;right:0;top:-10px}@media(min-width:1200px){.fs-couriers{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-start}.fs-courier{width:20%}}.admin_page_flexible_shipping_connect_register .notice.is-dismissible,.admin_page_flexible_shipping_connect_register .update-nag,.admin_page_flexible_shipping_connect_register .updated,.admin_page_flexible_shipping_connect_register .settings-error{display:none !important}.fs-page-wrap{margin:0 auto;max-width:45rem;padding:1.5rem}.fs-page-wrap h1{font-weight:normal;margin-bottom:.67em;text-align:center}.fs-box{display:block;position:relative;margin:0 auto 20px;padding:16px;box-sizing:border-box;background:white;box-shadow:0 0 0 1px #dfdfdf,0 1px 2px #dfdfdf}.fs-box:after{content:".";display:block;height:0;clear:both;visibility:hidden}.admin_page_flexible_shipping_connect_register .fs-box,.fs-box.text-center{text-align:center}.admin_page_flexible_shipping_connect_register .fs-box p{margin:1.5em 0}.fs-box input[type="email"]{padding:8px 10px}.fs-actions{padding-left:40px}.fs-actions button:active{vertical-align:inherit !important}.fs-actions .spinner{float:none;margin-top:0}.fs-cols{display:flex;flex-wrap:wrap;justify-content:space-between}.fs-inner-box{box-sizing:border-box;margin-top:30px;padding:0 20px}.fs-inner-box h4{font-size:1.2em;margin-bottom:.37em}.fs-inner-box svg{fill:#0085ba;height:70px;width:auto}@media(min-width:600px){.fs-inner-box{width:33.33%}}
assets/js/admin.js CHANGED
@@ -19,6 +19,47 @@ jQuery(document).ready(function(){
19
  window.history.pushState({}, "", url);
20
  }
21
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  });
23
 
24
  function fs_removeParam(key, sourceURL) {
@@ -140,6 +181,9 @@ function fs_ajax(button, id, fs_action) {
140
  }
141
  }
142
  else {
 
 
 
143
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').addClass("flexible_shipping_shipment_message_error");
144
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
145
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html(response.message);
@@ -154,6 +198,7 @@ function fs_ajax(button, id, fs_action) {
154
  jQuery('.button-shipping').attr('disabled', false);
155
  jQuery('.shipping-spinner').parent().find('.spinner').css({visibility: 'hidden'});
156
  }).fail(function (jqXHR, textStatus) {
 
157
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
158
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html("Request failed: " + textStatus + " " + jqXHR.status);
159
  })
@@ -171,4 +216,4 @@ jQuery(function($) {
171
  }
172
  } );
173
  } );
174
- });
19
  window.history.pushState({}, "", url);
20
  }
21
  }
22
+
23
+ /* Connect Global Notice */
24
+ var nav = jQuery( '.fs-connect__vertical-nav-container' ),
25
+ contentContainer = jQuery( '.fs-connect__content-container' );
26
+ nextFeatureButtons = jQuery( '.fs-banner__button-container .next-feature' ),
27
+
28
+ nav.on( 'click', '.vertical-menu__feature-item:not( .vertical-menu__feature-item-is-selected )', function() {
29
+ transitionSlideToIndex( jQuery( this ).index() );
30
+ } );
31
+
32
+ nextFeatureButtons.on( 'click', function( e ) {
33
+ e.preventDefault();
34
+
35
+ var slideIndex = jQuery( this )
36
+ .closest( '.fs-connect__slide' )
37
+ .index();
38
+
39
+ transitionSlideToIndex( slideIndex + 1 );
40
+ } );
41
+
42
+ function transitionSlideToIndex( index ) {
43
+ // Remove classes from previously selected menu item and content
44
+ nav
45
+ .find( '.vertical-menu__feature-item-is-selected' )
46
+ .removeClass( 'vertical-menu__feature-item-is-selected' );
47
+
48
+ contentContainer
49
+ .find( '.fs__slide-is-active' )
50
+ .removeClass( 'fs__slide-is-active' );
51
+
52
+ // Add classes to selected menu item and content
53
+ nav
54
+ .children()
55
+ .eq( index )
56
+ .addClass( 'vertical-menu__feature-item-is-selected' );
57
+
58
+ contentContainer
59
+ .children()
60
+ .eq( index )
61
+ .addClass( 'fs__slide-is-active' );
62
+ }
63
  });
64
 
65
  function fs_removeParam(key, sourceURL) {
181
  }
182
  }
183
  else {
184
+ if ( typeof response.content !== 'undefined' ) {
185
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_content').html(response.content);
186
+ }
187
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').addClass("flexible_shipping_shipment_message_error");
188
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
189
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html(response.message);
198
  jQuery('.button-shipping').attr('disabled', false);
199
  jQuery('.shipping-spinner').parent().find('.spinner').css({visibility: 'hidden'});
200
  }).fail(function (jqXHR, textStatus) {
201
+ jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').addClass("flexible_shipping_shipment_message_error");
202
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').show();
203
  jQuery('#flexible_shipping_shipment_' + id + ' .flexible_shipping_shipment_message').html("Request failed: " + textStatus + " " + jqXHR.status);
204
  })
216
  }
217
  } );
218
  } );
219
+ });
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){if(jQuery("#flexible_shipping_labels_url").length){window.location.href=jQuery("#flexible_shipping_labels_url").attr("href")}if(jQuery("a.shipping_manifest_download").length==1){window.location.href=jQuery("a.shipping_manifest_download").attr("href")}if(typeof window.history.pushState=="function"){var a=document.location.href;var b=document.location.href;a=fs_removeParam("bulk_flexible_shipping_labels",a);a=fs_removeParam("bulk_flexible_shipping_send",a);a=fs_removeParam("bulk_flexible_shipping_manifests",a);a=fs_removeParam("bulk_flexible_shipping_no_labels_created",a);a=fs_trimChar(a,"?");if(a!=b){window.history.pushState({},"",a)}}});function fs_removeParam(b,d){var e=d.split("?")[0],f,c=[],g=(d.indexOf("?")!==-1)?d.split("?")[1]:"";if(g!==""){c=g.split("&");for(var a=c.length-1;a>=0;a-=1){f=c[a].split("=")[0];if(f===b){c.splice(a,1)}}e=e+"?"+c.join("&")}return e}function fs_trimChar(b,a){while(b.charAt(0)==a){b=b.substring(1)}while(b.charAt(b.length-1)==a){b=b.substring(0,b.length-1)}return b}function fs_id(a){return jQuery(a).closest(".flexible_shipping_shipment").attr("data-id")}function fs_data_set_val(c,a,f){if(typeof a=="undefined"){return c}if(a.indexOf("[")==-1){c[a]=f}else{var d=a.split("[");var g=c;var e=c;var b="";jQuery.each(d,function(i,h){b=h.replace("]","");if(typeof g[b]=="undefined"){g[b]={}}e=g;g=g[b]});e[b]=f}return c}function fs_ajax(a,e,d){jQuery(".button-shipping").attr("disabled",true);jQuery(a).parent().find(".spinner").css({visibility:"visible"});var c={};jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content input, #flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content select, #flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content textarea").each(function(){if(jQuery(this).attr("type")=="radio"){c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery("#flexible_shipping_shipment_"+e+" input[name="+jQuery(this).attr("name")+"]:checked").val())}else{if(jQuery(this).attr("type")=="checkbox"){if(jQuery(this).is(":checked")){c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery(this).val())}else{c=fs_data_set_val(c,jQuery(this).attr("name"),"")}}else{c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery(this).val())}}});var b=jQuery("#flexible_shipping_shipment_nonce_"+e).val();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").hide();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").removeClass("flexible_shipping_shipment_message_error");jQuery.ajax({url:fs_admin.ajax_url,type:"POST",data:{fs_action:d,action:"flexible_shipping",nonce:b,shipment_id:e,data:c},dataType:"json"}).done(function(f){if(f){if(f=="0"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Invalid response: 0")}else{if(f.status=="success"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content").html(f.content);jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").hide();if(typeof f.message!="undefined"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html(f.message)}}else{jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html(f.message)}}}else{jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Request failed: invalid method?")}}).always(function(){jQuery(".button-shipping").attr("disabled",false);jQuery(".shipping-spinner").parent().find(".spinner").css({visibility:"hidden"})}).fail(function(f,g){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Request failed: "+g+" "+f.status)})}jQuery(function(a){a(document).on("click",".flexible-shipping-taxes-notice .notice-dismiss",function(){a.ajax(ajaxurl,{type:"POST",data:{action:"flexible_shipping_taxes_notice"}})})});
1
+ jQuery(document).ready(function(){if(jQuery("#flexible_shipping_labels_url").length){window.location.href=jQuery("#flexible_shipping_labels_url").attr("href")}if(jQuery("a.shipping_manifest_download").length==1){window.location.href=jQuery("a.shipping_manifest_download").attr("href")}if(typeof window.history.pushState=="function"){var a=document.location.href;var d=document.location.href;a=fs_removeParam("bulk_flexible_shipping_labels",a);a=fs_removeParam("bulk_flexible_shipping_send",a);a=fs_removeParam("bulk_flexible_shipping_manifests",a);a=fs_removeParam("bulk_flexible_shipping_no_labels_created",a);a=fs_trimChar(a,"?");if(a!=d){window.history.pushState({},"",a)}}var e=jQuery(".fs-connect__vertical-nav-container"),c=jQuery(".fs-connect__content-container");nextFeatureButtons=jQuery(".fs-banner__button-container .next-feature"),e.on("click",".vertical-menu__feature-item:not( .vertical-menu__feature-item-is-selected )",function(){b(jQuery(this).index())});nextFeatureButtons.on("click",function(g){g.preventDefault();var f=jQuery(this).closest(".fs-connect__slide").index();b(f+1)});function b(f){e.find(".vertical-menu__feature-item-is-selected").removeClass("vertical-menu__feature-item-is-selected");c.find(".fs__slide-is-active").removeClass("fs__slide-is-active");e.children().eq(f).addClass("vertical-menu__feature-item-is-selected");c.children().eq(f).addClass("fs__slide-is-active")}});function fs_removeParam(b,d){var e=d.split("?")[0],f,c=[],g=(d.indexOf("?")!==-1)?d.split("?")[1]:"";if(g!==""){c=g.split("&");for(var a=c.length-1;a>=0;a-=1){f=c[a].split("=")[0];if(f===b){c.splice(a,1)}}e=e+"?"+c.join("&")}return e}function fs_trimChar(b,a){while(b.charAt(0)==a){b=b.substring(1)}while(b.charAt(b.length-1)==a){b=b.substring(0,b.length-1)}return b}function fs_id(a){return jQuery(a).closest(".flexible_shipping_shipment").attr("data-id")}function fs_data_set_val(c,a,f){if(typeof a=="undefined"){return c}if(a.indexOf("[")==-1){c[a]=f}else{var d=a.split("[");var g=c;var e=c;var b="";jQuery.each(d,function(i,h){b=h.replace("]","");if(typeof g[b]=="undefined"){g[b]={}}e=g;g=g[b]});e[b]=f}return c}function fs_ajax(a,e,d){jQuery(".button-shipping").attr("disabled",true);jQuery(a).parent().find(".spinner").css({visibility:"visible"});var c={};jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content input, #flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content select, #flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content textarea").each(function(){if(jQuery(this).attr("type")=="radio"){c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery("#flexible_shipping_shipment_"+e+" input[name="+jQuery(this).attr("name")+"]:checked").val())}else{if(jQuery(this).attr("type")=="checkbox"){if(jQuery(this).is(":checked")){c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery(this).val())}else{c=fs_data_set_val(c,jQuery(this).attr("name"),"")}}else{c=fs_data_set_val(c,jQuery(this).attr("name"),jQuery(this).val())}}});var b=jQuery("#flexible_shipping_shipment_nonce_"+e).val();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").hide();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").removeClass("flexible_shipping_shipment_message_error");jQuery.ajax({url:fs_admin.ajax_url,type:"POST",data:{fs_action:d,action:"flexible_shipping",nonce:b,shipment_id:e,data:c},dataType:"json"}).done(function(f){if(f){if(f=="0"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Invalid response: 0")}else{if(f.status=="success"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content").html(f.content);jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").hide();if(typeof f.message!="undefined"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html(f.message)}}else{if(typeof f.content!=="undefined"){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_content").html(f.content)}jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html(f.message)}}}else{jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Request failed: invalid method?")}}).always(function(){jQuery(".button-shipping").attr("disabled",false);jQuery(".shipping-spinner").parent().find(".spinner").css({visibility:"hidden"})}).fail(function(f,g){jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").addClass("flexible_shipping_shipment_message_error");jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").show();jQuery("#flexible_shipping_shipment_"+e+" .flexible_shipping_shipment_message").html("Request failed: "+g+" "+f.status)})}jQuery(function(a){a(document).on("click",".flexible-shipping-taxes-notice .notice-dismiss",function(){a.ajax(ajaxurl,{type:"POST",data:{action:"flexible_shipping_taxes_notice"}})})});
assets/js/admin_saas_platform.js ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function flexible_shipping_saas_integration_options(integration) {
2
+ var integration_class = '.' + integration;
3
+ jQuery('.flexible_shipping_method_rules').css('display', 'table-row');
4
+ if (jQuery('#woocommerce_flexible_shipping_method_integration').val() == integration) {
5
+ jQuery(integration_class).closest('tr').css('display', 'table-row');
6
+ }
7
+ else {
8
+ jQuery(integration_class).closest('tr').css('display', 'none');
9
+ }
10
+ flexible_shipping_saas_rates_type_options();
11
+ }
12
+
13
+ function flexible_shipping_saas_rates_type_options() {
14
+ if ( jQuery('#woocommerce_flexible_shipping_method_integration').length ) {
15
+ var integration_class = '.' + jQuery('#woocommerce_flexible_shipping_method_integration').val();
16
+ if ( integration_class !== '.' ) {
17
+ var rates_type_value = jQuery('.fs-rates-type').val();
18
+ jQuery(integration_class).each(function (index) {
19
+ var closest_tr = jQuery(this).closest('tr');
20
+ if ('custom' === rates_type_value) {
21
+ if (!jQuery(this).hasClass('fs-method')) {
22
+ closest_tr.css('display', 'none');
23
+ } else {
24
+ closest_tr.css('display', 'table-row');
25
+ }
26
+ }
27
+ if ('live' === rates_type_value) {
28
+ if (!jQuery(this).hasClass('fs-live')) {
29
+ closest_tr.css('display', 'none');
30
+ } else {
31
+ closest_tr.css('display', 'table-row');
32
+ }
33
+ }
34
+ });
35
+ // force elements show/hide
36
+ jQuery(window).trigger('resize');
37
+ jQuery(integration_class).each(function (index) {
38
+ if ('checkbox' === jQuery(this).attr('type')) {
39
+ jQuery(this).trigger('change');
40
+ }
41
+ });
42
+ }
43
+ }
44
+ }
45
+
46
+ function flexible_shipping_saas_click_action(fs_action, element, event ) {
47
+ let id = jQuery(element).attr('data-id');
48
+ if ( typeof id !== 'undefined' ) {
49
+ event.stopImmediatePropagation();
50
+ event.preventDefault();
51
+ let element_id = fs_id(element);
52
+ fs_ajax( element, element_id, fs_action );
53
+ }
54
+ }
55
+
56
+ function flexible_shipping_saas_checkbox_dependent_field(checkbox) {
57
+ var dependend_field_id = jQuery(checkbox).data('dependent-field-id');
58
+ if (typeof dependend_field_id !== 'undefined' && jQuery(checkbox).is(':visible')) {
59
+ var dependend_field = jQuery('#'+dependend_field_id);
60
+ if (jQuery(checkbox).is(':checked')) {
61
+ dependend_field.closest('tr').css('display','table-row');
62
+ } else {
63
+ dependend_field.closest('tr').css('display','none');
64
+ }
65
+ }
66
+ var dependend_row_class = jQuery(checkbox).data('dependent-row-class');
67
+ if (typeof dependend_row_class !== 'undefined' ) {
68
+ var dependend_row = jQuery('.' + dependend_row_class);
69
+ if ( jQuery(checkbox).is(':visible') ) {
70
+ if (jQuery(checkbox).is(':checked')) {
71
+ dependend_row.css('display', 'table-row');
72
+ } else {
73
+ dependend_row.css('display', 'none');
74
+ }
75
+ } else {
76
+ dependend_row.css('display', 'table-row');
77
+ }
78
+ }
79
+ }
80
+
81
+ jQuery(document).on('click','.fs-saas-button-create', function( event ) {
82
+ flexible_shipping_saas_click_action( 'send', this, event );
83
+ });
84
+
85
+ jQuery(document).on('click','.fs-saas-button-save', function(e) {
86
+ flexible_shipping_saas_click_action( 'save', this, event );
87
+ });
88
+
89
+ jQuery(document).on('click','.fs-saas-button-cancel-created', function( e ) {
90
+ flexible_shipping_saas_click_action( 'cancel', this, event );
91
+ });
92
+
93
+ jQuery(document).on('change', '.fs-rates-type', function( e ) {
94
+ flexible_shipping_saas_rates_type_options();
95
+ });
96
+ jQuery(document).on('change', 'input[type=checkbox]', function( e ) {
97
+ flexible_shipping_saas_checkbox_dependent_field(this);
98
+ });
99
+
100
+ jQuery(document).ready(function() {
101
+ let elements = jQuery( '.fs_select2' );
102
+ if ( elements.length ) {
103
+ elements.select2();
104
+ }
105
+ });
106
+
assets/js/admin_saas_platform.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function flexible_shipping_saas_integration_options(b){var a="."+b;jQuery(".flexible_shipping_method_rules").css("display","table-row");if(jQuery("#woocommerce_flexible_shipping_method_integration").val()==b){jQuery(a).closest("tr").css("display","table-row")}else{jQuery(a).closest("tr").css("display","none")}flexible_shipping_saas_rates_type_options()}function flexible_shipping_saas_rates_type_options(){if(jQuery("#woocommerce_flexible_shipping_method_integration").length){var a="."+jQuery("#woocommerce_flexible_shipping_method_integration").val();if(a!=="."){var b=jQuery(".fs-rates-type").val();jQuery(a).each(function(c){var d=jQuery(this).closest("tr");if("custom"===b){if(!jQuery(this).hasClass("fs-method")){d.css("display","none")}else{d.css("display","table-row")}}if("live"===b){if(!jQuery(this).hasClass("fs-live")){d.css("display","none")}else{d.css("display","table-row")}}});jQuery(window).trigger("resize");jQuery(a).each(function(c){if("checkbox"===jQuery(this).attr("type")){jQuery(this).trigger("change")}})}}}function flexible_shipping_saas_click_action(c,a,b){let id=jQuery(a).attr("data-id");if(typeof id!=="undefined"){b.stopImmediatePropagation();b.preventDefault();let element_id=fs_id(a);fs_ajax(a,element_id,c)}}function flexible_shipping_saas_checkbox_dependent_field(c){var a=jQuery(c).data("dependent-field-id");if(typeof a!=="undefined"&&jQuery(c).is(":visible")){var e=jQuery("#"+a);if(jQuery(c).is(":checked")){e.closest("tr").css("display","table-row")}else{e.closest("tr").css("display","none")}}var b=jQuery(c).data("dependent-row-class");if(typeof b!=="undefined"){var d=jQuery("."+b);if(jQuery(c).is(":visible")){if(jQuery(c).is(":checked")){d.css("display","table-row")}else{d.css("display","none")}}else{d.css("display","table-row")}}}jQuery(document).on("click",".fs-saas-button-create",function(a){flexible_shipping_saas_click_action("send",this,a)});jQuery(document).on("click",".fs-saas-button-save",function(a){flexible_shipping_saas_click_action("save",this,event)});jQuery(document).on("click",".fs-saas-button-cancel-created",function(a){flexible_shipping_saas_click_action("cancel",this,event)});jQuery(document).on("change",".fs-rates-type",function(a){flexible_shipping_saas_rates_type_options()});jQuery(document).on("change","input[type=checkbox]",function(a){flexible_shipping_saas_checkbox_dependent_field(this)});jQuery(document).ready(function(){let elements=jQuery(".fs_select2");if(elements.length){elements.select2()}});
bootstrap.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- //require_once __DIR__ . '/vendor/autoload.php';
8
- require_once( 'classes/wpdesk/class-plugin.php' );
9
- require_once( 'classes/flexible-shipping-factory.php' );
10
- require_once( 'inc/functions.php' );
11
-
12
- WPDesk_Flexible_Shipping_Factory::get_plugin_instance();
 
 
 
 
 
 
 
 
 
 
 
 
classes/admin-notices.php CHANGED
@@ -34,16 +34,16 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Admin_Notices' ) ) {
34
  const BASED_ON_VALUE = 'value';
35
 
36
  /**
37
- * @var WPDesk_Flexible_Shipping_Plugin
38
  */
39
  private $plugin;
40
 
41
  /**
42
  * WPDesk_Flexible_Shipping_Export constructor.
43
  *
44
- * @param WPDesk_Flexible_Shipping_Plugin $plugin
45
  */
46
- public function __construct( WPDesk_Flexible_Shipping_Plugin $plugin ) {
47
  $this->plugin = $plugin;
48
  $this->hooks();
49
  }
34
  const BASED_ON_VALUE = 'value';
35
 
36
  /**
37
+ * @var Flexible_Shipping_Plugin
38
  */
39
  private $plugin;
40
 
41
  /**
42
  * WPDesk_Flexible_Shipping_Export constructor.
43
  *
44
+ * @param Flexible_Shipping_Plugin $plugin
45
  */
46
+ public function __construct( Flexible_Shipping_Plugin $plugin ) {
47
  $this->plugin = $plugin;
48
  $this->hooks();
49
  }
classes/bulk-actions.php CHANGED
@@ -287,6 +287,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Bulk_Actions' ) ) {
287
  foreach ($shipments as $shipment) {
288
  /* @var $shipment WPDesk_Flexible_Shipping_Shipment|WPDesk_Flexible_Shipping_Shipment_Interface */
289
  try {
 
290
  $shipment->api_create();
291
  $messages[$post_id][$shipment->get_id()] = array(
292
  'status' => 'created',
287
  foreach ($shipments as $shipment) {
288
  /* @var $shipment WPDesk_Flexible_Shipping_Shipment|WPDesk_Flexible_Shipping_Shipment_Interface */
289
  try {
290
+ $shipment->set_sent_via_bulk();
291
  $shipment->api_create();
292
  $messages[$post_id][$shipment->get_id()] = array(
293
  'status' => 'created',
classes/class-flexible-shipping-plugin.php ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Flexible_Shipping_Plugin
4
+ extends \WPDesk\PluginBuilder\Plugin\AbstractPlugin
5
+ implements \WPDesk\PluginBuilder\Plugin\HookableCollection
6
+ {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\HookableParent;
9
+ use \WPDesk\PluginBuilder\Plugin\TemplateLoad;
10
+
11
+ /**
12
+ * @var string
13
+ */
14
+ private $scripts_version = '162';
15
+
16
+ /**
17
+ * @var WPDesk_Flexible_Shipping_Admin_Notices
18
+ */
19
+ public $admin_notices;
20
+
21
+ /**
22
+ * @var string
23
+ */
24
+ private $default_settings_tab = 'connect';
25
+
26
+ /**
27
+ * Renderer.
28
+ *
29
+ * @var WPDesk\View\Renderer\Renderer;
30
+ */
31
+ private $renderer;
32
+
33
+ /**
34
+ * SaaS platform links,
35
+ *
36
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
37
+ */
38
+ private $saas_platform_links;
39
+
40
+ /**
41
+ * Is order processed on checkout?
42
+ *
43
+ * @var bool
44
+ */
45
+ private $is_order_processed_on_checkout = false;
46
+
47
+ /**
48
+ * Logger.
49
+ *
50
+ * @var \Psr\Log\LoggerInterface
51
+ */
52
+ private $logger;
53
+
54
+ /**
55
+ * Flexible_Invoices_Reports_Plugin constructor.
56
+ *
57
+ * @param WPDesk_Plugin_Info $plugin_info Plugin info.
58
+ */
59
+ public function __construct( WPDesk_Plugin_Info $plugin_info ) {
60
+ $this->plugin_info = $plugin_info;
61
+ parent::__construct( $this->plugin_info );
62
+
63
+ $this->logger = WPDesk_Flexible_Shipping_Logger_Factory::create_logger();
64
+ }
65
+
66
+
67
+ /**
68
+ * Load dependencies.
69
+ */
70
+ private function load_dependencies() {
71
+ new WPDesk_Flexible_Shipping_Shipment_CPT( $this );
72
+
73
+ new WPDesk_Flexible_Shipping_Shipping_Manifest_CPT( $this );
74
+
75
+ new WPDesk_Flexible_Shipping_Shipment_Ajax( $this );
76
+
77
+ new WPDesk_Flexible_Shipping_Bulk_Actions();
78
+
79
+ new WPDesk_Flexible_Shipping_Export( $this );
80
+
81
+ new WPDesk_Flexible_Shipping_Multilingual( $this );
82
+
83
+ new WPDesk_Flexible_Shipping_Multicurrency( $this );
84
+
85
+ $this->admin_notices = new WPDesk_Flexible_Shipping_Admin_Notices( $this );
86
+
87
+ $this->add_hookable( new WPDesk_Flexible_Shipping_Add_Shipping() );
88
+
89
+ $connection = new WPDesk_Flexible_Shipping_SaaS_Connection( $this->logger, $this->saas_platform_links );
90
+ $this->add_hookable( $connection );
91
+
92
+ $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_User_Registration( $connection, $this->saas_platform_links ) );
93
+
94
+ $services_manager = new WPDesk_Flexible_Shipping_SaaS_Services_Manager( $connection, $this->saas_platform_links, $this->logger );
95
+ $this->add_hookable( $services_manager );
96
+
97
+ if ( $services_manager->is_require_uk_states() ) {
98
+ $this->add_hookable( new WPDesk_Flexible_Shipping_UK_States() );
99
+ }
100
+
101
+ $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax( $connection ) );
102
+
103
+ $this->add_hookable( new WPDesk_Flexible_Shipping_Tracker() );
104
+
105
+ $this->add_hookable( new WPDesk_Flexible_Shipping_Shorcode_Unit_Weight() );
106
+ $this->add_hookable( new WPDesk_Flexible_Shipping_Shorcode_Unit_Dimension() );
107
+
108
+ $this->add_hookable( new \WPDesk\Notice\AjaxHandler( trailingslashit( $this->get_plugin()->get_plugin_url() ) . 'vendor/wpdesk/wp-notice/assets' ) );
109
+
110
+ $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler() );
111
+
112
+ $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Free_Shipping_Metadata_Handler() );
113
+
114
+ $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Logger_Downloader( new \WPDesk\Logger\WPDeskLoggerFactory() ) );
115
+
116
+ $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Tracker( $connection, $services_manager ) );
117
+
118
+ }
119
+
120
+ /**
121
+ * Init base variables for plugin
122
+ */
123
+ public function init_base_variables() {
124
+ $this->plugin_url = $this->plugin_info->get_plugin_url();
125
+
126
+ $this->plugin_path = $this->plugin_info->get_plugin_dir();
127
+ $this->template_path = $this->plugin_info->get_text_domain();
128
+
129
+ $this->plugin_text_domain = $this->plugin_info->get_text_domain();
130
+ $this->plugin_namespace = $this->plugin_info->get_text_domain();
131
+ $this->template_path = $this->plugin_info->get_text_domain();
132
+ $this->default_settings_tab = 'main';
133
+
134
+ $this->settings_url = admin_url( 'admin.php?page=flexible-shipping-settings' );
135
+ $this->docs_url = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://docs.flexibleshipping.com/collection/20-fs-table-rate/';
136
+
137
+ $this->default_view_args = array(
138
+ 'plugin_url' => $this->get_plugin_url()
139
+ );
140
+
141
+ }
142
+
143
+ /**
144
+ * Set renderer.
145
+ */
146
+ private function init_renderer() {
147
+ $resolver = new \WPDesk\View\Resolver\ChainResolver();
148
+ $resolver->appendResolver( new \WPDesk\View\Resolver\WPThemeResolver( $this->get_template_path() ) );
149
+ $resolver->appendResolver( new \WPDesk\View\Resolver\DirResolver( trailingslashit( $this->plugin_path ) . 'templates' ) );
150
+ $this->renderer = new WPDesk\View\Renderer\SimplePhpRenderer( $resolver );
151
+ WPDesk_Flexible_Shipping_Shipment_Saas::set_renderer( $this->renderer );
152
+ }
153
+
154
+ /**
155
+ * Init platform links.
156
+ */
157
+ private function init_platform_links() {
158
+ $this->saas_platform_links = new WPDesk_Flexible_Shipping_SaaS_Platform_Links();
159
+ WPDesk_Flexible_Shipping_Shipment_Saas::set_platform_links( $this->saas_platform_links );
160
+ }
161
+
162
+ /**
163
+ * Init.
164
+ */
165
+ public function init() {
166
+ $this->init_base_variables();
167
+ $this->init_platform_links();
168
+ $this->load_dependencies();
169
+ $this->init_renderer();
170
+ $this->hooks();
171
+ }
172
+
173
+ /**
174
+ * Hooks.
175
+ */
176
+ public function hooks() {
177
+ parent::hooks();
178
+
179
+ add_filter( 'woocommerce_shipping_methods', array( $this, 'woocommerce_shipping_methods_filter' ), 10, 1 );
180
+
181
+ add_action( 'admin_init', array( $this, 'session_init' ) );
182
+
183
+ add_action( 'woocommerce_after_shipping_rate', array( $this, 'woocommerce_after_shipping_rate' ), 10, 2 );
184
+
185
+ add_action( 'flexible_shipping_method_rate_id', array( $this, 'flexible_shipping_method_rate_id' ), 9999999,
186
+ 2 );
187
+
188
+ add_filter( 'woocommerce_shipping_chosen_method', array( $this, 'woocommerce_shipping_chosen_method' ), 10, 2 );
189
+
190
+ add_action( 'woocommerce_checkout_update_order_meta', array(
191
+ $this,
192
+ 'add_flexible_shipping_order_meta_on_checkout_woo_pre_27'
193
+ ) );
194
+
195
+ add_action( 'woocommerce_checkout_create_order', array(
196
+ $this,
197
+ 'add_flexible_shipping_order_meta_on_checkout'
198
+ ) );
199
+
200
+ add_filter( 'option_woocommerce_cod_settings', array( $this, 'option_woocommerce_cod_settings' ) );
201
+
202
+ $this->hooks_on_hookable_objects();
203
+
204
+ }
205
+
206
+ /**
207
+ * @param $methods
208
+ *
209
+ * @return mixed
210
+ */
211
+ public function woocommerce_shipping_methods_filter( $methods ) {
212
+ $methods['flexible_shipping'] = WPDesk_Flexible_Shipping::class;
213
+
214
+ return $methods;
215
+ }
216
+
217
+
218
+ /**
219
+ * @param array $value
220
+ *
221
+ * @return array
222
+ */
223
+ public function option_woocommerce_cod_settings( $value ) {
224
+ if ( is_checkout() ) {
225
+ if (
226
+ ! empty( $value )
227
+ && is_array( $value )
228
+ && $value['enabled'] == 'yes'
229
+ && ! empty( $value['enable_for_methods'] )
230
+ && is_array( $value['enable_for_methods'] )
231
+ ) {
232
+ foreach ( $value['enable_for_methods'] as $method ) {
233
+ if ( $method == 'flexible_shipping' ) {
234
+ $all_fs_methods = flexible_shipping_get_all_shipping_methods();
235
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
236
+ $flexible_shipping = $all_shipping_methods['flexible_shipping'];
237
+ $flexible_shipping_rates = $flexible_shipping->get_all_rates();
238
+ foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
239
+ $value['enable_for_methods'][] = $flexible_shipping_rate['id_for_shipping'];
240
+ }
241
+ break;
242
+ }
243
+ }
244
+ }
245
+ }
246
+
247
+ return $value;
248
+ }
249
+
250
+ /**
251
+ *
252
+ */
253
+ public function session_init() {
254
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
255
+ return;
256
+ }
257
+ if ( ! session_id() ) {
258
+ session_start();
259
+ }
260
+ }
261
+
262
+ /**
263
+ * Add flexible shipping order meta on checkout.
264
+ *
265
+ * @param WC_Order $order Order.
266
+ */
267
+ public function add_flexible_shipping_order_meta_on_checkout( WC_Order $order ) {
268
+ if ( ! $this->is_order_processed_on_checkout ) {
269
+ $mutex = \WPDesk\Mutex\WordpressPostMutex::fromOrder( $order );
270
+ $mutex->acquireLock();
271
+ $this->is_order_processed_on_checkout = true;
272
+ $order_shipping_methods = $order->get_shipping_methods();
273
+ foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
274
+ if ( isset( $shipping_method['item_meta'] )
275
+ && isset( $shipping_method['item_meta']['_fs_method'] )
276
+ ) {
277
+ $fs_method = $shipping_method['item_meta']['_fs_method'];
278
+ if ( ! empty( $fs_method['method_integration'] ) ) {
279
+ $order_meta = $order->get_meta( '_flexible_shipping_integration', false );
280
+ if ( ! in_array( $fs_method['method_integration'], $order_meta, true ) ) {
281
+ $order->add_meta_data( '_flexible_shipping_integration', $fs_method['method_integration'] );
282
+ }
283
+ }
284
+ }
285
+ }
286
+ $mutex->releaseLock();
287
+ }
288
+ }
289
+
290
+ /**
291
+ * Add flexible shipping order meta on checkout (for WooCommerce versions before 2.7).
292
+ *
293
+ * @param int $order_id Order id.
294
+ */
295
+ public function add_flexible_shipping_order_meta_on_checkout_woo_pre_27( $order_id ) {
296
+ if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
297
+ if ( ! $this->is_order_processed_on_checkout ) {
298
+ $this->is_order_processed_on_checkout = true;
299
+ $order = wc_get_order( $order_id );
300
+ $order_shipping_methods = $order->get_shipping_methods();
301
+ foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
302
+ if ( isset( $shipping_method['item_meta'] )
303
+ && isset( $shipping_method['item_meta']['_fs_method'] )
304
+ && isset( $shipping_method['item_meta']['_fs_method'][0] )
305
+ ) {
306
+ $fs_method = unserialize( $shipping_method['item_meta']['_fs_method'][0] );
307
+ if ( ! empty( $fs_method['method_integration'] ) ) {
308
+ add_post_meta( $order->id, '_flexible_shipping_integration', $fs_method['method_integration'] );
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+
316
+ /**
317
+ * @param $method
318
+ * @param $available_methods
319
+ *
320
+ * @return mixed
321
+ */
322
+ function woocommerce_shipping_chosen_method( $method, $available_methods ) {
323
+ $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
324
+ if ( isset( $chosen_shipping_methods[0] ) ) {
325
+ foreach ( $available_methods as $available_method ) {
326
+ if ( $available_method->id ==
327
+ $chosen_shipping_methods[0] ) {
328
+ $method = $available_method->id;
329
+ break;
330
+ }
331
+ }
332
+ }
333
+
334
+ return $method;
335
+ }
336
+
337
+ /**
338
+ * @param $hooq
339
+ */
340
+ public function admin_enqueue_scripts() {
341
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
342
+ wp_register_script( 'fs_admin',
343
+ trailingslashit( $this->get_plugin_assets_url() ) . 'js/admin' . $suffix . '.js', array( 'jquery' ),
344
+ $this->scripts_version );
345
+ wp_localize_script( 'fs_admin', 'fs_admin', array(
346
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
347
+ ) );
348
+ wp_enqueue_script( 'fs_admin' );
349
+
350
+ wp_register_script( 'fs_admin_saas_platform', trailingslashit( $this->get_plugin_assets_url() ) . 'js/admin_saas_platform' . $suffix . '.js', array( 'jquery' ), $this->scripts_version );
351
+ wp_enqueue_script( 'fs_admin_saas_platform' );
352
+
353
+ wp_enqueue_style( 'fs_admin',
354
+ trailingslashit( $this->get_plugin_assets_url() ) . 'css/admin' . $suffix . '.css', array(),
355
+ $this->scripts_version );
356
+ wp_enqueue_style( 'fs_font', trailingslashit( $this->get_plugin_assets_url() ) . 'css/font' . $suffix . '.css',
357
+ array(), $this->scripts_version );
358
+ }
359
+
360
+ /**
361
+ * @param array $links
362
+ *
363
+ * @return array
364
+ */
365
+ public function links_filter( $links ) {
366
+ $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://docs.flexibleshipping.com/collection/20-fs-table-rate/';
367
+ $support_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/support/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=&utm_content=fs-plugins-support' : 'https://flexibleshipping.com/support/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=&utm_content=fs-plugins-support';
368
+
369
+ $docs_link .= '??utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=&utm_content=fs-plugins-docs';
370
+
371
+ $plugin_links = array(
372
+ '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section=' . WPDesk_Flexible_Shipping_SaaS_Settings::METHOD_ID ) . '">' . __( 'Settings',
373
+ 'flexible-shipping' ) . '</a>',
374
+ '<a href="' . $docs_link . '">' . __( 'Docs', 'flexible-shipping' ) . '</a>',
375
+ '<a href="' . $support_link . '">' . __( 'Support', 'flexible-shipping' ) . '</a>',
376
+ );
377
+ $pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://flexibleshipping.com/table-rate/';
378
+ $utm = '?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=&utm_content=fs-plugins-upgrade';
379
+
380
+ if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) ) {
381
+ $plugin_links[] = '<a href="' . $pro_link . $utm . '" target="_blank" style="color:#d64e07;font-weight:bold;">' . __( 'Upgrade',
382
+ 'flexible-shipping' ) . '</a>';
383
+ }
384
+
385
+ return array_merge( $plugin_links, $links );
386
+ }
387
+
388
+
389
+ /**
390
+ * @param WC_Shipping_Rate $method
391
+ * @param int $index
392
+ */
393
+ public function woocommerce_after_shipping_rate( $method, $index ) {
394
+ if ( $method->method_id == 'flexible_shipping' ) {
395
+ $description = WC()->session->get( 'flexible_shipping_description_' . $method->id, false );
396
+ if ( $description && $description != '' ) {
397
+ echo $this->load_template(
398
+ 'flexible-shipping/after-shipping-rate',
399
+ 'cart/',
400
+ array(
401
+ 'method_description' => $description,
402
+ )
403
+ );
404
+ }
405
+ }
406
+ }
407
+
408
+ /**
409
+ * @param string $method_id
410
+ * @param array $shipping_method
411
+ *
412
+ * @return string
413
+ */
414
+ public function flexible_shipping_method_rate_id( $method_id, array $shipping_method ) {
415
+ if ( isset( $shipping_method['id_for_shipping'] ) && $shipping_method['id_for_shipping'] != '' ) {
416
+ $method_id = $shipping_method['id_for_shipping'];
417
+ }
418
+
419
+ return $method_id;
420
+ }
421
+
422
+
423
+ }
classes/class-menu.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Menu' ) ) {
8
+
9
+ /**
10
+ * Class WPDesk_Flexible_Shipping_Menu
11
+ */
12
+ class WPDesk_Flexible_Shipping_Menu implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
13
+
14
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
15
+
16
+ const MENU_POSITION_AFTER_PRODUCTS = 59;
17
+ const HOOK_PRIORITY_HIGH = 1;
18
+
19
+ /**
20
+ * Hooks.
21
+ */
22
+ public function hooks() {
23
+ add_action( 'admin_menu', array( $this, 'admin_menu_action' ), self::HOOK_PRIORITY_HIGH );
24
+ }
25
+
26
+ /**
27
+ * Admin menu action.
28
+ */
29
+ public function admin_menu_action() {
30
+ //add_menu_page( __( 'Settings', 'flexible-shipping' ), __( 'Flexible Shipping', 'flexible-shipping' ), 'manage_woocommerce', 'flexible-shipping', array( $this, 'settings_menu' ), null, self::MENU_POSITION_AFTER_PRODUCTS );
31
+ }
32
+
33
+ /**
34
+ * Settings menu;
35
+ */
36
+ public function settings_menu() {
37
+ echo '<div class="wrap"><h2>Settings</h2></div>';
38
+ }
39
+
40
+
41
+ }
42
+
43
+ }
classes/class-order-add-shipping.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Add_Shipping
5
+ */
6
+ class WPDesk_Flexible_Shipping_Add_Shipping implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ /**
11
+ * Shipping added?
12
+ *
13
+ * @var bool
14
+ */
15
+ private $shipping_added = false;
16
+
17
+ /**
18
+ * Hooks.
19
+ */
20
+ public function hooks() {
21
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 20, 2 );
22
+ add_action( 'admin_init', array( $this, 'handle_add_shipping' ) );
23
+ }
24
+
25
+ /**
26
+ * Add shipping.
27
+ *
28
+ * @param string $integration Integration.
29
+ */
30
+ private function add_shipping( $integration ) {
31
+ $class_name = apply_filters( 'flexible_shipping_shipment_class', 'WPDesk_Flexible_Shipping_Shipment_' . $integration, $integration );
32
+ if ( class_exists( $class_name ) ) {
33
+ $order = wc_get_order( $_GET['post'] );
34
+ if ( $order ) {
35
+ $order_id = $order->get_id();
36
+ $integration = $_GET['fs_add_shipping'];
37
+ // Translators: order id and integration.
38
+ $post_title = sprintf( __( 'Shipment for order %1$s, %2$s', 'flexible-shipping' ), $order_id, $integration );
39
+ $shipment_post = array(
40
+ 'post_title' => $post_title,
41
+ 'post_type' => 'shipment',
42
+ 'post_status' => 'fs-new',
43
+ 'post_parent' => $order_id
44
+ );
45
+ $shipment_id = wp_insert_post( $shipment_post );
46
+ update_post_meta( $shipment_id, '_integration', $integration );
47
+ $shipment = fs_get_shipment( $shipment_id, $order );
48
+ $shipment->set_created_via_add_shipment();
49
+ if ( method_exists( $shipment, 'admin_add_shipment' ) ) {
50
+ $shipment->admin_add_shipment();
51
+ }
52
+ $shipment->save();
53
+ $order->add_order_note( sprintf( __( 'Added new shipment via metabox. Shipment ID: %s', 'flexible-shipping' ), $shipment->get_id() ) );
54
+ $this->shipping_added = true;
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Handle add shipping.
61
+ */
62
+ public function handle_add_shipping() {
63
+ if ( isset( $_GET['fs_add_shipping'] ) && isset( $_GET['post'] ) ) {
64
+ if ( isset( $_GET['_wpnonce'] ) ) {
65
+ if ( wp_verify_nonce( $_GET['_wpnonce'], 'fs_add_shipping' ) ) {
66
+ $integration = $_GET['fs_add_shipping'];
67
+ $this->add_shipping( $integration );
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Add metabox.
75
+ *
76
+ * @param string $post_type Post type.
77
+ * @param WP_Post $post Post.
78
+ */
79
+ public function add_meta_box( $post_type, $post ) {
80
+ if ( 'shop_order' === $post_type ) {
81
+ $add_metabox = false;
82
+ $order = wc_get_order( $post->ID );
83
+ $created_via = $order->get_created_via();
84
+ if ( 'checkout' !== $created_via ) {
85
+ $add_metabox = true;
86
+ }
87
+ if ( ! $add_metabox ) {
88
+ $order_shipping_methods = $order->get_shipping_methods();
89
+ $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
90
+ $flexible_shipping = $all_shipping_methods['flexible_shipping'];
91
+ $flexible_shipping_rates = $flexible_shipping->get_all_rates();
92
+ foreach ( $order_shipping_methods as $order_shipping_method ) {
93
+ /** @var WC_Order_Item_Shipping $order_shipping_method */
94
+ $fs_method = $order_shipping_method->get_meta( '_fs_method' );
95
+ if ( ! empty( $fs_method ) && isset( $flexible_shipping_rates[ $fs_method['id_for_shipping'] ] ) ) {
96
+ $add_metabox = true;
97
+ }
98
+ }
99
+ }
100
+ $select_options = array();
101
+ $select_options = apply_filters( 'flexible_shipping_add_shipping_options', $select_options );
102
+ if ( $add_metabox && count( $select_options ) ) {
103
+ $select_options = array_merge(
104
+ array( '' => __( 'Select integration', 'flexible-shipping' ) ),
105
+ $select_options
106
+ );
107
+ $args = array(
108
+ 'select_options' => $select_options,
109
+ 'order_id' => $post->ID,
110
+ );
111
+ add_meta_box(
112
+ 'add_shipping_meta_box',
113
+ __( 'Add shipping', 'flexible-shipping' ),
114
+ array( $this, 'display_order_metabox' ),
115
+ 'shop_order',
116
+ 'side',
117
+ 'default',
118
+ $args
119
+ );
120
+
121
+ }
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Display order metabox.
127
+ *
128
+ * @param WP_Post $post Post.
129
+ * @param array $args Args.
130
+ */
131
+ public function display_order_metabox( $post, $args ) {
132
+ $select_options = $args['args']['select_options'];
133
+ $order_id = $args['args']['order_id'];
134
+ $add_shipping_url = admin_url( 'post.php?post=' . $order_id . '&action=edit' );
135
+ $add_shipping_url = wp_nonce_url( $add_shipping_url, 'fs_add_shipping' );
136
+ $add_shipping_url = str_replace( '&amp;', '&', $add_shipping_url );
137
+ include 'views/html-order-add_shipping-metabox.php';
138
+ }
139
+
140
+ }
classes/class-shipping-zone-data-extractor.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_UK_States
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor {
7
+
8
+ /**
9
+ * Shipping zone.
10
+ *
11
+ * @var WC_Shipping_Zone
12
+ */
13
+ private $shipping_zone;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor constructor.
17
+ *
18
+ * @param WC_Shipping_Zone $shipping_zone Shipping zone.
19
+ */
20
+ public function __construct( $shipping_zone ) {
21
+ $this->shipping_zone = $shipping_zone;
22
+ }
23
+
24
+ /**
25
+ * Get zone countries.
26
+ *
27
+ * @return array
28
+ */
29
+ public function get_countries() {
30
+ $countries = array();
31
+ $locations = $this->shipping_zone->get_zone_locations();
32
+ foreach ( $locations as $location ) {
33
+ if ( 'country' === $location->type ) {
34
+ $countries[ $location->code ] = $location->code;
35
+ }
36
+ if ( 'continent' === $location->type ) {
37
+ $continents = WC()->countries->get_continents();
38
+ $countries = $continents[ $location->code ]['countries'];
39
+ foreach ( $countries as $country ) {
40
+ $countries[ $country ] = $country;
41
+ }
42
+ }
43
+ }
44
+ if ( 0 === count( $countries ) ) {
45
+ $countries[] = 'other';
46
+ }
47
+ return $countries;
48
+ }
49
+
50
+ }
classes/class-shortcode-unit-dimension.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_UK_States
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shorcode_Unit_Dimension implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ /**
11
+ * Hooks.
12
+ */
13
+ public function hooks() {
14
+ add_shortcode( 'unit_dimension', [ $this, 'shortcode_unit_dimension' ] );
15
+ }
16
+
17
+ /**
18
+ * Shortcode Unit Dimension
19
+ *
20
+ * @return string
21
+ */
22
+ public function shortcode_unit_dimension() {
23
+ return '[' . get_option( 'woocommerce_dimension_unit', '' ) . ']';
24
+ }
25
+
26
+ }
classes/class-shortcode-unit-weight.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_UK_States
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shorcode_Unit_Weight implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ /**
11
+ * Hooks.
12
+ */
13
+ public function hooks() {
14
+ add_shortcode( 'unit_weight', [ $this, 'shortcode_unit_weight' ] );
15
+ }
16
+
17
+ /**
18
+ * Shortcode Unit Weight.
19
+ *
20
+ * @return string
21
+ */
22
+ public function shortcode_unit_weight() {
23
+ return '[' . get_option( 'woocommerce_weight_unit', '' ) . ']';
24
+ }
25
+
26
+ }
classes/class-uk-states.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_UK_States
5
+ */
6
+ class WPDesk_Flexible_Shipping_UK_States implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ const COUNTRY_GB = 'GB';
11
+
12
+ const PRIORITY_LATEST = 999999;
13
+
14
+ /**
15
+ * Hooks.
16
+ */
17
+ public function hooks() {
18
+ add_filter( 'woocommerce_states', [ $this, 'add_uk_counties_to_wc_states' ] );
19
+ add_filter( 'woocommerce_checkout_fields', [ $this, 'make_uk_state_required' ], self::PRIORITY_LATEST );
20
+ }
21
+
22
+ /**
23
+ * Make UK state required.
24
+ *
25
+ * @param array $fields Checkout fields.
26
+ *
27
+ * @return array
28
+ */
29
+ public function make_uk_state_required( array $fields ) {
30
+ $billing_country = WC()->customer->get_shipping_country();
31
+ if ( self::COUNTRY_GB === $billing_country ) {
32
+ $fields['billing']['billing_state']['required'] = true;
33
+ }
34
+ $shipping_country = WC()->customer->get_shipping_country();
35
+ if ( self::COUNTRY_GB === $shipping_country ) {
36
+ $fields['shipping']['shipping_state']['required'] = true;
37
+ }
38
+
39
+ return $fields;
40
+ }
41
+
42
+ /**
43
+ * Add UK Counties to Woocommerce states.
44
+ *
45
+ * @param array $states Woocommerce states.
46
+ *
47
+ * @return array
48
+ */
49
+ public function add_uk_counties_to_wc_states( array $states ) {
50
+ $states[ self::COUNTRY_GB ] = array(
51
+ 'AV' => 'Avon',
52
+ 'BE' => 'Bedfordshire',
53
+ 'BK' => 'Berkshire',
54
+ 'BU' => 'Buckinghamshire',
55
+ 'CA' => 'Cambridgeshire',
56
+ 'CH' => 'Cheshire',
57
+ 'CL' => 'Cleveland',
58
+ 'CO' => 'Cornwall',
59
+ 'CD' => 'County Durham',
60
+ 'CU' => 'Cumbria',
61
+ 'DE' => 'Derbyshire',
62
+ 'DV' => 'Devon',
63
+ 'DO' => 'Dorset',
64
+ 'ES' => 'East Sussex',
65
+ 'EX' => 'Essex',
66
+ 'GL' => 'Gloucestershire',
67
+ 'HA' => 'Hampshire',
68
+ 'HE' => 'Herefordshire',
69
+ 'HT' => 'Hertfordshire',
70
+ 'IW' => 'Isle of Wight',
71
+ 'KE' => 'Kent',
72
+ 'LA' => 'Lancashire',
73
+ 'LE' => 'Leicestershire',
74
+ 'LI' => 'Lincolnshire',
75
+ 'LO' => 'London',
76
+ 'ME' => 'Merseyside',
77
+ 'MI' => 'Middlesex',
78
+ 'NO' => 'Norfolk',
79
+ 'NH' => 'North Humberside',
80
+ 'NY' => 'North Yorkshire',
81
+ 'NS' => 'Northamptonshire',
82
+ 'NL' => 'Northumberland',
83
+ 'NT' => 'Nottinghamshire',
84
+ 'OX' => 'Oxfordshire',
85
+ 'SH' => 'Shropshire',
86
+ 'SO' => 'Somerset',
87
+ 'SM' => 'South Humberside',
88
+ 'SY' => 'South Yorkshire',
89
+ 'SF' => 'Staffordshire',
90
+ 'SU' => 'Suffolk',
91
+ 'SR' => 'Surrey',
92
+ 'TW' => 'Tyne and Wear',
93
+ 'WA' => 'Warwickshire',
94
+ 'WM' => 'West Midlands',
95
+ 'WS' => 'West Sussex',
96
+ 'WY' => 'West Yorkshire',
97
+ 'WI' => 'Wiltshire',
98
+ 'WO' => 'Worcestershire',
99
+ 'ABD' => 'Scotland / Aberdeenshire',
100
+ 'ANS' => 'Scotland / Angus',
101
+ 'ARL' => 'Scotland / Argyle & Bute',
102
+ 'AYR' => 'Scotland / Ayrshire',
103
+ 'CLK' => 'Scotland / Clackmannanshire',
104
+ 'DGY' => 'Scotland / Dumfries & Galloway',
105
+ 'DNB' => 'Scotland / Dunbartonshire',
106
+ 'DDE' => 'Scotland / Dundee',
107
+ 'ELN' => 'Scotland / East Lothian',
108
+ 'EDB' => 'Scotland / Edinburgh',
109
+ 'FIF' => 'Scotland / Fife',
110
+ 'GGW' => 'Scotland / Glasgow',
111
+ 'HLD' => 'Scotland / Highland',
112
+ 'LKS' => 'Scotland / Lanarkshire',
113
+ 'MLN' => 'Scotland / Midlothian',
114
+ 'MOR' => 'Scotland / Moray',
115
+ 'OKI' => 'Scotland / Orkney',
116
+ 'PER' => 'Scotland / Perth and Kinross',
117
+ 'RFW' => 'Scotland / Renfrewshire',
118
+ 'SB' => 'Scotland / Scottish Borders',
119
+ 'SHI' => 'Scotland / Shetland Isles',
120
+ 'STI' => 'Scotland / Stirling',
121
+ 'WLN' => 'Scotland / West Lothian',
122
+ 'WIS' => 'Scotland / Western Isles',
123
+ 'AGY' => 'Wales / Anglesey',
124
+ 'GNT' => 'Wales / Blaenau Gwent',
125
+ 'CP' => 'Wales / Caerphilly',
126
+ 'CF' => 'Wales / Cardiff',
127
+ 'CAE' => 'Wales / Carmarthenshire',
128
+ 'CR' => 'Wales / Ceredigion',
129
+ 'CW' => 'Wales / Conwy',
130
+ 'DEN' => 'Wales / Denbighshire',
131
+ 'FLN' => 'Wales / Flintshire',
132
+ 'GLA' => 'Wales / Glamorgan',
133
+ 'GWN' => 'Wales / Gwynedd',
134
+ 'MT' => 'Wales / Merthyr Tydfil',
135
+ 'MON' => 'Wales / Monmouthshire',
136
+ 'PT' => 'Wales / Neath Port Talbot',
137
+ 'NP' => 'Wales / Newport',
138
+ 'PEM' => 'Wales / Pembrokeshire',
139
+ 'POW' => 'Wales / Powys',
140
+ 'RT' => 'Wales / Rhondda Cynon Taff',
141
+ 'SS' => 'Wales / Swansea',
142
+ 'TF' => 'Wales / Torfaen',
143
+ 'WX' => 'Wales / Wrexham',
144
+ 'ANT' => 'Northern Ireland / County Antrim',
145
+ 'ARM' => 'Northern Ireland / County Armagh',
146
+ 'DOW' => 'Northern Ireland / County Down',
147
+ 'FER' => 'Northern Ireland / County Fermanagh',
148
+ 'LDY' => 'Northern Ireland / County Londonderry',
149
+ 'TYR' => 'Northern Ireland / County Tyrone',
150
+ );
151
+ return $states;
152
+ }
153
+
154
+ }
classes/flexible-shipping-export.php CHANGED
@@ -9,16 +9,16 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Export' ) ) {
9
  class WPDesk_Flexible_Shipping_Export {
10
 
11
  /**
12
- * @var WPDesk_Flexible_Shipping_Plugin
13
  */
14
  private $plugin;
15
 
16
  /**
17
  * WPDesk_Flexible_Shipping_Export constructor.
18
  *
19
- * @param WPDesk_Flexible_Shipping_Plugin $plugin
20
  */
21
- public function __construct( WPDesk_Flexible_Shipping_Plugin $plugin ) {
22
  $this->plugin = $plugin;
23
  $this->hooks();
24
  }
9
  class WPDesk_Flexible_Shipping_Export {
10
 
11
  /**
12
+ * @var Flexible_Shipping_Plugin
13
  */
14
  private $plugin;
15
 
16
  /**
17
  * WPDesk_Flexible_Shipping_Export constructor.
18
  *
19
+ * @param Flexible_Shipping_Plugin $plugin
20
  */
21
+ public function __construct( Flexible_Shipping_Plugin $plugin ) {
22
  $this->plugin = $plugin;
23
  $this->hooks();
24
  }
classes/flexible-shipping-factory.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
- require_once( 'wpdesk/class-plugin.php' );
3
- require_once( 'wpdesk/interface-plugin-factory.php' );
4
- require_once( 'flexible-shipping-plugin.php' );
5
-
6
-
7
- final class WPDesk_Flexible_Shipping_Factory implements WPDesk_Plugin_Factory_1_10 {
8
-
9
- const PHP_EXTENSION = '.php';
10
- /**
11
- * @var WPDesk_Flexible_Shipping_Plugin
12
- */
13
- private static $instance = null;
14
-
15
- /**
16
- * Builds instance of plugin. If called more than once then more than one instance is created.
17
- *
18
- * @return WPDesk_Flexible_Shipping_Plugin
19
- */
20
- public static function build_plugin() {
21
- $wpdesk_flexible_shipping_plugin_data = array();
22
-
23
- $class_name = apply_filters( self::WPDESK_FILTER_PLUGIN_CLASS, WPDesk_Flexible_Shipping_Plugin::class );
24
-
25
- $plugin_dir = dirname( dirname( __FILE__ ) );
26
- $plugin_file = trailingslashit( $plugin_dir ) . basename( $plugin_dir ) . self::PHP_EXTENSION;
27
-
28
- return new $class_name( $plugin_file, $wpdesk_flexible_shipping_plugin_data );
29
- }
30
-
31
- /**
32
- * Builds instance if needed and ensures there is only one instance.
33
- *
34
- * @return WPDesk_Flexible_Shipping_Plugin
35
- */
36
- public static function get_plugin_instance() {
37
- if ( empty( self::$instance ) ) {
38
- self::$instance = self::build_plugin();
39
- }
40
-
41
- return self::$instance;
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/flexible-shipping-plugin.php DELETED
@@ -1,328 +0,0 @@
1
- <?php
2
- require_once( 'wpdesk/class-plugin.php' );
3
-
4
- class WPDesk_Flexible_Shipping_Plugin extends WPDesk_Plugin_1_10 {
5
-
6
- /**
7
- * @var string
8
- */
9
- private $scripts_version = '60';
10
-
11
- /**
12
- * @var WPDesk_Flexible_Shipping_Admin_Notices
13
- */
14
- public $admin_notices;
15
-
16
- /**
17
- * Is order processed on checkout?
18
- *
19
- * @var bool
20
- */
21
- private $is_order_processed_on_checkout = false;
22
-
23
- /**
24
- * WPDesk_Flexible_Shipping_Plugin constructor.
25
- *
26
- * @param $base_file
27
- * @param $plugin_data
28
- */
29
- public function __construct( $base_file, $plugin_data ) {
30
- $this->plugin_namespace = 'flexible-shipping';
31
- $this->plugin_text_domain = 'flexible-shipping';
32
-
33
- $this->plugin_has_settings = false;
34
- $this->default_settings_tab = 'welcome';
35
-
36
- parent::__construct( $base_file, $plugin_data );
37
-
38
- if ( $this->plugin_is_active() ) {
39
- $this->init();
40
- $this->hooks();
41
- }
42
- }
43
-
44
- /**
45
- *
46
- */
47
- private function load_dependencies() {
48
- require_once('shipment/cpt-shipment.php');
49
- new WPDesk_Flexible_Shipping_Shipment_CPT( $this );
50
-
51
- require_once('manifest/cpt-shipping-manifest.php');
52
- new WPDesk_Flexible_Shipping_Shipping_Manifest_CPT( $this );
53
-
54
- require_once('shipment/ajax.php');
55
- new WPDesk_Flexible_Shipping_Shipment_Ajax( $this );
56
-
57
- require_once('shipment/class-shipment.php');
58
- require_once('shipment/interface-shipment.php');
59
- require_once('shipment/functions.php');
60
-
61
- require_once('manifest/class-manifest.php');
62
- require_once('manifest/interface-manifest.php');
63
- require_once('manifest/functions.php');
64
- require_once('manifest/class-manifest-fs.php');
65
-
66
- require_once('bulk-actions.php');
67
- new WPDesk_Flexible_Shipping_Bulk_Actions();
68
-
69
- require_once('order-add-shipping.php');
70
- new WPDesk_Flexible_Shipping_Add_Shipping();
71
-
72
- require_once( 'shipping-method.php' );
73
- require_once( 'shipping-method-info.php' );
74
-
75
- require_once( 'flexible-shipping-export.php' );
76
- new WPDesk_Flexible_Shipping_Export( $this );
77
-
78
- require_once( 'multilingual.php' );
79
- new WPDesk_Flexible_Shipping_Multilingual( $this );
80
-
81
- require_once( 'multicurrency.php' );
82
- new WPDesk_Flexible_Shipping_Multicurrency( $this );
83
-
84
- require_once( 'admin-notices.php' );
85
- $this->admin_notices = new WPDesk_Flexible_Shipping_Admin_Notices( $this );
86
- }
87
-
88
- /**
89
- *
90
- */
91
- public function init() {
92
- $this->load_dependencies();
93
- }
94
-
95
- /**
96
- *
97
- */
98
- public function hooks() {
99
- parent::hooks();
100
-
101
- add_filter( 'woocommerce_shipping_methods', array( $this, 'woocommerce_shipping_methods_filter' ), 10, 1 );
102
-
103
- add_action( 'admin_init', array( $this, 'session_init') );
104
-
105
- add_action( 'woocommerce_after_shipping_rate', array( $this, 'woocommerce_after_shipping_rate' ), 10, 2 );
106
-
107
- add_action( 'flexible_shipping_method_rate_id', array( $this, 'flexible_shipping_method_rate_id' ), 9999999, 2 );
108
-
109
- add_filter( 'woocommerce_shipping_chosen_method', array( $this, 'woocommerce_shipping_chosen_method' ), 10, 2);
110
-
111
- add_action( 'woocommerce_checkout_update_order_meta', array(
112
- $this,
113
- 'add_flexible_shipping_order_meta_on_checkout_woo_pre_27'
114
- ) );
115
-
116
- add_action( 'woocommerce_checkout_create_order', array(
117
- $this,
118
- 'add_flexible_shipping_order_meta_on_checkout'
119
- ) );
120
-
121
- add_filter( 'option_woocommerce_cod_settings', array( $this, 'option_woocommerce_cod_settings' ) );
122
-
123
- }
124
-
125
- /**
126
- * @param $methods
127
- *
128
- * @return mixed
129
- */
130
- public function woocommerce_shipping_methods_filter( $methods ) {
131
- $methods['flexible_shipping'] = 'WPDesk_Flexible_Shipping';
132
- $methods['flexible_shipping_info'] = 'WPDesk_Flexible_Shipping_Info';
133
- return $methods;
134
- }
135
-
136
-
137
- /**
138
- * @param array $value
139
- *
140
- * @return array
141
- */
142
- public function option_woocommerce_cod_settings( $value ) {
143
- if ( is_checkout() ) {
144
- if (
145
- !empty( $value )
146
- && is_array( $value )
147
- && $value['enabled'] == 'yes'
148
- && !empty( $value['enable_for_methods'] )
149
- && is_array( $value['enable_for_methods'] )
150
- ) {
151
- foreach ( $value['enable_for_methods'] as $method ) {
152
- if ( $method == 'flexible_shipping' ) {
153
- $all_fs_methods = flexible_shipping_get_all_shipping_methods();
154
- $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
155
- $flexible_shipping = $all_shipping_methods['flexible_shipping'];
156
- $flexible_shipping_rates = $flexible_shipping->get_all_rates();
157
- foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
158
- $value['enable_for_methods'][] = $flexible_shipping_rate['id_for_shipping'];
159
- }
160
- break;
161
- }
162
- }
163
- }
164
- }
165
- return $value;
166
- }
167
-
168
- /**
169
- *
170
- */
171
- public function session_init() {
172
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
173
- return;
174
- }
175
- if ( ! session_id() ) {
176
- session_start();
177
- }
178
- }
179
-
180
- /**
181
- * Add flexible shipping order meta on checkout.
182
- *
183
- * @param WC_Order $order Order.
184
- */
185
- public function add_flexible_shipping_order_meta_on_checkout( WC_Order $order ) {
186
- if ( ! $this->is_order_processed_on_checkout ) {
187
- $mutex = \WPDesk\Mutex\WordpressPostMutex::fromOrder( $order );
188
- $mutex->acquireLock();
189
- $this->is_order_processed_on_checkout = true;
190
- $order_shipping_methods = $order->get_shipping_methods();
191
- foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
192
- if ( isset( $shipping_method['item_meta'] )
193
- && isset( $shipping_method['item_meta']['_fs_method'] )
194
- ) {
195
- $fs_method = $shipping_method['item_meta']['_fs_method'];
196
- if ( ! empty( $fs_method['method_integration'] ) ) {
197
- $order_meta = $order->get_meta( '_flexible_shipping_integration', false );
198
- if ( ! in_array( $fs_method['method_integration'], $order_meta, true ) ) {
199
- $order->add_meta_data( '_flexible_shipping_integration', $fs_method['method_integration'] );
200
- }
201
- }
202
- }
203
- }
204
- $mutex->releaseLock();
205
- }
206
- }
207
-
208
- /**
209
- * Add flexible shipping order meta on checkout (for WooCommerce versions before 2.7).
210
- *
211
- * @param int $order_id Order id.
212
- */
213
- public function add_flexible_shipping_order_meta_on_checkout_woo_pre_27( $order_id ) {
214
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
215
- if ( ! $this->is_order_processed_on_checkout ) {
216
- $this->is_order_processed_on_checkout = true;
217
- $order = wc_get_order( $order_id );
218
- $order_shipping_methods = $order->get_shipping_methods();
219
- foreach ( $order_shipping_methods as $shipping_id => $shipping_method ) {
220
- if ( isset( $shipping_method['item_meta'] )
221
- && isset( $shipping_method['item_meta']['_fs_method'] )
222
- && isset( $shipping_method['item_meta']['_fs_method'][0] )
223
- ) {
224
- $fs_method = unserialize( $shipping_method['item_meta']['_fs_method'][0] );
225
- if ( ! empty( $fs_method['method_integration'] ) ) {
226
- add_post_meta( $order->id, '_flexible_shipping_integration', $fs_method['method_integration'] );
227
- }
228
- }
229
- }
230
- }
231
- }
232
- }
233
-
234
- /**
235
- * @param $method
236
- * @param $available_methods
237
- *
238
- * @return mixed
239
- */
240
- function woocommerce_shipping_chosen_method( $method, $available_methods ) {
241
- $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods', array() );
242
- if ( isset( $chosen_shipping_methods[0] ) ) {
243
- foreach ($available_methods as $available_method ) {
244
- if ( $available_method->id ==
245
- $chosen_shipping_methods[0] ) {
246
- $method = $available_method->id;
247
- break;
248
- }
249
- }
250
- }
251
- return $method;
252
- }
253
-
254
- /**
255
- * @param $hooq
256
- */
257
- public function admin_enqueue_scripts( $hooq ) {
258
- $current_screen = get_current_screen();
259
- if ( $current_screen->id === 'woocommerce_page_wc-settings' || $current_screen->id === 'edit-shop_order' || $current_screen->id === 'shop_order' ) {
260
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
261
- wp_register_script( 'fs_admin', trailingslashit( $this->get_plugin_assets_url() ) . 'js/admin' . $suffix . '.js', array( 'jquery' ), $this->scripts_version );
262
- wp_localize_script( 'fs_admin', 'fs_admin', array(
263
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
264
- ));
265
- wp_enqueue_script( 'fs_admin' );
266
- wp_enqueue_style( 'fs_admin', trailingslashit( $this->get_plugin_assets_url() ) . 'css/admin' . $suffix . '.css', array(), $this->scripts_version );
267
- wp_enqueue_style( 'fs_font', trailingslashit( $this->get_plugin_assets_url() ) . 'css/font' . $suffix . '.css', array(), $this->scripts_version );
268
- }
269
- }
270
-
271
- /**
272
- * @param array $links
273
- *
274
- * @return array
275
- */
276
- public function links_filter( $links ) {
277
- $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
278
- $support_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/support/' : 'https://www.wpdesk.net/support';
279
-
280
- $docs_link .= '?utm_source=wp-admin-plugins&utm_medium=quick-link&utm_campaign=flexible-shipping-docs-link';
281
-
282
- $plugin_links = array(
283
- '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section=flexible_shipping_info') . '">' . __( 'Settings', 'flexible-shipping' ) . '</a>',
284
- '<a href="' . $docs_link . '">' . __( 'Docs', 'flexible-shipping' ) . '</a>',
285
- '<a href="' . $support_link . '">' . __( 'Support', 'flexible-shipping' ) . '</a>',
286
- );
287
- $pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/';
288
- $utm = '?utm_source=wp-admin-plugins&utm_medium=link&utm_campaign=flexible-shipping-plugins-upgrade-link';
289
-
290
- if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) )
291
- $plugin_links[] = '<a href="' . $pro_link . $utm . '" target="_blank" style="color:#d64e07;font-weight:bold;">' . __( 'Upgrade', 'flexible-shipping' ) . '</a>';
292
- return array_merge( $plugin_links, $links );
293
- }
294
-
295
-
296
- /**
297
- * @param WC_Shipping_Rate $method
298
- * @param int $index
299
- */
300
- public function woocommerce_after_shipping_rate( $method, $index ) {
301
- if ( $method->method_id == 'flexible_shipping' ) {
302
- $description = WC()->session->get('flexible_shipping_description_' . $method->id, false );
303
- if ( $description && $description != '' ) {
304
- echo $this->load_template(
305
- 'flexible-shipping/after-shipping-rate',
306
- 'cart/',
307
- array(
308
- 'method_description' => $description,
309
- )
310
- );
311
- }
312
- }
313
- }
314
-
315
- /**
316
- * @param string $method_id
317
- * @param array $shipping_method
318
- *
319
- * @return string
320
- */
321
- public function flexible_shipping_method_rate_id( $method_id, array $shipping_method ) {
322
- if ( isset( $shipping_method['id_for_shipping'] ) && $shipping_method['id_for_shipping'] != '' ) {
323
- $method_id = $shipping_method['id_for_shipping'];
324
- }
325
- return $method_id;
326
- }
327
-
328
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/logger/class-logger-factory.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Logger_Factory
5
+ */
6
+ class WPDesk_Flexible_Shipping_Logger_Factory {
7
+
8
+ /**
9
+ * Logger.
10
+ *
11
+ * @var \Psr\Log\LoggerInterface
12
+ */
13
+ private static $logger;
14
+
15
+ /**
16
+ * Create logger.
17
+ *
18
+ * @return \Psr\Log\LoggerInterface
19
+ */
20
+ public static function create_logger() {
21
+ if ( null === self::$logger ) {
22
+ $logger_settings = new WPDesk_Flexible_Shipping_SaaS_Logger_Settings();
23
+
24
+ self::$logger = new WPDesk_Flexible_Shipping_WooCommerce_Context_Logger(
25
+ @\WPDesk\Logger\LoggerFacade::get_logger( $logger_settings->get_logger_channel_name() ),
26
+ $logger_settings->get_logging_context()
27
+ );
28
+
29
+ if ( ! $logger_settings->is_enabled() ) {
30
+ \WPDesk\Logger\LoggerFacade::set_disable_log( $logger_settings->get_logger_channel_name() );
31
+ }
32
+ }
33
+ return self::$logger;
34
+ }
35
+
36
+ }
classes/logger/class-saas-logger-downloader.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Logger_Downloader implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ const GET_PARAMETER = 'fs-get-log';
11
+
12
+ /**
13
+ * Logger factory.
14
+ *
15
+ * @var \WPDesk\Logger\WPDeskLoggerFactory
16
+ */
17
+ private $logger_factory;
18
+
19
+ /**
20
+ * WPDesk_Flexible_Shipping_SaaS_Logger_Downloader constructor.
21
+ *
22
+ * @param \WPDesk\Logger\WPDeskLoggerFactory $logger_factory Logger factory.
23
+ */
24
+ public function __construct( \WPDesk\Logger\WPDeskLoggerFactory $logger_factory = null ) {
25
+ $this->logger_factory = $logger_factory;
26
+ }
27
+
28
+ /**
29
+ * Hooks.
30
+ */
31
+ public function hooks() {
32
+ add_action( 'admin_init', [ $this, 'handle_log_file_download' ] );
33
+ }
34
+
35
+ /**
36
+ * Get download URL.
37
+ *
38
+ * @return string
39
+ */
40
+ public function get_download_url() {
41
+ return admin_url( 'admin.php?' . self::GET_PARAMETER . '=1' );
42
+ }
43
+
44
+ /**
45
+ * Handle log file download.
46
+ */
47
+ public function handle_log_file_download() {
48
+ if ( isset( $_GET[ self::GET_PARAMETER ] ) ) {
49
+ if ( current_user_can( 'manage_options' ) ) {
50
+ $logger_settings = new WPDesk_Flexible_Shipping_SaaS_Logger_Settings();
51
+ $file_name = $this->logger_factory->getFileName( $logger_settings->get_logger_channel_name() );
52
+ if ( file_exists( $file_name ) ) {
53
+ header( 'Content-Type: text/plain' );
54
+ header( 'Content-Disposition: attachment; filename="fs-debug.log"' );
55
+ readfile( $file_name );
56
+ } else {
57
+ wp_die( __( 'File not exists!', 'flexible-shipping' ) );
58
+ }
59
+ } else {
60
+ wp_die( __( 'Insufficient privileges!', 'flexible-shipping' ) );
61
+ }
62
+ }
63
+ }
64
+
65
+ }
classes/logger/class-saas-logger-settings.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Logger_Settings {
7
+
8
+ const LOGGER_CHANNEL_NAME = 'fs';
9
+
10
+ const LOGGING_CONTEXT = 'saas-flexible-shipping';
11
+
12
+ const DEBUG_LOG_OPTION = 'debug_log';
13
+
14
+ const OPTION_NAME = 'fs_logger_enabled';
15
+
16
+ const OPTION_VALUE_DISABLED = '0';
17
+ const OPTION_VALUE_ENABLED = '1';
18
+ /**
19
+ * Enabled.
20
+ *
21
+ * @var bool
22
+ */
23
+ private $enabled = false;
24
+
25
+ /**
26
+ * SaaS settings.
27
+ *
28
+ * @var WPDesk_Flexible_Shipping_SaaS_Settings
29
+ */
30
+ private $saas_settings;
31
+
32
+ /**
33
+ * WPDesk_Flexible_Shipping_SaaS_Logger_Settings constructor.
34
+ *
35
+ * @param WPDesk_Flexible_Shipping_SaaS_Settings $saas_settings SaaS settings.
36
+ */
37
+ public function __construct( WPDesk_Flexible_Shipping_SaaS_Settings $saas_settings = null ) {
38
+ $option_value = get_option( self::OPTION_NAME, self::OPTION_VALUE_DISABLED );
39
+ $this->enabled = self::OPTION_VALUE_ENABLED === $option_value;
40
+
41
+ $this->saas_settings = $saas_settings;
42
+ }
43
+
44
+ /**
45
+ * Get logger channel name.
46
+ *
47
+ * @return string
48
+ */
49
+ public function get_logger_channel_name() {
50
+ return self::LOGGER_CHANNEL_NAME;
51
+ }
52
+
53
+ /**
54
+ * Get logging context.
55
+ *
56
+ * @return string
57
+ */
58
+ public function get_logging_context() {
59
+ return self::LOGGING_CONTEXT;
60
+ }
61
+
62
+ /**
63
+ * Is enabled.
64
+ *
65
+ * @return bool
66
+ */
67
+ public function is_enabled() {
68
+ return $this->enabled;
69
+ }
70
+
71
+ /**
72
+ * Update option from saas settings.
73
+ */
74
+ public function update_option_from_saas_settings() {
75
+ $saas_settings_value = $this->saas_settings->get_option( self::DEBUG_LOG_OPTION );
76
+ if ( ! empty( $saas_settings_value ) && 'yes' === $saas_settings_value ) {
77
+ $option_value = self::OPTION_VALUE_ENABLED;
78
+ } else {
79
+ $option_value = self::OPTION_VALUE_DISABLED;
80
+ }
81
+ update_option( self::OPTION_NAME, $option_value );
82
+ $this->enabled = self::OPTION_VALUE_ENABLED === $option_value;
83
+ }
84
+
85
+ /**
86
+ * Add fields to settings.
87
+ *
88
+ * @param array $settings Settings.
89
+ *
90
+ * @return array
91
+ */
92
+ public function add_fields_to_settings( array $settings ) {
93
+ $settings[] = array(
94
+ 'type' => 'title',
95
+ 'title' => __( 'Advanced settings', 'flexible-shipping' ),
96
+ );
97
+ $settings[ self::DEBUG_LOG_OPTION ] = array(
98
+ 'type' => 'checkbox',
99
+ 'label' => __( 'Enable Debug Mode', 'flexible-shipping' ),
100
+ 'title' => __( 'Debug mode', 'flexible-shipping' ),
101
+ );
102
+ if ( 'yes' === $this->saas_settings->get_option( self::DEBUG_LOG_OPTION ) ) {
103
+ $downloader = new WPDesk_Flexible_Shipping_SaaS_Logger_Downloader();
104
+
105
+ $settings[ self::DEBUG_LOG_OPTION ]['description'] = sprintf(
106
+ // Translators: URL.
107
+ __( '%1$sDownload debug.log file%2$s', 'flexible-shipping' ),
108
+ sprintf( '<a href="%1$s">', $downloader->get_download_url() ),
109
+ '</a>'
110
+ );
111
+ }
112
+ return $settings;
113
+ }
114
+
115
+ }
classes/logger/class-woocommerce-context-logger.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Psr\Log\LoggerInterface;
4
+ use Psr\Log\LoggerTrait;
5
+
6
+ /**
7
+ * Class WPDesk_Flexible_Shipping_WooCommerce_Context_Logger
8
+ */
9
+ class WPDesk_Flexible_Shipping_WooCommerce_Context_Logger implements LoggerInterface {
10
+
11
+ use LoggerTrait;
12
+
13
+ /**
14
+ * Logger.
15
+ *
16
+ * @var LoggerInterface
17
+ */
18
+ private $logger;
19
+
20
+ /**
21
+ * Default context.
22
+ *
23
+ * @var array
24
+ */
25
+ private $default_context;
26
+
27
+ /**
28
+ * WPDesk_Flexible_Shipping_Context_Logger constructor.
29
+ *
30
+ * @param LoggerInterface $logger Logger.
31
+ * @param string $source WooCommerce source context.
32
+ * @param array $context Default context for logger.
33
+ */
34
+ public function __construct( LoggerInterface $logger, $source, array $context = [] ) {
35
+ $this->logger = $logger;
36
+
37
+ $context['source'] = $source;
38
+ $this->default_context = $context;
39
+ }
40
+
41
+ /**
42
+ * Logs with an arbitrary level.
43
+ *
44
+ * @param string $level Level.
45
+ * @param string $message Message.
46
+ * @param array $context Context.
47
+ *
48
+ * @return void
49
+ */
50
+ public function log( $level, $message, array $context = array() ) {
51
+ $context = array_merge( $this->default_context, $context );
52
+ $this->logger->log( $level, $message, $context );
53
+ }
54
+
55
+ }
56
+
classes/manifest/cpt-shipping-manifest.php CHANGED
@@ -6,7 +6,7 @@ class WPDesk_Flexible_Shipping_Shipping_Manifest_CPT {
6
 
7
  private $plugin = null;
8
 
9
- public function __construct( WPDesk_Flexible_Shipping_Plugin $plugin ) {
10
  $this->plugin = $plugin;
11
  $this->hooks();
12
  }
6
 
7
  private $plugin = null;
8
 
9
+ public function __construct( Flexible_Shipping_Plugin $plugin ) {
10
  $this->plugin = $plugin;
11
  $this->hooks();
12
  }
classes/multicurrency.php CHANGED
@@ -9,16 +9,16 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Multicurrency' ) ) {
9
  class WPDesk_Flexible_Shipping_Multicurrency {
10
 
11
  /**
12
- * @var WPDesk_Flexible_Shipping_Plugin
13
  */
14
  private $plugin;
15
 
16
  /**
17
  * WPDesk_Flexible_Shipping_Export constructor.
18
  *
19
- * @param WPDesk_Flexible_Shipping_Plugin $plugin
20
  */
21
- public function __construct( WPDesk_Flexible_Shipping_Plugin $plugin ) {
22
  $this->plugin = $plugin;
23
  $this->hooks();
24
  }
9
  class WPDesk_Flexible_Shipping_Multicurrency {
10
 
11
  /**
12
+ * @var Flexible_Shipping_Plugin
13
  */
14
  private $plugin;
15
 
16
  /**
17
  * WPDesk_Flexible_Shipping_Export constructor.
18
  *
19
+ * @param Flexible_Shipping_Plugin $plugin
20
  */
21
+ public function __construct( Flexible_Shipping_Plugin $plugin ) {
22
  $this->plugin = $plugin;
23
  $this->hooks();
24
  }
classes/multilingual.php CHANGED
@@ -9,16 +9,16 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Multilingual' ) ) {
9
  class WPDesk_Flexible_Shipping_Multilingual {
10
 
11
  /**
12
- * @var WPDesk_Flexible_Shipping_Plugin
13
  */
14
  private $plugin;
15
 
16
  /**
17
  * WPDesk_Flexible_Shipping_Export constructor.
18
  *
19
- * @param WPDesk_Flexible_Shipping_Plugin $plugin
20
  */
21
- public function __construct( WPDesk_Flexible_Shipping_Plugin $plugin ) {
22
  $this->plugin = $plugin;
23
  $this->hooks();
24
  }
9
  class WPDesk_Flexible_Shipping_Multilingual {
10
 
11
  /**
12
+ * @var Flexible_Shipping_Plugin
13
  */
14
  private $plugin;
15
 
16
  /**
17
  * WPDesk_Flexible_Shipping_Export constructor.
18
  *
19
+ * @param Flexible_Shipping_Plugin $plugin
20
  */
21
+ public function __construct( Flexible_Shipping_Plugin $plugin ) {
22
  $this->plugin = $plugin;
23
  $this->hooks();
24
  }
classes/order-add-shipping.php DELETED
@@ -1,116 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- if ( ! class_exists( 'WPDesk_Flexible_Shipping_Add_Shipping' ) ) {
6
-
7
- class WPDesk_Flexible_Shipping_Add_Shipping {
8
-
9
- private $shipping_added = false;
10
-
11
- public function __construct() {
12
- add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 20, 2 );
13
- add_action( 'admin_init', array( $this, 'admin_init' ) );
14
- }
15
-
16
- public function admin_init() {
17
- if ( isset( $_GET['fs_add_shipping'] ) && isset( $_GET['post'] ) ) {
18
- if ( isset( $_GET['_wpnonce'] ) ) {
19
- if ( wp_verify_nonce( $_GET['_wpnonce'], 'fs_add_shipping' ) ) {
20
- if ( class_exists( 'WPDesk_Flexible_Shipping_Shipment_' . $_GET['fs_add_shipping'] ) ) {
21
- $order = wc_get_order( $_GET['post'] );
22
- if ( $order ) {
23
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
24
- $order_id = $order->id;
25
- }
26
- else {
27
- $order_id = $order->get_id();
28
- }
29
- $integration = $_GET['fs_add_shipping'];
30
- $post_title = sprintf( __( 'Shipment for order %s, %s', 'flexible-shipping' ), $order_id, $integration );
31
- //$post_title = apply_filters( 'flexible_shipping_shipment_post_title_'. $integration, $post_title, $fs_method );
32
- $shipment_post = array(
33
- 'post_title' => $post_title,
34
- 'post_type' => 'shipment',
35
- 'post_status' => 'fs-new',
36
- 'post_parent' => $order_id
37
- );
38
- $shipment_id = wp_insert_post( $shipment_post );
39
- update_post_meta( $shipment_id, '_integration', $integration );
40
- $shipment = fs_get_shipment( $shipment_id, $order );
41
- if ( method_exists( $shipment, 'admin_add_shipment' ) ) {
42
- $shipment->admin_add_shipment();
43
- $shipment->save();
44
- }
45
- $order->add_order_note( sprintf( __( 'Added new shipment via metabox. Shipment ID: %s', 'flexible-shipping' ), $shipment->get_id() ) );
46
- $this->shipping_added = true;
47
- }
48
- }
49
- }
50
- }
51
- }
52
- }
53
-
54
- public function add_meta_boxes( $post_type, $post ) {
55
- if ( $post_type == 'shop_order' ) {
56
- $add_metabox = false;
57
- $order = wc_get_order( $post->ID );
58
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
59
- $created_via = get_post_meta( $order->id, '_created_via', true );
60
- }
61
- else {
62
- $created_via = $order->get_created_via();
63
- }
64
- if ( $created_via != 'checkout' ) {
65
- $add_metabox = true;
66
- }
67
- if ( !$add_metabox ) {
68
- $order_shipping_methods = $order->get_shipping_methods();
69
- $all_shipping_methods = flexible_shipping_get_all_shipping_methods();
70
- $flexible_shipping = $all_shipping_methods['flexible_shipping'];
71
- $flexible_shipping_rates = $flexible_shipping->get_all_rates();
72
- foreach ( $order_shipping_methods as $order_shipping_method ) {
73
- /** @var WC_Order_Item_Shipping $order_shipping_method */
74
- $fs_method = $order_shipping_method->get_meta( '_fs_method' );
75
- if ( !empty( $fs_method ) && isset( $flexible_shipping_rates[ $fs_method['id_for_shipping'] ] ) ) {
76
- $add_metabox = true;
77
- }
78
- }
79
- }
80
- $select_options = array();
81
- $select_options = apply_filters( 'flexible_shipping_add_shipping_options', $select_options );
82
- if ( $add_metabox && count( $select_options ) ) {
83
- $select_options = array_merge(
84
- array( '' => __( 'Select integration', 'flexible-shipping' ) ),
85
- $select_options
86
- );
87
- $args = array(
88
- 'select_options' => $select_options,
89
- 'order_id' => $post->ID
90
- );
91
- add_meta_box(
92
- 'add_shipping_meta_box',
93
- __( 'Add shipping', 'flexible-shipping' ),
94
- array( $this, 'order_metabox' ),
95
- 'shop_order',
96
- 'side',
97
- 'default',
98
- $args
99
- );
100
-
101
- }
102
- }
103
- }
104
-
105
- public function order_metabox( $post, $args ) {
106
- $select_options = $args['args']['select_options'];
107
- $order_id = $args['args']['order_id'];
108
- $add_shipping_url = admin_url( 'post.php?post=' . $order_id . '&action=edit' );
109
- $add_shipping_url = wp_nonce_url( $add_shipping_url, 'fs_add_shipping' );
110
- $add_shipping_url = str_replace( '&amp;', '&', $add_shipping_url );
111
- include( 'views/html-order-add_shipping-metabox.php' );
112
- }
113
-
114
- }
115
-
116
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/saas/class-saas-add-shipping-handler.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Add_Shipping_Handler
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Add_Shipping_Handler {
7
+
8
+ /**
9
+ * Shipping service.
10
+ *
11
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service
12
+ */
13
+ private $shipping_service;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_SaaS_Add_Shipping_Handler constructor.
17
+ *
18
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
19
+ */
20
+ public function __construct( WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service ) {
21
+ $this->shipping_service = $shipping_service;
22
+ }
23
+
24
+ /**
25
+ * Hooks.
26
+ */
27
+ public function hooks() {
28
+ add_filter( 'flexible_shipping_add_shipping_options', array( $this, 'handle_add_shipping_options' ) );
29
+ }
30
+
31
+ /**
32
+ * Handle add shipping service options.
33
+ *
34
+ * @param array $options Options.
35
+ *
36
+ * @return array
37
+ */
38
+ public function handle_add_shipping_options( array $options ) {
39
+ $options[ $this->shipping_service->get_integration_id() ] = $this->shipping_service->get_name();
40
+ return $options;
41
+ }
42
+
43
+ }
classes/saas/class-saas-auth-params.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings_Connection
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Auth_Params {
7
+
8
+
9
+ /**
10
+ * Returns WooCommerce shop domain
11
+ *
12
+ * @return string
13
+ */
14
+ public function get_user_domain() {
15
+ $parsed_url = wp_parse_url( site_url() );
16
+
17
+ return $parsed_url['host'];
18
+ }
19
+
20
+ /**
21
+ * Returns default user locale
22
+ *
23
+ * @return string
24
+ */
25
+ public function get_user_locale() {
26
+ return get_locale();
27
+ }
28
+ }
29
+
classes/saas/class-saas-bad-credentials-exception.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception extends RuntimeException {
7
+
8
+
9
+ /**
10
+ * WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception constructor.
11
+ *
12
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Platform links.
13
+ */
14
+ public function __construct( WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links ) {
15
+ $notice_content = sprintf(
16
+ /* Translators: url */
17
+ __( 'The Connect Key that you entered is invalid. Please enter a valid key. %1$sGet your Connect Key →%2$s', 'flexible-shipping' ),
18
+ '<a href="' . $saas_platform_links->get_base_url() . '">',
19
+ '</a>'
20
+ );
21
+ parent::__construct( $notice_content );
22
+ }
23
+ }
classes/saas/class-saas-connection-status-ajax.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings_Connection
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ const AJAX_ACTION = 'wpdesk_fs_connection_status';
11
+ const NONCE_NAME = 'status_field_nonce';
12
+
13
+ const STATUS_ERROR = 'ERROR';
14
+ const STATUS_OK = 'OK';
15
+
16
+ const RESPONSE_MESSAGE = 'message';
17
+ const RESPONSE_STATUS = 'status';
18
+
19
+
20
+ /**
21
+ * SaaS connection.
22
+ *
23
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
24
+ */
25
+ private $saas_connection;
26
+
27
+ /**
28
+ * WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax constructor.
29
+ *
30
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS connection.
31
+ */
32
+ public function __construct(
33
+ WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection
34
+ ) {
35
+ $this->saas_connection = $saas_connection;
36
+ }
37
+
38
+ /**
39
+ * Hooks.
40
+ */
41
+ public function hooks() {
42
+ add_action( 'wp_ajax_' . self::AJAX_ACTION, array( $this, 'handle_ajax_request' ) );
43
+ }
44
+
45
+ /**
46
+ * Prepare response.
47
+ *
48
+ * @param \WPDesk\SaasPlatformClient\Response\ShippingServicesSettings\Test\GetSettingsTestResponse $test_response Test connection response.
49
+ *
50
+ * @return array
51
+ */
52
+ public function prepare_response( $test_response ) {
53
+ $response = array(
54
+ self::RESPONSE_STATUS => self::STATUS_ERROR,
55
+ self::RESPONSE_MESSAGE => __( 'Something go wrong!', 'flexible-shipping' ),
56
+ );
57
+ try {
58
+ if ( $test_response->isError() ) {
59
+ $response[ self::RESPONSE_MESSAGE ] = sprintf(
60
+ // Translators: response code.
61
+ __( 'Invalid response from Flexible Shipping Connect platform. Response code: %1$s.', 'flexible-shipping' ),
62
+ $test_response->getResponseCode()
63
+ );
64
+ } else {
65
+ $response[ self::RESPONSE_STATUS ] = $test_response->getStatus();
66
+ if ( self::STATUS_ERROR === $response[ self::RESPONSE_STATUS ] ) {
67
+ $response[ self::RESPONSE_MESSAGE ] = $test_response->getMessage();
68
+ } else {
69
+ $response[ self::RESPONSE_MESSAGE ] = __( 'OK', 'flexible-shipping' );
70
+ }
71
+ }
72
+ } catch ( Exception $e ) {
73
+ $response[ self::RESPONSE_STATUS ] = self::STATUS_ERROR;
74
+ $response[ self::RESPONSE_MESSAGE ] = $e->getMessage();
75
+ }
76
+ return $response;
77
+ }
78
+
79
+ /**
80
+ * Handle AJAX request.
81
+ */
82
+ public function handle_ajax_request() {
83
+ check_ajax_referer( self::NONCE_NAME, 'nonce' );
84
+
85
+ $service_id = $_REQUEST['service_id'];
86
+
87
+ $test_response = $this->saas_connection->get_platform()->requestGetSettingsTest( $service_id );
88
+
89
+ wp_send_json( $this->prepare_response( $test_response ) );
90
+ exit;
91
+ }
92
+
93
+ }
classes/saas/class-saas-connection-status-field.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings_Connection
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field {
7
+
8
+ /**
9
+ * Shipping method.
10
+ *
11
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings
12
+ */
13
+ private $shipping_method;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_Connection_Status_Field constructor.
17
+ *
18
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings $shipping_method Shipping method.
19
+ */
20
+ public function __construct( $shipping_method ) {
21
+ $this->shipping_method = $shipping_method;
22
+ }
23
+
24
+ /**
25
+ * Get field key.
26
+ *
27
+ * @param string $key Key.
28
+ *
29
+ * @return string
30
+ */
31
+ protected function get_field_key( $key ) {
32
+ return $this->shipping_method->get_field_key( $key );
33
+ }
34
+
35
+ /**
36
+ * Generate HTML.
37
+ *
38
+ * @param string $key Key.
39
+ * @param array $data Data.
40
+ *
41
+ * @return false|string
42
+ */
43
+ public function generate_html( $key, $data ) {
44
+ $field_key = $this->get_field_key( $key );
45
+ $defaults = array(
46
+ 'title' => '',
47
+ 'disabled' => false,
48
+ 'class' => '',
49
+ 'css' => '',
50
+ 'placeholder' => '',
51
+ 'type' => 'text',
52
+ 'desc_tip' => false,
53
+ 'description' => '',
54
+ 'custom_attributes' => array(),
55
+ );
56
+
57
+ $data = wp_parse_args( $data, $defaults );
58
+
59
+ $field_id = esc_attr( $field_key );
60
+ $tooltip_html = $this->shipping_method->get_tooltip_html( $data );
61
+ $title = $data['title'];
62
+ $description_html = $this->shipping_method->get_description_html( $data );
63
+ $status_html = __( 'Checking...', 'flexible-shipping' );
64
+ $service_id = $this->shipping_method->get_shipping_service_id();
65
+ $ajax_action = false;
66
+ $ajax_nonce = '';
67
+ $ajax_error_message = __( 'Something go wrong! (AJAX)', 'flexible-shipping' );
68
+
69
+ if ( ! $this->shipping_method->get_has_saas_settings() ) {
70
+ $status_html = __( 'Add credentials', 'flexible-shipping' );
71
+ } else {
72
+ $ajax_action = WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax::AJAX_ACTION;
73
+ $ajax_nonce = wp_create_nonce( WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax::NONCE_NAME );
74
+ }
75
+
76
+ ob_start();
77
+ include 'views/html-field-connection-status.php';
78
+ return ob_get_clean();
79
+ }
80
+
81
+ }
classes/saas/class-saas-connection.php ADDED
@@ -0,0 +1,609 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_Settings_Connection' ) ) {
8
+
9
+ /**
10
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings_Connection
11
+ */
12
+ class WPDesk_Flexible_Shipping_SaaS_Connection
13
+ implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
14
+
15
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
16
+
17
+ const PRIORITY_BEFORE_DEFAULT = 9;
18
+ const PRIORITY_AFTER_DEFAULT = 11;
19
+
20
+ const PAGE_WOOCOMMERCE_SETTINGS = 'wc-settings';
21
+ const TAB_SHIPPING = 'shipping';
22
+ const SECTION_FLEXIBLE_SHIPPING_CONNECT = 'flexible_shipping_connect';
23
+
24
+ const OPTION_SAAS_API_KEY = 'fs_saas_api_key';
25
+ const OPTION_FLEXIBLE_SHIPPING_SAAS_CONNECTED = 'fs_saas_connected';
26
+
27
+ const CONNECTED = '1';
28
+ const DISCONNECTED = '0';
29
+
30
+ const NONCE_CONNECTION_ACTION = 'fs_connection_nonce';
31
+ const NONCE_CONNECTION_NAME = '_nonce_fs_connection';
32
+
33
+ const SUBMIT_CONNECTION_PARAMETER = 'flexible-shipping-submit-connection';
34
+
35
+ const PARAMETER_CONNECT_URL = 'flexible_shipping_connect_url';
36
+ const PARAMETER_CONNECT_FROM_MAIL = 'connect_from_mail';
37
+
38
+ const SETTINGS_ERROR_SETTING = 'flexible-shipping-connect';
39
+
40
+ const BUTTON_ID_DISCONNECT = 'flexible-shipping-disconnect';
41
+ const BUTTON_ID_CONNECT = 'flexible-shipping-connect';
42
+
43
+ const LOGGER_SOURCE = 'saas-connection';
44
+
45
+ /**
46
+ * Is processing email link?
47
+ *
48
+ * @var bool
49
+ */
50
+ private $is_processing_email_link = false;
51
+
52
+ /**
53
+ * Saas shipping providers.
54
+ *
55
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Services
56
+ */
57
+ private $saas_shipping_services;
58
+
59
+ /**
60
+ * Links.
61
+ *
62
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
63
+ */
64
+ private $saas_platform_links;
65
+
66
+ /**
67
+ * Logger.
68
+ *
69
+ * @var \Psr\Log\LoggerInterface
70
+ */
71
+ private $logger;
72
+
73
+ /**
74
+ * WPDesk_Flexible_Shipping_SaaS_Connection constructor.
75
+ *
76
+ * @param \Psr\Log\LoggerInterface $logger Logger.
77
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Links.
78
+ */
79
+ public function __construct(
80
+ \Psr\Log\LoggerInterface $logger = null,
81
+ WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links = null
82
+ ) {
83
+
84
+ if ( null === $saas_platform_links ) {
85
+ $saas_platform_links = new WPDesk_Flexible_Shipping_SaaS_Platform_Links();
86
+ }
87
+ $this->saas_platform_links = $saas_platform_links;
88
+
89
+ if ( null !== $logger ) {
90
+ $this->logger = $logger;
91
+ } else {
92
+ $this->logger = WPDesk_Flexible_Shipping_Logger_Factory::create_logger();
93
+ }
94
+ $this->saas_shipping_services = new WPDesk_Flexible_Shipping_SaaS_Shipping_Services(
95
+ $this,
96
+ $this->logger,
97
+ $saas_platform_links
98
+ );
99
+
100
+ }
101
+
102
+ /**
103
+ * Hooks.
104
+ */
105
+ public function hooks() {
106
+ add_filter( 'removable_query_args', [ $this, 'add_email_parameters_to_removable_query_args' ] );
107
+
108
+ add_action( 'update_option_' . self::OPTION_SAAS_API_KEY, [ $this, 'connect_on_api_key_change' ], 10, 3 );
109
+
110
+ add_action( 'admin_init', [ $this, 'connect_admin_notices' ], self::PRIORITY_BEFORE_DEFAULT );
111
+ add_action( 'admin_init', [ $this, 'handle_connection_form' ], self::PRIORITY_BEFORE_DEFAULT );
112
+ add_action( 'admin_init', [ $this, 'handle_saas_connect_url' ] );
113
+ add_action( 'admin_init', [ $this, 'check_connection_and_show_notice_on_error' ] );
114
+ }
115
+
116
+ /**
117
+ * Clear SaaS client cache.
118
+ */
119
+ public function clear_saas_client_cache() {
120
+ $client_cache = new \WPDesk\SaasPlatformClient\Cache\WordpressCache();
121
+ $client_cache->clear();
122
+ }
123
+
124
+ /**
125
+ * Is on settings page?
126
+ *
127
+ * @return bool
128
+ */
129
+ public function is_on_setings_page() {
130
+ return (
131
+ isset( $_GET['page'] )
132
+ && self::PAGE_WOOCOMMERCE_SETTINGS === $_GET['page']
133
+ && isset( $_GET['tab'] )
134
+ && self::TAB_SHIPPING === $_GET['tab']
135
+ );
136
+ }
137
+
138
+ /**
139
+ * Check connection and show notice on error.
140
+ */
141
+ public function check_connection_and_show_notice_on_error() {
142
+ if ( $this->is_on_setings_page() && $this->is_connected() ) {
143
+ try {
144
+ $platform = $this->get_platform();
145
+ $response = $platform->requestListShippingServices();
146
+ if ( $response->isBadCredentials() ) {
147
+ $this->add_notice_bad_credentials();
148
+ } elseif ( $response->isMaintenance() ) {
149
+ $maintenance_context = new \WPDesk\SaasPlatformClient\Response\Maintenance\MaintenanceResponseContext( $response );
150
+ $this->add_notice_maintenance(
151
+ $maintenance_context->getMaintenanceMessage(),
152
+ $maintenance_context->getMaintenanceTill()
153
+ );
154
+ } elseif ( $response->isServerFatalError() ) {
155
+ $this->add_notice_fatal_error();
156
+ }
157
+ } catch ( Exception $e ) {
158
+ $this->add_notice_fatal_error();
159
+ }
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Add notice for fatal error.
165
+ *
166
+ * @param string $platform_message Message from platform.
167
+ * @param int $till Time till maintenance is active.
168
+ */
169
+ public function add_notice_maintenance( $platform_message, $till ) {
170
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
171
+ $notice_content = $this->prepare_maintenance_notice( $platform_message, $till );
172
+ new \WPDesk\Notice\Notice( $notice_content, $notice_type );
173
+ }
174
+
175
+ /**
176
+ * Add notice for fatal error.
177
+ */
178
+ public function add_notice_fatal_error() {
179
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
180
+ $notice_content = $this->prepare_fatal_error_notice();
181
+ new \WPDesk\Notice\Notice( $notice_content, $notice_type );
182
+ }
183
+
184
+ /**
185
+ * Add notice for bad credentials.
186
+ */
187
+ public function add_notice_bad_credentials() {
188
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
189
+ $notice_content = $this->prepare_bad_credentials_notice();
190
+ new \WPDesk\Notice\Notice( $notice_content, $notice_type );
191
+ }
192
+
193
+ /**
194
+ * Removable query args.
195
+ *
196
+ * @param array $removable_query_args Query args.
197
+ *
198
+ * @return array
199
+ */
200
+ public function add_email_parameters_to_removable_query_args( $removable_query_args ) {
201
+ $removable_query_args[] = self::PARAMETER_CONNECT_FROM_MAIL;
202
+ $removable_query_args[] = 'connect_key';
203
+
204
+ return $removable_query_args;
205
+ }
206
+
207
+
208
+ /**
209
+ * Show settings messages.
210
+ */
211
+ public function connect_admin_notices() {
212
+ $settings_errors = get_settings_errors( self::SETTINGS_ERROR_SETTING );
213
+ foreach ( $settings_errors as $error ) {
214
+ new \WPDesk\Notice\Notice( $error['message'], $error['type'] );
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Get platform.
220
+ *
221
+ * @return \WPDesk\SaasPlatformClient\Platform
222
+ */
223
+ public function get_platform() {
224
+ $platform_factory = new WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory( $this->logger );
225
+
226
+ return $platform_factory->get_platform();
227
+ }
228
+
229
+ /**
230
+ * Login user.
231
+ *
232
+ * @param string $connect_key Key.
233
+ * @param WPDesk_Flexible_Shipping_SaaS_Auth_Params $params Parameters.
234
+ *
235
+ * @return \WPDesk\SaasPlatformClient\Response\Authentication\TokenResponse
236
+ */
237
+ private function login_user( $connect_key, WPDesk_Flexible_Shipping_SaaS_Auth_Params $params ) {
238
+ return $this->get_platform()->requestToken(
239
+ $connect_key,
240
+ $params->get_user_domain(),
241
+ $params->get_user_locale()
242
+ );
243
+ }
244
+
245
+ /**
246
+ * Add settings error: user authenticated successfully notice.
247
+ */
248
+ private function add_settings_error_login_success() {
249
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_SUCCESS;
250
+ $notice_content = __( 'Your store has been connected to Flexible Shipping Connect. Choose from the available shipping integrations below.',
251
+ 'flexible-shipping' );
252
+ add_settings_error( self::SETTINGS_ERROR_SETTING, 'success', $notice_content, $notice_type );
253
+ }
254
+
255
+ /**
256
+ * Add settings error: disconnected notice.
257
+ */
258
+ private function add_settings_error_disconnected() {
259
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_SUCCESS;
260
+ $notice_content = __( 'You are now disconnected from Flexible Shipping Connect. All shipping services have been disabled. To use Flexible Shipping Connect again, please enter a valid Connect Key.',
261
+ 'flexible-shipping' );
262
+ add_settings_error( self::SETTINGS_ERROR_SETTING, 'success', $notice_content, $notice_type );
263
+ }
264
+
265
+ /**
266
+ * Add notice already connected. Used for email link.
267
+ */
268
+ private function add_notice_already_connected() {
269
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_INFO;
270
+ $notice_content = __( 'Your store is already connected to Flexible Shipping Connect!', 'flexible-shipping' );
271
+ add_settings_error( self::SETTINGS_ERROR_SETTING, 'success', $notice_content, $notice_type );
272
+ }
273
+
274
+ /**
275
+ * Add settings error: domain occupied.
276
+ */
277
+ private function add_settings_error_domain_occupied() {
278
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
279
+ $notice_content = sprintf(
280
+ /* Translators: url */
281
+ __( 'Your store (%1$s) is already registered on another account. You can register your domain only on one account. If you have questions, %2$scontact us%3$s.',
282
+ 'flexible-shipping'
283
+ ),
284
+ site_url(),
285
+ '<a target="_blank" href="' . $this->saas_platform_links->add_utm(
286
+ $this->saas_platform_links->get_support(),
287
+ 'fs-register-contactus',
288
+ 'flexible-shipping',
289
+ 'link',
290
+ 'user-site',
291
+ 'contact-us'
292
+ ) . '">',
293
+ '</a>'
294
+ );
295
+ add_settings_error( self::SETTINGS_ERROR_SETTING, 'success', $notice_content, $notice_type );
296
+ }
297
+
298
+ /**
299
+ * Add settings error: bad credentials.
300
+ */
301
+ private function add_settings_error_bad_credentials() {
302
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
303
+ $notice_content = $this->prepare_bad_credentials_notice();
304
+ add_settings_error( self::SETTINGS_ERROR_SETTING, 'success', $notice_content, $notice_type );
305
+ }
306
+
307
+ /**
308
+ * Add settings error: fatal error.
309
+ */
310
+ private function add_settings_error_fatal_error() {
311
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
312
+ $notice_content = $this->prepare_fatal_error_notice();
313
+ add_settings_error( self::SETTINGS_ERROR_SETTING, 'success', $notice_content, $notice_type );
314
+ }
315
+
316
+ /**
317
+ * Prepare fatal error notice text.
318
+ *
319
+ * @param string $platform_message Message from platform.
320
+ * @param int $till Time till maintenance is active.
321
+ * @return string
322
+ */
323
+ public function prepare_maintenance_notice( $platform_message, $till ) {
324
+ if ( isset( $platform_message ) ) {
325
+ $platform_message = sprintf(
326
+ '%1$s%2$s',
327
+ '<br/><br/>',
328
+ sprintf(
329
+ // Translators: platform message.
330
+ __( 'Message from platform: %1$s%2$s%3$s', 'flexible-shipping' ),
331
+ '<strong>',
332
+ $platform_message,
333
+ '</strong>'
334
+ )
335
+ );
336
+ } else {
337
+ $platform_message = '';
338
+ }
339
+ $notice_content = sprintf(
340
+ /* Translators: url */
341
+ __(
342
+ 'FS Connect is undergoing maintenance. To get more information about the platform status check %1$sstatus.flexibleshipping.com &rarr;%2$s%3$s',
343
+ 'flexible-shipping'
344
+ ),
345
+ '<a href="' . $this->saas_platform_links->add_utm(
346
+ $this->saas_platform_links->get_status(),
347
+ 'fs-notice-status',
348
+ 'flexible-shipping',
349
+ 'link',
350
+ 'user-site',
351
+ ''
352
+ ) . '">',
353
+ '</a>',
354
+ $platform_message
355
+ );
356
+ return $notice_content;
357
+ }
358
+
359
+ /**
360
+ * Prepare fatal error notice text.
361
+ *
362
+ * @return string
363
+ */
364
+ public function prepare_fatal_error_notice() {
365
+ $notice_content = __(
366
+ 'There are some connection problems. Please try again in a few minutes. Thanks!',
367
+ 'flexible-shipping'
368
+ );
369
+ $notice_content .= '<br />';
370
+ $notice_content .= sprintf(
371
+ /* Translators: url */
372
+ __( 'To get more information about the platform status check %1$sstatus.flexibleshipping.com &rarr;%2$s',
373
+ 'flexible-shipping'
374
+ ),
375
+ '<a href="' . $this->saas_platform_links->add_utm(
376
+ $this->saas_platform_links->get_status(),
377
+ 'fs-notice-status',
378
+ 'flexible-shipping',
379
+ 'link',
380
+ 'user-site',
381
+ ''
382
+ ) . '">',
383
+ '</a>'
384
+ );
385
+
386
+ return $notice_content;
387
+ }
388
+
389
+ /**
390
+ * Prepare fatal error notice text.
391
+ *
392
+ * @return string
393
+ */
394
+ public function prepare_bad_credentials_notice() {
395
+ $notice_content = sprintf(
396
+ /* Translators: url */
397
+ __( 'The Connect Key that you entered is invalid. Please enter a valid key. %1$sRegister%3$s for a new key or log in to %2$syour account%3$s to get your key.', 'flexible-shipping' ),
398
+ '<a href="' . add_query_arg( 'page', WPDesk_Flexible_Shipping_SaaS_User_Registration::REGISTER_PAGE_SLUG, admin_url( 'admin.php' ) ) . '">',
399
+ '<a href="' . $this->saas_platform_links->add_utm(
400
+ $this->saas_platform_links->get_my_account(),
401
+ 'fs-configuration-contactus',
402
+ 'flexible-shipping',
403
+ 'link',
404
+ 'user-site',
405
+ 'contact-us'
406
+ ) . '">',
407
+ '</a>'
408
+ );
409
+
410
+ return $notice_content;
411
+ }
412
+
413
+ /**
414
+ * Is on submit page?
415
+ *
416
+ * @return bool
417
+ */
418
+ public function is_on_submit_page() {
419
+ return ( isset( $_REQUEST[ self::SUBMIT_CONNECTION_PARAMETER ] ) && '1' === $_REQUEST[ self::SUBMIT_CONNECTION_PARAMETER ] );
420
+ }
421
+
422
+ /**
423
+ * Handle connection form.
424
+ */
425
+ public function handle_connection_form() {
426
+ if ( $this->is_on_submit_page() ) {
427
+ if ( isset( $_REQUEST[ self::NONCE_CONNECTION_NAME ] )
428
+ && wp_verify_nonce( $_REQUEST[ self::NONCE_CONNECTION_NAME ], self::NONCE_CONNECTION_ACTION )
429
+ && isset( $_REQUEST['api_key'] )
430
+ ) {
431
+ $api_key = sanitize_text_field( $_REQUEST['api_key'] );
432
+ if ( $this->is_connected() ) {
433
+ $api_key = '';
434
+ } else {
435
+ remove_action( 'update_option_' . self::OPTION_SAAS_API_KEY, [
436
+ $this,
437
+ 'connect_on_api_key_change',
438
+ ], 10, 3 );
439
+ update_option( self::OPTION_SAAS_API_KEY, '' );
440
+ add_action( 'update_option_' . self::OPTION_SAAS_API_KEY, [
441
+ $this,
442
+ 'connect_on_api_key_change',
443
+ ], 10, 3 );
444
+ }
445
+ update_option( self::OPTION_SAAS_API_KEY, $api_key );
446
+ }
447
+ set_transient( 'settings_errors', get_settings_errors(), 30 );
448
+ $url = admin_url( 'admin.php' );
449
+ $url = add_query_arg( 'page', 'wc-settings', $url );
450
+ $url = add_query_arg( 'tab', 'shipping', $url );
451
+ $url = add_query_arg( 'section', WPDesk_Flexible_Shipping_SaaS_Settings::METHOD_ID, $url );
452
+ $url = add_query_arg( 'settings-updated', 'true', $url );
453
+ wp_safe_redirect( $url );
454
+ exit;
455
+ }
456
+ }
457
+
458
+ /**
459
+ * Update option - do connection when api key changed.
460
+ *
461
+ * @param string $old_value Old option value.
462
+ * @param string $value Current option value.
463
+ * @param string $option Option name.
464
+ */
465
+ public function connect_on_api_key_change( $old_value, $value, $option ) {
466
+ $old_key_value = $old_value;
467
+ $new_key_value = $value;
468
+ $connected = $this->is_connected();
469
+ if ( ( ! $connected || ( $old_key_value !== $new_key_value ) ) && '' !== $new_key_value ) {
470
+ update_option( self::OPTION_FLEXIBLE_SHIPPING_SAAS_CONNECTED, self::DISCONNECTED );
471
+ try {
472
+ $response = $this->login_user(
473
+ $new_key_value,
474
+ new WPDesk_Flexible_Shipping_SaaS_Auth_Params()
475
+ );
476
+ if ( $response->isLoginSuccess() ) {
477
+ update_option( self::OPTION_FLEXIBLE_SHIPPING_SAAS_CONNECTED, self::CONNECTED );
478
+ $this->add_settings_error_login_success();
479
+ } else {
480
+ if ( $response->isBadCredentials() ) {
481
+ $this->add_settings_error_bad_credentials();
482
+ } elseif ( $response->isDomainOccupied() ) {
483
+ $this->add_settings_error_domain_occupied();
484
+ } elseif ( $response->isBadRequest() ) {
485
+ $this->add_settings_error_fatal_error();
486
+ } elseif ( $response->isServerFatalError() ) {
487
+ $this->add_settings_error_fatal_error();
488
+ } else {
489
+ $this->add_settings_error_fatal_error();
490
+ }
491
+ }
492
+ } catch ( Exception $e ) {
493
+ $this->add_settings_error_fatal_error();
494
+ }
495
+ } elseif ( '' === $new_key_value ) {
496
+ update_option( self::OPTION_FLEXIBLE_SHIPPING_SAAS_CONNECTED, self::DISCONNECTED );
497
+ if ( $connected ) {
498
+ $this->add_settings_error_disconnected();
499
+ }
500
+ }
501
+ set_transient( 'settings_errors', get_settings_errors(), 30 );
502
+ }
503
+
504
+ /**
505
+ * Get connected.
506
+ *
507
+ * @return string
508
+ */
509
+ private function get_connected() {
510
+ return get_option( self::OPTION_FLEXIBLE_SHIPPING_SAAS_CONNECTED, '0' );
511
+ }
512
+
513
+ /**
514
+ * Is connected.
515
+ *
516
+ * @return bool
517
+ */
518
+ public function is_connected() {
519
+ return ( $this->get_connected() === self::CONNECTED );
520
+ }
521
+
522
+ /**
523
+ * Handle SaaS connect URL.
524
+ */
525
+ public function handle_saas_connect_url() {
526
+ if ( ! empty( $_GET[ self::PARAMETER_CONNECT_URL ] ) ) {
527
+ if ( current_user_can( 'manage_woocommerce' ) ) {
528
+ $this->is_processing_email_link = true;
529
+ if ( $this->is_connected() ) {
530
+ $this->add_notice_already_connected();
531
+ } else {
532
+ $api_key = sanitize_text_field( $_GET['connect_key'] );
533
+ /**
534
+ * Clear option value to trigger connection action in connect_on_api_key_change.
535
+ */
536
+ update_option( self::OPTION_SAAS_API_KEY, '' );
537
+ update_option( self::OPTION_SAAS_API_KEY, $api_key );
538
+ }
539
+ }
540
+ set_transient( 'settings_errors', get_settings_errors(), 30 );
541
+ $url = admin_url( 'admin.php' );
542
+ $url = add_query_arg( 'page', 'wc-settings', $url );
543
+ $url = add_query_arg( 'tab', 'shipping', $url );
544
+ $url = add_query_arg( 'section', WPDesk_Flexible_Shipping_SaaS_Settings::METHOD_ID, $url );
545
+ $url = add_query_arg( 'settings-updated', 'true', $url );
546
+ wp_safe_redirect( $url );
547
+ exit;
548
+ }
549
+ }
550
+
551
+
552
+ /**
553
+ * Get shipping providers from platform.
554
+ *
555
+ * @return array|\WPDesk\SaasPlatformClient\Response\ShippingServices\GetShippingServicesListResponse
556
+ */
557
+ public function get_shipping_services_from_platform() {
558
+ $shipping_services = array();
559
+ if ( $this->is_connected() ) {
560
+ try {
561
+ $platform = $this->get_platform();
562
+ $shipping_services = $platform->requestListShippingServices();
563
+
564
+ return $shipping_services->getPage();
565
+ } catch ( Exception $e ) {
566
+ }
567
+ }
568
+
569
+ return $shipping_services;
570
+ }
571
+
572
+ public function display_connection_form() {
573
+ $form_action = admin_url( 'admin.php' );
574
+ $form_action = add_query_arg( self::SUBMIT_CONNECTION_PARAMETER, '1', $form_action );
575
+ if ( $this->is_connected() ) {
576
+ $button_id = self::BUTTON_ID_DISCONNECT;
577
+ $readonly = 'readonly="readonly"';
578
+ $submit_button_value = __( 'Disconnect', 'flexible-shipping' );
579
+ } else {
580
+ $button_id = self::BUTTON_ID_CONNECT;
581
+ $readonly = '';
582
+ $submit_button_value = __( 'Connect', 'flexible-shipping' );
583
+ }
584
+ $api_key = get_option( self::OPTION_SAAS_API_KEY, '' );
585
+ $saas_connected = $this->is_connected();
586
+ include 'views/html-saas-connection-form.php';
587
+ }
588
+
589
+ /**
590
+ * Get SaaS shipping providers.
591
+ *
592
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Services
593
+ */
594
+ public function get_saas_shipping_services() {
595
+ return $this->saas_shipping_services;
596
+ }
597
+
598
+ /**
599
+ * Set SaaS shipping providers.
600
+ *
601
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Services $saas_shipping_services SaaS shipping providers.
602
+ */
603
+ public function set_saas_shipping_services( $saas_shipping_services ) {
604
+ $this->saas_shipping_services = $saas_shipping_services;
605
+ }
606
+
607
+ }
608
+
609
+ }
classes/saas/class-saas-country-state-field.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Country_State_Field
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Country_State_Field {
7
+
8
+ const DELIMITER = ':';
9
+
10
+ const COUNTRY_STATE_CODE_FIELD = 'country_state_code';
11
+ const COUNTRY_CODE_FIELD = 'country_code';
12
+ const STATE_CODE_FIELD = 'state_code';
13
+
14
+ /**
15
+ * Country code.
16
+ *
17
+ * @var string|null
18
+ */
19
+ private $country_code;
20
+
21
+ /**
22
+ * State code.
23
+ *
24
+ * @var string|null
25
+ */
26
+ private $state_code;
27
+
28
+ /**
29
+ * WPDesk_Flexible_Shipping_SaaS_Country_State_Field constructor.
30
+ *
31
+ * @param string|null $country_code Country code.
32
+ * @param string|null $state_code State code.
33
+ */
34
+ public function __construct( $country_code, $state_code ) {
35
+ $this->country_code = $country_code;
36
+ $this->state_code = $state_code;
37
+ }
38
+
39
+ /**
40
+ * Create from single field.
41
+ *
42
+ * @param string $country_state_code Country state code.
43
+ *
44
+ * @return WPDesk_Flexible_Shipping_SaaS_Country_State_Field
45
+ */
46
+ public static function create_from_single_field( $country_state_code ) {
47
+ $country_state_code_array = explode( self::DELIMITER, $country_state_code );
48
+ return new WPDesk_Flexible_Shipping_SaaS_Country_State_Field(
49
+ $country_state_code_array[0],
50
+ isset( $country_state_code_array[1] ) ? $country_state_code_array[1] : null
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Create from serialized settings.
56
+ *
57
+ * @param array $settings Serialized settings.
58
+ *
59
+ * @return WPDesk_Flexible_Shipping_SaaS_Country_State_Field
60
+ */
61
+ public static function create_from_serialized_settings( array $settings ) {
62
+ if ( ! empty( $settings[ self::COUNTRY_STATE_CODE_FIELD ] ) ) {
63
+ return self::create_from_single_field( $settings[ self::COUNTRY_STATE_CODE_FIELD ] );
64
+ } else {
65
+ return new WPDesk_Flexible_Shipping_SaaS_Country_State_Field( null, null );
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Create from serialized settings.
71
+ *
72
+ * @param array $settings Serialized settings.
73
+ *
74
+ * @return WPDesk_Flexible_Shipping_SaaS_Country_State_Field
75
+ */
76
+ public static function create_from_settings( array $settings ) {
77
+ if ( ! empty( $settings[ self::COUNTRY_CODE_FIELD ] ) ) {
78
+ return new WPDesk_Flexible_Shipping_SaaS_Country_State_Field(
79
+ $settings[ self::COUNTRY_CODE_FIELD ],
80
+ isset( $settings[ self::STATE_CODE_FIELD ] ) ? $settings[ self::STATE_CODE_FIELD ] : null
81
+ );
82
+ } else {
83
+ return new WPDesk_Flexible_Shipping_SaaS_Country_State_Field( null, null );
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Get country state code as single field.
89
+ *
90
+ * @return string
91
+ */
92
+ public function get_as_single_field() {
93
+ $single_field = '';
94
+ if ( ! empty( $this->country_code ) ) {
95
+ $single_field = $this->country_code;
96
+ if ( ! empty( $this->state_code ) ) {
97
+ $single_field .= self::DELIMITER . $this->state_code;
98
+ }
99
+ }
100
+ return $single_field;
101
+ }
102
+
103
+ /**
104
+ * Get country state as array.
105
+ *
106
+ * @return array
107
+ */
108
+ public function get_as_array() {
109
+ $array = [];
110
+ if ( ! empty( $this->country_code ) ) {
111
+ $array[ self::COUNTRY_CODE_FIELD ] = $this->country_code;
112
+ if ( ! empty( $this->state_code ) ) {
113
+ $array[ self::STATE_CODE_FIELD ] = $this->state_code;
114
+ }
115
+ }
116
+ return $array;
117
+ }
118
+ }
classes/saas/class-saas-custom-services-setting.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Custom Services - settings field.
5
+ *
6
+ * Class WPDesk_Flexible_Shipping_SaaS_Custom_Services_Settings
7
+ */
8
+ class WPDesk_Flexible_Shipping_SaaS_Custom_Services_Settings {
9
+
10
+ const CUSTOM_SERVICE_NAME = 'name';
11
+ const CUSTOM_SERVICE_ENABLED = 'enabled';
12
+
13
+ /**
14
+ * Field.
15
+ *
16
+ * @var array
17
+ */
18
+ private $field;
19
+
20
+ /**
21
+ * Shipping method field.
22
+ *
23
+ * @var array
24
+ */
25
+ private $shipping_method_field;
26
+
27
+ /**
28
+ * WPDesk_Flexible_Shipping_SaaS_Custom_Services_Settings constructor.
29
+ *
30
+ * @param array $field Field.
31
+ * @param array|null $shipping_method_field Shipping method field.
32
+ */
33
+ public function __construct( array $field, $shipping_method_field ) {
34
+ $this->field = $field;
35
+ $this->shipping_method_field = null === $shipping_method_field ? array() : $shipping_method_field;
36
+ if ( ! is_array( $this->shipping_method_field ) ) {
37
+ $this->shipping_method_field = array();
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Shipping method first time setup?
43
+ *
44
+ * @return bool
45
+ */
46
+ private function first_time_setup() {
47
+ if ( 0 === count( $this->shipping_method_field ) ) {
48
+ return true;
49
+ }
50
+ return false;
51
+ }
52
+
53
+ /**
54
+ * Create services field.
55
+ *
56
+ * @return array
57
+ */
58
+ private function create_services_field() {
59
+ $services = array();
60
+ if ( isset( $this->field['services'] ) && is_array( $this->field['services'] ) ) {
61
+ foreach ( $this->field['services'] as $service_id => $service ) {
62
+ if ( isset( $this->shipping_method_field[ $service_id ] ) ) {
63
+ $shipping_method_field_service = $this->shipping_method_field[ $service_id ];
64
+
65
+ $services[ $service_id ][ self::CUSTOM_SERVICE_NAME ] = $shipping_method_field_service[ self::CUSTOM_SERVICE_NAME ];
66
+ if ( isset( $shipping_method_field_service[ self::CUSTOM_SERVICE_ENABLED ] ) ) {
67
+ $services[ $service_id ][ self::CUSTOM_SERVICE_ENABLED ] = $shipping_method_field_service[ self::CUSTOM_SERVICE_ENABLED ];
68
+ } else {
69
+ $services[ $service_id ][ self::CUSTOM_SERVICE_ENABLED ] = '0';
70
+ }
71
+ } else {
72
+ $services[ $service_id ] = array( self::CUSTOM_SERVICE_NAME => $service[ self::CUSTOM_SERVICE_NAME ] );
73
+ }
74
+ }
75
+ }
76
+ return $services;
77
+ }
78
+
79
+ /**
80
+ * Remove unused services from shipping method field.
81
+ *
82
+ * @param array $services Services.
83
+ */
84
+ private function remove_unused_services( $services ) {
85
+ foreach ( $this->shipping_method_field as $service_id => $service ) {
86
+ if ( empty( $services[ $service_id ] ) ) {
87
+ unset( $this->shipping_method_field[ $service_id ] );
88
+ }
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Set default values when service fields are empty.
94
+ *
95
+ * @param array $services Services.
96
+ * @param string $default_enabled Default value for enabled field.
97
+ *
98
+ * @return array
99
+ */
100
+ private function set_empty_service_fields( $services, $default_enabled ) {
101
+ foreach ( $services as $service_id => $service ) {
102
+ if ( ! isset( $services[ $service_id ][ self::CUSTOM_SERVICE_ENABLED ] ) ) {
103
+ $services[ $service_id ][ self::CUSTOM_SERVICE_ENABLED ] = $default_enabled;
104
+ }
105
+ if ( empty( $services[ $service_id ][ self::CUSTOM_SERVICE_NAME ] ) ) {
106
+ $services[ $service_id ][ self::CUSTOM_SERVICE_NAME ] = $this->field['services'][ $service_id ][ self::CUSTOM_SERVICE_NAME ];
107
+ }
108
+ }
109
+ return $services;
110
+ }
111
+
112
+ /**
113
+ * Sort services as in settings.
114
+ *
115
+ * @param array $services Services.
116
+ *
117
+ * @return array
118
+ */
119
+ private function sort_services( array $services ) {
120
+ if ( 0 !== count( $this->shipping_method_field ) ) {
121
+ $services = array_replace( array_flip( array_keys( $this->shipping_method_field ) ), $services );
122
+ }
123
+ return $services;
124
+ }
125
+
126
+ /**
127
+ * Setup shipping integrations custom services values.
128
+ *
129
+ * @return array
130
+ */
131
+ public function setup_custom_services() {
132
+ if ( $this->first_time_setup() ) {
133
+ $default_enabled = '1';
134
+ } else {
135
+ $default_enabled = '0';
136
+ }
137
+ $services = $this->create_services_field();
138
+
139
+ $this->remove_unused_services( $services );
140
+
141
+ $services = $this->sort_services( $services );
142
+
143
+ $services = $this->set_empty_service_fields( $services, $default_enabled );
144
+
145
+ return $services;
146
+ }
147
+
148
+
149
+ /**
150
+ * Process custom services field.
151
+ *
152
+ * @param array $posted_value Posted value.
153
+ *
154
+ * @return array
155
+ */
156
+ public function process_custom_services_field( array $posted_value ) {
157
+ $custom_services_settings_value = array();
158
+ foreach ( $posted_value as $service_id => $service ) {
159
+ $custom_services_settings_value[ sanitize_text_field( $service_id ) ] = array(
160
+ self::CUSTOM_SERVICE_NAME => sanitize_text_field( $posted_value[ $service_id ][ self::CUSTOM_SERVICE_NAME ] ),
161
+ self::CUSTOM_SERVICE_ENABLED => 0,
162
+ );
163
+ if ( ! empty( $posted_value[ $service_id ][ self::CUSTOM_SERVICE_ENABLED ] ) ) {
164
+ $custom_services_settings_value[ sanitize_text_field( $service_id ) ][ self::CUSTOM_SERVICE_ENABLED ] = 1;
165
+ }
166
+ }
167
+ return $custom_services_settings_value;
168
+ }
169
+
170
+ }
classes/saas/class-saas-default-value-compute-handler.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handles rate request.
5
+ *
6
+ * Class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler
7
+ */
8
+ class WPDesk_Flexible_Shipping_SaaS_Default_Value_Compute_Handler {
9
+
10
+ /**
11
+ * Compute method.
12
+ *
13
+ * @var string
14
+ */
15
+ private $compute_method;
16
+
17
+ /**
18
+ * WPDesk_Flexible_Shipping_SaaS_Default_Value_Compute_Handler constructor.
19
+ *
20
+ * @param string $compute_method Compute method.
21
+ */
22
+ public function __construct( $compute_method ) {
23
+ $this->compute_method = $compute_method;
24
+ }
25
+
26
+ /**
27
+ * Compute.
28
+ */
29
+ public function compute() {
30
+ $computed_value = null;
31
+ if ( 'units' === $this->compute_method ) {
32
+ return $this->compute_units();
33
+ }
34
+ return $computed_value;
35
+ }
36
+
37
+ /**
38
+ * Compute units.
39
+ *
40
+ * @return string
41
+ */
42
+ private function compute_units() {
43
+ $units = 'imperial';
44
+ $woocommerce_weight_unit = get_option( 'woocommerce_weight_unit', 'lbs' );
45
+ if ( in_array( $woocommerce_weight_unit, array( 'g', 'kg' ), true ) ) {
46
+ $units = 'metric';
47
+ }
48
+ return $units;
49
+ }
50
+
51
+ }
classes/saas/class-saas-free-shipping-metadata-handler.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Free_Shipping_Metadata_Handler
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Free_Shipping_Metadata_Handler implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ const META_FS_FREE_SHIPPING = '_fs_free_shipping';
11
+
12
+ /**
13
+ * Hooks.
14
+ */
15
+ public function hooks() {
16
+ add_filter( 'woocommerce_order_shipping_method', [ $this, 'add_free_shipping_to_shipping_method_name' ], 10, 2 );
17
+ add_filter( 'woocommerce_hidden_order_itemmeta', [ $this, 'hide_free_shipping_meta' ] );
18
+ add_action( 'woocommerce_before_order_itemmeta', [ $this, 'display_free_shipping_in_order_shipping' ], 10, 3 );
19
+ }
20
+
21
+ /**
22
+ * Add free shipping to shipping method name.
23
+ *
24
+ * @param string $names Names.
25
+ * @param WC_Order $order Order.
26
+ *
27
+ * @return string
28
+ */
29
+ public function add_free_shipping_to_shipping_method_name( $names, WC_Order $order ) {
30
+ $names = array();
31
+ foreach ( $order->get_shipping_methods() as $shipping_method ) {
32
+ $name = $shipping_method->get_name();
33
+ $fallback = $shipping_method->get_meta( self::META_FS_FREE_SHIPPING );
34
+ if ( '' !== $fallback ) {
35
+ // Translators: shipping method name.
36
+ $name = sprintf( __( '%1$s (free shipping)', 'flexible-shipping' ), $name );
37
+ }
38
+ $names[] = $name;
39
+ }
40
+ return implode( ', ', $names );
41
+ }
42
+
43
+ /**
44
+ * Hide free shipping meta.
45
+ *
46
+ * @param array $items Items to hide.
47
+ *
48
+ * @return array
49
+ */
50
+ public function hide_free_shipping_meta( array $items ) {
51
+ $items[] = self::META_FS_FREE_SHIPPING;
52
+ return $items;
53
+ }
54
+
55
+ /**
56
+ * Display free shipping in order shipping.
57
+ *
58
+ * @param string $item_id Item Id.
59
+ * @param WC_Order_Item $item Item.
60
+ * @param WC_Product|null $product Produuct.
61
+ */
62
+ public function display_free_shipping_in_order_shipping( $item_id, $item, $product ) {
63
+ if ( $item->is_type( 'shipping' ) ) {
64
+ $free_shipping = $item->get_meta( self::META_FS_FREE_SHIPPING );
65
+ if ( '' !== $free_shipping ) {
66
+ include 'views/html-order-free-shipping.php';
67
+ }
68
+ }
69
+ }
70
+
71
+ }
classes/saas/class-saas-live-rates-fallback-metadata-handler.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Handler
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ const META_DEFAULT = '_default';
11
+ const MATA_FS_FALLBACK = '_fs_fallback';
12
+ const META_FS_RATE_TYPE = '_fs_rate_type';
13
+
14
+ /**
15
+ * Hooks.
16
+ */
17
+ public function hooks() {
18
+ add_filter( 'woocommerce_order_shipping_method', [ $this, 'add_fallback_to_shipping_method_name' ], 10, 2 );
19
+ add_filter( 'woocommerce_hidden_order_itemmeta', [ $this, 'hide_fallback_meta' ] );
20
+ add_action( 'woocommerce_before_order_itemmeta', [ $this, 'display_fallback_message_in_order_shipping' ], 10, 3 );
21
+ }
22
+
23
+ /**
24
+ * Add fallback to shipping method name.
25
+ *
26
+ * @param string $names Names.
27
+ * @param WC_Order $order Order.
28
+ *
29
+ * @return string
30
+ */
31
+ public function add_fallback_to_shipping_method_name( $names, WC_Order $order ) {
32
+ $names = array();
33
+ foreach ( $order->get_shipping_methods() as $shipping_method ) {
34
+ $name = $shipping_method->get_name();
35
+ $fallback = $shipping_method->get_meta( self::MATA_FS_FALLBACK );
36
+ if ( '' !== $fallback ) {
37
+ // Translators: shipping method name.
38
+ $name = sprintf( __( '%1$s (fallback)', 'flexible-shipping' ), $name );
39
+ }
40
+ $names[] = $name;
41
+ }
42
+ return implode( ', ', $names );
43
+ }
44
+
45
+ /**
46
+ * Hide fallback meta.
47
+ *
48
+ * @param array $items Items to hide.
49
+ *
50
+ * @return array
51
+ */
52
+ public function hide_fallback_meta( array $items ) {
53
+ $items[] = self::META_DEFAULT;
54
+ $items[] = self::MATA_FS_FALLBACK;
55
+ $items[] = self::META_FS_RATE_TYPE;
56
+ return $items;
57
+ }
58
+
59
+ /**
60
+ * Display fallback message in order shipping.
61
+ *
62
+ * @param string $item_id Item Id.
63
+ * @param WC_Order_Item $item Item.
64
+ * @param WC_Product|null $product Produuct.
65
+ */
66
+ public function display_fallback_message_in_order_shipping( $item_id, $item, $product ) {
67
+ if ( $item->is_type( 'shipping' ) ) {
68
+ $fallback = $item->get_meta( self::MATA_FS_FALLBACK );
69
+ if ( '' !== $fallback ) {
70
+ include 'views/html-order-fallback-message.php';
71
+ }
72
+ }
73
+ }
74
+
75
+ }
classes/saas/class-saas-live-rates-handler.php ADDED
@@ -0,0 +1,563 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handles rate request.
5
+ *
6
+ * Class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler
7
+ */
8
+ class WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler {
9
+
10
+ const PRIORITY_BEFORE_DEFAULT = 9;
11
+
12
+ const RATE_TYPE_LIVE = 'live';
13
+ const FS_RATE_TYPE = '_fs_rate_type';
14
+
15
+ /**
16
+ * Integration id.
17
+ *
18
+ * @var string
19
+ */
20
+ private $integration_id;
21
+
22
+ /**
23
+ * Shipping service.
24
+ *
25
+ * @var \WPDesk\SaasPlatformClient\Model\ShippingService
26
+ */
27
+ private $shipping_service;
28
+
29
+ /**
30
+ * SaaS connection.
31
+ *
32
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
33
+ */
34
+ private $saas_connection;
35
+
36
+ /**
37
+ * Logger.
38
+ *
39
+ * @var \Psr\Log\LoggerInterface
40
+ */
41
+ private $logger;
42
+
43
+ /**
44
+ * Fallback error message.
45
+ *
46
+ * @var string
47
+ */
48
+ private $fallback_error_message = '';
49
+
50
+ /**
51
+ * WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler constructor.
52
+ *
53
+ * @param string $integration_id Integration id.
54
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
55
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS Connection.
56
+ * @param \Psr\Log\LoggerInterface $logger Logger.
57
+ */
58
+ public function __construct( $integration_id, $shipping_service, $saas_connection, \Psr\Log\LoggerInterface $logger = null ) {
59
+ $this->integration_id = $integration_id;
60
+ $this->shipping_service = $shipping_service;
61
+ $this->saas_connection = $saas_connection;
62
+ $this->logger = $logger;
63
+ }
64
+
65
+ /**
66
+ * Hooks.
67
+ */
68
+ public function hooks() {
69
+ add_filter( 'flexible_shipping_add_method', [ $this, 'handle_saas_live_rates' ], self::PRIORITY_BEFORE_DEFAULT, 4 );
70
+ add_action( 'woocommerce_before_checkout_form', [ $this, 'recalculate_shipping_for_woocomerce_manager' ] );
71
+ }
72
+
73
+ /**
74
+ * Prepare packages.
75
+ *
76
+ * @param array $woocommerce_package Package.
77
+ * @param string $package_type Package type.
78
+ * @param string $description Description.
79
+ * @param float $weight Weight.
80
+ * @param int $height Height.
81
+ * @param int $width Width.
82
+ * @param int $length Length.
83
+ *
84
+ * @return array
85
+ */
86
+ private function prepare_packages( array $woocommerce_package, $package_type, $description, $weight, $height, $width, $length ) {
87
+ $package = new \WPDesk\SaasPlatformClient\Model\Shipment\Package();
88
+ $package->seTtype( $package_type );
89
+ $package_weight = fs_calculate_package_weight( $woocommerce_package );
90
+ if ( floatval( 0 ) === $package_weight ) {
91
+ $package_weight = $weight;
92
+ }
93
+ $package_weight = intval( wc_get_weight( floatval( $package_weight ), 'g' ) );
94
+ $package->setWeight( $package_weight );
95
+
96
+ $package->setDescription( $description );
97
+ $package->dimensions = new \WPDesk\SaasPlatformClient\Model\Shipment\Package\Dimensions();
98
+ $package->dimensions->setHeight( intval( wc_get_dimension( floatval( $height ), 'mm' ) ) );
99
+ $package->dimensions->setWidth( intval( wc_get_dimension( floatval( $width ), 'mm' ) ) );
100
+ $package->dimensions->setLength( intval( wc_get_dimension( floatval( $length ), 'mm' ) ) );
101
+
102
+ $packages = array( $package );
103
+
104
+ return $packages;
105
+ }
106
+
107
+ /**
108
+ * Prepare ship to address.
109
+ *
110
+ * @param array $package Package.
111
+ *
112
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\Address
113
+ */
114
+ private function prepare_ship_to_address( array $package ) {
115
+ $destination = $package['destination'];
116
+ $ship_to_address = new \WPDesk\SaasPlatformClient\Model\Shipment\Address();
117
+ $ship_to_address->setAddressLine1( $destination['address'] );
118
+ $ship_to_address->setAddressLine2( $destination['address_2'] );
119
+ $ship_to_address->setPostalCode( str_replace( '-', '', $destination['postcode'] ) );
120
+ $ship_to_address->setCity( $destination['city'] );
121
+ $ship_to_address->setCountryCode( $destination['country'] );
122
+ $ship_to_address->setStateCode( $destination['state'] );
123
+
124
+ return $ship_to_address;
125
+ }
126
+
127
+
128
+ /**
129
+ * Prepare ship to.
130
+ *
131
+ * @param array $package Package.
132
+ *
133
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\Actor
134
+ */
135
+ private function prepare_ship_to( array $package ) {
136
+ $ship_to = new \WPDesk\SaasPlatformClient\Model\Shipment\Actor();
137
+ $ship_to->setAddress( $this->prepare_ship_to_address( $package ) );
138
+ $ship_to->setName( 'first last' );
139
+ $ship_to->setCompanyName( '' );
140
+ $ship_to->setPhoneNumber( '' );
141
+ return $ship_to;
142
+ }
143
+
144
+ /**
145
+ * Get string element from array.
146
+ *
147
+ * @param array $array Array.
148
+ * @param string $key Key.
149
+ *
150
+ * @return string
151
+ */
152
+ private function get_string_element_from_array( array $array, $key ) {
153
+ if ( isset( $array[ $key ] ) ) {
154
+ return $array[ $key ];
155
+ }
156
+ return '';
157
+ }
158
+
159
+ /**
160
+ * Get int element from array.
161
+ *
162
+ * @param array $array Array.
163
+ * @param string $key Key.
164
+ *
165
+ * @return int
166
+ */
167
+ private function get_int_element_from_array( array $array, $key ) {
168
+ if ( isset( $array[ $key ] ) ) {
169
+ return intval( $array[ $key ] );
170
+ }
171
+ return 0;
172
+ }
173
+
174
+ /**
175
+ * Prepare shipment field from send-as.
176
+ *
177
+ * @param array $field Field.
178
+ * @param string $send_as Send as field name.
179
+ * @param mixed $append_to Append to object.
180
+ * @param mixed $field_value Field value.
181
+ */
182
+ private function prepare_shipment_field_from_send_as( array $field, $send_as, $append_to, $field_value ) {
183
+ $send_as_to_array = explode( '.', $send_as );
184
+ $field_name = $send_as_to_array[0];
185
+ if ( 1 === count( $send_as_to_array ) ) {
186
+ $append_to[ $field_name ] = $field_value;
187
+ } else {
188
+ unset( $send_as_to_array[0] );
189
+ $append_to_field = $append_to[ $field_name ];
190
+ if ( empty( $append_to_field ) ) {
191
+ $append_to[ $field_name ] = new \WPDesk\SaasPlatformClient\Model\AbstractModel();
192
+ }
193
+ $this->prepare_shipment_field_from_send_as( $field, implode( '.', $send_as_to_array ), $append_to[ $field_name ], $field_value );
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Get shipping method setting for field.
199
+ *
200
+ * @param array $field Field.
201
+ * @param array $shipping_method Shipping method settings.
202
+ *
203
+ * @return bool|string
204
+ */
205
+ private function get_shipping_method_setting_for_field( $field, $shipping_method ) {
206
+ $field_value = '';
207
+ if ( isset( $shipping_method[ $this->integration_id . '_' . $field['id'] ] ) ) {
208
+ $field_value = $shipping_method[ $this->integration_id . '_' . $field['id'] ];
209
+ }
210
+ if ( 'checkbox' === $field['type'] ) {
211
+ $field_value = 'yes' === $field_value;
212
+ }
213
+ return $field_value;
214
+ }
215
+
216
+ /**
217
+ * Prepare rate request additional fields.
218
+ *
219
+ * @param \WPDesk\SaasPlatformClient\Model\Rate\RateRequest $rate_request Rate request.
220
+ * @param array $fields Fields.
221
+ * @param array $shipping_method Shipping method settings.
222
+ *
223
+ * @return \WPDesk\SaasPlatformClient\Model\Rate\RateRequest
224
+ */
225
+ private function prepare_rate_request_additional_fields( $rate_request, $fields, $shipping_method ) {
226
+ foreach ( $fields as $fieldset ) {
227
+ foreach ( $fieldset['fields'] as $field ) {
228
+ if ( isset( $field['send-with'] ) && in_array( 'rate', $field['send-with'], true ) ) {
229
+ $field_value = $this->get_shipping_method_setting_for_field( $field, $shipping_method );
230
+ if ( isset( $field['send-as'] ) ) {
231
+ $this->prepare_shipment_field_from_send_as( $field, $field['send-as'], $rate_request, $field_value );
232
+ } else {
233
+ $rate_request->{$field['id']} = $field_value;
234
+ }
235
+ }
236
+ }
237
+ }
238
+ return $rate_request;
239
+ }
240
+
241
+ /**
242
+ * Prepare rate request.
243
+ *
244
+ * @param array $package Package.
245
+ * @param array $shipping_method Shipping method.
246
+ *
247
+ * @return \WPDesk\SaasPlatformClient\Model\Rate\RateRequest
248
+ */
249
+ private function prepare_rate_request( array $package, array $shipping_method ) {
250
+ $rate_request = new \WPDesk\SaasPlatformClient\Model\Rate\RateRequest();
251
+ $rate_request->setServiceType( '' );
252
+ $rate_request->setReferenceNumber( '' );
253
+ $rate_request->setShipTo( $this->prepare_ship_to( $package ) );
254
+ $package_type = $this->get_string_element_from_array( $shipping_method, $this->integration_id . '_package_type' );
255
+ $description = $this->get_string_element_from_array( $shipping_method, $this->integration_id . '_description' );
256
+ $weight = floatval( $this->get_string_element_from_array( $shipping_method, $this->integration_id . '_package_weight' ) );
257
+ $height = $this->get_int_element_from_array( $shipping_method, $this->integration_id . '_height' );
258
+ $width = $this->get_int_element_from_array( $shipping_method, $this->integration_id . '_width' );
259
+ $length = $this->get_int_element_from_array( $shipping_method, $this->integration_id . '_length' );
260
+ $rate_request->setPackages( $this->prepare_packages( $package, $package_type, $description, $weight, $height, $width, $length ) );
261
+
262
+ $destination_country = $package['destination']['country'];
263
+ $fields = $this->shipping_service->get_fields_for_targets( array( $destination_country ) );
264
+ $rate_request = $this->prepare_rate_request_additional_fields( $rate_request, $fields, $shipping_method );
265
+
266
+ return $rate_request;
267
+ }
268
+
269
+ /**
270
+ * Get shipping method settings fields.
271
+ *
272
+ * @param array $shipping_method Shipping method.
273
+ *
274
+ * @return array
275
+ */
276
+ private function get_shipping_method_settings( array $shipping_method ) {
277
+ return apply_filters( 'flexible_shipping_method_settings', array(), $shipping_method );
278
+ }
279
+
280
+ /**
281
+ * Get custom services enabled for shipping method.
282
+ *
283
+ * @param array $shipping_method Shipping method.
284
+ *
285
+ * @return bool
286
+ */
287
+ private function get_custom_services_enabled( array $shipping_method ) {
288
+ $custom_services_enabled = false;
289
+ if ( isset( $shipping_method[ $this->integration_id . '_custom_services' ] )
290
+ && 'yes' === $shipping_method[ $this->integration_id . '_custom_services' ]
291
+ ) {
292
+ $custom_services_enabled = true;
293
+ }
294
+ return $custom_services_enabled;
295
+ }
296
+
297
+ /**
298
+ * Get custom service types from shipping method settings.
299
+ *
300
+ * @param array $shipping_method_settings Shipping method settings.
301
+ *
302
+ * @return array
303
+ */
304
+ private function get_custom_service_types_from_settings( array $shipping_method_settings ) {
305
+ if ( isset( $shipping_method_settings[ $this->integration_id . '_service_type_custom_services' ] )
306
+ && isset( $shipping_method_settings[ $this->integration_id . '_service_type_custom_services' ]['services'] )
307
+ ) {
308
+ $custom_services_service_types = $shipping_method_settings[ $this->integration_id . '_service_type_custom_services' ]['services'];
309
+ } else {
310
+ $custom_services_service_types = array();
311
+ }
312
+ return $custom_services_service_types;
313
+ }
314
+
315
+ /**
316
+ * Filter rates.
317
+ *
318
+ * @param WPDesk\SaasPlatformClient\Model\Rate\SingleRate[] $rates Rates.
319
+ * @param array $shipping_method Shipping method.
320
+ *
321
+ * @return array
322
+ */
323
+ private function filter_and_rename_rates( $rates, array $shipping_method ) {
324
+ $shipping_method_settings = $this->get_shipping_method_settings( $shipping_method );
325
+
326
+ $custom_services_enabled = $this->get_custom_services_enabled( $shipping_method );
327
+
328
+ $custom_services_service_types = $this->get_custom_service_types_from_settings( $shipping_method_settings );
329
+
330
+ foreach ( $rates as $rate_id => $rate ) {
331
+ if ( isset( $custom_services_service_types[ $rate->serviceType ] ) ) {
332
+ if ( $custom_services_enabled && 0 === intval( $custom_services_service_types[ $rate->serviceType ]['enabled'] ) ) {
333
+ unset( $rates[ $rate_id ] );
334
+ } else {
335
+ $rates[ $rate_id ]->serviceName = $custom_services_service_types[ $rate->serviceType ]['name'];
336
+ }
337
+ } else {
338
+ unset( $rates[ $rate_id ] );
339
+ }
340
+ }
341
+ return $rates;
342
+ }
343
+
344
+ /**
345
+ * Get rate for given service type.
346
+ *
347
+ * @param WPDesk\SaasPlatformClient\Model\Rate\SingleRate[] $rates Rates.
348
+ * @param string $service_type_id Service type id.
349
+ *
350
+ * @return \WPDesk\SaasPlatformClient\Model\Rate\SingleRate|null
351
+ */
352
+ private function get_rate_for_service_type( $rates, $service_type_id ) {
353
+ foreach ( $rates as $rate ) {
354
+ if ( strval( $rate->serviceType ) === strval( $service_type_id ) ) {
355
+ return $rate;
356
+ }
357
+ }
358
+ return null;
359
+ }
360
+
361
+ /**
362
+ * Sort rates.
363
+ *
364
+ * @param WPDesk\SaasPlatformClient\Model\Rate\SingleRate[] $rates Rates.
365
+ * @param array $shipping_method Shipping method.
366
+ *
367
+ * @return array
368
+ */
369
+ private function sort_rates( $rates, array $shipping_method ) {
370
+ $custom_services_enabled = $this->get_custom_services_enabled( $shipping_method );
371
+
372
+ if ( $custom_services_enabled ) {
373
+ $sorted_rates = array();
374
+ $shipping_method_settings = $this->get_shipping_method_settings( $shipping_method );
375
+ $custom_services_service_types = $this->get_custom_service_types_from_settings( $shipping_method_settings );
376
+ foreach ( $custom_services_service_types as $service_type_id => $service_type ) {
377
+ $rate = $this->get_rate_for_service_type( $rates, $service_type_id );
378
+ if ( null !== $rate ) {
379
+ $sorted_rates[] = $rate;
380
+ }
381
+ }
382
+ return $sorted_rates;
383
+ }
384
+
385
+ return $rates;
386
+ }
387
+
388
+ /**
389
+ * Add rates to checkout.
390
+ *
391
+ * @param \WPDesk\SaasPlatformClient\Model\Rate\SingleRate[] $rates Rates.
392
+ * @param array $shipping_method Shipping method.
393
+ * @param WPDesk_Flexible_Shipping $flexible_shipping Flexible shipping.
394
+ * @param array $live_rate_response Live rate response.
395
+ */
396
+ private function add_rates_to_checkout( $rates, $shipping_method, $flexible_shipping, $live_rate_response ) {
397
+ foreach ( $rates as $rate ) {
398
+ $flexible_shipping->add_rate( array(
399
+ 'id' => $flexible_shipping->id . ':' . $flexible_shipping->instance_id . ':' . $rate->serviceType,
400
+ 'label' => $rate->serviceName,
401
+ 'cost' => $rate->totalCharge->getAmount() / 100,
402
+ 'meta_data' => array(
403
+ '_fs_method' => $shipping_method,
404
+ self::FS_RATE_TYPE => self::RATE_TYPE_LIVE,
405
+ '_fs_saas_data' => array(
406
+ '_default' => $shipping_method['method_default'],
407
+ '_fs_service_type' => $rate->serviceType,
408
+ '_fs_service_name' => $rate->serviceName,
409
+ '_fs_live_rate_response' => $live_rate_response,
410
+ ),
411
+ ),
412
+ ) );
413
+ }
414
+ }
415
+
416
+ /**
417
+ * Is fallback enabled?
418
+ *
419
+ * @param array $shipping_method_settings Shipping method settings.
420
+ *
421
+ * @return bool
422
+ */
423
+ private function is_fallback_enabled( array $shipping_method_settings ) {
424
+ return 'yes' === $shipping_method_settings[ $this->integration_id . '_fallback' ];
425
+ }
426
+
427
+ /**
428
+ * Maybe add notice in checkout page for admin.
429
+ *
430
+ * @param string $notice_message Notice message.
431
+ */
432
+ private function maybe_add_notice_for_admin( $notice_message ) {
433
+ if ( is_checkout() && current_user_can( 'manage_woocommerce' ) ) {
434
+ // Translators: notice message.
435
+ $message = sprintf( __( 'Flexible Shipping Fallback: %1$s', 'flexible-shipping' ), $notice_message );
436
+ if ( ! wc_has_notice( $message, 'error' ) ) {
437
+ wc_add_notice( $message, 'error' );
438
+ }
439
+ }
440
+ }
441
+
442
+ /**
443
+ * Process SaaS live rates.
444
+ *
445
+ * @param bool $add_method Already processed.
446
+ * @param array $shipping_method_settings Shipping method.
447
+ * @param array $package Package.
448
+ * @param WPDesk_Flexible_Shipping $flexible_shipping Flexible shipping.
449
+ *
450
+ * @return bool
451
+ */
452
+ private function process_live_rates( $add_method, array $shipping_method_settings, array $package, $flexible_shipping ) {
453
+ $is_fallback = false;
454
+ if ( $this->integration_id === $shipping_method_settings['method_integration'] ) {
455
+ if ( self::RATE_TYPE_LIVE === $shipping_method_settings[ $this->integration_id . '_rates_type' ] ) {
456
+ try {
457
+ $rate_request = $this->prepare_rate_request( $package, $shipping_method_settings );
458
+ $rate_request_response = $this->saas_connection->get_platform()->requestPostRate( $rate_request, $this->shipping_service->get_id() );
459
+ if ( $rate_request_response->isError() ) {
460
+ $reponse_error_body = $rate_request_response->getResponseErrorBody();
461
+ if ( isset( $reponse_error_body['message'] ) ) {
462
+ $this->fallback_error_message = $reponse_error_body['message'];
463
+ } else {
464
+ $this->fallback_error_message = 'Live rates response error: ' . wp_json_encode( $rate_request->toArray() ) . ', response ' . wp_json_encode( $rate_request_response->getResponseErrorBody() );
465
+ }
466
+ $this->logger->debug( $this->fallback_error_message );
467
+ $add_method = $this->is_fallback_enabled( $shipping_method_settings );
468
+ $is_fallback = true;
469
+ } else {
470
+ $rates = $this->filter_and_rename_rates( $rate_request_response->getRate()->rates, $shipping_method_settings );
471
+ $rates = $this->sort_rates( $rates, $shipping_method_settings );
472
+ $this->add_rates_to_checkout( $rates, $shipping_method_settings, $flexible_shipping, $rate_request_response->getResponseBody() );
473
+ $add_method = false;
474
+ }
475
+ } catch ( Exception $e ) {
476
+ $this->fallback_error_message = "Live rates response exception {$e->getMessage()}; {$e->getCode()} occurred while sending request";
477
+ $this->logger->error( $this->fallback_error_message );
478
+ $add_method = $this->is_fallback_enabled( $shipping_method_settings );
479
+ $is_fallback = true;
480
+ }
481
+ if ( $is_fallback ) {
482
+ if ( $add_method ) {
483
+ add_filter( 'woocommerce_shipping_method_add_rate', [
484
+ $this,
485
+ 'add_fallback_metadata_to_rate',
486
+ ], 10, 3 );
487
+ }
488
+ $this->maybe_add_notice_for_admin( $this->fallback_error_message );
489
+ }
490
+ }
491
+ }
492
+ return $add_method;
493
+ }
494
+
495
+ /**
496
+ * Handle SaaS live rates.
497
+ *
498
+ * @param bool $add_method Already processed.
499
+ * @param array $shipping_method_settings Shipping method.
500
+ * @param array $package Package.
501
+ * @param null|WPDesk_Flexible_Shipping $flexible_shipping Flexible shipping.
502
+ *
503
+ * @return bool
504
+ */
505
+ public function handle_saas_live_rates( $add_method, array $shipping_method_settings, array $package, $flexible_shipping = null ) {
506
+ if ( null === $flexible_shipping ) {
507
+ $flexible_shipping = new WPDesk_Flexible_Shipping();
508
+ }
509
+ if ( $flexible_shipping->is_free_shipping( $shipping_method_settings, $flexible_shipping->contents_cost() ) ) {
510
+ $add_method = true;
511
+ add_filter( 'woocommerce_shipping_method_add_rate', [
512
+ $this,
513
+ 'add_free_shipping_metadata_to_rate',
514
+ ], 10, 3 );
515
+ $this->maybe_add_notice_for_admin( $this->fallback_error_message );
516
+ } else {
517
+ $add_method = $this->process_live_rates( $add_method, $shipping_method_settings, $package, $flexible_shipping );
518
+ }
519
+ return $add_method;
520
+ }
521
+
522
+
523
+ /**
524
+ * Add fallback metadata to shipping rate.
525
+ *
526
+ * @param WC_Shipping_Rate $rate Rate.
527
+ * @param array $args Args.
528
+ * @param WC_Shipping_Method $shipping_method Shipping method.
529
+ * @return WC_Shipping_Rate
530
+ */
531
+ public function add_fallback_metadata_to_rate( WC_Shipping_Rate $rate, array $args, WC_Shipping_Method $shipping_method ) {
532
+ remove_filter( 'woocommerce_shipping_method_add_rate', [ $this, 'add_fallback_metadata_to_rate' ], 10, 3 );
533
+ $rate->add_meta_data( '_fs_fallback', $this->fallback_error_message );
534
+ $rate->add_meta_data( self::FS_RATE_TYPE, self::RATE_TYPE_LIVE );
535
+ return $rate;
536
+ }
537
+
538
+ /**
539
+ * Add free shipping metadata to shipping rate.
540
+ *
541
+ * @param WC_Shipping_Rate $rate Rate.
542
+ * @param array $args Args.
543
+ * @param WC_Shipping_Method $shipping_method Shipping method.
544
+ * @return WC_Shipping_Rate
545
+ */
546
+ public function add_free_shipping_metadata_to_rate( WC_Shipping_Rate $rate, array $args, WC_Shipping_Method $shipping_method ) {
547
+ remove_filter( 'woocommerce_shipping_method_add_rate', [ $this, 'add_free_shipping_metadata_to_rate' ], 10, 3 );
548
+ $rate->add_meta_data( '_fs_free_shipping', 'Free shipping' );
549
+ $rate->add_meta_data( self::FS_RATE_TYPE, self::RATE_TYPE_LIVE );
550
+ return $rate;
551
+ }
552
+
553
+ /**
554
+ * Recalculate shipping for woocommerce manager.
555
+ * Used for fallback always visible on checkout.
556
+ */
557
+ public function recalculate_shipping_for_woocomerce_manager() {
558
+ if ( ! is_ajax() && is_checkout() && current_user_can( 'manage_woocommerce' ) ) {
559
+ WC()->session->set( 'cart_totals', null );
560
+ }
561
+ }
562
+
563
+ }
classes/saas/class-saas-maintenance-mode-exception.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception extends RuntimeException {
7
+
8
+ /**
9
+ * Response
10
+ *
11
+ * @var \WPDesk\SaasPlatformClient\Response\Response
12
+ */
13
+ private $response;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception constructor.
17
+ *
18
+ * @param \WPDesk\SaasPlatformClient\Response\Response $response Response.
19
+ * @param string $message Message.
20
+ * @param int $code Code.
21
+ * @param Throwable|null $previous Previous.
22
+ */
23
+ public function __construct( WPDesk\SaasPlatformClient\Response\Response $response, $message = '', $code = 0, Throwable $previous = null ) {
24
+ parent::__construct( $message, $code, $previous );
25
+ $this->response = $response;
26
+ }
27
+
28
+ /**
29
+ * Get response.
30
+ *
31
+ * @return \WPDesk\SaasPlatformClient\Response\Response
32
+ */
33
+ public function get_response() {
34
+ return $this->response;
35
+ }
36
+
37
+ }
classes/saas/class-saas-platform-factory.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_Settings_Connection' ) ) {
8
+
9
+ /**
10
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings_Connection
11
+ */
12
+ class WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory {
13
+ const SAAS_PLATFORM_LOGGER_SOURCE = 'saas-platform';
14
+
15
+ const ONE_HOUR = 3600;
16
+
17
+ /** @var \Psr\Log\LoggerInterface */
18
+ private $logger;
19
+
20
+ /**
21
+ * WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory constructor.
22
+ *
23
+ * @param \Psr\Log\LoggerInterface $logger Logger.
24
+ */
25
+ public function __construct( \Psr\Log\LoggerInterface $logger ) {
26
+ $this->logger = new WPDesk_Flexible_Shipping_WooCommerce_Context_Logger(
27
+ $logger,
28
+ self::SAAS_PLATFORM_LOGGER_SOURCE
29
+ );
30
+ }
31
+
32
+ /**
33
+ * Get platform.
34
+ *
35
+ * @return \WPDesk\SaasPlatformClient\Platform
36
+ */
37
+ public function get_platform() {
38
+ $platform_options = new \WPDesk\SaasPlatformClient\PlatformFactoryWordpressOptions();
39
+ $platform_options->setLogger( $this->logger );
40
+ // TODO: enable when ready
41
+ //$platform_options->setCachedClient( true );
42
+ $platform_options->setCacheTtl( self::ONE_HOUR );
43
+ $platform = \WPDesk\SaasPlatformClient\PlatformFactory::createPlatformApi( $platform_options );
44
+
45
+ return $platform;
46
+ }
47
+ }
48
+
49
+ }
classes/saas/class-saas-platform-links.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Platform_Links
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Platform_Links {
7
+
8
+ const MY_ACCOUNT = 'my-account/';
9
+ const SUPPORT = 'support/';
10
+ const TERMS = 'terms/';
11
+ const PRIVACY = 'terms/privacy/';
12
+ const UPGRADE_PLAN = 'my-account/';
13
+ const CONNECT = 'connect/';
14
+
15
+ const DOCS = 'https://docs.flexibleshipping.com/category/81-getting-started';
16
+ const STATUS = 'https://status.flexibleshipping.com/';
17
+
18
+ const UTM_SOURCE = 'fs-signup';
19
+ const UTM_MEDIUM = 'banner';
20
+ const UTM_CAMPAIGN = 'fs-signup';
21
+ const UTM_TERM = '';
22
+
23
+ const UTM_CONTENT_GENERAL = 'general';
24
+ const UTM_CONTENT_PRIVACY_POLICY = 'privacy-policy';
25
+ const UTM_CONTENT_TERMS = 'terms';
26
+
27
+
28
+ /**
29
+ * Base URL.
30
+ *
31
+ * @var string
32
+ */
33
+ private $base_url;
34
+
35
+ /**
36
+ * WPDesk_Flexible_Shipping_SaaS_Platform_Links constructor.
37
+ *
38
+ * @param string $base_url Base URL.
39
+ */
40
+ public function __construct( $base_url = 'https://flexibleshipping.com/' ) {
41
+ $this->base_url = trailingslashit( $base_url );
42
+ }
43
+
44
+ /**
45
+ * Get base URL.
46
+ *
47
+ * @return string
48
+ */
49
+ public function get_base_url() {
50
+ return $this->base_url;
51
+ }
52
+
53
+ /**
54
+ * Get my account URL.
55
+ *
56
+ * @return string
57
+ */
58
+ public function get_my_account() {
59
+ return $this->base_url . self::MY_ACCOUNT;
60
+ }
61
+
62
+ /**
63
+ * Get my account URL.
64
+ *
65
+ * @return string
66
+ */
67
+ public function get_support() {
68
+ return $this->base_url . self::SUPPORT;
69
+ }
70
+
71
+ /**
72
+ * Get terms URL.
73
+ *
74
+ * @return string
75
+ */
76
+ public function get_terms() {
77
+ return $this->base_url . self::TERMS;
78
+ }
79
+
80
+ /**
81
+ * Get privacy URL.
82
+ *
83
+ * @return string
84
+ */
85
+ public function get_privacy() {
86
+ return $this->base_url . self::PRIVACY;
87
+ }
88
+
89
+ /**
90
+ * Get upgrade plan URL.
91
+ *
92
+ * @return string
93
+ */
94
+ public function get_upgrade_plan() {
95
+ return $this->base_url . self::UPGRADE_PLAN;
96
+ }
97
+
98
+ /**
99
+ * Get docs URL.
100
+ *
101
+ * @return string
102
+ */
103
+ public function get_docs() {
104
+ return self::DOCS;
105
+ }
106
+
107
+ /**
108
+ * Get status URL.
109
+ *
110
+ * @return string
111
+ */
112
+ public function get_status() {
113
+ return self::STATUS;
114
+ }
115
+
116
+ /**
117
+ * Get connect URL.
118
+ *
119
+ * @return string
120
+ */
121
+ public function get_connect() {
122
+ return $this->base_url . self::CONNECT;
123
+ }
124
+
125
+ /**
126
+ * Add UTM to URL.
127
+ *
128
+ * @param string $url URL.
129
+ * @param string $utm_content Parameter utm_content.
130
+ * @param string $utm_campaign Parameter utm_campaign.
131
+ * @param string $utm_medium Parameter utm_medium.
132
+ * @param string $utm_source Parameter utm_source.
133
+ *
134
+ * @return string
135
+ */
136
+ public function add_utm( $url, $utm_content, $utm_campaign = '', $utm_medium = '', $utm_source = '', $utm_term = '' ) {
137
+ $utm_campaign = empty( $utm_campaign ) ? self::UTM_CAMPAIGN : $utm_campaign;
138
+ $utm_medium = empty( $utm_medium ) ? self::UTM_MEDIUM : $utm_medium;
139
+ $utm_source = empty( $utm_source ) ? self::UTM_SOURCE : $utm_source;
140
+ $utm_term = empty( $utm_term ) ? self::UTM_TERM : $utm_term;
141
+ return sprintf(
142
+ '%1$s?utm_source=%2$s&utm_medium=%3$s&utm_campaign=%4$s&utm_content=%5$s&utm_term=%6$s',
143
+ $url,
144
+ $utm_source,
145
+ $utm_medium,
146
+ $utm_campaign,
147
+ $utm_content,
148
+ $utm_term
149
+ );
150
+ }
151
+
152
+ /**
153
+ * Add utm-content general to URL.
154
+ *
155
+ * @param string $url URL.
156
+ *
157
+ * @return string
158
+ */
159
+ public function add_utm_general( $url ) {
160
+ return $this->add_utm( $url, self::UTM_CONTENT_GENERAL );
161
+ }
162
+
163
+ /**
164
+ * Add utm-content privacy policy to URL.
165
+ *
166
+ * @param string $url URL.
167
+ *
168
+ * @return string
169
+ */
170
+ public function add_utm_privacy_policy( $url ) {
171
+ return $this->add_utm( $url, self::UTM_CONTENT_PRIVACY_POLICY );
172
+ }
173
+
174
+ /**
175
+ * Add utm-content terms to URL.
176
+ *
177
+ * @param string $url URL.
178
+ *
179
+ * @return string
180
+ */
181
+ public function add_utm_terms( $url ) {
182
+ return $this->add_utm( $url, self::UTM_CONTENT_TERMS );
183
+ }
184
+
185
+ }
186
+
classes/saas/class-saas-registration-second-notice.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice
7
+ implements \WPDesk\PluginBuilder\Plugin\Hookable {
8
+
9
+ const SECOND_NOTICE_NAME = 'fs_connect_start2';
10
+ const SECOND_NOTICE_OPTION_NAME = 'fs_connect_start2_time';
11
+ const NOTICE_START_TIME_OFFSET = 604800; // One week.
12
+ //const NOTICE_START_TIME_OFFSET = 60; // One minute.
13
+
14
+ /**
15
+ * First notice name.
16
+ *
17
+ * @var string
18
+ */
19
+ private $first_notice_name;
20
+
21
+ /**
22
+ * WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice constructor.
23
+ *
24
+ * @param string $first_notice_name First notice name.
25
+ */
26
+ public function __construct( $first_notice_name ) {
27
+ $this->first_notice_name = $first_notice_name;
28
+ }
29
+
30
+ /**
31
+ * Hooks.
32
+ */
33
+ public function hooks() {
34
+ add_action( 'wpdesk_notice_dismissed_notice', array( $this, 'save_notice_start_date' ) );
35
+ add_action( 'admin_init', array( $this, 'maybe_show_notice' ) );
36
+ }
37
+
38
+ /**
39
+ * Save notice start date.
40
+ * Fires on notice dismiss.
41
+ *
42
+ * @param string $notice_name Dismissed notice name.
43
+ */
44
+ public function save_notice_start_date( $notice_name ) {
45
+ if ( $this->first_notice_name === $notice_name ) {
46
+ $notice_start_time = current_time( 'timestamp' ) + self::NOTICE_START_TIME_OFFSET;
47
+ update_option( self::SECOND_NOTICE_OPTION_NAME, $notice_start_time );
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Get notice content.
53
+ *
54
+ * @return string
55
+ */
56
+ private function get_notice_content() {
57
+ $link = add_query_arg( 'page', WPDesk_Flexible_Shipping_SaaS_User_Registration::REGISTER_PAGE_SLUG, admin_url( 'admin.php' ) );
58
+ ob_start();
59
+ include 'views/html-flexible-shipping-connect-second-notice.php';
60
+ $notice_content = ob_get_contents();
61
+ ob_end_clean();
62
+
63
+ return $notice_content;
64
+ }
65
+
66
+
67
+ /**
68
+ * Maybe show notice.
69
+ */
70
+ public function maybe_show_notice() {
71
+ $notice_start_time = intval( get_option( self::SECOND_NOTICE_OPTION_NAME, '0' ) );
72
+ if ( 0 !== $notice_start_time && $notice_start_time <= current_time( 'timestamp' ) ) {
73
+ $notice_content = $this->get_notice_content();
74
+ new \WPDesk\Notice\PermanentDismissibleNotice(
75
+ $notice_content,
76
+ \WPDesk\Notice\Notice::NOTICE_TYPE_INFO,
77
+ self::SECOND_NOTICE_NAME,
78
+ 10,
79
+ array(
80
+ 'class' => self::SECOND_NOTICE_NAME,
81
+ 'id' => self::SECOND_NOTICE_NAME,
82
+ )
83
+ );
84
+ }
85
+ }
86
+
87
+ }
88
+
classes/saas/class-saas-service-settings-not-found-exception.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found extends RuntimeException {
7
+ }
classes/saas/class-saas-settings-service-checkbox.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings_Service_Checkbox
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Settings_Service_Checkbox {
7
+
8
+ /**
9
+ * Integration ID.
10
+ *
11
+ * @var string
12
+ */
13
+ private $integration_id;
14
+
15
+ /**
16
+ * Shipping service.
17
+ *
18
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service
19
+ */
20
+ private $shipping_service;
21
+
22
+ /**
23
+ * Required plugin version.
24
+ *
25
+ * @var null|string
26
+ */
27
+ private $required_plugin_version;
28
+
29
+ /**
30
+ * Current plugin version.
31
+ *
32
+ * @var string
33
+ */
34
+ private $current_plugin_version;
35
+
36
+ /**
37
+ * Is checkbox checked?
38
+ *
39
+ * @var bool
40
+ */
41
+ private $is_checked;
42
+
43
+ /**
44
+ * Settings URL.
45
+ *
46
+ * @var string
47
+ */
48
+ private $settings_url;
49
+
50
+ /**
51
+ * WPDesk_Flexible_Shipping_SaaS_Settings_Service_Checkbox constructor.
52
+ *
53
+ * @param string $integration_id Integration ID.
54
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
55
+ * @param string|null $required_plugin_version Required plugin version.
56
+ * @param string $current_plugin_version Current plugin version.
57
+ * @param bool $is_checked Checkbox is checked.
58
+ * @param string $settings_url Settings URL.
59
+ */
60
+ public function __construct( $integration_id, $shipping_service, $required_plugin_version, $current_plugin_version, $is_checked, $settings_url ) {
61
+ $this->integration_id = $integration_id;
62
+ $this->shipping_service = $shipping_service;
63
+ $this->required_plugin_version = $required_plugin_version;
64
+ $this->current_plugin_version = $current_plugin_version;
65
+ $this->is_checked = $is_checked;
66
+ $this->settings_url = $settings_url;
67
+ }
68
+
69
+ /**
70
+ * Add description to checkbox.
71
+ *
72
+ * @param array $checkbox_field Checkbox field.
73
+ *
74
+ * @return array
75
+ */
76
+ private function add_description_to_checkbox_for_required_plugin_version( array $checkbox_field ) {
77
+ if ( empty( $this->required_plugin_version ) ) {
78
+ $checkbox_field['description'] = __( 'Invalid requireWordpressPluginVersion capability!', 'flexible-shipping' );
79
+ $checkbox_field['disabled'] = true;
80
+ } elseif ( version_compare( $this->required_plugin_version, $this->current_plugin_version ) > 0 ) {
81
+ $checkbox_field['description'] = sprintf(
82
+ // Translators: plugin version.
83
+ __( 'This integration requires Flexible Shipping Plugin in version %1$s or newer!', 'flexible-shipping' ),
84
+ $this->required_plugin_version
85
+ );
86
+ $checkbox_field['disabled'] = true;
87
+ } else {
88
+ if ( $this->is_checked ) {
89
+ $settings_url = $this->settings_url;
90
+ $link_id = 'saas-settings-link-' . $this->shipping_service->get_id();
91
+ // Translators: URL.
92
+ $link_text = sprintf( __( 'Go to %s settings</a>', 'flexible-shipping' ), $this->shipping_service->get_name() );
93
+
94
+ $checkbox_field['description'] = '<a id="' . esc_attr( $link_id ) . '" href="' . $settings_url . '">' . $link_text . '</a>';
95
+ }
96
+ }
97
+ return $checkbox_field;
98
+ }
99
+
100
+ /**
101
+ * Setup promoted service.
102
+ *
103
+ * @param array $checkbox_field
104
+ *
105
+ * @return array
106
+ */
107
+ private function setup_promoted( array $checkbox_field ) {
108
+ $checkbox_field['title'] = sprintf(
109
+ // Translators: span and service name.
110
+ __( '%1$s%2$s (new)%3$s', 'flexible-shipping' ),
111
+ '<span class="fs-new-service">',
112
+ $this->shipping_service->get_name(),
113
+ '</span>'
114
+ );
115
+ return $checkbox_field;
116
+ }
117
+
118
+ /**
119
+ * Prepare checkbox.
120
+ *
121
+ * @return array
122
+ */
123
+ public function prepare_checkbox() {
124
+ $checkbox_field = [
125
+ 'type' => 'checkbox',
126
+ 'title' => $this->shipping_service->get_name(),
127
+ 'label' => __( 'Enable', 'flexible-shipping' ) . ' ' . $this->shipping_service->get_name(),
128
+ 'class' => 'flexible-shipping-saas-shipping-provider',
129
+ 'custom_attributes' => array(
130
+ 'data-shipping_provider_id' => esc_attr( $this->shipping_service->get_id() ),
131
+ 'data-shipping_provider_name' => esc_attr( $this->shipping_service->get_name() ),
132
+ ),
133
+ ];
134
+
135
+ if ( $this->shipping_service->get_promoted() ) {
136
+ $checkbox_field = $this->setup_promoted( $checkbox_field );
137
+ }
138
+
139
+ $checkbox_field = $this->add_description_to_checkbox_for_required_plugin_version( $checkbox_field );
140
+
141
+ return $checkbox_field;
142
+
143
+ }
144
+
145
+ }
classes/saas/class-saas-settings.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implements WPDesk_Flexible_Shipping_Saas_Connection_Aware {
7
+
8
+ const METHOD_ID = 'flexible_shipping_connect';
9
+
10
+ const FILTER_FLEXIBLE_SHIPPING_SAAS_SERVICES = 'flexible_shipping_saas_services';
11
+
12
+ const WOOCOMMERCE_PAGE_WC_SETTINGS = 'wc-settings';
13
+
14
+ const WOOCOMMERCE_SETTINGS_SHIPPING_URL = 'admin.php?page=wc-settings&tab=shipping';
15
+
16
+ const WPDESK_HELPER_OPTIONS = 'wpdesk_helper_options';
17
+
18
+ /**
19
+ * Shipping methods manager.
20
+ *
21
+ * @var WPDesk_Flexible_Shipping_SaaS_Services_Manager
22
+ */
23
+ private $shipping_methods_manager;
24
+
25
+ /**
26
+ * Saas connection.
27
+ *
28
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
29
+ */
30
+ private $saas_connection = null;
31
+
32
+ /**
33
+ * Links.
34
+ *
35
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
36
+ */
37
+ private $saas_platform_links;
38
+
39
+ /**
40
+ * Logger settings.
41
+ *
42
+ * @var WPDesk_Flexible_Shipping_SaaS_Logger_Settings
43
+ */
44
+ private $logger_settings;
45
+
46
+ /**
47
+ * WPDesk_Flexible_Shipping_Connect constructor.
48
+ *
49
+ * @param int $instance_id Instance id.
50
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS connection.
51
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Links.
52
+ * @param WPDesk_Flexible_Shipping_SaaS_Services_Manager $shipping_methods_manager Shipping methods manager.
53
+ */
54
+ public function __construct(
55
+ $instance_id = 0,
56
+ $saas_connection = null,
57
+ WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links = null,
58
+ $shipping_methods_manager = null
59
+ ) {
60
+ parent::__construct( $instance_id );
61
+ $this->id = self::METHOD_ID;
62
+ $this->enabled = 'no';
63
+ $this->method_title = __( 'Flexible Shipping', 'flexible-shipping' );
64
+
65
+ $this->supports = array(
66
+ 'settings',
67
+ );
68
+
69
+ $this->shipping_methods_manager = $shipping_methods_manager;
70
+ $this->saas_connection = $saas_connection;
71
+
72
+ if ( null === $saas_platform_links ) {
73
+ $saas_platform_links = new WPDesk_Flexible_Shipping_SaaS_Platform_Links();
74
+ }
75
+ $this->saas_platform_links = $saas_platform_links;
76
+
77
+ $this->logger_settings = new WPDesk_Flexible_Shipping_SaaS_Logger_Settings( $this );
78
+
79
+ $this->init_form_fields();
80
+
81
+ add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
82
+
83
+ }
84
+
85
+ /**
86
+ * Set shipping methods manager.
87
+ *
88
+ * @param WPDesk_Flexible_Shipping_SaaS_Services_Manager $shipping_methods_manager Shipping methods manager.
89
+ */
90
+ public function set_shipping_methods_manager( $shipping_methods_manager ) {
91
+ $this->shipping_methods_manager = $shipping_methods_manager;
92
+ }
93
+
94
+ /**
95
+ * Set SaaS Connection.
96
+ *
97
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS connection.
98
+ */
99
+ public function set_saas_connection( $saas_connection ) {
100
+ $this->saas_connection = $saas_connection;
101
+ }
102
+
103
+ /**
104
+ * Update all shipping services.
105
+ *
106
+ * @param array $shipping_providers Shipping providers.
107
+ */
108
+ private function update_all_shipping_services( array $shipping_providers ) {
109
+ $this->shipping_methods_manager->update_all_shipping_services( $shipping_providers );
110
+ }
111
+
112
+ /**
113
+ * Update debug mode.
114
+ */
115
+ private function update_debug_mode() {
116
+ $this->logger_settings->update_option_from_saas_settings( $this );
117
+ }
118
+
119
+ /**
120
+ * Process admin options.
121
+ */
122
+ public function process_admin_options() {
123
+ parent::process_admin_options();
124
+ $shipping_service = $this->get_shipping_services_from_platform();
125
+ $this->update_all_shipping_services( $shipping_service );
126
+ $enabled_shipping_services = array();
127
+ /**
128
+ * IDE type hint.
129
+ *
130
+ * @var \WPDesk\SaasPlatformClient\Model\ShippingService $service
131
+ */
132
+ foreach ( $shipping_service as $service ) {
133
+ $shipping_service = WPDesk_Flexible_Shipping_SaaS_Shipping_Service::create_from_platform_service(
134
+ $this->saas_connection,
135
+ $this->saas_platform_links,
136
+ $service
137
+ );
138
+ if ( 'yes' === $this->get_option( $shipping_service->get_integration_id(), 'no' ) ) {
139
+ $enabled_shipping_services[] = $service->getId();
140
+ }
141
+ }
142
+ $this->update_debug_mode();
143
+ $this->shipping_methods_manager->update_enabled_shipping_services( $enabled_shipping_services );
144
+ $url = admin_url( self::WOOCOMMERCE_SETTINGS_SHIPPING_URL );
145
+ $url = add_query_arg( 'section', $this->id, $url );
146
+ $url = add_query_arg(
147
+ WPDesk_Flexible_Shipping_SaaS_Services_Manager::PARAMETER_SETTINGS_UPDATED,
148
+ WPDesk_Flexible_Shipping_SaaS_Services_Manager::PARAMETER_SETTINGS_UPDATED_VALUE,
149
+ $url
150
+ );
151
+ wp_safe_redirect( $url );
152
+ exit;
153
+ }
154
+
155
+ /**
156
+ * In settings screen?
157
+ *
158
+ * @return bool
159
+ */
160
+ public function is_in_settings() {
161
+ if ( is_admin() && isset( $_GET['page'] ) && isset( $_GET['section'] ) ) {
162
+ $page = $_GET['page'];
163
+ $section = $_GET['section'];
164
+ if ( self::WOOCOMMERCE_PAGE_WC_SETTINGS === $page && self::METHOD_ID === $section ) {
165
+ return true;
166
+ }
167
+ }
168
+ return false;
169
+ }
170
+
171
+ /**
172
+ * Get shipping providers from platform.
173
+ *
174
+ * @return array
175
+ * @throws Exception Exception.
176
+ */
177
+ private function get_shipping_services_from_platform() {
178
+ try {
179
+ $saas_shipping_services = $this->saas_connection->get_saas_shipping_services();
180
+ $shipping_services_from_platform = $saas_shipping_services->get_shipping_services_from_platform();
181
+ } catch ( WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception $e ) {
182
+ $shipping_services_from_platform = array();
183
+ }
184
+ return $shipping_services_from_platform;
185
+ }
186
+
187
+ /**
188
+ * Maybe update integration checkbox.
189
+ *
190
+ * @param string|null $required_plugin_version Required plugin version.
191
+ * @param string $integration_id Integration ID.
192
+ */
193
+ private function maybe_update_integration_checkbox( $required_plugin_version, $integration_id ) {
194
+ if ( empty( $required_plugin_version )
195
+ || version_compare( $required_plugin_version, FLEXIBLE_SHIPPING_VERSION ) > 0
196
+ ) {
197
+ $this->update_option( $integration_id, 'no' );
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Add shipping providers checkboxes to settings.
203
+ *
204
+ * @param array $settings Settings.
205
+ * @param array $shipping_services_from_platform Shipping providers from platform.
206
+ *
207
+ * @return array
208
+ */
209
+ private function add_shipping_services_checkboxes_to_settings( array $settings, array $shipping_services_from_platform ) {
210
+ if ( count( $shipping_services_from_platform ) ) {
211
+ $settings[] = array(
212
+ 'type' => 'title',
213
+ 'title' => __( 'Connect Services', 'flexible-shipping' ),
214
+ 'description' => __( 'Enable services to automate shipping and print labels with Flexible Shipping Connect.', 'flexible-shipping' ),
215
+ );
216
+ foreach ( $shipping_services_from_platform as $shipping_service_from_platform ) {
217
+ $shipping_service = WPDesk_Flexible_Shipping_SaaS_Shipping_Service::create_from_platform_service(
218
+ $this->saas_connection,
219
+ $this->saas_platform_links,
220
+ $shipping_service_from_platform
221
+ );
222
+
223
+ $integration_id = $shipping_service->get_integration_id();
224
+
225
+ $required_plugin_version = $shipping_service->get_capability( 'requireWordpressPluginVersion' );
226
+ $this->maybe_update_integration_checkbox( $required_plugin_version, $integration_id );
227
+
228
+ $service_checkbox = new WPDesk_Flexible_Shipping_SaaS_Settings_Service_Checkbox(
229
+ $integration_id,
230
+ $shipping_service,
231
+ $required_plugin_version,
232
+ FLEXIBLE_SHIPPING_VERSION,
233
+ 'yes' === $this->get_option( $integration_id ),
234
+ admin_url( self::WOOCOMMERCE_SETTINGS_SHIPPING_URL . '&section=' . $integration_id )
235
+ );
236
+
237
+ $settings[ $integration_id ] = $service_checkbox->prepare_checkbox();
238
+ }
239
+ }
240
+ return $settings;
241
+ }
242
+
243
+ /**
244
+ * Initialise Settings Form Fields.
245
+ */
246
+ public function init_form_fields() {
247
+ $this->form_fields = array(
248
+ 'saas_connection' => array(
249
+ 'type' => 'saas_connection',
250
+ ),
251
+ );
252
+ if ( $this->is_in_settings() ) {
253
+ if ( $this->saas_connection->is_connected() ) {
254
+ $shipping_providers_from_platform = $this->get_shipping_services_from_platform();
255
+ if ( count( $shipping_providers_from_platform ) ) {
256
+ $this->form_fields = $this->add_shipping_services_checkboxes_to_settings( $this->form_fields, $shipping_providers_from_platform );
257
+ }
258
+ }
259
+ $this->form_fields = $this->logger_settings->add_fields_to_settings( $this->form_fields );
260
+ }
261
+ }
262
+
263
+
264
+ /**
265
+ * Generate HTML for custom field type saas_connection.
266
+ *
267
+ * @param string $key Key.
268
+ * @param array $data Data.
269
+ *
270
+ * @return string
271
+ */
272
+ public function generate_saas_connection_html( $key, $data ) {
273
+ ob_start();
274
+ $saas_connection = $this->saas_connection;
275
+ $saas_platform_my_account_url = $this->saas_platform_links->add_utm(
276
+ $this->saas_platform_links->get_my_account(),
277
+ 'fs-configuration-myaccount',
278
+ 'flexible-shipping',
279
+ 'link',
280
+ 'user-site',
281
+ 'your-account'
282
+ );
283
+ $saas_platform_docs_url = $this->saas_platform_links->add_utm(
284
+ $this->saas_platform_links->get_docs(),
285
+ 'fs-configuration-howtostart',
286
+ 'flexible-shipping',
287
+ 'link',
288
+ 'user-site',
289
+ 'check-how-to-start-with-FS-Connect'
290
+ );
291
+ $saas_connected = $this->saas_connection->is_connected();
292
+ include 'views/html-field-saas-connection.php';
293
+ return ob_get_clean();
294
+ }
295
+
296
+
297
+ /**
298
+ * Generate settings HTML.
299
+ *
300
+ * @param array $form_fields Form fields.
301
+ * @param bool $echo Echo settings.
302
+ *
303
+ * @return string
304
+ * @throws Exception Exception.
305
+ */
306
+ public function generate_settings_html( $form_fields = array(), $echo = true ) {
307
+ ob_start();
308
+ $this->saas_connection->clear_saas_client_cache();
309
+ $html = parent::generate_settings_html( $form_fields, $echo );
310
+ $saas_connected = $this->saas_connection->is_connected();
311
+ $shipping_providers = $this->get_shipping_services_from_platform();
312
+ if ( 0 === count( $shipping_providers ) ) {
313
+ $saas_connected = false;
314
+ } else {
315
+ $this->update_all_shipping_services( $shipping_providers );
316
+ }
317
+ include 'views/html-settings-connect-script.php';
318
+ include 'views/html-shipping-method-info-description.php';
319
+ $html .= ob_get_clean();
320
+ if ( $echo ) {
321
+ echo $html;
322
+ } else {
323
+ return $html;
324
+ }
325
+ }
326
+
327
+ }
classes/saas/class-saas-shipment-auto-create.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Shipment_Auto_Create
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Shipment_Auto_Create {
7
+
8
+ /**
9
+ * Integration id.
10
+ *
11
+ * @var string
12
+ */
13
+ private $integration_id;
14
+
15
+ /**
16
+ * Shipping service.
17
+ *
18
+ * @var \WPDesk\SaasPlatformClient\Model\ShippingService
19
+ */
20
+ private $shipping_service;
21
+
22
+ /**
23
+ * Logger.
24
+ *
25
+ * @var \Psr\Log\LoggerInterface
26
+ */
27
+ private $logger;
28
+
29
+ /**
30
+ * WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Handler constructor.
31
+ *
32
+ * @param string $integration_id Integration id.
33
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
34
+ * @param \Psr\Log\LoggerInterface $logger Logger.
35
+ */
36
+ public function __construct( $integration_id, $shipping_service, $logger ) {
37
+ $this->integration_id = $integration_id;
38
+ $this->shipping_service = $shipping_service;
39
+ $this->logger = $logger;
40
+ }
41
+
42
+ /**
43
+ * Hooks.
44
+ */
45
+ public function hooks() {
46
+ add_action( 'woocommerce_order_status_changed', array( $this, 'handle_shipment_create' ), 10, 3 );
47
+ }
48
+
49
+ /**
50
+ * Handle shipment create.
51
+ *
52
+ * @param int $order_id Order ID.
53
+ * @param string $old_status Old status.
54
+ * @param string $new_status New status.
55
+ */
56
+ public function handle_shipment_create( $order_id, $old_status, $new_status ) {
57
+ if ( $this->shipping_service->is_auto_shipment_settings_auto_create() ) {
58
+ if ( $this->shipping_service->is_order_status_shipment_settings_order_status( $new_status ) ) {
59
+ $shipments = fs_get_order_shipments( $order_id, $this->integration_id );
60
+ foreach ( $shipments as $shipment ) {
61
+ if ( $shipment->is_status_fs_new() ) {
62
+ try {
63
+ $shipment->set_sent_via_auto();
64
+ $shipment->api_create();
65
+ } catch ( Exception $e ) {
66
+ $this->logger->error( "Auto creating shipment error {$e->getMessage()}; {$e->getCode()}" );
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ }
classes/saas/class-saas-shipment-order-auto-complete.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Shipment_Order_Auto_Complete
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Shipment_Order_Auto_Complete {
7
+
8
+ /**
9
+ * Integration id.
10
+ *
11
+ * @var string
12
+ */
13
+ private $integration_id;
14
+
15
+ /**
16
+ * Shipping service.
17
+ *
18
+ * @var \WPDesk\SaasPlatformClient\Model\ShippingService
19
+ */
20
+ private $shipping_service;
21
+
22
+ /**
23
+ * Logger.
24
+ *
25
+ * @var \Psr\Log\LoggerInterface
26
+ */
27
+ private $logger;
28
+
29
+ /**
30
+ * WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Handler constructor.
31
+ *
32
+ * @param string $integration_id Integration id.
33
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
34
+ * @param \Psr\Log\LoggerInterface $logger Logger.
35
+ */
36
+ public function __construct( $integration_id, $shipping_service, $logger ) {
37
+ $this->integration_id = $integration_id;
38
+ $this->shipping_service = $shipping_service;
39
+ $this->logger = $logger;
40
+ }
41
+
42
+ /**
43
+ * Hooks.
44
+ */
45
+ public function hooks() {
46
+ add_action( 'flexible_shipping_shipment_confirmed', array( $this, 'handle_complete_order' ) );
47
+ }
48
+
49
+ /**
50
+ * Handle complete order.
51
+ *
52
+ * @param WPDesk_Flexible_Shipping_Shipment $shipment Shipment.
53
+ */
54
+ public function handle_complete_order( WPDesk_Flexible_Shipping_Shipment $shipment ) {
55
+ if ( $this->integration_id === $shipment->get_meta( '_integration', '' ) ) {
56
+ if ( $this->shipping_service->is_shipment_settings_complete_order() ) {
57
+ $order = $shipment->get_order();
58
+ if ( ! $order->has_status( 'completed' ) ) {
59
+ $order->update_status( 'completed', __( 'Order status changed automatically by Flexible Shipping Plugin.', 'flexible-shipping' ) );
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+
66
+ }
classes/saas/class-saas-shipment-settings-field.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Field
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Field {
7
+
8
+ /**
9
+ * Saas field.
10
+ *
11
+ * @var array
12
+ */
13
+ private $saas_field;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_SaaS_Shipping_Settings_Field constructor.
17
+ *
18
+ * @param array $saas_field SaaS field.
19
+ */
20
+ public function __construct( array $saas_field ) {
21
+ $this->saas_field = $saas_field;
22
+ }
23
+
24
+ /**
25
+ * Add fields to settings.
26
+ *
27
+ * @param array $settings Settings.
28
+ *
29
+ * @return array
30
+ */
31
+ public function add_fields_to_settings( array $settings ) {
32
+ $order_statuses = wc_get_order_statuses();
33
+
34
+ $field_id = $this->saas_field['id'];
35
+
36
+ $settings[ $field_id . '_auto_create' ] = array(
37
+ 'title' => __( 'Create shipments', 'flexible-shipping' ),
38
+ 'type' => 'select',
39
+ 'class' => 'fs-settings-shipments',
40
+ 'default' => 'manual',
41
+ 'options' => array(
42
+ 'manual' => __( 'Manually', 'flexible-shipping' ),
43
+ 'auto' => __( 'Automatically', 'flexible-shipping' ),
44
+ ),
45
+ 'description' => __( 'Choose to create shipments manually or automatically based on the order status.', 'flexible-shipping' ),
46
+ 'desc_tip' => true,
47
+ );
48
+ $settings[ $field_id . '_order_status' ] = array(
49
+ 'title' => __( 'Order status', 'flexible-shipping' ),
50
+ 'type' => 'select',
51
+ 'class' => 'fs-settings-shipments',
52
+ 'default' => 'wc-completed',
53
+ 'options' => $order_statuses,
54
+ 'description' => __( 'Select order status for automatic shipment creation.', 'flexible-shipping' ),
55
+ 'desc_tip' => true,
56
+ );
57
+ $settings[ $field_id . '_complete_order' ] = array(
58
+ 'title' => __( 'Complete order', 'flexible-shipping' ),
59
+ 'type' => 'checkbox',
60
+ 'class' => 'fs-settings-shipments',
61
+ 'label' => __( 'Enable automatic order status change', 'flexible-shipping' ),
62
+ 'default' => 'no',
63
+ 'description' => __( 'Automatically change order status to completed after creating shipment.', 'flexible-shipping' ),
64
+ 'desc_tip' => true,
65
+ );
66
+
67
+ return $settings;
68
+ }
69
+
70
+ /**
71
+ * Add settings for platform.
72
+ *
73
+ * @param array $settings Settings.
74
+ * @param array $settings_for_platform Settings for platform.
75
+ *
76
+ * @return array
77
+ */
78
+ public function add_settings_for_platform( array $settings, array $settings_for_platform ) {
79
+ $field_id = $this->saas_field['id'];
80
+
81
+ $field_key = $field_id . '_auto_create';
82
+ $settings_for_platform[ $field_key ] = $settings[ $field_key ];
83
+
84
+ $field_key = $field_id . '_order_status';
85
+ $settings_for_platform[ $field_key ] = $settings[ $field_key ];
86
+
87
+ $field_key = $field_id . '_complete_order';
88
+ $settings_for_platform[ $field_key ] = $settings[ $field_key ];
89
+
90
+ return $settings_for_platform;
91
+ }
92
+
93
+ }
classes/saas/class-saas-shipping-method-integration-settings.php ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Shipping_Method_Integration_Settings
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Shipping_Method_Integration_Settings {
7
+
8
+ const TYPE_TEXT = 'text';
9
+ const TYPE_CHECKBOX = 'checkbox';
10
+ const TYPE_SELECT = 'select';
11
+ const TYPE_CUSTOM_SERVICES = 'custom_services';
12
+
13
+ const WOOCOMMERCE_SETTINGS_SHIPPING_URL = 'admin.php?page=wc-settings&tab=shipping';
14
+
15
+ /**
16
+ * SaaS connection.
17
+ *
18
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
19
+ */
20
+ private $saas_connection;
21
+
22
+ /**
23
+ * Shipping service.
24
+ *
25
+ * @var \WPDesk\SaasPlatformClient\Model\ShippingService
26
+ */
27
+ private $shipping_service;
28
+
29
+ /**
30
+ * Field name prefix.
31
+ *
32
+ * @var string
33
+ */
34
+ private $field_name_prefix;
35
+
36
+ /**
37
+ * Integration ID.
38
+ *
39
+ * @var string
40
+ */
41
+ private $integration_id;
42
+
43
+ /**
44
+ * Supported columns types.
45
+ *
46
+ * @var array
47
+ */
48
+ private $supported_columns_types;
49
+
50
+ /**
51
+ * Logger.
52
+ *
53
+ * @var \Psr\Log\LoggerInterface
54
+ */
55
+ private $logger;
56
+
57
+ /**
58
+ * Live rates handler.
59
+ *
60
+ * @var WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler
61
+ */
62
+ private $live_rates_handler;
63
+
64
+ /**
65
+ * Shipment auto create.
66
+ *
67
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipment_Auto_Create
68
+ */
69
+ private $shipment_auto_create;
70
+
71
+ /**
72
+ * Shipment Order auto complete.
73
+ *
74
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipment_Order_Auto_Complete
75
+ */
76
+ private $shipment_order_auto_complete;
77
+
78
+ /**
79
+ * WPDesk_Flexible_Shipping_SaaS_Shipping_Method_Integration_Settings constructor.
80
+ *
81
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
82
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS Connection.
83
+ * @param \Psr\Log\LoggerInterface $logger Logger.
84
+ */
85
+ public function __construct( $shipping_service, $saas_connection, \Psr\Log\LoggerInterface $logger = null ) {
86
+ $this->shipping_service = $shipping_service;
87
+ $this->saas_connection = $saas_connection;
88
+ $this->integration_id = $shipping_service->get_integration_id();
89
+ $this->field_name_prefix = $this->integration_id . '_';
90
+
91
+ $this->supported_columns_types = array( self::TYPE_TEXT, self::TYPE_CHECKBOX, self::TYPE_SELECT, self::TYPE_CUSTOM_SERVICES );
92
+
93
+ if ( $shipping_service->supports( 'supportsShipmentLiveRates' ) ) {
94
+ $this->live_rates_handler = new WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler(
95
+ $this->integration_id,
96
+ $shipping_service,
97
+ $saas_connection,
98
+ $logger
99
+ );
100
+ }
101
+
102
+ $this->shipment_auto_create = new WPDesk_Flexible_Shipping_SaaS_Shipment_Auto_Create(
103
+ $this->integration_id,
104
+ $shipping_service,
105
+ $logger
106
+ );
107
+
108
+ $this->shipment_order_auto_complete = new WPDesk_Flexible_Shipping_SaaS_Shipment_Order_Auto_Complete(
109
+ $this->integration_id,
110
+ $shipping_service,
111
+ $logger
112
+ );
113
+
114
+ $this->logger = $logger;
115
+ }
116
+
117
+ /**
118
+ * Hooks.
119
+ */
120
+ public function hooks() {
121
+ add_filter( 'flexible_shipping_integration_options', array( $this, 'add_shipping_integrations_options' ) );
122
+
123
+ add_filter( 'flexible_shipping_method_settings', array( $this, 'get_settings_for_flexible_shipping_method' ), 10, 2 );
124
+
125
+ add_action( 'flexible_shipping_method_script', array( $this, 'add_flexible_shipping_integration_script' ) );
126
+
127
+ add_filter( 'flexible_shipping_process_admin_options', array( $this, 'process_flexible_shipping_integration_options' ), 10, 1 );
128
+
129
+ add_filter( 'flexible_shipping_method_integration_col', array( $this, 'show_integration_in_flexible_shipping_integration_col' ), 10, 2 );
130
+
131
+ if ( isset( $this->live_rates_handler ) ) {
132
+ $this->live_rates_handler->hooks();
133
+ }
134
+
135
+ $this->shipment_auto_create->hooks();
136
+
137
+ $this->shipment_order_auto_complete->hooks();
138
+ }
139
+
140
+ /**
141
+ * Add shipping integrations
142
+ *
143
+ * @param array $options Options.
144
+ *
145
+ * @return array
146
+ */
147
+ public function add_shipping_integrations_options( array $options ) {
148
+ $options[ $this->integration_id ] = $this->shipping_service->get_name();
149
+ return $options;
150
+ }
151
+
152
+ /**
153
+ * Add CSS class to fields.
154
+ *
155
+ * @param array $settings Settings.
156
+ *
157
+ * @return array
158
+ */
159
+ private function add_css_class_to_settings_fields( array $settings ) {
160
+ foreach ( $settings as $field_key => $field ) {
161
+ $settings[ $field_key ]['class'] = empty( $settings[ $field_key ]['class'] ) ? '' : $settings[ $field_key ]['class'] . ' ';
162
+ $settings[ $field_key ]['class'] .= $this->integration_id;
163
+ }
164
+ return $settings;
165
+ }
166
+
167
+ /**
168
+ * Add CSS class to fields.
169
+ *
170
+ * @param array $settings Settings.
171
+ *
172
+ * @return array
173
+ */
174
+ private function remove_required_attribute_from_settings_fields( array $settings ) {
175
+ foreach ( $settings as $field_key => $field ) {
176
+ $custom_attributes_key = 'custom_attributes';
177
+ $custom_attributes = isset( $field[ $custom_attributes_key ] ) ? $field[ $custom_attributes_key ] : array();
178
+ if ( isset( $custom_attributes['required'] ) ) {
179
+ unset( $custom_attributes['required'] );
180
+ }
181
+ $settings[ $field_key ][ $custom_attributes_key ] = $custom_attributes;
182
+ }
183
+ return $settings;
184
+ }
185
+
186
+ /**
187
+ * Setup shipping integrations settings values.
188
+ *
189
+ * @param array $settings Settings fields.
190
+ * @param array $shipping_method Shipping method.
191
+ *
192
+ * @return array
193
+ */
194
+ private function setup_settings_values( array $settings, array $shipping_method ) {
195
+ foreach ( $settings as $field_key => $field ) {
196
+ if ( isset( $shipping_method[ $field_key ] ) ) {
197
+ $settings[ $field_key ]['default'] = $shipping_method[ $field_key ];
198
+ }
199
+ }
200
+ return $settings;
201
+ }
202
+
203
+ /**
204
+ * Setup shipping integrations custom services values.
205
+ *
206
+ * @param array $settings Settings fields.
207
+ * @param array $shipping_method Shipping method.
208
+ *
209
+ * @return array
210
+ */
211
+ private function setup_custom_services( array $settings, array $shipping_method ) {
212
+ foreach ( $settings as $field_key => $field ) {
213
+ if ( self::TYPE_CUSTOM_SERVICES === $settings[ $field_key ]['type'] ) {
214
+ $custom_services_settings = new WPDesk_Flexible_Shipping_SaaS_Custom_Services_Settings(
215
+ $settings[ $field_key ],
216
+ isset( $shipping_method[ $field_key ] ) ? $shipping_method[ $field_key ] : array()
217
+ );
218
+ $settings[ $field_key ]['services'] = $custom_services_settings->setup_custom_services();
219
+ }
220
+ }
221
+ return $settings;
222
+ }
223
+
224
+ /**
225
+ * Get settings for shipping method instance.
226
+ *
227
+ * @param int $shiping_method_instance_id Shipping method instance ID.
228
+ *
229
+ * @return array
230
+ */
231
+ private function get_settings_for_shipping_method_instance( $shiping_method_instance_id ) {
232
+ $shipping_zone = WC_Shipping_Zones::get_zone_by( 'instance_id', $shiping_method_instance_id );
233
+
234
+ $shipping_zone_data_extractor = new WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor( $shipping_zone );
235
+
236
+ $countries = $shipping_zone_data_extractor->get_countries();
237
+
238
+ $settings = $this->shipping_service->prepare_flexible_shipping_integration_settings_fields( $this->field_name_prefix, $countries );
239
+
240
+ return $settings;
241
+ }
242
+
243
+
244
+ /**
245
+ * Get settings for flexible shipping method.
246
+ *
247
+ * @param array $flexible_shipping_settings Flexible Shipping settings.
248
+ * @param array $shipping_method Shipping method.
249
+ *
250
+ * @return array
251
+ */
252
+ public function get_settings_for_flexible_shipping_method( array $flexible_shipping_settings, array $shipping_method ) {
253
+ try {
254
+ $settings = $this->get_settings_for_shipping_method_instance( intval( $shipping_method['woocommerce_method_instance_id'] ) );
255
+ $settings = $this->remove_required_attribute_from_settings_fields( $settings );
256
+ $settings = $this->setup_settings_values( $settings, $shipping_method );
257
+ $settings = $this->setup_custom_services( $settings, $shipping_method );
258
+ } catch ( WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found $e ) {
259
+ $settings = array(
260
+ $this->field_name_prefix . '_error' => array(
261
+ 'type' => 'saas_connection_error',
262
+ 'description' => $this->shipping_service->prepare_settings_not_found_message(),
263
+ 'class' => 'flexible_shipping_saas_connection_error',
264
+ ),
265
+ );
266
+ } catch ( Exception $e ) {
267
+ $settings = array(
268
+ $this->field_name_prefix . '_error' => array(
269
+ 'type' => 'saas_connection_error',
270
+ 'description' => $this->saas_connection->prepare_fatal_error_notice(),
271
+ 'class' => 'flexible_shipping_saas_connection_error',
272
+ ),
273
+ );
274
+ }
275
+ $settings = $this->add_css_class_to_settings_fields( $settings );
276
+ return array_merge( $flexible_shipping_settings, $settings );
277
+ }
278
+
279
+ /**
280
+ * Add Flexible Shipping integration script.
281
+ */
282
+ public function add_flexible_shipping_integration_script() {
283
+ ?>
284
+ <script type="text/javascript">
285
+ jQuery(document).ready(function() {
286
+ jQuery('#woocommerce_flexible_shipping_method_integration').change(function() {
287
+ flexible_shipping_saas_integration_options('<?php echo $this->integration_id; ?>');
288
+ });
289
+ flexible_shipping_saas_integration_options('<?php echo $this->integration_id; ?>');
290
+ });
291
+ </script>
292
+ <?php
293
+ }
294
+
295
+ /**
296
+ * Process Flexible Shipping integration options.
297
+ *
298
+ * @param array $shipping_method_options Shipping method options.
299
+ *
300
+ * @return mixed
301
+ */
302
+ public function process_flexible_shipping_integration_options( array $shipping_method_options ) {
303
+ try {
304
+ $settings = $this->get_settings_for_shipping_method_instance( intval( $shipping_method_options['woocommerce_method_instance_id'] ) );
305
+ foreach ( $settings as $field_key => $field ) {
306
+ $post_field_name = 'woocommerce_flexible_shipping_' . $field_key;
307
+ $field_value = '';
308
+ $field_type = $field['type'];
309
+ if ( self::TYPE_CHECKBOX === $field_type ) {
310
+ $field_value = '0';
311
+ }
312
+ if ( isset( $_POST[ $post_field_name ] ) ) {
313
+ $field_post_value = $_POST[ $post_field_name ];
314
+ if ( in_array( $field_type, $this->supported_columns_types, true ) ) {
315
+ if ( self::TYPE_CUSTOM_SERVICES === $field_type ) {
316
+ $custom_services_settings = new WPDesk_Flexible_Shipping_SaaS_Custom_Services_Settings(
317
+ $field_post_value,
318
+ array()
319
+ );
320
+
321
+ $field_value = $custom_services_settings->process_custom_services_field( $field_post_value );
322
+ } else {
323
+ $field_value = sanitize_text_field( $field_post_value );
324
+ if ( self::TYPE_CHECKBOX === $field_type ) {
325
+ if ( '1' === $field_value ) {
326
+ $field_value = 'yes';
327
+ }
328
+ }
329
+ }
330
+ }
331
+ }
332
+ $shipping_method_options[ $field_key ] = $field_value;
333
+ }
334
+ } catch ( Exception $e ) {
335
+ $this->saas_connection->add_notice_fatal_error();
336
+ do_action( 'admin_notices' );
337
+ }
338
+ return $shipping_method_options;
339
+ }
340
+
341
+ /**
342
+ * Show integration name in Flexible Shipping integration column.
343
+ *
344
+ * @param string $col Col value.
345
+ * @param array $shipping_method Shipping method.
346
+ *
347
+ * @return string
348
+ */
349
+ public function show_integration_in_flexible_shipping_integration_col( $col, array $shipping_method ) {
350
+ if ( isset( $shipping_method['method_integration'] ) && $this->integration_id === $shipping_method['method_integration'] ) {
351
+ $col = sprintf( '<td width="1%%" class="integration default"><span>%1$s</span></td>', $this->shipping_service->get_name() );
352
+ }
353
+ return $col;
354
+ }
355
+
356
+
357
+ }
classes/saas/class-saas-shipping-service-settings.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Integration settings in WooCommerce settings tab.
5
+ *
6
+ * Class WPDesk_Flexible_Shipping_SaaS_Shipping_Method
7
+ */
8
+ class WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings extends WC_Shipping_Method implements WPDesk_Flexible_Shipping_Saas_Connection_Aware {
9
+
10
+ const OPTION_SHIPPING_METHOD_TYPE = 'fs_method_instance_type_';
11
+
12
+ /**
13
+ * Settings already saved.
14
+ *
15
+ * @var bool
16
+ */
17
+ private static $settings_saved = false;
18
+
19
+ /**
20
+ * Shipping methods manager.
21
+ *
22
+ * @var WPDesk_Flexible_Shipping_SaaS_Services_Manager
23
+ */
24
+ private $shipping_methods_manager;
25
+
26
+ /**
27
+ * Saas connection.
28
+ *
29
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
30
+ */
31
+ private $saas_connection = null;
32
+
33
+ /**
34
+ * Shipping method has settings in SaaS?
35
+ *
36
+ * @var bool
37
+ */
38
+ private $has_saas_settings = false;
39
+
40
+ /**
41
+ * Shipping service id.
42
+ *
43
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service
44
+ */
45
+ private $shipping_service;
46
+
47
+ /**
48
+ * Save settings error.
49
+ *
50
+ * @var bool
51
+ */
52
+ private $save_settings_error = false;
53
+
54
+ /**
55
+ * WPDesk_Flexible_Shipping_Connect constructor.
56
+ *
57
+ * @param int $instance_id Instance id.
58
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
59
+ */
60
+ public function __construct(
61
+ $instance_id = 0,
62
+ WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service = null
63
+ ) {
64
+ parent::__construct( $instance_id );
65
+
66
+ if ( ! empty( $shipping_service ) ) {
67
+ $this->shipping_service = $shipping_service;
68
+
69
+ $this->id = $this->shipping_service->get_integration_id();
70
+ $this->method_title = $shipping_service->get_name();
71
+ $this->title = $shipping_service->get_name();
72
+ $this->method_description = $shipping_service->get_description();
73
+
74
+ add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
75
+
76
+ } else {
77
+ $this->title = $this->get_option( 'title' );
78
+ $parent_shipping_method = $this->get_parent_method();
79
+ if ( ! empty( $parent_shipping_method ) ) {
80
+ $this->shipping_service = $parent_shipping_method->get_shipping_service();
81
+ $this->method_description = $parent_shipping_method->method_description;
82
+ $this->id = $this->shipping_service->get_integration_id();
83
+
84
+ $this->instance_form_fields['title']['default'] = $parent_shipping_method->method_title;
85
+ $this->method_title = $parent_shipping_method->method_title;
86
+ }
87
+ }
88
+
89
+ $this->enabled = 'no';
90
+
91
+ $this->supports = array(
92
+ 'settings',
93
+ 'flexible-shipping',
94
+ );
95
+
96
+ $this->init();
97
+
98
+ }
99
+
100
+ /**
101
+ * Set shipping methods manager.
102
+ *
103
+ * @param WPDesk_Flexible_Shipping_SaaS_Services_Manager $shipping_methods_manager Shipping methods manager.
104
+ */
105
+ public function set_shipping_methods_manager( $shipping_methods_manager ) {
106
+ $this->shipping_methods_manager = $shipping_methods_manager;
107
+ }
108
+
109
+ /**
110
+ * Set SaaS Connection.
111
+ *
112
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS connection.
113
+ */
114
+ public function set_saas_connection( $saas_connection ) {
115
+ $this->saas_connection = $saas_connection;
116
+ $this->init();
117
+ }
118
+
119
+ /**
120
+ * Get has saas settings.
121
+ *
122
+ * @return bool
123
+ */
124
+ public function get_has_saas_settings() {
125
+ return $this->has_saas_settings;
126
+ }
127
+
128
+ /**
129
+ * Display admin error messages.
130
+ */
131
+ public function display_errors() {
132
+ if ( $this->get_errors() ) {
133
+ echo '<div id="notice-error" class="error notice is-dismissible">';
134
+ foreach ( $this->get_errors() as $error ) {
135
+ echo '<p>' . wp_kses_post( $error ) . '</p>';
136
+ }
137
+ echo '</div>';
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Generate settings HTML.
143
+ *
144
+ * @param array $form_fields Form fields.
145
+ * @param bool $echo Echo.
146
+ *
147
+ * @return string
148
+ * @throws RuntimeException Exception.
149
+ */
150
+ public function generate_settings_html( $form_fields = array(), $echo = true ) {
151
+ if ( 0 === $this->instance_id ) {
152
+ $this->init_settings();
153
+ if ( ! $this->save_settings_error ) {
154
+ try {
155
+ $this->saas_connection->clear_saas_client_cache();
156
+ $platform = $this->saas_connection->get_platform();
157
+ $shipping_service_settings = $platform->requestGetSettings( $this->get_shipping_service_id() );
158
+ if ( $shipping_service_settings->isNotExists() ) {
159
+ $this->settings = array( '' => '' );
160
+ } elseif ( $shipping_service_settings->isError() ) {
161
+ throw new RuntimeException( $shipping_service_settings->getResponseCode() );
162
+ } else {
163
+ $this->settings = $this->cast_settings_types( $shipping_service_settings->getSetting()->getJsonValue() );
164
+ $country_state_field = WPDesk_Flexible_Shipping_SaaS_Country_State_Field::create_from_settings( $this->settings );
165
+
166
+ $this->settings[ WPDesk_Flexible_Shipping_SaaS_Country_State_Field::COUNTRY_STATE_CODE_FIELD ] = $country_state_field->get_as_single_field();
167
+
168
+ $this->has_saas_settings = true;
169
+ }
170
+ } catch ( Exception $e ) {
171
+ $this->saas_connection->check_connection_and_show_notice_on_error();
172
+ add_action( 'admin_notices', [ $this, 'hide_save_changes_button_on_connection_error' ] );
173
+ return '';
174
+ }
175
+ }
176
+ }
177
+ return parent::generate_settings_html( $form_fields, $echo );
178
+ }
179
+
180
+ /**
181
+ * Admin notices.
182
+ */
183
+ public function hide_save_changes_button_on_connection_error() {
184
+ ?>
185
+ <style>
186
+ p.submit {
187
+ display: none;
188
+ }
189
+ </style>
190
+ <?php
191
+ }
192
+
193
+ /**
194
+ * Get not empty array.
195
+ *
196
+ * @return array
197
+ */
198
+ private function create_not_empty_array() {
199
+ return array( '' );
200
+ }
201
+
202
+ /**
203
+ * Admin notices.
204
+ */
205
+ public function admin_notices() {
206
+ ?>
207
+ <script type="text/javascript">
208
+ jQuery(document).ready(function () {
209
+ jQuery('#message').remove();
210
+ })
211
+ </script>
212
+ <style>
213
+ #message {
214
+ display: none;
215
+ }
216
+ </style>
217
+ <?php
218
+ }
219
+
220
+ /**
221
+ * Save settings fields to platform.
222
+ *
223
+ * @param array $settings Settings.
224
+ *
225
+ * @return mixed
226
+ */
227
+ private function save_settings_fields_to_platform( array $settings ) {
228
+ $this->saas_connection->clear_saas_client_cache();
229
+ $platform = $this->saas_connection->get_platform();
230
+
231
+ $settings_for_platform = $this->shipping_service->prepare_settings_for_platform( $settings );
232
+
233
+ if ( getenv( 'SAAS_FLEXIBLESHIPPING_URL' ) ) {
234
+ $settings_for_platform['production'] = false;
235
+ }
236
+ if ( defined( 'SAAS_FLEXIBLESHIPPING_URL' ) ) {
237
+ $settings_for_platform['production'] = false;
238
+ }
239
+
240
+ $shipping_service_settings = new \WPDesk\SaasPlatformClient\Model\ShippingServiceSetting();
241
+ $shipping_service_settings->setJsonValue( $this->shipping_service->cast_raw_service_settings_to_valid_types( $settings_for_platform ) );
242
+ $shipping_service_settings->setShippingService( $this->shipping_service->get_id() );
243
+ $response = $platform->requestSaveSettings( $shipping_service_settings );
244
+
245
+ if ( $response->isBadRequest() ) {
246
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
247
+ $error_message = __( 'Invalid format - contact with flexibleshipping.com administrator.', 'flexible-shipping' );
248
+ new \WPDesk\Notice\Notice( $error_message, 'error' );
249
+ $this->save_settings_error = true;
250
+ } elseif ( $response->isError() ) {
251
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
252
+ $error_message = sprintf(
253
+ // Translators: response code.
254
+ __( 'Ups, something is wrong. Error code: %1$s.', 'flexible-shipping' ),
255
+ $response->getResponseCode()
256
+ );
257
+ new \WPDesk\Notice\Notice( $error_message, 'error' );
258
+ $this->save_settings_error = true;
259
+ }
260
+ return $settings;
261
+ }
262
+
263
+ /**
264
+ * Process admin options.
265
+ *
266
+ * @return bool
267
+ */
268
+ public function process_admin_options() {
269
+ $process_admin_options_return = parent::process_admin_options();
270
+ if ( 0 === $this->instance_id ) {
271
+ if ( false === self::$settings_saved ) {
272
+ self::$settings_saved = true;
273
+ $this->save_settings_fields_to_platform( $this->settings );
274
+ }
275
+ }
276
+
277
+ return $process_admin_options_return;
278
+ }
279
+
280
+
281
+ /**
282
+ * Get shipping service id.
283
+ *
284
+ * @return int
285
+ */
286
+ public function get_shipping_service_id() {
287
+ return $this->shipping_service->get_id();
288
+ }
289
+
290
+ /**
291
+ * Get shipping service.
292
+ *
293
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Service
294
+ */
295
+ public function get_shipping_service() {
296
+ return $this->shipping_service;
297
+ }
298
+
299
+ /**
300
+ * Init user set variables.
301
+ */
302
+ public function init() {
303
+ $this->init_form_fields();
304
+ }
305
+
306
+ /**
307
+ * Get parent method instance id.
308
+ *
309
+ * @return bool|string
310
+ */
311
+ private function get_parent_method_type() {
312
+ return get_option( self::OPTION_SHIPPING_METHOD_TYPE . $this->instance_id, false );
313
+ }
314
+
315
+ /**
316
+ * Get parent method.
317
+ *
318
+ * @return null|WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings
319
+ */
320
+ private function get_parent_method() {
321
+ $shipping_methods = WC()->shipping()->get_shipping_methods();
322
+ /**
323
+ * IDE type hint.
324
+ *
325
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings $shipping_method
326
+ */
327
+ $shipping_method = null;
328
+ if ( isset( $shipping_methods[ $this->get_parent_method_type() ] ) ) {
329
+ $shipping_method = $shipping_methods[ $this->get_parent_method_type() ];
330
+ }
331
+ return $shipping_method;
332
+ }
333
+
334
+ /**
335
+ * In settings screen?
336
+ *
337
+ * @return bool
338
+ */
339
+ public function is_in_settings() {
340
+ if ( function_exists( 'get_current_screen' ) ) {
341
+ $current_screen = get_current_screen();
342
+ if ( isset( $current_screen ) ) {
343
+ $section_parameter = 'section';
344
+ if ( 'woocommerce_page_wc-settings' === $current_screen->id
345
+ && isset( $_GET[ $section_parameter ] )
346
+ && $this->id === $_GET[ $section_parameter ]
347
+ ) {
348
+ return true;
349
+ }
350
+ }
351
+ }
352
+
353
+ return false;
354
+ }
355
+
356
+ /**
357
+ * Init form fields.
358
+ */
359
+ public function init_form_fields() {
360
+ if ( ! empty( $this->shipping_service ) ) {
361
+ $this->form_fields = $this->shipping_service->prepare_shipping_method_settings_fields();
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Generate Connection Status HTML.
367
+ *
368
+ * @param string $key Field key.
369
+ * @param array $data Field data.
370
+
371
+ * @return string
372
+ */
373
+ public function generate_connection_status_html( $key, $data ) {
374
+ $status_field = new WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field( $this );
375
+ return $status_field->generate_html( $key, $data );
376
+ }
377
+
378
+ /**
379
+ * Prepare country state options.
380
+ *
381
+ * @return array
382
+ */
383
+ private function prepare_country_state_options() {
384
+ $countries = WC()->countries->get_countries();
385
+ $options = array();
386
+ foreach ( $countries as $country_key => $country ) {
387
+ $states = WC()->countries->get_states( $country_key );
388
+ if ( $states ) {
389
+ foreach ( $states as $state_key => $state ) {
390
+ $options[ $country_key . ':' . $state_key ] = $country . ' &mdash; ' . $state;
391
+ }
392
+ } else {
393
+ $options[ $country_key ] = $country;
394
+ }
395
+ }
396
+ return $options;
397
+ }
398
+
399
+ /**
400
+ * Generate select country state HTML.
401
+ *
402
+ * @param string $key Field key.
403
+ * @param array $data Field data.
404
+ *
405
+ * @return string
406
+ */
407
+ public function generate_select_country_state_html( $key, array $data ) {
408
+ $data['options'] = $this->prepare_country_state_options();
409
+ $class = isset( $data['class'] ) ? $data['class'] . ' ' : '';
410
+ $class .= 'fs_select2';
411
+ $data['class'] = $class;
412
+ return $this->generate_select_html( $key, $data );
413
+ }
414
+
415
+ /**
416
+ * Cast settings types.
417
+ *
418
+ * @param array $settings Settings.
419
+ *
420
+ * @return array
421
+ */
422
+ private function cast_settings_types( $settings ) {
423
+ foreach ( $settings as $key => $value ) {
424
+ if ( is_bool( $value ) ) {
425
+ if ( $value ) {
426
+ $settings[ $key ] = 'yes';
427
+ } else {
428
+ $settings[ $key ] = 'no';
429
+ }
430
+ }
431
+ }
432
+ return $settings;
433
+ }
434
+
435
+ /**
436
+ * Is connected.
437
+ *
438
+ * @return bool
439
+ */
440
+ private function is_connected() {
441
+ return $this->saas_connection->is_connected();
442
+ }
443
+
444
+ }
445
+
classes/saas/class-saas-shipping-service.php ADDED
@@ -0,0 +1,764 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_Shipping_Service' ) ) {
8
+
9
+ /**
10
+ * Class WPDesk_Flexible_Shipping_SaaS_Shipping_Service
11
+ */
12
+ class WPDesk_Flexible_Shipping_SaaS_Shipping_Service {
13
+
14
+ const INTEGRATION_PREFIX = 'flexible_shipping_saas_';
15
+
16
+ const FIELD_TYPE_CONNECTION_STATUS = 'connection_status';
17
+
18
+ const FIELD_TITLE = 'title';
19
+ const FIELD_LABEL = 'label';
20
+ const FIELD_DESC = 'desc';
21
+ const FIELD_DESCRIPTION = 'description';
22
+ const FIELD_TOOLTIP = 'tooltip';
23
+ const FIELD_DESC_TIP = 'desc_tip';
24
+ const FIELD_CUSTOM_ATTRIBUTES = 'custom_attributes';
25
+ const FIELD_TYPE = 'type';
26
+ const FIELD_REQUIRED = 'required';
27
+ const FIELD_SELECT_ADDITIONAL = 'select-additional';
28
+ const FIELD_OPTIONS = 'options';
29
+
30
+ const TYPE_TEXT = 'text';
31
+ const TYPE_CHECKBOX = 'checkbox';
32
+ const TYPE_SELECT = 'select';
33
+ const TYPE_CUSTOM_SERVICES = 'custom_services';
34
+
35
+ const WOOCOMMERCE_SETTINGS_SHIPPING_URL = 'admin.php?page=wc-settings&tab=shipping';
36
+
37
+ /**
38
+ * SaaS connection.
39
+ *
40
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
41
+ */
42
+ private $saas_connection;
43
+
44
+ /**
45
+ * ID.
46
+ *
47
+ * @var int
48
+ */
49
+ private $id;
50
+
51
+ /**
52
+ * Name.
53
+ *
54
+ * @var string
55
+ */
56
+ private $name;
57
+
58
+ /**
59
+ * Description.
60
+ *
61
+ * @var string
62
+ */
63
+ private $description;
64
+
65
+ /**
66
+ * Promoted.
67
+ *
68
+ * @var bool
69
+ */
70
+ private $promoted;
71
+
72
+ /**
73
+ * Settings fields.
74
+ *
75
+ * @var array
76
+ */
77
+ private $settings_fields;
78
+
79
+ /**
80
+ * Definition of return values generated by settings.
81
+ *
82
+ * @var array
83
+ */
84
+ private $settings_fields_values;
85
+
86
+ /**
87
+ * Definition of request fields.
88
+ *
89
+ * @var array
90
+ */
91
+ private $request_fields;
92
+
93
+ /**
94
+ * Capabilities.
95
+ *
96
+ * @var array
97
+ */
98
+ private $capabilities;
99
+
100
+ /**
101
+ * Shipping method.
102
+ *
103
+ * @var null|WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings
104
+ */
105
+ private $shipping_method = null;
106
+
107
+ /**
108
+ * Links.
109
+ *
110
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
111
+ */
112
+ private $saas_platform_links;
113
+
114
+ /**
115
+ * Integration id.
116
+ *
117
+ * @var string
118
+ */
119
+ private $integration_id;
120
+
121
+ /**
122
+ * WPDesk_Flexible_Shipping_SaaS_Shipping_Service constructor.
123
+ *
124
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection Saas connection.
125
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Links.
126
+ * @param int $id Service ID.
127
+ * @param string $name Service Name.
128
+ * @param string $description Service description.
129
+ * @param bool $promoted Promoted.
130
+ * @param array $settings_fields Settings fields.
131
+ * @param array $settings_fields_values Definition of return values generated by settings.
132
+ * @param array $request_fields Request fields.
133
+ * @param array $capabilities Capabilities.
134
+ */
135
+ public function __construct(
136
+ WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection,
137
+ WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links,
138
+ $id,
139
+ $name,
140
+ $description,
141
+ $promoted,
142
+ array $settings_fields = array(),
143
+ $settings_fields_values = array(),
144
+ $request_fields = array(),
145
+ $capabilities = array()
146
+ ) {
147
+ $this->saas_connection = $saas_connection;
148
+ $this->saas_platform_links = $saas_platform_links;
149
+ $this->id = $id;
150
+ $this->name = $name;
151
+ $this->description = $description;
152
+ $this->promoted = $promoted;
153
+ $this->settings_fields = $settings_fields;
154
+ $this->settings_fields_values = $settings_fields_values;
155
+ $this->request_fields = $request_fields;
156
+ $this->capabilities = $capabilities;
157
+
158
+ $this->integration_id = self::INTEGRATION_PREFIX . $id;
159
+ }
160
+
161
+ /**
162
+ * Static creator form \WPDesk\SaasPlatformClient\Model\ShippingService.
163
+ *
164
+ * @param \WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS connection.
165
+ * @param \WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Links.
166
+ * @param \WPDesk\SaasPlatformClient\Model\ShippingService $platform_service Service from platform.
167
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Service
168
+ */
169
+ public static function create_from_platform_service(
170
+ \WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection,
171
+ \WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links,
172
+ \WPDesk\SaasPlatformClient\Model\ShippingService $platform_service
173
+ ) {
174
+ return new self(
175
+ $saas_connection,
176
+ $saas_platform_links,
177
+ $platform_service->getId(),
178
+ $platform_service->getName(),
179
+ $platform_service->getDescription(),
180
+ $platform_service->getPromoted(),
181
+ $platform_service->getConnectionSettingsDefinitionJson(),
182
+ $platform_service->getConnectionSettingsValuesJsonSchema(),
183
+ $platform_service->getRequestFieldsDefinitionJson(),
184
+ $platform_service->getCapabilitiesJson()
185
+ );
186
+ }
187
+
188
+ /**
189
+ * Get ID.
190
+ *
191
+ * @return int
192
+ */
193
+ public function get_id() {
194
+ return $this->id;
195
+ }
196
+
197
+ /**
198
+ * Get name.
199
+ *
200
+ * @return string
201
+ */
202
+ public function get_name() {
203
+ return $this->name;
204
+ }
205
+
206
+ /**
207
+ * Get description.
208
+ *
209
+ * @return string
210
+ */
211
+ public function get_description() {
212
+ return $this->description;
213
+ }
214
+
215
+ /**
216
+ * Get promoted.
217
+ *
218
+ * @return bool
219
+ */
220
+ public function get_promoted() {
221
+ return $this->promoted;
222
+ }
223
+
224
+ /**
225
+ * Get settings fields.
226
+ *
227
+ * @return array
228
+ */
229
+ public function get_settings_fields() {
230
+ return $this->settings_fields;
231
+ }
232
+
233
+ /**
234
+ * Get settings fields values.
235
+ *
236
+ * @return array
237
+ */
238
+ public function get_settings_fields_values() {
239
+ return $this->settings_fields_values;
240
+ }
241
+
242
+ /**
243
+ * Get request fields.
244
+ *
245
+ * @return array
246
+ */
247
+ public function get_request_fields() {
248
+ return $this->request_fields;
249
+ }
250
+
251
+ /**
252
+ * Get capabilities.
253
+ *
254
+ * @return array
255
+ */
256
+ public function get_capabilities() {
257
+ return $this->capabilities;
258
+ }
259
+
260
+ /**
261
+ * Get integration id.
262
+ *
263
+ * @return string
264
+ */
265
+ public function get_integration_id() {
266
+ return $this->integration_id;
267
+ }
268
+
269
+ /**
270
+ * Is capability?
271
+ *
272
+ * @param string $capability_name Capability name.
273
+ *
274
+ * @return bool
275
+ */
276
+ public function supports( $capability_name ) {
277
+ $capability = $this->get_capability( $capability_name );
278
+ if ( isset( $this->capabilities[ $capability_name ] ) && $this->capabilities[ $capability_name ] ) {
279
+ return true;
280
+ }
281
+ return false;
282
+ }
283
+
284
+ /**
285
+ * Get capability.
286
+ *
287
+ * @param string $capability_name Capability name.
288
+ *
289
+ * @return string|null
290
+ */
291
+ public function get_capability( $capability_name ) {
292
+ if ( isset( $this->capabilities[ $capability_name ] ) ) {
293
+ return $this->capabilities[ $capability_name ];
294
+ }
295
+ return null;
296
+ }
297
+
298
+ /**
299
+ * Prapare section heading field.
300
+ *
301
+ * @param array $section Section.
302
+ *
303
+ * @return array
304
+ */
305
+ private function prepare_section_heading_field( array $section ) {
306
+ $section_heading = array(
307
+ self::FIELD_TYPE => 'title',
308
+ 'title' => $section['title'],
309
+ );
310
+ if ( isset( $section[ self::FIELD_DESCRIPTION ] ) ) {
311
+ $section_heading['description'] = $section[ self::FIELD_DESCRIPTION ];
312
+ }
313
+
314
+ return $section_heading;
315
+ }
316
+
317
+ /**
318
+ * Prepare default field value.
319
+ *
320
+ * @param array $field Field from SaaS platform.
321
+ * @param array $settings_field WooCommerce settings field.
322
+ *
323
+ * @return array
324
+ */
325
+ private function prepare_default_field_value( array $field, array $settings_field ) {
326
+ if ( isset( $field['default'] ) ) {
327
+ $settings_field['default'] = $field['default'];
328
+ }
329
+ $default_woocommerce_id = 'default-woocommerce';
330
+ if ( isset( $field[ $default_woocommerce_id ] ) ) {
331
+ if ( ! isset( $settings_field['default'] ) ) {
332
+ $settings_field['default'] = get_option( $field[ $default_woocommerce_id ], '' );
333
+ }
334
+ }
335
+ $deafault_commpute = 'default-compute';
336
+ if ( isset( $field[ $deafault_commpute ] ) ) {
337
+ if ( ! isset( $settings_field['default'] ) ) {
338
+ $default_compute_handler = new WPDesk_Flexible_Shipping_SaaS_Default_Value_Compute_Handler( $field[ $deafault_commpute ] );
339
+ $settings_field['default'] = $default_compute_handler->compute();
340
+ }
341
+ }
342
+ return $settings_field;
343
+ }
344
+
345
+ /**
346
+ * Prepare settings field select options.
347
+ *
348
+ * @param array $field Field.
349
+ * @param array $settings_field Settings field.
350
+ *
351
+ * @return mixed
352
+ */
353
+ private function prepare_field_select_options( array $field, array $settings_field ) {
354
+ if ( self::TYPE_SELECT === $field[ self::FIELD_TYPE ] || self::TYPE_CUSTOM_SERVICES === $field[ self::FIELD_TYPE ] ) {
355
+ if ( isset( $field[ self::FIELD_SELECT_ADDITIONAL ] ) && isset( $field[ self::FIELD_SELECT_ADDITIONAL ][ self::FIELD_OPTIONS ] ) ) {
356
+ $options = array();
357
+ foreach ( $field[ self::FIELD_SELECT_ADDITIONAL ][ self::FIELD_OPTIONS ] as $option ) {
358
+ if ( ! empty( $option['value'] ) || ! empty( $option['text'] ) ) {
359
+ $options[ $option['value'] ] = $option['text'];
360
+ }
361
+ }
362
+ $settings_field[ self::FIELD_OPTIONS ] = $options;
363
+ }
364
+ }
365
+ return $settings_field;
366
+ }
367
+
368
+ /**
369
+ * Prepare settings field custom services options.
370
+ *
371
+ * @param array $field Field.
372
+ * @param array $settings_field Settings field.
373
+ *
374
+ * @return mixed
375
+ */
376
+ private function prepare_field_custom_services_options( array $field, array $settings_field ) {
377
+ if ( self::TYPE_SELECT === $field[ self::FIELD_TYPE ] || self::TYPE_CUSTOM_SERVICES === $field[ self::FIELD_TYPE ] ) {
378
+ if ( isset( $field[ self::FIELD_SELECT_ADDITIONAL ] ) && isset( $field[ self::FIELD_SELECT_ADDITIONAL ][ self::FIELD_OPTIONS ] ) ) {
379
+ $services = array();
380
+ foreach ( $field[ self::FIELD_SELECT_ADDITIONAL ][ self::FIELD_OPTIONS ] as $option ) {
381
+ if ( ! empty( $option['value'] ) || ! empty( $option['text'] ) ) {
382
+ $services[ $option['value'] ] = array( 'name' => $option['text'] );
383
+ }
384
+ }
385
+ $settings_field['services'] = $services;
386
+ }
387
+ }
388
+ return $settings_field;
389
+ }
390
+
391
+ /**
392
+ * Prepare settings field description.
393
+ *
394
+ * @param array $field Field.
395
+ * @param array $settings_field Settings field.
396
+ *
397
+ * @return mixed
398
+ */
399
+ private function prepare_field_description( array $field, array $settings_field ) {
400
+ if ( isset( $field[ self::FIELD_DESC ] ) ) {
401
+ $settings_field[ self::FIELD_DESCRIPTION ] = do_shortcode( $field[ self::FIELD_DESC ] );
402
+ }
403
+ if ( isset( $field[ self::FIELD_TOOLTIP ] ) && is_array( $field[ self::FIELD_TOOLTIP ] ) ) {
404
+ $settings_field[ self::FIELD_DESCRIPTION ] = do_shortcode( $field[ self::FIELD_TOOLTIP ][ self::FIELD_DESCRIPTION ] );
405
+ $settings_field[ self::FIELD_DESC_TIP ] = true;
406
+ }
407
+ return $settings_field;
408
+ }
409
+
410
+ /**
411
+ * Prepare setting field.
412
+ *
413
+ * @param array $field Field.
414
+ *
415
+ * @return array
416
+ */
417
+ private function prepare_setting_field( array $field ) {
418
+ $settings_field = array(
419
+ self::FIELD_TYPE => $field[ self::FIELD_TYPE ],
420
+ self::FIELD_TITLE => do_shortcode( $field['name'] ),
421
+ self::FIELD_CUSTOM_ATTRIBUTES => array(),
422
+ );
423
+ if ( isset( $field[ self::FIELD_LABEL ] ) ) {
424
+ $settings_field[ self::FIELD_LABEL ] = $field[ self::FIELD_LABEL ];
425
+ }
426
+ if ( 'password' === $field[ self::FIELD_TYPE ] ) {
427
+ $settings_field[ self::FIELD_CUSTOM_ATTRIBUTES ]['autocomplete'] = 'new-password';
428
+ }
429
+ if ( self::TYPE_CHECKBOX !== $field[ self::FIELD_TYPE ] && self::TYPE_SELECT !== $field[ self::FIELD_TYPE ]
430
+ && isset( $field[ self::FIELD_REQUIRED ] ) && $field[ self::FIELD_REQUIRED ]
431
+ ) {
432
+ $settings_field[ self::FIELD_CUSTOM_ATTRIBUTES ][ self::FIELD_REQUIRED ] = self::FIELD_REQUIRED;
433
+ }
434
+ if ( self::TYPE_CUSTOM_SERVICES === $field[ self::FIELD_TYPE ] ) {
435
+ $settings_field = $this->prepare_field_custom_services_options( $field, $settings_field );
436
+ }
437
+ $settings_field = $this->prepare_default_field_value( $field, $settings_field );
438
+ $settings_field = $this->prepare_field_select_options( $field, $settings_field );
439
+ $settings_field = $this->prepare_field_description( $field, $settings_field );
440
+ return $settings_field;
441
+ }
442
+
443
+
444
+ /**
445
+ * Prepare settings for platform.
446
+ *
447
+ * @param array $settings Settings.
448
+ *
449
+ * @return array
450
+ */
451
+ public function prepare_settings_for_platform( array $settings ) {
452
+ $settings_for_platform = array();
453
+ foreach ( $this->settings_fields as $section ) {
454
+ foreach ( $section['fields'] as $field ) {
455
+ $field_id = $field['id'];
456
+ if ( isset( $field[ self::FIELD_TYPE ] ) && self::FIELD_TYPE_CONNECTION_STATUS !== $field[ self::FIELD_TYPE ] ) {
457
+ if ( isset( $settings[ $field_id ] ) ) {
458
+ $settings_for_platform[ $field_id ] = $settings[ $field_id ];
459
+ } else {
460
+ $settings_for_platform[ $field_id ] = '';
461
+ }
462
+ if ( self::TYPE_CHECKBOX === $field[ self::FIELD_TYPE ] ) {
463
+ $settings_for_platform[ $field_id ] = 'yes' === $settings[ $field_id ];
464
+ }
465
+ if ( 'shipment_settings' === $field[ self::FIELD_TYPE ] ) {
466
+ $shipment_settings = new WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Field( $field );
467
+
468
+ $settings_for_platform = $shipment_settings->add_settings_for_platform( $settings, $settings_for_platform );
469
+ }
470
+ }
471
+ }
472
+ }
473
+ $country_state_field = WPDesk_Flexible_Shipping_SaaS_Country_State_Field::create_from_serialized_settings( $settings );
474
+ $settings_for_platform = array_merge( $settings_for_platform, $country_state_field->get_as_array() );
475
+ return $settings_for_platform;
476
+ }
477
+
478
+ /**
479
+ * Prepare woocommerce settings fields from fields.
480
+ *
481
+ * @param array $fields Fields.
482
+ *
483
+ * @return array
484
+ */
485
+ private function prepare_woocommerce_settings_fields_from_fields( array $fields ) {
486
+ $settings_fields = array();
487
+ foreach ( $fields as $section ) {
488
+ $settings_fields[] = $this->prepare_section_heading_field( $section );
489
+ foreach ( $section['fields'] as $field ) {
490
+ if ( 'shipment_settings' === $field[ self::FIELD_TYPE ] ) {
491
+ $shipment_settings_field = new WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Field( $field );
492
+
493
+ $settings_fields = $shipment_settings_field->add_fields_to_settings( $settings_fields );
494
+ } else {
495
+ $settings_fields[ $field['id'] ] = $this->prepare_setting_field( $field );
496
+ }
497
+ }
498
+ }
499
+ return $settings_fields;
500
+ }
501
+
502
+ /**
503
+ * Get shipping method settings fields.
504
+ *
505
+ * @return array
506
+ */
507
+ public function prepare_shipping_method_settings_fields() {
508
+ return $this->prepare_woocommerce_settings_fields_from_fields( $this->settings_fields );
509
+ }
510
+
511
+ /**
512
+ * Set css class on field.
513
+ *
514
+ * @param array $field Settings field.
515
+ * @param array $show_in Show in.
516
+ *
517
+ * @return array
518
+ */
519
+ private function set_css_class_on_field( array $field, array $show_in ) {
520
+ if ( ! isset( $field['class'] ) ) {
521
+ $field['class'] = '';
522
+ }
523
+ if ( in_array( 'method', $show_in, true ) ) {
524
+ $field['class'] .= ' fs-method';
525
+ }
526
+ if ( in_array( 'live', $show_in, true ) ) {
527
+ $field['class'] .= ' fs-live';
528
+ }
529
+ return $field;
530
+ }
531
+
532
+ /**
533
+ * Prepare rates type field.
534
+ *
535
+ * @return array
536
+ */
537
+ private function prepare_rates_type_field() {
538
+ $rates_type_field = array(
539
+ 'title' => __( 'Rates type', 'flexible-shipping' ),
540
+ 'type' => self::TYPE_SELECT,
541
+ 'class' => 'fs-rates-type fs-method fs-live',
542
+ 'options' => array(
543
+ 'custom' => __( 'Custom', 'flexible-shipping' ),
544
+ ),
545
+ // Translators: service name.
546
+ 'description' => sprintf( __(
547
+ 'Choose custom rates to set a custom shipping cost (this method will be the selected %1$s service). Choose live rates if you want to present services and rates for the customer\'s address.',
548
+ 'flexible-shipping'
549
+ ), $this->get_name() ),
550
+ 'desc_tip' => true,
551
+ );
552
+ if ( $this->supports( 'supportsShipmentLiveRates' ) ) {
553
+ $rates_type_field['options'] = array(
554
+ 'live' => __( 'Live', 'flexible-shipping' ),
555
+ 'custom' => __( 'Custom', 'flexible-shipping' ),
556
+ );
557
+ $rates_type_field['default'] = 'live';
558
+ }
559
+ return $rates_type_field;
560
+ }
561
+
562
+ /**
563
+ * Prepare custom services field.
564
+ *
565
+ * @param string $field_id Field Id.
566
+ * @param array $field Field.
567
+ * @param array $show_in Show in.
568
+ *
569
+ * @return array
570
+ */
571
+ private function prepare_custom_services_field( $field_id, $field, $show_in ) {
572
+ $custom_services = array(
573
+ 'title' => __( 'Custom services', 'flexible-shipping' ),
574
+ self::FIELD_TYPE => self::TYPE_CHECKBOX,
575
+ self::FIELD_DESC_TIP => true,
576
+ self::FIELD_DESCRIPTION => $field[ self::FIELD_TOOLTIP ][ self::FIELD_DESCRIPTION ],
577
+ 'label' => __( 'Enable services custom settings', 'flexible-shipping' ),
578
+ );
579
+ $custom_services = $this->set_css_class_on_field( $custom_services, $show_in );
580
+
581
+ $custom_services['custom_attributes'] = array( 'data-dependent-field-id' => 'woocommerce_flexible_shipping_' . $field_id );
582
+
583
+ $custom_services = $this->prepare_default_field_value( $field, $custom_services );
584
+
585
+ return $custom_services;
586
+ }
587
+
588
+ /**
589
+ * Prepare FS integration settings fields.
590
+ *
591
+ * @param string $field_name_prefix Field name prefix.
592
+ * @param array $zone_targets Zone targets.
593
+ * @return array
594
+ */
595
+ public function prepare_flexible_shipping_integration_settings_fields( $field_name_prefix, array $zone_targets ) {
596
+ $settings = array( $field_name_prefix . 'rates_type' => $this->prepare_rates_type_field() );
597
+ $fields = $this->get_fields_for_targets( $zone_targets );
598
+ foreach ( $fields as $section ) {
599
+ if ( in_array( 'method', $section['show-in'], true ) || in_array( 'live', $section['show-in'], true ) ) {
600
+ foreach ( $section['fields'] as $field ) {
601
+ $field_id = $field_name_prefix . $field['id'];
602
+ if ( self::TYPE_CUSTOM_SERVICES === $field['type'] ) {
603
+ $field_id = $field_id . '_custom_services';
604
+ $settings[ $field_name_prefix . self::TYPE_CUSTOM_SERVICES ] = $this->prepare_custom_services_field(
605
+ $field_id,
606
+ $field,
607
+ $section['show-in']
608
+ );
609
+ }
610
+ $settings_field = $this->prepare_setting_field( $field );
611
+ $settings_field = $this->set_css_class_on_field( $settings_field, $section['show-in'] );
612
+
613
+ $settings[ $field_id ] = $settings_field;
614
+ }
615
+ }
616
+ }
617
+ if ( $this->supports( 'supportsShipmentLiveRates' ) ) {
618
+ $settings_field = array(
619
+ 'title' => __( 'Fallback', 'flexible-shipping' ),
620
+ 'label' => __( 'Enable fallback', 'flexible-shipping' ),
621
+ 'type' => 'checkbox',
622
+ 'description' => __( 'Enable to offer flat rate cost for shipping so that the user can still checkout, if API returns no matching rates.', 'flexible-shipping' ),
623
+ 'desc_tip' => true,
624
+ 'custom_attributes' => array(
625
+ 'data-dependent-row-class' => 'flexible_shipping_method_rules',
626
+ 'data-dependent-field-id' => 'woocommerce_flexible_shipping_method_calculation_method',
627
+ ),
628
+ );
629
+ $settings_field = $this->set_css_class_on_field( $settings_field, array( 'live' ) );
630
+
631
+ $settings[ $field_name_prefix . 'fallback' ] = $settings_field;
632
+ }
633
+ return $settings;
634
+ }
635
+
636
+
637
+ /**
638
+ * Cast raw service settings to valid types.
639
+ *
640
+ * @param array $settings Settings values.
641
+ *
642
+ * @return array Settings values with casting.
643
+ */
644
+ public function cast_raw_service_settings_to_valid_types( array $settings ) {
645
+ foreach ( $this->settings_fields_values['properties'] as $key => $type ) {
646
+ if ( 'integer' === $type[ self::FIELD_TYPE ] ) {
647
+ $settings[ $key ] = (int) $settings[ $key ];
648
+ }
649
+ }
650
+ return $settings;
651
+ }
652
+
653
+ /**
654
+ * Get fields for zone targets.
655
+ *
656
+ * @param array $zone_targets Target countries.
657
+ *
658
+ * @return array
659
+ * @throws WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception Exception.
660
+ * @throws WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found Exception.
661
+ * @throws WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception Exception.
662
+ */
663
+ public function get_fields_for_targets( array $zone_targets ) {
664
+ $platform = $this->saas_connection->get_platform();
665
+ $fields_response = $platform->requestGetFields( $this->get_id(), $zone_targets );
666
+ if ( $fields_response->isBadCredentials() ) {
667
+ throw new WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception( $this->saas_platform_links );
668
+ } elseif ( $fields_response->isMaintenance() ) {
669
+ throw new WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception( $fields_response );
670
+ } elseif ( $fields_response->isNotExists() ) {
671
+ throw new WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found();
672
+ }
673
+ return $fields_response->getFields();
674
+ }
675
+
676
+ /**
677
+ * Set shipping method.
678
+ *
679
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings $shipping_method Shipping method.
680
+ */
681
+ public function set_shipping_method( WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings $shipping_method ) {
682
+ $this->shipping_method = $shipping_method;
683
+ }
684
+
685
+ /**
686
+ * Get option from shiping method.
687
+ *
688
+ * @param string $option_name Option name.
689
+ *
690
+ * @return string
691
+ */
692
+ public function get_option_from_shipping_method( $option_name ) {
693
+ $option_value = '';
694
+ if ( ! empty( $this->shipping_method ) ) {
695
+ return $this->shipping_method->get_option( $option_name, '' );
696
+ }
697
+ return $option_value;
698
+ }
699
+
700
+ /**
701
+ * Is auto selected in shipment_settings_auto_create option?
702
+ *
703
+ * @return bool
704
+ */
705
+ public function is_auto_shipment_settings_auto_create() {
706
+ return 'auto' === $this->get_option_from_shipping_method( 'shipment_settings_auto_create' );
707
+ }
708
+
709
+ /**
710
+ * Is manual selected in shipment_settings_auto_create option?
711
+ *
712
+ * @return bool
713
+ */
714
+ public function is_manual_shipment_settings_auto_create() {
715
+ return 'manual' === $this->get_option_from_shipping_method( 'shipment_settings_auto_create' );
716
+ }
717
+
718
+ /**
719
+ * Is order status set in shipment_settings_order_status option?
720
+ *
721
+ * @param string $order_status Order status.
722
+ *
723
+ * @return bool
724
+ */
725
+ public function is_order_status_shipment_settings_order_status( $order_status ) {
726
+ return 'wc-' . $order_status === $this->get_option_from_shipping_method( 'shipment_settings_order_status' );
727
+ }
728
+
729
+ /**
730
+ * Is shipment_settings_complete_order option checked?
731
+ *
732
+ * @return bool
733
+ */
734
+ public function is_shipment_settings_complete_order() {
735
+ return 'yes' === $this->get_option_from_shipping_method( 'shipment_settings_complete_order' );
736
+ }
737
+
738
+ /**
739
+ * Get settings URL.
740
+ *
741
+ * @return string
742
+ */
743
+ public function get_settings_url() {
744
+ return admin_url( self::WOOCOMMERCE_SETTINGS_SHIPPING_URL . '&section=' . $this->integration_id );
745
+ }
746
+
747
+ /**
748
+ * Prepare settings not found message.
749
+ *
750
+ * @return string
751
+ */
752
+ public function prepare_settings_not_found_message() {
753
+ return sprintf(
754
+ // Translators: links to settings.
755
+ __( 'You need to configure the service. %1$sGo to %2$s settings.%3$s', 'flexible-shipping' ),
756
+ '<a href="' . $this->get_settings_url() . '"">',
757
+ $this->get_name(),
758
+ '</a>'
759
+ );
760
+ }
761
+
762
+ }
763
+
764
+ }
classes/saas/class-saas-shipping-services-manager.php ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Shipping_Methods_Manager
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Services_Manager
7
+ implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant
8
+ {
9
+
10
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
11
+
12
+ const OPTION_ALL_SHIPPING_SERVICES = 'fs_saas_all_shipping_servicess';
13
+ const OPTION_ENABLED_SHIPPING_SERVICES = 'fs_saas_enabled_shipping_services';
14
+
15
+ const PARAMETER_SETTINGS_UPDATED = 'settings-updated';
16
+ const PARAMETER_SETTINGS_UPDATED_VALUE = 'flexible-shipping';
17
+
18
+ const LOGGER_SOURCE = 'saas-methods-manager';
19
+
20
+
21
+ /**
22
+ * SaaS connection.
23
+ *
24
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
25
+ */
26
+ private $saas_connection;
27
+
28
+ /**
29
+ * Flexible Shipping Connect shipping method.
30
+ *
31
+ * @var WPDesk_Flexible_Shipping_SaaS_Settings
32
+ */
33
+ private $shipping_method_connect = null;
34
+
35
+ /**
36
+ * SaaS shipping methods.
37
+ *
38
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings[]
39
+ */
40
+ private $saas_shipping_methods = array();
41
+
42
+ /**
43
+ * SaaS shipping services.
44
+ *
45
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service[]
46
+ */
47
+ private $saas_shipping_services = array();
48
+
49
+ /**
50
+ * Require UK states - there is enabled shipping method with requireUKStates capability.
51
+ *
52
+ * @var bool
53
+ */
54
+ private $require_uk_states = false;
55
+
56
+ /**
57
+ * Links.
58
+ *
59
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
60
+ */
61
+ private $saas_platform_links;
62
+
63
+ /**
64
+ * Logger.
65
+ *
66
+ * @var \Psr\Log\LoggerInterface
67
+ */
68
+ private $logger;
69
+
70
+ /**
71
+ * WPDesk_Flexible_Shipping_Services constructor.
72
+ *
73
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection Connection.
74
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Links.
75
+ * @param \Psr\Log\LoggerInterface $logger Logger.
76
+ */
77
+ public function __construct(
78
+ WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection,
79
+ WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links,
80
+ \Psr\Log\LoggerInterface $logger = null
81
+ ) {
82
+ $this->saas_connection = $saas_connection;
83
+ if ( null !== $logger ) {
84
+ $this->logger = $logger;
85
+ } else {
86
+ $this->logger = WPDesk_Flexible_Shipping_Logger_Factory::create_logger();
87
+ }
88
+
89
+ $this->saas_platform_links = $saas_platform_links;
90
+
91
+ $this->create_saas_shipping_methods();
92
+ }
93
+
94
+ /**
95
+ * Hooks.
96
+ */
97
+ public function hooks() {
98
+ add_filter( 'woocommerce_shipping_methods',
99
+ array( $this, 'add_flexible_shipping_connect_shipping_method' )
100
+ );
101
+ add_filter( 'woocommerce_shipping_methods', array( $this, 'add_shipping_methods_for_shipping_services' ) );
102
+
103
+ add_filter( 'woocommerce_shipping_zone_shipping_methods',
104
+ array( $this, 'inject_saas_connection_to_shipping_methods' )
105
+ );
106
+
107
+ add_action( 'woocommerce_shipping_zone_method_added', array( $this, 'set_shipping_method_type' ), 10, 3 );
108
+ add_action( 'woocommerce_shipping_zone_method_deleted', array( $this, 'delete_shipping_method_type' ), 10,
109
+ 3
110
+ );
111
+
112
+ add_action( 'current_screen', array( $this, 'clear_cache_at_settings_page' ) );
113
+ add_action( 'current_screen', array( $this, 'handle_settings_updated_notice' ) );
114
+
115
+ add_filter( 'flexible_shipping_shipment_class', array( $this, 'flexible_shipping_shipment_class' ), 10, 2 );
116
+
117
+ }
118
+
119
+ /**
120
+ * Flexible Shipping shipment class for SaaS integration
121
+ *
122
+ * @param string $class_name Class name.
123
+ * @param string $integration Integration.
124
+ *
125
+ * @return string
126
+ */
127
+ public function flexible_shipping_shipment_class( $class_name, $integration ) {
128
+ if ( isset( $this->saas_shipping_methods[ $integration ] ) ) {
129
+ return WPDesk_Flexible_Shipping_Shipment_Saas::class;
130
+ }
131
+
132
+ return $class_name;
133
+ }
134
+
135
+ /**
136
+ * Handle settings updated notice.
137
+ *
138
+ * @param WP_Screen $current_screen Current screen.
139
+ */
140
+ public function handle_settings_updated_notice( $current_screen ) {
141
+ if ( $this->is_in_shipping_settings( $current_screen ) ) {
142
+ if ( isset( $_GET[ self::PARAMETER_SETTINGS_UPDATED ] )
143
+ && $_GET[ self::PARAMETER_SETTINGS_UPDATED ] == self::PARAMETER_SETTINGS_UPDATED_VALUE
144
+ ) {
145
+ new \WPDesk\Notice\Notice(
146
+ // Translators: strong tag.
147
+ sprintf( __( '%1$sYour settings have been saved.%2$s', 'flexible-shipping' ), '<strong>',
148
+ '</strong>'
149
+ ),
150
+ 'updated'
151
+ );
152
+ }
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Create shipping method.
158
+ *
159
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
160
+ *
161
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings
162
+ */
163
+ private function create_shipping_method( $shipping_service ) {
164
+ $shipping_method = new WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings( 0, $shipping_service );
165
+ $shipping_method->set_saas_connection( $this->saas_connection );
166
+ $shipping_method->set_shipping_methods_manager( $this );
167
+ $shipping_service->set_shipping_method( $shipping_method );
168
+
169
+ return $shipping_method;
170
+ }
171
+
172
+ /**
173
+ * Inject SaaS connection to shipping methods.
174
+ *
175
+ * @param array $shipping_methods Shipping methods.
176
+ *
177
+ * @return mixed
178
+ */
179
+ public function inject_saas_connection_to_shipping_methods( array $shipping_methods ) {
180
+ foreach ( $shipping_methods as $shipping_method_key => $shipping_method ) {
181
+ if ( $shipping_method instanceof WPDesk_Flexible_Shipping_Saas_Connection_Aware ) {
182
+ $shipping_method->set_saas_connection( $this->saas_connection );
183
+ $shipping_method->set_shipping_methods_manager( $this );
184
+ }
185
+ }
186
+
187
+ return $shipping_methods;
188
+ }
189
+
190
+ /**
191
+ * Create shipping method integration settings.
192
+ *
193
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
194
+ *
195
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Method_Integration_Settings
196
+ */
197
+ private function create_shipping_method_integration_settings( $shipping_service ) {
198
+ $integration_settings = new WPDesk_Flexible_Shipping_SaaS_Shipping_Method_Integration_Settings( $shipping_service, $this->saas_connection, $this->logger );
199
+ $integration_settings->hooks();
200
+
201
+ return $integration_settings;
202
+ }
203
+
204
+ /**
205
+ * Create shipping method integration settings.
206
+ *
207
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $shipping_service Shipping service.
208
+ *
209
+ * @return WPDesk_Flexible_Shipping_SaaS_Add_Shipping_Handler
210
+ */
211
+ private function create_add_shipping_options_handler( $shipping_service ) {
212
+ return new WPDesk_Flexible_Shipping_SaaS_Add_Shipping_Handler( $shipping_service );
213
+ }
214
+
215
+ /**
216
+ * Create shipping service.
217
+ *
218
+ * @param array $shipping_service_data Shipping service data.
219
+ *
220
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Service
221
+ */
222
+ private function create_shipping_service( array $shipping_service_data ) {
223
+ if ( empty( $shipping_service_data['settings_fields'] ) ) {
224
+ $shipping_service_data['settings_fields'] = array();
225
+ }
226
+ if ( empty( $shipping_service_data['settings_fields_values'] ) ) {
227
+ $shipping_service_data['settings_fields_values'] = array();
228
+ }
229
+ if ( empty( $shipping_service_data['request_fields'] ) ) {
230
+ $shipping_service_data['request_fields'] = array();
231
+ }
232
+ if ( empty( $shipping_service_data['capabilities'] ) ) {
233
+ $shipping_service_data['capabilities'] = array();
234
+ }
235
+ if ( empty( $shipping_service_data['promoted'] ) ) {
236
+ $shipping_service_data['promoted'] = false;
237
+ }
238
+
239
+ return new WPDesk_Flexible_Shipping_SaaS_Shipping_Service(
240
+ $this->saas_connection,
241
+ $this->saas_platform_links,
242
+ $shipping_service_data['id'],
243
+ $shipping_service_data['name'],
244
+ $shipping_service_data['description'],
245
+ $shipping_service_data['promoted'],
246
+ $shipping_service_data['settings_fields'],
247
+ $shipping_service_data['settings_fields_values'],
248
+ $shipping_service_data['request_fields'],
249
+ $shipping_service_data['capabilities']
250
+ );
251
+ }
252
+
253
+ /**
254
+ * Create shipping methods.
255
+ */
256
+ private function create_saas_shipping_methods() {
257
+ if ( $this->saas_connection->is_connected() ) {
258
+
259
+ $all_services = $this->get_all_services();
260
+ $enabled_services = $this->get_enabled_services();
261
+ try {
262
+ foreach ( $all_services as $service_id => $shipping_service_data ) {
263
+ $shipping_service = $this->create_shipping_service( $shipping_service_data );
264
+
265
+ $this->saas_shipping_services[ $service_id ] = $shipping_service;
266
+ if ( in_array( $service_id, $enabled_services, true ) ) {
267
+ $shipping_method = $this->create_shipping_method( $shipping_service );
268
+
269
+ $this->saas_shipping_methods[ $shipping_method->id ] = $shipping_method;
270
+
271
+ $this->create_shipping_method_integration_settings( $shipping_service );
272
+
273
+ $shipping_options_handler = $this->create_add_shipping_options_handler( $shipping_service );
274
+ $shipping_options_handler->hooks();
275
+
276
+ if ( $shipping_service->supports( 'requireUKStates' ) ) {
277
+ $this->require_uk_states = true;
278
+ }
279
+ }
280
+ }
281
+ } catch ( Exception $e ) {
282
+ $this->logger->debug( "create_saas_shipping_methods method exception: {$e->getMessage()} code: {$e->getCode()}",
283
+ [
284
+ 'exception' => $e,
285
+ ]
286
+ );
287
+ }
288
+ }
289
+ }
290
+
291
+ /**
292
+ * In settings screen?
293
+ *
294
+ * @param WP_Screen $current_screen Current screen.
295
+ *
296
+ * @return bool
297
+ */
298
+ private function is_in_shipping_settings( $current_screen = null ) {
299
+ if ( ! isset( $current_screen ) ) {
300
+ if ( function_exists( 'get_current_screen' ) ) {
301
+ $current_screen = get_current_screen();
302
+ }
303
+ }
304
+ if ( isset( $current_screen ) ) {
305
+ $tab_parameter = 'tab';
306
+ if ( 'woocommerce_page_wc-settings' === $current_screen->id
307
+ && isset( $_GET[ $tab_parameter ] )
308
+ && 'shipping' === $_GET[ $tab_parameter ]
309
+ ) {
310
+ return true;
311
+ }
312
+ }
313
+
314
+ return false;
315
+ }
316
+
317
+ /**
318
+ * Clear SaaS Cache on shipping settings pages.
319
+ *
320
+ * @param WP_Screen $current_screen Current screen.
321
+ */
322
+ public function clear_cache_at_settings_page( $current_screen ) {
323
+ if ( $this->is_in_shipping_settings( $current_screen ) ) {
324
+ $this->saas_connection->clear_saas_client_cache();
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Set shipping method type - fired on woocommerce_shipping_zone_method_added action.
330
+ *
331
+ * @param int $instance_id Instance ID.
332
+ * @param string $type Type.
333
+ * @param int $zone_id Zone ID.
334
+ */
335
+ public function set_shipping_method_type( $instance_id, $type, $zone_id ) {
336
+ update_option( WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings::OPTION_SHIPPING_METHOD_TYPE . $instance_id,
337
+ $type
338
+ );
339
+ }
340
+
341
+ /**
342
+ * Delete shipping method type - fired on woocommerce_shipping_zone_method_deleted action.
343
+ *
344
+ * @param int $instance_id Instance ID.
345
+ * @param int $method_id Method ID.
346
+ * @param int $zone_id Zone ID.
347
+ */
348
+ public function delete_shipping_method_type( $instance_id, $method_id, $zone_id ) {
349
+ delete_option( WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings::OPTION_SHIPPING_METHOD_TYPE . $instance_id );
350
+ }
351
+
352
+ /**
353
+ * Add flexible shipping connect shipping method to woocommerce shipping methods.
354
+ *
355
+ * @param array $methods Methods.
356
+ *
357
+ * @return array
358
+ */
359
+ public function add_flexible_shipping_connect_shipping_method( $methods ) {
360
+ if ( null === $this->shipping_method_connect ) {
361
+ $this->shipping_method_connect = new WPDesk_Flexible_Shipping_SaaS_Settings(
362
+ 0,
363
+ $this->saas_connection,
364
+ $this->saas_platform_links
365
+ );
366
+ $this->shipping_method_connect->set_shipping_methods_manager( $this );
367
+ }
368
+ $methods[ WPDesk_Flexible_Shipping_SaaS_Settings::METHOD_ID ] = $this->shipping_method_connect;
369
+
370
+ return $methods;
371
+ }
372
+
373
+ /**
374
+ * Add shipping methods for shipping services.
375
+ *
376
+ * @param array $methods Methods.
377
+ *
378
+ * @return mixed
379
+ */
380
+ public function add_shipping_methods_for_shipping_services( $methods ) {
381
+ foreach ( $this->saas_shipping_methods as $method_id => $shipping_method ) {
382
+ $methods[ $method_id ] = $shipping_method;
383
+ }
384
+
385
+ return $methods;
386
+ }
387
+
388
+ /**
389
+ * Update all shipping services.
390
+ *
391
+ * @param array $shipping_services All shipping services.
392
+ */
393
+ public function update_all_shipping_services( array $shipping_services ) {
394
+ $all_shipping_services = array();
395
+ /**
396
+ * IDE type hint.
397
+ *
398
+ * @var \WPDesk\SaasPlatformClient\Model\ShippingService $service
399
+ */
400
+ foreach ( $shipping_services as $service ) {
401
+ $all_shipping_services[ $service->getId() ] = array(
402
+ 'id' => $service->getId(),
403
+ 'name' => $service->getName(),
404
+ 'description' => $service->getDescription(),
405
+ 'promoted' => $service->getPromoted(),
406
+ 'logo_url' => $service->getLogoUrl(),
407
+ 'settings_fields' => $service->getConnectionSettingsDefinitionJson(),
408
+ 'settings_fields_values' => $service->getConnectionSettingsValuesJsonSchema(),
409
+ 'request_fields' => $service->getRequestFieldsDefinitionJson(),
410
+ 'capabilities' => $service->getCapabilitiesJson(),
411
+ );
412
+ }
413
+ update_option( self::OPTION_ALL_SHIPPING_SERVICES, $all_shipping_services );
414
+ }
415
+
416
+ /**
417
+ * Update enabled shipping services.
418
+ *
419
+ * @param array $enabled_shipping_services Enabled shipping services.
420
+ */
421
+ public function update_enabled_shipping_services( array $enabled_shipping_services = array() ) {
422
+ update_option( self::OPTION_ENABLED_SHIPPING_SERVICES, $enabled_shipping_services );
423
+ }
424
+
425
+ /**
426
+ * Get require uk states.
427
+ *
428
+ * @return bool
429
+ */
430
+ public function is_require_uk_states() {
431
+ return $this->require_uk_states;
432
+ }
433
+
434
+ /**
435
+ * Get all services.
436
+ *
437
+ * @return array
438
+ */
439
+ public function get_all_services() {
440
+ return get_option( self::OPTION_ALL_SHIPPING_SERVICES, array() );
441
+ }
442
+
443
+ /**
444
+ * Get enabled services.
445
+ *
446
+ * @return array
447
+ */
448
+ public function get_enabled_services() {
449
+ return get_option( self::OPTION_ENABLED_SHIPPING_SERVICES, array() );
450
+ }
451
+
452
+ /**
453
+ * Get SaaS shipping service.
454
+ *
455
+ * @param int $service_id Service Id.
456
+ *
457
+ * @return null|WPDesk_Flexible_Shipping_SaaS_Shipping_Service
458
+ */
459
+ public function get_saas_shiping_service( $service_id ) {
460
+ return isset( $this->saas_shipping_services[ $service_id ] ) ? $this->saas_shipping_services[ $service_id ] : null;
461
+ }
462
+
463
+ /**
464
+ * Is enabled SaaS service.
465
+ *
466
+ * @param int $service_id Service Id.
467
+ *
468
+ * @return bool
469
+ */
470
+ public function is_enabled_saas_service( $service_id ) {
471
+ $enabled_services = $this->get_enabled_services();
472
+ return isset( $enabled_services[ $service_id ] );
473
+ }
474
+
475
+ }
classes/saas/class-saas-shipping-services.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_Shipping_Services' ) ) {
8
+
9
+ /**
10
+ * Class WPDesk_Flexible_Shipping_SaaS_Shipping_Services
11
+ */
12
+ class WPDesk_Flexible_Shipping_SaaS_Shipping_Services {
13
+
14
+ const SHIPPING_SERVICE_FIELD_PREFIX = 'shipping_service_';
15
+
16
+ /**
17
+ * Saas connection.
18
+ *
19
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
20
+ */
21
+ private $saas_connection;
22
+
23
+ /**
24
+ * Logger.
25
+ *
26
+ * @var \Psr\Log\LoggerInterface
27
+ */
28
+ private $logger;
29
+
30
+ /**
31
+ * Links.
32
+ *
33
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
34
+ */
35
+ private $saas_platform_links;
36
+
37
+ /**
38
+ * WPDesk_Flexible_Shipping_SaaS_Shipping_Services constructor.
39
+ *
40
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection Saas connection.
41
+ * @param \Psr\Log\LoggerInterface $logger Logger.
42
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Links.
43
+ */
44
+ public function __construct(
45
+ $saas_connection,
46
+ \Psr\Log\LoggerInterface $logger,
47
+ WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links
48
+ ) {
49
+ $this->saas_connection = $saas_connection;
50
+ $this->logger = $logger;
51
+ $this->saas_platform_links = $saas_platform_links;
52
+ }
53
+
54
+ /**
55
+ * Get platform.
56
+ *
57
+ * @return \WPDesk\SaasPlatformClient\Platform
58
+ */
59
+ private function get_platform() {
60
+ return $this->saas_connection->get_platform();
61
+ }
62
+
63
+ /**
64
+ * Add shipping service checkbox to settings.
65
+ *
66
+ * @param array $settings Settings.
67
+ * @param \WPDesk\SaasPlatformClient\Model\ShippingService $shipping_service Shipping service.
68
+ *
69
+ * @return array
70
+ */
71
+ private function add_shipping_service_checkbox_to_settings(
72
+ array $settings,
73
+ \WPDesk\SaasPlatformClient\Model\ShippingService $shipping_service
74
+ ) {
75
+ $settings[ self::SHIPPING_SERVICE_FIELD_PREFIX . $shipping_service->getId() ] = [
76
+ 'class' => 'flexible-shipping-saas-shipping-service',
77
+ 'title' => $shipping_service->getName(),
78
+ 'description' => $shipping_service->getDescription(),
79
+ 'type' => 'checkbox',
80
+ 'custom_attributes' => array(
81
+ 'data-shipping_service_id' => esc_attr( $shipping_service->getId() ),
82
+ 'data-shipping_service_name' => esc_attr( $shipping_service->getName() ),
83
+ ),
84
+ ];
85
+
86
+ return $settings;
87
+ }
88
+
89
+ /**
90
+ * Add shipping services checkboxes to settings.
91
+ *
92
+ * @param array $settings Settings.
93
+ *
94
+ * @return mixed
95
+ */
96
+ public function add_shipping_services_checkboxes_to_settings( array $settings ) {
97
+ if ( $this->saas_connection->is_connected() ) {
98
+ try {
99
+ $platform = $this->get_platform();
100
+ $shipping_services = $platform->requestListShippingServices();
101
+ $settings[] = array(
102
+ 'title' => __( 'Services', 'flexible-shipping' ),
103
+ 'type' => 'title',
104
+ );
105
+ foreach ( $shipping_services->getPage() as $shipping_service ) {
106
+ $settings = $this->add_shipping_service_checkbox_to_settings( $settings, $shipping_service );
107
+ }
108
+ } catch ( Exception $e ) {
109
+ $this->logger->debug( "add_shipping_services_checkboxes_to_settings method exception: {$e->getMessage()} code: {$e->getCode()}",
110
+ [
111
+ 'exception' => $e
112
+ ] );
113
+ }
114
+ }
115
+
116
+ return $settings;
117
+ }
118
+
119
+ /**
120
+ * Get shipping services from platform.
121
+ *
122
+ * @return array
123
+ * @throws Exception Exception.
124
+ */
125
+ public function get_shipping_services_from_platform() {
126
+ $shipping_services_from_platform = array();
127
+ $platform = $this->get_platform();
128
+ try {
129
+ $shipping_services = $platform->requestListShippingServices();
130
+ if ( $shipping_services->isBadCredentials() ) {
131
+ throw new WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception( $this->saas_platform_links );
132
+ }
133
+ /**
134
+ * IDE type hint.
135
+ *
136
+ * @var \WPDesk\SaasPlatformClient\Model\ShippingService $shipping_service
137
+ */
138
+ foreach ( $shipping_services->getPage() as $shipping_service ) {
139
+ $shipping_services_from_platform[] = $shipping_service;
140
+ }
141
+ } catch ( Exception $e ) {
142
+ $this->logger->debug( "get_shipping_services_from_platform method exception: {$e->getMessage()} code: {$e->getCode()}",
143
+ [
144
+ 'exception' => $e,
145
+ ]
146
+ );
147
+ if ( $e instanceof WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception ) {
148
+ throw $e;
149
+ }
150
+ }
151
+
152
+ return $shipping_services_from_platform;
153
+ }
154
+
155
+ }
156
+
157
+ }
classes/saas/class-saas-user-registration.php ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_User_Registration' ) ) {
8
+
9
+ /**
10
+ * Class WPDesk_Flexible_Shipping_SaaS_User_Registration
11
+ */
12
+ class WPDesk_Flexible_Shipping_SaaS_User_Registration
13
+ implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant, \WPDesk\PluginBuilder\Plugin\HookableCollection {
14
+
15
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
16
+ use \WPDesk\PluginBuilder\Plugin\HookableParent;
17
+
18
+ const PRIORITY_AFTER_DEFAULT = 11;
19
+ const PRIORITY_AFTER_AFTER_DEFAULT = 12;
20
+
21
+ const PAGE_WOOCOMMERCE_SETTINGS = 'wc-settings';
22
+ const TAB_SHIPPING = 'shipping';
23
+ const SECTION_FLEXIBLE_SHIPPING_CONNECT = 'flexible_shipping_connect';
24
+
25
+ const SUBMIT_REGISTER_PARAMETER = 'flexible-shipping-submit-register';
26
+
27
+ const SETTING_FLEXIBLE_SHIPPING_USER_EMAIL = 'flexible_shipping_user_email';
28
+ const SETTING_FLEXIBLE_SHIPPING_API_KEY = 'flexible_shipping_api_key';
29
+ const SETTING_FLEXIBLE_SHIPPING_REGISTERED = 'flexible_shipping_registered';
30
+
31
+ const NONCE_REGISTRATION_ACTION = 'fsregister';
32
+ const NONCE_REGISTRATION_NAME = '_nonce_fsregister';
33
+
34
+ const SETTINGS_ERROR_SETTING = 'flexible-shipping-register';
35
+ const SETTINGS_ERROR_CODE_SUCCESS = 'success';
36
+
37
+ const NOTICE_NAME = 'fs_connect_notice';
38
+
39
+ const REGISTER_PAGE_SLUG = 'flexible_shipping_connect_register';
40
+ const FS_CONNECT_FIRST_NOTICE_NAME = 'fs_connect_start';
41
+
42
+ /**
43
+ * Show register form
44
+ *
45
+ * @var bool
46
+ */
47
+ private $show_register_form = true;
48
+
49
+ /**
50
+ * SaaS connection.
51
+ *
52
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
53
+ */
54
+ private $saas_connection;
55
+
56
+ /**
57
+ * Links.
58
+ *
59
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
60
+ */
61
+ private $saas_platform_links;
62
+
63
+ /**
64
+ * WPDesk_Flexible_Shipping_Services constructor.
65
+ *
66
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection Connection.
67
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Links.
68
+ */
69
+ public function __construct(
70
+ WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection,
71
+ WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links
72
+ ) {
73
+ $this->saas_connection = $saas_connection;
74
+ $this->saas_platform_links = $saas_platform_links;
75
+ if ( ! $this->saas_connection->is_connected() && ! $this->is_on_setings_page() ) {
76
+ $this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice( self::FS_CONNECT_FIRST_NOTICE_NAME ) );
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Is on settings page?
82
+ *
83
+ * @return bool
84
+ */
85
+ public function is_on_setings_page() {
86
+ return ( isset( $_GET['page'] ) && self::PAGE_WOOCOMMERCE_SETTINGS === $_GET['page']
87
+ && isset( $_GET['tab'] ) && self::TAB_SHIPPING === $_GET['tab']
88
+ && isset( $_GET['section'] ) && self::SECTION_FLEXIBLE_SHIPPING_CONNECT === $_GET['section']
89
+ );
90
+ }
91
+
92
+ /**
93
+ * Is on registration page?
94
+ *
95
+ * @return bool
96
+ */
97
+ public function is_on_registration_page() {
98
+ return ( isset( $_GET['page'] ) && self::REGISTER_PAGE_SLUG === $_GET['page'] );
99
+ }
100
+
101
+ /**
102
+ * Is on submit page?
103
+ *
104
+ * @return bool
105
+ */
106
+ public function is_on_submit_page() {
107
+ return ( isset( $_GET[ self::SUBMIT_REGISTER_PARAMETER ] ) && '1' === $_GET[ self::SUBMIT_REGISTER_PARAMETER ] );
108
+ }
109
+
110
+ /**
111
+ * Hooks.
112
+ */
113
+ public function hooks() {
114
+ add_filter( 'removable_query_args', [ $this, 'add_email_parameters_to_removable_query_args' ] );
115
+ add_action( 'admin_init', [ $this, 'register_user_and_add_notice' ] );
116
+ add_action( 'admin_init', [ $this, 'register_form_notice' ], self::PRIORITY_AFTER_DEFAULT );
117
+ add_action( 'admin_init', [ $this, 'create_registration_notices' ] );
118
+ add_action( 'admin_menu', [ $this, 'add_registration_page' ] );
119
+ $this->hooks_on_hookable_objects();
120
+ }
121
+
122
+ /**
123
+ * Add registration page to WordPress admin area.
124
+ */
125
+ public function add_registration_page() {
126
+ add_submenu_page(
127
+ null,
128
+ __( 'Flexible Shipping Connect Registration', 'flexible-shipping' ),
129
+ __( 'Flexible Shipping Connect Registration', 'flexible-shipping' ),
130
+ 'edit_pages',
131
+ self::REGISTER_PAGE_SLUG,
132
+ [ $this, 'show_registration_page' ]
133
+ );
134
+ }
135
+
136
+ /**
137
+ * Display registration page.
138
+ */
139
+ public function show_registration_page() {
140
+ $user_email = get_option( 'admin_email' );
141
+ if ( isset( $_REQUEST['user_email'] ) ) {
142
+ $user_email = $_REQUEST['user_email'];
143
+ }
144
+ $action = admin_url( 'admin.php' );
145
+ $action = add_query_arg( self::SUBMIT_REGISTER_PARAMETER, '1', $action );
146
+ $url_fs_com = $this->saas_platform_links->add_utm_general( $this->saas_platform_links->get_base_url() );
147
+ $url_terms = $this->saas_platform_links->add_utm(
148
+ $this->saas_platform_links->get_terms(),
149
+ 'fs-signup-terms',
150
+ 'flexible-shipping',
151
+ 'link',
152
+ 'user-site',
153
+ 'terms-of-service'
154
+ );
155
+ $url_privacy = $this->saas_platform_links->add_utm(
156
+ $this->saas_platform_links->get_privacy(),
157
+ 'fs-signup-privacy',
158
+ 'flexible-shipping',
159
+ 'link',
160
+ 'user-site',
161
+ 'privacy-policy'
162
+ );
163
+ $saas_connected = $this->saas_connection->is_connected();
164
+ $settings_url = admin_url( 'admin.php' );
165
+ $settings_url = add_query_arg( 'page', self::PAGE_WOOCOMMERCE_SETTINGS, $settings_url );
166
+ $settings_url = add_query_arg( 'tab', self::TAB_SHIPPING, $settings_url );
167
+ $settings_url = add_query_arg( 'section', self::SECTION_FLEXIBLE_SHIPPING_CONNECT, $settings_url );
168
+ include 'views/html-registration-page.php';
169
+ }
170
+
171
+ /**
172
+ * Show registration notices.
173
+ */
174
+ public function create_registration_notices() {
175
+ $settings_errors = get_settings_errors( self::SETTINGS_ERROR_SETTING );
176
+ $notices = array();
177
+ foreach ( $settings_errors as $error ) {
178
+ $notices[] = new \WPDesk\Notice\Notice( $error['message'], $error['type'] );
179
+ }
180
+ return $notices;
181
+ }
182
+
183
+ /**
184
+ * Removable query args.
185
+ *
186
+ * @param array $removable_query_args Query args.
187
+ *
188
+ * @return array
189
+ */
190
+ public function add_email_parameters_to_removable_query_args( $removable_query_args ) {
191
+ $removable_query_args[] = 'user_email';
192
+ $removable_query_args[] = '_nonce_fsregister';
193
+ $removable_query_args[] = '_wp_http_referer';
194
+ return $removable_query_args;
195
+ }
196
+
197
+
198
+ /**
199
+ * Add platform unavailable notice.
200
+ */
201
+ private function add_notice_connecton_problem() {
202
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
203
+ $notice_content = __( 'There are some connection problems. Please try again in few minutes. Thanks!', 'flexible-shipping' );
204
+ add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
205
+ }
206
+
207
+ /**
208
+ * Add invalid email notice.
209
+ */
210
+ private function add_notice_invalid_email() {
211
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
212
+ $notice_content = __( 'Please enter a valid email!', 'flexible-shipping' );
213
+ add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
214
+ }
215
+
216
+ /**
217
+ * Add notice user registered.
218
+ *
219
+ * @param string $user_email User email.
220
+ */
221
+ private function add_notice_user_registered( $user_email ) {
222
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_SUCCESS;
223
+ $notice_content = sprintf(
224
+ /* Translators: email and url */
225
+ __( '%1$sAccount created, please check your email and click the activation link to connect (%3$s).%2$s If you haven\'t received the email, please %4$scontact us%5$s.', 'flexible-shipping' ),
226
+ '<strong>',
227
+ '</strong>',
228
+ $user_email,
229
+ '<a href=' . $this->saas_platform_links->add_utm(
230
+ $this->saas_platform_links->get_support(),
231
+ 'fs-signup-support',
232
+ 'flexible-shipping',
233
+ 'link',
234
+ 'user-site',
235
+ ''
236
+ ) . ' tagret="_blank">',
237
+ '</a>'
238
+ );
239
+ add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
240
+ }
241
+
242
+ /**
243
+ * Add notice domain occupied.
244
+ */
245
+ private function add_notice_domain_occupied() {
246
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
247
+ $notice_content = sprintf(
248
+ /* Translators: email and url */
249
+ __( 'Your store (%1$s) is already registered with another account! You can register your domain with one account. If you have questions, %2$scontact us%3$s.', 'flexible-shipping' ),
250
+ site_url(),
251
+ '<a target="_blank" href=' . $this->saas_platform_links->add_utm(
252
+ $this->saas_platform_links->get_support(),
253
+ 'fs-register-contactus',
254
+ 'flexible-shipping',
255
+ 'link',
256
+ 'user-site',
257
+ 'contact-us'
258
+ ) . ' tagret="_blank">',
259
+ '</a>'
260
+ );
261
+ add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
262
+ }
263
+
264
+ /**
265
+ * Add notice user already exists.
266
+ *
267
+ * @param string $user_email User email.
268
+ */
269
+ private function add_notice_user_already_exists( $user_email ) {
270
+ $settings_url = admin_url( 'admin.php' );
271
+ $settings_url = add_query_arg( 'page', self::PAGE_WOOCOMMERCE_SETTINGS, $settings_url );
272
+ $settings_url = add_query_arg( 'tab', self::TAB_SHIPPING, $settings_url );
273
+ $settings_url = add_query_arg( 'section', self::SECTION_FLEXIBLE_SHIPPING_CONNECT, $settings_url );
274
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_INFO;
275
+ $notice_content = sprintf(
276
+ /* Translators: email and url */
277
+ __( 'Account with this email is already registered! We emailed your Connect Key to %1$s.<br>Enter your key %2$shere%4$s. You can also get your key by logging to %3$syour account%4$s.', 'flexible-shipping' ),
278
+ $user_email,
279
+ '<a href=' . $settings_url . '>',
280
+ '<a href=' . $this->saas_platform_links->get_my_account() . ' target="_blank">',
281
+ '</a>'
282
+ );
283
+ add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
284
+ }
285
+
286
+ /**
287
+ * Add admin notice.
288
+ *
289
+ * @param int $response_code Notice code.
290
+ */
291
+ private function add_notice_from_response( $response_code ) {
292
+ $notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
293
+ $notice_content = sprintf(
294
+ /* Translators: notice code */
295
+ __( 'Unknown response code from Flexible Shipping Connect API (%s).', 'flexible-shipping' ),
296
+ $response_code
297
+ );
298
+ add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
299
+ }
300
+
301
+ /**
302
+ * Registers user trough FS Connect platform
303
+ *
304
+ * @param string $email Email.
305
+ * @param WPDesk_Flexible_Shipping_SaaS_Auth_Params $params Params.
306
+ *
307
+ * @return \WPDesk\SaasPlatformClient\Response\Authentication\RegisterResponse
308
+ */
309
+ private function register_user( $email, WPDesk_Flexible_Shipping_SaaS_Auth_Params $params ) {
310
+ $platform = $this->saas_connection->get_platform();
311
+
312
+ return $platform->requestRegister( $email, $params->get_user_domain(), $params->get_user_locale(), admin_url( 'admin.php' ) );
313
+ }
314
+
315
+ /**
316
+ * Register user and show notice.
317
+ */
318
+ public function register_user_and_add_notice() {
319
+ if ( $this->is_on_submit_page() ) {
320
+ $user_email = '';
321
+ if ( isset( $_REQUEST[ self::NONCE_REGISTRATION_NAME ] )
322
+ && wp_verify_nonce( $_REQUEST[ self::NONCE_REGISTRATION_NAME ], self::NONCE_REGISTRATION_ACTION )
323
+ && isset( $_REQUEST['user_email'] )
324
+ ) {
325
+ $user_email = $_REQUEST['user_email'];
326
+ $registered = get_option( self::SETTING_FLEXIBLE_SHIPPING_REGISTERED, '' );
327
+ if ( '' !== $user_email && '' === $registered && is_email( $user_email ) ) {
328
+ try {
329
+ $register_response = $this->register_user(
330
+ $user_email,
331
+ new WPDesk_Flexible_Shipping_SaaS_Auth_Params()
332
+ );
333
+ if ( $register_response->isUserRegistered() ) {
334
+ $this->add_notice_user_registered( $user_email );
335
+
336
+ } else {
337
+ if ( $register_response->isDomainOccupied() ) {
338
+ $this->add_notice_domain_occupied();
339
+ } elseif ( $register_response->isUserAlreadyExists() ) {
340
+ $this->add_notice_user_already_exists( $user_email );
341
+ } elseif ( $register_response->isBadRequest() ) {
342
+ $this->add_notice_connecton_problem();
343
+ } elseif ( $register_response->isServerFatalError() ) {
344
+ $this->add_notice_connecton_problem();
345
+ } else {
346
+ $this->add_notice_from_response( $register_response->getResponseCode() );
347
+ }
348
+ }
349
+ } catch ( Exception $e ) {
350
+ $this->add_notice_connecton_problem();
351
+ }
352
+ } else {
353
+ $this->add_notice_invalid_email();
354
+ }
355
+ }
356
+ set_transient( 'settings_errors', get_settings_errors(), 30 );
357
+ $url = admin_url( 'admin.php' );
358
+ $url = add_query_arg( 'page', self::REGISTER_PAGE_SLUG, $url );
359
+ $url = add_query_arg( 'settings-updated', 'true', $url );
360
+ $url = add_query_arg( 'user_email', urlencode( $user_email ), $url );
361
+ wp_safe_redirect( $url );
362
+ exit;
363
+ }
364
+ }
365
+
366
+ /**
367
+ * Show register form - handle hook.
368
+ */
369
+ public function register_form_notice() {
370
+ if ( $this->show_register_form ) {
371
+ if ( ! $this->saas_connection->is_connected() ) {
372
+ $this->display_registration_notice();
373
+ }
374
+ }
375
+ }
376
+
377
+ /**
378
+ * Get registration notice content.
379
+ *
380
+ * @return false|string
381
+ */
382
+ private function get_registration_notice_content() {
383
+ $html_class_is_dismissible = 'is-dismissible';
384
+ if ( $this->is_on_setings_page() ) {
385
+ $html_class_is_dismissible = '';
386
+ }
387
+
388
+ ob_start();
389
+ include 'views/html-flexible-shipping-connect-notice.php';
390
+ $notice_content = ob_get_contents();
391
+ ob_end_clean();
392
+
393
+ return $notice_content;
394
+ }
395
+
396
+ /**
397
+ * Display registration form.
398
+ */
399
+ private function display_registration_notice() {
400
+
401
+ $notice_content = $this->get_registration_notice_content();
402
+
403
+ if ( ! $this->is_on_setings_page() && ! $this->is_on_registration_page() ) {
404
+ new \WPDesk\Notice\PermanentDismissibleNotice(
405
+ $notice_content,
406
+ \WPDesk\Notice\Notice::NOTICE_TYPE_INFO,
407
+ self::FS_CONNECT_FIRST_NOTICE_NAME,
408
+ 10,
409
+ array(
410
+ 'class' => 'fs-connect__container',
411
+ 'id' => 'fs_connect_notice',
412
+ )
413
+ );
414
+ }
415
+ }
416
+
417
+ }
418
+
419
+ }
classes/saas/interface-saas-connection-aware.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Interface WPDesk_Flexible_Shipping_Saas_Connection_Aware
5
+ */
6
+ interface WPDesk_Flexible_Shipping_Saas_Connection_Aware {
7
+
8
+ /**
9
+ * Set SaaS Connection.
10
+ *
11
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS connection.
12
+ */
13
+ public function set_saas_connection( $saas_connection );
14
+
15
+ /**
16
+ * Set shipping methods manager.
17
+ *
18
+ * @param WPDesk_Flexible_Shipping_SaaS_Services_Manager $shipping_methods_manager Shipping methods manager.
19
+ */
20
+ public function set_shipping_methods_manager( $shipping_methods_manager );
21
+
22
+ }
classes/saas/tracker/class-saas-tracker.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_SaaS_Settings
5
+ */
6
+ class WPDesk_Flexible_Shipping_SaaS_Tracker implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
+
10
+ const PRIORITY_AFTER_DEFAULT = 11;
11
+
12
+ /**
13
+ * SaaS connection.
14
+ *
15
+ * @var WPDesk_Flexible_Shipping_SaaS_Connection
16
+ */
17
+ private $saas_connection;
18
+
19
+ /**
20
+ * Services manager.
21
+ *
22
+ * @var WPDesk_Flexible_Shipping_SaaS_Services_Manager $services_manager
23
+ */
24
+ private $services_manager;
25
+
26
+ /**
27
+ * WPDesk_Flexible_Shipping_SaaS_Tracker constructor.
28
+ *
29
+ * @param WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection SaaS connection.
30
+ * @param WPDesk_Flexible_Shipping_SaaS_Services_Manager $services_manager Services manager.
31
+ */
32
+ public function __construct(
33
+ WPDesk_Flexible_Shipping_SaaS_Connection $saas_connection,
34
+ WPDesk_Flexible_Shipping_SaaS_Services_Manager $services_manager
35
+ ) {
36
+ $this->saas_connection = $saas_connection;
37
+ $this->services_manager = $services_manager;
38
+ }
39
+
40
+ /**
41
+ * Hooks
42
+ */
43
+ public function hooks() {
44
+ // @TODO: not now, probably to remove: https://trello.com/c/xv9Rm0YG/2804-trackowanie-i-analiza-danych
45
+ //add_filter( 'wpdesk_tracker_data', array( $this, 'collect_tracker_data' ), self::PRIORITY_AFTER_DEFAULT );
46
+ }
47
+
48
+ /**
49
+ * Collect tracked data.
50
+ *
51
+ * @param array $tracked_data Tracked data.
52
+ * @return array
53
+ */
54
+ public function collect_tracker_data( array $tracked_data ) {
55
+ $saas_data = array();
56
+ if ( $this->saas_connection->is_connected() ) {
57
+ $sass_data['connected'] = '1';
58
+ $services_data = $this->collect_sass_services_data();
59
+ $saas_data['services'] = $services_data;
60
+ $saas_data['summaries'] = $this->compute_summaries( $services_data );
61
+ } else {
62
+ $sass_data['connected'] = '0';
63
+ }
64
+ $tracked_data['flexible-shipping-saas'] = $saas_data;
65
+ return $tracked_data;
66
+ }
67
+
68
+ /**
69
+ * Min first shipment.
70
+ *
71
+ * @param array $array1 Array 1.
72
+ * @param array $array2 Array 2.
73
+ *
74
+ * @return mixed
75
+ */
76
+ private function min_first_shipment_from_arrays( array $array1, array $array2 ) {
77
+ if ( ! isset( $array1[ WPDesk_Flexible_Shipping_Shipment_Counter::FIRST_SHIPMENT ] ) ) {
78
+ return $array2[ WPDesk_Flexible_Shipping_Shipment_Counter::FIRST_SHIPMENT ];
79
+ } else {
80
+ return min(
81
+ $array1[ WPDesk_Flexible_Shipping_Shipment_Counter::FIRST_SHIPMENT ],
82
+ $array2[ WPDesk_Flexible_Shipping_Shipment_Counter::FIRST_SHIPMENT ]
83
+ );
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Max last shipment.
89
+ *
90
+ * @param array $array1 Array 1.
91
+ * @param array $array2 Array 2.
92
+ *
93
+ * @return mixed
94
+ */
95
+ private function max_last_shipment_from_arrays( array $array1, array $array2 ) {
96
+ if ( ! isset( $array1[ WPDesk_Flexible_Shipping_Shipment_Counter::LAST_SHIPMENT ] ) ) {
97
+ return $array2[ WPDesk_Flexible_Shipping_Shipment_Counter::LAST_SHIPMENT ];
98
+ } else {
99
+ return max(
100
+ $array1[ WPDesk_Flexible_Shipping_Shipment_Counter::LAST_SHIPMENT ],
101
+ $array2[ WPDesk_Flexible_Shipping_Shipment_Counter::LAST_SHIPMENT ]
102
+ );
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Compute summaries.
108
+ *
109
+ * @param array $services_data Services data.
110
+ * @return array
111
+ */
112
+ private function compute_summaries( array $services_data ) {
113
+ $summaries = array(
114
+ WPDesk_Flexible_Shipping_Shipment_Counter::ALL_SHIPMENTS => 0,
115
+ WPDesk_Flexible_Shipping_Shipment_Counter::STATUS => array(),
116
+ );
117
+ foreach ( $services_data as $service_data ) {
118
+ $summaries[ WPDesk_Flexible_Shipping_Shipment_Counter::ALL_SHIPMENTS ]
119
+ += $service_data[ WPDesk_Flexible_Shipping_Shipment_Counter::ALL_SHIPMENTS ];
120
+
121
+ $summaries[ WPDesk_Flexible_Shipping_Shipment_Counter::FIRST_SHIPMENT ] =
122
+ $this->min_first_shipment_from_arrays( $summaries, $service_data );
123
+
124
+ $summaries[ WPDesk_Flexible_Shipping_Shipment_Counter::LAST_SHIPMENT ] =
125
+ $this->max_last_shipment_from_arrays( $summaries, $service_data );
126
+
127
+ foreach ( $services_data[ WPDesk_Flexible_Shipping_Shipment_Counter::STATUS ] as $status => $status_counters ) {
128
+ if ( ! isset( $summaries[ WPDesk_Flexible_Shipping_Shipment_Counter::STATUS ][ $status ] ) ) {
129
+ $summaries[ WPDesk_Flexible_Shipping_Shipment_Counter::STATUS ][ $status ] = $status_counters;
130
+ } else {
131
+ $summary_status_counters = $summaries[ WPDesk_Flexible_Shipping_Shipment_Counter::STATUS ][ $status ];
132
+
133
+ $summary_status_counters[ WPDesk_Flexible_Shipping_Shipment_Counter::ALL_SHIPMENTS ]
134
+ += $status_counters[ WPDesk_Flexible_Shipping_Shipment_Counter::ALL_SHIPMENTS ];
135
+
136
+ $summary_status_counters[ WPDesk_Flexible_Shipping_Shipment_Counter::FIRST_SHIPMENT ] =
137
+ $this->min_first_shipment_from_arrays( $summary_status_counters, $status_counters );
138
+
139
+ $summary_status_counters[ WPDesk_Flexible_Shipping_Shipment_Counter::LAST_SHIPMENT ] =
140
+ $this->max_last_shipment_from_arrays( $summary_status_counters, $status_counters );
141
+
142
+ $summaries[ WPDesk_Flexible_Shipping_Shipment_Counter::STATUS ][ $status ] = $summary_status_counters;
143
+ }
144
+ }
145
+ }
146
+ return $summaries;
147
+ }
148
+
149
+ /**
150
+ * Collect tracker SaaS data.
151
+ *
152
+ * @return array
153
+ */
154
+ private function collect_sass_services_data() {
155
+ $services_data = array();
156
+ $all_services = $this->services_manager->get_all_services();
157
+ foreach ( $all_services as $service_id => $saas_service ) {
158
+ $service = $this->services_manager->get_saas_shiping_service( $service_id );
159
+ if ( ! empty( $service ) ) {
160
+ $services_data[ $service->get_integration_id() ] = $this->collect_saas_service_data( $service );
161
+ }
162
+ }
163
+ return $services_data;
164
+ }
165
+
166
+ /**
167
+ * Collect service data.
168
+ *
169
+ * @param WPDesk_Flexible_Shipping_SaaS_Shipping_Service $service Service.
170
+ *
171
+ * @return array
172
+ */
173
+ private function collect_saas_service_data( $service ) {
174
+ $service_data = array();
175
+ $service_id = $service->get_id();
176
+ $integration_id = $service->get_integration_id();
177
+ if ( $this->services_manager->is_enabled_saas_service( $service_id ) ) {
178
+ $enabled = '1';
179
+ } else {
180
+ $enabled = '0';
181
+ }
182
+ $service_data['enabled'] = $enabled;
183
+
184
+ global $wpdb;
185
+ $shipment_counter = new WPDesk_Flexible_Shipping_Shipment_Counter( $integration_id, $wpdb );
186
+
187
+ $service_data['counters'] = $shipment_counter->count_shipments();
188
+
189
+ return $service_data;
190
+ }
191
+
192
+ }
classes/saas/views/html-boxes-content.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $boxes_content = array(
3
+ array(
4
+ 'title' => __( 'Print Labels', 'flexible-shipping' ),
5
+ 'heading' => __( 'Print Labels', 'flexible-shipping' ),
6
+ 'description' => __( 'Download printable PDF shipping labels directly from WooCommerce orders list in bulk or one by one from order details.', 'flexible-shipping' ),
7
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M280 96h-16c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h16c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zm-64 0h-16c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h16c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zM592 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h544c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zm16 464c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h544c8.8 0 16 7.2 16 16v416zM152 96h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zm384 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zm-128 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8z"/></svg>'
8
+ ),
9
+ array(
10
+ 'title' => __( 'Calculate Rates', 'flexible-shipping' ),
11
+ 'heading' => __( 'Calculate Rates', 'flexible-shipping' ),
12
+ 'description' => __( 'Calculate shipping rates in real time, and get available service types and expected delivery time based on customer\'s address.', 'flexible-shipping' ),
13
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M80 448h288c8.84 0 16-7.16 16-16V240c0-8.84-7.16-16-16-16H80c-8.84 0-16 7.16-16 16v192c0 8.84 7.16 16 16 16zm208-96v-96h64v160h-64v-64zm-96-96h64v64h-64v-64zm0 96h64v64h-64v-64zm-96-96h64v64H96v-64zm0 96h64v64H96v-64zM400 0H48C22.4 0 0 22.4 0 48v416c0 25.6 22.4 48 48 48h352c25.6 0 48-22.4 48-48V48c0-25.6-22.4-48-48-48zm16 464c0 7.93-8.07 16-16 16H48c-7.93 0-16-8.07-16-16V192h384v272zm0-304H32V48c0-7.93 8.07-16 16-16h352c7.93 0 16 8.07 16 16v112z"/></svg>'
14
+ ),
15
+ array(
16
+ 'title' => __( 'Track Parcels', 'flexible-shipping' ),
17
+ 'heading' => __( 'Track Parcels', 'flexible-shipping' ),
18
+ 'description' => __( 'Always keep your customers (and yourself) up to date with automatic confirmation emails with tracking link and delivery status.', 'flexible-shipping' ),
19
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M208 96c-49.53 0-89.81 40.3-89.81 89.83 0 34.66 38.34 87.2 70.53 125.2 4.81 5.7 11.84 8.97 19.28 8.97s14.47-3.27 19.31-8.97c32.16-38 70.5-90.55 70.5-125.2C297.81 136.3 257.53 96 208 96zm0 188.23c-35.31-42.7-57.81-80.89-57.81-98.41 0-31.89 25.94-57.83 57.81-57.83s57.81 25.94 57.81 57.83c0 17.52-22.5 55.71-57.81 98.41zM208 160c-13.25 0-24 10.74-24 24 0 13.25 10.75 24 24 24s24-10.75 24-24c0-13.26-10.75-24-24-24zm300.47 321.58l-128.99-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3c34.3-37.1 55.3-86.6 55.3-141.09C415.98 93.1 322.88 0 207.99 0S0 93.1 0 207.99c0 114.89 93.1 207.99 207.99 207.99 54.5 0 103.99-21 141.09-55.2v10.2c0 3.2 1.3 6.2 3.5 8.5l128.99 128.99c4.7 4.7 12.3 4.7 17 0l9.9-9.9c4.71-4.69 4.71-12.29 0-16.99zm-300.48-97.6C110.7 383.98 32 305.29 32 207.99 32 110.69 110.7 32 207.99 32s175.99 78.7 175.99 175.99c0 97.3-78.69 175.99-175.99 175.99z"/></svg>'
20
+ ),
21
+ array(
22
+ 'title' => __( 'Automate Shipping', 'flexible-shipping' ),
23
+ 'heading' => __( 'Automate Shipping', 'flexible-shipping' ),
24
+ 'description' => __( 'Automatically create shipments and print labels based on order status. Change order status after shipment creation.', 'flexible-shipping' ),
25
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M48 416c-8.82 0-16-7.18-16-16V256h160v40c0 13.25 10.75 24 24 24h80c13.25 0 24-10.75 24-24v-40h40.23c10.06-12.19 21.81-22.9 34.77-32H32v-80c0-8.82 7.18-16 16-16h416c8.82 0 16 7.18 16 16v48.81c5.28-.48 10.6-.81 16-.81s10.72.33 16 .81V144c0-26.51-21.49-48-48-48H352V24c0-13.26-10.74-24-24-24H184c-13.26 0-24 10.74-24 24v72H48c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h291.37a174.574 174.574 0 0 1-12.57-32H48zm176-160h64v32h-64v-32zM192 32h128v64H192V32zm358.29 320H512v-54.29c0-5.34-4.37-9.71-9.71-9.71h-12.57c-5.34 0-9.71 4.37-9.71 9.71v76.57c0 5.34 4.37 9.71 9.71 9.71h60.57c5.34 0 9.71-4.37 9.71-9.71v-12.57c0-5.34-4.37-9.71-9.71-9.71zM496 224c-79.59 0-144 64.41-144 144s64.41 144 144 144 144-64.41 144-144-64.41-144-144-144zm0 256c-61.76 0-112-50.24-112-112s50.24-112 112-112 112 50.24 112 112-50.24 112-112 112z"/></svg>'
26
+ ),
27
+ array(
28
+ 'title' => __( 'Create Shipments', 'flexible-shipping' ),
29
+ 'heading' => __( 'Create Shipments', 'flexible-shipping' ),
30
+ 'description' => __( 'Create shipments with predefined services, sizes and weights automatically filled in from order items.', 'flexible-shipping' ),
31
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M492.5 133.4L458.9 32.8C452.4 13.2 434.1 0 413.4 0H98.6c-20.7 0-39 13.2-45.5 32.8L2.5 184.6c-1.6 4.9-2.5 10-2.5 15.2V464c0 26.5 21.5 48 48 48h400c106 0 192-86 192-192 0-90.7-63-166.5-147.5-186.6zM272 32h141.4c6.9 0 13 4.4 15.2 10.9l28.5 85.5c-3-.1-6-.5-9.1-.5-56.8 0-107.7 24.8-142.8 64H272V32zM83.4 42.9C85.6 36.4 91.7 32 98.6 32H240v160H33.7L83.4 42.9zM48 480c-8.8 0-16-7.2-16-16V224h249.9c-16.4 28.3-25.9 61-25.9 96 0 66.8 34.2 125.6 86 160H48zm400 0c-88.2 0-160-71.8-160-160s71.8-160 160-160 160 71.8 160 160-71.8 160-160 160zm64.6-221.7c-3.1-3.1-8.1-3.1-11.2 0l-69.9 69.3-30.3-30.6c-3.1-3.1-8.1-3.1-11.2 0l-18.7 18.6c-3.1 3.1-3.1 8.1 0 11.2l54.4 54.9c3.1 3.1 8.1 3.1 11.2 0l94.2-93.5c3.1-3.1 3.1-8.1 0-11.2l-18.5-18.7z"/></svg>'
32
+ ),
33
+ array(
34
+ 'title' => __( 'Manage Orders', 'flexible-shipping' ),
35
+ 'heading' => __( 'Manage Orders', 'flexible-shipping' ),
36
+ 'description' => __( 'Get a complete overview of your orders and shipments in your WooCommerce dashboard with shipments statuses and filters.', 'flexible-shipping' ),
37
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M112 256h352c8.8 0 16-7.2 16-16V16c0-8.8-7.2-16-16-16H112c-8.8 0-16 7.2-16 16v224c0 8.8 7.2 16 16 16zM256 32h64v76.2l-32-16-32 16V32zm-128 0h96v128l64-32 64 32V32h96v192H128V32zm430.3 301.6c-9.6-8.6-22.1-13.4-35.2-13.4-12.5 0-24.8 4.3-34.6 12.2l-61.6 49.3c-1.9 1.5-4.2 2.3-6.7 2.3h-41.6c4.6-9.6 6.5-20.7 4.8-32.3-4-27.9-29.6-47.7-57.8-47.7H181.3c-20.8 0-41 6.7-57.6 19.2L85.3 352H8c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h88l46.9-35.2c11.1-8.3 24.6-12.8 38.4-12.8H328c13.3 0 24 10.7 24 24s-10.7 24-24 24h-88c-8.8 0-16 7.2-16 16s7.2 16 16 16h180.2c9.7 0 19.1-3.3 26.7-9.3l61.6-49.2c4.2-3.4 9.5-5.2 14.6-5.2 5 0 9.9 1.7 13.8 5.2 10.1 9.1 9.3 24.5-.9 32.6l-100.8 80.7c-7.6 6.1-17 9.3-26.7 9.3H8c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h400.5c17 0 33.4-5.8 46.6-16.4L556 415c12.2-9.8 19.5-24.4 20-40s-6-30.8-17.7-41.4z"/></svg>'
38
+ )
39
+ );
40
+ ?>
41
+
42
+ <div class="fs-box text-center">
43
+ <h3><?php _e( 'Ship your orders faster with Flexible Shipping Connect', 'flexible-shipping' ); ?></h3>
44
+
45
+ <div class="fs-cols">
46
+ <?php
47
+ foreach ( $boxes_content as $key => $value ) {
48
+
49
+ echo '<div class="fs-inner-box">';
50
+
51
+ echo $value['icon'];
52
+
53
+ echo '<h4>' . $value['title'] . '</h4>';
54
+
55
+ echo '<p>' . $value['description'] . '</p>';
56
+
57
+ echo '</div>';
58
+ }
59
+ ?>
60
+ </div>
61
+
62
+ <p><a class="button button-large <?php echo $button_class; ?>" href="<?php echo $button_link; ?>"><?php _e( 'Sign up now!', 'flexible-shipping' ); ?></a></p>
63
+ </div>
classes/saas/views/html-field-connection-status.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <tr valign="top">
2
+ <th scope="row" class="titledesc">
3
+ <label for="<?php echo $field_id; ?>"><?php echo wp_kses_post( $data['title'] ); ?> <?php echo $tooltip_html; ?></label>
4
+ </th>
5
+ <td class="forminp">
6
+ <fieldset>
7
+ <legend class="screen-reader-text"><span><?php echo wp_kses_post( $title ); ?></span></legend>
8
+ <span id="<?php echo $field_id; ?>"><?php echo $status_html; ?></span>
9
+ <?php echo $description_html; ?>
10
+ </fieldset>
11
+ <?php if ( $ajax_action ) : ?>
12
+ <script type="text/javascript">
13
+ jQuery(document).ready(function(){
14
+ var data = {
15
+ 'action' : '<?php echo $ajax_action; ?>',
16
+ 'nonce' : '<?php echo $ajax_nonce; ?>',
17
+ 'service_id' : <?php echo $service_id; ?>,
18
+ };
19
+ var status_span = jQuery('#<?php echo $field_id; ?>');
20
+ jQuery.post(ajaxurl, data, function( response ) {
21
+ status_span.html(response.message);
22
+ if ( response.status == '<?php echo WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax::STATUS_OK; ?>' ) {
23
+ status_span.css('color', 'green');
24
+ }
25
+ else {
26
+ status_span.css('color', 'red');
27
+ }
28
+ }).fail(function() {
29
+ status_span.css('color', 'red');
30
+ status_span.html('<?php echo $ajax_error_message; ?>');
31
+ });
32
+ })
33
+ </script>
34
+ <?php endif; ?>
35
+ </td>
36
+ </tr>
classes/saas/views/html-field-saas-connection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ </table>
2
+
3
+ <div class="fs-page-wrap">
4
+ <div class="fs-box">
5
+ <h3 class="wc-settings-sub-title"><?php _e( 'Flexible Shipping Connect', 'flexible-shipping' ); ?></h3>
6
+
7
+ <?php if ( ! $saas_connected ) : ?>
8
+ <p>
9
+ <?php printf(
10
+ /* Translators: url */
11
+ __( '%1$sRegister%3$s for a new Flexible Shipping Connect account or log in to %2$syour account%3$s to get your key.', 'flexible-shipping' ),
12
+ '<a href="' . admin_url( 'admin.php?page=' . WPDesk_Flexible_Shipping_SaaS_User_Registration::REGISTER_PAGE_SLUG ) . '">',
13
+ '<a href="' . $saas_platform_my_account_url . '">',
14
+ '</a>'
15
+ ); ?>
16
+ </p>
17
+ <?php else : ?>
18
+ <p><a href="<?php echo $saas_platform_docs_url; ?>" target="_blank"><?php _e( 'Check how to start with FS Connect &rarr;', 'flexible-shipping' ); ?></a></p>
19
+ <?php endif; ?>
20
+
21
+ <?php $saas_connection->display_connection_form(); ?>
22
+ </div>
23
+
24
+ <?php
25
+ /* Fake saas_connected - always true for debug mode settings. */
26
+ $saas_connected = true;
27
+ ?>
28
+ <?php if ( $saas_connected ) : ?>
29
+ <div class="fs-box fs-services">
30
+ <table>
31
+ <?php endif; ?>
classes/saas/views/html-flexible-shipping-connect-notice.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ob_start();
3
+
4
+ echo '<p>' . __( 'Welcome to new Flexible Shipping Connect installation guide.', 'flexible-shipping' ) . '</p>';
5
+
6
+ echo '<p><strong>' . __( 'To complete the installation please click the Sing up for Connect button below.', 'flexible-shipping' ) . '</strong></p>';
7
+
8
+ echo '<p>' . sprintf( __( 'The %saccount is free (no credit card needed)%s and allows you to send packages directly from here!', 'flexible-shipping' ), '<strong>', '</strong>' ) . '</p>';
9
+
10
+ echo '<p>' . __( 'If you want to learn more about other benefits, you may click one of the tabs on the left.', 'flexible-shipping' ) . '</p>';
11
+
12
+ $fs_description = ob_get_contents();
13
+ ob_end_clean();
14
+
15
+ $fs_content = array(
16
+ array(
17
+ 'title' => 'Flexible Shipping',
18
+ 'heading' => __( 'Ship your orders faster with Flexible Shipping Connect', 'flexible-shipping' ),
19
+ 'description' => $fs_description,
20
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6zm-16.2 55.1l-352 208C45.6 483.9 32 476.6 32 464V47.9c0-16.3 16.4-18.4 24.1-13.8l352 208.1c10.5 6.2 10.5 21.4.1 27.6z"/></svg>'
21
+ )
22
+ );
23
+
24
+ $couriers = array(
25
+ array(
26
+ 'title' => 'UPS',
27
+ 'country' => array(),
28
+ 'label' => '',
29
+ 'logo' => 'https://s3.eu-central-1.amazonaws.com/wpdeskcdn/couriers/ups.svg'
30
+ ),
31
+ array(
32
+ 'title' => 'FedEx',
33
+ 'country' => array(),
34
+ 'label' => __( 'soon!', 'flexible-shipping' ),
35
+ 'logo' => 'https://s3.eu-central-1.amazonaws.com/wpdeskcdn/couriers/fedex.svg'
36
+ ),
37
+ array(
38
+ 'title' => 'DPD UK',
39
+ 'country' => array( 'GB' ),
40
+ 'label' => __( 'soon!', 'flexible-shipping' ),
41
+ 'logo' => 'https://s3.eu-central-1.amazonaws.com/wpdeskcdn/couriers/dpd.svg'
42
+ ),
43
+ array(
44
+ 'title' => 'Royal Mail',
45
+ 'country' => array( 'GB' ),
46
+ 'label' => __( 'soon!', 'flexible-shipping' ),
47
+ 'logo' => 'https://s3.eu-central-1.amazonaws.com/wpdeskcdn/couriers/royal-mail.png'
48
+ )
49
+ );
50
+
51
+ $base_location = wc_get_base_location();
52
+
53
+ ob_start();
54
+
55
+ _e( 'Using Flexible Shipping Connect, you can send packages via:', 'flexible-shipping' );
56
+
57
+ echo '<div class="fs-couriers">';
58
+
59
+ foreach ( $couriers as $key => $value ) :
60
+
61
+ if ( empty( $value['country'] ) || in_array( $base_location['country'], $value['country'] ) ) :
62
+ echo '<div class="fs-courier">';
63
+
64
+ echo '<img src="' . $value['logo'] . '">';
65
+
66
+ if ( $value['label'] )
67
+ echo '<span class="fs-courier-label">' . $value['label'] . '</span>';
68
+
69
+ echo '</div>';
70
+ endif;
71
+
72
+ endforeach;
73
+
74
+ echo '</div>';
75
+
76
+ echo '<a href="https://flexibleshipping.com/product-category/integrations/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=possible-integrations&utm_content=fs-notice-integrations" target="_blank">' . __( 'Read more about possible integrations &rarr;', 'flexible-shipping') . '</a>';
77
+
78
+ $couriers_description = ob_get_contents();
79
+ ob_end_clean();
80
+
81
+ $boxes_content = array(
82
+ array(
83
+ 'title' => __( 'Create & Print Labels', 'flexible-shipping' ),
84
+ 'heading' => __( 'Create & Print Labels', 'flexible-shipping' ),
85
+ 'description' => __( 'Create shipments with predefined services, sizes and weights automatically filled in from order items. Download printable PDF shipping labels directly from WooCommerce orders list in bulk or one by one from order details.', 'flexible-shipping' ),
86
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M280 96h-16c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h16c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zm-64 0h-16c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h16c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zM592 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h544c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zm16 464c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h544c8.8 0 16 7.2 16 16v416zM152 96h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zm384 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zm-128 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8z"/></svg>'
87
+ ),
88
+ array(
89
+ 'title' => __( 'Calculate Rates', 'flexible-shipping' ),
90
+ 'heading' => __( 'Calculate Rates', 'flexible-shipping' ),
91
+ 'description' => __( 'Calculate shipping rates in real time, and get available service types and expected delivery time based on customer\'s address.', 'flexible-shipping' ),
92
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M80 448h288c8.84 0 16-7.16 16-16V240c0-8.84-7.16-16-16-16H80c-8.84 0-16 7.16-16 16v192c0 8.84 7.16 16 16 16zm208-96v-96h64v160h-64v-64zm-96-96h64v64h-64v-64zm0 96h64v64h-64v-64zm-96-96h64v64H96v-64zm0 96h64v64H96v-64zM400 0H48C22.4 0 0 22.4 0 48v416c0 25.6 22.4 48 48 48h352c25.6 0 48-22.4 48-48V48c0-25.6-22.4-48-48-48zm16 464c0 7.93-8.07 16-16 16H48c-7.93 0-16-8.07-16-16V192h384v272zm0-304H32V48c0-7.93 8.07-16 16-16h352c7.93 0 16 8.07 16 16v112z"/></svg>'
93
+ ),
94
+ array(
95
+ 'title' => __( 'Track Parcels', 'flexible-shipping' ),
96
+ 'heading' => __( 'Track Parcels', 'flexible-shipping' ),
97
+ 'description' => __( 'Always keep your customers (and yourself) up to date with automatic confirmation emails with tracking link and delivery status.', 'flexible-shipping' ),
98
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M208 96c-49.53 0-89.81 40.3-89.81 89.83 0 34.66 38.34 87.2 70.53 125.2 4.81 5.7 11.84 8.97 19.28 8.97s14.47-3.27 19.31-8.97c32.16-38 70.5-90.55 70.5-125.2C297.81 136.3 257.53 96 208 96zm0 188.23c-35.31-42.7-57.81-80.89-57.81-98.41 0-31.89 25.94-57.83 57.81-57.83s57.81 25.94 57.81 57.83c0 17.52-22.5 55.71-57.81 98.41zM208 160c-13.25 0-24 10.74-24 24 0 13.25 10.75 24 24 24s24-10.75 24-24c0-13.26-10.75-24-24-24zm300.47 321.58l-128.99-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3c34.3-37.1 55.3-86.6 55.3-141.09C415.98 93.1 322.88 0 207.99 0S0 93.1 0 207.99c0 114.89 93.1 207.99 207.99 207.99 54.5 0 103.99-21 141.09-55.2v10.2c0 3.2 1.3 6.2 3.5 8.5l128.99 128.99c4.7 4.7 12.3 4.7 17 0l9.9-9.9c4.71-4.69 4.71-12.29 0-16.99zm-300.48-97.6C110.7 383.98 32 305.29 32 207.99 32 110.69 110.7 32 207.99 32s175.99 78.7 175.99 175.99c0 97.3-78.69 175.99-175.99 175.99z"/></svg>'
99
+ ),
100
+ array(
101
+ 'title' => __( 'Automate Shipping', 'flexible-shipping' ),
102
+ 'heading' => __( 'Automate Shipping', 'flexible-shipping' ),
103
+ 'description' => __( 'Automatically create shipments and print labels based on order status. Change order status after shipment creation.', 'flexible-shipping' ),
104
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M48 416c-8.82 0-16-7.18-16-16V256h160v40c0 13.25 10.75 24 24 24h80c13.25 0 24-10.75 24-24v-40h40.23c10.06-12.19 21.81-22.9 34.77-32H32v-80c0-8.82 7.18-16 16-16h416c8.82 0 16 7.18 16 16v48.81c5.28-.48 10.6-.81 16-.81s10.72.33 16 .81V144c0-26.51-21.49-48-48-48H352V24c0-13.26-10.74-24-24-24H184c-13.26 0-24 10.74-24 24v72H48c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h291.37a174.574 174.574 0 0 1-12.57-32H48zm176-160h64v32h-64v-32zM192 32h128v64H192V32zm358.29 320H512v-54.29c0-5.34-4.37-9.71-9.71-9.71h-12.57c-5.34 0-9.71 4.37-9.71 9.71v76.57c0 5.34 4.37 9.71 9.71 9.71h60.57c5.34 0 9.71-4.37 9.71-9.71v-12.57c0-5.34-4.37-9.71-9.71-9.71zM496 224c-79.59 0-144 64.41-144 144s64.41 144 144 144 144-64.41 144-144-64.41-144-144-144zm0 256c-61.76 0-112-50.24-112-112s50.24-112 112-112 112 50.24 112 112-50.24 112-112 112z"/></svg>'
105
+ ),
106
+ array(
107
+ 'title' => __( 'Manage Orders', 'flexible-shipping' ),
108
+ 'heading' => __( 'Manage Orders', 'flexible-shipping' ),
109
+ 'description' => __( 'Get a complete overview of your orders and shipments in your WooCommerce dashboard with shipments statuses and filters.', 'flexible-shipping' ),
110
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M112 256h352c8.8 0 16-7.2 16-16V16c0-8.8-7.2-16-16-16H112c-8.8 0-16 7.2-16 16v224c0 8.8 7.2 16 16 16zM256 32h64v76.2l-32-16-32 16V32zm-128 0h96v128l64-32 64 32V32h96v192H128V32zm430.3 301.6c-9.6-8.6-22.1-13.4-35.2-13.4-12.5 0-24.8 4.3-34.6 12.2l-61.6 49.3c-1.9 1.5-4.2 2.3-6.7 2.3h-41.6c4.6-9.6 6.5-20.7 4.8-32.3-4-27.9-29.6-47.7-57.8-47.7H181.3c-20.8 0-41 6.7-57.6 19.2L85.3 352H8c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h88l46.9-35.2c11.1-8.3 24.6-12.8 38.4-12.8H328c13.3 0 24 10.7 24 24s-10.7 24-24 24h-88c-8.8 0-16 7.2-16 16s7.2 16 16 16h180.2c9.7 0 19.1-3.3 26.7-9.3l61.6-49.2c4.2-3.4 9.5-5.2 14.6-5.2 5 0 9.9 1.7 13.8 5.2 10.1 9.1 9.3 24.5-.9 32.6l-100.8 80.7c-7.6 6.1-17 9.3-26.7 9.3H8c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h400.5c17 0 33.4-5.8 46.6-16.4L556 415c12.2-9.8 19.5-24.4 20-40s-6-30.8-17.7-41.4z"/></svg>'
111
+ ),
112
+ array(
113
+ 'title' => __( 'Couriers', 'flexible-shipping' ),
114
+ 'heading' => __( 'Couriers', 'flexible-shipping' ),
115
+ 'description' => $couriers_description,
116
+ 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M632 384h-24V275.9c0-16.8-6.8-33.3-18.8-45.2l-83.9-83.9c-11.8-12-28.3-18.8-45.2-18.8H416V78.6c0-25.7-22.2-46.6-49.4-46.6H49.4C22.2 32 0 52.9 0 78.6v290.8C0 395.1 22.2 416 49.4 416h16.2c-1.1 5.2-1.6 10.5-1.6 16 0 44.2 35.8 80 80 80s80-35.8 80-80c0-5.5-.6-10.8-1.6-16h195.2c-1.1 5.2-1.6 10.5-1.6 16 0 44.2 35.8 80 80 80s80-35.8 80-80c0-5.5-.6-10.8-1.6-16H632c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8zM460.1 160c8.4 0 16.7 3.4 22.6 9.4l83.9 83.9c.8.8 1.1 1.9 1.8 2.8H416v-96h44.1zM144 480c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm63.6-96C193 364.7 170 352 144 352s-49 12.7-63.6 32h-31c-9.6 0-17.4-6.5-17.4-14.6V78.6C32 70.5 39.8 64 49.4 64h317.2c9.6 0 17.4 6.5 17.4 14.6V384H207.6zM496 480c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm0-128c-26.1 0-49 12.7-63.6 32H416v-96h160v96h-16.4c-14.6-19.3-37.5-32-63.6-32z"/></svg>'
117
+ )
118
+ );
119
+
120
+ $content = array_merge( $fs_content, $boxes_content );
121
+ ?>
122
+ <div class="fs-connect__inner-container">
123
+ <div class="fs-connect__vertical-nav">
124
+ <div class="fs-connect__vertical-nav-container">
125
+ <?php
126
+ $count = 1;
127
+
128
+ foreach ( $content as $key => $value ) :
129
+ ?>
130
+ <div class="vertical-menu__feature-item <?php if ( $count === 1 ) : ?>vertical-menu__feature-item-is-selected<?php endif; ?>">
131
+ <div class="vertical-menu__feature-item-icon">
132
+ <?php echo $value['icon']; ?>
133
+ </div>
134
+
135
+ <span class="vertical-menu__feature-item-label"><?php echo $value['title']; ?></span>
136
+ </div>
137
+ <?php
138
+ $count++;
139
+
140
+ endforeach;
141
+ ?>
142
+ </div>
143
+ </div>
144
+
145
+ <div class="fs-connect__content-container">
146
+ <?php
147
+ $count = 1;
148
+
149
+ foreach ( $content as $key => $value ) :
150
+ ?>
151
+ <div class="fs-connect__slide <?php if ( $count === 1 ) : ?>fs__slide-is-active<?php endif; ?>">
152
+ <h2><?php echo $value['heading']; ?></h2>
153
+
154
+ <?php if ( $count != 7 ) : ?>
155
+ <div class="fs-connect__content-icon fs-connect-illo">
156
+ <?php echo $value['icon']; ?>
157
+ </div>
158
+ <?php endif; ?>
159
+
160
+ <p><?php echo $value['description']; ?></p>
161
+
162
+ <p class="fs-banner__button-container">
163
+ <a class="button button-primary button-large" href="<?php echo add_query_arg( 'page', WPDesk_Flexible_Shipping_SaaS_User_Registration::REGISTER_PAGE_SLUG, admin_url( 'admin.php' ) ); ?>"><?php _e( 'Sign up for Connect', 'flexible-shipping' ); ?></a>
164
+
165
+ <?php $button_text = $count === 1 ? __( 'Start quick tour', 'flexible-shipping' ) : __( 'Next feature', 'flexible-shipping' ); ?>
166
+
167
+ <?php if ( $count != 7 ) : ?>
168
+ <a class="button next-feature" href="#"><?php echo $button_text; ?></a>
169
+ <?php endif; ?>
170
+ </p>
171
+ </div>
172
+ <?php
173
+ $count++;
174
+
175
+ endforeach;
176
+ ?>
177
+ </div>
178
+ </div>
classes/saas/views/html-flexible-shipping-connect-second-notice.php ADDED
@@ -0,0 +1 @@
 
1
+ You never sing up to Flexible Shipping Connect. You may finish the registration process here <a href="<?php echo $link; ?>" class="button button-primary">Sign up for Connect</a>
classes/saas/views/html-order-fallback-message.php ADDED
@@ -0,0 +1 @@
 
1
+ <div class="fs-order-item-fallback"><strong><?php _e( 'Fallback:', 'flexible-shipping' ); ?></strong> <?php echo $fallback ;?></div>
classes/saas/views/html-order-free-shipping.php ADDED
@@ -0,0 +1 @@
 
1
+ <div class="fs-order-item-fallback"><strong><?php _e( 'Free shipping', 'flexible-shipping' ); ?></strong></div>
classes/saas/views/html-registration-page.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( $saas_connected ) : ?>
2
+ <div class="fs-page-wrap">
3
+ <div class="fs-box">
4
+ <p><?php printf( __( 'You are connected. %1$sGo to Flexible Shipping Connect settings &rarr;%2$s', 'flexible-shipping' ), '<a href="' . $settings_url . '">', '</a>' ); ?>
5
+ </div>
6
+ </div>
7
+ <?php else : ?>
8
+ <div id="register" class="wrap">
9
+ <div class="fs-page-wrap">
10
+ <h1><?php _e( 'Join Flexible Shipping Connect Now!', 'flexible-shipping' ); ?></h1>
11
+
12
+ <div class="fs-box">
13
+ <form id="flexible_shipping_signup_form" action="<?php echo $action; ?>" method="POST">
14
+ <?php wp_nonce_field( WPDesk_Flexible_Shipping_SaaS_User_Registration::NONCE_REGISTRATION_ACTION, WPDesk_Flexible_Shipping_SaaS_User_Registration::NONCE_REGISTRATION_NAME ); ?>
15
+
16
+ <h3><?php printf( __( 'Sign up for automatic shipments, label printing, live rates and more!', 'flexible-shipping' ), '<a href="' . $url_fs_com . '" target="_blank">', '</a>' ); ?></h3>
17
+
18
+ <p><small><?php printf( __( 'By signing up, you agree to the %1$sTerms of Service%3$s and to %2$sPrivacy Policy%3$s', 'flexible-shipping' ), '<a href="' . $url_terms . '" target="_blank">', '<a href="' . $url_privacy . '" target="_blank">', '</a>' ); ?></small></p>
19
+
20
+ <p><input class="regular-text" type="email" required="required" name="user_email" value="<?php echo $user_email; ?>" /></p>
21
+
22
+ <p class="fs-actions">
23
+ <button id="flexible_shipping_signup" class="button button-primary button-large" type="submit"><?php _e( 'Sign Up', 'flexible-shipping' ); ?></button>
24
+
25
+ <span class="spinner"></span>
26
+ </p>
27
+
28
+ </form>
29
+ </div>
30
+
31
+ <?php
32
+ $button_class = '';
33
+ $button_link = '#register';
34
+ include( 'html-boxes-content.php' );
35
+ ?>
36
+ </div>
37
+ </div>
38
+
39
+ <script type="text/javascript">
40
+ jQuery('#flexible_shipping_signup_form').on('submit', function(e){
41
+ jQuery('#flexible_shipping_signup').prop('disabled', 'disabled');
42
+ jQuery('.spinner').css('visibility', 'visible');
43
+ });
44
+ </script>
45
+ <?php endif; ?>
classes/saas/views/html-saas-connection-form.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php wp_nonce_field( WPDesk_Flexible_Shipping_SaaS_Connection::NONCE_CONNECTION_ACTION, WPDesk_Flexible_Shipping_SaaS_Connection::NONCE_CONNECTION_NAME ); ?>
2
+ <input type="hidden" id="<?php echo WPDesk_Flexible_Shipping_SaaS_Connection::SUBMIT_CONNECTION_PARAMETER; ?>" name="<?php echo WPDesk_Flexible_Shipping_SaaS_Connection::SUBMIT_CONNECTION_PARAMETER; ?>" value="0" />
3
+ <table class="form-table">
4
+ <tr valign="top">
5
+ <th scope="row" class="titledesc">
6
+ <label for="api_key"><?php _e( 'Connect Key', 'flexible-shipping' ); ?></label>
7
+ </th>
8
+ <td class="forminp">
9
+ <input class="input-text regular-input " type="text" name="api_key" id="api_key" value="<?php echo $api_key ?>" <?php echo $readonly;?> />
10
+ </td>
11
+ </tr>
12
+ </table>
13
+
14
+ <p class="flexible-shipping-connect-submit">
15
+ <input type="submit" id="<?php echo $button_id; ?>" class="button-primary woocommerce-save-button" value="<?php echo $submit_button_value; ?>" />
16
+ <?php ?>
17
+ </p>
18
+
19
+ <script type="text/javascript">
20
+ jQuery(document).ready(function(){
21
+ jQuery('#<?php echo WPDesk_Flexible_Shipping_SaaS_Connection::BUTTON_ID_DISCONNECT; ?>').click(function(e){
22
+ if ( !confirm( '<?php _e( 'Are you sure you want do disconnect your store from Flexible Shipping Connect?\n\nAll shipping services will be disabled.', 'flexible-shipping' ); ?>' ) ) {
23
+ e.preventDefault();
24
+ return false;
25
+ }
26
+ else {
27
+ jQuery('#<?php echo WPDesk_Flexible_Shipping_SaaS_Connection::SUBMIT_CONNECTION_PARAMETER; ?>').val('1');
28
+ }
29
+ });
30
+ function api_key_key_up() {
31
+ var button_connect = jQuery('#<?php echo WPDesk_Flexible_Shipping_SaaS_Connection::BUTTON_ID_CONNECT; ?>');
32
+ if ( jQuery('#api_key').val() != '' ) {
33
+ button_connect.prop('disabled', false);
34
+ }
35
+ else {
36
+ button_connect.prop('disabled', true);
37
+ }
38
+ }
39
+ api_key_key_up();
40
+ jQuery('#api_key').keyup(function(){
41
+ api_key_key_up();
42
+ })
43
+ jQuery('#api_key').change(function(){
44
+ api_key_key_up();
45
+ })
46
+ jQuery('#<?php echo WPDesk_Flexible_Shipping_SaaS_Connection::BUTTON_ID_CONNECT; ?>').click(function(){
47
+ jQuery('#<?php echo WPDesk_Flexible_Shipping_SaaS_Connection::SUBMIT_CONNECTION_PARAMETER; ?>').val('1');
48
+ });
49
+ })
50
+ </script>
classes/saas/views/html-settings-connect-script.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Fake saas_connected - always true for debug mode settings. */
3
+ $saas_connected = true;
4
+ ?>
5
+ <script type="text/javascript">
6
+ jQuery(document).ready(function () {
7
+ <?php if ( $saas_connected ) : ?>
8
+ <?php else : ?>
9
+ jQuery('p.submit').hide();
10
+ <?php endif; ?>
11
+ })
12
+ </script>
classes/saas/views/html-shipping-method-info-description.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Fake saas_connected - always true for debug mode settings. */
3
+ $saas_connected = true;
4
+
5
+ $pl = get_locale() === 'pl_PL';
6
+ $youtube_url = 'https://www.youtube.com/embed/qsFvYoiNDgU';
7
+ $general_settings_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=general-settings#Ustawienia_glowne' : 'https://docs.flexibleshipping.com/article/25-general-settings/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=general-settings&utm_content=fs-configuration-flexibleshippingtablerate';
8
+ $adding_a_shipping_method_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=adding-a-shipping-method#Metody_wysylki' : 'https://docs.flexibleshipping.com/article/29-shipping-methods/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=adding-a-shipping-method&utm_content=fs-configuration-flexibleshippingtablerate';
9
+ $currency_support_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=currency-support#Waluty' : 'https://docs.flexibleshipping.com/article/30-currency-support/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=currency-support&utm_content=fs-configuration-flexibleshippingtablerate';
10
+ $weight_based_shipping_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=weight-based-shipping#Koszt_na_wage' : 'https://docs.flexibleshipping.com/article/32-weight-based-shipping-woocommerce/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=weight-based-shipping&utm_content=fs-configuration-flexibleshippingtablerate';
11
+ $shipping_insurance_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=shipping-insurance#Ubezpieczenie_przesylki' : 'https://docs.flexibleshipping.com/article/34-shipping-insurance/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=shipping-insurance&utm_content=fs-configuration-flexibleshippingtablerate';
12
+ $conditional_cash_on_delivery_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=conditional-cash-on-delivery#Przesylka_za_pobraniem' : 'https://docs.flexibleshipping.com/article/35-conditional-cash-on-delivery/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=contitional-cash-on-delivery&utm_content=fs-configuration-flexibleshippingtablerate';
13
+ ?>
14
+
15
+ <?php if ( $saas_connected ) : ?>
16
+ </table>
17
+ </div><!-- Closes .fs-services -->
18
+ <?php endif; ?>
19
+
20
+ <?php
21
+ if ( ! $saas_connected ) {
22
+ $button_class = 'button-primary';
23
+ $button_link = add_query_arg( 'page', WPDesk_Flexible_Shipping_SaaS_User_Registration::REGISTER_PAGE_SLUG, admin_url( 'admin.php' ) );
24
+ include( 'html-boxes-content.php' );
25
+ }
26
+ ?>
27
+
28
+ <div class="fs-box">
29
+ <h3 class="wc-settings-sub-title">Flexible Shipping Table Rate</h3>
30
+
31
+ <ol>
32
+ <li>
33
+ <?php
34
+ echo sprintf(
35
+ __( 'To add first Flexible Shipping method go to %sShipping zones%s and add Flexible Shipping to a shipping zone.', 'flexible-shipping' ),
36
+ '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section' ) . '">',
37
+ '</a>'
38
+ );
39
+ ?>
40
+ </li>
41
+
42
+ <li><?php _e( 'You can start the configuration by clicking the Flexible Shipping link in the Shipping methods table.', 'flexible-shipping' ); ?></li>
43
+ </ol>
44
+
45
+ <h4><?php _e( 'Quick Video Overview', 'flexible-shipping' ); ?></h4>
46
+
47
+ <div class="flexible-shipping-video">
48
+ <iframe width="688" height="387" src="<?php echo $youtube_url?>?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
49
+ </div>
50
+
51
+ <h4><?php _e( 'More resources', 'flexible-shipping' ); ?></h4>
52
+
53
+ <ul>
54
+ <li><a href="<?php echo $general_settings_url; ?>"><?php _e( 'General Settings', 'flexible-shipping' ); ?></a></li>
55
+ <li><a href="<?php echo $adding_a_shipping_method_url; ?>"><?php _e( 'Adding a shipping method', 'flexible-shipping' ); ?></a></li>
56
+ <li><a href="<?php echo $currency_support_url; ?>"><?php _e( 'Currency Support', 'flexible-shipping' ); ?></a></li>
57
+ <li><a href="<?php echo $weight_based_shipping_url; ?>"><?php _e( 'Weight Based Shipping', 'flexible-shipping' ); ?></a></li>
58
+ <li><a href="<?php echo $shipping_insurance_url; ?>"><?php _e( 'Shipping Insurance', 'flexible-shipping' ); ?></a></li>
59
+ <li><a href="<?php echo $conditional_cash_on_delivery_url; ?>"><?php _e( 'Conditional Cash on Delivery', 'flexible-shipping' ); ?></a></li>
60
+ </ul>
61
+ </div>
62
+
63
+ <script type="text/javascript">
64
+ jQuery(document).ready(function() {
65
+ //jQuery('.woocommerce-save-button').hide();
66
+ jQuery('#mainform p.submit').appendTo( jQuery('.fs-box.fs-services') );
67
+ })
68
+ </script>
69
+
70
+ </div><!-- Closes .fs-page-wrap -->
71
+
72
+ <table>
classes/settings/flexible-shipping.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
 
7
- $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
8
 
9
  $docs_link .= '?utm_source=flexible-shipping-settings&utm_medium=link&utm_campaign=flexible-shipping-docs-link';
10
 
4
  exit;
5
  }
6
 
7
+ $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://docs.flexibleshipping.com/collection/20-fs-table-rate/';
8
 
9
  $docs_link .= '?utm_source=flexible-shipping-settings&utm_medium=link&utm_campaign=flexible-shipping-docs-link';
10
 
classes/settings/shipping-method-form.php CHANGED
@@ -14,16 +14,38 @@ foreach ( WC()->shipping->get_shipping_classes() as $shipping_class ) {
14
 
15
  $base_location = wc_get_base_location();
16
 
 
 
 
 
 
 
17
  switch ( $base_location['country'] ) {
18
  case 'PL':
19
- $integrations = __( 'Integrate with DPD, DHL, InPost, eNadawca Poczta Polska, Paczka w Ruchu.', 'flexible-shipping' ) . '&nbsp;&nbsp;' . sprintf( __( '%sAdd integrations%s', 'flexible-shipping' ), '<a class="button button-primary" href="https://www.wpdesk.pl/kategoria-produktu/wysylka/?utm_source=flexible-shipping-method&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">', ' &rarr;</a>' );
20
  break;
21
  case 'GB':
22
- $integrations = __( 'Integrate with DPD.', 'flexible-shipping' ) . '&nbsp;&nbsp;' . sprintf( __( '%sAdd integration%s', 'flexible-shipping' ), '<a class="button button-primary" href="https://www.wpdesk.net/products/dpd-uk-woocommerce/?utm_source=flexible-shipping-method&utm_medium=button&utm_campaign=flexible-shipping-integrations" target="_blank">', ' &rarr;</a>' );
23
  break;
24
  default:
25
- $integrations = '';
26
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
  $integrations_tip = $integrations ? false : true;
@@ -159,9 +181,9 @@ if ( class_exists('WC_Shipping_Zones1') ) {
159
  return $settings_with_zones;
160
  }
161
 
162
- $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/';
163
 
164
- $docs_link .= '?utm_source=flexible-shipping-settings&utm_medium=link&utm_campaign=flexible-shipping-docs-link';
165
 
166
  echo '<p>' . sprintf( __( 'See how to %sconfigure shipment methods%s.', 'flexible-shipping' ), '<a href="' . $docs_link . '" target="_blank">', '</a>' ) . '</p>';
167
 
14
 
15
  $base_location = wc_get_base_location();
16
 
17
+ $platform_links = new WPDesk_Flexible_Shipping_SaaS_Platform_Links();
18
+
19
+ $saas_connection = new WPDesk_Flexible_Shipping_SaaS_Connection();
20
+
21
+ $integrations = '';
22
+
23
  switch ( $base_location['country'] ) {
24
  case 'PL':
25
+ $integrations = __( 'Integrate with DPD, DHL, InPost, eNadawca Poczta Polska, Paczka w Ruchu.', 'flexible-shipping' ) . '&nbsp;&nbsp;' . sprintf( __( '%sAdd integrations%s', 'flexible-shipping' ), '<a class="button button-primary" href="https://www.wpdesk.pl/kategoria-produktu/wysylka/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=&utm_content=fs-shipping-integrations" target="_blank">', ' &rarr;</a>' );
26
  break;
27
  case 'GB':
28
+ $integrations = __( 'Integrate with DPD.', 'flexible-shipping' ) . '&nbsp;&nbsp;' . sprintf( __( '%sAdd integration%s', 'flexible-shipping' ), '<a class="button button-primary" href="https://flexibleshipping.com/table-rate/?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=&utm_content=fs-shipping-integrations" target="_blank">', ' &rarr;</a>' );
29
  break;
30
  default:
31
+ if ( ! $saas_connection->is_connected() ) {
32
+ $integrations = sprintf(
33
+ // Translators: URLs.
34
+ __( 'Ship your orders faster with %1$sFlexible Shipping Connect%2$s%3$s%4$sSign up now!%5$s', 'flexible-shipping' ),
35
+ '<a target="_blank" href="' . $platform_links->add_utm(
36
+ $platform_links->get_connect(),
37
+ 'fs-shipping-integrations',
38
+ 'flexible-shipping',
39
+ 'link',
40
+ 'user-site',
41
+ ''
42
+ ) . '">',
43
+ '</a>',
44
+ '&nbsp;&nbsp;',
45
+ '<a class="button button-primary" href="' . admin_url( 'admin.php?page=' . WPDesk_Flexible_Shipping_SaaS_User_Registration::REGISTER_PAGE_SLUG ) . '" target="_blank">'
46
+ , '</a>'
47
+ );
48
+ }
49
  }
50
 
51
  $integrations_tip = $integrations ? false : true;
181
  return $settings_with_zones;
182
  }
183
 
184
+ $docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://docs.flexibleshipping.com/article/29-shipping-methods/';
185
 
186
+ $docs_link .= '?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=configure-shipment-methods&utm_content=fs-shippingzone-addnew-seehow';
187
 
188
  echo '<p>' . sprintf( __( 'See how to %sconfigure shipment methods%s.', 'flexible-shipping' ), '<a href="' . $docs_link . '" target="_blank">', '</a>' ) . '</p>';
189
 
classes/shipment/ajax.php CHANGED
@@ -8,7 +8,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment_Ajax' ) ) {
8
 
9
  private $plugin = null;
10
 
11
- public function __construct( WPDesk_Flexible_Shipping_Plugin $plugin ) {
12
  $this->plugin = $plugin;
13
  $this->hooks();
14
  }
@@ -55,7 +55,10 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment_Ajax' ) ) {
55
  $json['message'] = __( 'Created', 'flexible-shipping' );
56
  }
57
  }
58
- $json['status'] = 'success';
 
 
 
59
  }
60
  catch ( Exception $e ) {
61
  $json['status'] = 'fail';
8
 
9
  private $plugin = null;
10
 
11
+ public function __construct( Flexible_Shipping_Plugin $plugin ) {
12
  $this->plugin = $plugin;
13
  $this->hooks();
14
  }
55
  $json['message'] = __( 'Created', 'flexible-shipping' );
56
  }
57
  }
58
+ $json['status'] = 'success';
59
+ if ( ! empty( $ajax_request['status'] ) ) {
60
+ $json['status'] = $ajax_request['status'];
61
+ }
62
  }
63
  catch ( Exception $e ) {
64
  $json['status'] = 'fail';
classes/shipment/class-cancel-shipment-exception.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Send_Shipment_Exception
5
+ */
6
+ class WPDesk_Flexible_Shipping_Cancel_Shipment_Exception extends RuntimeException {
7
+ }
classes/shipment/class-get-label-exception.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Send_Shipment_Exception
5
+ */
6
+ class WPDesk_Flexible_Shipping_Get_Label_Exception extends RuntimeException {
7
+ }
classes/shipment/class-label-not-available-exception.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Send_Shipment_Exception
5
+ */
6
+ class WPDesk_Flexible_Shipping_Label_Not_Available_Exception extends RuntimeException {
7
+ }
classes/shipment/class-money-formatter.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Money_Formatter
5
+ */
6
+ class WPDesk_Flexible_Shipping_Money_Formatter {
7
+
8
+ /**
9
+ * Money.
10
+ *
11
+ * @var \Money\Money
12
+ */
13
+ private $money;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_Money_Formatter constructor.
17
+ *
18
+ * @param \Money\Money $money Money.
19
+ */
20
+ public function __construct( Money\Money $money ) {
21
+ $this->money = $money;
22
+ }
23
+
24
+ /**
25
+ * Format as money string.
26
+ *
27
+ * @return null|string
28
+ */
29
+ public function format() {
30
+ if ( ! empty( $this->money ) ) {
31
+ if ( class_exists( 'NumberFormatter' ) ) {
32
+ $currencies = new \Money\Currencies\ISOCurrencies();
33
+ $number_formatter = new NumberFormatter( get_locale(), NumberFormatter::CURRENCY );
34
+ $money_formatter = new \Money\Formatter\IntlMoneyFormatter( $number_formatter, $currencies );
35
+ return $money_formatter->format( $this->money );
36
+ } else {
37
+ return wc_price( $this->money->getAmount() / 100, array( 'currency' => trim( $this->money->getCurrency() ) ) );
38
+ }
39
+ }
40
+ return null;
41
+
42
+ }
43
+
44
+ }
classes/shipment/class-send-shipment-exception.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Send_Shipment_Exception
5
+ */
6
+ class WPDesk_Flexible_Shipping_Send_Shipment_Exception extends RuntimeException {
7
+ }
classes/shipment/class-shipment-counter.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Shipment_Counter
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Counter {
7
+
8
+ const COUNTER_SHIPMENTS = 'shipments';
9
+ const FIRST_SHIPMENT = 'first_shipment';
10
+ const LAST_SHIPMENT = 'last_shipment';
11
+ const ALL_SHIPMENTS = 'all_shipments';
12
+ const STATUS = 'status';
13
+
14
+
15
+ /**
16
+ * Integration.
17
+ *
18
+ * @var string
19
+ */
20
+ private $integration;
21
+
22
+ /**
23
+ * Wpdb.
24
+ *
25
+ * @var wpdb
26
+ */
27
+ private $wpdb;
28
+
29
+ /**
30
+ * WPDesk_Flexible_Shipping_Shipment_Counter constructor.
31
+ *
32
+ * @param string $integration Integration.
33
+ * @param wpdb $wpdb wpdb.
34
+ */
35
+ public function __construct( $integration, $wpdb ) {
36
+ $this->integration = $integration;
37
+ $this->wpdb = $wpdb;
38
+ }
39
+
40
+ /**
41
+ * Set counters from row.
42
+ *
43
+ * @param array $counters Counters.
44
+ * @param object $row Row.
45
+ *
46
+ * @return array
47
+ */
48
+ private function set_counters( array $counters, $row ) {
49
+ $counters[ self::STATUS ][ $row->shipment_status ] = array(
50
+ self::COUNTER_SHIPMENTS => $row->shipments,
51
+ self::FIRST_SHIPMENT => $row->first_shipment,
52
+ self::LAST_SHIPMENT => $row->last_shipment,
53
+ );
54
+
55
+ $counters[ self::ALL_SHIPMENTS ] = $counters[ self::ALL_SHIPMENTS ] + $row->shipments;
56
+ $counters[ self::FIRST_SHIPMENT ] = ! isset( $counters[ self::FIRST_SHIPMENT ] ) ? $row->first_shipment : min( $counters[ self::FIRST_SHIPMENT ], $row->first_shipment );
57
+ $counters[ self::LAST_SHIPMENT ] = ! isset( $counters[ self::LAST_SHIPMENT ] ) ? $row->last_shipment : max( $counters[ self::LAST_SHIPMENT ], $row->last_shipment );
58
+
59
+ return $counters;
60
+ }
61
+
62
+ /**
63
+ * Count shipments.
64
+ *
65
+ * @return array
66
+ */
67
+ public function count_shipments() {
68
+ $counters = array( self::ALL_SHIPMENTS => 0 );
69
+ $query = $this->wpdb->get_results(
70
+ $this->wpdb->prepare(
71
+ "SELECT count(p.ID) AS shipments, p.post_status AS shipment_status, min(p.post_date) AS first_shipment, max(p.post_date) AS last_shipment
72
+ FROM {$this->wpdb->posts} p, {$this->wpdb->postmeta} m
73
+ WHERE p.post_type = %s
74
+ AND p.ID = m.post_id
75
+ AND m.meta_key = %s
76
+ AND m.meta_value = %s
77
+ GROUP BY p.post_status",
78
+ WPDesk_Flexible_Shipping_Shipment_CPT::POST_TYPE_SHIPMENT,
79
+ '_integration',
80
+ $this->integration
81
+ )
82
+ );
83
+ if ( $query ) {
84
+ foreach ( $query as $row ) {
85
+ $counters = $this->set_counters( $counters, $row );
86
+ }
87
+ }
88
+ return $counters;
89
+ }
90
+
91
+ }
classes/shipment/class-shipment-plan-exceeded-exception.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Send_Shipment_Exception
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Plan_Exceeded_Exception extends RuntimeException {
7
+ }
classes/shipment/class-shipment-request-fields.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Shipment_Saas_Shipment_Fields
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Request_Fields {
7
+
8
+ /**
9
+ * Shipment.
10
+ *
11
+ * @var WPDesk_Flexible_Shipping_Shipment_Saas
12
+ */
13
+ private $shipment;
14
+
15
+ /**
16
+ * Shipment request.
17
+ *
18
+ * @var \WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest Shipment request.
19
+ */
20
+ private $shipment_request;
21
+
22
+ /**
23
+ * WPDesk_Flexible_Shipping_Shipment_Request_Fields constructor.
24
+ *
25
+ * @param WPDesk_Flexible_Shipping_Shipment_Saas $shipment Shipment.
26
+ * @param \WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest $shipment_request Shipment request.
27
+ *
28
+ * @return WPDesk_Flexible_Shipping_Shipment_Request_Fields
29
+ */
30
+ public function __construct(
31
+ WPDesk_Flexible_Shipping_Shipment_Saas $shipment,
32
+ \WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest $shipment_request
33
+ ) {
34
+ $this->shipment = $shipment;
35
+ $this->shipment_request = $shipment_request;
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * Get field value for platform.
41
+ *
42
+ * @param array $field Field.
43
+ *
44
+ * @return string|bool
45
+ */
46
+ private function get_field_value_for_platform( array $field ) {
47
+ $field_value = $this->shipment->get_meta( $field['id'], '' );
48
+ if ( 'checkbox' === $field['type'] ) {
49
+ $field_value = 'yes' === $field_value;
50
+ }
51
+ return $field_value;
52
+ }
53
+
54
+ /**
55
+ * Prepare shipment field from send-as.
56
+ *
57
+ * @param array $field Field.
58
+ * @param string $send_as Send as field name.
59
+ * @param mixed $append_to Append to object.
60
+ */
61
+ private function prepare_shipment_field_from_send_as( array $field, $send_as, $append_to ) {
62
+ $send_as_to_array = explode( '.', $send_as );
63
+ $field_name = $send_as_to_array[0];
64
+ if ( 1 === count( $send_as_to_array ) ) {
65
+ $append_to[ $field_name ] = $this->get_field_value_for_platform( $field );
66
+ } else {
67
+ unset( $send_as_to_array[0] );
68
+ $append_to_field = $append_to[ $field_name ];
69
+ if ( empty( $append_to_field ) ) {
70
+ $append_to[ $field_name ] = new \WPDesk\SaasPlatformClient\Model\AbstractModel();
71
+ }
72
+ $this->prepare_shipment_field_from_send_as( $field, implode( '.', $send_as_to_array ), $append_to[ $field_name ] );
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Prepare shipment field.
78
+ *
79
+ * @param array $field Field.
80
+ */
81
+ private function prepare_shipment_field( array $field ) {
82
+ if ( isset( $field['send-with'] )
83
+ && ( in_array( 'shipment', $field['send-with'], true )
84
+ || in_array( 'label', $field['send-with'], true ) )
85
+ && ! in_array( 'package', $field['send-with'], true )
86
+ ) {
87
+ if ( isset( $field['send-as'] ) ) {
88
+ $this->prepare_shipment_field_from_send_as( $field, $field['send-as'], $this->shipment_request );
89
+ } else {
90
+ $this->shipment_request->{$field['id']} = $this->get_field_value_for_platform( $field );
91
+ }
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Prepare shipment fields from filedset.
97
+ *
98
+ * @param array $fieldset Fieldset.
99
+ */
100
+ private function prepare_shipment_fields_from_fieldset( array $fieldset ) {
101
+ foreach ( $fieldset['fields'] as $field ) {
102
+ $this->prepare_shipment_field( $field );
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Prepare fields from platform,
108
+ *
109
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest
110
+ */
111
+ public function prepare_shipment_fields() {
112
+ $order = $this->shipment->get_order();
113
+ $fields = $this->shipment->get_shipping_service()->get_fields_for_targets( [ $order->get_shipping_country() ] );
114
+ foreach ( $fields as $fieldset ) {
115
+ $this->prepare_shipment_fields_from_fieldset( $fieldset );
116
+ }
117
+ return $this->shipment_request;
118
+ }
119
+
120
+ }
classes/shipment/class-shipment.php CHANGED
@@ -8,7 +8,23 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment' ) ) {
8
  */
9
  abstract class WPDesk_Flexible_Shipping_Shipment {
10
 
11
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  * @var int
13
  */
14
  private $id;
@@ -67,13 +83,12 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment' ) ) {
67
  */
68
  private $order_metabox_context = 'side';
69
 
70
-
71
  /**
72
  * WPDesk_Flexible_Shipping_Shipment constructor.
73
  * @param $shipment
74
  * @param WC_Order|null $order
75
  */
76
- public function __construct( $shipment, WC_Order $order = null ) {
77
  if ( is_numeric( $shipment ) ) {
78
  $this->id = absint( $shipment );
79
  $this->post = get_post( $this->id );
@@ -234,11 +249,11 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment' ) ) {
234
  */
235
  public function get_status_for_shipping_column() {
236
  $statuses = array(
237
- 'fs-new' => 'new',
238
- 'fs-created' => 'created',
239
- 'fs-confirmed' => 'confirmed',
240
- 'fs-failed' => 'error',
241
- 'fs-manifest' => 'manifest',
242
  );
243
  return $statuses[$this->get_status()];
244
  }
@@ -248,7 +263,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment' ) ) {
248
  * Returns URL for label
249
  */
250
  public function get_label_url() {
251
- if ( in_array( $this->get_status(), array( 'fs-new', 'fs-created', 'fs-failed' ) ) ) {
252
  return null;
253
  }
254
  $label_url = '?flexible_shipping_get_label=' . $this->get_id() . '&nonce=' . wp_create_nonce( 'flexible_shipping_get_label' ) ;
@@ -270,7 +285,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment' ) ) {
270
  }
271
 
272
  public function label_avaliable() {
273
- if ( in_array( $this->get_status(), array( 'fs-confirmed', 'fs-manifest' ) ) ) {
274
  return true;
275
  }
276
  return false;
@@ -290,5 +305,130 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Shipment' ) ) {
290
  echo '</pre>';
291
  }
292
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  }
294
  }
8
  */
9
  abstract class WPDesk_Flexible_Shipping_Shipment {
10
 
11
+ const STATUS_FS_NEW = 'fs-new';
12
+ const STATUS_FS_CREATED = 'fs-created';
13
+ const STATUS_FS_CONFIRMED = 'fs-confirmed';
14
+ const STATUS_FS_FAILED = 'fs-failed';
15
+ const STATUS_FS_MANIFEST = 'fs-manifest';
16
+
17
+ const CREATED_VIA = 'created_via';
18
+
19
+ const SENT_VIA_METABOX = 'metabox';
20
+ const SENT_VIA_BULK = 'bulk';
21
+ const SENT_VIA_AUTO = 'auto';
22
+
23
+ const SENT_VIA = '_sent_via';
24
+
25
+ const NOT_SET = 'not_set';
26
+
27
+ /**
28
  * @var int
29
  */
30
  private $id;
83
  */
84
  private $order_metabox_context = 'side';
85
 
 
86
  /**
87
  * WPDesk_Flexible_Shipping_Shipment constructor.
88
  * @param $shipment
89
  * @param WC_Order|null $order
90
  */
91
+ public function __construct( $shipment, WC_Order $order = null ) {
92
  if ( is_numeric( $shipment ) ) {
93
  $this->id = absint( $shipment );
94
  $this->post = get_post( $this->id );
249
  */
250
  public function get_status_for_shipping_column() {
251
  $statuses = array(
252
+ self::STATUS_FS_NEW => 'new',
253
+ self::STATUS_FS_CREATED => 'created',
254
+ self::STATUS_FS_CONFIRMED => 'confirmed',
255
+ self::STATUS_FS_FAILED => 'error',
256
+ self::STATUS_FS_MANIFEST => 'manifest',
257
  );
258
  return $statuses[$this->get_status()];
259
  }
263
  * Returns URL for label
264
  */
265
  public function get_label_url() {
266
+ if ( in_array( $this->get_status(), array( self::STATUS_FS_NEW, self::STATUS_FS_CREATED, self::STATUS_FS_FAILED ) ) ) {
267
  return null;
268
  }
269
  $label_url = '?flexible_shipping_get_label=' . $this->get_id() . '&nonce=' . wp_create_nonce( 'flexible_shipping_get_label' ) ;
285
  }
286
 
287
  public function label_avaliable() {
288
+ if ( in_array( $this->get_status(), array( self::STATUS_FS_CONFIRMED, self::STATUS_FS_MANIFEST ) ) ) {
289
  return true;
290
  }
291
  return false;
305
  echo '</pre>';
306
  }
307
 
308
+ /**
309
+ * Is status fs-new?
310
+ *
311
+ * @return bool
312
+ */
313
+ public function is_status_fs_new() {
314
+ return self::STATUS_FS_NEW === $this->get_status();
315
+ }
316
+
317
+ /**
318
+ * Is status fs-created?
319
+ *
320
+ * @return bool
321
+ */
322
+ public function is_status_fs_created() {
323
+ return self::STATUS_FS_CREATED === $this->get_status();
324
+ }
325
+
326
+ /**
327
+ * Is status fs-confirmed?
328
+ *
329
+ * @return bool
330
+ */
331
+ public function is_status_fs_confirmed() {
332
+ return self::STATUS_FS_CONFIRMED === $this->get_status();
333
+ }
334
+
335
+ /**
336
+ * Is status fs-failed?
337
+ *
338
+ * @return bool
339
+ */
340
+ public function is_status_fs_failed() {
341
+ return self::STATUS_FS_FAILED === $this->get_status();
342
+ }
343
+
344
+ /**
345
+ * Is status fs-manifest?
346
+ *
347
+ * @return bool
348
+ */
349
+ public function is_status_fs_manifest() {
350
+ return self::STATUS_FS_MANIFEST === $this->get_status();
351
+ }
352
+
353
+ /**
354
+ * Set created via.
355
+ *
356
+ * @param string $created_via Created via.
357
+ */
358
+ public function set_created_via( $created_via ) {
359
+ $this->set_meta( self::CREATED_VIA, $created_via );
360
+ }
361
+
362
+ /**
363
+ * Set created via checkout.
364
+ */
365
+ public function set_created_via_checkout() {
366
+ $this->set_created_via( 'checkout' );
367
+ }
368
+
369
+ /**
370
+ * Set created via add shipment.
371
+ */
372
+ public function set_created_via_add_shipment() {
373
+ $this->set_created_via( 'add_shipment' );
374
+ }
375
+
376
+ /**
377
+ * Get created via.
378
+ *
379
+ * @return string
380
+ */
381
+ public function get_created_via() {
382
+ return $this->get_meta( self::CREATED_VIA, self::NOT_SET );
383
+ }
384
+
385
+ /**
386
+ * Set sent via.
387
+ *
388
+ * @param string $sent_via
389
+ */
390
+ public function set_sent_via( $sent_via ) {
391
+ $this->set_meta( self::SENT_VIA, $sent_via );
392
+ }
393
+
394
+ /**
395
+ * Set sent via bulk.
396
+ */
397
+ public function set_sent_via_bulk() {
398
+ $this->set_sent_via( self::SENT_VIA_BULK );
399
+ }
400
+
401
+ /**
402
+ * Set sent via auto.
403
+ */
404
+ public function set_sent_via_auto() {
405
+ $this->set_sent_via( self::SENT_VIA_AUTO );
406
+ }
407
+
408
+ /**
409
+ * Set sent via metabox.
410
+ */
411
+ public function set_sent_via_metabox() {
412
+ $this->set_sent_via( self::SENT_VIA_METABOX );
413
+ }
414
+
415
+ /**
416
+ * Get sent via.
417
+ *
418
+ * @return string
419
+ */
420
+ public function get_sent_via() {
421
+ return $this->get_meta( self::SENT_VIA, self::NOT_SET );
422
+ }
423
+
424
+ /**
425
+ * Get meta shipping method.
426
+ *
427
+ * @return WC_Order_Item_Shipping
428
+ */
429
+ protected function get_meta_shipping_method() {
430
+ return $this->get_meta( '_shipping_method' );
431
+ }
432
+
433
  }
434
  }
classes/shipment/cpt-shipment.php CHANGED
@@ -4,7 +4,9 @@ if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
  class WPDesk_Flexible_Shipping_Shipment_CPT {
6
 
7
- private $plugin = null;
 
 
8
 
9
  /**
10
  * Is order processed on checkout?
@@ -13,7 +15,7 @@ class WPDesk_Flexible_Shipping_Shipment_CPT {
13
  */
14
  private $is_order_processed_on_checkout = false;
15
 
16
- public function __construct( WPDesk_Flexible_Shipping_Plugin $plugin ) {
17
  $this->plugin = $plugin;
18
  $this->hooks();
19
  }
@@ -36,11 +38,11 @@ class WPDesk_Flexible_Shipping_Shipment_CPT {
36
  */
37
  public function register_post_types() {
38
 
39
- if ( post_type_exists( 'shipment' ) ) {
40
  return;
41
  }
42
 
43
- register_post_type( 'shipment',
44
  array(
45
  'labels' => array(
46
  'name' => __( 'Shipments', 'flexible-shipping' ),
@@ -126,12 +128,12 @@ class WPDesk_Flexible_Shipping_Shipment_CPT {
126
  }
127
 
128
  public function add_meta_boxes( $post_type, $post ) {
129
- if ( $post_type == 'shipment' ) {
130
  add_meta_box(
131
  'shipment_meta_box',
132
  __('Shipment data', 'flexible-shipping'),
133
  array( $this, 'metabox' ),
134
- 'shipment',
135
  'normal',
136
  'high'
137
  );
@@ -155,7 +157,12 @@ class WPDesk_Flexible_Shipping_Shipment_CPT {
155
  }
156
 
157
  public function order_metabox( $post, $args ) {
 
158
  $shipment = $args['args']['shipment'];
 
 
 
 
159
  include( 'views/order-metabox.php' );
160
  }
161
 
@@ -259,6 +266,7 @@ class WPDesk_Flexible_Shipping_Shipment_CPT {
259
  $shipment->set_meta( '_shipping_method', $shipping_method );
260
  $shipment->set_meta( '_package', $packages[ $package_id ] );
261
  $shipment->set_meta( '_packages', $packages );
 
262
  $shipment->checkout( $fs_method, $packages[ $package_id ] );
263
  $shipment->save();
264
  return $shipment;
4
 
5
  class WPDesk_Flexible_Shipping_Shipment_CPT {
6
 
7
+ const POST_TYPE_SHIPMENT = 'shipment';
8
+
9
+ private $plugin = null;
10
 
11
  /**
12
  * Is order processed on checkout?
15
  */
16
  private $is_order_processed_on_checkout = false;
17
 
18
+ public function __construct( Flexible_Shipping_Plugin $plugin ) {
19
  $this->plugin = $plugin;
20
  $this->hooks();
21
  }
38
  */
39
  public function register_post_types() {
40
 
41
+ if ( post_type_exists( self::POST_TYPE_SHIPMENT ) ) {
42
  return;
43
  }
44
 
45
+ register_post_type( self::POST_TYPE_SHIPMENT,
46
  array(
47
  'labels' => array(
48
  'name' => __( 'Shipments', 'flexible-shipping' ),
128
  }
129
 
130
  public function add_meta_boxes( $post_type, $post ) {
131
+ if ( $post_type == self::POST_TYPE_SHIPMENT ) {
132
  add_meta_box(
133
  'shipment_meta_box',
134
  __('Shipment data', 'flexible-shipping'),
135
  array( $this, 'metabox' ),
136
+ 'shipment',
137
  'normal',
138
  'high'
139
  );
157
  }
158
 
159
  public function order_metabox( $post, $args ) {
160
+ /** @var WPDesk_Flexible_Shipping_Shipment $shipment */
161
  $shipment = $args['args']['shipment'];
162
+ $shipment_id = $shipment->get_id();
163
+ $message = $shipment->get_error_message();
164
+ $message_heading = $shipment->get_order_metabox_title();
165
+ $message_css_style = '';
166
  include( 'views/order-metabox.php' );
167
  }
168
 
266
  $shipment->set_meta( '_shipping_method', $shipping_method );
267
  $shipment->set_meta( '_package', $packages[ $package_id ] );
268
  $shipment->set_meta( '_packages', $packages );
269
+ $shipment->set_created_via_checkout();
270
  $shipment->checkout( $fs_method, $packages[ $package_id ] );
271
  $shipment->save();
272
  return $shipment;
classes/shipment/functions.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
 
6
  function fs_shipment_integration_exists( $integration ) {
7
- $class_name = 'WPDesk_Flexible_Shipping_Shipment' . '_' . $integration ;
8
  if ( class_exists( $class_name ) ) {
9
  return true;
10
  }
@@ -71,9 +71,11 @@ function fs_get_order_shipments( $order_id, $integration = null ) {
71
  function fs_get_shipment( $shipment_id, WC_Order $order = null ) {
72
  $integration = get_post_meta( $shipment_id, '_integration', true );
73
  $class_name = 'WPDesk_Flexible_Shipping_Shipment';
74
- if ( class_exists( $class_name . '_' . $integration ) ) {
75
- $class_name = $class_name . '_' . $integration;
76
- }
 
 
77
  return new $class_name( $shipment_id, $order );
78
  }
79
 
4
 
5
 
6
  function fs_shipment_integration_exists( $integration ) {
7
+ $class_name = apply_filters( 'flexible_shipping_shipment_class', 'WPDesk_Flexible_Shipping_Shipment' . '_' . $integration, $integration );
8
  if ( class_exists( $class_name ) ) {
9
  return true;
10
  }
71
  function fs_get_shipment( $shipment_id, WC_Order $order = null ) {
72
  $integration = get_post_meta( $shipment_id, '_integration', true );
73
  $class_name = 'WPDesk_Flexible_Shipping_Shipment';
74
+ $integration_class_name = 'WPDesk_Flexible_Shipping_Shipment' . '_' . $integration;
75
+ $integration_class_name = apply_filters( 'flexible_shipping_shipment_class', $integration_class_name, $integration );
76
+ if ( class_exists( $integration_class_name ) ) {
77
+ $class_name = $integration_class_name;
78
+ }
79
  return new $class_name( $shipment_id, $order );
80
  }
81
 
classes/shipment/saas/class-shipment-saas-ajax.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Shipment_Saas_Ajax
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Ajax {
7
+
8
+ const META_SAAS_MESSAGE = '_saas_message';
9
+
10
+ const UPGRADE_PLAN_URL = 'https://www.flexibleshipping.com/connect/purchase/';
11
+
12
+ /**
13
+ * Shipment.
14
+ *
15
+ * @var WPDesk_Flexible_Shipping_Shipment_Saas
16
+ */
17
+ private $shipment;
18
+
19
+ /**
20
+ * Links.
21
+ *
22
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
23
+ */
24
+ private $saas_platform_links;
25
+
26
+ /**
27
+ * WPDesk_Flexible_Shipping_Shipment_Saas_Ajax constructor.
28
+ *
29
+ * @param WPDesk_Flexible_Shipping_Shipment_Saas $shipment Shipment.
30
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Platform links.
31
+ */
32
+ public function __construct(
33
+ WPDesk_Flexible_Shipping_Shipment_Saas $shipment,
34
+ WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links
35
+ ) {
36
+ $this->shipment = $shipment;
37
+ $this->saas_platform_links = $saas_platform_links;
38
+ }
39
+
40
+ /**
41
+ * Save field data.
42
+ *
43
+ * @param array $field Field.
44
+ * @param array $data Data.
45
+ */
46
+ private function save_field_data( array $field, array $data ) {
47
+ $id = $this->shipment->get_id();
48
+ $meta_value = '';
49
+ $data_name = $field['id'] . '_' . $id;
50
+ if ( isset( $data[ $data_name ] ) ) {
51
+ $meta_value = $data[ $data_name ];
52
+ }
53
+ $this->shipment->set_meta( $field['id'], $meta_value );
54
+ }
55
+
56
+ /**
57
+ * Save fieldset data.
58
+ *
59
+ * @param array $fieldset Fieldset.
60
+ * @param array $data Data.
61
+ */
62
+ private function save_fieldset_data( array $fieldset, array $data ) {
63
+ foreach ( $fieldset['fields'] as $field ) {
64
+ $this->save_field_data( $field, $data );
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Save data from metabox.
70
+ *
71
+ * @param array $data Data.
72
+ */
73
+ private function save_ajax_data( array $data ) {
74
+ $fields = $this->shipment->get_fields_for_targets();
75
+ foreach ( $fields as $fieldset ) {
76
+ if ( isset( $fieldset['show-in'] ) && in_array( 'metabox', $fieldset['show-in'], true ) ) {
77
+ $this->save_fieldset_data( $fieldset, $data );
78
+ }
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Shipment exceeded message.
84
+ *
85
+ * @return string
86
+ */
87
+ private function shipments_exceeded_message() {
88
+ return sprintf(
89
+ // Translators: link.
90
+ __( '%1$s Shipment plan exceeded. %2$sPlease upgrade your plan →%3$s', 'flexible-shipping' ),
91
+ '</p><p class="fs-saas-no-labels-left">',
92
+ '<a target="_blank" href="' . $this->saas_platform_links->add_utm(
93
+ $this->saas_platform_links->get_upgrade_plan(),
94
+ 'fs-notice-myaccount',
95
+ 'flexible-shipping',
96
+ 'link',
97
+ 'user-site',
98
+ ''
99
+ ) . '" target="blank">',
100
+ '</a>'
101
+ );
102
+ }
103
+
104
+ /**
105
+ * Save metabox data.
106
+ *
107
+ * @param array $data Data.
108
+ * @param array $response Response.
109
+ *
110
+ * @return mixed
111
+ * @throws RuntimeException Exception.
112
+ */
113
+ private function action_save( array $data, array $response ) {
114
+ $metabox_can_be_saved = $this->shipment->matabox_can_be_saved();
115
+ if ( ! $metabox_can_be_saved ) {
116
+ throw new RuntimeException( __( 'Shipment cannot be saved for this status!', 'flexible-shipping' ) );
117
+ }
118
+ $this->save_ajax_data( $data );
119
+ $this->shipment->set_meta( self::META_SAAS_MESSAGE, '' );
120
+ $this->shipment->update_status( 'fs-new' );
121
+ $this->shipment->save();
122
+ $response['status'] = 'success';
123
+ $response['message'] = __( 'Saved', 'flexible-shipping' );
124
+
125
+ return $response;
126
+ }
127
+
128
+ /**
129
+ * Action send.
130
+ *
131
+ * @param array $response Response.
132
+ *
133
+ * @return mixed
134
+ */
135
+ private function action_send( array $response ) {
136
+ try {
137
+ $shipment = $this->shipment;
138
+ $shipment->set_sent_via_metabox();
139
+ $shipment_response = $this->shipment->send_shipment();
140
+ $shipment_left = intval( $shipment_response->getShipmentCountLeft() );
141
+ $shipment_sent = intval( $shipment_response->getShipmentCountSent() );
142
+ $response['message'] = sprintf(
143
+ // Translators: shipments counts (sent/all).
144
+ __( 'Shipment created.%1$sFS Connect plan usage: %2$s/%3$s shipments', 'flexible-shipping' ),
145
+ '<br />',
146
+ $shipment_sent,
147
+ $shipment_left + $shipment_sent
148
+ );
149
+ if ( 0 === $shipment_left ) {
150
+ $response['message'] .= $this->shipments_exceeded_message();
151
+ }
152
+ } catch ( WPDesk_Flexible_Shipping_Shipment_Plan_Exceeded_Exception $e ) {
153
+ $response['status'] = 'fail';
154
+ $response['message'] = $this->shipments_exceeded_message();
155
+ } catch ( Exception $e ) {
156
+ $response['status'] = 'fail';
157
+ $response['message'] = $e->getMessage();
158
+ }
159
+
160
+ return $response;
161
+ }
162
+
163
+ /**
164
+ * Handle AJAX requests for shipment.
165
+ *
166
+ * @param string $action Action.
167
+ * @param array $data Data.
168
+ *
169
+ * @return array
170
+ *
171
+ * @throws WPDesk_Flexible_Shipping_Send_Shipment_Exception Send Shipment Exception.
172
+ * @throws RuntimeException Runtime Exception.
173
+ */
174
+ public function ajax_request( $action, $data ) {
175
+ $response = array();
176
+ if ( 'save' === $action || 'send' === $action ) {
177
+ $response = $this->action_save( $data, $response );
178
+ }
179
+ if ( 'send' === $action ) {
180
+ $response = $this->action_send( $response );
181
+ }
182
+ if ( 'cancel' === $action ) {
183
+ try {
184
+ $this->shipment->cancel_shipment();
185
+ $response['message'] = __( 'Canceled', 'flexible-shipping' );
186
+ } catch ( Exception $e ) {
187
+ $response['status'] = 'fail';
188
+ $message_formatter = new WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter(
189
+ $e->getMessage(),
190
+ $this->shipment->get_shipping_service_name()
191
+ );
192
+ $response['message'] = $message_formatter->format_to_html();
193
+ }
194
+ }
195
+
196
+ $response['content'] = $this->shipment->get_order_metabox_content();
197
+ return $response;
198
+ }
199
+
200
+ }
classes/shipment/saas/class-shipment-saas-message-formatter.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter {
7
+
8
+ /**
9
+ * Message.
10
+ *
11
+ * @var string
12
+ */
13
+ private $message;
14
+
15
+ /**
16
+ * Integration name.
17
+ *
18
+ * @var string
19
+ */
20
+ private $integration_name;
21
+
22
+ /**
23
+ * WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter constructor.
24
+ *
25
+ * @param string $message Message.
26
+ * @param string $integration_name Integration name.
27
+ */
28
+ public function __construct( $message, $integration_name ) {
29
+ $this->message = $message;
30
+ $this->integration_name = $integration_name;
31
+ }
32
+
33
+ /**
34
+ * Format error message to html.
35
+ *
36
+ * @return string
37
+ */
38
+ public function format_to_html() {
39
+ return sprintf( '%1$s%2$s:%3$s %4$s',
40
+ '<span>',
41
+ // Translators: metabox title.
42
+ sprintf( __( '%1$s notice', 'flexible-shipping' ), $this->integration_name ),
43
+ '</span>',
44
+ $this->message
45
+ );
46
+ }
47
+
48
+ }
classes/shipment/saas/class-shipment-saas-metabox.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Shipment_Saas_Metabox
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Metabox {
7
+
8
+ /**
9
+ * Shipment.
10
+ *
11
+ * @var WPDesk_Flexible_Shipping_Shipment_Saas
12
+ */
13
+ private $shipment;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_Shipment_Saas_Ajax constructor.
17
+ *
18
+ * @param WPDesk_Flexible_Shipping_Shipment_Saas $shipment Shipment.
19
+ */
20
+ public function __construct( WPDesk_Flexible_Shipping_Shipment_Saas $shipment ) {
21
+ $this->shipment = $shipment;
22
+ }
23
+
24
+ /**
25
+ * Display fieldset in order metabox.
26
+ *
27
+ * @param array $fieldset Fieldset.
28
+ * @param int $id Shipment ID.
29
+ * @param bool $disabled Disabled.
30
+ * @param array $values Values.
31
+ */
32
+ private function display_order_metabox_fieldset( array $fieldset, $id, $disabled, $values ) {
33
+ $fields = $fieldset['fields'];
34
+ $is_replicable = false;
35
+ if ( isset( $fieldset['replicable'] ) ) {
36
+ $is_replicable = true;
37
+ include 'views/order-metabox-fieldset-replicable.php';
38
+ } else {
39
+ include 'views/order-metabox-fieldset.php';
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Get order metabox content.
45
+ *
46
+ * @return string
47
+ */
48
+ public function get_order_metabox_content() {
49
+
50
+ /** Global $post is required for woocommerce_wp_text_input used in metabox. */
51
+ global $post;
52
+ if ( empty( $post ) ) {
53
+ $post = $this->shipment->get_post();
54
+ }
55
+
56
+ ob_start();
57
+
58
+ $disabled = true;
59
+ if ( $this->shipment->get_status() === 'fs-new' || $this->shipment->get_status() === 'fs-failed' ) {
60
+ $disabled = false;
61
+ }
62
+ $order = $this->shipment->get_order();
63
+ $id = $this->shipment->get_id();
64
+ $integration = $this->shipment->get_integration();
65
+ $values = $this->shipment->get_meta();
66
+ $label_url = $this->shipment->get_label_url();
67
+ $tracking_number = $this->shipment->get_tracking_number();
68
+ $tracking_url = $this->shipment->get_tracking_url();
69
+
70
+ $shipping_service = $this->shipment->get_shipping_service();
71
+
72
+ try {
73
+ $fields = $this->shipment->get_fields_for_targets();
74
+ foreach ( $fields as $fieldset ) {
75
+ if ( isset( $fieldset['show-in'] ) && in_array( 'metabox', $fieldset['show-in'], true ) ) {
76
+ $this->display_order_metabox_fieldset( $fieldset, $id, $disabled, $values );
77
+ }
78
+ }
79
+
80
+ $supports_label = $shipping_service->supports( 'supportsShipmentLabel' );
81
+ $supports_cancel = $shipping_service->supports( 'supportsShipmentCancel' );
82
+
83
+ $status = $this->shipment->get_status();
84
+ $status_text = get_post_status_object( $status )->label;
85
+
86
+ $shipment_charges = '';
87
+ $show_shipping_charges = false;
88
+ if ( ! empty( $this->shipment->get_shipment_cost_as_money() ) ) {
89
+ $shipment_charges = $this->shipment->get_shipment_cost_amount();
90
+ $show_shipping_charges = true;
91
+ }
92
+
93
+ include 'views/order-metabox-actions.php';
94
+
95
+ } catch ( Exception $e ) {
96
+ if ( $e instanceof WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception ) {
97
+ $error_message = $e->getMessage();
98
+ } elseif ( $e instanceof WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found ) {
99
+ $error_message = $shipping_service->prepare_settings_not_found_message();
100
+ } else {
101
+ $saas_connection = new WPDesk_Flexible_Shipping_SaaS_Connection();
102
+ if ( $e instanceof WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception ) {
103
+ $maintenance_context = new \WPDesk\SaasPlatformClient\Response\Maintenance\MaintenanceResponseContext( $e->get_response() );
104
+ $error_message = $saas_connection->prepare_maintenance_notice(
105
+ $maintenance_context->getMaintenanceMessage(),
106
+ $maintenance_context->getMaintenanceTill()
107
+ );
108
+ } else {
109
+ $error_message = $saas_connection->prepare_fatal_error_notice();
110
+ }
111
+ }
112
+ include 'views/order-metabox-connection-error.php';
113
+ }
114
+
115
+ $content = ob_get_contents();
116
+ ob_end_clean();
117
+
118
+ return $content;
119
+
120
+ }
121
+
122
+ }
classes/shipment/saas/class-shipment-saas-send.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPDesk_Flexible_Shipping_Shipment_Saas_Send
5
+ */
6
+ class WPDesk_Flexible_Shipping_Shipment_Saas_Send {
7
+
8
+ /**
9
+ * Shipment.
10
+ *
11
+ * @var WPDesk_Flexible_Shipping_Shipment_Saas
12
+ */
13
+ private $shipment;
14
+
15
+ /**
16
+ * WPDesk_Flexible_Shipping_Shipment_Saas_Send constructor.
17
+ *
18
+ * @param WPDesk_Flexible_Shipping_Shipment_Saas $shipment Shipment.
19
+ */
20
+ public function __construct( WPDesk_Flexible_Shipping_Shipment_Saas $shipment ) {
21
+ $this->shipment = $shipment;
22
+ }
23
+
24
+ /**
25
+ * Prepare ship to address.
26
+ *
27
+ * @param WC_Order $order Order.
28
+ *
29
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\Address
30
+ */
31
+ private function prepare_ship_to_address( WC_Order $order ) {
32
+ $ship_to_address = new \WPDesk\SaasPlatformClient\Model\Shipment\Address();
33
+ $ship_to_address->setAddressLine1( $order->get_shipping_address_1() );
34
+ $ship_to_address->setAddressLine2( $order->get_shipping_address_2() );
35
+ $ship_to_address->setPostalCode( str_replace( '-', '', $order->get_shipping_postcode() ) );
36
+ $ship_to_address->setCity( $order->get_shipping_city() );
37
+ $ship_to_address->setCountryCode( $order->get_shipping_country() );
38
+ $ship_to_address->setStateCode( $order->get_shipping_state() );
39
+
40
+ return $ship_to_address;
41
+ }
42
+
43
+ /**
44
+ * Prepare ship to actor.
45
+ *
46
+ * @param WC_Order $order Order.
47
+ *
48
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\Actor
49
+ */
50
+ private function prepare_ship_to( WC_Order $order ) {
51
+ $ship_to = new \WPDesk\SaasPlatformClient\Model\Shipment\Actor();
52
+ $ship_to->setAddress( $this->prepare_ship_to_address( $order ) );
53
+ $ship_to->setName( trim( $order->get_shipping_first_name() . ' ' . $order->get_shipping_last_name() ) );
54
+ $ship_to->setCompanyName( $order->get_shipping_company() );
55
+ $ship_to->setPhoneNumber( $order->get_billing_phone() );
56
+
57
+ return $ship_to;
58
+ }
59
+
60
+ /**
61
+ * Prepare packages.
62
+ *
63
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\Package[]
64
+ */
65
+ private function prepare_packages() {
66
+ $package = new \WPDesk\SaasPlatformClient\Model\Shipment\Package();
67
+ $package->seTtype( $this->shipment->get_meta( 'package_type' ) );
68
+ $package->setWeight( intval( wc_get_weight( floatval( $this->shipment->get_meta( 'package_weight' ) ), 'g' ) ) );
69
+ $package->setDescription( $this->shipment->get_meta( 'description' ) );
70
+
71
+ $package->dimensions = new \WPDesk\SaasPlatformClient\Model\Shipment\Package\Dimensions();
72
+ $package->dimensions->setHeight( intval( wc_get_dimension( floatval( $this->shipment->get_meta( 'height' ) ), 'mm' ) ) );
73
+ $package->dimensions->setWidth( intval( wc_get_dimension( floatval( $this->shipment->get_meta( 'width' ) ), 'mm' ) ) );
74
+ $package->dimensions->setLength( intval( wc_get_dimension( floatval( $this->shipment->get_meta( 'length' ) ), 'mm' ) ) );
75
+
76
+ $packages = array( $package );
77
+
78
+ return $packages;
79
+ }
80
+
81
+ /**
82
+ * Prepare shop data.
83
+ *
84
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\ShopData
85
+ */
86
+ private function prepare_shop_data() {
87
+ $shop_data = new \WPDesk\SaasPlatformClient\Model\Shipment\ShopData();
88
+ $shop_data->setOrderId( $this->shipment->get_order_id() );
89
+ $shop_data->setShipmentId( $this->shipment->get_id() );
90
+ return $shop_data;
91
+ }
92
+
93
+ /**
94
+ * Prepare shop flow.
95
+ *
96
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\ShopFlow
97
+ */
98
+ private function prepare_shop_flow() {
99
+ $shipment = $this->shipment;
100
+ $shop_flow = new \WPDesk\SaasPlatformClient\Model\Shipment\ShopFlow();
101
+ $shop_flow->setCreatedVia( $shipment->get_created_via() );
102
+ $shop_flow->setSentVia( $shipment->get_sent_via() );
103
+ $shop_flow->setFallback( $shipment->was_fallback() );
104
+ $shop_flow->setFallbackMessage( $shipment->get_fallback_message() );
105
+ $shop_flow->setRateType( $shipment->get_rate_type() );
106
+ $shop_flow->setCheckoutServiceType( $shipment->get_checkout_service_type() );
107
+ $shop_flow->setCheckoutServiceName( $shipment->get_checkout_service_name() );
108
+ return $shop_flow;
109
+ }
110
+
111
+ /**
112
+ * Prepare shipment request.
113
+ *
114
+ * @return \WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest
115
+ */
116
+ private function prepare_shipment_request() {
117
+
118
+ $shipment_request = new \WPDesk\SaasPlatformClient\Model\Shipment\ShipmentRequest();
119
+ $shipment_request->setShipTo( $this->prepare_ship_to( $this->shipment->get_order() ) );
120
+ $shipment_request->setPackages( $this->prepare_packages() );
121
+
122
+ $shipment_request->setServiceType( $this->shipment->get_meta( 'service_type' ) );
123
+
124
+ $shipment_request->setShopData( $this->prepare_shop_data() );
125
+ $shipment_request->setShopFlow( $this->prepare_shop_flow() );
126
+
127
+ $shipment_request_fields = new WPDesk_Flexible_Shipping_Shipment_Request_Fields( $this->shipment, $shipment_request );
128
+ $shipment_request_fields->prepare_shipment_fields();
129
+
130
+ return $shipment_request;
131
+ }
132
+
133
+ /**
134
+ * Send shipment to platform.
135
+ *
136
+ * @return WPDesk\SaasPlatformClient\Model\Shipment\ShipmentResponse
137
+ * @throws WPDesk_Flexible_Shipping_Send_Shipment_Exception Send Shipment Exception.
138
+ */
139
+ public function send() {
140
+ $shipment = $this->shipment;
141
+ $platform = $shipment->get_platform();
142
+ $shipment_request = $this->prepare_shipment_request();
143
+ $response = $platform->requestPostShipment( $shipment_request, $shipment->get_shipping_method()->get_shipping_service_id() );
144
+ if ( $response->isError() ) {
145
+ $error_body = $response->getResponseErrorBody();
146
+ $message = __( 'UPS! Something is wrong!', 'flexible-shipping' );
147
+
148
+ if ( isset( $error_body['detail'] ) ) {
149
+ $message = $error_body['detail'];
150
+ }
151
+ if ( isset( $error_body['message'] ) ) {
152
+ $message = $error_body['message'];
153
+ }
154
+ $shipment->set_meta( $shipment::META_SAAS_MESSAGE, $message );
155
+ $shipment->update_status( 'fs-failed' );
156
+ $shipment->save();
157
+ if ( $response->isShipmentPlanExceeded() ) {
158
+ throw new WPDesk_Flexible_Shipping_Shipment_Plan_Exceeded_Exception( $shipment->get_error_message(), $response->getResponseCode() );
159
+ } else {
160
+ throw new WPDesk_Flexible_Shipping_Send_Shipment_Exception( $shipment->get_error_message(), $response->getResponseCode() );
161
+ }
162
+ }
163
+
164
+ $shipment_response = $response->getShipment();
165
+ $shipment->set_saas_shipment_id( $shipment_response->getShipmentId() );
166
+ $shipment->set_tracking_number( $shipment_response->getTrackingId() );
167
+ $shipment->set_tracking_url( $shipment_response->getTrackingUrl() );
168
+ $shipment->set_shipment_cost( $shipment_response->getShipmentCost() );
169
+ $shipment->delete_meta( $shipment::META_SAAS_MESSAGE );
170
+ $shipment->update_status( 'fs-' . $shipment_response->getStatus() );
171
+ $shipment->save();
172
+
173
+ $shipment->add_order_note_shipment_created();
174
+
175
+ do_action( 'flexible_shipping_shipment_confirmed', $shipment );
176
+
177
+ return $shipment_response;
178
+ }
179
+
180
+ }
classes/shipment/saas/class-shipment-saas.php ADDED
@@ -0,0 +1,721 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Flexible Shipping SaaS Shipment.
5
+ *
6
+ * Class WPDesk_Flexible_Shipping_Shipment_Saas
7
+ */
8
+ class WPDesk_Flexible_Shipping_Shipment_Saas
9
+ extends WPDesk_Flexible_Shipping_Shipment
10
+ implements WPDesk_Flexible_Shipping_Shipment_Interface {
11
+
12
+ const META_SAAS_SHIPMENT_ID = '_saas_shipment_id';
13
+
14
+ const META_SAAS_MESSAGE = '_saas_message';
15
+
16
+ const META_SAAS_TRACKING_ID = '_saas_tracking_id';
17
+
18
+ const META_SAAS_TRACKING_URL = '_saas_tracking_url';
19
+
20
+ const META_SAAS_SHIPMENT_COST = '_saas_shipment_cost';
21
+
22
+ const FIELD_CALCULATION_METHOD = 'calculation-method';
23
+
24
+ const FLOAT_EPSILON = 0.000001;
25
+
26
+ const RATE_TYPE = 'rate_type';
27
+
28
+ const FALLBACK_MESSAGE = 'fallback_message';
29
+
30
+ const FALLBACK = 'fallback';
31
+
32
+ const CHECKOUT_SERVICE_TYPE = 'checkout_service_type';
33
+ const CHECKOUT_SERVICE_NAME = 'checkout_service_name';
34
+
35
+ /**
36
+ * Renderer.
37
+ *
38
+ * @var WPDesk\View\Renderer\Renderer;
39
+ */
40
+ private static $renderer;
41
+
42
+ /**
43
+ * Platform links.
44
+ *
45
+ * @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
46
+ */
47
+ private static $saas_platform_links;
48
+
49
+ /**
50
+ * Shipping method.
51
+ *
52
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings
53
+ */
54
+ private $shipping_method;
55
+
56
+ /**
57
+ * Shipping service.
58
+ *
59
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service
60
+ */
61
+ private $shipping_service;
62
+
63
+ /**
64
+ * Logger.
65
+ *
66
+ * @var \Psr\Log\LoggerInterface
67
+ */
68
+ private $logger;
69
+
70
+ /**
71
+ * WPDesk_Flexible_Shipping_Shipment_Saas constructor.
72
+ *
73
+ * @param int $shipment_id Shipment ID.
74
+ * @param WC_Order|null $order Order.
75
+ */
76
+ public function __construct( $shipment_id, WC_Order $order = null ) {
77
+ parent::__construct( $shipment_id, $order );
78
+ $shipping_methods = WC()->shipping()->get_shipping_methods();
79
+ $integration = $this->get_integration();
80
+ /**
81
+ * IDE Type hint.
82
+ *
83
+ * @var WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings $shipping_method
84
+ */
85
+ $shipping_method = $shipping_methods[ $integration ];
86
+ $this->shipping_method = $shipping_method;
87
+ $this->shipping_service = $shipping_method->get_shipping_service();
88
+ }
89
+
90
+ /**
91
+ * Set renderer.
92
+ *
93
+ * @param WPDesk\View\Renderer\Renderer $renderer Renderer.
94
+ */
95
+ public static function set_renderer( WPDesk\View\Renderer\Renderer $renderer ) {
96
+ self::$renderer = $renderer;
97
+ }
98
+
99
+ /**
100
+ * Set platform links.
101
+ *
102
+ * @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Platform links.
103
+ */
104
+ public static function set_platform_links( WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links ) {
105
+ self::$saas_platform_links = $saas_platform_links;
106
+ }
107
+
108
+ /**
109
+ * Save field data from shipping method.
110
+ *
111
+ * @param array $field Field.
112
+ * @param array $fs_method Flexible Shipping Method settings.
113
+ * @param WC_Order_Item_Shipping $shipping_method Woocommerce shipping method.
114
+ * @param float $package_weight Package weight.
115
+ */
116
+ private function save_field_data_from_shipping_method( array $field, array $fs_method, $shipping_method, $package_weight = 0 ) {
117
+ $field_id = $field['id'];
118
+ $fs_saas_data = $shipping_method->get_meta( '_fs_saas_data' );
119
+ if ( ! is_array( $fs_saas_data ) ) {
120
+ $fs_saas_data = array();
121
+ }
122
+ $meta_field_id = '_fs_' . $field_id;
123
+ $calculated = false;
124
+ if ( isset( $field[ self::FIELD_CALCULATION_METHOD ] ) ) {
125
+ if ( 'sum_items_weight' === $field[ self::FIELD_CALCULATION_METHOD ] && abs( 0 - floatval( $package_weight ) ) > self::FLOAT_EPSILON ) {
126
+ $this->set_meta( $field_id, $package_weight );
127
+ $calculated = true;
128
+ }
129
+ }
130
+ if ( ! $calculated ) {
131
+ if ( isset( $fs_method[ $this->get_integration() . '_' . $field_id ] ) ) {
132
+ $this->set_meta( $field_id, $fs_method[ $this->get_integration() . '_' . $field_id ] );
133
+ }
134
+ if ( isset( $fs_saas_data[ $meta_field_id ] ) ) {
135
+ $this->set_meta( $field_id, $fs_saas_data[ $meta_field_id ] );
136
+ }
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Save fieldset data from shipping method.
142
+ *
143
+ * @param array $fieldset Fieldset.
144
+ * @param array $fs_method Flexible Shipping method.
145
+ * @param WC_Order_Item_Shipping $shipping_method Woocommerce shipping method.
146
+ * @param float $package_weight Package weight.
147
+ */
148
+ private function save_fieldset_data_from_shipping_method( array $fieldset, array $fs_method, $shipping_method, $package_weight ) {
149
+ foreach ( $fieldset['fields'] as $field ) {
150
+ $this->save_field_data_from_shipping_method( $field, $fs_method, $shipping_method, $package_weight );
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Set shop and floe data.
156
+ *
157
+ * @param WC_Order_Item_Shipping $shipping_method Shipping method.
158
+ */
159
+ private function set_shop_and_flow_data( $shipping_method ) {
160
+ $rate_type = $shipping_method->get_meta( '_fs_rate_type' );
161
+ if ( '' === $shipping_method->get_meta( '_fs_rate_type' ) ) {
162
+ $rate_type = 'custom';
163
+ }
164
+ if ( 'live' === $rate_type ) {
165
+ $service_type = $shipping_method->get_meta( '_fs_service_type' );
166
+ if ( '' !== $service_type ) {
167
+ $this->set_meta( self::CHECKOUT_SERVICE_TYPE, $service_type );
168
+ }
169
+ $service_name = $shipping_method->get_meta( '_fs_service_name' );
170
+ if ( '' !== $service_name ) {
171
+ $this->set_meta( self::CHECKOUT_SERVICE_NAME, $service_name );
172
+ }
173
+ }
174
+ $this->set_meta( self::RATE_TYPE, $rate_type );
175
+
176
+ $fallback_message = $shipping_method->get_meta( '_fs_fallback' );
177
+ if ( '' !== $fallback_message ) {
178
+ $this->set_meta( self::FALLBACK, '1' );
179
+ $this->set_meta( self::FALLBACK_MESSAGE, $fallback_message );
180
+ } else {
181
+ $this->set_meta( self::FALLBACK, '0' );
182
+ $this->set_meta( self::FALLBACK_MESSAGE, '' );
183
+ }
184
+ }
185
+
186
+ /**
187
+ * Create shipment on checkout.
188
+ *
189
+ * @param array $fs_method Flexible Shipping method.
190
+ * @param array $package Package.
191
+ */
192
+ public function checkout( array $fs_method, $package ) {
193
+
194
+ $shipping_method = $this->get_meta_shipping_method();
195
+
196
+ if ( null !== $shipping_method ) {
197
+ $this->set_shop_and_flow_data( $shipping_method );
198
+ }
199
+
200
+ $package_weight = fs_calculate_package_weight( $package );
201
+ if ( abs( 0 - floatval( $package_weight ) ) > self::FLOAT_EPSILON ) {
202
+ $this->set_meta( '_package_weight', $package_weight );
203
+ }
204
+
205
+ $order = $this->get_order();
206
+
207
+ try {
208
+ $fields = $this->shipping_service->get_fields_for_targets( [ $order->get_shipping_country() ] );
209
+
210
+ foreach ( $fields as $fieldset ) {
211
+ if ( isset( $fieldset['show-in'] ) && in_array( 'metabox', $fieldset['show-in'], true ) ) {
212
+ $this->save_fieldset_data_from_shipping_method( $fieldset, $fs_method, $shipping_method, $package_weight );
213
+ }
214
+ }
215
+ } catch ( Exception $e ) {
216
+ $this->update_status( 'fs-failed' );
217
+ $this->set_meta(
218
+ self::META_SAAS_MESSAGE,
219
+ sprintf(
220
+ // Translators: error from checkout.
221
+ __( 'There was problems on checkout: %1$s', 'flexible-shipping' ),
222
+ $e->getMessage()
223
+ )
224
+ );
225
+ }
226
+
227
+ }
228
+
229
+ /**
230
+ * Get order metabox content.
231
+ *
232
+ * @return string
233
+ */
234
+ public function get_order_metabox_content() {
235
+ $metabox = new WPDesk_Flexible_Shipping_Shipment_Saas_Metabox( $this );
236
+ return $metabox->get_order_metabox_content();
237
+ }
238
+
239
+ /**
240
+ * Display order metabox.
241
+ */
242
+ public function order_metabox() {
243
+ echo $this->get_order_metabox_content();
244
+ }
245
+
246
+ /**
247
+ * Get order metabox title.
248
+ *
249
+ * @return string
250
+ */
251
+ public function get_order_metabox_title() {
252
+ return $this->get_shipping_service_name();
253
+ }
254
+
255
+ /**
256
+ * Get shipping service name.
257
+ *
258
+ * @return string
259
+ */
260
+ public function get_shipping_service_name() {
261
+ return $this->shipping_service->get_name();
262
+ }
263
+
264
+ /**
265
+ * Get fields for targets.
266
+ *
267
+ * @return array
268
+ */
269
+ public function get_fields_for_targets() {
270
+ $order = $this->get_order();
271
+ $shipping_country = $order->get_shipping_country();
272
+ if ( empty( $shipping_country ) ) {
273
+ $default_shipping_country = explode( ':', get_option( 'woocommerce_default_country' ) );
274
+ $shipping_country = $default_shipping_country[0];
275
+ }
276
+ return $this->shipping_service->get_fields_for_targets( [ $shipping_country ] );
277
+ }
278
+
279
+ /**
280
+ * Get platform.
281
+ *
282
+ * @return \WPDesk\SaasPlatformClient\Platform
283
+ */
284
+ public function get_platform() {
285
+
286
+ $this->logger = WPDesk_Flexible_Shipping_Logger_Factory::create_logger();
287
+
288
+ $platform_factory = new WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory( $this->logger );
289
+ $platform = $platform_factory->get_platform();
290
+
291
+ return $platform;
292
+ }
293
+
294
+ /**
295
+ * Send order notes to client?
296
+ *
297
+ * @return bool
298
+ */
299
+ public function order_note_send_to_client() {
300
+ if ( 'yes' === $this->shipping_service->get_option_from_shipping_method( 'email_add_tracking_number' ) ) {
301
+ return true;
302
+ }
303
+ return false;
304
+ }
305
+
306
+ /**
307
+ * Add order note - shipment created.
308
+ */
309
+ public function add_order_note_shipment_created() {
310
+ $order = $this->get_order();
311
+ $order->add_order_note(
312
+ sprintf(
313
+ // Translators: service name and shipment number.
314
+ __( '%1$s Shipment %2$s was created.', 'flexible-shipping' ),
315
+ $this->shipping_service->get_name(),
316
+ $this->get_tracking_number()
317
+ ),
318
+ $this->order_note_send_to_client()
319
+ );
320
+ }
321
+
322
+ /**
323
+ * Add order note - shipment created.
324
+ *
325
+ * @param string $tracking_number Tracking number.
326
+ */
327
+ private function add_order_note_shipment_canceled( $tracking_number ) {
328
+ $order = $this->get_order();
329
+ $order->add_order_note(
330
+ sprintf(
331
+ // Translators: service name.
332
+ __( '%1$s Shipment %2$s was canceled.', 'flexible-shipping' ),
333
+ $this->shipping_service->get_name(),
334
+ $tracking_number
335
+ ),
336
+ $this->order_note_send_to_client()
337
+ );
338
+ }
339
+
340
+ /**
341
+ * Cancel shipment on platform.
342
+ *
343
+ * @throws WPDesk_Flexible_Shipping_Cancel_Shipment_Exception Cancel Shipment Exception.
344
+ */
345
+ public function cancel_shipment() {
346
+ $tracking_number = $this->get_tracking_number();
347
+ $platform = $this->get_platform();
348
+ $response = $platform->requestPostCancel( $this->get_saas_shipment_id(), $this->shipping_service->get_id() );
349
+ if ( $response->isError() ) {
350
+ $error_body = $response->getResponseErrorBody();
351
+ $message = __( 'UPS! Something is wrong!', 'flexible-shipping' );
352
+
353
+ if ( isset( $error_body['detail'] ) ) {
354
+ $message = $error_body['detail'];
355
+ }
356
+ if ( isset( $error_body['message'] ) ) {
357
+ $message = $error_body['message'];
358
+ }
359
+ throw new WPDesk_Flexible_Shipping_Cancel_Shipment_Exception( $message );
360
+ }
361
+
362
+ $this->set_saas_shipment_id( '' );
363
+ $this->delete_meta( self::META_SAAS_MESSAGE );
364
+ $this->delete_meta( self::META_SAAS_TRACKING_URL );
365
+ $this->delete_meta( self::META_SAAS_TRACKING_ID );
366
+ $this->delete_meta( self::META_SAAS_SHIPMENT_COST );
367
+ $this->update_status( 'fs-new' );
368
+ $this->save();
369
+
370
+ $this->add_order_note_shipment_canceled( $tracking_number );
371
+
372
+ do_action( 'flexible_shipping_shipment_canceled', $this );
373
+ }
374
+
375
+ /**
376
+ * Send shipment to platform.
377
+ *
378
+ * @return WPDesk\SaasPlatformClient\Model\Shipment\ShipmentResponse
379
+ * @throws WPDesk_Flexible_Shipping_Send_Shipment_Exception Send Shipment Exception.
380
+ */
381
+ public function send_shipment() {
382
+ $send_shipment = new WPDesk_Flexible_Shipping_Shipment_Saas_Send( $this );
383
+ return $send_shipment->send();
384
+ }
385
+
386
+ /**
387
+ * Metabox can be saved?
388
+ *
389
+ * @return bool
390
+ */
391
+ public function matabox_can_be_saved() {
392
+ if ( $this->get_status() === 'fs-new' && $this->get_status() === 'fs-failed' ) {
393
+ return false;
394
+ }
395
+ return true;
396
+ }
397
+
398
+ /**
399
+ * Handle AJAX requests for shipment.
400
+ *
401
+ * @param string $action Action.
402
+ * @param array $data Data.
403
+ *
404
+ * @return array
405
+ *
406
+ * @throws WPDesk_Flexible_Shipping_Send_Shipment_Exception Send Shipment Exception.
407
+ * @throws RuntimeException Runtime Exception.
408
+ */
409
+ public function ajax_request( $action, $data ) {
410
+ $saas_ajax = new WPDesk_Flexible_Shipping_Shipment_Saas_Ajax( $this, self::$saas_platform_links );
411
+ return $saas_ajax->ajax_request( $action, $data );
412
+ }
413
+
414
+ /**
415
+ * Get label URL.
416
+ *
417
+ * @return null|string
418
+ * Returns URL for label
419
+ */
420
+ public function get_label_url() {
421
+ if ( in_array( $this->get_status(), array( 'fs-new', 'fs-failed' ), true ) ) {
422
+ return null;
423
+ }
424
+ $label_url = '?flexible_shipping_get_label=' . $this->get_id() . '&nonce=' . wp_create_nonce( 'flexible_shipping_get_label' );
425
+ return site_url( $label_url );
426
+ }
427
+
428
+ /**
429
+ * Get error message.
430
+ *
431
+ * @return null|string
432
+ */
433
+ public function get_error_message() {
434
+ $saas_message = $this->get_meta( self::META_SAAS_MESSAGE );
435
+ if ( ! empty( $saas_message ) ) {
436
+ $message_formatter = new WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter(
437
+ $saas_message,
438
+ $this->get_shipping_service_name()
439
+ );
440
+ return $message_formatter->format_to_html();
441
+ }
442
+ return '';
443
+ }
444
+
445
+ /**
446
+ * Get tracking number.
447
+ *
448
+ * @return string
449
+ */
450
+ public function get_tracking_number() {
451
+ return $this->get_meta( self::META_SAAS_TRACKING_ID );
452
+ }
453
+
454
+ /**
455
+ * Set tracking number.
456
+ *
457
+ * @param string $saas_tracking_id Tracking ID from platform.
458
+ */
459
+ public function set_tracking_number( $saas_tracking_id ) {
460
+ $this->set_meta( self::META_SAAS_TRACKING_ID, $saas_tracking_id );
461
+ }
462
+
463
+ /**
464
+ * Get tracking URL.
465
+ *
466
+ * @return string
467
+ */
468
+ public function get_tracking_url() {
469
+ return $this->get_meta( self::META_SAAS_TRACKING_URL );
470
+ }
471
+
472
+ /**
473
+ * Set tracking URL.
474
+ *
475
+ * @param string $saas_tracking_url Tracking URL from platform.
476
+ */
477
+ public function set_tracking_url( $saas_tracking_url ) {
478
+ $this->set_meta( self::META_SAAS_TRACKING_URL, $saas_tracking_url );
479
+ }
480
+
481
+ /**
482
+ * Set shipment cost.
483
+ *
484
+ * @param \WPDesk\SaasPlatformClient\Model\Shipment\ClientMoney $shipment_cost Shipment cost.
485
+ */
486
+ public function set_shipment_cost( $shipment_cost ) {
487
+ $shipment_cost_array = array(
488
+ 'amount' => $shipment_cost->getAmount(),
489
+ 'currency' => $shipment_cost->getCurrency(),
490
+ );
491
+ $this->set_meta( self::META_SAAS_SHIPMENT_COST, $shipment_cost_array );
492
+ }
493
+
494
+ /**
495
+ * Get shipment cost as Money.
496
+ *
497
+ * @return \Money\Money|null
498
+ */
499
+ public function get_shipment_cost_as_money() {
500
+ $shipment_cost = $this->get_meta( self::META_SAAS_SHIPMENT_COST );
501
+ if ( ! empty( $shipment_cost ) && is_array( $shipment_cost ) ) {
502
+ return new Money\Money( $shipment_cost['amount'], new \Money\Currency( $shipment_cost['currency'] ) );
503
+ }
504
+ return null;
505
+ }
506
+
507
+ /**
508
+ * Get shipment cost amount.
509
+ */
510
+ public function get_shipment_cost_amount() {
511
+ $shipment_cost_as_money = $this->get_shipment_cost_as_money();
512
+ $money_formatter = new WPDesk_Flexible_Shipping_Money_Formatter( $shipment_cost_as_money );
513
+ return $money_formatter->format();
514
+ }
515
+
516
+ /**
517
+ * Get shipment cost currency.
518
+ */
519
+ public function get_shipment_cost_currency() {
520
+ $shipment_cost_as_money = $this->get_shipment_cost_as_money();
521
+ if ( ! empty( $shipment_cost_as_money ) ) {
522
+ return $shipment_cost_as_money->getCurrency()->getCode();
523
+ }
524
+ return null;
525
+ }
526
+
527
+ /**
528
+ * Is label avaliable?
529
+ *
530
+ * @return bool
531
+ */
532
+ public function label_avaliable() {
533
+ if ( in_array( $this->get_status(), array( 'fs-confirmed', 'fs-manifest' ), true ) ) {
534
+ return true;
535
+ }
536
+ return false;
537
+ }
538
+
539
+ /**
540
+ * Prepare label file name.
541
+ *
542
+ * @param string $extension File extension.
543
+ *
544
+ * @return string
545
+ */
546
+ private function prepare_label_file_name( $extension ) {
547
+ return sprintf(
548
+ 'label_%1$s_%2$s.%3$s',
549
+ $this->get_shipping_service_name(),
550
+ $this->get_tracking_number(),
551
+ $extension
552
+ );
553
+ }
554
+
555
+ /**
556
+ * Get label from platform.
557
+ *
558
+ * @return array
559
+ *
560
+ * @throws WPDesk_Flexible_Shipping_Get_Label_Exception Label exception.
561
+ */
562
+ private function get_label_from_platform() {
563
+ $platform = $this->get_platform();
564
+ $label_response = $platform->requestPostLabel( intval( $this->get_meta( '_saas_shipment_id' ) ), $this->shipping_service->get_id() );
565
+ if ( $label_response->isError() ) {
566
+ throw new WPDesk_Flexible_Shipping_Get_Label_Exception( $label_response->getResponseCode() . ' - ' . $label_response->getResponseErrorBody()['message'] );
567
+ } else {
568
+ $label = $label_response->getLabel();
569
+ $label_data = array(
570
+ 'label_format' => 'pdf',
571
+ 'content' => base64_decode( $label->getLabelContent() ),
572
+ 'file_name' => $this->prepare_label_file_name( 'pdf' ),
573
+ );
574
+ if ( 'image/gif' === $label->getLabelContentMime() ) {
575
+ $label_data['label_format'] = 'gif';
576
+ $label_data['file_name'] = $this->prepare_label_file_name( 'gif' );
577
+ }
578
+ return $label_data;
579
+ }
580
+ }
581
+
582
+ /**
583
+ * Get label.
584
+ *
585
+ * @return array
586
+ * @throws WPDesk_Flexible_Shipping_Label_Not_Available_Exception Exception.
587
+ */
588
+ public function get_label() {
589
+ if ( ! $this->label_avaliable() ) {
590
+ throw new WPDesk_Flexible_Shipping_Label_Not_Available_Exception( __( 'Label is not avaliable for this shipment.', 'flexible-shipping' ) );
591
+ }
592
+ return $this->get_label_from_platform();
593
+ }
594
+
595
+ /**
596
+ * Echo after order table.
597
+ */
598
+ public function get_after_order_table() {
599
+ if ( $this->label_avaliable() ) {
600
+ $args = array(
601
+ 'shipments' => array(
602
+ array(
603
+ 'tracking_url' => $this->get_tracking_url(),
604
+ 'tracking_number' => $this->get_tracking_number(),
605
+ ),
606
+ ),
607
+ );
608
+ echo self::$renderer->render( 'myaccount/after_order_table', $args );
609
+ }
610
+ }
611
+
612
+ /**
613
+ * Echo email after order table.
614
+ */
615
+ public function get_email_after_order_table() {
616
+ if ( 'yes' === $this->shipping_service->get_option_from_shipping_method( 'email_add_tracking_number' )
617
+ && $this->label_avaliable()
618
+ ) {
619
+ $args = array(
620
+ 'shipments' => array(
621
+ array(
622
+ 'tracking_url' => $this->get_tracking_url(),
623
+ 'tracking_number' => $this->get_tracking_number(),
624
+ ),
625
+ ),
626
+ );
627
+ echo self::$renderer->render( 'email/after_order_table', $args );
628
+ }
629
+ }
630
+
631
+ /**
632
+ * Get SaaS shipment ID (from platform).
633
+ *
634
+ * @return array|null|string
635
+ */
636
+ private function get_saas_shipment_id() {
637
+ return $this->get_meta( self::META_SAAS_SHIPMENT_ID );
638
+ }
639
+
640
+ /**
641
+ * Set SaaS shipment ID.
642
+ *
643
+ * @param string $shipment_id Shipment ID.
644
+ */
645
+ public function set_saas_shipment_id( $shipment_id ) {
646
+ $this->set_meta( self::META_SAAS_SHIPMENT_ID, $shipment_id );
647
+ }
648
+
649
+ /**
650
+ * Get shipping service.
651
+ *
652
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Service
653
+ */
654
+ public function get_shipping_service() {
655
+ return $this->shipping_service;
656
+ }
657
+
658
+ /**
659
+ * Creates shipment.
660
+ *
661
+ * @throws Exception Exception.
662
+ */
663
+ public function api_create() {
664
+ $this->send_shipment();
665
+ }
666
+
667
+ /**
668
+ * Get shipping method.
669
+ *
670
+ * @return WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings
671
+ */
672
+ public function get_shipping_method() {
673
+ return $this->shipping_method;
674
+ }
675
+
676
+ /**
677
+ * Was fallback?
678
+ *
679
+ * @return bool
680
+ */
681
+ public function was_fallback() {
682
+ return '1' === $this->get_meta( self::FALLBACK, '0' );
683
+ }
684
+
685
+ /**
686
+ * Get fallback message.
687
+ *
688
+ * @return string
689
+ */
690
+ public function get_fallback_message() {
691
+ return $this->get_meta( self::FALLBACK_MESSAGE, '' );
692
+ }
693
+
694
+ /**
695
+ * Get rate type.
696
+ *
697
+ * @return string
698
+ */
699
+ public function get_rate_type() {
700
+ return $this->get_meta( self::RATE_TYPE, self::NOT_SET );
701
+ }
702
+
703
+ /**
704
+ * Get checkout service type.
705
+ *
706
+ * @return string
707
+ */
708
+ public function get_checkout_service_type() {
709
+ return $this->get_meta( self::CHECKOUT_SERVICE_TYPE, self::NOT_SET );
710
+ }
711
+
712
+ /**
713
+ * Get checkout service name.
714
+ *
715
+ * @return string
716
+ */
717
+ public function get_checkout_service_name() {
718
+ return $this->get_meta( self::CHECKOUT_SERVICE_NAME, self::NOT_SET );
719
+ }
720
+
721
+ }
classes/shipment/saas/views/order-metabox-actions.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( !$disabled ) : ?>
2
+ <p>
3
+ <button data-id="<?php echo $id; ?>" class="button button-primary fs-saas-button fs-saas-button-create button-shipping"><?php _e( 'Create', 'flexible-shipping' ); ?></button>
4
+ <button data-id="<?php echo $id; ?>" class="button fs-saas-button fs-saas-button-save button-shipping"><?php _e( 'Save', 'flexible-shipping' ); ?></button>
5
+ <span class="spinner fs-saas-spinner shipping-spinner"></span>
6
+ </p>
7
+ <?php else : ?>
8
+ <p>
9
+ <p>
10
+ <?php if ( $supports_label ) : ?>
11
+ <a data-qa-id="get-label" target="_blank" href='<?php echo $label_url; ?>' data-id="<?php echo $id; ?>" class="button button-primary fs-saas-button fs-saas-button-get-label"><?php _e( 'Get Label', 'flexible-shipping' ); ?></a>
12
+ <?php endif; ?>
13
+ <?php if ( $supports_cancel ) : ?>
14
+ <span class="spinner fs-saas-spinner shipping-spinner"></span>
15
+ <a data-qa-id="cancel-created" data-id="<?php echo $id; ?>" class="fs-saas-button fs-saas-button-cancel-created button-shipping"><?php _e( 'Cancel', 'flexible-shipping' ); ?></a>
16
+ <?php endif; ?>
17
+ </p>
18
+ </p>
19
+ <?php endif; ?>
20
+ <?php if ( ! empty( $tracking_url ) ) : ?>
21
+ <p class="fs-saas-shipment">
22
+ <span><?php _e( 'Track:', 'flexible-shipping' ); ?></span> <a title="<?php _e( 'Click to track shipment', 'flexible-shipping' ); ?>" target="_blank" href="<?php echo $tracking_url; ?>"><?php echo $tracking_number; ?></a>
23
+ </p>
24
+ <?php endif; ?>
25
+ <?php if ( $show_shipping_charges ) : ?>
26
+ <p class="fs-saas-charges">
27
+ <?php echo sprintf( __( '%1$sShipping charges:%2$s %3$s', 'flexible-shipping' ), '<span>', '</span>', $shipment_charges ); ?>
28
+ </p>
29
+ <?php endif; ?>
30
+ <p class="fs-saas-status fs-saas-status-<?php echo $status; ?>">
31
+ <?php echo sprintf( __( '%1$sShipment status:%2$s %3$s', 'flexible-shipping' ), '<span>', '</span>', $status_text ); ?>
32
+ </p>
classes/shipment/saas/views/order-metabox-connection-error.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <p class="connection-error">
2
+ <?php echo $error_message; ?>
3
+ </p>
classes/shipment/saas/views/order-metabox-fieldset-replicable.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ include 'order-metabox-fieldset.php';
classes/shipment/saas/views/order-metabox-fieldset.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php foreach ( $fields as $field ) : ?>
2
+ <?php
3
+ if ( ! empty( $field['id'] ) ) {
4
+ $key = $field['id'];
5
+ $args = array(
6
+ 'label' => do_shortcode( $field['name'] ),
7
+ 'id' => $key . '_' . $id,
8
+ 'type' => $field['type'],
9
+ );
10
+ if ( 'select' === $field['type'] ) {
11
+ $args['options'] = array();
12
+ foreach ( $field['select-additional']['options'] as $option ) {
13
+ $args['options'][ $option['value'] ] = $option['text'];
14
+ }
15
+ }
16
+ if ( isset( $values[ $key ] ) ) {
17
+ $args['value'] = $values[ $key ][0];
18
+ }
19
+ if ( $disabled ) {
20
+ $args['custom_attributes'] = array( 'disabled' => 'disabled' );
21
+ }
22
+ if ( isset( $field['desc'] ) ) {
23
+ $args['description'] = do_shortcode( $field['desc'] );
24
+ }
25
+ if ( isset( $field['tooltip'] ) && is_array( $field['tooltip'] ) ) {
26
+ $args['description'] = do_shortcode( $field['tooltip']['description'] );
27
+ $args['desc_tip'] = true;
28
+ }
29
+ }
30
+ ?>
31
+ <div class="<?php echo $key; ?>">
32
+ <?php if ( 'checkbox' === $field['type'] ) : ?>
33
+ <?php $args['label'] .= ' '; ?>
34
+ <?php woocommerce_wp_checkbox( $args ); ?>
35
+ <?php elseif ( 'header' === $field['type'] ) : ?>
36
+ <h4><?php echo $field['name']; ?></h4>
37
+ <?php elseif ( 'select' === $field['type'] ) : ?>
38
+ <?php woocommerce_wp_select( $args ); ?>
39
+ <?php else : ?>
40
+ <?php woocommerce_wp_text_input( $args ); ?>
41
+ <?php endif; ?>
42
+ </div>
43
+ <?php endforeach; ?>
classes/shipment/views/order-metabox.php CHANGED
@@ -1,9 +1,9 @@
1
- <div class="flexible_shipping_shipment" id="flexible_shipping_shipment_<?php echo $shipment->get_id(); ?>" data-id="<?php echo $shipment->get_id(); ?>">
2
- <?php wp_nonce_field( 'flexible_shipping_shipment_nonce', 'flexible_shipping_shipment_nonce_' . $shipment->get_id(), false ); ?>
3
  <div class="flexible_shipping_shipment_content">
4
  <?php $shipment->order_metabox(); ?>
5
  </div>
6
- <div class="flexible_shipping_shipment_message flexible_shipping_shipment_message_error">
7
- <?php echo $shipment->get_error_message(); ?>
8
  </div>
9
  </div>
1
+ <div class="flexible_shipping_shipment" id="flexible_shipping_shipment_<?php echo $shipment->get_id(); ?>" data-id="<?php echo $shipment_id; ?>">
2
+ <?php wp_nonce_field( 'flexible_shipping_shipment_nonce', 'flexible_shipping_shipment_nonce_' . $shipment_id, false ); ?>
3
  <div class="flexible_shipping_shipment_content">
4
  <?php $shipment->order_metabox(); ?>
5
  </div>
6
+ <div class="flexible_shipping_shipment_message flexible_shipping_shipment_message_error" style="<?php echo $message_css_style; ?>">
7
+ <?php echo $message; ?>
8
  </div>
9
  </div>
classes/shipping-method-info.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- if ( ! class_exists( 'WPDesk_Flexible_Shipping_Info' ) ) {
8
-
9
- class WPDesk_Flexible_Shipping_Info extends WC_Shipping_Method {
10
-
11
- /**
12
- * WPDesk_Flexible_Shipping_Fake_Method constructor.
13
- *
14
- * @param int $instance_id
15
- */
16
- public function __construct( $instance_id = 0 ) {
17
- parent::__construct( $instance_id );
18
- $this->id = 'flexible_shipping_info';
19
- $this->enabled = 'no';
20
- $this->method_title = __( 'Flexible Shipping', 'flexible-shipping' );
21
-
22
- $this->supports = array(
23
- 'settings',
24
- );
25
-
26
- }
27
-
28
- /**
29
- * @param array $form_fields
30
- * @param bool $echo
31
- *
32
- * @return string
33
- */
34
- public function generate_settings_html( $form_fields = array(), $echo = true ) {
35
- ob_start();
36
- include( 'views/html-shipping-method-info-description.php' );
37
- $html = ob_get_clean();
38
- if ( $echo ) {
39
- echo $html;
40
- } else {
41
- return $html;
42
- }
43
- }
44
-
45
- }
46
-
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/shipping-method.php CHANGED
@@ -15,7 +15,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
15
  * @access public
16
  * @return void
17
  */
18
- public function __construct( $instance_id = 0 ) {
19
  $this->instance_id = absint( $instance_id );
20
  $this->id = 'flexible_shipping';
21
  $this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
@@ -242,14 +242,18 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
242
  else {
243
  $method_id = $_POST['method_id'];
244
  $method_id_for_shipping = $_POST['method_id_for_shipping'];
 
 
 
245
  }
 
246
  $shipping_method['id'] = $method_id;
247
  $shipping_method['id_for_shipping'] = $method_id_for_shipping;
248
  $shipping_method['method_title'] = $_POST['woocommerce_' . $this->id . '_method_title'];
249
  $shipping_method['method_description'] = $_POST['woocommerce_' . $this->id . '_method_description'];
250
- $shipping_method['method_free_shipping'] = '';
251
  if ( isset( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] ) && $_POST['woocommerce_' . $this->id . '_method_free_shipping'] != '' ) {
252
- $shipping_method['method_free_shipping'] = wc_format_decimal( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] );
253
  }
254
  if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
255
  $shipping_method['method_free_shipping_label'] = $_POST['woocommerce_' . $this->id . '_method_free_shipping_label'];
@@ -370,7 +374,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
370
  WC_Admin_Settings::show_messages();
371
  return;
372
  }
373
- $imported_shipping_method['method_free_shipping'] = str_replace( ',', '.', $csv_row['Free Shipping'] );
374
  if ( trim( $csv_row['Maximum Cost'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Maximum Cost'] ) ) ) {
375
  WC_Admin_Settings::add_error( sprintf(__('Maximum Cost value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Maximum Cost'], $import_row_count ) );
376
  WC_Admin_Settings::show_messages();
@@ -527,7 +531,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
527
  'method_enabled' => 'no',
528
  'method_shipping_zone' => '',
529
  'method_calculation_method' => 'sum',
530
- 'method_free_shipping' => '',
531
  'method_free_shipping_label'=> '',
532
  'method_visibility' => 'no',
533
  'method_default' => 'no',
@@ -775,10 +779,43 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
775
  return apply_filters( 'flexible_shipping_prices_include_tax', $prices_include_tax );
776
  }
777
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
778
  /**
779
  * @param array $package
780
  */
781
  public function calculate_shipping( $package = array() ) {
 
 
 
782
  $processed = apply_filters( 'flexible_shipping_calculate_shipping', false, $this, $package, 0 );
783
 
784
  $default_method_is_set = false;
@@ -805,13 +842,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
805
  $rule_triggered = true;
806
  }
807
 
808
- $prices_include_tax = $this->prices_include_tax();
809
- if ( $prices_include_tax ) {
810
- $contents_cost = $this->contents_cost_with_tax();
811
- }
812
- else {
813
- $contents_cost = $this->contents_cost_without_tax();
814
- }
815
  $cart_contents_cost = $contents_cost;
816
 
817
  if ( $method_rule['based_on'] == 'value' ) {
@@ -850,28 +881,24 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
850
  $rule_triggered = true;
851
  }
852
  }
853
-
854
  if ( $rule_triggered ) {
855
  $rule_triggered = apply_filters( 'flexible_shipping_rule_triggered', $rule_triggered, $method_rule, $package );
856
  }
857
-
858
  if ( $rule_triggered ) {
859
  $rule_cost = array( 'cost' => floatval( $method_rule['cost_per_order'] ) );
860
  $rule_costs[$rule_key] = $rule_cost;
861
  $add_method = true;
862
  }
863
- }
864
 
 
865
  $cost = $this->calculate_method_cost( $shipping_method, $rule_costs );
866
- $add_method = apply_filters( 'flexible_shipping_add_method' , $add_method, $shipping_method, $package );
867
-
868
  if ( $add_method === true ) {
869
- if ( isset( $shipping_method['method_free_shipping'] ) && $shipping_method['method_free_shipping'] != '' ) {
870
- if ( apply_filters( 'flexible_shipping_value_in_currency', floatval( $shipping_method['method_free_shipping'] ) ) <= floatval( $cart_contents_cost ) ) {
871
- $cost = 0;
872
- }
873
  }
874
-
875
  $method_title = wpdesk__( $shipping_method['method_title'], 'flexible-shipping' );
876
  if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
877
  if ( $cost == 0 ) {
@@ -958,7 +985,64 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
958
  $rates = $this->get_all_rates();
959
  return $rates[$rate_id];
960
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
961
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
962
  }
963
 
964
  }
15
  * @access public
16
  * @return void
17
  */
18
+ const FIELD_METHOD_FREE_SHIPPING='method_free_shipping';public function __construct( $instance_id = 0 ) {
19
  $this->instance_id = absint( $instance_id );
20
  $this->id = 'flexible_shipping';
21
  $this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
242
  else {
243
  $method_id = $_POST['method_id'];
244
  $method_id_for_shipping = $_POST['method_id_for_shipping'];
245
+ if ( isset( $shipping_methods[ $method_id ] ) ) {
246
+ $shipping_method = $shipping_methods[ $method_id ];
247
+ }
248
  }
249
+ $shipping_method['woocommerce_method_instance_id'] = $this->instance_id;
250
  $shipping_method['id'] = $method_id;
251
  $shipping_method['id_for_shipping'] = $method_id_for_shipping;
252
  $shipping_method['method_title'] = $_POST['woocommerce_' . $this->id . '_method_title'];
253
  $shipping_method['method_description'] = $_POST['woocommerce_' . $this->id . '_method_description'];
254
+ $shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = '';
255
  if ( isset( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] ) && $_POST['woocommerce_' . $this->id . '_method_free_shipping'] != '' ) {
256
+ $shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = wc_format_decimal( $_POST['woocommerce_' . $this->id . '_method_free_shipping'] );
257
  }
258
  if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
259
  $shipping_method['method_free_shipping_label'] = $_POST['woocommerce_' . $this->id . '_method_free_shipping_label'];
374
  WC_Admin_Settings::show_messages();
375
  return;
376
  }
377
+ $imported_shipping_method[self::FIELD_METHOD_FREE_SHIPPING] = str_replace( ',', '.', $csv_row['Free Shipping'] );
378
  if ( trim( $csv_row['Maximum Cost'] ) != '' && !is_numeric( str_replace( ',', '.', $csv_row['Maximum Cost'] ) ) ) {
379
  WC_Admin_Settings::add_error( sprintf(__('Maximum Cost value %s is not valid number. Row number %d.', 'flexible-shipping' ), $csv_row['Maximum Cost'], $import_row_count ) );
380
  WC_Admin_Settings::show_messages();
531
  'method_enabled' => 'no',
532
  'method_shipping_zone' => '',
533
  'method_calculation_method' => 'sum',
534
+ self::FIELD_METHOD_FREE_SHIPPING => '',
535
  'method_free_shipping_label'=> '',
536
  'method_visibility' => 'no',
537
  'method_default' => 'no',
779
  return apply_filters( 'flexible_shipping_prices_include_tax', $prices_include_tax );
780
  }
781
 
782
+ /**
783
+ * Is free shipping?
784
+ *
785
+ * @param array $shipping_method_settings Flexible shipping method settings.
786
+ * @param float $cart_contents_cost Cart contents cost.
787
+ *
788
+ * @return bool
789
+ */
790
+ public function is_free_shipping( array $shipping_method_settings, $cart_contents_cost ) {
791
+ if ( isset( $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) && '' !== $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) {
792
+ if ( apply_filters( 'flexible_shipping_value_in_currency', floatval( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] ) ) <= floatval( $cart_contents_cost ) ) {
793
+ return true;
794
+ }
795
+ }
796
+ return false;
797
+ }
798
+
799
+ /**
800
+ * Calculate contents cost.
801
+ *
802
+ * @return float
803
+ */
804
+ public function contents_cost() {
805
+ if ( $this->prices_include_tax() ) {
806
+ return $this->contents_cost_with_tax();
807
+ } else {
808
+ return $this->contents_cost_without_tax();
809
+ }
810
+ }
811
+
812
  /**
813
  * @param array $package
814
  */
815
  public function calculate_shipping( $package = array() ) {
816
+
817
+ $cart_contents_cost = 0;
818
+
819
  $processed = apply_filters( 'flexible_shipping_calculate_shipping', false, $this, $package, 0 );
820
 
821
  $default_method_is_set = false;
842
  $rule_triggered = true;
843
  }
844
 
845
+ $contents_cost = $this->contents_cost();
 
 
 
 
 
 
846
  $cart_contents_cost = $contents_cost;
847
 
848
  if ( $method_rule['based_on'] == 'value' ) {
881
  $rule_triggered = true;
882
  }
883
  }
 
884
  if ( $rule_triggered ) {
885
  $rule_triggered = apply_filters( 'flexible_shipping_rule_triggered', $rule_triggered, $method_rule, $package );
886
  }
 
887
  if ( $rule_triggered ) {
888
  $rule_cost = array( 'cost' => floatval( $method_rule['cost_per_order'] ) );
889
  $rule_costs[$rule_key] = $rule_cost;
890
  $add_method = true;
891
  }
 
892
 
893
+ }
894
  $cost = $this->calculate_method_cost( $shipping_method, $rule_costs );
895
+ $add_method = apply_filters( 'flexible_shipping_add_method' , $add_method, $shipping_method, $package, $this );
 
896
  if ( $add_method === true ) {
897
+
898
+ if ( $this->is_free_shipping( $shipping_method, $cart_contents_cost ) ) {
899
+ $cost = 0;
 
900
  }
901
+
902
  $method_title = wpdesk__( $shipping_method['method_title'], 'flexible-shipping' );
903
  if ( version_compare( WC()->version, '2.6' ) >= 0 ) {
904
  if ( $cost == 0 ) {
985
  $rates = $this->get_all_rates();
986
  return $rates[$rate_id];
987
  }
988
+
989
+ public function generate_header_html( $key, $data ) {
990
+ $field_key = $this->get_field_key( $key );
991
+ $defaults = array(
992
+ 'title' => '',
993
+ 'class' => '',
994
+ );
995
+ $data = wp_parse_args( $data, $defaults );
996
+ return sprintf( '<tr><td colspan="2"><h4 class="%1$s" id="%2$s">%3$s</h4></td></tr>', esc_attr( $data['class'] ), esc_attr( $field_key ), esc_html( $data['title'] ) );
997
+ }
998
+
999
+ /**
1000
+ * Generate SaaS connection error field HTML.
1001
+ *
1002
+ * @param string $key
1003
+ * @param array $data
1004
+ *
1005
+ * @return string
1006
+ */
1007
+ public function generate_saas_connection_error_html( $key, $data ) {
1008
+ $field_key = $this->get_field_key( $key );
1009
+ $defaults = array(
1010
+ 'title' => '',
1011
+ 'class' => '',
1012
+ );
1013
+ $data = wp_parse_args( $data, $defaults );
1014
+ return sprintf( '<tr><td></td><td><span class="%1$s" id="%2$s">%3$s</span></td></tr>', esc_attr( $data['class'] ), esc_attr( $field_key ), $data['description'] );
1015
+ }
1016
 
1017
+ /**
1018
+ * Generate custom_services field HTML.
1019
+ *
1020
+ * @param string $key
1021
+ * @param array $data
1022
+ *
1023
+ * @return string
1024
+ */
1025
+ public function generate_custom_services_html( $key, $data ) {
1026
+ $field_key = $this->get_field_key( $key );
1027
+ $defaults = array(
1028
+ 'title' => '',
1029
+ 'disabled' => false,
1030
+ 'class' => '',
1031
+ 'css' => '',
1032
+ 'placeholder' => '',
1033
+ 'type' => 'text',
1034
+ 'desc_tip' => false,
1035
+ 'description' => '',
1036
+ 'custom_attributes' => array(),
1037
+ 'services' => array()
1038
+ );
1039
+ $data = wp_parse_args( $data, $defaults );
1040
+ ob_start();
1041
+ $services = $data['services'];
1042
+ include ( 'views/html-custom-services.php' );
1043
+ return ob_get_clean();
1044
+ }
1045
+
1046
  }
1047
 
1048
  }
classes/tracker.php CHANGED
@@ -3,7 +3,9 @@
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
  if ( ! class_exists( 'WPDesk_Flexible_Shipping_Tracker' ) ) {
6
- class WPDesk_Flexible_Shipping_Tracker {
 
 
7
 
8
  const PLUGIN_ACTION_LINKS_FILTER_NAME = 'plugin_action_links_flexible-shipping/flexible-shipping.php';
9
 
@@ -223,8 +225,6 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Tracker' ) ) {
223
 
224
  }
225
 
226
- new WPDesk_Flexible_Shipping_Tracker();
227
-
228
  }
229
 
230
  if ( !function_exists( 'wpdesk_activated_plugin_activation_date' ) ) {
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
  if ( ! class_exists( 'WPDesk_Flexible_Shipping_Tracker' ) ) {
6
+ class WPDesk_Flexible_Shipping_Tracker implements \WPDesk\PluginBuilder\Plugin\HookablePluginDependant {
7
+
8
+ use \WPDesk\PluginBuilder\Plugin\PluginAccess;
9
 
10
  const PLUGIN_ACTION_LINKS_FILTER_NAME = 'plugin_action_links_flexible-shipping/flexible-shipping.php';
11
 
225
 
226
  }
227
 
 
 
228
  }
229
 
230
  if ( !function_exists( 'wpdesk_activated_plugin_activation_date' ) ) {
classes/views/html-ads.php CHANGED
@@ -4,7 +4,7 @@
4
  <h3 class="hndle"><?php _e( 'Get Flexible Shipping PRO!', 'flexible-shipping' ); ?></h3>
5
 
6
  <?php
7
- $fs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/';
8
  ?>
9
 
10
  <div class="inside">
@@ -16,7 +16,7 @@
16
  <li><span class="dashicons dashicons-yes"></span> <?php _e( 'Additional calculation methods', 'flexible-shipping' ); ?></li>
17
  </ul>
18
 
19
- <a class="button button-primary" href="<?php echo $fs_link; ?>?utm_source=flexible-shipping-settings&utm_medium=button&utm_campaign=flexible-shipping-pro-plugin" target="_blank"><?php _e( 'Upgrade Now &rarr;', 'flexible-shipping' ); ?></a>
20
  </div>
21
  </div>
22
  </div>
4
  <h3 class="hndle"><?php _e( 'Get Flexible Shipping PRO!', 'flexible-shipping' ); ?></h3>
5
 
6
  <?php
7
+ $fs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://flexibleshipping.com/table-rate/';
8
  ?>
9
 
10
  <div class="inside">
16
  <li><span class="dashicons dashicons-yes"></span> <?php _e( 'Additional calculation methods', 'flexible-shipping' ); ?></li>
17
  </ul>
18
 
19
+ <a class="button button-primary" href="<?php echo $fs_link; ?>?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=button&utm_term=upgrade-now&utm_content=fs-shippingzone-upgradenow" target="_blank"><?php _e( 'Upgrade Now &rarr;', 'flexible-shipping' ); ?></a>
20
  </div>
21
  </div>
22
  </div>
classes/views/html-column-shipping-shipping.php CHANGED
@@ -1,11 +1,8 @@
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2
  <div class="shipping">
3
  <div class="shipping-status">
4
- <a class="icon-status icon-status-<?php echo $shipping['status']; ?> tips" href="<?php echo $shipping['url']; ?>" data-tip="<?php echo $statuses[$shipping['status']]; ?>">
5
- <?php echo $statuses[$shipping['status']]; ?>
6
- <?php /*
7
- <span class="icon-status icon-status-<?php echo $shipping['status']; ?> tips" data-tip="<?php echo $statuses[$shipping['status']]; ?>"><?php echo $statuses[$shipping['status']]; ?></span>
8
- */ ?>
9
  </a>
10
  <?php do_action( 'flexible_shipping_shipping_status_html', $shipping ); ?>
11
  </div>
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2
  <div class="shipping">
3
  <div class="shipping-status">
4
+ <a class="icon-status icon-status-<?php echo $shipping['status']; ?> tips" href="<?php echo $shipping['url']; ?>" data-tip="<?php echo esc_html( $statuses[$shipping['status']] ); ?>">
5
+ <?php echo esc_html( $statuses[$shipping['status']] ); ?>
 
 
 
6
  </a>
7
  <?php do_action( 'flexible_shipping_shipping_status_html', $shipping ); ?>
8
  </div>
classes/views/html-custom-services.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <tr valign="top">
2
+ <th scope="row" class="titledesc">
3
+ <label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></label>
4
+ <?php echo $this->get_tooltip_html( $data ); ?>
5
+ </th>
6
+ <td class="forminp">
7
+ <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend>
8
+ <span class="<?php echo esc_attr( $data['class'] ); ?>" id="<?php echo esc_attr( $field_key ); ?>" style="<?php echo esc_attr( $data['css'] ); ?>">
9
+
10
+ <table class="flexible_shipping_services wc_shipping widefat wp-list-table" cellspacing="0">
11
+ <thead>
12
+ <tr>
13
+ <th class="sort">&nbsp;</th>
14
+ <th class="service_code"><?php _e( 'Code', 'flexible-shipping' ); ?></th>
15
+ <th class="service_name"><?php _e( 'Name', 'flexible-shipping' ); ?></th>
16
+ <th class="select">
17
+ <?php _e( 'Enabled', 'flexible-shipping' ); ?><?php /* <input type="checkbox" class="tips checkbox-select-all-services" value="1" data-tip="<?php _e( 'Enable all', 'flexible-shipping' ); ?>" /> */ ?>
18
+ </th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <?php foreach ( $services as $service_code => $service ) : ?>
23
+ <tr>
24
+ <td class="sort"></td>
25
+ <td class="service_code"><?php echo $service_code; ?></td>
26
+ <td class="service_name">
27
+ <input name="<?php echo esc_attr( $field_key ); ?>[<?php echo $service_code ?>][name]" type="text" value="<?php echo esc_attr( $service['name'] ); ?>" class="woocommerce_flexible_shipping_service_name"/>
28
+ </td>
29
+ <td width="1%" class="select" nowrap>
30
+ <input name="<?php echo esc_attr( $field_key ); ?>[<?php echo $service_code ?>][enabled]" type="checkbox" class="checkbox-select-service" value="<?php echo esc_attr( $service_code ); ?>" <?php echo $service['enabled'] ? 'checked' : ''; ;?> />
31
+ </td>
32
+ </tr>
33
+ <?php endforeach; ?>
34
+ </tbody>
35
+ <tfoot>
36
+ <tr>
37
+ <th colspan="4"><span class="description"><?php _e( 'Drag and drop the services to control their display order. Confirm by clicking Save changes button below.', 'flexible-shipping' ); ?></span></th>
38
+ </tr>
39
+ </tfoot>
40
+ </table>
41
+ </span>
42
+ <?php echo $this->get_description_html( $data ); ?>
43
+ </fieldset>
44
+ </td>
45
+ </tr>
classes/views/html-shipping-method-info-description.php DELETED
@@ -1,62 +0,0 @@
1
- <?php
2
- $pl = get_locale() === 'pl_PL';
3
- $youtube_url = 'https://www.youtube.com/embed/qsFvYoiNDgU';
4
- $general_settings_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=general-settings#Ustawienia_glowne' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=general-settings#General_Settings';
5
- $adding_a_shipping_method_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=adding-a-shipping-method#Metody_wysylki' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=adding-a-shipping-method#Shipping_Methods';
6
- $currency_support_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=currency-support#Waluty' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=currency-support#Currency_Support';
7
- $weight_based_shipping_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=weight-based-shipping#Koszt_na_wage' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=weight-based-shipping#Weight_Based_Shipping';
8
- $shipping_insurance_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=shipping-insurance#Ubezpieczenie_przesylki' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=shipping-insurance#Shipping_Insurance';
9
- $conditional_cash_on_delivery_url = $pl ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=conditional-cash-on-delivery#Przesylka_za_pobraniem' : 'https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/?utm_source=flexible-shipping-info&utm_medium=link&utm_campaign=flexible-shipping-resources-box&utm_content=conditional-cash-on-delivery#Conditional_Cash_on_Delivery';
10
- ?>
11
- </table>
12
-
13
- <div class="inspire-settings flexible-shipping-info">
14
- <div class="inspire-main-content">
15
- <ol>
16
- <li>
17
- <?php
18
- echo sprintf(
19
- __( 'To add first Flexible Shipping method go to %sShipping zones%s and add Flexible Shipping to a shipping zone.', 'flexible-shipping' ),
20
- '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section' ) . '">',
21
- '</a>'
22
- );
23
- ?>
24
- </li>
25
-
26
- <li><?php _e( 'You can start the configuration by clicking the Flexible Shipping link in the Shipping methods table.', 'flexible-shipping' ); ?></li>
27
- </ol>
28
-
29
- <h4><?php _e( 'Quick Video Overview', 'flexible-shipping' ); ?></h4>
30
-
31
- <div class="flexible-shipping-video">
32
- <?php /* <iframe src="<?php echo $youtube_url?>" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen class="flexible-shipping-video"></iframe> */ ?>
33
- <iframe width="720" height="405" src="<?php echo $youtube_url?>?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
34
- </div>
35
- </div>
36
-
37
- <div class="inspire-sidebar">
38
- <div class="metabox-holder">
39
- <div class="stuffbox">
40
- <h3 class="hndle"><?php _e( 'More resources', 'flexible-shipping' ); ?></h3>
41
-
42
- <div class="inside">
43
- <ul>
44
- <li><a href="<?php echo $general_settings_url; ?>"><?php _e( 'General Settings', 'flexible-shipping' ); ?></a></li>
45
- <li><a href="<?php echo $adding_a_shipping_method_url; ?>"><?php _e( 'Adding a shipping method', 'flexible-shipping' ); ?></a></li>
46
- <li><a href="<?php echo $currency_support_url; ?>"><?php _e( 'Currency Support', 'flexible-shipping' ); ?></a></li>
47
- <li><a href="<?php echo $weight_based_shipping_url; ?>"><?php _e( 'Weight Based Shipping', 'flexible-shipping' ); ?></a></li>
48
- <li><a href="<?php echo $shipping_insurance_url; ?>"><?php _e( 'Shipping Insurance', 'flexible-shipping' ); ?></a></li>
49
- <li><a href="<?php echo $conditional_cash_on_delivery_url; ?>"><?php _e( 'Conditional Cash on Delivery', 'flexible-shipping' ); ?></a></li>
50
- </ul>
51
- </div>
52
- </div>
53
- </div>
54
- </div>
55
- </div>
56
-
57
- <script type="text/javascript">
58
- jQuery(document).ready(function() {
59
- jQuery('.woocommerce-save-button').hide();
60
- })
61
- </script>
62
- <table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/views/html-shipping-method-rules.php CHANGED
@@ -49,21 +49,20 @@
49
  $count_rules = 0;
50
  ?>
51
 
52
- <tr valign="top">
53
  <th class="forminp" colspan="2">
54
  <label for="<?php echo esc_attr( $field ); ?>"><?php echo $data['title']; ?></label>
55
 
56
  <?php
57
- $fs_pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/';
58
 
59
  if ( ! in_array( 'flexible-shipping-pro/flexible-shipping-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ):
60
  ?>
61
- <p><?php printf( __( 'Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on shipment classes, product/item count or additional handling fees/insurance.', 'flexible-shipping' ), '<a href="' . $fs_pro_link . '?utm_source=flexible-shipping-method&utm_medium=text-link&utm_campaign=flexible-shipping-pro" target="_blank">', '</a>' ); ?></p>
62
  <?php endif; ?>
63
  </th>
64
  </tr>
65
-
66
- <tr valign="top">
67
  <td colspan="2" style="padding:0;">
68
  <table id="<?php echo esc_attr( $field ); ?>" class="flexible_shipping_method_rules wc_input_table sortable widefat">
69
  <thead>
49
  $count_rules = 0;
50
  ?>
51
 
52
+ <tr valign="top" class="flexible_shipping_method_rules">
53
  <th class="forminp" colspan="2">
54
  <label for="<?php echo esc_attr( $field ); ?>"><?php echo $data['title']; ?></label>
55
 
56
  <?php
57
+ $fs_pro_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/flexible-shipping-pro-woocommerce/' : 'https://flexibleshipping.com/table-rate/';
58
 
59
  if ( ! in_array( 'flexible-shipping-pro/flexible-shipping-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ):
60
  ?>
61
+ <p><?php printf( __( 'Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on shipment classes, product/item count or additional handling fees/insurance.', 'flexible-shipping' ), '<a href="' . $fs_pro_link . '?utm_campaign=flexible-shipping&utm_source=user-site&utm_medium=link&utm_term=flexible-shipping-pro&utm_content=fs-shippingzone-addnew-rules" target="_blank">', '</a>' ); ?></p>
62
  <?php endif; ?>
63
  </th>
64
  </tr>
65
+ <tr valign="top" class="flexible_shipping_method_rules">
 
66
  <td colspan="2" style="padding:0;">
67
  <table id="<?php echo esc_attr( $field ); ?>" class="flexible_shipping_method_rules wc_input_table sortable widefat">
68
  <thead>
classes/views/html-shipping-method-settings.php CHANGED
@@ -27,7 +27,7 @@
27
  <input type="hidden" name="method_order[<?php echo esc_attr( $shipping_method['id'] ); ?>]" value="<?php echo esc_attr( $shipping_method['id'] ); ?>" />
28
  </td>
29
  <td class="title">
30
- <a href="<?php echo add_query_arg( 'method_id' , $shipping_method_id, add_query_arg( 'action', 'edit' ) ); ?>">
31
  <strong><?php echo esc_html( $shipping_method['method_title'] ); ?></strong>
32
  </a>
33
  <?php if ( isset( $shipping_method['method_description'] ) && $shipping_method['method_description'] != '' ) : ?>
27
  <input type="hidden" name="method_order[<?php echo esc_attr( $shipping_method['id'] ); ?>]" value="<?php echo esc_attr( $shipping_method['id'] ); ?>" />
28
  </td>
29
  <td class="title">
30
+ <a data-qa-id="shipping-method-<?php echo esc_attr( $shipping_method['method_title'] ); ?>" href="<?php echo add_query_arg( 'method_id' , $shipping_method_id, add_query_arg( 'action', 'edit' ) ); ?>">
31
  <strong><?php echo esc_html( $shipping_method['method_title'] ); ?></strong>
32
  </a>
33
  <?php if ( isset( $shipping_method['method_description'] ) && $shipping_method['method_description'] != '' ) : ?>
classes/wpdesk/assets/css/admin-settings.min.css DELETED
@@ -1 +0,0 @@
1
- .select2-container li{margin-bottom:0}.select-2-columns .available-column,.select-2-columns .selected-column{background-color:#fff;border:1px solid #e5e5e5;float:left;margin-right:20px;padding:12px 14px;max-width:450px}.select-2-columns>div>strong{display:block;margin-bottom:10px}.select-2-columns ul{margin:0;min-height:50px;min-width:200px}.select-2-columns li{background-color:#fafafa;border:1px solid #e5e5e5;cursor:move;padding:5px 10px}.select-2-columns li:hover{border-color:#999}.select-2-columns .ui-sortable-placeholder{background-color:transparent;border:1px dashed #b4b9be;visibility:visible !important}.s214-color-picker-label{position:absolute;display:inline-block;padding-top:4px}#system-info-textarea{width:800px;height:400px;font-family:Menlo,Monaco,monospace;background:0;white-space:pre;overflow:auto;display:block}.s214-help-tip{cursor:help}.ui-tooltip{background:#333 !important;border-radius:3px !important;box-shadow:1px 1px 2px 1px rgba(214,214,214,0.5);color:#dedede !important;max-width:300px;padding:7px;text-rendering:optimizeLegibility}
 
classes/wpdesk/assets/js/admin-settings.min.js DELETED
@@ -1 +0,0 @@
1
- jQuery(document).ready(function(b){if(b(".s214-color-picker").length){b(".s214-color-picker").wpColorPicker()}if(b(".s214-select2").length){b(".s214-select2").select2()}if(b(".s214-html").length){b(".s214-html").each(function(c,d){CodeMirror.fromTextArea(d,{lineNumbers:true,mode:"text/html",showCursorWhenSelecting:true})})}b(".s214-help-tip").tooltip({content:function(){return b(this).prop("title")},position:{my:"center top",at:"center bottom+10",collision:"flipfit"},hide:{duration:200},show:{duration:200}});if(b("."+s214_settings_vars.func+"_settings_upload_button").length){var a;b("body").on("click","."+s214_settings_vars.func+"_settings_upload_button",function(d){d.preventDefault();var c=b(this);window.formfield=b(this).parent().prev();if(a){a.open();return}wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:c.data("uploader_title"),button:{text:c.data("uploader_button_text")},multiple:false});a=wp.media.frames.file_frame;a.on("menu:render:default",function(f){var e={};f.unset("library-separator");f.unset("gallery");f.unset("featured-image");f.unset("embed");f.set(e)});a.on("insert",function(){var e=a.state().get("selection");e.each(function(f){f=f.toJSON();window.formfield.val(f.url)})});a.open()});window.formfield=""}});
 
classes/wpdesk/class-helper.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- if ( ! class_exists( 'WPDesk_Helper_Plugin' ) ) {
8
-
9
- class WPDesk_Helper_Plugin {
10
-
11
- /** @var array */
12
- protected $plugin_data;
13
-
14
- /** @var string */
15
- protected $text_domain;
16
-
17
- /** @var string */
18
- protected $ame_activated_key;
19
-
20
- /** @var string */
21
- protected $ame_activation_tab_key;
22
-
23
- /**
24
- * @param array $plugin_data
25
- */
26
- function __construct( $plugin_data ) {
27
- global $wpdesk_helper_plugins;
28
-
29
- $this->plugin_data = $plugin_data;
30
- if ( ! isset( $wpdesk_helper_plugins ) ) {
31
- $wpdesk_helper_plugins = array();
32
- }
33
- $plugin_data['helper_plugin'] = $this;
34
- $wpdesk_helper_plugins[] = $plugin_data;
35
-
36
- $this->ame_activated_key = 'api_' . dirname( $plugin_data['plugin'] ) . '_activated';
37
- $this->ame_activation_tab_key = 'api_' . dirname( $plugin_data['plugin'] ) . '_dashboard';
38
-
39
- }
40
-
41
- /**
42
- * @return void
43
- */
44
- public function inactive_notice() { ?>
45
- <?php if ( ! current_user_can( 'manage_options' ) ) {
46
- return;
47
- } ?>
48
- <?php if ( 1 == 1 && isset( $_GET['page'] ) && $this->ame_activation_tab_key == $_GET['page'] ) {
49
- return;
50
- } ?>
51
- <div class="update-nag">
52
- <?php printf( __( 'The %s%s%s License Key has not been activated, so the plugin is inactive! %sClick here%s to activate the license key and the plugin.', 'wpdesk-plugin' ), '<strong>', $this->plugin_data['product_id'], '</strong>', '<a href="' . esc_url( admin_url( 'admin.php?page=' . $this->ame_activation_tab_key ) ) . '">', '</a>' ); ?>
53
- </div>
54
- <?php
55
- }
56
-
57
- /**
58
- * @param bool $add_notice
59
- *
60
- * @return bool
61
- */
62
- function is_active( $add_notice = false ) {
63
- if ( get_option( $this->ame_activated_key, '0' ) != 'Activated' ) {
64
- if ( $add_notice ) {
65
- add_action( 'admin_notices', array( $this, 'inactive_notice' ) );
66
- }
67
-
68
- return false;
69
- } else {
70
- return true;
71
- }
72
- }
73
-
74
- }
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/wpdesk/class-plugin.php DELETED
@@ -1,277 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- require_once 'functions.php';
8
-
9
- if ( ! class_exists( 'WPDesk_Plugin_1_10' ) ) {
10
-
11
- require_once 'class-settings.php';
12
-
13
- /**
14
- * Base plugin class for WP Desk plugins
15
- *
16
- * @author Grzegorz
17
- *
18
- */
19
- class WPDesk_Plugin_1_10 {
20
-
21
- const VERSION = '1.10';
22
-
23
- /** @var bool */
24
- protected $plugin_is_active = true;
25
-
26
- /** @var array */
27
- protected $default_view_args;
28
-
29
- /** @var string */
30
- public $plugin_namespace = 'wpdesk_plugin';
31
-
32
- /** @var string */
33
- public $plugin_text_domain = 'wpdesk-plugin';
34
-
35
- /** @var bool */
36
- public $plugin_has_settings = false;
37
-
38
- /** @var string */
39
- public $plugin_path;
40
-
41
- /** @var string */
42
- public $template_path;
43
-
44
- /** @var string */
45
- public $plugin_file_path;
46
-
47
- /** @var string */
48
- public $plugin_url;
49
-
50
- /** @var bool */
51
- public $settings_url = false;
52
-
53
- /** @var bool */
54
- public $docs_url = false;
55
-
56
- /** @var string */
57
- public $default_settings_tab = 'general';
58
-
59
- public $settings_hooks = null;
60
-
61
- /** @var WPDesk_Settings_1_10 */
62
- public $settings = null;
63
-
64
- /** @var array */
65
- public $options = null;
66
-
67
- protected function __construct( $base_file, $plugin_data = false ) {
68
- $this->init_base_variables( $base_file );
69
- if ( $this->plugin_is_active ) {
70
- if ( $this->plugin_has_settings ) {
71
- $this->settings = new WPDesk_Settings_1_10( $this, $this->get_namespace(), $this->default_settings_tab );
72
- $this->options = $this->settings->get_settings();
73
- }
74
- }
75
- $this->hooks();
76
- }
77
-
78
- /**
79
- * @return bool
80
- */
81
- public function plugin_is_active() {
82
- return $this->plugin_is_active;
83
- }
84
-
85
- /**
86
- * @return WPDesk_Settings_1_10
87
- */
88
- public function get_settings() {
89
- return $this->settings;
90
- }
91
-
92
- /**
93
- * @param $key
94
- * @param $default
95
- *
96
- * @return mixed
97
- */
98
- public function get_option( $key, $default ) {
99
- return $this->settings->get_option( $key, $default );
100
- }
101
-
102
- /**
103
- * @return $this
104
- */
105
- public function get_plugin() {
106
- return $this;
107
- }
108
-
109
- /**
110
- * @return string
111
- */
112
- public function get_text_domain() {
113
- return $this->plugin_text_domain;
114
- }
115
-
116
- /**
117
- * @return void
118
- */
119
- public function load_plugin_text_domain() {
120
- $wpdesk_translation = load_plugin_textdomain( 'wpdesk-plugin', false, $this->get_namespace() . '/classes/wpdesk/lang/' );
121
- $plugin_translation = load_plugin_textdomain( $this->get_text_domain(), false, $this->get_namespace() . '/lang/' );
122
- }
123
-
124
- /**
125
- * @param string $base_file
126
- */
127
- public function init_base_variables( $base_file ) {
128
- // Set Plugin Path
129
- $this->plugin_path = dirname( $base_file );
130
-
131
- // Set Plugin URL
132
- $this->plugin_url = plugin_dir_url( $base_file );
133
-
134
- $this->plugin_file_path = $base_file;
135
-
136
- $this->template_path = $this->get_namespace();
137
-
138
- $this->default_view_args = array(
139
- 'plugin_url' => $this->get_plugin_url()
140
- );
141
-
142
- }
143
-
144
- /**
145
- * @return void
146
- */
147
- public function hooks() {
148
-
149
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
150
-
151
- add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
152
-
153
- add_action( 'plugins_loaded', array( $this, 'load_plugin_text_domain' ) );
154
-
155
- add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file_path() ), array(
156
- $this,
157
- 'links_filter'
158
- ) );
159
-
160
- }
161
-
162
- /**
163
- *
164
- * @return string
165
- */
166
- public function get_plugin_url() {
167
- return esc_url( trailingslashit( $this->plugin_url ) );
168
- }
169
-
170
- public function get_plugin_assets_url() {
171
- return esc_url( trailingslashit( $this->get_plugin_url() . 'assets' ) );
172
- }
173
-
174
- /**
175
- * @return string
176
- */
177
- public function get_template_path() {
178
- return trailingslashit( $this->template_path );
179
- }
180
-
181
- /**
182
- * @return string
183
- */
184
- public function get_plugin_file_path() {
185
- return $this->plugin_file_path;
186
- }
187
-
188
- /**
189
- * @return string
190
- */
191
- public function get_namespace() {
192
- return $this->plugin_namespace;
193
- }
194
-
195
- /**
196
- * @return null
197
- */
198
- public function get_settings_hooks() {
199
- return $this->settings_hooks;
200
- }
201
-
202
-
203
- /**
204
- * Renders end returns selected template
205
- *
206
- * @param string $name name of the template
207
- * @param string $path additional inner path to the template
208
- * @param array $args args accesible from template
209
- *
210
- * @return string
211
- */
212
- public function load_template( $name, $path = '', $args = array() ) {
213
- $plugin_template_path = trailingslashit( $this->plugin_path ) . 'templates/';
214
-
215
- // Look within passed path within the theme - this is priority.
216
- $template = locate_template(
217
- array(
218
- trailingslashit( $this->get_template_path() ) . trailingslashit( $path ) . $name . '.php',
219
- )
220
- );
221
-
222
- if ( ! $template ) {
223
- $template = $plugin_template_path . trailingslashit( $path ) . $name . '.php';
224
- }
225
-
226
- extract( $args );
227
- ob_start();
228
- include( $template );
229
-
230
- return ob_get_clean();
231
- }
232
-
233
-
234
- public function admin_enqueue_scripts( $hooq ) {
235
- }
236
-
237
- public function wp_enqueue_scripts() {
238
- }
239
-
240
- /**
241
- * action_links function.
242
- *
243
- * @access public
244
- *
245
- * @param mixed $links
246
- *
247
- * @return array
248
- */
249
- public function links_filter( $links ) {
250
-
251
- $support_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/support/' : 'https://www.wpdesk.net/support';
252
-
253
- $plugin_links = array(
254
- '<a href="' . $support_link . '">' . __( 'Support', 'wpdesk-plugin' ) . '</a>',
255
- );
256
- $links = array_merge( $plugin_links, $links );
257
-
258
- if ( $this->docs_url ) {
259
- $plugin_links = array(
260
- '<a href="' . $this->docs_url . '">' . __( 'Docs', 'wpdesk-plugin' ) . '</a>',
261
- );
262
- $links = array_merge( $plugin_links, $links );
263
- }
264
-
265
- if ( $this->settings_url ) {
266
- $plugin_links = array(
267
- '<a href="' . $this->settings_url . '">' . __( 'Settings', 'wpdesk-plugin' ) . '</a>',
268
- );
269
- $links = array_merge( $plugin_links, $links );
270
- }
271
-
272
- return $links;
273
- }
274
-
275
- }
276
-
277
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/wpdesk/class-requirement-checker.php DELETED
@@ -1,356 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- if ( ! class_exists( 'WPDesk_Requirement_Checker_1_10' ) ) {
8
- /**
9
- * Checks requirements for plugin
10
- * have to be compatible with PHP 5.2.x
11
- */
12
- class WPDesk_Requirement_Checker_1_10 {
13
-
14
- const HOOK_PRIORITY_LOAD_AS_FIRST = -10;
15
-
16
- /** @var string */
17
- private $plugin_name = '';
18
-
19
- /** @var string */
20
- private $plugin_file = '';
21
-
22
- /** @var string */
23
- private $min_php_version;
24
-
25
- /** @var string */
26
- private $min_wp_version;
27
-
28
- /** @var string */
29
- private $min_wc_version;
30
-
31
- /** @var array */
32
- private $plugin_require;
33
-
34
- /** @var array */
35
- private $module_require;
36
-
37
- /** @var array */
38
- private $setting_require;
39
-
40
- /** @var array */
41
- private $notices;
42
-
43
- /**
44
- * @param $plugin_file
45
- * @param $php_version
46
- * @param $wp_version
47
- * @param string|null $wc_version
48
- */
49
- public function __construct( $plugin_file, $php_version, $wp_version, $wc_version = null ) {
50
- $this->plugin_file = $plugin_file;
51
- $this->plugin_name = $this->extract_plugin_title_from_header( $plugin_file );
52
- $this->set_min_php_require( $php_version );
53
- $this->set_min_wp_require( $wp_version );
54
- $this->set_min_wc_require( $wc_version );
55
-
56
- $this->plugin_require = array();
57
- $this->module_require = array();
58
- $this->setting_require = array();
59
- $this->notices = array();
60
- }
61
-
62
- /**
63
- * Should be used when you want to check if others plugin are loaded (WC for example)
64
- */
65
- public function check_requirements_and_load_plugin_deferred() {
66
- add_action( "plugins_loaded", array( $this, "check_requirements_and_load_plugin" ), self::HOOK_PRIORITY_LOAD_AS_FIRST );
67
- }
68
-
69
- /**
70
- * Checks if requirements are met and loads bootstrap
71
- */
72
- public function check_requirements_and_load_plugin() {
73
- if ( $this->is_requirements_met() ) {
74
- require_once plugin_dir_path( $this->plugin_file ) . DIRECTORY_SEPARATOR . 'bootstrap.php';
75
- } else {
76
- $this->disable_plugin_render_notice();
77
- }
78
- }
79
-
80
- /**
81
- * @param string $version
82
- *
83
- * @return $this
84
- */
85
- public function set_min_php_require( $version ) {
86
- $this->min_php_version = $version;
87
-
88
- return $this;
89
- }
90
-
91
- /**
92
- * @param string $version
93
- *
94
- * @return $this
95
- */
96
- public function set_min_wp_require( $version ) {
97
- $this->min_wp_version = $version;
98
-
99
- return $this;
100
- }
101
-
102
- /**
103
- * @param string $version
104
- *
105
- * @return $this
106
- */
107
- public function set_min_wc_require( $version ) {
108
- $this->min_wc_version = $version;
109
-
110
- return $this;
111
- }
112
-
113
- /**
114
- * @param string $plugin_name
115
- * @param string $nice_plugin_name Nice plugin name for better looks in notice
116
- *
117
- * @return $this
118
- */
119
- public function add_plugin_require( $plugin_name, $nice_plugin_name = null ) {
120
- if ( is_null( $nice_plugin_name ) ) {
121
- $this->plugin_require[ $plugin_name ] = $plugin_name;
122
- } else {
123
- $this->plugin_require[ $plugin_name ] = $nice_plugin_name;
124
- }
125
-
126
- return $this;
127
- }
128
-
129
- /**
130
- * @param string $module_name
131
- * @param string $nice_name Nice module name for better looks in notice
132
- *
133
- * @return $this
134
- */
135
- public function add_php_module_require( $module_name, $nice_name = null ) {
136
- if ( is_null( $nice_name ) ) {
137
- $this->module_require[ $module_name ] = $module_name;
138
- } else {
139
- $this->module_require[ $module_name ] = $nice_name;
140
- }
141
-
142
- return $this;
143
- }
144
-
145
- /**
146
- * @param string $setting
147
- * @param mixed $value
148
- *
149
- * @return $this
150
- */
151
- public function add_php_setting_require( $setting, $value ) {
152
- $this->setting_require[ $setting ] = $value;
153
-
154
- return $this;
155
- }
156
-
157
- /**
158
- * @param string $file
159
- *
160
- * @return string mixed
161
- */
162
- private function extract_plugin_title_from_header( $file ) {
163
- $plugin_data = get_file_data( $file, array(
164
- 'title' => 'Plugin Name'
165
- ) );
166
-
167
- return $plugin_data['title'];
168
- }
169
-
170
- /**
171
- * @return bool
172
- */
173
- public function is_requirements_met() {
174
- $this->notices = $this->prepare_requirement_notices();
175
-
176
- return count( $this->notices ) === 0;
177
- }
178
-
179
- /**
180
- * @return array
181
- */
182
- private function prepare_requirement_notices() {
183
- $notices = array();
184
- if ( ! $this->is_php_at_least( $this->min_php_version ) ) {
185
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on PHP versions older than %s. Please contact your host and ask them to upgrade.', 'wpdesk-plugin' ), esc_html( $this->plugin_name ), $this->min_php_version ) );
186
- }
187
- if ( ! $this->is_wp_at_least( $this->min_wp_version ) ) {
188
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on WordPress versions older than %s. Please update WordPress.', 'wpdesk-plugin' ), esc_html( $this->plugin_name ), $this->min_wp_version ) );
189
- }
190
- if ( ! is_null( $this->min_wc_version ) && ! $this->is_wc_at_least( $this->min_wc_version ) ) {
191
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run on WooCommerce versions older than %s. Please update WooCommerce.', 'wpdesk-plugin' ), esc_html( $this->plugin_name ), $this->min_wc_version ) );
192
- }
193
- $notices = $this->append_plugin_require_notices( $notices );
194
- $notices = $this->append_module_require_notices( $notices );
195
- $notices = $this->append_settings_require_notices( $notices );
196
-
197
- return $notices;
198
- }
199
-
200
- /**
201
- * @param array $notices
202
- *
203
- * @return array
204
- */
205
- private function append_module_require_notices( $notices ) {
206
- if ( count( $this->module_require ) > 0 ) {
207
- foreach ( $this->module_require as $module_name => $nice_module_name ) {
208
- if ( ! $this->is_module_active( $module_name ) ) {
209
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s php module installed. Please contact your host and ask them to install %s.', 'wpdesk-plugin' ), esc_html( $this->plugin_name ), esc_html( basename( $nice_module_name ) ), esc_html( basename( $nice_module_name ) ) ) );
210
- }
211
- }
212
- }
213
-
214
- return $notices;
215
- }
216
-
217
- /**
218
- * @param array $notices
219
- *
220
- * @return array
221
- */
222
- private function append_settings_require_notices( $notices ) {
223
- if ( count( $this->setting_require ) > 0 ) {
224
- foreach ( $this->setting_require as $setting => $value ) {
225
- if ( ! $this->is_setting_set( $setting, $value ) ) {
226
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s php setting set to %s. Please contact your host and ask them to set %s.', 'wpdesk-plugin' ), esc_html( $this->plugin_name ), esc_html( basename( $setting ) ), esc_html( basename( $value ) ), esc_html( basename( $setting ) ) ) );
227
- }
228
- }
229
- }
230
-
231
- return $notices;
232
- }
233
-
234
- /**
235
- * @param array $notices
236
- *
237
- * @return array
238
- */
239
- private function append_plugin_require_notices( $notices ) {
240
- if ( count( $this->plugin_require ) > 0 ) {
241
- foreach ( $this->plugin_require as $plugin_name => $nice_plugin_name ) {
242
- if ( ! $this->is_wp_plugin_active( $plugin_name ) ) {
243
- $notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin cannot run without %s active. Please install and activate %s plugin.', 'wpdesk-plugin' ), esc_html( $this->plugin_name ), esc_html( basename( $nice_plugin_name ) ), esc_html( basename( $nice_plugin_name ) ) ) );
244
- }
245
- }
246
- }
247
-
248
- return $notices;
249
- }
250
-
251
- /**
252
- * @param string $name
253
- * @param mixed $value
254
- *
255
- * @return bool
256
- */
257
- public static function is_setting_set( $name, $value ) {
258
- return ini_get( $name ) === strval( $value );
259
- }
260
-
261
- /**
262
- * @param string $name
263
- *
264
- * @return bool
265
- */
266
- public static function is_module_active( $name ) {
267
- return extension_loaded( $name );
268
- }
269
-
270
- /**
271
- * @return void
272
- */
273
- public function disable_plugin_render_notice() {
274
- add_action( 'admin_notices', array( $this, 'deactivate_action' ) );
275
- add_action( 'admin_notices', array( $this, 'render_notices_action' ) );
276
- }
277
-
278
- /**
279
- * Shoud be called as WordPress action
280
- *
281
- * @return void
282
- */
283
- public function render_notices_action() {
284
- foreach ( $this->notices as $notice ) {
285
- echo $notice;
286
- }
287
- }
288
-
289
- /**
290
- * Prepares message in html format
291
- *
292
- * @param string $message
293
- *
294
- * @return string
295
- */
296
- private function prepare_notice_message( $message ) {
297
- return '<div class="error"><p>' . $message . '</p></div>';
298
- }
299
-
300
- /**
301
- * @return void
302
- */
303
- public function deactivate_action() {
304
- if ( isset( $this->plugin_file ) ) {
305
- deactivate_plugins( plugin_basename( $this->plugin_file ) );
306
- }
307
- }
308
-
309
- /**
310
- * @param $min_version
311
- *
312
- * @return mixed
313
- */
314
- public static function is_php_at_least( $min_version ) {
315
- return version_compare( phpversion(), $min_version, '>=' );
316
- }
317
-
318
- /**
319
- * @param string $min_version
320
- *
321
- * @return bool
322
- */
323
- public static function is_wp_at_least( $min_version ) {
324
- return version_compare( get_bloginfo( 'version' ), $min_version, '>=' );
325
- }
326
-
327
- /**
328
- * Checks if plugin is active. Needs to be enabled in deferred way.
329
- *
330
- * @param string $plugin_file
331
- *
332
- * @return bool
333
- */
334
- public static function is_wp_plugin_active( $plugin_file ) {
335
- $active_plugins = (array) get_option( 'active_plugins', array() );
336
-
337
- if ( is_multisite() ) {
338
- $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
339
- }
340
-
341
- return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
342
- }
343
-
344
- /**
345
- * Checks if plugin is active and have designated version. Needs to be enabled in deferred way.
346
- *
347
- * @param string $min_version
348
- *
349
- * @return bool
350
- */
351
- public static function is_wc_at_least( $min_version ) {
352
- return defined('WC_VERSION') &&
353
- version_compare( WC_VERSION, $min_version, '>=' );
354
- }
355
- }
356
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/wpdesk/class-settings.php DELETED
@@ -1,352 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- if ( ! class_exists( 'WPDesk_Settings_1_10' ) ) {
8
-
9
- if ( ! class_exists( 'WPDesk_S214_Settings_1_10' ) ) {
10
- require_once 'settings-api/class.s214-settings.php';
11
- }
12
-
13
- /**
14
- * Base plugin class for WP Desk plugins settings
15
- *
16
- * @author Grzegorz
17
- *
18
- */
19
- class WPDesk_Settings_1_10 extends WPDesk_S214_Settings_1_10 {
20
-
21
- private $slug;
22
-
23
- protected $version = '1.0';
24
-
25
- protected $plugin_text_domain = 'wpdesk-plugin';
26
-
27
- protected $plugin = null;
28
-
29
- protected $func = 'wpdesk_plugin';
30
-
31
- public function __construct( WPDesk_Plugin_1_10 $plugin, $slug = 'wpdesk-settings', $default_tab = 'general' ) {
32
- parent::__construct( $slug, $default_tab );
33
- $this->slug = $slug;
34
- $this->plugin = $plugin;
35
- $this->func = str_replace( '-', '_', $slug );
36
- global ${$this->func . '_options'};
37
- ${$this->func . '_options'} = $this->get_settings();
38
- $this->hooks();
39
- }
40
-
41
- public function hooks() {
42
- }
43
-
44
- public function render_settings_page() {
45
- parent::render_settings_page();
46
- }
47
-
48
- public function enqueue_scripts( $hook ) {
49
- if ( ! apply_filters( $this->func . '_load_admin_scripts', $this->load_scripts( $hook ), $hook ) ) {
50
- return;
51
- }
52
-
53
- global $wp_scripts;
54
-
55
- // Use minified libraries if SCRIPT_DEBUG is turned off
56
- $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
57
- //$url_path = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, dirname( __FILE__ ) );
58
- $url_path = $this->plugin->get_plugin_url() . 'classes/wpdesk';
59
- $select2_cdn = 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/';
60
- $cm_cdn = 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.14.2/';
61
- $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.11.4';
62
-
63
- wp_enqueue_style( 'wp-color-picker' );
64
- wp_enqueue_script( 'wp-color-picker' );
65
- wp_enqueue_script( 'jquery-ui-tooltip' );
66
- wp_enqueue_media();
67
- wp_enqueue_style( 'jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui' . $suffix . '.css', array(), $jquery_version );
68
-
69
- wp_enqueue_script( 'media-upload' );
70
- wp_enqueue_style( 'thickbox' );
71
- wp_enqueue_script( 'thickbox' );
72
- wp_enqueue_style( 's14-select2', $select2_cdn . 'css/select2' . $suffix . '.css', array(), '4.0.3' );
73
- wp_enqueue_script( 's14-select2', $select2_cdn . 'js/select2' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
74
-
75
- wp_enqueue_style( $this->slug . '-cm', $cm_cdn . 'codemirror.css', array(), '5.10' );
76
- wp_enqueue_script( $this->slug . '-cm', $cm_cdn . 'codemirror.js', array( 'jquery' ), '5.14.2' );
77
- wp_enqueue_script( $this->slug . '-cm-html', $cm_cdn . 'mode/htmlmixed/htmlmixed.js', array(
78
- 'jquery',
79
- $this->slug . '-cm'
80
- ), '5.14.2' );
81
- wp_enqueue_script( $this->slug . '-cm-xml', $cm_cdn . 'mode/xml/xml.js', array(
82
- 'jquery',
83
- $this->slug . '-cm'
84
- ), '5.14.2' );
85
- wp_enqueue_script( $this->slug . '-cm-js', $cm_cdn . 'mode/javascript/javascript.js', array(
86
- 'jquery',
87
- $this->slug . '-cm'
88
- ), '5.14.2' );
89
- wp_enqueue_script( $this->slug . '-cm-css', $cm_cdn . 'mode/css/css.js', array(
90
- 'jquery',
91
- $this->slug . '-cm'
92
- ), '5.14.2' );
93
- wp_enqueue_script( $this->slug . '-cm-php', $cm_cdn . 'mode/php/php.js', array(
94
- 'jquery',
95
- $this->slug . '-cm'
96
- ), '5.14.2' );
97
- wp_enqueue_script( $this->slug . '-cm-clike', $cm_cdn . 'mode/clike/clike.js', array(
98
- 'jquery',
99
- $this->slug . '-cm'
100
- ), '5.14.2' );
101
-
102
- wp_enqueue_style( $this->slug, $url_path . '/assets/css/admin-settings' . $suffix . '.css', array(), $this->version );
103
- wp_enqueue_script( $this->slug . '-js', $url_path . '/assets/js/admin-settings' . $suffix . '.js', array( 'jquery' ), $this->version );
104
- wp_localize_script( $this->slug . '-js', 's214_settings_vars', apply_filters( $this->func . 'localize_script', array(
105
- 'func' => $this->func,
106
- 'image_media_button' => __( 'Insert Image', 'wpdesk-plugin' ),
107
- 'image_media_title' => __( 'Select Image', 'wpdesk-plugin' ),
108
- ) ) );
109
- }
110
-
111
- /**
112
- * Add settings sections and fields
113
- *
114
- * @access public
115
- * @since 1.0.0
116
- * @return void
117
- */
118
- function register_settings() {
119
- if ( get_option( $this->func . '_settings' ) == false ) {
120
- add_option( $this->func . '_settings' );
121
- }
122
-
123
- foreach ( $this->get_registered_settings() as $tab => $sections ) {
124
- foreach ( $sections as $section => $settings ) {
125
- // Check for backwards compatibility
126
- $section_tabs = $this->get_settings_tab_sections( $tab );
127
-
128
- if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
129
- $section = 'main';
130
- $settings = $sections;
131
- }
132
-
133
- add_settings_section(
134
- $this->func . '_settings_' . $tab . '_' . $section,
135
- __return_null(),
136
- '__return_false',
137
- $this->func . '_settings_' . $tab . '_' . $section
138
- );
139
-
140
- foreach ( $settings as $option ) {
141
- // For backwards compatibility
142
- if ( empty( $option['id'] ) ) {
143
- continue;
144
- }
145
-
146
- $name = isset( $option['name'] ) ? $option['name'] : '';
147
-
148
- add_settings_field(
149
- $this->func . '_settings[' . $option['id'] . ']',
150
- $name,
151
- function_exists( $this->func . '_' . $option['type'] . '_callback' ) ? $this->func . '_' . $option['type'] . '_callback' : ( method_exists( $this, $option['type'] . '_callback' ) ? array(
152
- $this,
153
- $option['type'] . '_callback'
154
- ) : array( $this, 'missing_callback' ) ),
155
- $this->func . '_settings_' . $tab . '_' . $section,
156
- $this->func . '_settings_' . $tab . '_' . $section,
157
- array(
158
- 'section' => $section,
159
- 'id' => isset( $option['id'] ) ? $option['id'] : null,
160
- 'desc' => ! empty( $option['desc'] ) ? $option['desc'] : '',
161
- 'name' => isset( $option['name'] ) ? $option['name'] : null,
162
- 'size' => isset( $option['size'] ) ? $option['size'] : null,
163
- 'options' => isset( $option['options'] ) ? $option['options'] : '',
164
- 'std' => isset( $option['std'] ) ? $option['std'] : '',
165
- 'min' => isset( $option['min'] ) ? $option['min'] : null,
166
- 'max' => isset( $option['max'] ) ? $option['max'] : null,
167
- 'step' => isset( $option['step'] ) ? $option['step'] : null,
168
- 'select2' => isset( $option['select2'] ) ? $option['select2'] : null,
169
- 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
170
- 'multiple' => isset( $option['multiple'] ) ? $option['multiple'] : null,
171
- 'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
172
- 'readonly' => isset( $option['readonly'] ) ? $option['readonly'] : false,
173
- 'buttons' => isset( $option['buttons'] ) ? $option['buttons'] : null,
174
- 'wpautop' => isset( $option['wpautop'] ) ? $option['wpautop'] : null,
175
- 'teeny' => isset( $option['teeny'] ) ? $option['teeny'] : null,
176
- 'tab' => isset( $option['tab'] ) ? $option['tab'] : null,
177
- 'tooltip_title' => isset( $option['tooltip_title'] ) ? $option['tooltip_title'] : false,
178
- 'tooltip_desc' => isset( $option['tooltip_desc'] ) ? $option['tooltip_desc'] : false,
179
-
180
- 'available_header' => isset( $option['available_header'] ) ? $option['available_header'] : null,
181
- 'selected_header' => isset( $option['selected_header'] ) ? $option['selected_header'] : null,
182
-
183
- 'class' => isset( $option['class'] ) ? $option['class'] : '',
184
-
185
- )
186
- );
187
- }
188
- }
189
- }
190
-
191
- register_setting( $this->func . '_settings', $this->func . '_settings', array(
192
- $this,
193
- 'settings_sanitize'
194
- ) );
195
- }
196
-
197
- /**
198
- * Checkbox callback
199
- *
200
- * @access public
201
- * @since 1.0.0
202
- *
203
- * @param array $args Arguments passed by the setting
204
- *
205
- * @global array ${$this->func . '_options'} The plugin options
206
- * @return void
207
- */
208
- public function checkbox_callback( $args ) {
209
- global ${$this->func . '_options'};
210
-
211
- $name = ' name="' . $this->func . '_settings[' . $args['id'] . ']"';
212
-
213
- if ( isset( ${$this->func . '_options'}[ $args['id'] ] ) ) {
214
- $value = ${$this->func . '_options'}[ $args['id'] ];
215
- } else {
216
- $value = isset( $args['std'] ) ? $args['std'] : '';
217
- }
218
-
219
- $checked = checked( 1, $value, false );
220
-
221
- $html = '<input type="hidden"' . $name . ' value="0" />';
222
- $html .= '<input type="checkbox" id="' . $this->func . '_settings[' . $args['id'] . ']"' . $name . ' value="1" ' . $checked . '/>&nbsp;';
223
- $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
224
-
225
- echo apply_filters( $this->func . '_after_setting_output', $html, $args );
226
- }
227
-
228
-
229
- /**
230
- * Date callback
231
- *
232
- * @access public
233
- * @since 1.0.0
234
- *
235
- * @param array $args Arguments passed by the setting
236
- *
237
- * @global array ${$this->func . '_options'} The Beacon options
238
- * @return void
239
- */
240
- public function date_callback( $args ) {
241
- global ${$this->func . '_options'};
242
-
243
- if ( isset( ${$this->func . '_options'}[ $args['id'] ] ) ) {
244
- $value = ${$this->func . '_options'}[ $args['id'] ];
245
- } else {
246
- $value = isset( $args['std'] ) ? $args['std'] : '';
247
- }
248
-
249
- $name = ' name="' . $this->func . '_settings[' . $args['id'] . ']"';
250
- $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'date';
251
- $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
252
-
253
- $html = '<input type="date" ' . '" class="' . $size . '-text" id="' . $this->func . '_settings[' . $args['id'] . ']"' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>&nbsp;';
254
- $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
255
-
256
- echo apply_filters( $this->func . '_after_setting_output', $html, $args );
257
- }
258
-
259
-
260
- /**
261
- * select 2 columns
262
- *
263
- * @access public
264
- * @since 1.0.0
265
- *
266
- * @param array $args Arguments passed by the setting
267
- *
268
- * @global array ${$this->func . '_options'} The Beacon options
269
- * @return void
270
- */
271
- public function select_2_columns_callback( $args ) {
272
- global ${$this->func . '_options'};
273
-
274
- if ( isset( ${$this->func . '_options'}[ $args['id'] ] ) ) {
275
- $value = ${$this->func . '_options'}[ $args['id'] ];
276
- } else {
277
- $value = isset( $args['std'] ) ? $args['std'] : '';
278
- }
279
-
280
- $value_array = explode( ',', $value );
281
-
282
- $available_header = isset( $args['available_header'] ) ? $args['available_header'] : '';
283
-
284
- $selected_header = isset( $args['selected_header'] ) ? $args['selected_header'] : '';
285
-
286
- $html = '<input type="hidden" value="' . esc_attr( $value ) . '" id="' . $this->func . '_settings[' . $args['id'] . ']" name="' . $this->func . '_settings[' . $args['id'] . ']"' . ' />';
287
-
288
- $html_list_available = '<div class="available-column">';
289
- $html_list_available .= '<strong>' . $available_header . '</strong>';
290
- $html_list_available .= '<ul id="' . $this->func . '_settings[' . $args['id'] . '][available]" class="available connectedSortable">';
291
-
292
- $html_list_selected = '<div class="selected-column">';
293
- $html_list_selected .= '<strong>' . $selected_header . '</strong>';
294
- $html_list_selected .= '<ul id="' . $this->func . '_settings[' . $args['id'] . '][selected]" class="selected connectedSortable">';
295
-
296
- foreach ( $args['options'] as $option => $name ) {
297
- if ( is_array( $value_array ) && in_array( $option, $value_array ) ) {
298
- $html_list_selected .= '<li data-value="' . esc_attr( $option ) . '">' . $name . '</li>';
299
- } else {
300
- $html_list_available .= '<li data-value="' . esc_attr( $option ) . '">' . $name . '</li>';
301
- }
302
- }
303
-
304
- $html_list_available .= '</ul></div>';
305
- $html_list_selected .= '</ul></div>';
306
-
307
- $html .= '<div class="select-2-columns">';
308
- $html .= $html_list_available;
309
- $html .= $html_list_selected;
310
-
311
- $html .= '<div style="clear:both;">';
312
-
313
- $html .= '<script type="text/javascript">';
314
- $html .= "\n";
315
- $html .= '
316
- jQuery( function() {
317
- jQuery( "#' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]\\\\[available\\\\], #' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]\\\\[selected\\\\]" ).sortable({
318
- connectWith: ".connectedSortable",
319
- deactivate: function( event, ui ) {
320
- jQuery("#' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]").val("");
321
- var val = "";
322
- jQuery("#' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]\\\\[selected\\\\] > li").each( function () {
323
- if ( val != "" ) {
324
- val = val + ",";
325
- }
326
- val = val + jQuery(this).attr("data-value");
327
- });
328
- jQuery("#' . $this->func . '_settings\\\\[' . $args['id'] . '\\\\]").val(val);
329
- }
330
- }).disableSelection();
331
- } );
332
- ';
333
- $html .= "\n";
334
- $html .= '</script>';
335
-
336
- $html .= '</div>';
337
-
338
- $html .= '<span class="description"><label for="' . $this->func . '_settings[' . $args['id'] . ']">' . $args['desc'] . '</label></span>';
339
-
340
- echo apply_filters( $this->func . '_after_setting_output', $html, $args );
341
- }
342
-
343
- public function set_text_domain( $plugin_text_domain ) {
344
- $this->plugin_text_domain = $plugin_text_domain;
345
- }
346
-
347
- public function get_text_domain() {
348
- return $this->plugin_text_domain;
349
- }
350
-
351
- }
352
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/wpdesk/functions.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- if ( ! function_exists( 'wpdesk_is_plugin_active' ) ) {
8
- /**
9
- * @param $plugin_file
10
- *
11
- * @return bool
12
- * @deprecated 1.10 Use requirement class
13
- */
14
- function wpdesk_is_plugin_active( $plugin_file ) {
15
- return WPDesk_Requirement_Checker_1_10::is_wp_plugin_active($plugin_file);
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/wpdesk/interface-plugin-factory.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- if ( !interface_exists( 'WPDesk_Plugin_Factory_1_10' ) ) {
8
- interface WPDesk_Plugin_Factory_1_10 {
9
- const WPDESK_FILTER_PLUGIN_CLASS = 'wpdesk_plugin_class';
10
-
11
- static function build_plugin();
12
-
13
- static function get_plugin_instance();
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/wpdesk/lang/wpdesk-plugin-pl_PL.mo DELETED
Binary file
classes/wpdesk/lang/wpdesk-plugin-pl_PL.po DELETED
@@ -1,145 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WP Desk Class\n"
4
- "POT-Creation-Date: 2016-10-27 14:04+0100\n"
5
- "PO-Revision-Date: 2016-10-27 14:05+0100\n"
6
- "Last-Translator: wp-kat <admin@wp-kat.net>\n"
7
- "Language-Team: \n"
8
- "Language: pl_PL\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.5.7\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
15
- "|| n%100>=20) ? 1 : 2);\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
- "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
- "X-Poedit-SearchPathExcluded-0: settings-api\n"
21
- "X-Poedit-SearchPath-0: .\n"
22
-
23
- #: class-helper.php:34
24
- #, php-format
25
- msgid ""
26
- "The %s%s%s License Key has not been activated, so the plugin is inactive! "
27
- "%sClick here%s to activate the license key and the plugin."
28
- msgstr ""
29
- "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
30
- "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
31
-
32
- #: class-plugin.php:217
33
- msgid "Docs"
34
- msgstr "Docs"
35
-
36
- #: class-plugin.php:218
37
- msgid "Support"
38
- msgstr "Wsparcie"
39
-
40
- #: class-plugin.php:224
41
- msgid "Settings"
42
- msgstr "Ustawienia"
43
-
44
- #: class-plugin.php:270
45
- #, php-format
46
- msgid ""
47
- "<a href=\"%s\">Install the WP Desk Helper plugin</a> to activate and get "
48
- "updates for your WP Desk plugins."
49
- msgstr ""
50
- "<a href=\"%s\">Zainstaluj wtyczkę WP Desk Helper</a>, aby aktywować i "
51
- "otrzymywać aktualizacje wtyczek WP Desk."
52
-
53
- #: class-plugin.php:276
54
- #, php-format
55
- msgid ""
56
- "<a href=\"%s\">Activate the WP Desk Helper plugin</a> to activate and get "
57
- "updates for your WP Desk plugins."
58
- msgstr ""
59
- "<a href=\"%s\">Włącz wtyczkę WP Desk Helper</a>, aby aktywować i otrzymywać "
60
- "aktualizacje wtyczek WP Desk."
61
-
62
- #: class-settings.php:85 settings-api/class.s214-settings.php:1211
63
- msgid "Insert Image"
64
- msgstr "Wstaw obrazek"
65
-
66
- #: class-settings.php:86 settings-api/class.s214-settings.php:1212
67
- msgid "Select Image"
68
- msgstr "Wybierz obrazek"
69
-
70
- #: settings-api/class.s214-settings.php:144
71
- #: settings-api/class.s214-settings.php:146
72
- msgid "Section214 Settings"
73
- msgstr "Ustawienia Section214"
74
-
75
- #: settings-api/class.s214-settings.php:592
76
- msgid "Settings updated."
77
- msgstr "Ustawienia zostały zaktualizowane."
78
-
79
- #: settings-api/class.s214-settings.php:977
80
- msgid ""
81
- "To copy the system info, click below then press Ctrl + C (PC) or Cmd + C "
82
- "(Mac)."
83
- msgstr ""
84
- "Aby skopiować informacje systemowe kliknij poniżej a następnie wciśnij Ctrl"
85
- "+C lub Cmd+C."
86
-
87
- #: settings-api/class.s214-settings.php:980
88
- msgid "Download System Info File"
89
- msgstr "Pobierz plik z informacjami systemowymi"
90
-
91
- #: settings-api/class.s214-settings.php:1060
92
- msgid "Upload File"
93
- msgstr "Załaduj plik"
94
-
95
- #: settings-api/class.s214-settings.php:1090
96
- msgid "Deactivate License"
97
- msgstr "Deaktywacja licencji"
98
-
99
- #: settings-api/class.s214-settings.php:1121
100
- #, php-format
101
- msgid ""
102
- "The callback function used for the <strong>%s</strong> setting is missing."
103
- msgstr "Funkcja callback dla <strong>%s</strong> nie istnieje"
104
-
105
- #~ msgid "Licensing"
106
- #~ msgstr "Licencjonowanie"
107
-
108
- #~ msgid "%1$s License Key"
109
- #~ msgstr "Klucz licencji %1$s"
110
-
111
- #~ msgid ""
112
- #~ "Please enter your license key to enable automatic updates and support."
113
- #~ msgstr ""
114
- #~ "Wprowadz klucz licencji aby aktywować automatyczne aktualizacje i support."
115
-
116
- #~ msgid "Nonce verification failed"
117
- #~ msgstr "Błąd weryfikacji nonce"
118
-
119
- #~ msgid "Error"
120
- #~ msgstr "Błąd"
121
-
122
- #~ msgid "This license does not belong to the product you have entered it for."
123
- #~ msgstr "Licencja dotyczy innego produktu."
124
-
125
- #~ msgid "This license does not have any activations left"
126
- #~ msgstr "Licencja nie posiada wolnych aktywacji."
127
-
128
- #~ msgid "This license key is expired. Please renew it."
129
- #~ msgstr "Klucz licencyjny wygasł. Proszę go odnowić."
130
-
131
- #~ msgid ""
132
- #~ "There was a problem activating your license key, please try again or "
133
- #~ "contact support. Error code: %s"
134
- #~ msgstr ""
135
- #~ "Wystąpił problem przy aktywacji klucza licencji, proszę spróbować "
136
- #~ "ponownie lub skontaktować się z supportem. Kod błędu: %s"
137
-
138
- #~ msgid ""
139
- #~ "There is a new version of %1$s available. %2$sView version %3$s details"
140
- #~ "%4$s."
141
- #~ msgstr ""
142
- #~ "Jest dostępna nowa wersja %1$s . %2$sZobacz szczegóły %3$s wersji %4$s."
143
-
144
- #~ msgid "You do not have permission to install plugin updates"
145
- #~ msgstr "Brak uprawnień do instalacji aktualizacji"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/wpdesk/settings-api/assets/css/admin.min.css DELETED
@@ -1 +0,0 @@
1
- .s214-color-picker-label{position:absolute;display:inline-block;padding-top:4px}#system-info-textarea{width:800px;height:400px;font-family:Menlo,Monaco,monospace;background:0;white-space:pre;overflow:auto;display:block}.s214-help-tip{cursor:help}.ui-tooltip{background:#333 !important;border-radius:3px !important;box-shadow:1px 1px 2px 1px rgba(214,214,214,0.5);color:#dedede !important;max-width:300px;padding:7px;text-rendering:optimizeLegibility}
 
classes/wpdesk/settings-api/assets/js/admin.min.js DELETED
@@ -1 +0,0 @@
1
- jQuery(document).ready(function(b){if(b(".s214-color-picker").length){b(".s214-color-picker").wpColorPicker()}if(b(".s214-select2").length){b(".s214-select2").select2()}if(b(".s214-html").length){b(".s214-html").each(function(c,d){CodeMirror.fromTextArea(d,{lineNumbers:true,mode:"text/html",showCursorWhenSelecting:true})})}b(".s214-help-tip").tooltip({content:function(){return b(this).prop("title")},position:{my:"center top",at:"center bottom+10",collision:"flipfit"},hide:{duration:200},show:{duration:200}});if(b("."+s214_settings_vars.func+"_settings_upload_button").length){var a;b("body").on("click","."+s214_settings_vars.func+"_settings_upload_button",function(d){d.preventDefault();var c=b(this);window.formfield=b(this).parent().prev();if(a){a.open();return}wp.media.frames.file_frame=wp.media({frame:"post",state:"insert",title:c.data("uploader_title"),button:{text:c.data("uploader_button_text")},multiple:false});a=wp.media.frames.file_frame;a.on("menu:render:default",function(f){var e={};f.unset("library-separator");f.unset("gallery");f.unset("featured-image");f.unset("embed");f.set(e)});a.on("insert",function(){var e=a.state().get("selection");e.each(function(f){f=f.toJSON();window.formfield.val(f.url)})});a.open()});window.formfield=""}});
 
flexible-shipping.php CHANGED
@@ -3,15 +3,15 @@
3
  Plugin Name: Flexible Shipping
4
  Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
- Version: 2.1.10
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
10
- Domain Path: /languages/
11
  Requires at least: 4.5
12
- Tested up to: 4.9.8
13
- WC requires at least: 3.1.0
14
- WC tested up to: 3.5.0
15
 
16
  Copyright 2017 WP Desk Ltd.
17
 
@@ -36,43 +36,51 @@ if ( ! defined( 'ABSPATH' ) ) {
36
  exit;
37
  } // Exit if accessed directly
38
 
39
- $plugin_version = '2.1.10';
 
 
 
40
 
41
- define( 'FLEXIBLE_SHIPPING_VERSION', $plugin_version );
42
 
43
- require_once( __DIR__ . '/vendor/autoload.php' );
 
 
44
 
45
- require_once( 'classes/tracker.php' );
 
 
46
 
47
- require_once( dirname( __FILE__ ) . '/classes/wpdesk/class-requirement-checker.php' );
 
48
 
49
- $requirements_checker = new WPDesk_Requirement_Checker_1_10(
50
  __FILE__,
 
 
51
  '5.5',
52
- '4.5',
53
- '2.6.14'
54
  );
 
 
55
 
56
- $requirements_checker
57
- ->add_plugin_require( 'woocommerce/woocommerce.php', 'WooCommerce' );
58
 
59
- $requirements_checker->check_requirements_and_load_plugin_deferred();
 
 
 
60
 
61
- add_action( 'plugins_loaded', 'flexible_shipping_plugins_loaded', 9 );
62
- if ( ! function_exists( 'flexible_shipping_plugins_loaded' ) ) {
63
- function flexible_shipping_plugins_loaded() {
64
- if ( ! function_exists( 'should_enable_wpdesk_tracker' ) ) {
65
- function should_enable_wpdesk_tracker() {
66
- $tracker_enabled = true;
67
- if ( ! empty( $_SERVER['SERVER_ADDR'] ) && $_SERVER['SERVER_ADDR'] === '127.0.0.1' ) {
68
- $tracker_enabled = false;
69
- }
70
 
71
- return apply_filters( 'wpdesk_tracker_enabled', $tracker_enabled );
72
- }
73
- }
74
 
75
- $tracker_factory = new WPDesk_Tracker_Factory();
76
- $tracker_factory->create_tracker( basename( dirname( __FILE__ ) ) );
77
- }
78
  }
3
  Plugin Name: Flexible Shipping
4
  Plugin URI: https://wordpress.org/plugins/flexible-shipping/
5
  Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
6
+ Version: 3.0.6
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
10
+ Domain Path: /lang/
11
  Requires at least: 4.5
12
+ Tested up to: 5.0.0
13
+ WC requires at least: 3.0.0
14
+ WC tested up to: 3.5.1
15
 
16
  Copyright 2017 WP Desk Ltd.
17
 
36
  exit;
37
  } // Exit if accessed directly
38
 
39
+ // Only PHP 5.2 compatible code
40
+ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) {
41
+ require_once dirname( __FILE__ ) . '/vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php';
42
+ }
43
 
 
44
 
45
+ /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
46
+ $plugin_version = '3.0.6';
47
+ $plugin_release_timestamp = '2018-11-28';
48
 
49
+ $plugin_name = 'Flexible Shipping';
50
+ $plugin_class_name = 'Flexible_Shipping_Plugin';
51
+ $plugin_text_domain = 'flexible-shipping';
52
 
53
+ define( 'FLEXIBLE_SHIPPING_VERSION', $plugin_version );
54
+ define( $plugin_class_name, $plugin_version );
55
 
56
+ $requirements_checker = new WPDesk_Basic_Requirement_Checker(
57
  __FILE__,
58
+ $plugin_name,
59
+ $plugin_text_domain,
60
  '5.5',
61
+ '4.5'
 
62
  );
63
+ $requirements_checker->add_plugin_require( 'woocommerce/woocommerce.php', 'Woocommerce' );
64
+ //$requirements_checker->add_php_module_require( 'intl', 'Internationalization Functions (intl)' );
65
 
 
 
66
 
67
+ if ( $requirements_checker->are_requirements_met() ) {
68
+ if ( ! class_exists( 'WPDesk_Plugin_Info' ) ) {
69
+ require_once dirname( __FILE__ ) . '/vendor/wpdesk/wp-basic-requirements/src/Plugin/Plugin_Info.php';
70
+ }
71
 
72
+ $plugin_info = new WPDesk_Plugin_Info();
73
+ $plugin_info->set_plugin_file_name( plugin_basename( __FILE__ ) );
74
+ $plugin_info->set_plugin_dir( dirname( __FILE__ ) );
75
+ $plugin_info->set_class_name( $plugin_class_name );
76
+ $plugin_info->set_version( $plugin_version );
77
+ $plugin_info->set_product_id( $plugin_text_domain );
78
+ $plugin_info->set_text_domain( $plugin_text_domain );
79
+ $plugin_info->set_release_date( new DateTime( $plugin_release_timestamp ) );
80
+ $plugin_info->set_plugin_url( plugins_url( dirname( plugin_basename( __FILE__ ) ) ) );
81
 
82
+ require_once dirname( __FILE__ ) . '/plugin-load.php';
 
 
83
 
84
+ } else {
85
+ $requirements_checker->disable_plugin_render_notice();
 
86
  }
lang/flexible-shipping-pl_PL.mo ADDED
Binary file
lang/flexible-shipping-pl_PL.po ADDED
@@ -0,0 +1,2153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Flexible Shipping\n"
4
+ "POT-Creation-Date: 2018-11-29 14:04+0100\n"
5
+ "PO-Revision-Date: 2018-11-29 14:04+0100\n"
6
+ "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\n"
7
+ "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
+ "Language: pl_PL\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.2\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "X-Poedit-WPHeader: flexible-shipping.php\n"
15
+ "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
16
+ "|| n%100>=20) ? 1 : 2);\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
19
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
20
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
+ "X-Poedit-SearchPath-0: .\n"
22
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
23
+ "X-Poedit-SearchPathExcluded-1: classes/wpdesk/settings-api\n"
24
+
25
+ #: classes/admin-notices.php:164
26
+ #, php-format
27
+ msgid ""
28
+ "Flexible Shipping has changed the calculation method for shipping rules. "
29
+ "Currently, the cart value for rules based on price is determined by "
30
+ "WooCommerce tax option \"Display prices during cart and checkout\". You "
31
+ "should check the %ssettings%s."
32
+ msgstr ""
33
+ "Flexible Shipping: zaktualizowane zostały metody obliczania reguł wysyłki. "
34
+ "Aktualnie dla reguł opartych na cenie wartość koszyka zostanie obliczona na "
35
+ "podstawie ustawienia podatków WooCommerce ”Wyświetlanie cen w sklepie”. "
36
+ "Sprawdź %sustawienia podatków%s."
37
+
38
+ #: classes/admin-notices.php:181
39
+ msgid ""
40
+ "Flexible Shipping requires at least version 2.7 of Active Payments plugin."
41
+ msgstr ""
42
+ "Flexible Shipping wymaga wtyczki Aktywne płatności w wersji co najmniej 2.7."
43
+
44
+ #: classes/admin-notices.php:196
45
+ msgid "Flexible Shipping requires at least version 1.2 of eNadawca plugin."
46
+ msgstr "Flexible Shipping wymaga wtyczki eNadawca w wersji co najmniej 1.2."
47
+
48
+ #: classes/admin-notices.php:211
49
+ msgid ""
50
+ "Flexible Shipping requires at least version 1.1 of Paczka w Ruchu plugin."
51
+ msgstr ""
52
+ "Flexible Shipping wymaga wtyczki Paczka w Ruchu w wersji co najmniej 1.1."
53
+
54
+ #: classes/admin-notices.php:223
55
+ #, php-format
56
+ msgid ""
57
+ "You are using WooCommerce Flexible Shipping below 1.4. Please deactivate it "
58
+ "on %splugins page%s. Read about big changes in Flexible Shipping on %sour "
59
+ "blog →%s"
60
+ msgstr ""
61
+ "Masz włączony WooCommerce Flexible Shipping w wersji starszej niż 1.4. "
62
+ "Wyłącz go na %sstronie wtyczek%s. Przeczytaj o dużej zmianie we Flexible "
63
+ "Shipping na %snaszym blogu →%s"
64
+
65
+ #: classes/bulk-actions.php:46
66
+ msgid "New"
67
+ msgstr "Nowa"
68
+
69
+ #: classes/bulk-actions.php:47 classes/bulk-actions.php:198
70
+ #: classes/shipment/ajax.php:55
71
+ msgid "Created"
72
+ msgstr "Utworzona"
73
+
74
+ #: classes/bulk-actions.php:48 classes/bulk-actions.php:199
75
+ msgid "Confirmed"
76
+ msgstr "Zatwierdzona"
77
+
78
+ #: classes/bulk-actions.php:49
79
+ msgid "Manifest"
80
+ msgstr "Protokół nadania"
81
+
82
+ #: classes/bulk-actions.php:50
83
+ msgid "Failed"
84
+ msgstr "Błąd"
85
+
86
+ #: classes/bulk-actions.php:196 classes/bulk-actions.php:226
87
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/S214_Plugin_Updater.php:340
88
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:197
89
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:270
90
+ msgid "Error"
91
+ msgstr "Błąd"
92
+
93
+ #: classes/bulk-actions.php:197
94
+ msgid "New shipment"
95
+ msgstr "Nowa"
96
+
97
+ #: classes/bulk-actions.php:200
98
+ msgid "Manifest created"
99
+ msgstr "Protokół nadania utworzony"
100
+
101
+ #: classes/bulk-actions.php:255 classes/bulk-actions.php:261
102
+ msgid "Shipping"
103
+ msgstr "Wysyłka"
104
+
105
+ #: classes/bulk-actions.php:269
106
+ msgid "Send shipment"
107
+ msgstr "Nadaj przesyłki"
108
+
109
+ #: classes/bulk-actions.php:270
110
+ msgid "Get labels"
111
+ msgstr "Pobierz etykiety nadawcze"
112
+
113
+ #: classes/bulk-actions.php:272
114
+ msgid "Create shipping manifest"
115
+ msgstr "Utwórz protokół nadania"
116
+
117
+ #: classes/bulk-actions.php:294
118
+ msgid "Shipment created."
119
+ msgstr "Przesyłka utworzona."
120
+
121
+ #: classes/bulk-actions.php:306
122
+ msgid "No action performed."
123
+ msgstr "Nie wykonano żdanych działań."
124
+
125
+ #: classes/bulk-actions.php:326
126
+ msgid "Label downloaded."
127
+ msgstr "Etykieta została pobrana."
128
+
129
+ #: classes/bulk-actions.php:344
130
+ msgid ""
131
+ "Unable to create temporary zip archive for labels. Check temporary folder "
132
+ "configuration on server."
133
+ msgstr ""
134
+ "Nie można utworzyć tymczasowego archwium zip dla etykiet. Sprawdź "
135
+ "konfigurację folderu na serwerze."
136
+
137
+ #: classes/bulk-actions.php:408
138
+ #, php-format
139
+ msgid ""
140
+ "Created manifest: %s (%s). If download not start automatically click %shere"
141
+ "%s."
142
+ msgstr ""
143
+ "Utworzone protokoły nadania: %s (%s). Jesli pobieranie nie rozpoczęło się "
144
+ "automatycznie kliknij %stutaj%s."
145
+
146
+ #: classes/bulk-actions.php:420
147
+ #, php-format
148
+ msgid "Manifest creation error: %s (%s)."
149
+ msgstr "Błąd podczas tworzenia protokołu nadania: %s (%s)."
150
+
151
+ #: classes/bulk-actions.php:431
152
+ msgid "No manifests created."
153
+ msgstr "Nie zostały utworzone protokoły nadania."
154
+
155
+ #: classes/bulk-actions.php:445
156
+ #, php-format
157
+ msgid "Bulk send shipment - processed orders: %d"
158
+ msgstr "Masowe nadawanie przesyłek - przetworzone zamówienia: %d"
159
+
160
+ #: classes/bulk-actions.php:454
161
+ #, php-format
162
+ msgid "Bulk labels - processed orders: %d. No labels for processed orders."
163
+ msgstr ""
164
+ "Masowe pobieranie etykiet - przetworzone zamówienia: %d. Brak etykiet dla "
165
+ "przetworzonych zamówień."
166
+
167
+ #: classes/bulk-actions.php:470
168
+ #, php-format
169
+ msgid ""
170
+ "Bulk labels - processed orders: %d. If download not start automatically "
171
+ "click %shere%s."
172
+ msgstr ""
173
+ "Masowe pobieranie etykiet - przetworzone zamówienia: %d. Jeśli pobieranie "
174
+ "nie rozpoczęło się automatycznie kliknij %stutaj%s ."
175
+
176
+ #: classes/bulk-actions.php:479
177
+ #, php-format
178
+ msgid "Bulk shipping manifest - processed orders: %d"
179
+ msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
180
+
181
+ #: classes/class-flexible-shipping-plugin.php:372
182
+ #: vendor/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:147
183
+ msgid "Settings"
184
+ msgstr "Ustawienia"
185
+
186
+ #: classes/class-flexible-shipping-plugin.php:374
187
+ #: vendor/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:140
188
+ msgid "Docs"
189
+ msgstr "Docs"
190
+
191
+ #: classes/class-flexible-shipping-plugin.php:375
192
+ #: vendor/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:134
193
+ msgid "Support"
194
+ msgstr "Wsparcie"
195
+
196
+ #: classes/class-flexible-shipping-plugin.php:381
197
+ msgid "Upgrade"
198
+ msgstr "Kup PRO"
199
+
200
+ #: classes/class-order-add-shipping.php:38
201
+ #, php-format
202
+ msgid "Shipment for order %1$s, %2$s"
203
+ msgstr "Przesyłka do zamówienia %s, %s"
204
+
205
+ #: classes/class-order-add-shipping.php:53
206
+ #, php-format
207
+ msgid "Added new shipment via metabox. Shipment ID: %s"
208
+ msgstr "Dodano nową przesyłkę. Numer przesyłki: %s"
209
+
210
+ #: classes/class-order-add-shipping.php:104
211
+ msgid "Select integration"
212
+ msgstr "Wybierz integrację"
213
+
214
+ #: classes/class-order-add-shipping.php:113
215
+ msgid "Add shipping"
216
+ msgstr "Dodaj przesyłkę"
217
+
218
+ #: classes/logger/class-saas-logger-downloader.php:57
219
+ msgid "File not exists!"
220
+ msgstr "Plik nie istnieje!"
221
+
222
+ #: classes/logger/class-saas-logger-downloader.php:60
223
+ msgid "Insufficient privileges!"
224
+ msgstr "Niewystraczające uprawnienia!"
225
+
226
+ #: classes/logger/class-saas-logger-settings.php:95
227
+ msgid "Advanced settings"
228
+ msgstr "Ustawienia zaawansowane"
229
+
230
+ #: classes/logger/class-saas-logger-settings.php:99
231
+ msgid "Enable Debug Mode"
232
+ msgstr "Włącz tryb debug"
233
+
234
+ #: classes/logger/class-saas-logger-settings.php:100
235
+ msgid "Debug mode"
236
+ msgstr "Tryb debug"
237
+
238
+ #: classes/logger/class-saas-logger-settings.php:107
239
+ #, php-format
240
+ msgid "%1$sDownload debug.log file%2$s"
241
+ msgstr "%1$sPobierz plik debug.log%2$s"
242
+
243
+ #: classes/manifest/cpt-shipping-manifest.php:60
244
+ #: classes/manifest/cpt-shipping-manifest.php:62
245
+ #: classes/manifest/cpt-shipping-manifest.php:64
246
+ #: classes/manifest/cpt-shipping-manifest.php:97
247
+ msgid "Shipping Manifests"
248
+ msgstr "Protokoły nadania"
249
+
250
+ #: classes/manifest/cpt-shipping-manifest.php:61
251
+ msgid "Shipping Manifest"
252
+ msgstr "Protokół nadania"
253
+
254
+ #: classes/manifest/cpt-shipping-manifest.php:65
255
+ msgid "View Shipping Manifests"
256
+ msgstr "Wyświetl protokół nadania"
257
+
258
+ #: classes/manifest/cpt-shipping-manifest.php:66
259
+ msgid "Add new Shipping Manifest"
260
+ msgstr "Dodaj nowy Protokół nadania"
261
+
262
+ #: classes/manifest/cpt-shipping-manifest.php:67
263
+ msgid "Add new Shipping Manifests"
264
+ msgstr "Dodaj nowe Protokoły nadania"
265
+
266
+ #: classes/manifest/cpt-shipping-manifest.php:68
267
+ msgid "Edit Shipping Manifest"
268
+ msgstr "Edytuj protokół nadania"
269
+
270
+ #: classes/manifest/cpt-shipping-manifest.php:69
271
+ msgid "Save Shipping Manifest"
272
+ msgstr "Zapisz protokół nadania"
273
+
274
+ #: classes/manifest/cpt-shipping-manifest.php:70
275
+ msgid "Search Shipping Manifests"
276
+ msgstr "Szukaj protokół nadania"
277
+
278
+ #: classes/manifest/cpt-shipping-manifest.php:71
279
+ msgid "Shipping Manifests not found"
280
+ msgstr "Nie znaleziono protokołów nadania"
281
+
282
+ #: classes/manifest/cpt-shipping-manifest.php:72
283
+ msgid "Shipping Manifests not found in trash"
284
+ msgstr "Nie znaleziono protokołów nadania w koszu"
285
+
286
+ #: classes/manifest/cpt-shipping-manifest.php:74
287
+ msgid "Shipping Manifests."
288
+ msgstr "Protokoły nadania."
289
+
290
+ #: classes/manifest/cpt-shipping-manifest.php:116
291
+ #: classes/shipment/cpt-shipment.php:48 classes/shipment/cpt-shipment.php:50
292
+ #: classes/shipment/cpt-shipment.php:52
293
+ msgid "Shipments"
294
+ msgstr "Przesyłki"
295
+
296
+ #: classes/manifest/cpt-shipping-manifest.php:160
297
+ msgid "Date"
298
+ msgstr "Data"
299
+
300
+ #: classes/manifest/cpt-shipping-manifest.php:161
301
+ #: classes/manifest/views/filter-form.php:5
302
+ #: classes/settings/shipping-method-form.php:137
303
+ #: classes/views/html-orders-filter-form.php:5
304
+ #: classes/views/html-shipping-method-settings.php:15
305
+ msgid "Integration"
306
+ msgstr "Integracja"
307
+
308
+ #: classes/manifest/cpt-shipping-manifest.php:162
309
+ msgid "Number"
310
+ msgstr "Numer"
311
+
312
+ #: classes/manifest/cpt-shipping-manifest.php:163
313
+ msgid "Shipments count"
314
+ msgstr "Liczba przesyłek"
315
+
316
+ #: classes/manifest/cpt-shipping-manifest.php:164
317
+ msgid "Actions"
318
+ msgstr "Akcje"
319
+
320
+ #: classes/manifest/cpt-shipping-manifest.php:219
321
+ #: classes/manifest/cpt-shipping-manifest.php:243
322
+ #: classes/shipment/cpt-shipment.php:188
323
+ msgid "Invalid nonce!"
324
+ msgstr "Błąd weryfikacji nonce!"
325
+
326
+ #: classes/manifest/functions.php:16
327
+ #, php-format
328
+ msgid "Shipping manifest %s, %s"
329
+ msgstr "Protokół nadania %s, %s"
330
+
331
+ #: classes/manifest/views/column-actions.php:1
332
+ msgid "Download"
333
+ msgstr "Pobierz"
334
+
335
+ #: classes/manifest/views/column-actions.php:2
336
+ #: classes/shipment/saas/views/order-metabox-actions.php:15
337
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:78
338
+ msgid "Cancel"
339
+ msgstr "Anuluj"
340
+
341
+ #: classes/manifest/views/filter-form.php:4
342
+ msgid "All manifests"
343
+ msgstr "Wszystkie protokoły nadania"
344
+
345
+ #: classes/manifest/views/manifest-metabox.php:7
346
+ #: classes/manifest/views/manifest-metabox.php:47
347
+ #: classes/shipment/cpt-shipment.php:49
348
+ #: templates/email/after_order_table.php:12
349
+ #: templates/myaccount/after_order_table.php:12
350
+ msgid "Shipment"
351
+ msgstr "Przesyłka"
352
+
353
+ #: classes/manifest/views/manifest-metabox.php:10
354
+ #: classes/manifest/views/manifest-metabox.php:50
355
+ msgid "Order"
356
+ msgstr "Zamówienie"
357
+
358
+ #. Plugin Name of the plugin/theme
359
+ #: classes/multilingual.php:44 classes/multilingual.php:47
360
+ #: classes/multilingual.php:50 classes/saas/class-saas-settings.php:63
361
+ #: classes/settings/flexible-shipping.php:16
362
+ #: classes/settings/flexible-shipping.php:30
363
+ #: classes/settings/shipping-method-form.php:79 classes/shipping-method.php:24
364
+ #: classes/shipping-method.php:25 classes/shipping-method.php:43
365
+ msgid "Flexible Shipping"
366
+ msgstr "Flexible Shipping"
367
+
368
+ #: classes/saas/class-saas-bad-credentials-exception.php:17
369
+ #, php-format
370
+ msgid ""
371
+ "The Connect Key that you entered is invalid. Please enter a valid key. "
372
+ "%1$sGet your Connect Key →%2$s"
373
+ msgstr ""
374
+ "Wprowadzony klucz Connect jest nieprawidłowy. Proszę wprowadzić prawidłowy "
375
+ "klucz. %1$sPobierz swój klucz Connect →%2$s"
376
+
377
+ #: classes/saas/class-saas-connection-status-ajax.php:55
378
+ msgid "Something go wrong!"
379
+ msgstr "Coś poszło nie tak!"
380
+
381
+ #: classes/saas/class-saas-connection-status-ajax.php:61
382
+ #, php-format
383
+ msgid ""
384
+ "Invalid response from Flexible Shipping Connect platform. Response code: "
385
+ "%1$s."
386
+ msgstr ""
387
+ "Nieprawidłowa odpowiedź Flexible Shipping Connect. Kod odpowiedzi: %1$s."
388
+
389
+ #: classes/saas/class-saas-connection-status-ajax.php:69
390
+ msgid "OK"
391
+ msgstr "OK"
392
+
393
+ #: classes/saas/class-saas-connection-status-field.php:63
394
+ msgid "Checking..."
395
+ msgstr "Sprawdzanie…"
396
+
397
+ #: classes/saas/class-saas-connection-status-field.php:67
398
+ msgid "Something go wrong! (AJAX)"
399
+ msgstr "Coś pójdzie nie tak! (AJAX)"
400
+
401
+ #: classes/saas/class-saas-connection-status-field.php:70
402
+ msgid "Add credentials"
403
+ msgstr "Dodaj ustawienia"
404
+
405
+ #: classes/saas/class-saas-connection.php:250
406
+ msgid ""
407
+ "Your store has been connected to Flexible Shipping Connect. Choose from the "
408
+ "available shipping integrations below."
409
+ msgstr ""
410
+ "Twój sklep został podłączony do Flexible Shipping Connect. Wybierz jedną z "
411
+ "dostępnych poniżej integracji wysyłkowych."
412
+
413
+ #: classes/saas/class-saas-connection.php:260
414
+ msgid ""
415
+ "You are now disconnected from Flexible Shipping Connect. All shipping "
416
+ "services have been disabled. To use Flexible Shipping Connect again, please "
417
+ "enter a valid Connect Key."
418
+ msgstr ""
419
+ "Zostałeś teraz odłączony od Flexible Shipping Connect. Wszystkie integracje "
420
+ "wysyłkowe zostały wyłączone. Aby ponownie użyć Flexible Shipping Connect, "
421
+ "wprowadź ważny klucz Connect."
422
+
423
+ #: classes/saas/class-saas-connection.php:270
424
+ msgid "Your store is already connected to Flexible Shipping Connect!"
425
+ msgstr "Twój sklep jest już podłączony do Flexible Shipping Connect!"
426
+
427
+ #: classes/saas/class-saas-connection.php:281
428
+ #, php-format
429
+ msgid ""
430
+ "Your store (%1$s) is already registered on another account. You can register "
431
+ "your domain only on one account. If you have questions, %2$scontact us%3$s."
432
+ msgstr ""
433
+ "Twój sklep (%1$s) jest już zarejestrowany na innym koncie. Możesz "
434
+ "zarejestrować swoją domenę tylko na jednym koncie. Jeśli masz pytania, "
435
+ "%2$sskontaktuj się z nami%3$s."
436
+
437
+ #: classes/saas/class-saas-connection.php:330
438
+ #, php-format
439
+ msgid "Message from platform: %1$s%2$s%3$s"
440
+ msgstr "Komunikat z platformy: %1$s%2$s%3$s"
441
+
442
+ #: classes/saas/class-saas-connection.php:342
443
+ #, php-format
444
+ msgid ""
445
+ "FS Connect is undergoing maintenance. To get more information about the "
446
+ "platform status check %1$sstatus.flexibleshipping.com &rarr;%2$s%3$s"
447
+ msgstr ""
448
+ "FS Connect jest w trakcie konserwacji. Aby uzyskać więcej informacji na "
449
+ "temat statusu platformy sprawdź %1$sstatus.flexibleshipping.com &rarr;%2$s"
450
+ "%3$s"
451
+
452
+ #: classes/saas/class-saas-connection.php:366
453
+ msgid ""
454
+ "There are some connection problems. Please try again in a few minutes. "
455
+ "Thanks!"
456
+ msgstr ""
457
+ "Chwilowe problemy z połączeniem. Spróbuj ponownie za kilka minut. Dziękujemy!"
458
+
459
+ #: classes/saas/class-saas-connection.php:372
460
+ #, php-format
461
+ msgid ""
462
+ "To get more information about the platform status check %1$sstatus."
463
+ "flexibleshipping.com &rarr;%2$s"
464
+ msgstr ""
465
+ "Aby uzyskać więcej informacji na temat statusu platformy sprawdź %1$sstatus."
466
+ "flexibleshipping.com &rarr;%2$s"
467
+
468
+ #: classes/saas/class-saas-connection.php:397
469
+ #, php-format
470
+ msgid ""
471
+ "The Connect Key that you entered is invalid. Please enter a valid key. "
472
+ "%1$sRegister%3$s for a new key or log in to %2$syour account%3$s to get your "
473
+ "key."
474
+ msgstr ""
475
+ "Wprowadzony klucz Connect jest nieprawidłowy. Proszę wprowadzić prawidłowy "
476
+ "klucz. %1$sZarejestruj się%3$s lub zaloguj na %2$sistniejące konto%3$s aby "
477
+ "otrzymać klucz."
478
+
479
+ #: classes/saas/class-saas-connection.php:578
480
+ msgid "Disconnect"
481
+ msgstr "Rozłącz"
482
+
483
+ #: classes/saas/class-saas-connection.php:582
484
+ msgid "Connect"
485
+ msgstr "Połącz"
486
+
487
+ #: classes/saas/class-saas-free-shipping-metadata-handler.php:36
488
+ #, php-format
489
+ msgid "%1$s (free shipping)"
490
+ msgstr "%1$s (darmowa wysyłka)"
491
+
492
+ #: classes/saas/class-saas-live-rates-fallback-metadata-handler.php:38
493
+ #, php-format
494
+ msgid "%1$s (fallback)"
495
+ msgstr "%1$s (stawka awaryjna)"
496
+
497
+ #: classes/saas/class-saas-live-rates-handler.php:435
498
+ #, php-format
499
+ msgid "Flexible Shipping Fallback: %1$s"
500
+ msgstr "Stawka awaryjna Flexible Shipping: %1$s"
501
+
502
+ #: classes/saas/class-saas-settings-service-checkbox.php:78
503
+ msgid "Invalid requireWordpressPluginVersion capability!"
504
+ msgstr "Invalid requireWordpressPluginVersion capability!"
505
+
506
+ #: classes/saas/class-saas-settings-service-checkbox.php:83
507
+ #, php-format
508
+ msgid ""
509
+ "This integration requires Flexible Shipping Plugin in version %1$s or newer!"
510
+ msgstr ""
511
+ "Ta integracja wymaga wtyczki Flexible Shipping w wersji %1$s lub nowszej!"
512
+
513
+ #: classes/saas/class-saas-settings-service-checkbox.php:92
514
+ #, php-format
515
+ msgid "Go to %s settings</a>"
516
+ msgstr "Przejdź do ustawień %s</a>"
517
+
518
+ #: classes/saas/class-saas-settings-service-checkbox.php:110
519
+ #, php-format
520
+ msgid "%1$s%2$s (new)%3$s"
521
+ msgstr "%1$s%2$s (nowość)%3$s"
522
+
523
+ #: classes/saas/class-saas-settings-service-checkbox.php:127
524
+ msgid "Enable"
525
+ msgstr "Włącz"
526
+
527
+ #: classes/saas/class-saas-settings.php:213
528
+ msgid "Connect Services"
529
+ msgstr "Usługi Connect"
530
+
531
+ #: classes/saas/class-saas-settings.php:214
532
+ msgid ""
533
+ "Enable services to automate shipping and print labels with Flexible Shipping "
534
+ "Connect."
535
+ msgstr ""
536
+ "Włącz usługi aby automatyzować wysyłkę i pobierać etykiety dzięki Flexible "
537
+ "Shipping Connect."
538
+
539
+ #: classes/saas/class-saas-shipment-order-auto-complete.php:59
540
+ msgid "Order status changed automatically by Flexible Shipping Plugin."
541
+ msgstr ""
542
+ "Status zamówienia zmieniony automatycznie przez wtyczkę Flexible Shipping."
543
+
544
+ #: classes/saas/class-saas-shipment-settings-field.php:37
545
+ msgid "Create shipments"
546
+ msgstr "Utwórz przesyłkę"
547
+
548
+ #: classes/saas/class-saas-shipment-settings-field.php:42
549
+ msgid "Manually"
550
+ msgstr "Manualnie"
551
+
552
+ #: classes/saas/class-saas-shipment-settings-field.php:43
553
+ msgid "Automatically"
554
+ msgstr "Automatyczne"
555
+
556
+ #: classes/saas/class-saas-shipment-settings-field.php:45
557
+ msgid ""
558
+ "Choose to create shipments manually or automatically based on the order "
559
+ "status."
560
+ msgstr ""
561
+ "Wybierz opcję ręcznego lub automatycznego tworzenia przesyłek w oparciu o "
562
+ "status zamówienia."
563
+
564
+ #: classes/saas/class-saas-shipment-settings-field.php:49
565
+ msgid "Order status"
566
+ msgstr "Status zamówienia"
567
+
568
+ #: classes/saas/class-saas-shipment-settings-field.php:54
569
+ msgid "Select order status for automatic shipment creation."
570
+ msgstr "Wybierz status zamówienia do automatycznego tworzenia przesyłek."
571
+
572
+ #: classes/saas/class-saas-shipment-settings-field.php:58
573
+ msgid "Complete order"
574
+ msgstr "Zamówienie zrealizowane"
575
+
576
+ #: classes/saas/class-saas-shipment-settings-field.php:61
577
+ msgid "Enable automatic order status change"
578
+ msgstr "Włącz automatyczną zmianę statusu zamówienia"
579
+
580
+ #: classes/saas/class-saas-shipment-settings-field.php:63
581
+ msgid "Automatically change order status to completed after creating shipment."
582
+ msgstr ""
583
+ "Automatyczna zmiana statusu zamówienia na zrealizowane po utworzeniu "
584
+ "przesyłki."
585
+
586
+ #: classes/saas/class-saas-shipping-service-settings.php:247
587
+ msgid "Invalid format - contact with flexibleshipping.com administrator."
588
+ msgstr "Invalid format - contact with flexibleshipping.com administrator."
589
+
590
+ #: classes/saas/class-saas-shipping-service-settings.php:254
591
+ #, php-format
592
+ msgid "Ups, something is wrong. Error code: %1$s."
593
+ msgstr "UPS nie działa poprawnie. Kod błędu: %1$s."
594
+
595
+ #: classes/saas/class-saas-shipping-service.php:539
596
+ msgid "Rates type"
597
+ msgstr "Typ stawek"
598
+
599
+ #: classes/saas/class-saas-shipping-service.php:543
600
+ #: classes/saas/class-saas-shipping-service.php:555
601
+ msgid "Custom"
602
+ msgstr "Własne"
603
+
604
+ #: classes/saas/class-saas-shipping-service.php:547
605
+ #, php-format
606
+ msgid ""
607
+ "Choose custom rates to set a custom shipping cost (this method will be the "
608
+ "selected %1$s service). Choose live rates if you want to present services "
609
+ "and rates for the customer's address."
610
+ msgstr ""
611
+ "Wybierz własne stawki aby ustawić niestandardowe koszty wysyłki (metodą "
612
+ "wysyłki będzie wybrana usługa %1$s). Wybierz stawki Live, jeśli chcesz "
613
+ "prezentować usługi i stawki wg. adresu klienta."
614
+
615
+ #: classes/saas/class-saas-shipping-service.php:554
616
+ msgid "Live"
617
+ msgstr "Live"
618
+
619
+ #: classes/saas/class-saas-shipping-service.php:573
620
+ msgid "Custom services"
621
+ msgstr "Usługi"
622
+
623
+ #: classes/saas/class-saas-shipping-service.php:577
624
+ msgid "Enable services custom settings"
625
+ msgstr "Włącz własne ustawienia usług"
626
+
627
+ #: classes/saas/class-saas-shipping-service.php:619
628
+ msgid "Fallback"
629
+ msgstr "Stawka awaryjna"
630
+
631
+ #: classes/saas/class-saas-shipping-service.php:620
632
+ msgid "Enable fallback"
633
+ msgstr "Włącz stawkę awaryjną"
634
+
635
+ #: classes/saas/class-saas-shipping-service.php:622
636
+ msgid ""
637
+ "Enable to offer flat rate cost for shipping so that the user can still "
638
+ "checkout, if API returns no matching rates."
639
+ msgstr ""
640
+ "Włącz aby oferować płaską stawkę wysyłki. Klient będzie mógł zrealizować "
641
+ "zamówienia jeśli API nie zwróci żadnych usług."
642
+
643
+ #: classes/saas/class-saas-shipping-service.php:755
644
+ #, php-format
645
+ msgid "You need to configure the service. %1$sGo to %2$s settings.%3$s"
646
+ msgstr "Musisz skonfigurować usługę. %1$sPrzejdź do %2$s ustawień.%3$s"
647
+
648
+ #: classes/saas/class-saas-shipping-services-manager.php:147
649
+ #, php-format
650
+ msgid "%1$sYour settings have been saved.%2$s"
651
+ msgstr "%1$sUstawienia zostały zapisane.%2$s"
652
+
653
+ #: classes/saas/class-saas-shipping-services.php:102
654
+ msgid "Services"
655
+ msgstr "Usługi"
656
+
657
+ #: classes/saas/class-saas-user-registration.php:128
658
+ #: classes/saas/class-saas-user-registration.php:129
659
+ msgid "Flexible Shipping Connect Registration"
660
+ msgstr "Rejestracja Flexible Shipping Connect"
661
+
662
+ #: classes/saas/class-saas-user-registration.php:203
663
+ msgid ""
664
+ "There are some connection problems. Please try again in few minutes. Thanks!"
665
+ msgstr ""
666
+ "Chwilowe problemy z połączeniem. Spróbuj ponownie za kilka minut. Dziękujemy!"
667
+
668
+ #: classes/saas/class-saas-user-registration.php:212
669
+ msgid "Please enter a valid email!"
670
+ msgstr "Proszę podać poprawny adres e-mail!"
671
+
672
+ #: classes/saas/class-saas-user-registration.php:225
673
+ #, php-format
674
+ msgid ""
675
+ "%1$sAccount created, please check your email and click the activation link "
676
+ "to connect (%3$s).%2$s If you haven't received the email, please %4$scontact "
677
+ "us%5$s."
678
+ msgstr ""
679
+ "%1$sUtworzono konto, sprawdź swój e-mail i kliknij link aktywacyjny aby się "
680
+ "połączyć (%3$s).%2$s Jeśli nie otrzymałeś e-maila, proszę %4$sskontaktuj się "
681
+ "z nami%5$s."
682
+
683
+ #: classes/saas/class-saas-user-registration.php:249
684
+ #, php-format
685
+ msgid ""
686
+ "Your store (%1$s) is already registered with another account! You can "
687
+ "register your domain with one account. If you have questions, %2$scontact us"
688
+ "%3$s."
689
+ msgstr ""
690
+ "Twój sklep (%1$s) jest już zarejestrowany na innym koncie! Możesz "
691
+ "zarejestrować swoją domenę za pomocą jednego konta. Jeśli masz pytania, "
692
+ "%2$sskontaktuj się z nami%3$s."
693
+
694
+ #: classes/saas/class-saas-user-registration.php:277
695
+ #, php-format
696
+ msgid ""
697
+ "Account with this email is already registered! We emailed your Connect Key "
698
+ "to %1$s.<br>Enter your key %2$shere%4$s. You can also get your key by "
699
+ "logging to %3$syour account%4$s."
700
+ msgstr ""
701
+ "Konto z tym e-mailem jest już zarejestrowane! Wysłaliśmy wiadomość e-mail z "
702
+ "kluczem Connect do %1$s.<br>Wpisz klucz %2$stutaj%4$s. Możesz również "
703
+ "uzyskać klucz logując się na %3$sswoje konto%4$s."
704
+
705
+ #: classes/saas/class-saas-user-registration.php:295
706
+ #, php-format
707
+ msgid "Unknown response code from Flexible Shipping Connect API (%s)."
708
+ msgstr "Nieznany kod odpowiedzi z API Flexible Shipping Connect (%s)."
709
+
710
+ #: classes/saas/views/html-boxes-content.php:4
711
+ #: classes/saas/views/html-boxes-content.php:5
712
+ msgid "Print Labels"
713
+ msgstr "Drukuj etykiety"
714
+
715
+ #: classes/saas/views/html-boxes-content.php:6
716
+ msgid ""
717
+ "Download printable PDF shipping labels directly from WooCommerce orders list "
718
+ "in bulk or one by one from order details."
719
+ msgstr ""
720
+ "Pobieraj etykiety wysyłkowe bezpośrednio z listy zamówień WooCommerce lub "
721
+ "edycji zamówienia."
722
+
723
+ #: classes/saas/views/html-boxes-content.php:10
724
+ #: classes/saas/views/html-boxes-content.php:11
725
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:89
726
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:90
727
+ msgid "Calculate Rates"
728
+ msgstr "Obliczaj stawki"
729
+
730
+ #: classes/saas/views/html-boxes-content.php:12
731
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:91
732
+ msgid ""
733
+ "Calculate shipping rates in real time, and get available service types and "
734
+ "expected delivery time based on customer's address."
735
+ msgstr ""
736
+ "Obliczaj stawki wysyłki w czasie rzeczywistym i otrzymuj dostępne rodzaje "
737
+ "usług w oparciu o adres klienta."
738
+
739
+ #: classes/saas/views/html-boxes-content.php:16
740
+ #: classes/saas/views/html-boxes-content.php:17
741
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:95
742
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:96
743
+ msgid "Track Parcels"
744
+ msgstr "Śledź przesyłki"
745
+
746
+ #: classes/saas/views/html-boxes-content.php:18
747
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:97
748
+ msgid ""
749
+ "Always keep your customers (and yourself) up to date with automatic "
750
+ "confirmation emails with tracking link and delivery status."
751
+ msgstr ""
752
+ "Przekazuj linki do śledzenia przesyłki w automatycznych mailach "
753
+ "transakcyjnych do klientów."
754
+
755
+ #: classes/saas/views/html-boxes-content.php:22
756
+ #: classes/saas/views/html-boxes-content.php:23
757
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:101
758
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:102
759
+ msgid "Automate Shipping"
760
+ msgstr "Automatyzuj wysyłkę"
761
+
762
+ #: classes/saas/views/html-boxes-content.php:24
763
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:103
764
+ msgid ""
765
+ "Automatically create shipments and print labels based on order status. "
766
+ "Change order status after shipment creation."
767
+ msgstr ""
768
+ "Twórz przesyłki automatycznie i drukuj etykiety na podstawie statusu "
769
+ "zamówienia. Status zamówienia zmieni się automatycznie po utworzeniu "
770
+ "przesyłki."
771
+
772
+ #: classes/saas/views/html-boxes-content.php:28
773
+ #: classes/saas/views/html-boxes-content.php:29
774
+ msgid "Create Shipments"
775
+ msgstr "Utwórz przesyłkę"
776
+
777
+ #: classes/saas/views/html-boxes-content.php:30
778
+ msgid ""
779
+ "Create shipments with predefined services, sizes and weights automatically "
780
+ "filled in from order items."
781
+ msgstr ""
782
+ "Twórz przesyłki z ustawionymi usługami, rozmiarami i wagami automatycznie "
783
+ "wypełnionymi z pozycji zamówienia."
784
+
785
+ #: classes/saas/views/html-boxes-content.php:34
786
+ #: classes/saas/views/html-boxes-content.php:35
787
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:107
788
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:108
789
+ msgid "Manage Orders"
790
+ msgstr "Zarządzaj zamówieniami"
791
+
792
+ #: classes/saas/views/html-boxes-content.php:36
793
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:109
794
+ msgid ""
795
+ "Get a complete overview of your orders and shipments in your WooCommerce "
796
+ "dashboard with shipments statuses and filters."
797
+ msgstr ""
798
+ "Zyskaj możliwość kompletnego zarządzania zamówieniami i przesyłkami "
799
+ "bezpośrednio z panelu WooCommerce za pomocą statusów i filtrów."
800
+
801
+ #: classes/saas/views/html-boxes-content.php:43
802
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:18
803
+ msgid "Ship your orders faster with Flexible Shipping Connect"
804
+ msgstr "Wysyłaj zamówienia szybciej z Flexible Shipping Connect"
805
+
806
+ #: classes/saas/views/html-boxes-content.php:62
807
+ msgid "Sign up now!"
808
+ msgstr "Zarejestruj się teraz!"
809
+
810
+ #: classes/saas/views/html-field-saas-connection.php:5
811
+ msgid "Flexible Shipping Connect"
812
+ msgstr "Flexible Shipping Connect"
813
+
814
+ #: classes/saas/views/html-field-saas-connection.php:11
815
+ #, php-format
816
+ msgid ""
817
+ "%1$sRegister%3$s for a new Flexible Shipping Connect account or log in to "
818
+ "%2$syour account%3$s to get your key."
819
+ msgstr ""
820
+ "%1$sZarejestruj%3$s nowe konto Flexible Shipping Connect lub zaloguj się do "
821
+ "%2$sistniejącego konta%3$s aby otrzymać klucz."
822
+
823
+ #: classes/saas/views/html-field-saas-connection.php:18
824
+ msgid "Check how to start with FS Connect &rarr;"
825
+ msgstr "Sprawdź jak zacząć z FS Connect &rarr;"
826
+
827
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:4
828
+ msgid "Welcome to new Flexible Shipping Connect installation guide."
829
+ msgstr "Witamy w przewodniku o nowym Flexible Shipping Connect."
830
+
831
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:6
832
+ msgid ""
833
+ "To complete the installation please click the Sing up for Connect button "
834
+ "below."
835
+ msgstr ""
836
+ "Aby zakończyć instalację, kliknij poniżej przycisk Zarejestruj się w Connect."
837
+
838
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:8
839
+ #, php-format
840
+ msgid ""
841
+ "The %saccount is free (no credit card needed)%s and allows you to send "
842
+ "packages directly from here!"
843
+ msgstr ""
844
+ "Konto %sjest bezpłatne (nie wymaga karty kredytowej) %s i pozwala na "
845
+ "nadawanie paczek bezpośrednio z panelu WooCommerce!"
846
+
847
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:10
848
+ msgid ""
849
+ "If you want to learn more about other benefits, you may click one of the "
850
+ "tabs on the left."
851
+ msgstr ""
852
+ "Jeśli chcesz dowiedzieć się więcej o innych korzyściach, możesz kliknąć "
853
+ "jedną z zakładek po lewej stronie."
854
+
855
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:34
856
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:40
857
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:46
858
+ msgid "soon!"
859
+ msgstr "wkrótce!"
860
+
861
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:55
862
+ msgid "Using Flexible Shipping Connect, you can send packages via:"
863
+ msgstr ""
864
+ "Korzystając z Flexible Shipping Connect, możesz wysyłać paczki za "
865
+ "pośrednictwem:"
866
+
867
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:76
868
+ msgid "Read more about possible integrations &rarr;"
869
+ msgstr "Przeczytaj więcej o możliwych integracjach &rarr;"
870
+
871
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:83
872
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:84
873
+ msgid "Create & Print Labels"
874
+ msgstr "Twórz i drukuj etykiety"
875
+
876
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:85
877
+ msgid ""
878
+ "Create shipments with predefined services, sizes and weights automatically "
879
+ "filled in from order items. Download printable PDF shipping labels directly "
880
+ "from WooCommerce orders list in bulk or one by one from order details."
881
+ msgstr ""
882
+ "Twórz przesyłki z ustawionymi usługami, rozmiarami i wagami automatycznie "
883
+ "wypełnionymi z pozycji zamówienia. Pobieraj etykiety wysyłkowe bezpośrednio "
884
+ "z listy zamówień WooCommerce lub edycji zamówienia."
885
+
886
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:113
887
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:114
888
+ msgid "Couriers"
889
+ msgstr "Kurierzy"
890
+
891
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:163
892
+ msgid "Sign up for Connect"
893
+ msgstr "Zarejestruj się w Connect"
894
+
895
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:165
896
+ msgid "Start quick tour"
897
+ msgstr "Rozpocznij przewodnik"
898
+
899
+ #: classes/saas/views/html-flexible-shipping-connect-notice.php:165
900
+ msgid "Next feature"
901
+ msgstr "Następna funkcja"
902
+
903
+ #: classes/saas/views/html-order-fallback-message.php:1
904
+ msgid "Fallback:"
905
+ msgstr "Stawka awaryjna:"
906
+
907
+ #: classes/saas/views/html-order-free-shipping.php:1
908
+ msgid "Free shipping"
909
+ msgstr "Darmowa wysyłka"
910
+
911
+ #: classes/saas/views/html-registration-page.php:4
912
+ #, php-format
913
+ msgid ""
914
+ "You are connected. %1$sGo to Flexible Shipping Connect settings &rarr;%2$s"
915
+ msgstr ""
916
+ "Jesteś połączony. %1$sPrzejdź do ustawień Flexible Shipping Connect &rarr;"
917
+ "%2$s"
918
+
919
+ #: classes/saas/views/html-registration-page.php:10
920
+ msgid "Join Flexible Shipping Connect Now!"
921
+ msgstr "Dołącz do Flexible Shipping Connect!"
922
+
923
+ #: classes/saas/views/html-registration-page.php:16
924
+ msgid "Sign up for automatic shipments, label printing, live rates and more!"
925
+ msgstr ""
926
+ "Zarejestruj się aby automatyzować przesyłkę, drukować etykiety, pobierać "
927
+ "stawki i wiele więcej!"
928
+
929
+ #: classes/saas/views/html-registration-page.php:18
930
+ #, php-format
931
+ msgid ""
932
+ "By signing up, you agree to the %1$sTerms of Service%3$s and to %2$sPrivacy "
933
+ "Policy%3$s"
934
+ msgstr ""
935
+ "Rejestrując się, zgadzasz się na %1$sTerms of Service%3$s i %2$sPrivacy "
936
+ "Policy%3$s"
937
+
938
+ #: classes/saas/views/html-registration-page.php:23
939
+ msgid "Sign Up"
940
+ msgstr "Zarejestruj się"
941
+
942
+ #: classes/saas/views/html-saas-connection-form.php:6
943
+ msgid "Connect Key"
944
+ msgstr "Klucz Connect"
945
+
946
+ #: classes/saas/views/html-saas-connection-form.php:22
947
+ msgid ""
948
+ "Are you sure you want do disconnect your store from Flexible Shipping "
949
+ "Connect?\\n\\nAll shipping services will be disabled."
950
+ msgstr ""
951
+ "Czy jesteś pewien, że chcesz odłączyć swój sklep od Flexible Shipping "
952
+ "Connect?\\n\\nWszystkie integracje wysyłkowe zostaną wyłączone."
953
+
954
+ #: classes/saas/views/html-shipping-method-info-description.php:35
955
+ #, php-format
956
+ msgid ""
957
+ "To add first Flexible Shipping method go to %sShipping zones%s and add "
958
+ "Flexible Shipping to a shipping zone."
959
+ msgstr ""
960
+ "Aby dodać pierwszą metodę Flexible Shipping przejdź do zakładki %sStrefy "
961
+ "wysyłki%s i dodaj Flexible Shipping do strefy wysyłki."
962
+
963
+ #: classes/saas/views/html-shipping-method-info-description.php:42
964
+ msgid ""
965
+ "You can start the configuration by clicking the Flexible Shipping link in "
966
+ "the Shipping methods table."
967
+ msgstr ""
968
+ "Możesz rozpocząć konfigurację klikając na link Flexible Shipping w tabeli "
969
+ "”Metody wysyłki”."
970
+
971
+ #: classes/saas/views/html-shipping-method-info-description.php:45
972
+ msgid "Quick Video Overview"
973
+ msgstr "Krótki przewodnik video"
974
+
975
+ #: classes/saas/views/html-shipping-method-info-description.php:51
976
+ msgid "More resources"
977
+ msgstr "Więcej informacji"
978
+
979
+ #: classes/saas/views/html-shipping-method-info-description.php:54
980
+ msgid "General Settings"
981
+ msgstr "Ustawienia główne"
982
+
983
+ #: classes/saas/views/html-shipping-method-info-description.php:55
984
+ msgid "Adding a shipping method"
985
+ msgstr "Dodawanie metody wysyłki"
986
+
987
+ #: classes/saas/views/html-shipping-method-info-description.php:56
988
+ msgid "Currency Support"
989
+ msgstr "Waluty"
990
+
991
+ #: classes/saas/views/html-shipping-method-info-description.php:57
992
+ msgid "Weight Based Shipping"
993
+ msgstr "Koszt na wagę"
994
+
995
+ #: classes/saas/views/html-shipping-method-info-description.php:58
996
+ msgid "Shipping Insurance"
997
+ msgstr "Ubezpieczenie przesyłki"
998
+
999
+ #: classes/saas/views/html-shipping-method-info-description.php:59
1000
+ msgid "Conditional Cash on Delivery"
1001
+ msgstr "Przesyłka za pobraniem"
1002
+
1003
+ #: classes/settings/flexible-shipping.php:18
1004
+ #, php-format
1005
+ msgid "See how to %sconfigure Flexible Shipping%s."
1006
+ msgstr "Zobacz jak %sskonfigurować Flexible Shipping%s."
1007
+
1008
+ #: classes/settings/flexible-shipping.php:21
1009
+ #: classes/settings/shipping-method-form.php:70 classes/shipping-method.php:34
1010
+ msgid "Enable/Disable"
1011
+ msgstr "Włącz/Wyłącz"
1012
+
1013
+ #: classes/settings/flexible-shipping.php:23
1014
+ msgid "Enable Flexible Shipping"
1015
+ msgstr "Włącz Flexible Shipping"
1016
+
1017
+ #: classes/settings/flexible-shipping.php:27
1018
+ msgid "Shipping title"
1019
+ msgstr "Tytuł"
1020
+
1021
+ #: classes/settings/flexible-shipping.php:29
1022
+ msgid "Visible only to admin in WooCommerce settings."
1023
+ msgstr "Widoczny tylko dla admina w ustawieniach WooCommerce."
1024
+
1025
+ #: classes/settings/flexible-shipping.php:34
1026
+ msgid "Tax Status"
1027
+ msgstr "Status podatku"
1028
+
1029
+ #: classes/settings/flexible-shipping.php:39
1030
+ msgid "Taxable"
1031
+ msgstr "Opodatkowany"
1032
+
1033
+ #: classes/settings/flexible-shipping.php:40
1034
+ msgctxt "Tax status"
1035
+ msgid "None"
1036
+ msgstr "Brak"
1037
+
1038
+ #: classes/settings/flexible-shipping.php:44
1039
+ #: classes/settings/flexible-shipping.php:49
1040
+ msgid "Shipping Methods"
1041
+ msgstr "Metody wysyłki"
1042
+
1043
+ #: classes/settings/shipping-method-form.php:10
1044
+ msgid "Select shipment class"
1045
+ msgstr "Wybierz klasę wysyłkową"
1046
+
1047
+ #: classes/settings/shipping-method-form.php:25
1048
+ msgid ""
1049
+ "Integrate with DPD, DHL, InPost, eNadawca Poczta Polska, Paczka w Ruchu."
1050
+ msgstr "Zintegruj z DPD, DHL, InPost, eNadawca Poczta Polska, Paczka w Ruchu."
1051
+
1052
+ #: classes/settings/shipping-method-form.php:25
1053
+ #, php-format
1054
+ msgid "%sAdd integrations%s"
1055
+ msgstr "%sDodaj integracje%s"
1056
+
1057
+ #: classes/settings/shipping-method-form.php:28
1058
+ msgid "Integrate with DPD."
1059
+ msgstr "Zintegruj z DPD."
1060
+
1061
+ #: classes/settings/shipping-method-form.php:28
1062
+ #, php-format
1063
+ msgid "%sAdd integration%s"
1064
+ msgstr "%sDodaj integrację%s"
1065
+
1066
+ #: classes/settings/shipping-method-form.php:34
1067
+ #, php-format
1068
+ msgid ""
1069
+ "Ship your orders faster with %1$sFlexible Shipping Connect%2$s%3$s%4$sSign "
1070
+ "up now!%5$s"
1071
+ msgstr ""
1072
+ "Wysyłaj zamówienia szybciej z %1$sFlexible Shipping Connect%2$s%3$s"
1073
+ "%4$sZarejestruj się teraz!%5$s"
1074
+
1075
+ #: classes/settings/shipping-method-form.php:54 classes/shipping-method.php:906
1076
+ msgid "Free"
1077
+ msgstr "Bezpłatnie"
1078
+
1079
+ #: classes/settings/shipping-method-form.php:73 classes/shipping-method.php:36
1080
+ msgid "Enable this shipment method"
1081
+ msgstr "Włącz tę metodę wysyłki"
1082
+
1083
+ #: classes/settings/shipping-method-form.php:76
1084
+ msgid "Method Title"
1085
+ msgstr "Tytuł metody"
1086
+
1087
+ #: classes/settings/shipping-method-form.php:78 classes/shipping-method.php:42
1088
+ msgid "This controls the title which the user sees during checkout."
1089
+ msgstr "Tytuł, który widzi użytkownik podczas składania zamówienia."
1090
+
1091
+ #: classes/settings/shipping-method-form.php:85
1092
+ msgid "Method Description"
1093
+ msgstr "Opis"
1094
+
1095
+ #: classes/settings/shipping-method-form.php:87
1096
+ msgid "This controls method description which the user sees during checkout."
1097
+ msgstr "Opis, który widzi użytkownik podczas składania zamówienia."
1098
+
1099
+ #: classes/settings/shipping-method-form.php:98
1100
+ msgid "Free Shipping"
1101
+ msgstr "Darmowa wysyłka"
1102
+
1103
+ #: classes/settings/shipping-method-form.php:101
1104
+ msgid ""
1105
+ "Enter a minimum order amount for free shipment. This will override the costs "
1106
+ "configured below."
1107
+ msgstr ""
1108
+ "Wpisz minimalną kwotę zamówienia dla bezpłatnej wysyłki. Spowoduje to "
1109
+ "zastąpienie reguł skonfigurowanych poniżej."
1110
+
1111
+ #: classes/settings/shipping-method-form.php:105
1112
+ msgid "Free Shipping Label"
1113
+ msgstr "Etykieta darmowej wysyłki"
1114
+
1115
+ #: classes/settings/shipping-method-form.php:108
1116
+ msgid "Enter additional label for shipment when free shipment available."
1117
+ msgstr ""
1118
+ "Wpisz dodatkową etykietę, która zostanie wyświetlona dla darmowej wysyłki."
1119
+
1120
+ #: classes/settings/shipping-method-form.php:117
1121
+ msgid "Calculation Method"
1122
+ msgstr "Metoda obliczania"
1123
+
1124
+ #: classes/settings/shipping-method-form.php:119
1125
+ msgid ""
1126
+ "Select how rules will be calculated. If you choose \"sum\" the rules order "
1127
+ "is important."
1128
+ msgstr ""
1129
+ "Wybierz jak będą obliczane reguły. Dla sumy, kolejność reguł ma znaczenie."
1130
+
1131
+ #: classes/settings/shipping-method-form.php:122
1132
+ msgid "Sum"
1133
+ msgstr "Suma"
1134
+
1135
+ #: classes/settings/shipping-method-form.php:125
1136
+ #: classes/views/html-shipping-method-settings.php:13
1137
+ msgid "Visibility"
1138
+ msgstr "Wyświetlanie"
1139
+
1140
+ #: classes/settings/shipping-method-form.php:128
1141
+ #: classes/views/html-shipping-method-settings.php:46
1142
+ msgid "Show only for logged in users"
1143
+ msgstr "Pokaż tylko dla zalogowanych użytkowników"
1144
+
1145
+ #: classes/settings/shipping-method-form.php:131
1146
+ #: classes/views/html-shipping-method-settings.php:14
1147
+ msgid "Default"
1148
+ msgstr "Domyślnie"
1149
+
1150
+ #: classes/settings/shipping-method-form.php:134
1151
+ msgid ""
1152
+ "Check the box to set this option as the default selected choice on the cart "
1153
+ "page."
1154
+ msgstr ""
1155
+ "Zaznacz, aby ustawić tę metodę wysyłki jako domyślną przy składaniu "
1156
+ "zamówienia."
1157
+
1158
+ #: classes/settings/shipping-method-form.php:139
1159
+ msgid "Select integration. "
1160
+ msgstr "Wybierz integrację. "
1161
+
1162
+ #: classes/settings/shipping-method-form.php:142
1163
+ #: classes/views/html-shipping-method-rules.php:7
1164
+ msgid "None"
1165
+ msgstr "Brak"
1166
+
1167
+ #: classes/settings/shipping-method-form.php:153
1168
+ msgid "Rules"
1169
+ msgstr "Reguły"
1170
+
1171
+ #: classes/settings/shipping-method-form.php:174
1172
+ msgid "Shipping Zone"
1173
+ msgstr "Strefa wysyłki"
1174
+
1175
+ #: classes/settings/shipping-method-form.php:188
1176
+ #, php-format
1177
+ msgid "See how to %sconfigure shipment methods%s."
1178
+ msgstr "Zobacz jak %sskonfigurować metody wysyłki %s."
1179
+
1180
+ #: classes/shipment/ajax.php:22
1181
+ msgid "Unknown error!"
1182
+ msgstr "Nieznany błąd!"
1183
+
1184
+ #: classes/shipment/ajax.php:25
1185
+ msgid "Nonce verification error! Invalid request."
1186
+ msgstr "Błąd weryfikacji nonce! Nieprawidłowe żądanie."
1187
+
1188
+ #: classes/shipment/ajax.php:29
1189
+ msgid "No shipment id!"
1190
+ msgstr "Brak id przesyłki!"
1191
+
1192
+ #: classes/shipment/ajax.php:33
1193
+ msgid "No data!"
1194
+ msgstr "Brak danych!"
1195
+
1196
+ #: classes/shipment/ajax.php:52
1197
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:123
1198
+ msgid "Saved"
1199
+ msgstr "Zapisano"
1200
+
1201
+ #: classes/shipment/class-shipment.php:299
1202
+ msgid "Please override shipping_column method!"
1203
+ msgstr "Proszę nadpisać metodę shipping_column!"
1204
+
1205
+ #: classes/shipment/cpt-shipment.php:53
1206
+ msgid "View Shipments"
1207
+ msgstr "Wyświetl przesyłki"
1208
+
1209
+ #: classes/shipment/cpt-shipment.php:54 classes/shipment/cpt-shipment.php:55
1210
+ msgid "Add new Shipment"
1211
+ msgstr "Dodaj nową przesyłkę"
1212
+
1213
+ #: classes/shipment/cpt-shipment.php:56
1214
+ msgid "Edit Shipment"
1215
+ msgstr "Edytuj przesyłkę"
1216
+
1217
+ #: classes/shipment/cpt-shipment.php:57
1218
+ msgid "Save Shipment"
1219
+ msgstr "Zapisz przesyłkę"
1220
+
1221
+ #: classes/shipment/cpt-shipment.php:58
1222
+ msgid "Search Shipments"
1223
+ msgstr "Szukaj przesyłek"
1224
+
1225
+ #: classes/shipment/cpt-shipment.php:59
1226
+ msgid "Shipment not found"
1227
+ msgstr "Nie znaleziono przesyłki"
1228
+
1229
+ #: classes/shipment/cpt-shipment.php:60
1230
+ msgid "Shipment not found in trash"
1231
+ msgstr "Nie znaleziono przesyłki w koszu"
1232
+
1233
+ #: classes/shipment/cpt-shipment.php:62
1234
+ msgid "Shipments."
1235
+ msgstr "Przesyłki."
1236
+
1237
+ #: classes/shipment/cpt-shipment.php:82
1238
+ msgctxt "Shipment status"
1239
+ msgid "New"
1240
+ msgstr "Nowa"
1241
+
1242
+ #: classes/shipment/cpt-shipment.php:87
1243
+ #, php-format
1244
+ msgid "New <span class=\"count\">(%s)</span>"
1245
+ msgid_plural "New <span class=\"count\">(%s)</span>"
1246
+ msgstr[0] "Nowa <span class=\"count\">(%s)</span>"
1247
+ msgstr[1] "Nowa <span class=\"count\">(%s)</span>"
1248
+ msgstr[2] "Nowa <span class=\"count\">(%s)</span>"
1249
+
1250
+ #: classes/shipment/cpt-shipment.php:90
1251
+ msgctxt "Shipment status"
1252
+ msgid "Created"
1253
+ msgstr "Utworzona"
1254
+
1255
+ #: classes/shipment/cpt-shipment.php:95
1256
+ #, php-format
1257
+ msgid "Created <span class=\"count\">(%s)</span>"
1258
+ msgid_plural "Created <span class=\"count\">(%s)</span>"
1259
+ msgstr[0] "Utworzona <span class=\"count\">(%s)</span>"
1260
+ msgstr[1] "Utworzona <span class=\"count\">(%s)</span>"
1261
+ msgstr[2] "Utworzona <span class=\"count\">(%s)</span>"
1262
+
1263
+ #: classes/shipment/cpt-shipment.php:98
1264
+ msgctxt "Shipment status"
1265
+ msgid "Confirmed"
1266
+ msgstr "Zatwierdzona"
1267
+
1268
+ #: classes/shipment/cpt-shipment.php:103 classes/shipment/cpt-shipment.php:111
1269
+ #, php-format
1270
+ msgid "Confirmed <span class=\"count\">(%s)</span>"
1271
+ msgid_plural "Confirmed <span class=\"count\">(%s)</span>"
1272
+ msgstr[0] "Zatwierdzona <span class=\"count\">(%s)</span>"
1273
+ msgstr[1] "Zatwierdzona <span class=\"count\">(%s)</span>"
1274
+ msgstr[2] "Zatwierdzona <span class=\"count\">(%s)</span>"
1275
+
1276
+ #: classes/shipment/cpt-shipment.php:106
1277
+ msgctxt "Shipment status"
1278
+ msgid "Manifest created"
1279
+ msgstr "Protokół nadania utworzony"
1280
+
1281
+ #: classes/shipment/cpt-shipment.php:114
1282
+ msgctxt "Shipment status"
1283
+ msgid "Failed"
1284
+ msgstr "Błąd"
1285
+
1286
+ #: classes/shipment/cpt-shipment.php:119
1287
+ #, php-format
1288
+ msgid "Failed <span class=\"count\">(%s)</span>"
1289
+ msgid_plural "Failed <span class=\"count\">(%s)</span>"
1290
+ msgstr[0] "Błąd <span class=\"count\">(%s)</span>"
1291
+ msgstr[1] "Błąd <span class=\"count\">(%s)</span>"
1292
+ msgstr[2] "Błąd <span class=\"count\">(%s)</span>"
1293
+
1294
+ #: classes/shipment/cpt-shipment.php:134
1295
+ msgid "Shipment data"
1296
+ msgstr "Dane przesyłki"
1297
+
1298
+ #: classes/shipment/functions.php:23
1299
+ #, php-format
1300
+ msgid "Shipment for order %s, %s"
1301
+ msgstr "Przesyłka do zamówienia %s, %s"
1302
+
1303
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:90
1304
+ #, php-format
1305
+ msgid "%1$s Shipment plan exceeded. %2$sPlease upgrade your plan →%3$s"
1306
+ msgstr "%1$s Przekroczono plan FS Connect %2$sProszę zmień swój plan →%3$s"
1307
+
1308
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:116
1309
+ msgid "Shipment cannot be saved for this status!"
1310
+ msgstr "Przesyłki nie można zapisać w tym statusie!"
1311
+
1312
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:144
1313
+ #, php-format
1314
+ msgid "Shipment created.%1$sFS Connect plan usage: %2$s/%3$s shipments"
1315
+ msgstr ""
1316
+ "Przesyłka utworzona.%1$sWykorzystanie planu FS Connect: %2$s/%3$s przesyłek"
1317
+
1318
+ #: classes/shipment/saas/class-shipment-saas-ajax.php:185
1319
+ msgid "Canceled"
1320
+ msgstr "Anulowana"
1321
+
1322
+ #: classes/shipment/saas/class-shipment-saas-message-formatter.php:42
1323
+ #, php-format
1324
+ msgid "%1$s notice"
1325
+ msgstr "%1$s komunikat"
1326
+
1327
+ #: classes/shipment/saas/class-shipment-saas-send.php:146
1328
+ #: classes/shipment/saas/class-shipment-saas.php:351
1329
+ msgid "UPS! Something is wrong!"
1330
+ msgstr "UPS! Nie działa poprawnie!"
1331
+
1332
+ #: classes/shipment/saas/class-shipment-saas.php:221
1333
+ #, php-format
1334
+ msgid "There was problems on checkout: %1$s"
1335
+ msgstr "Pojawił się problem na stronie zamówienia: %1$s"
1336
+
1337
+ #: classes/shipment/saas/class-shipment-saas.php:314
1338
+ #, php-format
1339
+ msgid "%1$s Shipment %2$s was created."
1340
+ msgstr "%1$s Przesyłka %2$s została utworzona."
1341
+
1342
+ #: classes/shipment/saas/class-shipment-saas.php:332
1343
+ #, php-format
1344
+ msgid "%1$s Shipment %2$s was canceled."
1345
+ msgstr "%1$s Przesyłka %2$s została anulowana."
1346
+
1347
+ #: classes/shipment/saas/class-shipment-saas.php:590
1348
+ msgid "Label is not avaliable for this shipment."
1349
+ msgstr "Etykieta nie jest dostępna dla tej przesyłki."
1350
+
1351
+ #: classes/shipment/saas/views/order-metabox-actions.php:3
1352
+ msgid "Create"
1353
+ msgstr "Utworzona"
1354
+
1355
+ #: classes/shipment/saas/views/order-metabox-actions.php:4
1356
+ msgid "Save"
1357
+ msgstr "Zapisz"
1358
+
1359
+ #: classes/shipment/saas/views/order-metabox-actions.php:11
1360
+ msgid "Get Label"
1361
+ msgstr "Pobierz etykietę"
1362
+
1363
+ #: classes/shipment/saas/views/order-metabox-actions.php:22
1364
+ msgid "Track:"
1365
+ msgstr "Śledź:"
1366
+
1367
+ #: classes/shipment/saas/views/order-metabox-actions.php:22
1368
+ msgid "Click to track shipment"
1369
+ msgstr "Kliknij, aby śledzić przesyłkę"
1370
+
1371
+ #: classes/shipment/saas/views/order-metabox-actions.php:27
1372
+ #, php-format
1373
+ msgid "%1$sShipping charges:%2$s %3$s"
1374
+ msgstr "%1$sKoszt przesyłki:%2$s %3$s"
1375
+
1376
+ #: classes/shipment/saas/views/order-metabox-actions.php:31
1377
+ #, php-format
1378
+ msgid "%1$sShipment status:%2$s %3$s"
1379
+ msgstr "%1$s Status przesyłki: %2$s %3$s"
1380
+
1381
+ #: classes/shipping-method.php:40
1382
+ msgid "Shipping Title"
1383
+ msgstr "Tytuł"
1384
+
1385
+ #: classes/shipping-method.php:112
1386
+ #: classes/views/html-shipping-method-rules.php:240
1387
+ msgid "Add New"
1388
+ msgstr "Dodaj nową"
1389
+
1390
+ #: classes/shipping-method.php:351
1391
+ msgid ""
1392
+ "Sorry, there has been an error. The CSV is invalid or incorrect file type."
1393
+ msgstr ""
1394
+ "Przepraszamy, wystąpił błąd. Plik CSV jest niepoprawny lub typ pliku jest "
1395
+ "nieprawidłowy."
1396
+
1397
+ #: classes/shipping-method.php:361 classes/shipping-method.php:364
1398
+ msgid "import"
1399
+ msgstr "import"
1400
+
1401
+ #: classes/shipping-method.php:373
1402
+ #, php-format
1403
+ msgid "Free Shipping value %s is not valid number. Row number %d."
1404
+ msgstr "Wartość darmowej wysyłki %s jest niepoprawna. Numer wiersza %d."
1405
+
1406
+ #: classes/shipping-method.php:379
1407
+ #, php-format
1408
+ msgid "Maximum Cost value %s is not valid number. Row number %d."
1409
+ msgstr "Maksymalny koszt %s jest niepoprawny. Numer wiersza %d."
1410
+
1411
+ #: classes/shipping-method.php:390
1412
+ #, php-format
1413
+ msgid "Invalid value for Calculation Method in row number %d."
1414
+ msgstr "Nieprawidłowa wartość dla Metody obliczania w wierszu %d."
1415
+
1416
+ #: classes/shipping-method.php:414
1417
+ #, php-format
1418
+ msgid "Invalid value for Based On in row number %d."
1419
+ msgstr "Nieprawidłowa wartość dla Oparte na w wierszu %d."
1420
+
1421
+ #: classes/shipping-method.php:419
1422
+ #, php-format
1423
+ msgid "Min value %s is not valid number. Row number %d."
1424
+ msgstr "Wartość Min %s jest niepoprawna. Numer wiersza %d."
1425
+
1426
+ #: classes/shipping-method.php:425
1427
+ #, php-format
1428
+ msgid "Max value %s is not valid number. Row number %d."
1429
+ msgstr "Wartość Maks %s jest niepoprawna. Numer wiersza %d."
1430
+
1431
+ #: classes/shipping-method.php:431
1432
+ #, php-format
1433
+ msgid "Cost per order value %s is not valid number. Row number %d."
1434
+ msgstr "Wartość Koszt na zamówienie %s jest niepoprawna. Numer wiersza %d."
1435
+
1436
+ #: classes/shipping-method.php:437
1437
+ #, php-format
1438
+ msgid "Additional cost value %s is not valid number. Row number %d."
1439
+ msgstr "Wartość Dodatkowy koszt %s jest niepoprawna. Numer wiersza %d."
1440
+
1441
+ #: classes/shipping-method.php:443
1442
+ #, php-format
1443
+ msgid "Value value %s is not valid number. Row number %d."
1444
+ msgstr "Wartość w polu Wartość %s jest niepoprawna. Numer wiersza %d."
1445
+
1446
+ #: classes/shipping-method.php:495
1447
+ #, php-format
1448
+ msgid "Shipping method %s imported as %s."
1449
+ msgstr "Metoda wysyłki %s została zaimportowana jako %s."
1450
+
1451
+ #: classes/shipping-method.php:555
1452
+ msgid "New Shipping Method"
1453
+ msgstr "Nowa metoda wysyłki"
1454
+
1455
+ #: classes/shipping-method.php:558
1456
+ msgid "Edit Shipping Method"
1457
+ msgstr "Edytuj metodę wysyłki"
1458
+
1459
+ #: classes/shipping-method.php:568 classes/shipping-method.php:610
1460
+ #, php-format
1461
+ msgid "Shipping method %s added."
1462
+ msgstr "Metoda wysyłki dodana: %s."
1463
+
1464
+ #: classes/shipping-method.php:593
1465
+ #, php-format
1466
+ msgid "Shipping method %s deleted."
1467
+ msgstr "Metoda wysyłki usunięta: %s."
1468
+
1469
+ #: classes/shipping-method.php:596
1470
+ msgid "Shipping method not found."
1471
+ msgstr "Metoda wysyłki nie znaleziona."
1472
+
1473
+ #: classes/shipping-method.php:622
1474
+ #, php-format
1475
+ msgid "Shipping method %s updated."
1476
+ msgstr "Metoda wysyłki zaktualizowana: %s."
1477
+
1478
+ #: classes/tracker.php:185
1479
+ msgid "Opt-in"
1480
+ msgstr "Opt-in"
1481
+
1482
+ #: classes/tracker.php:189
1483
+ msgid "Opt-out"
1484
+ msgstr "Opt-out"
1485
+
1486
+ #: classes/views/html-ads.php:4
1487
+ msgid "Get Flexible Shipping PRO!"
1488
+ msgstr "Kup Flexible Shipping PRO!"
1489
+
1490
+ #: classes/views/html-ads.php:13
1491
+ msgid "Shipping Classes support"
1492
+ msgstr "Wsparcie klas wysyłkowych"
1493
+
1494
+ #: classes/views/html-ads.php:14
1495
+ msgid "Product count based costs"
1496
+ msgstr "Koszty oparte o liczbę produktów w koszyku"
1497
+
1498
+ #: classes/views/html-ads.php:15
1499
+ msgid "Stopping, Cancelling a rule"
1500
+ msgstr "Zatrzymywanie, anulowanie reguł"
1501
+
1502
+ #: classes/views/html-ads.php:16
1503
+ msgid "Additional calculation methods"
1504
+ msgstr "Dodatkowe rodzaje obliczania kosztów"
1505
+
1506
+ #: classes/views/html-ads.php:19
1507
+ msgid "Upgrade Now &rarr;"
1508
+ msgstr "Zaktualizuj do wersji PRO &rarr;"
1509
+
1510
+ #: classes/views/html-column-shipping-shipping.php:11
1511
+ msgid "Get label for: "
1512
+ msgstr "Pobierz etykietę dla "
1513
+
1514
+ #: classes/views/html-column-shipping-shipping.php:14
1515
+ msgid "Track shipment for: "
1516
+ msgstr "Śledź przesyłkę "
1517
+
1518
+ #: classes/views/html-custom-services.php:14
1519
+ msgid "Code"
1520
+ msgstr "Kod"
1521
+
1522
+ #: classes/views/html-custom-services.php:15
1523
+ msgid "Name"
1524
+ msgstr "Nazwa"
1525
+
1526
+ #: classes/views/html-custom-services.php:17
1527
+ #: classes/views/html-shipping-method-settings.php:12
1528
+ msgid "Enabled"
1529
+ msgstr "Włączona"
1530
+
1531
+ #: classes/views/html-custom-services.php:37
1532
+ msgid ""
1533
+ "Drag and drop the services to control their display order. Confirm by "
1534
+ "clicking Save changes button below."
1535
+ msgstr ""
1536
+ "Przeciągnij i upuść usługę aby zmienić kolejność wyświetlania. Zatwierdź "
1537
+ "zmiany klikając Zapisz zmiany poniżej."
1538
+
1539
+ #: classes/views/html-order-add_shipping-metabox.php:15
1540
+ msgid "Add"
1541
+ msgstr "Dodaj"
1542
+
1543
+ #: classes/views/html-orders-filter-form.php:4
1544
+ #: classes/views/html-orders-filter-form.php:12
1545
+ msgid "All shippings"
1546
+ msgstr "Wszystkie przesyłki"
1547
+
1548
+ #: classes/views/html-orders-filter-form.php:13
1549
+ msgid "Shipment status"
1550
+ msgstr "Status przesyłki"
1551
+
1552
+ #: classes/views/html-shipping-method-rules.php:8
1553
+ msgid "Price"
1554
+ msgstr "Cena"
1555
+
1556
+ #: classes/views/html-shipping-method-rules.php:9
1557
+ msgid "Weight"
1558
+ msgstr "Waga"
1559
+
1560
+ #: classes/views/html-shipping-method-rules.php:61
1561
+ #, php-format
1562
+ msgid ""
1563
+ "Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on "
1564
+ "shipment classes, product/item count or additional handling fees/insurance."
1565
+ msgstr ""
1566
+ "Sprawdź %sFlexible Shipping PRO &rarr;%s, aby dodawać zaawansowane reguły "
1567
+ "oparte o klasy wysyłkowe, liczbę produktów/pozycji lub naliczać dodatkowe "
1568
+ "koszty obsługi/ubezpieczenia."
1569
+
1570
+ #: classes/views/html-shipping-method-rules.php:72
1571
+ msgid "Based on"
1572
+ msgstr "Oparte na"
1573
+
1574
+ #: classes/views/html-shipping-method-rules.php:73
1575
+ msgid "Shipping cost will be calculated based on the selected parameter."
1576
+ msgstr "Koszty wysyłki będą obliczane w oparciu o wybrany parametr."
1577
+
1578
+ #: classes/views/html-shipping-method-rules.php:76
1579
+ msgid "Min"
1580
+ msgstr "Min"
1581
+
1582
+ #: classes/views/html-shipping-method-rules.php:77
1583
+ msgid ""
1584
+ "Enter minimum value for the &quot;Based on&quot; parameter. Value based on "
1585
+ "the price will be calculated by WooCommerce tax settings &quot;Display "
1586
+ "prices during cart and checkout&quot;"
1587
+ msgstr ""
1588
+ "Wpisz minimalną wartość dla parametru &quot;Oparte na&quot;. Wartość oparta "
1589
+ "na cenie zostanie obliczona wg. ustawienia podatków WooCommerce &quot;"
1590
+ "Wyświetlanie cen w koszyku i zamówieniu&quot;"
1591
+
1592
+ #: classes/views/html-shipping-method-rules.php:80
1593
+ msgid "Max"
1594
+ msgstr "Max"
1595
+
1596
+ #: classes/views/html-shipping-method-rules.php:81
1597
+ msgid ""
1598
+ "Enter maximum value for the &quot;Based on&quot; parameter. Value based on "
1599
+ "the price will be calculated by WooCommerce tax settings &quot;Display "
1600
+ "prices during cart and checkout&quot;"
1601
+ msgstr ""
1602
+ "Wpisz maksymalną wartość dla parametru &quot;Oparte na&quot;. Wartość oparta "
1603
+ "na cenie zostanie obliczona wg. ustawienia podatków WooCommerce &quot;"
1604
+ "Wyświetlanie cen w koszyku i zamówieniu&quot;"
1605
+
1606
+ #: classes/views/html-shipping-method-rules.php:84
1607
+ msgid "Cost per<br/>order"
1608
+ msgstr "Koszt na<br/>zamówienie"
1609
+
1610
+ #: classes/views/html-shipping-method-rules.php:85
1611
+ msgid "Enter shipment cost for this rule."
1612
+ msgstr "Wpisz koszt wysyłki dla tej reguły."
1613
+
1614
+ #: classes/views/html-shipping-method-rules.php:160
1615
+ msgid "Insert rule"
1616
+ msgstr "Dodaj regułę"
1617
+
1618
+ #: classes/views/html-shipping-method-rules.php:161
1619
+ msgid "Delete selected rules"
1620
+ msgstr "Usuń wybrane reguły"
1621
+
1622
+ #: classes/views/html-shipping-method-rules.php:211
1623
+ msgid "No rows selected."
1624
+ msgstr "Nie wybrano wierszy."
1625
+
1626
+ #: classes/views/html-shipping-method-rules.php:216
1627
+ msgid "Are you sure?"
1628
+ msgstr "Na pewno?"
1629
+
1630
+ #: classes/views/html-shipping-method-rules.php:231
1631
+ #: classes/views/html-shipping-method-settings.php:106
1632
+ msgid "Shipping Zones"
1633
+ msgstr "Strefy wysyłki"
1634
+
1635
+ #: classes/views/html-shipping-method-settings.php:11
1636
+ msgid "Title"
1637
+ msgstr "Tytuł"
1638
+
1639
+ #: classes/views/html-shipping-method-settings.php:16
1640
+ msgid "Select all"
1641
+ msgstr "Zaznacz wszystkie"
1642
+
1643
+ #: classes/views/html-shipping-method-settings.php:39
1644
+ #: classes/views/html-shipping-method-settings.php:46
1645
+ #: classes/views/html-shipping-method-settings.php:53
1646
+ msgid "yes"
1647
+ msgstr "tak"
1648
+
1649
+ #: classes/views/html-shipping-method-settings.php:48
1650
+ msgid "Show for all users"
1651
+ msgstr "Pokaż dla wszystkich użytkowników"
1652
+
1653
+ #: classes/views/html-shipping-method-settings.php:69
1654
+ msgid ""
1655
+ "Drag and drop the above shipment methods to control their display order. "
1656
+ "Confirm by clicking Save changes button below."
1657
+ msgstr ""
1658
+ "Przeciągnij i upuść metody wysyłki aby ustawić ich kolejność wyświetlania. "
1659
+ "Potwierdź przez kliknięcie przycisku Zapisz zmiany poniżej."
1660
+
1661
+ #: classes/views/html-shipping-method-settings.php:74
1662
+ msgid "Remove selected"
1663
+ msgstr "Usuń zaznaczone"
1664
+
1665
+ #: classes/views/html-shipping-method-settings.php:78
1666
+ msgid "Cancel import"
1667
+ msgstr "Anuluj import"
1668
+
1669
+ #: classes/views/html-shipping-method-settings.php:79
1670
+ #: classes/views/html-shipping-method-settings.php:80
1671
+ msgid "Import"
1672
+ msgstr "Importuj"
1673
+
1674
+ #: classes/views/html-shipping-method-settings.php:155
1675
+ msgid "Please select shipment methods to remove"
1676
+ msgstr "Proszę wybrać metody wysyłki do usunięcia"
1677
+
1678
+ #: classes/views/html-shipping-method-settings.php:187
1679
+ msgid "Select file to import"
1680
+ msgstr "Wybierz plik do importu"
1681
+
1682
+ #: inc/functions.php:67
1683
+ #, php-format
1684
+ msgid "Redirecting. If page not redirects click %s here %s."
1685
+ msgstr ""
1686
+ "Przekierowywanie. Jeśli strona nie przekierowuje cię automatycznie, kliknij "
1687
+ "%s tu %s."
1688
+
1689
+ #: inc/wpdesk-tracker/views/tracker-connect.php:7
1690
+ #: inc/wpdesk-tracker/views/tracker-notice.php:5
1691
+ #, php-format
1692
+ msgid "Hey %s,"
1693
+ msgstr "Hej %s,"
1694
+
1695
+ #: inc/wpdesk-tracker/views/tracker-connect.php:8
1696
+ msgid ""
1697
+ "Please help us improve our plugins! If you opt-in, we will collect some non-"
1698
+ "sensitive data and usage information anonymously. If you skip this, that's "
1699
+ "okay! All plugins will work just fine."
1700
+ msgstr ""
1701
+ "Proszę pomóż nam udoskonalić nasze wtyczki! Jeśli się zgodzisz, będziemy "
1702
+ "zbierać niewrażliwe dane użytkowania anonimowo. Jeśli pominiesz ten krok, w "
1703
+ "porządku! Wszystkie wtyczki będą działać."
1704
+
1705
+ #: inc/wpdesk-tracker/views/tracker-connect.php:13
1706
+ msgid "Allow & Continue &rarr;"
1707
+ msgstr "Pozwól i kontunuuj &rarr;"
1708
+
1709
+ #: inc/wpdesk-tracker/views/tracker-connect.php:14
1710
+ msgid "Skip"
1711
+ msgstr "Pomiń"
1712
+
1713
+ #: inc/wpdesk-tracker/views/tracker-connect.php:19
1714
+ msgid "What permissions are being granted?"
1715
+ msgstr "Jakie uprawnienia są przyznawane?"
1716
+
1717
+ #: inc/wpdesk-tracker/views/tracker-connect.php:26
1718
+ msgid "Your Site Overview"
1719
+ msgstr "Dane witryny"
1720
+
1721
+ #: inc/wpdesk-tracker/views/tracker-connect.php:27
1722
+ msgid "WP version, PHP info"
1723
+ msgstr "Wersja WP, PHP info"
1724
+
1725
+ #: inc/wpdesk-tracker/views/tracker-connect.php:33
1726
+ msgid "Plugin Usage"
1727
+ msgstr "Dane użytkowania wtyczek"
1728
+
1729
+ #: inc/wpdesk-tracker/views/tracker-connect.php:34
1730
+ msgid "Current settings and usage information of WP Desk plugins"
1731
+ msgstr "Ustawienia i informacje o użytkowaniu wtyczek WP Desk"
1732
+
1733
+ #: inc/wpdesk-tracker/views/tracker-connect.php:40
1734
+ msgid "Your Store Overview"
1735
+ msgstr "Ustawienia i informacje o użytkowaniu wtyczek WP Desk"
1736
+
1737
+ #: inc/wpdesk-tracker/views/tracker-connect.php:41
1738
+ msgid "Anonymized and non-sensitive store usage information"
1739
+ msgstr "Tylko niewrażliwe i anonimowe dane o użytkowaniu sklepu"
1740
+
1741
+ #: inc/wpdesk-tracker/views/tracker-connect.php:47
1742
+ #: inc/wpdesk-tracker/views/tracker-notice.php:7
1743
+ msgid "Find out more &raquo;"
1744
+ msgstr "Dowiedz się więcej &raquo;"
1745
+
1746
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:3
1747
+ #, php-format
1748
+ msgid "You are deactivating %s plugin."
1749
+ msgstr "Dezaktywowałeś wtyczkę %s."
1750
+
1751
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:9
1752
+ msgid ""
1753
+ " If you have a moment, please let us know why you are deactivating plugin "
1754
+ "(anonymous feedback):"
1755
+ msgstr ""
1756
+ " Jeśli masz chwilę, prosimy daj nam znać dlaczego dezaktywowałeś wtyczkę "
1757
+ "(anonimowa opinia):"
1758
+
1759
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:16
1760
+ msgid "The plugin suddenly stopped working"
1761
+ msgstr "Wtyczka nagle przestała działać"
1762
+
1763
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:24
1764
+ msgid "The plugin broke my site"
1765
+ msgstr "Wtyczka zepsuła moją stronę"
1766
+
1767
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:32
1768
+ msgid "I found a better plugin"
1769
+ msgstr "Znalazłem lepszą wtyczkę"
1770
+
1771
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:35
1772
+ msgid "What's the plugin's name?"
1773
+ msgstr "Jaka jest nazwa wtyczki?"
1774
+
1775
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:43
1776
+ msgid "I only needed the plugin for a short period"
1777
+ msgstr "Potrzebowałem wtyczki tylko przez krótki okres"
1778
+
1779
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:51
1780
+ msgid "I no longer need the plugin"
1781
+ msgstr "Nie potrzebuję już wtyczki"
1782
+
1783
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:59
1784
+ msgid "It's a temporary deactivation. I'm just debugging an issue."
1785
+ msgstr "Jest to tymczasowa dezaktywacja, debaguję problem."
1786
+
1787
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:67
1788
+ msgid "Other"
1789
+ msgstr "Inny"
1790
+
1791
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:70
1792
+ msgid "Kindly tell us the reason so we can improve"
1793
+ msgstr "Napisz nam powód abyśmy mogli go poprawić"
1794
+
1795
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:77
1796
+ msgid "Skip &amp; Deactivate"
1797
+ msgstr "Pomiń i dezaktywuj"
1798
+
1799
+ #: inc/wpdesk-tracker/views/tracker-deactivate.php:92
1800
+ msgid "Submit &amp; Deactivate"
1801
+ msgstr "Anuluj"
1802
+
1803
+ #: inc/wpdesk-tracker/views/tracker-notice.php:6
1804
+ msgid ""
1805
+ "We need your help to improve <strong>WP Desk plugins</strong>, so they are "
1806
+ "more useful for you and the rest of <strong>30,000+ users</strong>. By "
1807
+ "collecting data on how you use our plugins, you will help us a lot. We will "
1808
+ "not collect any sensitive data, so you can feel safe."
1809
+ msgstr ""
1810
+ "Potrzebujemy Twojej pomocy, aby dalej rozwijać <strong>wtyczki WP Desk</"
1811
+ "strong> i były one jeszcze bardziej pomocne dla Ciebie i pozostałych ponad "
1812
+ "<strong>30 000 użytkowników</strong>. Zbierając dane na temat tego jak "
1813
+ "korzystasz z naszych wtyczek bardzo nam w tym pomożesz. Nie będziemy zbierać "
1814
+ "żadnych danych wrażliwych, więc możesz czuć się bezpiecznie."
1815
+
1816
+ #: inc/wpdesk-tracker/views/tracker-notice.php:10
1817
+ msgid "Allow"
1818
+ msgstr "Pozwól"
1819
+
1820
+ #: inc/wpdesk-tracker/views/tracker-opt-out-notice.php:3
1821
+ msgid ""
1822
+ "You successfully opted out of collecting usage data by WP Desk. If you "
1823
+ "change your mind, you can always opt in later in the plugin's quick links."
1824
+ msgstr ""
1825
+ "Twoja rezygnacja ze zbierania danych użytkowania wtyczek przez WP Desk "
1826
+ "została przyjęta. Jeśli zmienisz zdanie, zawsze możesz włączyć zgodę poprzez "
1827
+ "szybkie linki w menu wtyczek."
1828
+
1829
+ #: templates/email/after_order_table.php:15
1830
+ #: templates/myaccount/after_order_table.php:15
1831
+ msgid "Track shipment: "
1832
+ msgstr "Śledź przesyłkę: "
1833
+
1834
+ #: vendor/10up/wp_mock/tests/FunctionMocksTest.php:65
1835
+ msgid "Test"
1836
+ msgstr "Test"
1837
+
1838
+ #: vendor/10up/wp_mock/tests/FunctionMocksTest.php:75
1839
+ #: vendor/10up/wp_mock/tests/FunctionMocksTest.php:77
1840
+ msgid "Input"
1841
+ msgstr "Input"
1842
+
1843
+ #: vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php:162
1844
+ #, php-format
1845
+ msgid ""
1846
+ "The &#8220;%s&#8221; plugin cannot run on PHP versions older than %s. Please "
1847
+ "contact your host and ask them to upgrade."
1848
+ msgstr ""
1849
+ "Wtyczka &#8220;%s&#8221; nie może działać w wersjach PHP starszych niż %s. "
1850
+ "Skontaktuj się z administratorem hostingu i poproś o aktualizację."
1851
+
1852
+ #: vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php:166
1853
+ #, php-format
1854
+ msgid ""
1855
+ "The &#8220;%s&#8221; plugin cannot run on WordPress versions older than %s. "
1856
+ "Please update WordPress."
1857
+ msgstr ""
1858
+ "Wtyczka &#8220;%s&#8221; nie może działać w wersjach WordPress starszych niż "
1859
+ "%s. Prosimy o aktualizację WordPress."
1860
+
1861
+ #: vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php:170
1862
+ #, php-format
1863
+ msgid ""
1864
+ "The &#8220;%s&#8221; plugin cannot run on WooCommerce versions older than "
1865
+ "%s. Please update WooCommerce."
1866
+ msgstr ""
1867
+ "Wtyczka &#8220;%s&#8221; nie może działać w wersjach WooCommerce starszych "
1868
+ "niż %s. Prosimy o aktualizację WooCommerce."
1869
+
1870
+ #: vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php:174
1871
+ #, php-format
1872
+ msgid ""
1873
+ "The &#8220;%s&#8221; plugin cannot run without OpenSSL module version at "
1874
+ "least %s. Please update OpenSSL module."
1875
+ msgstr ""
1876
+ "Wtyczka &#8220;%s&#8221; nie może działać bez aktywacji OpenSSL co najmniej "
1877
+ "w wersji %s. Zaktualizuj wersję OpenSSL."
1878
+
1879
+ #: vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php:262
1880
+ #, php-format
1881
+ msgid ""
1882
+ "The &#8220;%s&#8221; plugin cannot run without %s active. Please install and "
1883
+ "activate %s plugin."
1884
+ msgstr ""
1885
+ "Wtyczka &#8220;%s&#8221; nie może działać bez aktywacji %s. Zainstaluj i "
1886
+ "aktywuj wtyczkę %s."
1887
+
1888
+ #: vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php:298
1889
+ #, php-format
1890
+ msgid ""
1891
+ "The &#8220;%s&#8221; plugin cannot run without %s php module installed. "
1892
+ "Please contact your host and ask them to install %s."
1893
+ msgstr ""
1894
+ "Wtyczka &#8220;%s&#8221; nie może działać bez modułu php: %s. Skontaktuj się "
1895
+ "z administratorem hostingu i poproś o instalację %s."
1896
+
1897
+ #: vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php:326
1898
+ #, php-format
1899
+ msgid ""
1900
+ "The &#8220;%s&#8221; plugin cannot run without %s php setting set to %s. "
1901
+ "Please contact your host and ask them to set %s."
1902
+ msgstr ""
1903
+ "Wtyczka &#8220;%s&#8221; nie może działać bez ustawienia php %s ustawionego "
1904
+ "na %s. Skontaktuj się z administratorem hostingu i poproś o ustawienie %s."
1905
+
1906
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:144
1907
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:146
1908
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:66
1909
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:68
1910
+ msgid "Section214 Settings"
1911
+ msgstr "Section214 Settings"
1912
+
1913
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:591
1914
+ msgid "Your settings have been saved."
1915
+ msgstr "Twoje ustawienia zostały zapisane."
1916
+
1917
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:976
1918
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:836
1919
+ msgid ""
1920
+ "To copy the system info, click below then press Ctrl + C (PC) or Cmd + C "
1921
+ "(Mac)."
1922
+ msgstr ""
1923
+ "Kliknij poniżej i naciśnij CTRL + C (Windows) lub Cmd + C (Mac) by skopiować "
1924
+ "informacje systemowe."
1925
+
1926
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:979
1927
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:841
1928
+ msgid "Download System Info File"
1929
+ msgstr "Pobierz plik informacji systemowych"
1930
+
1931
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:1059
1932
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:909
1933
+ msgid "Upload File"
1934
+ msgstr "Dodaj plik"
1935
+
1936
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:1089
1937
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:935
1938
+ msgid "Deactivate License"
1939
+ msgstr "Dezaktywuj licencję"
1940
+
1941
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:1120
1942
+ #, php-format
1943
+ msgid ""
1944
+ "The callback function used for the <strong>%s</strong> setting is missing."
1945
+ msgstr ""
1946
+ "The callback function used for the <strong>%s</strong> setting is missing."
1947
+
1948
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:1210
1949
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:1052
1950
+ msgid "Insert Image"
1951
+ msgstr "Wstaw obrazek"
1952
+
1953
+ #: vendor/wpdesk/wp-settings/source/class.s214-settings.php:1211
1954
+ #: vendor/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php:1053
1955
+ msgid "Select Image"
1956
+ msgstr "Wybierz obrazek"
1957
+
1958
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/S214_Plugin_Updater.php:188
1959
+ #, php-format
1960
+ msgid ""
1961
+ "There is a new version of %1$s available. %2$sView version %3$s details%4$s."
1962
+ msgstr "Dostępna jest nowa wersja %1$s. %2$s Pokaż %3$s szczegóły wersji %4$s."
1963
+
1964
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/S214_Plugin_Updater.php:196
1965
+ #, php-format
1966
+ msgid ""
1967
+ "There is a new version of %1$s available. %2$sView version %3$s details%4$s "
1968
+ "or %5$supdate now%6$s."
1969
+ msgstr ""
1970
+ "Jest dostępna nowa wersja %1$s. %2$s Zobacz szczegóły wersji %3$s %4$s lub "
1971
+ "%5$s zaktualizuj %6$s."
1972
+
1973
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/S214_Plugin_Updater.php:340
1974
+ msgid "You do not have permission to install plugin updates"
1975
+ msgstr "Nie masz uprawnień do instalacji aktualizacji wtyczki"
1976
+
1977
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:141
1978
+ msgid "Licensing"
1979
+ msgstr "Licencje"
1980
+
1981
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:159
1982
+ #, php-format
1983
+ msgid "%1$s License Key"
1984
+ msgstr "Klucz licencyjny %1$s"
1985
+
1986
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:160
1987
+ msgid "Please enter your license key to enable automatic updates and support."
1988
+ msgstr ""
1989
+ "Wpisz swój klucz licencyjny aby włączyć automatyczne aktualizacje i wsparcie."
1990
+
1991
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:197
1992
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:270
1993
+ msgid "Nonce verification failed"
1994
+ msgstr "Błąd zabepieczeń (nonce)"
1995
+
1996
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:352
1997
+ msgid "This license does not belong to the product you have entered it for."
1998
+ msgstr "Klucz licencyjny który wpisałeś nie należy do tego produktu."
1999
+
2000
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:357
2001
+ msgid "This license does not have any activations left"
2002
+ msgstr "Licencja nie posiada już wolnych aktywacji"
2003
+
2004
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:362
2005
+ msgid "This license key is expired. Please renew it."
2006
+ msgstr "Ten klucz licencyjny wygasł. Proszę odnów go."
2007
+
2008
+ #: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:367
2009
+ #, php-format
2010
+ msgid ""
2011
+ "There was a problem activating your license key, please try again or contact "
2012
+ "support. Error code: %s"
2013
+ msgstr ""
2014
+ "Pojawił się problem z aktywacją klucza licencyjnego. Proszę spróbuj ponownie "
2015
+ "lub skontaktuj się z naszym wsparciem. Kod błędu: %s"
2016
+
2017
+ #. Plugin URI of the plugin/theme
2018
+ msgid "https://wordpress.org/plugins/flexible-shipping/"
2019
+ msgstr "https://pl.wordpress.org/plugins/flexible-shipping/"
2020
+
2021
+ #. Description of the plugin/theme
2022
+ msgid ""
2023
+ "Create additional shipment methods in WooCommerce and enable pricing based "
2024
+ "on cart weight or total."
2025
+ msgstr ""
2026
+ "Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów w "
2027
+ "oparciu o wagę lub wartość zamówienia."
2028
+
2029
+ #. Author of the plugin/theme
2030
+ msgid "WP Desk"
2031
+ msgstr "WP Desk"
2032
+
2033
+ #. Author URI of the plugin/theme
2034
+ msgid "https://www.wpdesk.net/"
2035
+ msgstr "https://www.wpdesk.pl/"
2036
+
2037
+ #~ msgid ""
2038
+ #~ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
2039
+ #~ "%sClick here%s to activate the license key and the plugin."
2040
+ #~ msgstr ""
2041
+ #~ "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
2042
+ #~ "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
2043
+
2044
+ #~ msgid "Admin Updates"
2045
+ #~ msgstr "Powiadomienia"
2046
+
2047
+ #~ msgid "Announcements, updates, marketing, no spam and easy opt-out"
2048
+ #~ msgstr ""
2049
+ #~ "Ważne powiadomienia, uaktualnienia, marketing, żadnego spamu i łatwa "
2050
+ #~ "rezygnacja"
2051
+
2052
+ #~ msgid "Stopping a rule"
2053
+ #~ msgstr "Zatrzymywanie reguł"
2054
+
2055
+ #~ msgid "Additional calculation methods (sum, lowest cost, highest cost)"
2056
+ #~ msgstr ""
2057
+ #~ "Dodatkowe rodzaje obliczania kosztów (suma, najniższy, najwyższy koszt "
2058
+ #~ "reguł spełniających warunki)"
2059
+
2060
+ #~ msgid "Enter minimum value for the &quot;Based on&quot; parameter."
2061
+ #~ msgstr "Wpisz minimalną wartość dla parametru &quot;Oparte na&quot;."
2062
+
2063
+ #~ msgid "Enter maximum value for the &quot;Based on&quot; parameter."
2064
+ #~ msgstr "Wpisz maksymalną wartość dla parametru &quot;Oparte na&quot;."
2065
+
2066
+ #, fuzzy
2067
+ #~| msgid "Settings"
2068
+ #~ msgid "Settings updated."
2069
+ #~ msgstr "Ustawienia"
2070
+
2071
+ #~ msgid ""
2072
+ #~ "An Unexpected HTTP Error occurred during the API request. <a href=\"?\" "
2073
+ #~ "onclick=\"document.location.reload(); return false;\">Try again</a>"
2074
+ #~ msgstr ""
2075
+ #~ "Wystąpił nieoczekiwany błąd HTTP podczas zapytania API.</p> <p><a "
2076
+ #~ "href=„?” onclick=„document.location.reload(); return false;”>Spróbuj "
2077
+ #~ "ponownie</a>"
2078
+
2079
+ #~ msgid "An unknown error occurred"
2080
+ #~ msgstr "Wystąpił nieznany błąd"
2081
+
2082
+ #~ msgid ""
2083
+ #~ "Please help us improve our plugins and get a <strong>20&#37; discount "
2084
+ #~ "coupon</strong> for <strong>WP Desk</strong> plugins."
2085
+ #~ msgstr ""
2086
+ #~ "Pomóż nam ulepszyć nasze wtyczki i otrzymaj <strong>kupon rabatowy 20&#37;"
2087
+ #~ "</strong> na kolejne zakupy w <strong>WP Desk</strong>."
2088
+
2089
+ #~ msgid ""
2090
+ #~ "Allow WP Desk to collect plugin usage information and <strong>get "
2091
+ #~ "discount coupon</strong> in our shop. No sensitive data is tracked."
2092
+ #~ msgstr ""
2093
+ #~ "Pozwól WP Desk na zbieranie danych użytkowania wtyczek i <strong>otrzymaj "
2094
+ #~ "kupon rabatowy</strong> do naszego sklepu. Żadne wrażliwe dane nie będą "
2095
+ #~ "zbierane."
2096
+
2097
+ #~ msgid "Integration "
2098
+ #~ msgstr "Integracja "
2099
+
2100
+ #~ msgid "Shipping method title is not set in row number %d."
2101
+ #~ msgstr "Tytuł metody wysyłki nie został ustawiony w wierszu %d."
2102
+
2103
+ #~ msgid "Minimum Order Amount"
2104
+ #~ msgstr "Minimalna wartość zamówienia"
2105
+
2106
+ #~ msgid "Free shipment label"
2107
+ #~ msgstr "Etykieta darmowej wysyłki"
2108
+
2109
+ #~ msgid ""
2110
+ #~ "%sAdd integrations%s with Paczkomaty InPost, eNadawca Poczta Polska, "
2111
+ #~ "Paczka w Ruchu."
2112
+ #~ msgstr ""
2113
+ #~ "%sDodaj integracje%s z Paczkomaty InPost, eNadawca Poczta Polska, Paczka "
2114
+ #~ "w Ruchu."
2115
+
2116
+ #~ msgid "Action"
2117
+ #~ msgstr "Akcje"
2118
+
2119
+ #~ msgid "Delete"
2120
+ #~ msgstr "Usuń"
2121
+
2122
+ #~ msgid ""
2123
+ #~ "If you need more advanced rules based on shipment classes, product/item "
2124
+ #~ "count or adding additional handling/insurance fees make sure to check "
2125
+ #~ "%sFlexible Shipping PRO &rarr;%s"
2126
+ #~ msgstr ""
2127
+ #~ "Jeśli potrzebujesz bardziej zaawansowanych reguł opartych o klasy "
2128
+ #~ "wysyłkowe, liczbę produktów/pozycji lub dodatkowe koszty obsługi/"
2129
+ #~ "ubezpieczenia, koniecznie sprawdź %sFlexible Shipping PRO &rarr;%s"
2130
+
2131
+ #~ msgid ""
2132
+ #~ "You can add integrations with Paczkomaty InPost, eNadawca Poczta Polska, "
2133
+ #~ "Paczka w Ruchu. %sView details%s"
2134
+ #~ msgstr ""
2135
+ #~ "Możesz dodać integracje z Paczkomaty InPost, eNadawca Poczta Polska, "
2136
+ #~ "Paczka w Ruchu. %sSprawdź szczegóły%s"
2137
+
2138
+ #~ msgid "Insert row"
2139
+ #~ msgstr "Dodaj wiersz"
2140
+
2141
+ #~ msgid "Delete selected rows"
2142
+ #~ msgstr "Usuń zaznaczone wiersze"
2143
+
2144
+ #~ msgid "Cart total"
2145
+ #~ msgstr "Suma koszyka"
2146
+
2147
+ #~ msgid "Value"
2148
+ #~ msgstr "Wartość"
2149
+
2150
+ #~ msgid ""
2151
+ #~ "Enter minimum order amount for free shipment. This will override all "
2152
+ #~ "rules configured below."
2153
+ #~ msgstr "Wprowadź minimalną kwotę do bezpłatnej wysyłki. "
languages/flexible-shipping-pl_PL.mo DELETED
Binary file
languages/flexible-shipping-pl_PL.po DELETED
@@ -1,1302 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Flexible Shipping\n"
4
- "POT-Creation-Date: 2018-06-25 13:10+0200\n"
5
- "PO-Revision-Date: 2018-06-25 13:10+0200\n"
6
- "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\n"
7
- "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
- "Language: pl_PL\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.8\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "X-Poedit-WPHeader: flexible-shipping.php\n"
15
- "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
16
- "|| n%100>=20) ? 1 : 2);\n"
17
- "X-Poedit-SourceCharset: UTF-8\n"
18
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
19
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
20
- "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
- "X-Poedit-SearchPath-0: .\n"
22
- "X-Poedit-SearchPathExcluded-0: *.js\n"
23
- "X-Poedit-SearchPathExcluded-1: classes/wpdesk/settings-api\n"
24
-
25
- #: classes/admin-notices.php:164
26
- #, php-format
27
- msgid ""
28
- "Flexible Shipping has changed the calculation method for shipping rules. "
29
- "Currently, the cart value for rules based on price is determined by "
30
- "WooCommerce tax option \"Display prices during cart and checkout\". You "
31
- "should check the %ssettings%s."
32
- msgstr ""
33
- "Flexible Shipping: zaktualizowane zostały metody obliczania reguł wysyłki. "
34
- "Aktualnie dla reguł opartych na cenie wartość koszyka zostanie obliczona na "
35
- "podstawie ustawienia podatków WooCommerce ”Wyświetlanie cen w sklepie”. "
36
- "Sprawdź %sustawienia podatków%s."
37
-
38
- #: classes/admin-notices.php:181
39
- msgid ""
40
- "Flexible Shipping requires at least version 2.7 of Active Payments plugin."
41
- msgstr ""
42
- "Flexible Shipping wymaga wtyczki Aktywne płatności w wersji co najmniej 2.7."
43
-
44
- #: classes/admin-notices.php:196
45
- msgid "Flexible Shipping requires at least version 1.2 of eNadawca plugin."
46
- msgstr "Flexible Shipping wymaga wtyczki eNadawca w wersji co najmniej 1.2."
47
-
48
- #: classes/admin-notices.php:211
49
- msgid ""
50
- "Flexible Shipping requires at least version 1.1 of Paczka w Ruchu plugin."
51
- msgstr ""
52
- "Flexible Shipping wymaga wtyczki Paczka w Ruchu w wersji co najmniej 1.1."
53
-
54
- #: classes/admin-notices.php:223
55
- #, php-format
56
- msgid ""
57
- "You are using WooCommerce Flexible Shipping below 1.4. Please deactivate it "
58
- "on %splugins page%s. Read about big changes in Flexible Shipping on %sour "
59
- "blog →%s"
60
- msgstr ""
61
- "Masz włączony WooCommerce Flexible Shipping w wersji starszej niż 1.4. "
62
- "Wyłącz go na %sstronie wtyczek%s. Przeczytaj o dużej zmianie we Flexible "
63
- "Shipping na %snaszym blogu →%s"
64
-
65
- #: classes/bulk-actions.php:46
66
- msgid "New"
67
- msgstr "Nowa"
68
-
69
- #: classes/bulk-actions.php:47 classes/bulk-actions.php:198
70
- #: classes/shipment/ajax.php:55
71
- msgid "Created"
72
- msgstr "Utworzona"
73
-
74
- #: classes/bulk-actions.php:48 classes/bulk-actions.php:199
75
- msgid "Confirmed"
76
- msgstr "Zatwierdzona"
77
-
78
- #: classes/bulk-actions.php:49
79
- msgid "Manifest"
80
- msgstr "Protokół nadania"
81
-
82
- #: classes/bulk-actions.php:50
83
- msgid "Failed"
84
- msgstr "Błąd"
85
-
86
- #: classes/bulk-actions.php:196 classes/bulk-actions.php:226
87
- msgid "Error"
88
- msgstr "Błąd"
89
-
90
- #: classes/bulk-actions.php:197
91
- msgid "New shipment"
92
- msgstr "Nowa"
93
-
94
- #: classes/bulk-actions.php:200
95
- msgid "Manifest created"
96
- msgstr "Protokół nadania utworzony"
97
-
98
- #: classes/bulk-actions.php:255 classes/bulk-actions.php:261
99
- msgid "Shipping"
100
- msgstr "Wysyłka"
101
-
102
- #: classes/bulk-actions.php:269
103
- msgid "Send shipment"
104
- msgstr "Nadaj przesyłki"
105
-
106
- #: classes/bulk-actions.php:270
107
- msgid "Get labels"
108
- msgstr "Pobierz etykiety nadawcze"
109
-
110
- #: classes/bulk-actions.php:272
111
- msgid "Create shipping manifest"
112
- msgstr "Utwórz protokół nadania"
113
-
114
- #: classes/bulk-actions.php:293
115
- msgid "Shipment created."
116
- msgstr "Przesyłka utworzona."
117
-
118
- #: classes/bulk-actions.php:305
119
- msgid "No action performed."
120
- msgstr "Nie wykonano żdanych działań."
121
-
122
- #: classes/bulk-actions.php:325
123
- msgid "Label downloaded."
124
- msgstr "Etykieta została pobrana."
125
-
126
- #: classes/bulk-actions.php:343
127
- msgid ""
128
- "Unable to create temporary zip archive for labels. Check temporary folder "
129
- "configuration on server."
130
- msgstr ""
131
- "Nie można utworzyć tymczasowego archwium zip dla etykiet. Sprawdź "
132
- "konfigurację folderu na serwerze."
133
-
134
- #: classes/bulk-actions.php:407
135
- #, php-format
136
- msgid ""
137
- "Created manifest: %s (%s). If download not start automatically click %shere"
138
- "%s."
139
- msgstr ""
140
- "Utworzone protokoły nadania: %s (%s). Jesli pobieranie nie rozpoczęło się "
141
- "automatycznie kliknij %stutaj%s."
142
-
143
- #: classes/bulk-actions.php:419
144
- #, php-format
145
- msgid "Manifest creation error: %s (%s)."
146
- msgstr "Błąd podczas tworzenia protokołu nadania: %s (%s)."
147
-
148
- #: classes/bulk-actions.php:430
149
- msgid "No manifests created."
150
- msgstr "Nie zostały utworzone protokoły nadania."
151
-
152
- #: classes/bulk-actions.php:444
153
- #, php-format
154
- msgid "Bulk send shipment - processed orders: %d"
155
- msgstr "Masowe nadawanie przesyłek - przetworzone zamówienia: %d"
156
-
157
- #: classes/bulk-actions.php:453
158
- #, php-format
159
- msgid "Bulk labels - processed orders: %d. No labels for processed orders."
160
- msgstr ""
161
- "Masowe pobieranie etykiet - przetworzone zamówienia: %d. Brak etykiet dla "
162
- "przetworzonych zamówień."
163
-
164
- #: classes/bulk-actions.php:469
165
- #, php-format
166
- msgid ""
167
- "Bulk labels - processed orders: %d. If download not start automatically "
168
- "click %shere%s."
169
- msgstr ""
170
- "Masowe pobieranie etykiet - przetworzone zamówienia: %d. Jeśli pobieranie "
171
- "nie rozpoczęło się automatycznie kliknij %stutaj%s ."
172
-
173
- #: classes/bulk-actions.php:478
174
- #, php-format
175
- msgid "Bulk shipping manifest - processed orders: %d"
176
- msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
177
-
178
- #: classes/flexible-shipping-plugin.php:260 classes/wpdesk/class-plugin.php:267
179
- msgid "Settings"
180
- msgstr "Ustawienia"
181
-
182
- #: classes/flexible-shipping-plugin.php:261 classes/wpdesk/class-plugin.php:260
183
- msgid "Docs"
184
- msgstr "Docs"
185
-
186
- #: classes/flexible-shipping-plugin.php:262 classes/wpdesk/class-plugin.php:254
187
- msgid "Support"
188
- msgstr "Wsparcie"
189
-
190
- #: classes/flexible-shipping-plugin.php:268
191
- msgid "Upgrade"
192
- msgstr "Kup PRO"
193
-
194
- #: classes/manifest/cpt-shipping-manifest.php:60
195
- #: classes/manifest/cpt-shipping-manifest.php:62
196
- #: classes/manifest/cpt-shipping-manifest.php:64
197
- #: classes/manifest/cpt-shipping-manifest.php:97
198
- msgid "Shipping Manifests"
199
- msgstr "Protokoły nadania"
200
-
201
- #: classes/manifest/cpt-shipping-manifest.php:61
202
- msgid "Shipping Manifest"
203
- msgstr "Protokół nadania"
204
-
205
- #: classes/manifest/cpt-shipping-manifest.php:65
206
- msgid "View Shipping Manifests"
207
- msgstr "Wyświetl protokół nadania"
208
-
209
- #: classes/manifest/cpt-shipping-manifest.php:66
210
- msgid "Add new Shipping Manifest"
211
- msgstr "Dodaj nowy Protokół nadania"
212
-
213
- #: classes/manifest/cpt-shipping-manifest.php:67
214
- msgid "Add new Shipping Manifests"
215
- msgstr "Dodaj nowe Protokoły nadania"
216
-
217
- #: classes/manifest/cpt-shipping-manifest.php:68
218
- msgid "Edit Shipping Manifest"
219
- msgstr "Edytuj protokół nadania"
220
-
221
- #: classes/manifest/cpt-shipping-manifest.php:69
222
- msgid "Save Shipping Manifest"
223
- msgstr "Zapisz protokół nadania"
224
-
225
- #: classes/manifest/cpt-shipping-manifest.php:70
226
- msgid "Search Shipping Manifests"
227
- msgstr "Szukaj protokół nadania"
228
-
229
- #: classes/manifest/cpt-shipping-manifest.php:71
230
- msgid "Shipping Manifests not found"
231
- msgstr "Nie znaleziono protokołów nadania"
232
-
233
- #: classes/manifest/cpt-shipping-manifest.php:72
234
- msgid "Shipping Manifests not found in trash"
235
- msgstr "Nie znaleziono protokołów nadania w koszu"
236
-
237
- #: classes/manifest/cpt-shipping-manifest.php:74
238
- msgid "Shipping Manifests."
239
- msgstr "Protokoły nadania."
240
-
241
- #: classes/manifest/cpt-shipping-manifest.php:116
242
- #: classes/shipment/cpt-shipment.php:39 classes/shipment/cpt-shipment.php:41
243
- #: classes/shipment/cpt-shipment.php:43
244
- msgid "Shipments"
245
- msgstr "Przesyłki"
246
-
247
- #: classes/manifest/cpt-shipping-manifest.php:160
248
- msgid "Date"
249
- msgstr "Data"
250
-
251
- #: classes/manifest/cpt-shipping-manifest.php:161
252
- #: classes/manifest/views/filter-form.php:5
253
- #: classes/settings/shipping-method-form.php:115
254
- #: classes/views/html-orders-filter-form.php:5
255
- #: classes/views/html-shipping-method-settings.php:15
256
- msgid "Integration"
257
- msgstr "Integracja"
258
-
259
- #: classes/manifest/cpt-shipping-manifest.php:162
260
- msgid "Number"
261
- msgstr "Numer"
262
-
263
- #: classes/manifest/cpt-shipping-manifest.php:163
264
- msgid "Shipments count"
265
- msgstr "Liczba przesyłek"
266
-
267
- #: classes/manifest/cpt-shipping-manifest.php:164
268
- msgid "Actions"
269
- msgstr "Akcje"
270
-
271
- #: classes/manifest/cpt-shipping-manifest.php:219
272
- #: classes/manifest/cpt-shipping-manifest.php:243
273
- #: classes/shipment/cpt-shipment.php:174
274
- msgid "Invalid nonce!"
275
- msgstr "Błąd weryfikacji nonce!"
276
-
277
- #: classes/manifest/functions.php:16
278
- #, php-format
279
- msgid "Shipping manifest %s, %s"
280
- msgstr "Protokół nadania %s, %s"
281
-
282
- #: classes/manifest/views/column-actions.php:1
283
- msgid "Download"
284
- msgstr "Pobierz"
285
-
286
- #: classes/manifest/views/column-actions.php:2
287
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:78
288
- msgid "Cancel"
289
- msgstr "Anuluj"
290
-
291
- #: classes/manifest/views/filter-form.php:4
292
- msgid "All manifests"
293
- msgstr "Wszystkie protokoły nadania"
294
-
295
- #: classes/manifest/views/manifest-metabox.php:7
296
- #: classes/manifest/views/manifest-metabox.php:47
297
- #: classes/shipment/cpt-shipment.php:40
298
- msgid "Shipment"
299
- msgstr "Przesyłka"
300
-
301
- #: classes/manifest/views/manifest-metabox.php:10
302
- #: classes/manifest/views/manifest-metabox.php:50
303
- msgid "Order"
304
- msgstr "Zamówienie"
305
-
306
- #. Plugin Name of the plugin/theme
307
- #: classes/multilingual.php:44 classes/multilingual.php:47
308
- #: classes/multilingual.php:50 classes/settings/flexible-shipping.php:16
309
- #: classes/settings/flexible-shipping.php:30
310
- #: classes/settings/shipping-method-form.php:57
311
- #: classes/shipping-method-info.php:20 classes/shipping-method.php:24
312
- #: classes/shipping-method.php:25 classes/shipping-method.php:43
313
- msgid "Flexible Shipping"
314
- msgstr "Flexible Shipping"
315
-
316
- #: classes/order-add-shipping.php:30 classes/shipment/functions.php:23
317
- #, php-format
318
- msgid "Shipment for order %s, %s"
319
- msgstr "Przesyłka do zamówienia %s, %s"
320
-
321
- #: classes/order-add-shipping.php:45
322
- #, php-format
323
- msgid "Added new shipment via metabox. Shipment ID: %s"
324
- msgstr "Dodano nową przesyłkę. Numer przesyłki: %s"
325
-
326
- #: classes/order-add-shipping.php:84
327
- msgid "Select integration"
328
- msgstr "Wybierz integrację"
329
-
330
- #: classes/order-add-shipping.php:93
331
- msgid "Add shipping"
332
- msgstr "Dodaj przesyłkę"
333
-
334
- #: classes/settings/flexible-shipping.php:18
335
- #, php-format
336
- msgid "See how to %sconfigure Flexible Shipping%s."
337
- msgstr "Zobacz jak %sskonfigurować Flexible Shipping%s."
338
-
339
- #: classes/settings/flexible-shipping.php:21
340
- #: classes/settings/shipping-method-form.php:48 classes/shipping-method.php:34
341
- msgid "Enable/Disable"
342
- msgstr "Włącz/Wyłącz"
343
-
344
- #: classes/settings/flexible-shipping.php:23
345
- msgid "Enable Flexible Shipping"
346
- msgstr "Włącz Flexible Shipping"
347
-
348
- #: classes/settings/flexible-shipping.php:27
349
- msgid "Shipping title"
350
- msgstr "Tytuł"
351
-
352
- #: classes/settings/flexible-shipping.php:29
353
- msgid "Visible only to admin in WooCommerce settings."
354
- msgstr "Widoczny tylko dla admina w ustawieniach WooCommerce."
355
-
356
- #: classes/settings/flexible-shipping.php:34
357
- msgid "Tax Status"
358
- msgstr "Status podatku"
359
-
360
- #: classes/settings/flexible-shipping.php:39
361
- msgid "Taxable"
362
- msgstr "Opodatkowany"
363
-
364
- #: classes/settings/flexible-shipping.php:40
365
- msgctxt "Tax status"
366
- msgid "None"
367
- msgstr "Brak"
368
-
369
- #: classes/settings/flexible-shipping.php:44
370
- #: classes/settings/flexible-shipping.php:49
371
- msgid "Shipping Methods"
372
- msgstr "Metody wysyłki"
373
-
374
- #: classes/settings/shipping-method-form.php:10
375
- msgid "Select shipment class"
376
- msgstr "Wybierz klasę wysyłkową"
377
-
378
- #: classes/settings/shipping-method-form.php:19
379
- msgid ""
380
- "Integrate with DPD, DHL, InPost, eNadawca Poczta Polska, Paczka w Ruchu."
381
- msgstr "Zintegruj z DPD, DHL, InPost, eNadawca Poczta Polska, Paczka w Ruchu."
382
-
383
- #: classes/settings/shipping-method-form.php:19
384
- #, php-format
385
- msgid "%sAdd integrations%s"
386
- msgstr "%sDodaj integracje%s"
387
-
388
- #: classes/settings/shipping-method-form.php:22
389
- msgid "Integrate with DPD."
390
- msgstr "Zintegruj z DPD."
391
-
392
- #: classes/settings/shipping-method-form.php:22
393
- #, php-format
394
- msgid "%sAdd integration%s"
395
- msgstr "%sDodaj integrację%s"
396
-
397
- #: classes/settings/shipping-method-form.php:32 classes/shipping-method.php:879
398
- msgid "Free"
399
- msgstr "Bezpłatnie"
400
-
401
- #: classes/settings/shipping-method-form.php:51 classes/shipping-method.php:36
402
- msgid "Enable this shipment method"
403
- msgstr "Włącz tę metodę wysyłki"
404
-
405
- #: classes/settings/shipping-method-form.php:54
406
- msgid "Method Title"
407
- msgstr "Tytuł metody"
408
-
409
- #: classes/settings/shipping-method-form.php:56 classes/shipping-method.php:42
410
- msgid "This controls the title which the user sees during checkout."
411
- msgstr "Tytuł, który widzi użytkownik podczas składania zamówienia."
412
-
413
- #: classes/settings/shipping-method-form.php:63
414
- msgid "Method Description"
415
- msgstr "Opis"
416
-
417
- #: classes/settings/shipping-method-form.php:65
418
- msgid "This controls method description which the user sees during checkout."
419
- msgstr "Opis, który widzi użytkownik podczas składania zamówienia."
420
-
421
- #: classes/settings/shipping-method-form.php:76
422
- msgid "Free Shipping"
423
- msgstr "Darmowa wysyłka"
424
-
425
- #: classes/settings/shipping-method-form.php:79
426
- msgid ""
427
- "Enter a minimum order amount for free shipment. This will override the costs "
428
- "configured below."
429
- msgstr ""
430
- "Wpisz minimalną kwotę zamówienia dla bezpłatnej wysyłki. Spowoduje to "
431
- "zastąpienie reguł skonfigurowanych poniżej."
432
-
433
- #: classes/settings/shipping-method-form.php:83
434
- msgid "Free Shipping Label"
435
- msgstr "Etykieta darmowej wysyłki"
436
-
437
- #: classes/settings/shipping-method-form.php:86
438
- msgid "Enter additional label for shipment when free shipment available."
439
- msgstr ""
440
- "Wpisz dodatkową etykietę, która zostanie wyświetlona dla darmowej wysyłki."
441
-
442
- #: classes/settings/shipping-method-form.php:95
443
- msgid "Calculation Method"
444
- msgstr "Metoda obliczania"
445
-
446
- #: classes/settings/shipping-method-form.php:97
447
- msgid ""
448
- "Select how rules will be calculated. If you choose \"sum\" the rules order "
449
- "is important."
450
- msgstr ""
451
- "Wybierz jak będą obliczane reguły. Dla sumy, kolejność reguł ma znaczenie."
452
-
453
- #: classes/settings/shipping-method-form.php:100
454
- msgid "Sum"
455
- msgstr "Suma"
456
-
457
- #: classes/settings/shipping-method-form.php:103
458
- #: classes/views/html-shipping-method-settings.php:13
459
- msgid "Visibility"
460
- msgstr "Wyświetlanie"
461
-
462
- #: classes/settings/shipping-method-form.php:106
463
- #: classes/views/html-shipping-method-settings.php:46
464
- msgid "Show only for logged in users"
465
- msgstr "Pokaż tylko dla zalogowanych użytkowników"
466
-
467
- #: classes/settings/shipping-method-form.php:109
468
- #: classes/views/html-shipping-method-settings.php:14
469
- msgid "Default"
470
- msgstr "Domyślnie"
471
-
472
- #: classes/settings/shipping-method-form.php:112
473
- msgid ""
474
- "Check the box to set this option as the default selected choice on the cart "
475
- "page."
476
- msgstr ""
477
- "Zaznacz, aby ustawić tę metodę wysyłki jako domyślną przy składaniu "
478
- "zamówienia."
479
-
480
- #: classes/settings/shipping-method-form.php:117
481
- msgid "Select integration. "
482
- msgstr "Wybierz integrację. "
483
-
484
- #: classes/settings/shipping-method-form.php:120
485
- #: classes/views/html-shipping-method-rules.php:7
486
- msgid "None"
487
- msgstr "Brak"
488
-
489
- #: classes/settings/shipping-method-form.php:131
490
- msgid "Rules"
491
- msgstr "Reguły"
492
-
493
- #: classes/settings/shipping-method-form.php:152
494
- msgid "Shipping Zone"
495
- msgstr "Strefa wysyłki"
496
-
497
- #: classes/settings/shipping-method-form.php:166
498
- #, php-format
499
- msgid "See how to %sconfigure shipment methods%s."
500
- msgstr "Zobacz jak %sskonfigurować metody wysyłki %s."
501
-
502
- #: classes/shipment/ajax.php:22
503
- msgid "Unknown error!"
504
- msgstr "Nieznany błąd!"
505
-
506
- #: classes/shipment/ajax.php:25
507
- msgid "Nonce verification error! Invalid request."
508
- msgstr "Błąd weryfikacji nonce! Nieprawidłowe żądanie."
509
-
510
- #: classes/shipment/ajax.php:29
511
- msgid "No shipment id!"
512
- msgstr "Brak id przesyłki!"
513
-
514
- #: classes/shipment/ajax.php:33
515
- msgid "No data!"
516
- msgstr "Brak danych!"
517
-
518
- #: classes/shipment/ajax.php:52
519
- msgid "Saved"
520
- msgstr "Zapisano"
521
-
522
- #: classes/shipment/class-shipment.php:284
523
- msgid "Please override shipping_column method!"
524
- msgstr "Proszę nadpisać metodę shipping_column!"
525
-
526
- #: classes/shipment/cpt-shipment.php:44
527
- msgid "View Shipments"
528
- msgstr "Wyświetl przesyłki"
529
-
530
- #: classes/shipment/cpt-shipment.php:45 classes/shipment/cpt-shipment.php:46
531
- msgid "Add new Shipment"
532
- msgstr "Dodaj nową przesyłkę"
533
-
534
- #: classes/shipment/cpt-shipment.php:47
535
- msgid "Edit Shipment"
536
- msgstr "Edytuj przesyłkę"
537
-
538
- #: classes/shipment/cpt-shipment.php:48
539
- msgid "Save Shipment"
540
- msgstr "Zapisz przesyłkę"
541
-
542
- #: classes/shipment/cpt-shipment.php:49
543
- msgid "Search Shipments"
544
- msgstr "Szukaj przesyłek"
545
-
546
- #: classes/shipment/cpt-shipment.php:50
547
- msgid "Shipment not found"
548
- msgstr "Nie znaleziono przesyłki"
549
-
550
- #: classes/shipment/cpt-shipment.php:51
551
- msgid "Shipment not found in trash"
552
- msgstr "Nie znaleziono przesyłki w koszu"
553
-
554
- #: classes/shipment/cpt-shipment.php:53
555
- msgid "Shipments."
556
- msgstr "Przesyłki."
557
-
558
- #: classes/shipment/cpt-shipment.php:73
559
- msgctxt "Shipment status"
560
- msgid "New"
561
- msgstr "Nowa"
562
-
563
- #: classes/shipment/cpt-shipment.php:78
564
- #, php-format
565
- msgid "New <span class=\"count\">(%s)</span>"
566
- msgid_plural "New <span class=\"count\">(%s)</span>"
567
- msgstr[0] "Nowa <span class=\"count\">(%s)</span>"
568
- msgstr[1] "Nowa <span class=\"count\">(%s)</span>"
569
- msgstr[2] "Nowa <span class=\"count\">(%s)</span>"
570
-
571
- #: classes/shipment/cpt-shipment.php:81
572
- msgctxt "Shipment status"
573
- msgid "Created"
574
- msgstr "Utworzona"
575
-
576
- #: classes/shipment/cpt-shipment.php:86
577
- #, php-format
578
- msgid "Created <span class=\"count\">(%s)</span>"
579
- msgid_plural "Created <span class=\"count\">(%s)</span>"
580
- msgstr[0] "Utworzona <span class=\"count\">(%s)</span>"
581
- msgstr[1] "Utworzona <span class=\"count\">(%s)</span>"
582
- msgstr[2] "Utworzona <span class=\"count\">(%s)</span>"
583
-
584
- #: classes/shipment/cpt-shipment.php:89
585
- msgctxt "Shipment status"
586
- msgid "Confirmed"
587
- msgstr "Zatwierdzona"
588
-
589
- #: classes/shipment/cpt-shipment.php:94 classes/shipment/cpt-shipment.php:102
590
- #, php-format
591
- msgid "Confirmed <span class=\"count\">(%s)</span>"
592
- msgid_plural "Confirmed <span class=\"count\">(%s)</span>"
593
- msgstr[0] "Zatwierdzona <span class=\"count\">(%s)</span>"
594
- msgstr[1] "Zatwierdzona <span class=\"count\">(%s)</span>"
595
- msgstr[2] "Zatwierdzona <span class=\"count\">(%s)</span>"
596
-
597
- #: classes/shipment/cpt-shipment.php:97
598
- msgctxt "Shipment status"
599
- msgid "Manifest created"
600
- msgstr "Protokół nadania utworzony"
601
-
602
- #: classes/shipment/cpt-shipment.php:105
603
- msgctxt "Shipment status"
604
- msgid "Failed"
605
- msgstr "Błąd"
606
-
607
- #: classes/shipment/cpt-shipment.php:110
608
- #, php-format
609
- msgid "Failed <span class=\"count\">(%s)</span>"
610
- msgid_plural "Failed <span class=\"count\">(%s)</span>"
611
- msgstr[0] "Błąd <span class=\"count\">(%s)</span>"
612
- msgstr[1] "Błąd <span class=\"count\">(%s)</span>"
613
- msgstr[2] "Błąd <span class=\"count\">(%s)</span>"
614
-
615
- #: classes/shipment/cpt-shipment.php:125
616
- msgid "Shipment data"
617
- msgstr "Dane przesyłki"
618
-
619
- #: classes/shipping-method.php:40
620
- msgid "Shipping Title"
621
- msgstr "Tytuł"
622
-
623
- #: classes/shipping-method.php:112
624
- #: classes/views/html-shipping-method-rules.php:241
625
- msgid "Add New"
626
- msgstr "Dodaj nową"
627
-
628
- #: classes/shipping-method.php:347
629
- msgid ""
630
- "Sorry, there has been an error. The CSV is invalid or incorrect file type."
631
- msgstr ""
632
- "Przepraszamy, wystąpił błąd. Plik CSV jest niepoprawny lub typ pliku jest "
633
- "nieprawidłowy."
634
-
635
- #: classes/shipping-method.php:357 classes/shipping-method.php:360
636
- msgid "import"
637
- msgstr "import"
638
-
639
- #: classes/shipping-method.php:369
640
- #, php-format
641
- msgid "Free Shipping value %s is not valid number. Row number %d."
642
- msgstr "Wartość darmowej wysyłki %s jest niepoprawna. Numer wiersza %d."
643
-
644
- #: classes/shipping-method.php:375
645
- #, php-format
646
- msgid "Maximum Cost value %s is not valid number. Row number %d."
647
- msgstr "Maksymalny koszt %s jest niepoprawny. Numer wiersza %d."
648
-
649
- #: classes/shipping-method.php:386
650
- #, php-format
651
- msgid "Invalid value for Calculation Method in row number %d."
652
- msgstr "Nieprawidłowa wartość dla Metody obliczania w wierszu %d."
653
-
654
- #: classes/shipping-method.php:410
655
- #, php-format
656
- msgid "Invalid value for Based On in row number %d."
657
- msgstr "Nieprawidłowa wartość dla Oparte na w wierszu %d."
658
-
659
- #: classes/shipping-method.php:415
660
- #, php-format
661
- msgid "Min value %s is not valid number. Row number %d."
662
- msgstr "Wartość Min %s jest niepoprawna. Numer wiersza %d."
663
-
664
- #: classes/shipping-method.php:421
665
- #, php-format
666
- msgid "Max value %s is not valid number. Row number %d."
667
- msgstr "Wartość Maks %s jest niepoprawna. Numer wiersza %d."
668
-
669
- #: classes/shipping-method.php:427
670
- #, php-format
671
- msgid "Cost per order value %s is not valid number. Row number %d."
672
- msgstr "Wartość Koszt na zamówienie %s jest niepoprawna. Numer wiersza %d."
673
-
674
- #: classes/shipping-method.php:433
675
- #, php-format
676
- msgid "Additional cost value %s is not valid number. Row number %d."
677
- msgstr "Wartość Dodatkowy koszt %s jest niepoprawna. Numer wiersza %d."
678
-
679
- #: classes/shipping-method.php:439
680
- #, php-format
681
- msgid "Value value %s is not valid number. Row number %d."
682
- msgstr "Wartość w polu Wartość %s jest niepoprawna. Numer wiersza %d."
683
-
684
- #: classes/shipping-method.php:491
685
- #, php-format
686
- msgid "Shipping method %s imported as %s."
687
- msgstr "Metoda wysyłki %s została zaimportowana jako %s."
688
-
689
- #: classes/shipping-method.php:551
690
- msgid "New Shipping Method"
691
- msgstr "Nowa metoda wysyłki"
692
-
693
- #: classes/shipping-method.php:554
694
- msgid "Edit Shipping Method"
695
- msgstr "Edytuj metodę wysyłki"
696
-
697
- #: classes/shipping-method.php:564 classes/shipping-method.php:606
698
- #, php-format
699
- msgid "Shipping method %s added."
700
- msgstr "Metoda wysyłki dodana: %s."
701
-
702
- #: classes/shipping-method.php:589
703
- #, php-format
704
- msgid "Shipping method %s deleted."
705
- msgstr "Metoda wysyłki usunięta: %s."
706
-
707
- #: classes/shipping-method.php:592
708
- msgid "Shipping method not found."
709
- msgstr "Metoda wysyłki nie znaleziona."
710
-
711
- #: classes/shipping-method.php:618
712
- #, php-format
713
- msgid "Shipping method %s updated."
714
- msgstr "Metoda wysyłki zaktualizowana: %s."
715
-
716
- #: classes/tracker.php:183
717
- msgid "Opt-in"
718
- msgstr "Opt-in"
719
-
720
- #: classes/tracker.php:187
721
- msgid "Opt-out"
722
- msgstr "Opt-out"
723
-
724
- #: classes/views/html-ads.php:4
725
- msgid "Get Flexible Shipping PRO!"
726
- msgstr "Kup Flexible Shipping PRO!"
727
-
728
- #: classes/views/html-ads.php:13
729
- msgid "Shipping Classes support"
730
- msgstr "Wsparcie klas wysyłkowych"
731
-
732
- #: classes/views/html-ads.php:14
733
- msgid "Product count based costs"
734
- msgstr "Koszty oparte o liczbę produktów w koszyku"
735
-
736
- #: classes/views/html-ads.php:15
737
- msgid "Stopping, Cancelling a rule"
738
- msgstr "Zatrzymywanie, anulowanie reguł"
739
-
740
- #: classes/views/html-ads.php:16
741
- msgid "Additional calculation methods"
742
- msgstr "Dodatkowe rodzaje obliczania kosztów"
743
-
744
- #: classes/views/html-ads.php:19
745
- msgid "Upgrade Now &rarr;"
746
- msgstr "Zaktualizuj do wersji PRO &rarr;"
747
-
748
- #: classes/views/html-column-shipping-shipping.php:14
749
- msgid "Get label for: "
750
- msgstr "Pobierz etykietę dla "
751
-
752
- #: classes/views/html-column-shipping-shipping.php:17
753
- msgid "Track shipment for: "
754
- msgstr "Śledź przesyłkę "
755
-
756
- #: classes/views/html-order-add_shipping-metabox.php:15
757
- msgid "Add"
758
- msgstr "Dodaj"
759
-
760
- #: classes/views/html-orders-filter-form.php:4
761
- #: classes/views/html-orders-filter-form.php:12
762
- msgid "All shippings"
763
- msgstr "Wszystkie przesyłki"
764
-
765
- #: classes/views/html-orders-filter-form.php:13
766
- msgid "Shipment status"
767
- msgstr "Status przesyłki"
768
-
769
- #: classes/views/html-shipping-method-info-description.php:19
770
- #, php-format
771
- msgid ""
772
- "To add first Flexible Shipping method go to %sShipping zones%s and add "
773
- "Flexible Shipping to a shipping zone."
774
- msgstr ""
775
- "Aby dodać pierwszą metodę Flexible Shipping przejdź do zakładki %sStrefy "
776
- "wysyłki%s i dodaj Flexible Shipping do strefy wysyłki."
777
-
778
- #: classes/views/html-shipping-method-info-description.php:26
779
- msgid ""
780
- "You can start the configuration by clicking the Flexible Shipping link in "
781
- "the Shipping methods table."
782
- msgstr ""
783
- "Możesz rozpocząć konfigurację klikając na link Flexible Shipping w tabeli "
784
- "”Metody wysyłki”."
785
-
786
- #: classes/views/html-shipping-method-info-description.php:29
787
- msgid "Quick Video Overview"
788
- msgstr "Krótki przewodnik video"
789
-
790
- #: classes/views/html-shipping-method-info-description.php:40
791
- msgid "More resources"
792
- msgstr "Więcej informacji"
793
-
794
- #: classes/views/html-shipping-method-info-description.php:44
795
- msgid "General Settings"
796
- msgstr "Ustawienia główne"
797
-
798
- #: classes/views/html-shipping-method-info-description.php:45
799
- msgid "Adding a shipping method"
800
- msgstr "Dodawanie metody wysyłki"
801
-
802
- #: classes/views/html-shipping-method-info-description.php:46
803
- msgid "Currency Support"
804
- msgstr "Waluty"
805
-
806
- #: classes/views/html-shipping-method-info-description.php:47
807
- msgid "Weight Based Shipping"
808
- msgstr "Koszt na wagę"
809
-
810
- #: classes/views/html-shipping-method-info-description.php:48
811
- msgid "Shipping Insurance"
812
- msgstr "Ubezpieczenie przesyłki"
813
-
814
- #: classes/views/html-shipping-method-info-description.php:49
815
- msgid "Conditional Cash on Delivery"
816
- msgstr "Przesyłka za pobraniem"
817
-
818
- #: classes/views/html-shipping-method-rules.php:8
819
- msgid "Price"
820
- msgstr "Cena"
821
-
822
- #: classes/views/html-shipping-method-rules.php:9
823
- msgid "Weight"
824
- msgstr "Waga"
825
-
826
- #: classes/views/html-shipping-method-rules.php:61
827
- #, php-format
828
- msgid ""
829
- "Check %sFlexible Shipping PRO &rarr;%s to add advanced rules based on "
830
- "shipment classes, product/item count or additional handling fees/insurance."
831
- msgstr ""
832
- "Sprawdź %sFlexible Shipping PRO &rarr;%s, aby dodawać zaawansowane reguły "
833
- "oparte o klasy wysyłkowe, liczbę produktów/pozycji lub naliczać dodatkowe "
834
- "koszty obsługi/ubezpieczenia."
835
-
836
- #: classes/views/html-shipping-method-rules.php:73
837
- msgid "Based on"
838
- msgstr "Oparte na"
839
-
840
- #: classes/views/html-shipping-method-rules.php:74
841
- msgid "Shipping cost will be calculated based on the selected parameter."
842
- msgstr "Koszty wysyłki będą obliczane w oparciu o wybrany parametr."
843
-
844
- #: classes/views/html-shipping-method-rules.php:77
845
- msgid "Min"
846
- msgstr "Min"
847
-
848
- #: classes/views/html-shipping-method-rules.php:78
849
- msgid ""
850
- "Enter minimum value for the &quot;Based on&quot; parameter. Value based on "
851
- "the price will be calculated by WooCommerce tax settings &quot;Display "
852
- "prices during cart and checkout&quot;"
853
- msgstr ""
854
- "Wpisz minimalną wartość dla parametru &quot;Oparte na&quot;. Wartość oparta "
855
- "na cenie zostanie obliczona wg. ustawienia podatków WooCommerce &quot;"
856
- "Wyświetlanie cen w koszyku i zamówieniu&quot;"
857
-
858
- #: classes/views/html-shipping-method-rules.php:81
859
- msgid "Max"
860
- msgstr "Max"
861
-
862
- #: classes/views/html-shipping-method-rules.php:82
863
- msgid ""
864
- "Enter maximum value for the &quot;Based on&quot; parameter. Value based on "
865
- "the price will be calculated by WooCommerce tax settings &quot;Display "
866
- "prices during cart and checkout&quot;"
867
- msgstr ""
868
- "Wpisz maksymalną wartość dla parametru &quot;Oparte na&quot;. Wartość oparta "
869
- "na cenie zostanie obliczona wg. ustawienia podatków WooCommerce &quot;"
870
- "Wyświetlanie cen w koszyku i zamówieniu&quot;"
871
-
872
- #: classes/views/html-shipping-method-rules.php:85
873
- msgid "Cost per<br/>order"
874
- msgstr "Koszt na<br/>zamówienie"
875
-
876
- #: classes/views/html-shipping-method-rules.php:86
877
- msgid "Enter shipment cost for this rule."
878
- msgstr "Wpisz koszt wysyłki dla tej reguły."
879
-
880
- #: classes/views/html-shipping-method-rules.php:161
881
- msgid "Insert rule"
882
- msgstr "Dodaj regułę"
883
-
884
- #: classes/views/html-shipping-method-rules.php:162
885
- msgid "Delete selected rules"
886
- msgstr "Usuń wybrane reguły"
887
-
888
- #: classes/views/html-shipping-method-rules.php:212
889
- msgid "No rows selected."
890
- msgstr "Nie wybrano wierszy."
891
-
892
- #: classes/views/html-shipping-method-rules.php:217
893
- msgid "Are you sure?"
894
- msgstr "Na pewno?"
895
-
896
- #: classes/views/html-shipping-method-rules.php:232
897
- #: classes/views/html-shipping-method-settings.php:106
898
- msgid "Shipping Zones"
899
- msgstr "Strefy wysyłki"
900
-
901
- #: classes/views/html-shipping-method-settings.php:11
902
- msgid "Title"
903
- msgstr "Tytuł"
904
-
905
- #: classes/views/html-shipping-method-settings.php:12
906
- msgid "Enabled"
907
- msgstr "Włączona"
908
-
909
- #: classes/views/html-shipping-method-settings.php:16
910
- msgid "Select all"
911
- msgstr "Zaznacz wszystkie"
912
-
913
- #: classes/views/html-shipping-method-settings.php:39
914
- #: classes/views/html-shipping-method-settings.php:46
915
- #: classes/views/html-shipping-method-settings.php:53
916
- msgid "yes"
917
- msgstr "tak"
918
-
919
- #: classes/views/html-shipping-method-settings.php:48
920
- msgid "Show for all users"
921
- msgstr "Pokaż dla wszystkich użytkowników"
922
-
923
- #: classes/views/html-shipping-method-settings.php:69
924
- msgid ""
925
- "Drag and drop the above shipment methods to control their display order. "
926
- "Confirm by clicking Save changes button below."
927
- msgstr ""
928
- "Przeciągnij i upuść metody wysyłki aby ustawić ich kolejność wyświetlania. "
929
- "Potwierdź przez kliknięcie przycisku Zapisz zmiany poniżej."
930
-
931
- #: classes/views/html-shipping-method-settings.php:74
932
- msgid "Remove selected"
933
- msgstr "Usuń zaznaczone"
934
-
935
- #: classes/views/html-shipping-method-settings.php:78
936
- msgid "Cancel import"
937
- msgstr "Anuluj import"
938
-
939
- #: classes/views/html-shipping-method-settings.php:79
940
- #: classes/views/html-shipping-method-settings.php:80
941
- msgid "Import"
942
- msgstr "Importuj"
943
-
944
- #: classes/views/html-shipping-method-settings.php:155
945
- msgid "Please select shipment methods to remove"
946
- msgstr "Proszę wybrać metody wysyłki do usunięcia"
947
-
948
- #: classes/views/html-shipping-method-settings.php:187
949
- msgid "Select file to import"
950
- msgstr "Wybierz plik do importu"
951
-
952
- #: classes/wpdesk/class-helper.php:52
953
- #, php-format
954
- msgid ""
955
- "The %s%s%s License Key has not been activated, so the plugin is inactive! "
956
- "%sClick here%s to activate the license key and the plugin."
957
- msgstr ""
958
- "Klucz licencyjny wtyczki %s%s%s nie został aktywowany, więc wtyczka jest "
959
- "nieaktywna! %sKliknij tutaj%s, aby aktywować klucz licencyjny wtyczki."
960
-
961
- #: classes/wpdesk/class-requirement-checker.php:185
962
- #, php-format
963
- msgid ""
964
- "The &#8220;%s&#8221; plugin cannot run on PHP versions older than %s. Please "
965
- "contact your host and ask them to upgrade."
966
- msgstr ""
967
- "Wtyczka &#8220;%s&#8221; nie może działać w wersjach PHP starszych niż %s. "
968
- "Skontaktuj się z administratorem hostingu i poproś o aktualizację."
969
-
970
- #: classes/wpdesk/class-requirement-checker.php:188
971
- #, php-format
972
- msgid ""
973
- "The &#8220;%s&#8221; plugin cannot run on WordPress versions older than %s. "
974
- "Please update WordPress."
975
- msgstr ""
976
- "Wtyczka &#8220;%s&#8221; nie może działać w wersjach WordPress starszych niż "
977
- "%s. Prosimy o aktualizację WordPress."
978
-
979
- #: classes/wpdesk/class-requirement-checker.php:191
980
- #, php-format
981
- msgid ""
982
- "The &#8220;%s&#8221; plugin cannot run on WooCommerce versions older than "
983
- "%s. Please update WooCommerce."
984
- msgstr ""
985
- "Wtyczka &#8220;%s&#8221; nie może działać w wersjach WooCommerce starszych "
986
- "niż %s. Prosimy o aktualizację WooCommerce."
987
-
988
- #: classes/wpdesk/class-requirement-checker.php:209
989
- #, php-format
990
- msgid ""
991
- "The &#8220;%s&#8221; plugin cannot run without %s php module installed. "
992
- "Please contact your host and ask them to install %s."
993
- msgstr ""
994
- "Wtyczka &#8220;%s&#8221; nie może działać bez modułu php: %s. Skontaktuj się "
995
- "z administratorem hostingu i poproś o instalację %s."
996
-
997
- #: classes/wpdesk/class-requirement-checker.php:226
998
- #, php-format
999
- msgid ""
1000
- "The &#8220;%s&#8221; plugin cannot run without %s php setting set to %s. "
1001
- "Please contact your host and ask them to set %s."
1002
- msgstr ""
1003
- "Wtyczka &#8220;%s&#8221; nie może działać bez ustawienia php %s ustawionego "
1004
- "na %s. Skontaktuj się z administratorem hostingu i poproś o ustawienie %s."
1005
-
1006
- #: classes/wpdesk/class-requirement-checker.php:243
1007
- #, php-format
1008
- msgid ""
1009
- "The &#8220;%s&#8221; plugin cannot run without %s active. Please install and "
1010
- "activate %s plugin."
1011
- msgstr ""
1012
- "Wtyczka &#8220;%s&#8221; nie może działać bez aktywacji %s. Zainstaluj i "
1013
- "aktywuj wtyczkę %s."
1014
-
1015
- #: classes/wpdesk/class-settings.php:106
1016
- msgid "Insert Image"
1017
- msgstr "Wstaw obrazek"
1018
-
1019
- #: classes/wpdesk/class-settings.php:107
1020
- msgid "Select Image"
1021
- msgstr "Wybierz obrazek"
1022
-
1023
- #: inc/functions.php:67
1024
- #, php-format
1025
- msgid "Redirecting. If page not redirects click %s here %s."
1026
- msgstr ""
1027
- "Przekierowywanie. Jeśli strona nie przekierowuje cię automatycznie, kliknij "
1028
- "%s tu %s."
1029
-
1030
- #: inc/wpdesk-tracker/views/tracker-connect.php:7
1031
- #: inc/wpdesk-tracker/views/tracker-notice.php:5
1032
- #, php-format
1033
- msgid "Hey %s,"
1034
- msgstr "Hej %s,"
1035
-
1036
- #: inc/wpdesk-tracker/views/tracker-connect.php:8
1037
- msgid ""
1038
- "Please help us improve our plugins! If you opt-in, we will collect some non-"
1039
- "sensitive data and usage information anonymously. If you skip this, that's "
1040
- "okay! All plugins will work just fine."
1041
- msgstr ""
1042
- "Proszę pomóż nam udoskonalić nasze wtyczki! Jeśli się zgodzisz, będziemy "
1043
- "zbierać niewrażliwe dane użytkowania anonimowo. Jeśli pominiesz ten krok, w "
1044
- "porządku! Wszystkie wtyczki będą działać."
1045
-
1046
- #: inc/wpdesk-tracker/views/tracker-connect.php:13
1047
- msgid "Allow & Continue &rarr;"
1048
- msgstr "Pozwól i kontunuuj &rarr;"
1049
-
1050
- #: inc/wpdesk-tracker/views/tracker-connect.php:14
1051
- msgid "Skip"
1052
- msgstr "Pomiń"
1053
-
1054
- #: inc/wpdesk-tracker/views/tracker-connect.php:19
1055
- msgid "What permissions are being granted?"
1056
- msgstr "Jakie uprawnienia są przyznawane?"
1057
-
1058
- #: inc/wpdesk-tracker/views/tracker-connect.php:26
1059
- msgid "Your Site Overview"
1060
- msgstr "Dane witryny"
1061
-
1062
- #: inc/wpdesk-tracker/views/tracker-connect.php:27
1063
- msgid "WP version, PHP info"
1064
- msgstr "Wersja WP, PHP info"
1065
-
1066
- #: inc/wpdesk-tracker/views/tracker-connect.php:33
1067
- msgid "Plugin Usage"
1068
- msgstr "Dane użytkowania wtyczek"
1069
-
1070
- #: inc/wpdesk-tracker/views/tracker-connect.php:34
1071
- msgid "Current settings and usage information of WP Desk plugins"
1072
- msgstr "Ustawienia i informacje o użytkowaniu wtyczek WP Desk"
1073
-
1074
- #: inc/wpdesk-tracker/views/tracker-connect.php:40
1075
- msgid "Your Store Overview"
1076
- msgstr "Ustawienia i informacje o użytkowaniu wtyczek WP Desk"
1077
-
1078
- #: inc/wpdesk-tracker/views/tracker-connect.php:41
1079
- msgid "Anonymized and non-sensitive store usage information"
1080
- msgstr "Tylko niewrażliwe i anonimowe dane o użytkowaniu sklepu"
1081
-
1082
- #: inc/wpdesk-tracker/views/tracker-connect.php:47
1083
- #: inc/wpdesk-tracker/views/tracker-notice.php:7
1084
- msgid "Find out more &raquo;"
1085
- msgstr "Dowiedz się więcej &raquo;"
1086
-
1087
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:3
1088
- #, php-format
1089
- msgid "You are deactivating %s plugin."
1090
- msgstr "Dezaktywowałeś wtyczkę %s."
1091
-
1092
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:9
1093
- msgid ""
1094
- " If you have a moment, please let us know why you are deactivating plugin "
1095
- "(anonymous feedback):"
1096
- msgstr ""
1097
- " Jeśli masz chwilę, prosimy daj nam znać dlaczego dezaktywowałeś wtyczkę "
1098
- "(anonimowa opinia):"
1099
-
1100
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:16
1101
- msgid "The plugin suddenly stopped working"
1102
- msgstr "Wtyczka nagle przestała działać"
1103
-
1104
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:24
1105
- msgid "The plugin broke my site"
1106
- msgstr "Wtyczka zepsuła moją stronę"
1107
-
1108
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:32
1109
- msgid "I found a better plugin"
1110
- msgstr "Znalazłem lepszą wtyczkę"
1111
-
1112
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:35
1113
- msgid "What's the plugin's name?"
1114
- msgstr "Jaka jest nazwa wtyczki?"
1115
-
1116
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:43
1117
- msgid "I only needed the plugin for a short period"
1118
- msgstr "Potrzebowałem wtyczki tylko przez krótki okres"
1119
-
1120
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:51
1121
- msgid "I no longer need the plugin"
1122
- msgstr "Nie potrzebuję już wtyczki"
1123
-
1124
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:59
1125
- msgid "It's a temporary deactivation. I'm just debugging an issue."
1126
- msgstr "Jest to tymczasowa dezaktywacja, debaguję problem."
1127
-
1128
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:67
1129
- msgid "Other"
1130
- msgstr "Inny"
1131
-
1132
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:70
1133
- msgid "Kindly tell us the reason so we can improve"
1134
- msgstr "Napisz nam powód abyśmy mogli go poprawić"
1135
-
1136
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:77
1137
- msgid "Skip &amp; Deactivate"
1138
- msgstr "Pomiń i dezaktywuj"
1139
-
1140
- #: inc/wpdesk-tracker/views/tracker-deactivate.php:92
1141
- msgid "Submit &amp; Deactivate"
1142
- msgstr "Anuluj"
1143
-
1144
- #: inc/wpdesk-tracker/views/tracker-notice.php:6
1145
- msgid ""
1146
- "We need your help to improve <strong>WP Desk plugins</strong>, so they are "
1147
- "more useful for you and the rest of <strong>30,000+ users</strong>. By "
1148
- "collecting data on how you use our plugins, you will help us a lot. We will "
1149
- "not collect any sensitive data, so you can feel safe."
1150
- msgstr ""
1151
- "Potrzebujemy Twojej pomocy, aby dalej rozwijać <strong>wtyczki WP Desk</"
1152
- "strong> i były one jeszcze bardziej pomocne dla Ciebie i pozostałych ponad "
1153
- "<strong>30 000 użytkowników</strong>. Zbierając dane na temat tego jak "
1154
- "korzystasz z naszych wtyczek bardzo nam w tym pomożesz. Nie będziemy zbierać "
1155
- "żadnych danych wrażliwych, więc możesz czuć się bezpiecznie."
1156
-
1157
- #: inc/wpdesk-tracker/views/tracker-notice.php:10
1158
- msgid "Allow"
1159
- msgstr "Pozwól"
1160
-
1161
- #: inc/wpdesk-tracker/views/tracker-opt-out-notice.php:3
1162
- msgid ""
1163
- "You successfully opted out of collecting usage data by WP Desk. If you "
1164
- "change your mind, you can always opt in later in the plugin's quick links."
1165
- msgstr ""
1166
- "Twoja rezygnacja ze zbierania danych użytkowania wtyczek przez WP Desk "
1167
- "została przyjęta. Jeśli zmienisz zdanie, zawsze możesz włączyć zgodę poprzez "
1168
- "szybkie linki w menu wtyczek."
1169
-
1170
- #. Plugin URI of the plugin/theme
1171
- msgid "https://wordpress.org/plugins/flexible-shipping/"
1172
- msgstr "https://pl.wordpress.org/plugins/flexible-shipping/"
1173
-
1174
- #. Description of the plugin/theme
1175
- msgid ""
1176
- "Create additional shipment methods in WooCommerce and enable pricing based "
1177
- "on cart weight or total."
1178
- msgstr ""
1179
- "Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów w "
1180
- "oparciu o wagę lub wartość zamówienia."
1181
-
1182
- #. Author of the plugin/theme
1183
- msgid "WP Desk"
1184
- msgstr "WP Desk"
1185
-
1186
- #. Author URI of the plugin/theme
1187
- msgid "https://www.wpdesk.net/"
1188
- msgstr "https://www.wpdesk.pl/"
1189
-
1190
- #~ msgid "Admin Updates"
1191
- #~ msgstr "Powiadomienia"
1192
-
1193
- #~ msgid "Announcements, updates, marketing, no spam and easy opt-out"
1194
- #~ msgstr ""
1195
- #~ "Ważne powiadomienia, uaktualnienia, marketing, żadnego spamu i łatwa "
1196
- #~ "rezygnacja"
1197
-
1198
- #~ msgid "Stopping a rule"
1199
- #~ msgstr "Zatrzymywanie reguł"
1200
-
1201
- #~ msgid "Additional calculation methods (sum, lowest cost, highest cost)"
1202
- #~ msgstr ""
1203
- #~ "Dodatkowe rodzaje obliczania kosztów (suma, najniższy, najwyższy koszt "
1204
- #~ "reguł spełniających warunki)"
1205
-
1206
- #~ msgid "Enter minimum value for the &quot;Based on&quot; parameter."
1207
- #~ msgstr "Wpisz minimalną wartość dla parametru &quot;Oparte na&quot;."
1208
-
1209
- #~ msgid "Enter maximum value for the &quot;Based on&quot; parameter."
1210
- #~ msgstr "Wpisz maksymalną wartość dla parametru &quot;Oparte na&quot;."
1211
-
1212
- #, fuzzy
1213
- #~| msgid "Settings"
1214
- #~ msgid "Settings updated."
1215
- #~ msgstr "Ustawienia"
1216
-
1217
- #~ msgid ""
1218
- #~ "An Unexpected HTTP Error occurred during the API request. <a href=\"?\" "
1219
- #~ "onclick=\"document.location.reload(); return false;\">Try again</a>"
1220
- #~ msgstr ""
1221
- #~ "Wystąpił nieoczekiwany błąd HTTP podczas zapytania API.</p> <p><a "
1222
- #~ "href=„?” onclick=„document.location.reload(); return false;”>Spróbuj "
1223
- #~ "ponownie</a>"
1224
-
1225
- #~ msgid "An unknown error occurred"
1226
- #~ msgstr "Wystąpił nieznany błąd"
1227
-
1228
- #~ msgid ""
1229
- #~ "Please help us improve our plugins and get a <strong>20&#37; discount "
1230
- #~ "coupon</strong> for <strong>WP Desk</strong> plugins."
1231
- #~ msgstr ""
1232
- #~ "Pomóż nam ulepszyć nasze wtyczki i otrzymaj <strong>kupon rabatowy 20&#37;"
1233
- #~ "</strong> na kolejne zakupy w <strong>WP Desk</strong>."
1234
-
1235
- #~ msgid ""
1236
- #~ "Allow WP Desk to collect plugin usage information and <strong>get "
1237
- #~ "discount coupon</strong> in our shop. No sensitive data is tracked."
1238
- #~ msgstr ""
1239
- #~ "Pozwól WP Desk na zbieranie danych użytkowania wtyczek i <strong>otrzymaj "
1240
- #~ "kupon rabatowy</strong> do naszego sklepu. Żadne wrażliwe dane nie będą "
1241
- #~ "zbierane."
1242
-
1243
- #~ msgid "Integration "
1244
- #~ msgstr "Integracja "
1245
-
1246
- #~ msgid "Shipping method title is not set in row number %d."
1247
- #~ msgstr "Tytuł metody wysyłki nie został ustawiony w wierszu %d."
1248
-
1249
- #~ msgid "Minimum Order Amount"
1250
- #~ msgstr "Minimalna wartość zamówienia"
1251
-
1252
- #~ msgid "Free shipment label"
1253
- #~ msgstr "Etykieta darmowej wysyłki"
1254
-
1255
- #~ msgid "Free shipment"
1256
- #~ msgstr "Darmowa wysyłka"
1257
-
1258
- #~ msgid ""
1259
- #~ "%sAdd integrations%s with Paczkomaty InPost, eNadawca Poczta Polska, "
1260
- #~ "Paczka w Ruchu."
1261
- #~ msgstr ""
1262
- #~ "%sDodaj integracje%s z Paczkomaty InPost, eNadawca Poczta Polska, Paczka "
1263
- #~ "w Ruchu."
1264
-
1265
- #~ msgid "Action"
1266
- #~ msgstr "Akcje"
1267
-
1268
- #~ msgid "Delete"
1269
- #~ msgstr "Usuń"
1270
-
1271
- #~ msgid ""
1272
- #~ "If you need more advanced rules based on shipment classes, product/item "
1273
- #~ "count or adding additional handling/insurance fees make sure to check "
1274
- #~ "%sFlexible Shipping PRO &rarr;%s"
1275
- #~ msgstr ""
1276
- #~ "Jeśli potrzebujesz bardziej zaawansowanych reguł opartych o klasy "
1277
- #~ "wysyłkowe, liczbę produktów/pozycji lub dodatkowe koszty obsługi/"
1278
- #~ "ubezpieczenia, koniecznie sprawdź %sFlexible Shipping PRO &rarr;%s"
1279
-
1280
- #~ msgid ""
1281
- #~ "You can add integrations with Paczkomaty InPost, eNadawca Poczta Polska, "
1282
- #~ "Paczka w Ruchu. %sView details%s"
1283
- #~ msgstr ""
1284
- #~ "Możesz dodać integracje z Paczkomaty InPost, eNadawca Poczta Polska, "
1285
- #~ "Paczka w Ruchu. %sSprawdź szczegóły%s"
1286
-
1287
- #~ msgid "Insert row"
1288
- #~ msgstr "Dodaj wiersz"
1289
-
1290
- #~ msgid "Delete selected rows"
1291
- #~ msgstr "Usuń zaznaczone wiersze"
1292
-
1293
- #~ msgid "Cart total"
1294
- #~ msgstr "Suma koszyka"
1295
-
1296
- #~ msgid "Value"
1297
- #~ msgstr "Wartość"
1298
-
1299
- #~ msgid ""
1300
- #~ "Enter minimum order amount for free shipment. This will override all "
1301
- #~ "rules configured below."
1302
- #~ msgstr "Wprowadź minimalną kwotę do bezpłatnej wysyłki. "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin-create.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use WPDesk\PluginBuilder\BuildDirector\LegacyBuildDirector;
4
+ use WPDesk\PluginBuilder\Builder\InfoBuilder;
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ /** @var WPDesk_Plugin_Info $plugin_info */
11
+ $builder = new InfoBuilder( $plugin_info );
12
+ $build_director = new LegacyBuildDirector( $builder );
13
+ $build_director->build_plugin();
14
+
15
+ add_action( 'plugins_loaded', 'flexible_shipping_plugins_loaded', 9 );
16
+ if ( ! function_exists( 'flexible_shipping_plugins_loaded' ) ) {
17
+ function flexible_shipping_plugins_loaded() {
18
+ if ( ! function_exists( 'should_enable_wpdesk_tracker' ) ) {
19
+ function should_enable_wpdesk_tracker() {
20
+ $tracker_enabled = true;
21
+ if ( ! empty( $_SERVER['SERVER_ADDR'] ) && $_SERVER['SERVER_ADDR'] === '127.0.0.1' ) {
22
+ $tracker_enabled = false;
23
+ }
24
+
25
+ return apply_filters( 'wpdesk_tracker_enabled', $tracker_enabled );
26
+ }
27
+ }
28
+
29
+ $tracker_factory = new WPDesk_Tracker_Factory();
30
+ $tracker_factory->create_tracker( basename( dirname( __FILE__ ) ) );
31
+ }
32
+ }
33
+
34
+ require_once( __DIR__ . '/inc/functions.php' );
35
+ require_once( __DIR__ . '/classes/shipment/functions.php' );
36
+
37
+ if ( !function_exists( 'wpdesk_is_plugin_active' ) ) {
38
+ function wpdesk_is_plugin_active( $plugin_file ) {
39
+
40
+ $active_plugins = (array) get_option( 'active_plugins', array() );
41
+
42
+ if ( is_multisite() ) {
43
+ $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
44
+ }
45
+
46
+ return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
47
+ }
48
+ }
49
+
50
+ $tracker_factory = new WPDesk_Tracker_Factory();
51
+ $tracker_factory->create_tracker( basename( dirname( __FILE__ ) ) );
plugin-load.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+
6
+ /** @var WPDesk_Plugin_Info $plugin_info */
7
+
8
+ /**
9
+ * Here we KNOW:
10
+ * - that the PHP and WordPress version is in line with our expectation,
11
+ * - internal PHP modules and settings are correctly set,
12
+ * - what other plugins will be loaded but we don't know the version yet.
13
+ *
14
+ * We DON'T KNOW:
15
+ * - what versions of plugins will be loaded (ie. WooCommerce 2.6 or 3.0?)
16
+ * - autoloader is not working yet
17
+ */
18
+ if ( ! class_exists( 'WPDesk_Loader_Manager_Factory' ) ) {
19
+ require_once dirname( __FILE__ ) . '/vendor/wpdesk/wp-autoloader/src/Loader/Loader_Manager_Factory.php';
20
+ }
21
+ if ( ! class_exists( 'WPDesk_Composer_Loader' ) ) {
22
+ require_once dirname( __FILE__ ) . '/vendor/wpdesk/wp-autoloader/src/Loader/Composer/Composer_Loader.php';
23
+ }
24
+ if ( ! class_exists( 'WPDesk_Composer_Loader_Info' ) ) {
25
+ require_once dirname( __FILE__ ) . '/vendor/wpdesk/wp-autoloader/src/Loader/Composer/Composer_Loader_Info.php';
26
+ }
27
+ $loader_info = new WPDesk_Composer_Loader_Info();
28
+ $loader_info->set_autoload_file( new \SplFileInfo( realpath( dirname( __FILE__ ) . '/vendor/autoload.php' ) ) );
29
+ $loader_info->set_load_priority( $plugin_info->get_release_date()->getTimestamp() );
30
+ $loader_info->set_creation_file( new \SplFileInfo( realpath( dirname( __FILE__ ) . '/plugin-create.php' ) ) );
31
+ $loader_info->set_plugin_info($plugin_info);
32
+
33
+ $composer_loader = new WPDesk_Composer_Loader($loader_info);
34
+
35
+ $loader_manager = WPDesk_Loader_Manager_Factory::get_manager_instance();
36
+ $loader_manager->attach_loader($composer_loader);
readme.md DELETED
@@ -1,2 +0,0 @@
1
- [![pipeline status](https://gitlab.com/wpdesk/flexible-shipping/badges/master/pipeline.svg)](https://gitlab.com/wpdesk/flexible-shipping/commits/master)
2
-
 
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Flexible Shipping for WooCommerce ===
2
  Contributors: wpdesk, swoboda
3
- Donate link: https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/
4
  Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
5
  Requires at least: 4.5
6
- Tested up to: 4.9.8
7
- Stable tag: 2.1.10
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -20,7 +20,7 @@ Flexible Shipping is the most advanced shipping plugin for WooCommerce stores al
20
  [youtube https://www.youtube.com/watch?v=C7dQ2jQ-iVc]
21
 
22
  > **Upgrade to Flexible Shipping PRO**<br />
23
- > Get priority e-mail support and access all PRO features, upgrade to [Flexible Shipping PRO now &rarr;](https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/)
24
 
25
  = Possible Shipping Scenarios =
26
 
@@ -32,12 +32,12 @@ Flexible Shipping is the most advanced shipping plugin for WooCommerce stores al
32
  * Disable shipping method if a rule is matched in the cart (PRO)
33
  * Add a cost for order and per every product (PRO)
34
 
35
- These are just a few examples. The possibilities are probably endless ;) We described some of the in our [DIY section](https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/).
36
 
37
  = Features =
38
 
39
  * Unlimited shipping methods and cost rules
40
- * Add titles and **descriptions** to your shipping methods
41
  * Shipping cost based on cart total and/or weight
42
  * Minimum and maximum values for cart total and/or weight
43
  * Summing cost rules if they are matched - option to add costs based on cart total and weight at the same time
@@ -47,6 +47,7 @@ These are just a few examples. The possibilities are probably endless ;) We desc
47
  * Compatible with WooCommerce 2.6 Shipping Zones (see below for details)
48
  * WPML and Polylang support
49
  * CSV Import
 
50
 
51
  = PRO Features =
52
 
@@ -61,35 +62,37 @@ These are just a few examples. The possibilities are probably endless ;) We desc
61
  * Coupons support for free shipping
62
  * CSV Export
63
 
64
- [Upgrade to PRO Now &rarr;](https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/)
65
 
66
  = Locations Based Shipping Add-On =
67
 
68
  The Location Based Shipping Add-On extends Flexible Shipping for WooCommerce with additional rules based on locations. Works with both the free and PRO versions, so you can buy it separately if you don’t need the PRO features.
69
 
70
- [Buy Locations Add-On Now &rarr;](https://www.wpdesk.net/products/flexible-shipping-locations-woocommerce/)
71
 
72
  = WooCommerce Compatibility =
73
 
74
- **WooCommerce 3.4 ready!** In Flexible Shipping 2.1.2 we introduced support for WooCommerce 3.4.
75
 
76
- **Shipping Zones ready!** Flexible Shipping is compatible with WooCommerce Shipping Zones introduced in version 2.6. Read more about [WooCommerce Shipping Zones](https://www.wpdesk.net/blog/woocommerce-shipping-zones-explained/).
77
 
78
- Flexible Shipping also plays well with older versions of WooCommerce. We tested the plugin with WooCommerce 3.0.0 and up.
79
 
80
  = Docs =
81
 
82
- [View Flexible Shipping Docs](https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/)
83
 
84
  = Support Policy =
85
 
86
- We provide a limited support for the free version in the [plugin Support Forum](https://wordpress.org/support/plugin/flexible-shipping/). Please upgrade to PRO version to get priority e-mail support as well as all pro features. [Upgrade Now &rarr;](https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/)
87
 
88
  = Integrations =
89
 
 
 
90
  **United Kingdom**
91
 
92
- We created WooCommerce DPD UK integration for Flexible Shipping. [Check DPD UK for WooCommerce &rarr;](https://www.wpdesk.net/products/dpd-uk-woocommerce/)
93
 
94
  **Poland**
95
 
@@ -133,7 +136,8 @@ Key features:
133
  * shipping class based shipping cost,
134
  * WooCommerce shipping cost rules,
135
  * WooCommerce shipping plugin,
136
- * WooCommerce table rate shipping.
 
137
 
138
  Check out this WooCommerce Table Rate Shipping Plugin today!
139
 
@@ -151,11 +155,11 @@ You can also use WordPress uploader to upload plugin zip file in menu Plugins ->
151
 
152
  = How to configure the plugin? =
153
 
154
- Just check out our [Flexible Shipping Docs here](https://www.wpdesk.net/docs/flexible-shipping-pro-woocommerce-docs/).
155
 
156
  = Do you offer support? =
157
 
158
- We provide a limited support for the free version in the [plugin Support Forum](https://wordpress.org/support/plugin/flexible-shipping/). Please upgrade to PRO version to get priority e-mail support as well as all pro features. [Upgrade Now &rarr;](https://www.wpdesk.net/products/flexible-shipping-pro-woocommerce/)
159
 
160
  == Screenshots ==
161
 
@@ -171,6 +175,28 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  = 2.1.10 - 2018-10-17 =
175
  Fixed error 500 after update to 2.1.8/2.1.9 version
176
 
@@ -321,4 +347,4 @@ Fixed error 500 after update to 2.1.8 version
321
  * Added WooCommerce 2.3 compatibility
322
 
323
  = 1.0 - 2015-11-03 =
324
- * First release!
1
  === Flexible Shipping for WooCommerce ===
2
  Contributors: wpdesk, swoboda
3
+ Donate link: https://flexibleshipping.com/table-rate/
4
  Tags: table rate, table rate shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes
5
  Requires at least: 4.5
6
+ Tested up to: 5.0.0
7
+ Stable tag: 3.0.6
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
20
  [youtube https://www.youtube.com/watch?v=C7dQ2jQ-iVc]
21
 
22
  > **Upgrade to Flexible Shipping PRO**<br />
23
+ > Get priority e-mail support and access all PRO features, upgrade to [Flexible Shipping PRO now &rarr;](https://flexibleshipping.com/table-rate/)
24
 
25
  = Possible Shipping Scenarios =
26
 
32
  * Disable shipping method if a rule is matched in the cart (PRO)
33
  * Add a cost for order and per every product (PRO)
34
 
35
+ These are just a few examples. The possibilities are probably endless ;) We described some of the in our [DIY section](https://docs.flexibleshipping.com/category/24-ready-to-use-scenarios).
36
 
37
  = Features =
38
 
39
  * Unlimited shipping methods and cost rules
40
+ * Add titles and **descriptions** to your shipping methods
41
  * Shipping cost based on cart total and/or weight
42
  * Minimum and maximum values for cart total and/or weight
43
  * Summing cost rules if they are matched - option to add costs based on cart total and weight at the same time
47
  * Compatible with WooCommerce 2.6 Shipping Zones (see below for details)
48
  * WPML and Polylang support
49
  * CSV Import
50
+ * Integrations with couriers
51
 
52
  = PRO Features =
53
 
62
  * Coupons support for free shipping
63
  * CSV Export
64
 
65
+ [Upgrade to PRO Now &rarr;](https://flexibleshipping.com/table-rate/)
66
 
67
  = Locations Based Shipping Add-On =
68
 
69
  The Location Based Shipping Add-On extends Flexible Shipping for WooCommerce with additional rules based on locations. Works with both the free and PRO versions, so you can buy it separately if you don’t need the PRO features.
70
 
71
+ [Buy Locations Add-On Now &rarr;](https://flexibleshipping.com/products/flexible-shipping-locations-woocommerce/)
72
 
73
  = WooCommerce Compatibility =
74
 
75
+ **WooCommerce 3.5 ready!** In Flexible Shipping 2.1.8 we added support for WooCommerce 3.5. WooCommerce 3.4 is supported from version 2.1.2.
76
 
77
+ **Shipping Zones ready!** Flexible Shipping is compatible with WooCommerce Shipping Zones introduced in version 2.6. Read more about [WooCommerce Shipping Zones](https://flexibleshipping.com/woocommerce-shipping-zones-explained/).
78
 
79
+ Flexible Shipping also plays well with older versions of WooCommerce. We tested the plugin with WooCommerce 3.1.0 and up.
80
 
81
  = Docs =
82
 
83
+ [View Flexible Shipping Docs](https://docs.flexibleshipping.com/collection/20-fs-table-rate)
84
 
85
  = Support Policy =
86
 
87
+ We provide a limited support for the free version in the [plugin Support Forum](https://wordpress.org/support/plugin/flexible-shipping/). Please upgrade to PRO version to get priority e-mail support as well as all pro features. [Upgrade Now &rarr;](https://flexibleshipping.com/table-rate/)
88
 
89
  = Integrations =
90
 
91
+ Flexible Shipping Connect supports UPS (Worldwide) by default.
92
+
93
  **United Kingdom**
94
 
95
+ We created WooCommerce DPD UK integration for Flexible Shipping. [Check DPD UK for WooCommerce &rarr;](https://flexibleshipping.com/products/dpd-uk-dpd-local-woocommerce/)
96
 
97
  **Poland**
98
 
136
  * shipping class based shipping cost,
137
  * WooCommerce shipping cost rules,
138
  * WooCommerce shipping plugin,
139
+ * WooCommerce table rate shipping,
140
+ * WooCommerce UPS shipping.
141
 
142
  Check out this WooCommerce Table Rate Shipping Plugin today!
143
 
155
 
156
  = How to configure the plugin? =
157
 
158
+ Just check out our [Flexible Shipping Docs here](https://docs.flexibleshipping.com/collection/20-fs-table-rate).
159
 
160
  = Do you offer support? =
161
 
162
+ We provide a limited support for the free version in the [plugin Support Forum](https://wordpress.org/support/plugin/flexible-shipping/). Please upgrade to PRO version to get priority e-mail support as well as all pro features. [Upgrade Now &rarr;](https://flexibleshipping.com/table-rate/)
163
 
164
  == Screenshots ==
165
 
175
 
176
  == Changelog ==
177
 
178
+ = 3.0.6 - 2018-11-29 =
179
+ * Added Flexible Shipping Connect to create packages and generate shipping labels automatically from WooCommerce Orders list and manually from each order
180
+ * Added integration with UPS (Worldwide). Now you can connect your shop with your UPS account. No extra software is needed. You can cover the whole shipping process directly from your UPS WooCommerce environment.
181
+
182
+ = 3.0.5 - 2018-11-28 =
183
+ * Fixed residential address and send-as field from saas
184
+ * Fixed empty services handler
185
+
186
+ = 3.0.4 - 2018-11-22 =
187
+ * Fixed live rates on non supported service should not to initialize
188
+ * Fixed negotiated rates in live rates
189
+
190
+ = 3.0.4 - 2018-11-09 =
191
+ * Fixed negotiated rates
192
+
193
+ = 3.0.3 - 2018-11-09 =
194
+ * Fixed urls
195
+
196
+ = 3.0.0 - 2018-11-07 =
197
+ * First release of flexibleshipping.com platform integration
198
+ * Fixed multiple shipments in some cases
199
+
200
  = 2.1.10 - 2018-10-17 =
201
  Fixed error 500 after update to 2.1.8/2.1.9 version
202
 
347
  * Added WooCommerce 2.3 compatibility
348
 
349
  = 1.0 - 2015-11-03 =
350
+ * First release!
templates/email/after_order_table.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shipment tracking links
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/flexible-shipping/email/after_order_table.php
6
+ *
7
+ * @author WP Desk
8
+ * @version 1.0.0
9
+ */
10
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
+ ?>
12
+ <h2><?php _e( 'Shipment', 'flexible-shipping' ); ?></h2>
13
+ <?php foreach ( $shipments as $shipment ) : ?>
14
+ <p>
15
+ <?php _e( 'Track shipment: ', 'flexible-shipping' ); ?><a target="_blank" href="<?php echo $shipment['tracking_url']; ?>"><?php echo $shipment['tracking_number']; ?></a>
16
+ </p>
17
+ <?php endforeach; ?>
templates/myaccount/after_order_table.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shipment tracking links
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/flexible-shipping/myaccount/after_order_table.php
6
+ *
7
+ * @author WP Desk
8
+ * @version 1.0.0
9
+ */
10
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
+ ?>
12
+ <h2><?php _e( 'Shipment', 'flexible-shipping' ); ?></h2>
13
+ <?php foreach ( $shipments as $shipment ) : ?>
14
+ <p>
15
+ <?php _e( 'Track shipment: ', 'flexible-shipping' ); ?><a target="_blank" href="<?php echo $shipment['tracking_url']; ?>"><?php echo $shipment['tracking_number']; ?></a>
16
+ </p>
17
+ <?php endforeach; ?>
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitd6dd9e6f4ec2b811f4b5474bce1efe33::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitad64371326e4ceae5e5911f45824f78b::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -6,35 +6,477 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'Browser' => $baseDir . '/classes/wpdesk/settings-api/modules/sysinfo/browser.php',
10
- 'S214_Sysinfo' => $baseDir . '/classes/wpdesk/settings-api/modules/sysinfo/class.s214-sysinfo.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  'WPDesk\\Mutex\\Mutex' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/Mutex.php',
 
 
 
 
12
  'WPDesk\\Mutex\\WordpressPostMutex' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressPostMutex.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  'WPDesk_Flexible_Shipping' => $baseDir . '/classes/shipping-method.php',
14
- 'WPDesk_Flexible_Shipping_Add_Shipping' => $baseDir . '/classes/order-add-shipping.php',
15
  'WPDesk_Flexible_Shipping_Admin_Notices' => $baseDir . '/classes/admin-notices.php',
16
  'WPDesk_Flexible_Shipping_Bulk_Actions' => $baseDir . '/classes/bulk-actions.php',
 
17
  'WPDesk_Flexible_Shipping_Export' => $baseDir . '/classes/flexible-shipping-export.php',
18
- 'WPDesk_Flexible_Shipping_Factory' => $baseDir . '/classes/flexible-shipping-factory.php',
19
- 'WPDesk_Flexible_Shipping_Info' => $baseDir . '/classes/shipping-method-info.php',
 
20
  'WPDesk_Flexible_Shipping_Manifest' => $baseDir . '/classes/manifest/class-manifest.php',
21
  'WPDesk_Flexible_Shipping_Manifest_FS' => $baseDir . '/classes/manifest/class-manifest-fs.php',
22
  'WPDesk_Flexible_Shipping_Manifest_Interface' => $baseDir . '/classes/manifest/interface-manifest.php',
 
 
23
  'WPDesk_Flexible_Shipping_Multicurrency' => $baseDir . '/classes/multicurrency.php',
24
  'WPDesk_Flexible_Shipping_Multilingual' => $baseDir . '/classes/multilingual.php',
25
- 'WPDesk_Flexible_Shipping_Plugin' => $baseDir . '/classes/flexible-shipping-plugin.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  'WPDesk_Flexible_Shipping_Shipment' => $baseDir . '/classes/shipment/class-shipment.php',
27
  'WPDesk_Flexible_Shipping_Shipment_Ajax' => $baseDir . '/classes/shipment/ajax.php',
28
  'WPDesk_Flexible_Shipping_Shipment_CPT' => $baseDir . '/classes/shipment/cpt-shipment.php',
 
29
  'WPDesk_Flexible_Shipping_Shipment_Interface' => $baseDir . '/classes/shipment/interface-shipment.php',
 
 
 
 
 
 
 
30
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => $baseDir . '/classes/manifest/cpt-shipping-manifest.php',
 
 
 
31
  'WPDesk_Flexible_Shipping_Tracker' => $baseDir . '/classes/tracker.php',
32
- 'WPDesk_Helper_Plugin' => $baseDir . '/classes/wpdesk/class-helper.php',
33
- 'WPDesk_Plugin_1_10' => $baseDir . '/classes/wpdesk/class-plugin.php',
34
- 'WPDesk_Plugin_Factory_1_10' => $baseDir . '/classes/wpdesk/interface-plugin-factory.php',
35
- 'WPDesk_Requirement_Checker_1_10' => $baseDir . '/classes/wpdesk/class-requirement-checker.php',
36
- 'WPDesk_S214_Settings_1_10' => $baseDir . '/classes/wpdesk/settings-api/class.s214-settings.php',
37
- 'WPDesk_Settings_1_10' => $baseDir . '/classes/wpdesk/class-settings.php',
38
  'WPDesk_Tracker' => $baseDir . '/inc/wpdesk-tracker/class-wpdesk-tracker.php',
39
  'WPDesk_Tracker_Data_Provider' => $baseDir . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider.php',
40
  'WPDesk_Tracker_Data_Provider_Gateways' => $baseDir . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider-gateways.php',
@@ -63,4 +505,5 @@ return array(
63
  'WPDesk_Tracker_Sender_Exception_WpError' => $baseDir . '/inc/wpdesk-tracker/sender/Exception/class-wpdesk-tracker-sender-exception-wperror.php',
64
  'WPDesk_Tracker_Sender_Logged' => $baseDir . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-logged.php',
65
  'WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => $baseDir . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
 
66
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Browser' => $vendorDir . '/wpdesk/wp-settings/source/modules/sysinfo/browser.php',
10
+ 'Composer\\Installers\\AglInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AglInstaller.php',
11
+ 'Composer\\Installers\\AimeosInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AimeosInstaller.php',
12
+ 'Composer\\Installers\\AnnotateCmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php',
13
+ 'Composer\\Installers\\AsgardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AsgardInstaller.php',
14
+ 'Composer\\Installers\\AttogramInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/AttogramInstaller.php',
15
+ 'Composer\\Installers\\BaseInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
16
+ 'Composer\\Installers\\BitrixInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
17
+ 'Composer\\Installers\\BonefishInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
18
+ 'Composer\\Installers\\CakePHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
19
+ 'Composer\\Installers\\ChefInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
20
+ 'Composer\\Installers\\CiviCrmInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CiviCrmInstaller.php',
21
+ 'Composer\\Installers\\ClanCatsFrameworkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php',
22
+ 'Composer\\Installers\\CockpitInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
23
+ 'Composer\\Installers\\CodeIgniterInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
24
+ 'Composer\\Installers\\Concrete5Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
25
+ 'Composer\\Installers\\CraftInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
26
+ 'Composer\\Installers\\CroogoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
27
+ 'Composer\\Installers\\DecibelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
28
+ 'Composer\\Installers\\DokuWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
29
+ 'Composer\\Installers\\DolibarrInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
30
+ 'Composer\\Installers\\DrupalInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
31
+ 'Composer\\Installers\\ElggInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ElggInstaller.php',
32
+ 'Composer\\Installers\\EliasisInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
33
+ 'Composer\\Installers\\ExpressionEngineInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
34
+ 'Composer\\Installers\\EzPlatformInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
35
+ 'Composer\\Installers\\FuelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
36
+ 'Composer\\Installers\\FuelphpInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
37
+ 'Composer\\Installers\\GravInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/GravInstaller.php',
38
+ 'Composer\\Installers\\HuradInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/HuradInstaller.php',
39
+ 'Composer\\Installers\\ImageCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ImageCMSInstaller.php',
40
+ 'Composer\\Installers\\Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Installer.php',
41
+ 'Composer\\Installers\\ItopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ItopInstaller.php',
42
+ 'Composer\\Installers\\JoomlaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
43
+ 'Composer\\Installers\\KanboardInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
44
+ 'Composer\\Installers\\KirbyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
45
+ 'Composer\\Installers\\KodiCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
46
+ 'Composer\\Installers\\KohanaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
47
+ 'Composer\\Installers\\LanManagementSystemInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
48
+ 'Composer\\Installers\\LaravelInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LaravelInstaller.php',
49
+ 'Composer\\Installers\\LavaLiteInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LavaLiteInstaller.php',
50
+ 'Composer\\Installers\\LithiumInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/LithiumInstaller.php',
51
+ 'Composer\\Installers\\MODULEWorkInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
52
+ 'Composer\\Installers\\MODXEvoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
53
+ 'Composer\\Installers\\MagentoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
54
+ 'Composer\\Installers\\MajimaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MajimaInstaller.php',
55
+ 'Composer\\Installers\\MakoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
56
+ 'Composer\\Installers\\MauticInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
57
+ 'Composer\\Installers\\MayaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
58
+ 'Composer\\Installers\\MediaWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
59
+ 'Composer\\Installers\\MicroweberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
60
+ 'Composer\\Installers\\ModxInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ModxInstaller.php',
61
+ 'Composer\\Installers\\MoodleInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
62
+ 'Composer\\Installers\\OctoberInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
63
+ 'Composer\\Installers\\OntoWikiInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
64
+ 'Composer\\Installers\\OsclassInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OsclassInstaller.php',
65
+ 'Composer\\Installers\\OxidInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/OxidInstaller.php',
66
+ 'Composer\\Installers\\PPIInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PPIInstaller.php',
67
+ 'Composer\\Installers\\PhiftyInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PhiftyInstaller.php',
68
+ 'Composer\\Installers\\PhpBBInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PhpBBInstaller.php',
69
+ 'Composer\\Installers\\PimcoreInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PimcoreInstaller.php',
70
+ 'Composer\\Installers\\PiwikInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PiwikInstaller.php',
71
+ 'Composer\\Installers\\PlentymarketsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php',
72
+ 'Composer\\Installers\\Plugin' => $vendorDir . '/composer/installers/src/Composer/Installers/Plugin.php',
73
+ 'Composer\\Installers\\PortoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
74
+ 'Composer\\Installers\\PrestashopInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
75
+ 'Composer\\Installers\\PuppetInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
76
+ 'Composer\\Installers\\PxcmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/PxcmsInstaller.php',
77
+ 'Composer\\Installers\\RadPHPInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
78
+ 'Composer\\Installers\\ReIndexInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
79
+ 'Composer\\Installers\\RedaxoInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
80
+ 'Composer\\Installers\\RoundcubeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
81
+ 'Composer\\Installers\\SMFInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
82
+ 'Composer\\Installers\\ShopwareInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
83
+ 'Composer\\Installers\\SilverStripeInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
84
+ 'Composer\\Installers\\SiteDirectInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SiteDirectInstaller.php',
85
+ 'Composer\\Installers\\SyDESInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
86
+ 'Composer\\Installers\\Symfony1Installer' => $vendorDir . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
87
+ 'Composer\\Installers\\TYPO3CmsInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
88
+ 'Composer\\Installers\\TYPO3FlowInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
89
+ 'Composer\\Installers\\TheliaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
90
+ 'Composer\\Installers\\TuskInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
91
+ 'Composer\\Installers\\UserFrostingInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
92
+ 'Composer\\Installers\\VanillaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/VanillaInstaller.php',
93
+ 'Composer\\Installers\\VgmcpInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/VgmcpInstaller.php',
94
+ 'Composer\\Installers\\WHMCSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WHMCSInstaller.php',
95
+ 'Composer\\Installers\\WolfCMSInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WolfCMSInstaller.php',
96
+ 'Composer\\Installers\\WordPressInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/WordPressInstaller.php',
97
+ 'Composer\\Installers\\YawikInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/YawikInstaller.php',
98
+ 'Composer\\Installers\\ZendInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZendInstaller.php',
99
+ 'Composer\\Installers\\ZikulaInstaller' => $vendorDir . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
100
+ 'Flexible_Shipping_Plugin' => $baseDir . '/classes/class-flexible-shipping-plugin.php',
101
+ 'Money\\Calculator' => $vendorDir . '/moneyphp/money/src/Calculator.php',
102
+ 'Money\\Calculator\\BcMathCalculator' => $vendorDir . '/moneyphp/money/src/Calculator/BcMathCalculator.php',
103
+ 'Money\\Calculator\\GmpCalculator' => $vendorDir . '/moneyphp/money/src/Calculator/GmpCalculator.php',
104
+ 'Money\\Calculator\\PhpCalculator' => $vendorDir . '/moneyphp/money/src/Calculator/PhpCalculator.php',
105
+ 'Money\\Converter' => $vendorDir . '/moneyphp/money/src/Converter.php',
106
+ 'Money\\Currencies' => $vendorDir . '/moneyphp/money/src/Currencies.php',
107
+ 'Money\\Currencies\\AggregateCurrencies' => $vendorDir . '/moneyphp/money/src/Currencies/AggregateCurrencies.php',
108
+ 'Money\\Currencies\\BitcoinCurrencies' => $vendorDir . '/moneyphp/money/src/Currencies/BitcoinCurrencies.php',
109
+ 'Money\\Currencies\\CachedCurrencies' => $vendorDir . '/moneyphp/money/src/Currencies/CachedCurrencies.php',
110
+ 'Money\\Currencies\\CurrencyList' => $vendorDir . '/moneyphp/money/src/Currencies/CurrencyList.php',
111
+ 'Money\\Currencies\\ISOCurrencies' => $vendorDir . '/moneyphp/money/src/Currencies/ISOCurrencies.php',
112
+ 'Money\\Currency' => $vendorDir . '/moneyphp/money/src/Currency.php',
113
+ 'Money\\CurrencyPair' => $vendorDir . '/moneyphp/money/src/CurrencyPair.php',
114
+ 'Money\\Exception' => $vendorDir . '/moneyphp/money/src/Exception.php',
115
+ 'Money\\Exception\\FormatterException' => $vendorDir . '/moneyphp/money/src/Exception/FormatterException.php',
116
+ 'Money\\Exception\\ParserException' => $vendorDir . '/moneyphp/money/src/Exception/ParserException.php',
117
+ 'Money\\Exception\\UnknownCurrencyException' => $vendorDir . '/moneyphp/money/src/Exception/UnknownCurrencyException.php',
118
+ 'Money\\Exception\\UnresolvableCurrencyPairException' => $vendorDir . '/moneyphp/money/src/Exception/UnresolvableCurrencyPairException.php',
119
+ 'Money\\Exchange' => $vendorDir . '/moneyphp/money/src/Exchange.php',
120
+ 'Money\\Exchange\\FixedExchange' => $vendorDir . '/moneyphp/money/src/Exchange/FixedExchange.php',
121
+ 'Money\\Exchange\\IndirectExchange' => $vendorDir . '/moneyphp/money/src/Exchange/IndirectExchange.php',
122
+ 'Money\\Exchange\\ReversedCurrenciesExchange' => $vendorDir . '/moneyphp/money/src/Exchange/ReversedCurrenciesExchange.php',
123
+ 'Money\\Exchange\\SwapExchange' => $vendorDir . '/moneyphp/money/src/Exchange/SwapExchange.php',
124
+ 'Money\\Formatter\\AggregateMoneyFormatter' => $vendorDir . '/moneyphp/money/src/Formatter/AggregateMoneyFormatter.php',
125
+ 'Money\\Formatter\\BitcoinMoneyFormatter' => $vendorDir . '/moneyphp/money/src/Formatter/BitcoinMoneyFormatter.php',
126
+ 'Money\\Formatter\\DecimalMoneyFormatter' => $vendorDir . '/moneyphp/money/src/Formatter/DecimalMoneyFormatter.php',
127
+ 'Money\\Formatter\\IntlLocalizedDecimalFormatter' => $vendorDir . '/moneyphp/money/src/Formatter/IntlLocalizedDecimalFormatter.php',
128
+ 'Money\\Formatter\\IntlMoneyFormatter' => $vendorDir . '/moneyphp/money/src/Formatter/IntlMoneyFormatter.php',
129
+ 'Money\\Money' => $vendorDir . '/moneyphp/money/src/Money.php',
130
+ 'Money\\MoneyFormatter' => $vendorDir . '/moneyphp/money/src/MoneyFormatter.php',
131
+ 'Money\\MoneyParser' => $vendorDir . '/moneyphp/money/src/MoneyParser.php',
132
+ 'Money\\Number' => $vendorDir . '/moneyphp/money/src/Number.php',
133
+ 'Money\\PHPUnit\\Comparator' => $vendorDir . '/moneyphp/money/src/PHPUnit/Comparator.php',
134
+ 'Money\\Parser\\AggregateMoneyParser' => $vendorDir . '/moneyphp/money/src/Parser/AggregateMoneyParser.php',
135
+ 'Money\\Parser\\BitcoinMoneyParser' => $vendorDir . '/moneyphp/money/src/Parser/BitcoinMoneyParser.php',
136
+ 'Money\\Parser\\DecimalMoneyParser' => $vendorDir . '/moneyphp/money/src/Parser/DecimalMoneyParser.php',
137
+ 'Money\\Parser\\IntlLocalizedDecimalParser' => $vendorDir . '/moneyphp/money/src/Parser/IntlLocalizedDecimalParser.php',
138
+ 'Money\\Parser\\IntlMoneyParser' => $vendorDir . '/moneyphp/money/src/Parser/IntlMoneyParser.php',
139
+ 'Monolog\\ErrorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/ErrorHandler.php',
140
+ 'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
141
+ 'Monolog\\Formatter\\ElasticaFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
142
+ 'Monolog\\Formatter\\FlowdockFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
143
+ 'Monolog\\Formatter\\FluentdFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
144
+ 'Monolog\\Formatter\\FormatterInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
145
+ 'Monolog\\Formatter\\GelfMessageFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
146
+ 'Monolog\\Formatter\\HtmlFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
147
+ 'Monolog\\Formatter\\JsonFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php',
148
+ 'Monolog\\Formatter\\LineFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/LineFormatter.php',
149
+ 'Monolog\\Formatter\\LogglyFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php',
150
+ 'Monolog\\Formatter\\LogstashFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php',
151
+ 'Monolog\\Formatter\\MongoDBFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php',
152
+ 'Monolog\\Formatter\\NormalizerFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php',
153
+ 'Monolog\\Formatter\\ScalarFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php',
154
+ 'Monolog\\Formatter\\WildfireFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php',
155
+ 'Monolog\\Handler\\AbstractHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
156
+ 'Monolog\\Handler\\AbstractProcessingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php',
157
+ 'Monolog\\Handler\\AbstractSyslogHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php',
158
+ 'Monolog\\Handler\\AmqpHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AmqpHandler.php',
159
+ 'Monolog\\Handler\\BrowserConsoleHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php',
160
+ 'Monolog\\Handler\\BufferHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/BufferHandler.php',
161
+ 'Monolog\\Handler\\ChromePHPHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php',
162
+ 'Monolog\\Handler\\CouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
163
+ 'Monolog\\Handler\\CubeHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
164
+ 'Monolog\\Handler\\Curl\\Util' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
165
+ 'Monolog\\Handler\\DeduplicationHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
166
+ 'Monolog\\Handler\\DoctrineCouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
167
+ 'Monolog\\Handler\\DynamoDbHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
168
+ 'Monolog\\Handler\\ElasticSearchHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
169
+ 'Monolog\\Handler\\ErrorLogHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php',
170
+ 'Monolog\\Handler\\FilterHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FilterHandler.php',
171
+ 'Monolog\\Handler\\FingersCrossedHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php',
172
+ 'Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php',
173
+ 'Monolog\\Handler\\FingersCrossed\\ChannelLevelActivationStrategy' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php',
174
+ 'Monolog\\Handler\\FingersCrossed\\ErrorLevelActivationStrategy' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php',
175
+ 'Monolog\\Handler\\FirePHPHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php',
176
+ 'Monolog\\Handler\\FleepHookHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php',
177
+ 'Monolog\\Handler\\FlowdockHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php',
178
+ 'Monolog\\Handler\\GelfHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
179
+ 'Monolog\\Handler\\GroupHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
180
+ 'Monolog\\Handler\\HandlerInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
181
+ 'Monolog\\Handler\\HandlerWrapper' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
182
+ 'Monolog\\Handler\\HipChatHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
183
+ 'Monolog\\Handler\\IFTTTHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
184
+ 'Monolog\\Handler\\InsightOpsHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php',
185
+ 'Monolog\\Handler\\LogEntriesHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
186
+ 'Monolog\\Handler\\LogglyHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogglyHandler.php',
187
+ 'Monolog\\Handler\\MailHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MailHandler.php',
188
+ 'Monolog\\Handler\\MandrillHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MandrillHandler.php',
189
+ 'Monolog\\Handler\\MissingExtensionException' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php',
190
+ 'Monolog\\Handler\\MongoDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php',
191
+ 'Monolog\\Handler\\NativeMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php',
192
+ 'Monolog\\Handler\\NewRelicHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php',
193
+ 'Monolog\\Handler\\NullHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/NullHandler.php',
194
+ 'Monolog\\Handler\\PHPConsoleHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php',
195
+ 'Monolog\\Handler\\PsrHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PsrHandler.php',
196
+ 'Monolog\\Handler\\PushoverHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/PushoverHandler.php',
197
+ 'Monolog\\Handler\\RavenHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RavenHandler.php',
198
+ 'Monolog\\Handler\\RedisHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RedisHandler.php',
199
+ 'Monolog\\Handler\\RollbarHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RollbarHandler.php',
200
+ 'Monolog\\Handler\\RotatingFileHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
201
+ 'Monolog\\Handler\\SamplingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
202
+ 'Monolog\\Handler\\SlackHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
203
+ 'Monolog\\Handler\\SlackWebhookHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
204
+ 'Monolog\\Handler\\Slack\\SlackRecord' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
205
+ 'Monolog\\Handler\\SlackbotHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
206
+ 'Monolog\\Handler\\SocketHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
207
+ 'Monolog\\Handler\\StreamHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
208
+ 'Monolog\\Handler\\SwiftMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
209
+ 'Monolog\\Handler\\SyslogHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogHandler.php',
210
+ 'Monolog\\Handler\\SyslogUdpHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php',
211
+ 'Monolog\\Handler\\SyslogUdp\\UdpSocket' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php',
212
+ 'Monolog\\Handler\\TestHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/TestHandler.php',
213
+ 'Monolog\\Handler\\WhatFailureGroupHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php',
214
+ 'Monolog\\Handler\\ZendMonitorHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php',
215
+ 'Monolog\\Logger' => $vendorDir . '/monolog/monolog/src/Monolog/Logger.php',
216
+ 'Monolog\\Processor\\GitProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/GitProcessor.php',
217
+ 'Monolog\\Processor\\IntrospectionProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php',
218
+ 'Monolog\\Processor\\MemoryPeakUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
219
+ 'Monolog\\Processor\\MemoryProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
220
+ 'Monolog\\Processor\\MemoryUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
221
+ 'Monolog\\Processor\\MercurialProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php',
222
+ 'Monolog\\Processor\\ProcessIdProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
223
+ 'Monolog\\Processor\\ProcessorInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php',
224
+ 'Monolog\\Processor\\PsrLogMessageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
225
+ 'Monolog\\Processor\\TagProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
226
+ 'Monolog\\Processor\\UidProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/UidProcessor.php',
227
+ 'Monolog\\Processor\\WebProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/WebProcessor.php',
228
+ 'Monolog\\Registry' => $vendorDir . '/monolog/monolog/src/Monolog/Registry.php',
229
+ 'Monolog\\ResettableInterface' => $vendorDir . '/monolog/monolog/src/Monolog/ResettableInterface.php',
230
+ 'Monolog\\SignalHandler' => $vendorDir . '/monolog/monolog/src/Monolog/SignalHandler.php',
231
+ 'Monolog\\Utils' => $vendorDir . '/monolog/monolog/src/Monolog/Utils.php',
232
+ 'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
233
+ 'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php',
234
+ 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
235
+ 'Psr\\Log\\LoggerAwareInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareInterface.php',
236
+ 'Psr\\Log\\LoggerAwareTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareTrait.php',
237
+ 'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php',
238
+ 'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
239
+ 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
240
+ 'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
241
+ 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
242
+ 'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php',
243
+ 'Psr\\SimpleCache\\CacheException' => $vendorDir . '/psr/simple-cache/src/CacheException.php',
244
+ 'Psr\\SimpleCache\\CacheInterface' => $vendorDir . '/psr/simple-cache/src/CacheInterface.php',
245
+ 'Psr\\SimpleCache\\InvalidArgumentException' => $vendorDir . '/psr/simple-cache/src/InvalidArgumentException.php',
246
+ 'S214_License' => $vendorDir . '/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php',
247
+ 'S214_Plugin_Updater' => $vendorDir . '/wpdesk/wp-settings/source/modules/licensing/S214_Plugin_Updater.php',
248
+ 'S214_Settings' => $vendorDir . '/wpdesk/wp-settings/source/class.s214-settings.php',
249
+ 'S214_Sysinfo' => $vendorDir . '/wpdesk/wp-settings/source/modules/sysinfo/class.s214-sysinfo.php',
250
+ 'WPDesk\\Logger\\BasicLoggerFactory' => $vendorDir . '/wpdesk/wp-logs/src/BasicLoggerFactory.php',
251
+ 'WPDesk\\Logger\\LoggerFacade' => $vendorDir . '/wpdesk/wp-logs/src/LoggerFacade.php',
252
+ 'WPDesk\\Logger\\LoggerFactory' => $vendorDir . '/wpdesk/wp-logs/src/LoggerFactory.php',
253
+ 'WPDesk\\Logger\\WC\\Exception\\WCLoggerAlreadyCaptured' => $vendorDir . '/wpdesk/wp-logs/src/WC/Exception/WCLoggerAlreadyCaptured.php',
254
+ 'WPDesk\\Logger\\WC\\WooCommerceCapture' => $vendorDir . '/wpdesk/wp-logs/src/WC/WooCommerceCapture.php',
255
+ 'WPDesk\\Logger\\WC\\WooCommerceHandler' => $vendorDir . '/wpdesk/wp-logs/src/WC/WooCommerceHandler.php',
256
+ 'WPDesk\\Logger\\WC\\WooCommerceMonologPlugin' => $vendorDir . '/wpdesk/wp-logs/src/WC/WooCommerceMonologPlugin.php',
257
+ 'WPDesk\\Logger\\WPDeskLoggerFactory' => $vendorDir . '/wpdesk/wp-logs/src/WPDeskLoggerFactory.php',
258
  'WPDesk\\Mutex\\Mutex' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/Mutex.php',
259
+ 'WPDesk\\Mutex\\MutexNotFoundInStorage' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/MutexNotFoundInStorage.php',
260
+ 'WPDesk\\Mutex\\MutexStorage' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/MutexStorage.php',
261
+ 'WPDesk\\Mutex\\StaticMutexStorage' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/StaticMutexStorage.php',
262
+ 'WPDesk\\Mutex\\WordpressMySQLLockMutex' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressMySQLLockMutex.php',
263
  'WPDesk\\Mutex\\WordpressPostMutex' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressPostMutex.php',
264
+ 'WPDesk\\Mutex\\WordpressWpdb' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressWpdb.php',
265
+ 'WPDesk\\Notice\\AjaxHandler' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/AjaxHandler.php',
266
+ 'WPDesk\\Notice\\Factory' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/Factory.php',
267
+ 'WPDesk\\Notice\\Notice' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/Notice.php',
268
+ 'WPDesk\\Notice\\PermanentDismissibleNotice' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/PermanentDismissibleNotice.php',
269
+ 'WPDesk\\PluginBuilder\\BuildDirector\\LegacyBuildDirector' => $vendorDir . '/wpdesk/wp-builder/src/BuildDirector/LegacyBuildDirector.php',
270
+ 'WPDesk\\PluginBuilder\\Builder\\AbstractBuilder' => $vendorDir . '/wpdesk/wp-builder/src/Builder/AbstractBuilder.php',
271
+ 'WPDesk\\PluginBuilder\\Builder\\InfoBuilder' => $vendorDir . '/wpdesk/wp-builder/src/Builder/InfoBuilder.php',
272
+ 'WPDesk\\PluginBuilder\\Plugin\\AbstractPlugin' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php',
273
+ 'WPDesk\\PluginBuilder\\Plugin\\ActivationTracker' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/ActivationTracker.php',
274
+ 'WPDesk\\PluginBuilder\\Plugin\\Hookable' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/Hookable.php',
275
+ 'WPDesk\\PluginBuilder\\Plugin\\HookableCollection' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/HookableCollection.php',
276
+ 'WPDesk\\PluginBuilder\\Plugin\\HookableParent' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/HookableParent.php',
277
+ 'WPDesk\\PluginBuilder\\Plugin\\HookablePluginDependant' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/HookablePluginDependant.php',
278
+ 'WPDesk\\PluginBuilder\\Plugin\\PluginAccess' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/PluginAccess.php',
279
+ 'WPDesk\\PluginBuilder\\Plugin\\TemplateLoad' => $vendorDir . '/wpdesk/wp-builder/src/Plugin/TemplateLoad.php',
280
+ 'WPDesk\\PluginBuilder\\Storage\\Exception\\ClassAlreadyExists' => $vendorDir . '/wpdesk/wp-builder/src/Storage/Exception/ClassAlreadyExists.php',
281
+ 'WPDesk\\PluginBuilder\\Storage\\Exception\\ClassNotExists' => $vendorDir . '/wpdesk/wp-builder/src/Storage/Exception/ClassNotExists.php',
282
+ 'WPDesk\\PluginBuilder\\Storage\\PluginStorage' => $vendorDir . '/wpdesk/wp-builder/src/Storage/PluginStorage.php',
283
+ 'WPDesk\\PluginBuilder\\Storage\\StaticStorage' => $vendorDir . '/wpdesk/wp-builder/src/Storage/StaticStorage.php',
284
+ 'WPDesk\\PluginBuilder\\Storage\\StorageFactory' => $vendorDir . '/wpdesk/wp-builder/src/Storage/StorageFactory.php',
285
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\CachedClient' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/ApiClient/CachedClient.php',
286
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\Client' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/ApiClient/Client.php',
287
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\ClientFactory' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/ApiClient/ClientFactory.php',
288
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\ClientImplementation' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/ApiClient/ClientImplementation.php',
289
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\RequestCacheInfoResolver' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/ApiClient/RequestCacheInfoResolver.php',
290
+ 'WPDesk\\SaasPlatformClient\\Authentication\\JWTSaasToken' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Authentication/JWTSaasToken.php',
291
+ 'WPDesk\\SaasPlatformClient\\Authentication\\JWTToken' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Authentication/JWTToken.php',
292
+ 'WPDesk\\SaasPlatformClient\\Authentication\\NullToken' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Authentication/NullToken.php',
293
+ 'WPDesk\\SaasPlatformClient\\Authentication\\Token' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Authentication/Token.php',
294
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheDispatcher' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Cache/CacheDispatcher.php',
295
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheInfoResolver' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Cache/CacheInfoResolver.php',
296
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheItemCreator' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Cache/CacheItemCreator.php',
297
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheItemVerifier' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Cache/CacheItemVerifier.php',
298
+ 'WPDesk\\SaasPlatformClient\\Cache\\HowToCache' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Cache/HowToCache.php',
299
+ 'WPDesk\\SaasPlatformClient\\Cache\\WordpressCache' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Cache/WordpressCache.php',
300
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\Curl\\CurlClient' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/HttpClient/Curl/CurlClient.php',
301
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\Curl\\CurlException' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/HttpClient/Curl/CurlException.php',
302
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\HttpClient' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClient.php',
303
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\HttpClientFactory' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientFactory.php',
304
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\HttpClientResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientResponse.php',
305
+ 'WPDesk\\SaasPlatformClient\\Model\\AbstractModel' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/AbstractModel.php',
306
+ 'WPDesk\\SaasPlatformClient\\Model\\KeyInfo' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/KeyInfo.php',
307
+ 'WPDesk\\SaasPlatformClient\\Model\\Label\\Label' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Label/Label.php',
308
+ 'WPDesk\\SaasPlatformClient\\Model\\LoginData' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/LoginData.php',
309
+ 'WPDesk\\SaasPlatformClient\\Model\\Rate\\RateRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Rate/RateRequest.php',
310
+ 'WPDesk\\SaasPlatformClient\\Model\\Rate\\RateResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Rate/RateResponse.php',
311
+ 'WPDesk\\SaasPlatformClient\\Model\\Rate\\SingleRate' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Rate/SingleRate.php',
312
+ 'WPDesk\\SaasPlatformClient\\Model\\Register' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Register.php',
313
+ 'WPDesk\\SaasPlatformClient\\Model\\Reset' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Reset.php',
314
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Actor' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Actor.php',
315
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Address' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Address.php',
316
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ClientMoney' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ClientMoney.php',
317
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Package' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Package.php',
318
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Package\\Dimensions' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Package/Dimensions.php',
319
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShipmentAdminContext' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShipmentAdminContext.php',
320
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShipmentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShipmentRequest.php',
321
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShipmentResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShipmentResponse.php',
322
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShopData' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShopData.php',
323
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShopFlow' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShopFlow.php',
324
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingPlan' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/ShippingPlan.php',
325
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingService' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/ShippingService.php',
326
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingServiceSetting' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/ShippingServiceSetting.php',
327
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingServiceSettingTest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/ShippingServiceSettingTest.php',
328
+ 'WPDesk\\SaasPlatformClient\\Model\\Shop' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Shop.php',
329
+ 'WPDesk\\SaasPlatformClient\\Model\\Status' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Status.php',
330
+ 'WPDesk\\SaasPlatformClient\\Model\\Token' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/Token.php',
331
+ 'WPDesk\\SaasPlatformClient\\Model\\User' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Model/User.php',
332
+ 'WPDesk\\SaasPlatformClient\\Persistence\\ElementNotExistsException' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Persistence/ElementNotExistsException.php',
333
+ 'WPDesk\\SaasPlatformClient\\Persistence\\MemoryContainer' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Persistence/MemoryContainer.php',
334
+ 'WPDesk\\SaasPlatformClient\\Persistence\\PersistentContainer' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Persistence/PersistentContainer.php',
335
+ 'WPDesk\\SaasPlatformClient\\Persistence\\PersistentContainerFactory' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Persistence/PersistentContainerFactory.php',
336
+ 'WPDesk\\SaasPlatformClient\\Persistence\\Wordpress\\WordpressOptionsContainer' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Persistence/Wordpress/WordpressOptionsContainer.php',
337
+ 'WPDesk\\SaasPlatformClient\\Persistence\\Wordpress\\WordpressTransientContainer' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Persistence/Wordpress/WordpressTransientContainer.php',
338
+ 'WPDesk\\SaasPlatformClient\\Platform' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Platform.php',
339
+ 'WPDesk\\SaasPlatformClient\\PlatformAdminContext' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformAdminContext.php',
340
+ 'WPDesk\\SaasPlatformClient\\PlatformFactory' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformFactory.php',
341
+ 'WPDesk\\SaasPlatformClient\\PlatformFactoryOptions' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformFactoryOptions.php',
342
+ 'WPDesk\\SaasPlatformClient\\PlatformFactoryWordpressOptions' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformFactoryWordpressOptions.php',
343
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\HttpClientOptions' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformOption/HttpClientOptions.php',
344
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\PersistenceOptions' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformOption/PersistenceOptions.php',
345
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\PlatformUrlOptions' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformOption/PlatformUrlOptions.php',
346
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\SerializerOptions' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/PlatformOption/SerializerOptions.php',
347
+ 'WPDesk\\SaasPlatformClient\\Request\\AuthRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/AuthRequest.php',
348
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\ConnectKeyInfoRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/ConnectKeyInfoRequest.php',
349
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\ConnectKeyResetRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/ConnectKeyResetRequest.php',
350
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\RegisterRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/RegisterRequest.php',
351
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\TokenRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/TokenRequest.php',
352
+ 'WPDesk\\SaasPlatformClient\\Request\\BasicRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/BasicRequest.php',
353
+ 'WPDesk\\SaasPlatformClient\\Request\\Cancel\\PostCancelRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Cancel/PostCancelRequest.php',
354
+ 'WPDesk\\SaasPlatformClient\\Request\\Fields\\GetFieldsRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Fields/GetFieldsRequest.php',
355
+ 'WPDesk\\SaasPlatformClient\\Request\\Label\\PostLabelRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Label/PostLabelRequest.php',
356
+ 'WPDesk\\SaasPlatformClient\\Request\\Rate\\PostRateRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Rate/PostRateRequest.php',
357
+ 'WPDesk\\SaasPlatformClient\\Request\\Request' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Request.php',
358
+ 'WPDesk\\SaasPlatformClient\\Request\\Shipment\\GetUserListShipmentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/GetUserListShipmentRequest.php',
359
+ 'WPDesk\\SaasPlatformClient\\Request\\Shipment\\PostShipmentRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/PostShipmentRequest.php',
360
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingPlan\\PutShippingPlanRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingPlan/PutShippingPlanRequest.php',
361
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\GetSettingsRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/GetSettingsRequest.php',
362
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\PostSettingsRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/PostSettingsRequest.php',
363
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\PutSettingsRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/PutSettingsRequest.php',
364
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\Test\\GetSettingsTestRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/Test/GetSettingsTestRequest.php',
365
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServices\\GetListRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServices/GetListRequest.php',
366
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServices\\GetServiceRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServices/GetServiceRequest.php',
367
+ 'WPDesk\\SaasPlatformClient\\Request\\Status\\GetStatusRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Status/GetStatusRequest.php',
368
+ 'WPDesk\\SaasPlatformClient\\Request\\Traits\\SettingsItemRequestHelper' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Traits/SettingsItemRequestHelper.php',
369
+ 'WPDesk\\SaasPlatformClient\\Request\\Users\\GetUserRequest' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Request/Users/GetUserRequest.php',
370
+ 'WPDesk\\SaasPlatformClient\\Response\\ApiResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ApiResponse.php',
371
+ 'WPDesk\\SaasPlatformClient\\Response\\AuthApiResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/AuthApiResponse.php',
372
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyInfoResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyInfoResponse.php',
373
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyResetResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyResetResponse.php',
374
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\RegisterResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/RegisterResponse.php',
375
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\TokenResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/TokenResponse.php',
376
+ 'WPDesk\\SaasPlatformClient\\Response\\Cancel\\PostCancelResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Cancel/PostCancelResponse.php',
377
+ 'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyMessageFromResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyMessageFromResponse.php',
378
+ 'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyStatusFromResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyStatusFromResponse.php',
379
+ 'WPDesk\\SaasPlatformClient\\Response\\Exception\\TriedExtractDataFromErrorResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Exception/TriedExtractDataFromErrorResponse.php',
380
+ 'WPDesk\\SaasPlatformClient\\Response\\Fields\\GetFieldsResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Fields/GetFieldsResponse.php',
381
+ 'WPDesk\\SaasPlatformClient\\Response\\Label\\PostLabelResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Label/PostLabelResponse.php',
382
+ 'WPDesk\\SaasPlatformClient\\Response\\Maintenance\\MaintenanceResponseContext' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Maintenance/MaintenanceResponseContext.php',
383
+ 'WPDesk\\SaasPlatformClient\\Response\\ProtectedResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ProtectedResponse.php',
384
+ 'WPDesk\\SaasPlatformClient\\Response\\Rate\\PostRateResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Rate/PostRateResponse.php',
385
+ 'WPDesk\\SaasPlatformClient\\Response\\RawResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php',
386
+ 'WPDesk\\SaasPlatformClient\\Response\\Response' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Response.php',
387
+ 'WPDesk\\SaasPlatformClient\\Response\\Shipment\\GetListShipmentAdminContextResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/GetListShipmentAdminContextResponse.php',
388
+ 'WPDesk\\SaasPlatformClient\\Response\\Shipment\\PostShipmentResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/PostShipmentResponse.php',
389
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\GetSettingsResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/GetSettingsResponse.php',
390
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\Test\\GetSettingsTestResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/Test/GetSettingsTestResponse.php',
391
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServices\\GetShippingServiceResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServices/GetShippingServiceResponse.php',
392
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServices\\GetShippingServicesListResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServices/GetShippingServicesListResponse.php',
393
+ 'WPDesk\\SaasPlatformClient\\Response\\Status\\GetStatusResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Status/GetStatusResponse.php',
394
+ 'WPDesk\\SaasPlatformClient\\Response\\Traits\\ApiResponseDecorator' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Traits/ApiResponseDecorator.php',
395
+ 'WPDesk\\SaasPlatformClient\\Response\\Traits\\AuthApiResponseDecorator' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Traits/AuthApiResponseDecorator.php',
396
+ 'WPDesk\\SaasPlatformClient\\Response\\Traits\\PagedListImplementation' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Traits/PagedListImplementation.php',
397
+ 'WPDesk\\SaasPlatformClient\\Response\\Users\\GetUserResponse' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Response/Users/GetUserResponse.php',
398
+ 'WPDesk\\SaasPlatformClient\\Serializer\\Exception\\CannotUnserializeException' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Serializer/Exception/CannotUnserializeException.php',
399
+ 'WPDesk\\SaasPlatformClient\\Serializer\\JsonSerializer' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Serializer/JsonSerializer.php',
400
+ 'WPDesk\\SaasPlatformClient\\Serializer\\Serializer' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Serializer/Serializer.php',
401
+ 'WPDesk\\SaasPlatformClient\\Serializer\\SerializerFactory' => $vendorDir . '/wpdesk/wp-saas-platform-client/src/Serializer/SerializerFactory.php',
402
+ 'WPDesk\\View\\Renderer\\LoadTemplatePlugin' => $vendorDir . '/wpdesk/wp-view/src/Renderer/LoadTemplatePlugin.php',
403
+ 'WPDesk\\View\\Renderer\\Renderer' => $vendorDir . '/wpdesk/wp-view/src/Renderer/Renderer.php',
404
+ 'WPDesk\\View\\Renderer\\SimplePhpRenderer' => $vendorDir . '/wpdesk/wp-view/src/Renderer/SimplePhpRenderer.php',
405
+ 'WPDesk\\View\\Resolver\\ChainResolver' => $vendorDir . '/wpdesk/wp-view/src/Resolver/ChainResolver.php',
406
+ 'WPDesk\\View\\Resolver\\DirResolver' => $vendorDir . '/wpdesk/wp-view/src/Resolver/DirResolver.php',
407
+ 'WPDesk\\View\\Resolver\\Exception\\CanNotResolve' => $vendorDir . '/wpdesk/wp-view/src/Resolver/Exception/CanNotResolve.php',
408
+ 'WPDesk\\View\\Resolver\\NullResolver' => $vendorDir . '/wpdesk/wp-view/src/Resolver/NullResolver.php',
409
+ 'WPDesk\\View\\Resolver\\Resolver' => $vendorDir . '/wpdesk/wp-view/src/Resolver/Resolver.php',
410
+ 'WPDesk\\View\\Resolver\\WPThemeResolver' => $vendorDir . '/wpdesk/wp-view/src/Resolver/WPThemeResolver.php',
411
  'WPDesk_Flexible_Shipping' => $baseDir . '/classes/shipping-method.php',
412
+ 'WPDesk_Flexible_Shipping_Add_Shipping' => $baseDir . '/classes/class-order-add-shipping.php',
413
  'WPDesk_Flexible_Shipping_Admin_Notices' => $baseDir . '/classes/admin-notices.php',
414
  'WPDesk_Flexible_Shipping_Bulk_Actions' => $baseDir . '/classes/bulk-actions.php',
415
+ 'WPDesk_Flexible_Shipping_Cancel_Shipment_Exception' => $baseDir . '/classes/shipment/class-cancel-shipment-exception.php',
416
  'WPDesk_Flexible_Shipping_Export' => $baseDir . '/classes/flexible-shipping-export.php',
417
+ 'WPDesk_Flexible_Shipping_Get_Label_Exception' => $baseDir . '/classes/shipment/class-get-label-exception.php',
418
+ 'WPDesk_Flexible_Shipping_Label_Not_Available_Exception' => $baseDir . '/classes/shipment/class-label-not-available-exception.php',
419
+ 'WPDesk_Flexible_Shipping_Logger_Factory' => $baseDir . '/classes/logger/class-logger-factory.php',
420
  'WPDesk_Flexible_Shipping_Manifest' => $baseDir . '/classes/manifest/class-manifest.php',
421
  'WPDesk_Flexible_Shipping_Manifest_FS' => $baseDir . '/classes/manifest/class-manifest-fs.php',
422
  'WPDesk_Flexible_Shipping_Manifest_Interface' => $baseDir . '/classes/manifest/interface-manifest.php',
423
+ 'WPDesk_Flexible_Shipping_Menu' => $baseDir . '/classes/class-menu.php',
424
+ 'WPDesk_Flexible_Shipping_Money_Formatter' => $baseDir . '/classes/shipment/class-money-formatter.php',
425
  'WPDesk_Flexible_Shipping_Multicurrency' => $baseDir . '/classes/multicurrency.php',
426
  'WPDesk_Flexible_Shipping_Multilingual' => $baseDir . '/classes/multilingual.php',
427
+ 'WPDesk_Flexible_Shipping_SaaS_Add_Shipping_Handler' => $baseDir . '/classes/saas/class-saas-add-shipping-handler.php',
428
+ 'WPDesk_Flexible_Shipping_SaaS_Auth_Params' => $baseDir . '/classes/saas/class-saas-auth-params.php',
429
+ 'WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory' => $baseDir . '/classes/saas/class-saas-platform-factory.php',
430
+ 'WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception' => $baseDir . '/classes/saas/class-saas-bad-credentials-exception.php',
431
+ 'WPDesk_Flexible_Shipping_SaaS_Connection' => $baseDir . '/classes/saas/class-saas-connection.php',
432
+ 'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax' => $baseDir . '/classes/saas/class-saas-connection-status-ajax.php',
433
+ 'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field' => $baseDir . '/classes/saas/class-saas-connection-status-field.php',
434
+ 'WPDesk_Flexible_Shipping_SaaS_Country_State_Field' => $baseDir . '/classes/saas/class-saas-country-state-field.php',
435
+ 'WPDesk_Flexible_Shipping_SaaS_Custom_Services_Settings' => $baseDir . '/classes/saas/class-saas-custom-services-setting.php',
436
+ 'WPDesk_Flexible_Shipping_SaaS_Default_Value_Compute_Handler' => $baseDir . '/classes/saas/class-saas-default-value-compute-handler.php',
437
+ 'WPDesk_Flexible_Shipping_SaaS_Free_Shipping_Metadata_Handler' => $baseDir . '/classes/saas/class-saas-free-shipping-metadata-handler.php',
438
+ 'WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler' => $baseDir . '/classes/saas/class-saas-live-rates-fallback-metadata-handler.php',
439
+ 'WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler' => $baseDir . '/classes/saas/class-saas-live-rates-handler.php',
440
+ 'WPDesk_Flexible_Shipping_SaaS_Logger_Downloader' => $baseDir . '/classes/logger/class-saas-logger-downloader.php',
441
+ 'WPDesk_Flexible_Shipping_SaaS_Logger_Settings' => $baseDir . '/classes/logger/class-saas-logger-settings.php',
442
+ 'WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception' => $baseDir . '/classes/saas/class-saas-maintenance-mode-exception.php',
443
+ 'WPDesk_Flexible_Shipping_SaaS_Platform_Links' => $baseDir . '/classes/saas/class-saas-platform-links.php',
444
+ 'WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice' => $baseDir . '/classes/saas/class-saas-registration-second-notice.php',
445
+ 'WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found' => $baseDir . '/classes/saas/class-saas-service-settings-not-found-exception.php',
446
+ 'WPDesk_Flexible_Shipping_SaaS_Services_Manager' => $baseDir . '/classes/saas/class-saas-shipping-services-manager.php',
447
+ 'WPDesk_Flexible_Shipping_SaaS_Settings' => $baseDir . '/classes/saas/class-saas-settings.php',
448
+ 'WPDesk_Flexible_Shipping_SaaS_Settings_Service_Checkbox' => $baseDir . '/classes/saas/class-saas-settings-service-checkbox.php',
449
+ 'WPDesk_Flexible_Shipping_SaaS_Shipment_Auto_Create' => $baseDir . '/classes/saas/class-saas-shipment-auto-create.php',
450
+ 'WPDesk_Flexible_Shipping_SaaS_Shipment_Order_Auto_Complete' => $baseDir . '/classes/saas/class-saas-shipment-order-auto-complete.php',
451
+ 'WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Field' => $baseDir . '/classes/saas/class-saas-shipment-settings-field.php',
452
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Method_Integration_Settings' => $baseDir . '/classes/saas/class-saas-shipping-method-integration-settings.php',
453
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Service' => $baseDir . '/classes/saas/class-saas-shipping-service.php',
454
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings' => $baseDir . '/classes/saas/class-saas-shipping-service-settings.php',
455
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Services' => $baseDir . '/classes/saas/class-saas-shipping-services.php',
456
+ 'WPDesk_Flexible_Shipping_SaaS_Tracker' => $baseDir . '/classes/saas/tracker/class-saas-tracker.php',
457
+ 'WPDesk_Flexible_Shipping_SaaS_User_Registration' => $baseDir . '/classes/saas/class-saas-user-registration.php',
458
+ 'WPDesk_Flexible_Shipping_Saas_Connection_Aware' => $baseDir . '/classes/saas/interface-saas-connection-aware.php',
459
+ 'WPDesk_Flexible_Shipping_Send_Shipment_Exception' => $baseDir . '/classes/shipment/class-send-shipment-exception.php',
460
  'WPDesk_Flexible_Shipping_Shipment' => $baseDir . '/classes/shipment/class-shipment.php',
461
  'WPDesk_Flexible_Shipping_Shipment_Ajax' => $baseDir . '/classes/shipment/ajax.php',
462
  'WPDesk_Flexible_Shipping_Shipment_CPT' => $baseDir . '/classes/shipment/cpt-shipment.php',
463
+ 'WPDesk_Flexible_Shipping_Shipment_Counter' => $baseDir . '/classes/shipment/class-shipment-counter.php',
464
  'WPDesk_Flexible_Shipping_Shipment_Interface' => $baseDir . '/classes/shipment/interface-shipment.php',
465
+ 'WPDesk_Flexible_Shipping_Shipment_Plan_Exceeded_Exception' => $baseDir . '/classes/shipment/class-shipment-plan-exceeded-exception.php',
466
+ 'WPDesk_Flexible_Shipping_Shipment_Request_Fields' => $baseDir . '/classes/shipment/class-shipment-request-fields.php',
467
+ 'WPDesk_Flexible_Shipping_Shipment_Saas' => $baseDir . '/classes/shipment/saas/class-shipment-saas.php',
468
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Ajax' => $baseDir . '/classes/shipment/saas/class-shipment-saas-ajax.php',
469
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter' => $baseDir . '/classes/shipment/saas/class-shipment-saas-message-formatter.php',
470
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox' => $baseDir . '/classes/shipment/saas/class-shipment-saas-metabox.php',
471
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Send' => $baseDir . '/classes/shipment/saas/class-shipment-saas-send.php',
472
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => $baseDir . '/classes/manifest/cpt-shipping-manifest.php',
473
+ 'WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor' => $baseDir . '/classes/class-shipping-zone-data-extractor.php',
474
+ 'WPDesk_Flexible_Shipping_Shorcode_Unit_Dimension' => $baseDir . '/classes/class-shortcode-unit-dimension.php',
475
+ 'WPDesk_Flexible_Shipping_Shorcode_Unit_Weight' => $baseDir . '/classes/class-shortcode-unit-weight.php',
476
  'WPDesk_Flexible_Shipping_Tracker' => $baseDir . '/classes/tracker.php',
477
+ 'WPDesk_Flexible_Shipping_UK_States' => $baseDir . '/classes/class-uk-states.php',
478
+ 'WPDesk_Flexible_Shipping_WooCommerce_Context_Logger' => $baseDir . '/classes/logger/class-woocommerce-context-logger.php',
479
+ 'WPDesk_S214_Settings' => $vendorDir . '/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php',
 
 
 
480
  'WPDesk_Tracker' => $baseDir . '/inc/wpdesk-tracker/class-wpdesk-tracker.php',
481
  'WPDesk_Tracker_Data_Provider' => $baseDir . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider.php',
482
  'WPDesk_Tracker_Data_Provider_Gateways' => $baseDir . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider-gateways.php',
505
  'WPDesk_Tracker_Sender_Exception_WpError' => $baseDir . '/inc/wpdesk-tracker/sender/Exception/class-wpdesk-tracker-sender-exception-wperror.php',
506
  'WPDesk_Tracker_Sender_Logged' => $baseDir . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-logged.php',
507
  'WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => $baseDir . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
508
+ 'WPDesk_WP_Settings' => $vendorDir . '/wpdesk/wp-settings/source/class.wpdesk-wp-settings.php',
509
  );
vendor/composer/autoload_files.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_files.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ '46ae4ad8c3479aabff48f598a0e4b93f' => $vendorDir . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
10
+ 'cb883ac9840733a88fe8e977664ea0ea' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/functions.php',
11
+ );
vendor/composer/autoload_psr4.php CHANGED
@@ -6,5 +6,15 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
 
 
9
  'WPDesk\\Mutex\\' => array($vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex'),
 
 
 
 
 
 
10
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'WPDesk\\View\\' => array($vendorDir . '/wpdesk/wp-view/src'),
10
+ 'WPDesk\\SaasPlatformClient\\' => array($vendorDir . '/wpdesk/wp-saas-platform-client/src'),
11
+ 'WPDesk\\PluginBuilder\\' => array($vendorDir . '/wpdesk/wp-builder/src'),
12
+ 'WPDesk\\Notice\\' => array($vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice'),
13
  'WPDesk\\Mutex\\' => array($vendorDir . '/wpdesk/wp-mutex/src/WPDesk/Mutex'),
14
+ 'WPDesk\\Logger\\' => array($vendorDir . '/wpdesk/wp-logs/src'),
15
+ 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
16
+ 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
17
+ 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
18
+ 'Money\\' => array($vendorDir . '/moneyphp/money/src'),
19
+ 'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
20
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitd6dd9e6f4ec2b811f4b5474bce1efe33
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitd6dd9e6f4ec2b811f4b5474bce1efe33
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitd6dd9e6f4ec2b811f4b5474bce1efe33', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitd6dd9e6f4ec2b811f4b5474bce1efe33', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitd6dd9e6f4ec2b811f4b5474bce1efe33::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -47,6 +47,24 @@ class ComposerAutoloaderInitd6dd9e6f4ec2b811f4b5474bce1efe33
47
 
48
  $loader->register(true);
49
 
 
 
 
 
 
 
 
 
 
50
  return $loader;
51
  }
52
  }
 
 
 
 
 
 
 
 
 
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitad64371326e4ceae5e5911f45824f78b
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitad64371326e4ceae5e5911f45824f78b', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitad64371326e4ceae5e5911f45824f78b', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitad64371326e4ceae5e5911f45824f78b::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
47
 
48
  $loader->register(true);
49
 
50
+ if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInitad64371326e4ceae5e5911f45824f78b::$files;
52
+ } else {
53
+ $includeFiles = require __DIR__ . '/autoload_files.php';
54
+ }
55
+ foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequiread64371326e4ceae5e5911f45824f78b($fileIdentifier, $file);
57
+ }
58
+
59
  return $loader;
60
  }
61
  }
62
+
63
+ function composerRequiread64371326e4ceae5e5911f45824f78b($fileIdentifier, $file)
64
+ {
65
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
+ require $file;
67
+
68
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
69
+ }
70
+ }
vendor/composer/autoload_static.php CHANGED
@@ -4,52 +4,558 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitd6dd9e6f4ec2b811f4b5474bce1efe33
8
  {
 
 
 
 
 
9
  public static $prefixLengthsPsr4 = array (
10
  'W' =>
11
  array (
 
 
 
 
12
  'WPDesk\\Mutex\\' => 13,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ),
14
  );
15
 
16
  public static $prefixDirsPsr4 = array (
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  'WPDesk\\Mutex\\' =>
18
  array (
19
  0 => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex',
20
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  );
22
 
23
  public static $classMap = array (
24
- 'Browser' => __DIR__ . '/../..' . '/classes/wpdesk/settings-api/modules/sysinfo/browser.php',
25
- 'S214_Sysinfo' => __DIR__ . '/../..' . '/classes/wpdesk/settings-api/modules/sysinfo/class.s214-sysinfo.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  'WPDesk\\Mutex\\Mutex' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/Mutex.php',
 
 
 
 
27
  'WPDesk\\Mutex\\WordpressPostMutex' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressPostMutex.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  'WPDesk_Flexible_Shipping' => __DIR__ . '/../..' . '/classes/shipping-method.php',
29
- 'WPDesk_Flexible_Shipping_Add_Shipping' => __DIR__ . '/../..' . '/classes/order-add-shipping.php',
30
  'WPDesk_Flexible_Shipping_Admin_Notices' => __DIR__ . '/../..' . '/classes/admin-notices.php',
31
  'WPDesk_Flexible_Shipping_Bulk_Actions' => __DIR__ . '/../..' . '/classes/bulk-actions.php',
 
32
  'WPDesk_Flexible_Shipping_Export' => __DIR__ . '/../..' . '/classes/flexible-shipping-export.php',
33
- 'WPDesk_Flexible_Shipping_Factory' => __DIR__ . '/../..' . '/classes/flexible-shipping-factory.php',
34
- 'WPDesk_Flexible_Shipping_Info' => __DIR__ . '/../..' . '/classes/shipping-method-info.php',
 
35
  'WPDesk_Flexible_Shipping_Manifest' => __DIR__ . '/../..' . '/classes/manifest/class-manifest.php',
36
  'WPDesk_Flexible_Shipping_Manifest_FS' => __DIR__ . '/../..' . '/classes/manifest/class-manifest-fs.php',
37
  'WPDesk_Flexible_Shipping_Manifest_Interface' => __DIR__ . '/../..' . '/classes/manifest/interface-manifest.php',
 
 
38
  'WPDesk_Flexible_Shipping_Multicurrency' => __DIR__ . '/../..' . '/classes/multicurrency.php',
39
  'WPDesk_Flexible_Shipping_Multilingual' => __DIR__ . '/../..' . '/classes/multilingual.php',
40
- 'WPDesk_Flexible_Shipping_Plugin' => __DIR__ . '/../..' . '/classes/flexible-shipping-plugin.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  'WPDesk_Flexible_Shipping_Shipment' => __DIR__ . '/../..' . '/classes/shipment/class-shipment.php',
42
  'WPDesk_Flexible_Shipping_Shipment_Ajax' => __DIR__ . '/../..' . '/classes/shipment/ajax.php',
43
  'WPDesk_Flexible_Shipping_Shipment_CPT' => __DIR__ . '/../..' . '/classes/shipment/cpt-shipment.php',
 
44
  'WPDesk_Flexible_Shipping_Shipment_Interface' => __DIR__ . '/../..' . '/classes/shipment/interface-shipment.php',
 
 
 
 
 
 
 
45
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => __DIR__ . '/../..' . '/classes/manifest/cpt-shipping-manifest.php',
 
 
 
46
  'WPDesk_Flexible_Shipping_Tracker' => __DIR__ . '/../..' . '/classes/tracker.php',
47
- 'WPDesk_Helper_Plugin' => __DIR__ . '/../..' . '/classes/wpdesk/class-helper.php',
48
- 'WPDesk_Plugin_1_10' => __DIR__ . '/../..' . '/classes/wpdesk/class-plugin.php',
49
- 'WPDesk_Plugin_Factory_1_10' => __DIR__ . '/../..' . '/classes/wpdesk/interface-plugin-factory.php',
50
- 'WPDesk_Requirement_Checker_1_10' => __DIR__ . '/../..' . '/classes/wpdesk/class-requirement-checker.php',
51
- 'WPDesk_S214_Settings_1_10' => __DIR__ . '/../..' . '/classes/wpdesk/settings-api/class.s214-settings.php',
52
- 'WPDesk_Settings_1_10' => __DIR__ . '/../..' . '/classes/wpdesk/class-settings.php',
53
  'WPDesk_Tracker' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/class-wpdesk-tracker.php',
54
  'WPDesk_Tracker_Data_Provider' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider.php',
55
  'WPDesk_Tracker_Data_Provider_Gateways' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider-gateways.php',
@@ -78,14 +584,15 @@ class ComposerStaticInitd6dd9e6f4ec2b811f4b5474bce1efe33
78
  'WPDesk_Tracker_Sender_Exception_WpError' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/sender/Exception/class-wpdesk-tracker-sender-exception-wperror.php',
79
  'WPDesk_Tracker_Sender_Logged' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-logged.php',
80
  'WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
 
81
  );
82
 
83
  public static function getInitializer(ClassLoader $loader)
84
  {
85
  return \Closure::bind(function () use ($loader) {
86
- $loader->prefixLengthsPsr4 = ComposerStaticInitd6dd9e6f4ec2b811f4b5474bce1efe33::$prefixLengthsPsr4;
87
- $loader->prefixDirsPsr4 = ComposerStaticInitd6dd9e6f4ec2b811f4b5474bce1efe33::$prefixDirsPsr4;
88
- $loader->classMap = ComposerStaticInitd6dd9e6f4ec2b811f4b5474bce1efe33::$classMap;
89
 
90
  }, null, ClassLoader::class);
91
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitad64371326e4ceae5e5911f45824f78b
8
  {
9
+ public static $files = array (
10
+ '46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
11
+ 'cb883ac9840733a88fe8e977664ea0ea' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/functions.php',
12
+ );
13
+
14
  public static $prefixLengthsPsr4 = array (
15
  'W' =>
16
  array (
17
+ 'WPDesk\\View\\' => 12,
18
+ 'WPDesk\\SaasPlatformClient\\' => 26,
19
+ 'WPDesk\\PluginBuilder\\' => 21,
20
+ 'WPDesk\\Notice\\' => 14,
21
  'WPDesk\\Mutex\\' => 13,
22
+ 'WPDesk\\Logger\\' => 14,
23
+ ),
24
+ 'P' =>
25
+ array (
26
+ 'Psr\\SimpleCache\\' => 16,
27
+ 'Psr\\Log\\' => 8,
28
+ ),
29
+ 'M' =>
30
+ array (
31
+ 'Monolog\\' => 8,
32
+ 'Money\\' => 6,
33
+ ),
34
+ 'C' =>
35
+ array (
36
+ 'Composer\\Installers\\' => 20,
37
  ),
38
  );
39
 
40
  public static $prefixDirsPsr4 = array (
41
+ 'WPDesk\\View\\' =>
42
+ array (
43
+ 0 => __DIR__ . '/..' . '/wpdesk/wp-view/src',
44
+ ),
45
+ 'WPDesk\\SaasPlatformClient\\' =>
46
+ array (
47
+ 0 => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src',
48
+ ),
49
+ 'WPDesk\\PluginBuilder\\' =>
50
+ array (
51
+ 0 => __DIR__ . '/..' . '/wpdesk/wp-builder/src',
52
+ ),
53
+ 'WPDesk\\Notice\\' =>
54
+ array (
55
+ 0 => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice',
56
+ ),
57
  'WPDesk\\Mutex\\' =>
58
  array (
59
  0 => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex',
60
  ),
61
+ 'WPDesk\\Logger\\' =>
62
+ array (
63
+ 0 => __DIR__ . '/..' . '/wpdesk/wp-logs/src',
64
+ ),
65
+ 'Psr\\SimpleCache\\' =>
66
+ array (
67
+ 0 => __DIR__ . '/..' . '/psr/simple-cache/src',
68
+ ),
69
+ 'Psr\\Log\\' =>
70
+ array (
71
+ 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
72
+ ),
73
+ 'Monolog\\' =>
74
+ array (
75
+ 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
76
+ ),
77
+ 'Money\\' =>
78
+ array (
79
+ 0 => __DIR__ . '/..' . '/moneyphp/money/src',
80
+ ),
81
+ 'Composer\\Installers\\' =>
82
+ array (
83
+ 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
84
+ ),
85
  );
86
 
87
  public static $classMap = array (
88
+ 'Browser' => __DIR__ . '/..' . '/wpdesk/wp-settings/source/modules/sysinfo/browser.php',
89
+ 'Composer\\Installers\\AglInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AglInstaller.php',
90
+ 'Composer\\Installers\\AimeosInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AimeosInstaller.php',
91
+ 'Composer\\Installers\\AnnotateCmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php',
92
+ 'Composer\\Installers\\AsgardInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AsgardInstaller.php',
93
+ 'Composer\\Installers\\AttogramInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/AttogramInstaller.php',
94
+ 'Composer\\Installers\\BaseInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BaseInstaller.php',
95
+ 'Composer\\Installers\\BitrixInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BitrixInstaller.php',
96
+ 'Composer\\Installers\\BonefishInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/BonefishInstaller.php',
97
+ 'Composer\\Installers\\CakePHPInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CakePHPInstaller.php',
98
+ 'Composer\\Installers\\ChefInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ChefInstaller.php',
99
+ 'Composer\\Installers\\CiviCrmInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CiviCrmInstaller.php',
100
+ 'Composer\\Installers\\ClanCatsFrameworkInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php',
101
+ 'Composer\\Installers\\CockpitInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CockpitInstaller.php',
102
+ 'Composer\\Installers\\CodeIgniterInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php',
103
+ 'Composer\\Installers\\Concrete5Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Concrete5Installer.php',
104
+ 'Composer\\Installers\\CraftInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CraftInstaller.php',
105
+ 'Composer\\Installers\\CroogoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/CroogoInstaller.php',
106
+ 'Composer\\Installers\\DecibelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DecibelInstaller.php',
107
+ 'Composer\\Installers\\DokuWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DokuWikiInstaller.php',
108
+ 'Composer\\Installers\\DolibarrInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DolibarrInstaller.php',
109
+ 'Composer\\Installers\\DrupalInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/DrupalInstaller.php',
110
+ 'Composer\\Installers\\ElggInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ElggInstaller.php',
111
+ 'Composer\\Installers\\EliasisInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EliasisInstaller.php',
112
+ 'Composer\\Installers\\ExpressionEngineInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php',
113
+ 'Composer\\Installers\\EzPlatformInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/EzPlatformInstaller.php',
114
+ 'Composer\\Installers\\FuelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelInstaller.php',
115
+ 'Composer\\Installers\\FuelphpInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/FuelphpInstaller.php',
116
+ 'Composer\\Installers\\GravInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/GravInstaller.php',
117
+ 'Composer\\Installers\\HuradInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/HuradInstaller.php',
118
+ 'Composer\\Installers\\ImageCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ImageCMSInstaller.php',
119
+ 'Composer\\Installers\\Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Installer.php',
120
+ 'Composer\\Installers\\ItopInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ItopInstaller.php',
121
+ 'Composer\\Installers\\JoomlaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/JoomlaInstaller.php',
122
+ 'Composer\\Installers\\KanboardInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KanboardInstaller.php',
123
+ 'Composer\\Installers\\KirbyInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KirbyInstaller.php',
124
+ 'Composer\\Installers\\KodiCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KodiCMSInstaller.php',
125
+ 'Composer\\Installers\\KohanaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/KohanaInstaller.php',
126
+ 'Composer\\Installers\\LanManagementSystemInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php',
127
+ 'Composer\\Installers\\LaravelInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LaravelInstaller.php',
128
+ 'Composer\\Installers\\LavaLiteInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LavaLiteInstaller.php',
129
+ 'Composer\\Installers\\LithiumInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/LithiumInstaller.php',
130
+ 'Composer\\Installers\\MODULEWorkInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php',
131
+ 'Composer\\Installers\\MODXEvoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MODXEvoInstaller.php',
132
+ 'Composer\\Installers\\MagentoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MagentoInstaller.php',
133
+ 'Composer\\Installers\\MajimaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MajimaInstaller.php',
134
+ 'Composer\\Installers\\MakoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MakoInstaller.php',
135
+ 'Composer\\Installers\\MauticInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MauticInstaller.php',
136
+ 'Composer\\Installers\\MayaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MayaInstaller.php',
137
+ 'Composer\\Installers\\MediaWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MediaWikiInstaller.php',
138
+ 'Composer\\Installers\\MicroweberInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MicroweberInstaller.php',
139
+ 'Composer\\Installers\\ModxInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ModxInstaller.php',
140
+ 'Composer\\Installers\\MoodleInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/MoodleInstaller.php',
141
+ 'Composer\\Installers\\OctoberInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OctoberInstaller.php',
142
+ 'Composer\\Installers\\OntoWikiInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OntoWikiInstaller.php',
143
+ 'Composer\\Installers\\OsclassInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OsclassInstaller.php',
144
+ 'Composer\\Installers\\OxidInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/OxidInstaller.php',
145
+ 'Composer\\Installers\\PPIInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PPIInstaller.php',
146
+ 'Composer\\Installers\\PhiftyInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PhiftyInstaller.php',
147
+ 'Composer\\Installers\\PhpBBInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PhpBBInstaller.php',
148
+ 'Composer\\Installers\\PimcoreInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PimcoreInstaller.php',
149
+ 'Composer\\Installers\\PiwikInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PiwikInstaller.php',
150
+ 'Composer\\Installers\\PlentymarketsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php',
151
+ 'Composer\\Installers\\Plugin' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Plugin.php',
152
+ 'Composer\\Installers\\PortoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PortoInstaller.php',
153
+ 'Composer\\Installers\\PrestashopInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PrestashopInstaller.php',
154
+ 'Composer\\Installers\\PuppetInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PuppetInstaller.php',
155
+ 'Composer\\Installers\\PxcmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/PxcmsInstaller.php',
156
+ 'Composer\\Installers\\RadPHPInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RadPHPInstaller.php',
157
+ 'Composer\\Installers\\ReIndexInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ReIndexInstaller.php',
158
+ 'Composer\\Installers\\RedaxoInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RedaxoInstaller.php',
159
+ 'Composer\\Installers\\RoundcubeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/RoundcubeInstaller.php',
160
+ 'Composer\\Installers\\SMFInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SMFInstaller.php',
161
+ 'Composer\\Installers\\ShopwareInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ShopwareInstaller.php',
162
+ 'Composer\\Installers\\SilverStripeInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SilverStripeInstaller.php',
163
+ 'Composer\\Installers\\SiteDirectInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SiteDirectInstaller.php',
164
+ 'Composer\\Installers\\SyDESInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/SyDESInstaller.php',
165
+ 'Composer\\Installers\\Symfony1Installer' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/Symfony1Installer.php',
166
+ 'Composer\\Installers\\TYPO3CmsInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php',
167
+ 'Composer\\Installers\\TYPO3FlowInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php',
168
+ 'Composer\\Installers\\TheliaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TheliaInstaller.php',
169
+ 'Composer\\Installers\\TuskInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/TuskInstaller.php',
170
+ 'Composer\\Installers\\UserFrostingInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/UserFrostingInstaller.php',
171
+ 'Composer\\Installers\\VanillaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/VanillaInstaller.php',
172
+ 'Composer\\Installers\\VgmcpInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/VgmcpInstaller.php',
173
+ 'Composer\\Installers\\WHMCSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WHMCSInstaller.php',
174
+ 'Composer\\Installers\\WolfCMSInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WolfCMSInstaller.php',
175
+ 'Composer\\Installers\\WordPressInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/WordPressInstaller.php',
176
+ 'Composer\\Installers\\YawikInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/YawikInstaller.php',
177
+ 'Composer\\Installers\\ZendInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZendInstaller.php',
178
+ 'Composer\\Installers\\ZikulaInstaller' => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers/ZikulaInstaller.php',
179
+ 'Flexible_Shipping_Plugin' => __DIR__ . '/../..' . '/classes/class-flexible-shipping-plugin.php',
180
+ 'Money\\Calculator' => __DIR__ . '/..' . '/moneyphp/money/src/Calculator.php',
181
+ 'Money\\Calculator\\BcMathCalculator' => __DIR__ . '/..' . '/moneyphp/money/src/Calculator/BcMathCalculator.php',
182
+ 'Money\\Calculator\\GmpCalculator' => __DIR__ . '/..' . '/moneyphp/money/src/Calculator/GmpCalculator.php',
183
+ 'Money\\Calculator\\PhpCalculator' => __DIR__ . '/..' . '/moneyphp/money/src/Calculator/PhpCalculator.php',
184
+ 'Money\\Converter' => __DIR__ . '/..' . '/moneyphp/money/src/Converter.php',
185
+ 'Money\\Currencies' => __DIR__ . '/..' . '/moneyphp/money/src/Currencies.php',
186
+ 'Money\\Currencies\\AggregateCurrencies' => __DIR__ . '/..' . '/moneyphp/money/src/Currencies/AggregateCurrencies.php',
187
+ 'Money\\Currencies\\BitcoinCurrencies' => __DIR__ . '/..' . '/moneyphp/money/src/Currencies/BitcoinCurrencies.php',
188
+ 'Money\\Currencies\\CachedCurrencies' => __DIR__ . '/..' . '/moneyphp/money/src/Currencies/CachedCurrencies.php',
189
+ 'Money\\Currencies\\CurrencyList' => __DIR__ . '/..' . '/moneyphp/money/src/Currencies/CurrencyList.php',
190
+ 'Money\\Currencies\\ISOCurrencies' => __DIR__ . '/..' . '/moneyphp/money/src/Currencies/ISOCurrencies.php',
191
+ 'Money\\Currency' => __DIR__ . '/..' . '/moneyphp/money/src/Currency.php',
192
+ 'Money\\CurrencyPair' => __DIR__ . '/..' . '/moneyphp/money/src/CurrencyPair.php',
193
+ 'Money\\Exception' => __DIR__ . '/..' . '/moneyphp/money/src/Exception.php',
194
+ 'Money\\Exception\\FormatterException' => __DIR__ . '/..' . '/moneyphp/money/src/Exception/FormatterException.php',
195
+ 'Money\\Exception\\ParserException' => __DIR__ . '/..' . '/moneyphp/money/src/Exception/ParserException.php',
196
+ 'Money\\Exception\\UnknownCurrencyException' => __DIR__ . '/..' . '/moneyphp/money/src/Exception/UnknownCurrencyException.php',
197
+ 'Money\\Exception\\UnresolvableCurrencyPairException' => __DIR__ . '/..' . '/moneyphp/money/src/Exception/UnresolvableCurrencyPairException.php',
198
+ 'Money\\Exchange' => __DIR__ . '/..' . '/moneyphp/money/src/Exchange.php',
199
+ 'Money\\Exchange\\FixedExchange' => __DIR__ . '/..' . '/moneyphp/money/src/Exchange/FixedExchange.php',
200
+ 'Money\\Exchange\\IndirectExchange' => __DIR__ . '/..' . '/moneyphp/money/src/Exchange/IndirectExchange.php',
201
+ 'Money\\Exchange\\ReversedCurrenciesExchange' => __DIR__ . '/..' . '/moneyphp/money/src/Exchange/ReversedCurrenciesExchange.php',
202
+ 'Money\\Exchange\\SwapExchange' => __DIR__ . '/..' . '/moneyphp/money/src/Exchange/SwapExchange.php',
203
+ 'Money\\Formatter\\AggregateMoneyFormatter' => __DIR__ . '/..' . '/moneyphp/money/src/Formatter/AggregateMoneyFormatter.php',
204
+ 'Money\\Formatter\\BitcoinMoneyFormatter' => __DIR__ . '/..' . '/moneyphp/money/src/Formatter/BitcoinMoneyFormatter.php',
205
+ 'Money\\Formatter\\DecimalMoneyFormatter' => __DIR__ . '/..' . '/moneyphp/money/src/Formatter/DecimalMoneyFormatter.php',
206
+ 'Money\\Formatter\\IntlLocalizedDecimalFormatter' => __DIR__ . '/..' . '/moneyphp/money/src/Formatter/IntlLocalizedDecimalFormatter.php',
207
+ 'Money\\Formatter\\IntlMoneyFormatter' => __DIR__ . '/..' . '/moneyphp/money/src/Formatter/IntlMoneyFormatter.php',
208
+ 'Money\\Money' => __DIR__ . '/..' . '/moneyphp/money/src/Money.php',
209
+ 'Money\\MoneyFormatter' => __DIR__ . '/..' . '/moneyphp/money/src/MoneyFormatter.php',
210
+ 'Money\\MoneyParser' => __DIR__ . '/..' . '/moneyphp/money/src/MoneyParser.php',
211
+ 'Money\\Number' => __DIR__ . '/..' . '/moneyphp/money/src/Number.php',
212
+ 'Money\\PHPUnit\\Comparator' => __DIR__ . '/..' . '/moneyphp/money/src/PHPUnit/Comparator.php',
213
+ 'Money\\Parser\\AggregateMoneyParser' => __DIR__ . '/..' . '/moneyphp/money/src/Parser/AggregateMoneyParser.php',
214
+ 'Money\\Parser\\BitcoinMoneyParser' => __DIR__ . '/..' . '/moneyphp/money/src/Parser/BitcoinMoneyParser.php',
215
+ 'Money\\Parser\\DecimalMoneyParser' => __DIR__ . '/..' . '/moneyphp/money/src/Parser/DecimalMoneyParser.php',
216
+ 'Money\\Parser\\IntlLocalizedDecimalParser' => __DIR__ . '/..' . '/moneyphp/money/src/Parser/IntlLocalizedDecimalParser.php',
217
+ 'Money\\Parser\\IntlMoneyParser' => __DIR__ . '/..' . '/moneyphp/money/src/Parser/IntlMoneyParser.php',
218
+ 'Monolog\\ErrorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ErrorHandler.php',
219
+ 'Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
220
+ 'Monolog\\Formatter\\ElasticaFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
221
+ 'Monolog\\Formatter\\FlowdockFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
222
+ 'Monolog\\Formatter\\FluentdFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
223
+ 'Monolog\\Formatter\\FormatterInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
224
+ 'Monolog\\Formatter\\GelfMessageFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
225
+ 'Monolog\\Formatter\\HtmlFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
226
+ 'Monolog\\Formatter\\JsonFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php',
227
+ 'Monolog\\Formatter\\LineFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LineFormatter.php',
228
+ 'Monolog\\Formatter\\LogglyFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php',
229
+ 'Monolog\\Formatter\\LogstashFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php',
230
+ 'Monolog\\Formatter\\MongoDBFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php',
231
+ 'Monolog\\Formatter\\NormalizerFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php',
232
+ 'Monolog\\Formatter\\ScalarFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php',
233
+ 'Monolog\\Formatter\\WildfireFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php',
234
+ 'Monolog\\Handler\\AbstractHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
235
+ 'Monolog\\Handler\\AbstractProcessingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php',
236
+ 'Monolog\\Handler\\AbstractSyslogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php',
237
+ 'Monolog\\Handler\\AmqpHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AmqpHandler.php',
238
+ 'Monolog\\Handler\\BrowserConsoleHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php',
239
+ 'Monolog\\Handler\\BufferHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/BufferHandler.php',
240
+ 'Monolog\\Handler\\ChromePHPHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php',
241
+ 'Monolog\\Handler\\CouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
242
+ 'Monolog\\Handler\\CubeHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
243
+ 'Monolog\\Handler\\Curl\\Util' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
244
+ 'Monolog\\Handler\\DeduplicationHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
245
+ 'Monolog\\Handler\\DoctrineCouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
246
+ 'Monolog\\Handler\\DynamoDbHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
247
+ 'Monolog\\Handler\\ElasticSearchHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
248
+ 'Monolog\\Handler\\ErrorLogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php',
249
+ 'Monolog\\Handler\\FilterHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FilterHandler.php',
250
+ 'Monolog\\Handler\\FingersCrossedHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php',
251
+ 'Monolog\\Handler\\FingersCrossed\\ActivationStrategyInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php',
252
+ 'Monolog\\Handler\\FingersCrossed\\ChannelLevelActivationStrategy' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php',
253
+ 'Monolog\\Handler\\FingersCrossed\\ErrorLevelActivationStrategy' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php',
254
+ 'Monolog\\Handler\\FirePHPHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php',
255
+ 'Monolog\\Handler\\FleepHookHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php',
256
+ 'Monolog\\Handler\\FlowdockHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php',
257
+ 'Monolog\\Handler\\GelfHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
258
+ 'Monolog\\Handler\\GroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
259
+ 'Monolog\\Handler\\HandlerInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
260
+ 'Monolog\\Handler\\HandlerWrapper' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
261
+ 'Monolog\\Handler\\HipChatHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
262
+ 'Monolog\\Handler\\IFTTTHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
263
+ 'Monolog\\Handler\\InsightOpsHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php',
264
+ 'Monolog\\Handler\\LogEntriesHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
265
+ 'Monolog\\Handler\\LogglyHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogglyHandler.php',
266
+ 'Monolog\\Handler\\MailHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MailHandler.php',
267
+ 'Monolog\\Handler\\MandrillHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MandrillHandler.php',
268
+ 'Monolog\\Handler\\MissingExtensionException' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php',
269
+ 'Monolog\\Handler\\MongoDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php',
270
+ 'Monolog\\Handler\\NativeMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php',
271
+ 'Monolog\\Handler\\NewRelicHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php',
272
+ 'Monolog\\Handler\\NullHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/NullHandler.php',
273
+ 'Monolog\\Handler\\PHPConsoleHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php',
274
+ 'Monolog\\Handler\\PsrHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PsrHandler.php',
275
+ 'Monolog\\Handler\\PushoverHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/PushoverHandler.php',
276
+ 'Monolog\\Handler\\RavenHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RavenHandler.php',
277
+ 'Monolog\\Handler\\RedisHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RedisHandler.php',
278
+ 'Monolog\\Handler\\RollbarHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RollbarHandler.php',
279
+ 'Monolog\\Handler\\RotatingFileHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
280
+ 'Monolog\\Handler\\SamplingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
281
+ 'Monolog\\Handler\\SlackHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
282
+ 'Monolog\\Handler\\SlackWebhookHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
283
+ 'Monolog\\Handler\\Slack\\SlackRecord' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
284
+ 'Monolog\\Handler\\SlackbotHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
285
+ 'Monolog\\Handler\\SocketHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
286
+ 'Monolog\\Handler\\StreamHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
287
+ 'Monolog\\Handler\\SwiftMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
288
+ 'Monolog\\Handler\\SyslogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogHandler.php',
289
+ 'Monolog\\Handler\\SyslogUdpHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php',
290
+ 'Monolog\\Handler\\SyslogUdp\\UdpSocket' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php',
291
+ 'Monolog\\Handler\\TestHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/TestHandler.php',
292
+ 'Monolog\\Handler\\WhatFailureGroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php',
293
+ 'Monolog\\Handler\\ZendMonitorHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php',
294
+ 'Monolog\\Logger' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Logger.php',
295
+ 'Monolog\\Processor\\GitProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/GitProcessor.php',
296
+ 'Monolog\\Processor\\IntrospectionProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php',
297
+ 'Monolog\\Processor\\MemoryPeakUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
298
+ 'Monolog\\Processor\\MemoryProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
299
+ 'Monolog\\Processor\\MemoryUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
300
+ 'Monolog\\Processor\\MercurialProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php',
301
+ 'Monolog\\Processor\\ProcessIdProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
302
+ 'Monolog\\Processor\\ProcessorInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php',
303
+ 'Monolog\\Processor\\PsrLogMessageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
304
+ 'Monolog\\Processor\\TagProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
305
+ 'Monolog\\Processor\\UidProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/UidProcessor.php',
306
+ 'Monolog\\Processor\\WebProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/WebProcessor.php',
307
+ 'Monolog\\Registry' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Registry.php',
308
+ 'Monolog\\ResettableInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/ResettableInterface.php',
309
+ 'Monolog\\SignalHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/SignalHandler.php',
310
+ 'Monolog\\Utils' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Utils.php',
311
+ 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
312
+ 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php',
313
+ 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php',
314
+ 'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php',
315
+ 'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php',
316
+ 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php',
317
+ 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php',
318
+ 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php',
319
+ 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
320
+ 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
321
+ 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php',
322
+ 'Psr\\SimpleCache\\CacheException' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheException.php',
323
+ 'Psr\\SimpleCache\\CacheInterface' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheInterface.php',
324
+ 'Psr\\SimpleCache\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/simple-cache/src/InvalidArgumentException.php',
325
+ 'S214_License' => __DIR__ . '/..' . '/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php',
326
+ 'S214_Plugin_Updater' => __DIR__ . '/..' . '/wpdesk/wp-settings/source/modules/licensing/S214_Plugin_Updater.php',
327
+ 'S214_Settings' => __DIR__ . '/..' . '/wpdesk/wp-settings/source/class.s214-settings.php',
328
+ 'S214_Sysinfo' => __DIR__ . '/..' . '/wpdesk/wp-settings/source/modules/sysinfo/class.s214-sysinfo.php',
329
+ 'WPDesk\\Logger\\BasicLoggerFactory' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/BasicLoggerFactory.php',
330
+ 'WPDesk\\Logger\\LoggerFacade' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/LoggerFacade.php',
331
+ 'WPDesk\\Logger\\LoggerFactory' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/LoggerFactory.php',
332
+ 'WPDesk\\Logger\\WC\\Exception\\WCLoggerAlreadyCaptured' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/WC/Exception/WCLoggerAlreadyCaptured.php',
333
+ 'WPDesk\\Logger\\WC\\WooCommerceCapture' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/WC/WooCommerceCapture.php',
334
+ 'WPDesk\\Logger\\WC\\WooCommerceHandler' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/WC/WooCommerceHandler.php',
335
+ 'WPDesk\\Logger\\WC\\WooCommerceMonologPlugin' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/WC/WooCommerceMonologPlugin.php',
336
+ 'WPDesk\\Logger\\WPDeskLoggerFactory' => __DIR__ . '/..' . '/wpdesk/wp-logs/src/WPDeskLoggerFactory.php',
337
  'WPDesk\\Mutex\\Mutex' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/Mutex.php',
338
+ 'WPDesk\\Mutex\\MutexNotFoundInStorage' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/MutexNotFoundInStorage.php',
339
+ 'WPDesk\\Mutex\\MutexStorage' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/MutexStorage.php',
340
+ 'WPDesk\\Mutex\\StaticMutexStorage' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/StaticMutexStorage.php',
341
+ 'WPDesk\\Mutex\\WordpressMySQLLockMutex' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressMySQLLockMutex.php',
342
  'WPDesk\\Mutex\\WordpressPostMutex' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressPostMutex.php',
343
+ 'WPDesk\\Mutex\\WordpressWpdb' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/Mutex/WordpressWpdb.php',
344
+ 'WPDesk\\Notice\\AjaxHandler' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/AjaxHandler.php',
345
+ 'WPDesk\\Notice\\Factory' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/Factory.php',
346
+ 'WPDesk\\Notice\\Notice' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/Notice.php',
347
+ 'WPDesk\\Notice\\PermanentDismissibleNotice' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/PermanentDismissibleNotice.php',
348
+ 'WPDesk\\PluginBuilder\\BuildDirector\\LegacyBuildDirector' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/BuildDirector/LegacyBuildDirector.php',
349
+ 'WPDesk\\PluginBuilder\\Builder\\AbstractBuilder' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Builder/AbstractBuilder.php',
350
+ 'WPDesk\\PluginBuilder\\Builder\\InfoBuilder' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Builder/InfoBuilder.php',
351
+ 'WPDesk\\PluginBuilder\\Plugin\\AbstractPlugin' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php',
352
+ 'WPDesk\\PluginBuilder\\Plugin\\ActivationTracker' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/ActivationTracker.php',
353
+ 'WPDesk\\PluginBuilder\\Plugin\\Hookable' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/Hookable.php',
354
+ 'WPDesk\\PluginBuilder\\Plugin\\HookableCollection' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/HookableCollection.php',
355
+ 'WPDesk\\PluginBuilder\\Plugin\\HookableParent' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/HookableParent.php',
356
+ 'WPDesk\\PluginBuilder\\Plugin\\HookablePluginDependant' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/HookablePluginDependant.php',
357
+ 'WPDesk\\PluginBuilder\\Plugin\\PluginAccess' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/PluginAccess.php',
358
+ 'WPDesk\\PluginBuilder\\Plugin\\TemplateLoad' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Plugin/TemplateLoad.php',
359
+ 'WPDesk\\PluginBuilder\\Storage\\Exception\\ClassAlreadyExists' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Storage/Exception/ClassAlreadyExists.php',
360
+ 'WPDesk\\PluginBuilder\\Storage\\Exception\\ClassNotExists' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Storage/Exception/ClassNotExists.php',
361
+ 'WPDesk\\PluginBuilder\\Storage\\PluginStorage' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Storage/PluginStorage.php',
362
+ 'WPDesk\\PluginBuilder\\Storage\\StaticStorage' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Storage/StaticStorage.php',
363
+ 'WPDesk\\PluginBuilder\\Storage\\StorageFactory' => __DIR__ . '/..' . '/wpdesk/wp-builder/src/Storage/StorageFactory.php',
364
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\CachedClient' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/ApiClient/CachedClient.php',
365
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\Client' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/ApiClient/Client.php',
366
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\ClientFactory' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/ApiClient/ClientFactory.php',
367
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\ClientImplementation' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/ApiClient/ClientImplementation.php',
368
+ 'WPDesk\\SaasPlatformClient\\ApiClient\\RequestCacheInfoResolver' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/ApiClient/RequestCacheInfoResolver.php',
369
+ 'WPDesk\\SaasPlatformClient\\Authentication\\JWTSaasToken' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Authentication/JWTSaasToken.php',
370
+ 'WPDesk\\SaasPlatformClient\\Authentication\\JWTToken' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Authentication/JWTToken.php',
371
+ 'WPDesk\\SaasPlatformClient\\Authentication\\NullToken' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Authentication/NullToken.php',
372
+ 'WPDesk\\SaasPlatformClient\\Authentication\\Token' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Authentication/Token.php',
373
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheDispatcher' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Cache/CacheDispatcher.php',
374
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheInfoResolver' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Cache/CacheInfoResolver.php',
375
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheItemCreator' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Cache/CacheItemCreator.php',
376
+ 'WPDesk\\SaasPlatformClient\\Cache\\CacheItemVerifier' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Cache/CacheItemVerifier.php',
377
+ 'WPDesk\\SaasPlatformClient\\Cache\\HowToCache' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Cache/HowToCache.php',
378
+ 'WPDesk\\SaasPlatformClient\\Cache\\WordpressCache' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Cache/WordpressCache.php',
379
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\Curl\\CurlClient' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/HttpClient/Curl/CurlClient.php',
380
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\Curl\\CurlException' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/HttpClient/Curl/CurlException.php',
381
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\HttpClient' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClient.php',
382
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\HttpClientFactory' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientFactory.php',
383
+ 'WPDesk\\SaasPlatformClient\\HttpClient\\HttpClientResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientResponse.php',
384
+ 'WPDesk\\SaasPlatformClient\\Model\\AbstractModel' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/AbstractModel.php',
385
+ 'WPDesk\\SaasPlatformClient\\Model\\KeyInfo' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/KeyInfo.php',
386
+ 'WPDesk\\SaasPlatformClient\\Model\\Label\\Label' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Label/Label.php',
387
+ 'WPDesk\\SaasPlatformClient\\Model\\LoginData' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/LoginData.php',
388
+ 'WPDesk\\SaasPlatformClient\\Model\\Rate\\RateRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Rate/RateRequest.php',
389
+ 'WPDesk\\SaasPlatformClient\\Model\\Rate\\RateResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Rate/RateResponse.php',
390
+ 'WPDesk\\SaasPlatformClient\\Model\\Rate\\SingleRate' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Rate/SingleRate.php',
391
+ 'WPDesk\\SaasPlatformClient\\Model\\Register' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Register.php',
392
+ 'WPDesk\\SaasPlatformClient\\Model\\Reset' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Reset.php',
393
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Actor' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Actor.php',
394
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Address' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Address.php',
395
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ClientMoney' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ClientMoney.php',
396
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Package' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Package.php',
397
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\Package\\Dimensions' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/Package/Dimensions.php',
398
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShipmentAdminContext' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShipmentAdminContext.php',
399
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShipmentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShipmentRequest.php',
400
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShipmentResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShipmentResponse.php',
401
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShopData' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShopData.php',
402
+ 'WPDesk\\SaasPlatformClient\\Model\\Shipment\\ShopFlow' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shipment/ShopFlow.php',
403
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingPlan' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/ShippingPlan.php',
404
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingService' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/ShippingService.php',
405
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingServiceSetting' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/ShippingServiceSetting.php',
406
+ 'WPDesk\\SaasPlatformClient\\Model\\ShippingServiceSettingTest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/ShippingServiceSettingTest.php',
407
+ 'WPDesk\\SaasPlatformClient\\Model\\Shop' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Shop.php',
408
+ 'WPDesk\\SaasPlatformClient\\Model\\Status' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Status.php',
409
+ 'WPDesk\\SaasPlatformClient\\Model\\Token' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/Token.php',
410
+ 'WPDesk\\SaasPlatformClient\\Model\\User' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Model/User.php',
411
+ 'WPDesk\\SaasPlatformClient\\Persistence\\ElementNotExistsException' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Persistence/ElementNotExistsException.php',
412
+ 'WPDesk\\SaasPlatformClient\\Persistence\\MemoryContainer' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Persistence/MemoryContainer.php',
413
+ 'WPDesk\\SaasPlatformClient\\Persistence\\PersistentContainer' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Persistence/PersistentContainer.php',
414
+ 'WPDesk\\SaasPlatformClient\\Persistence\\PersistentContainerFactory' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Persistence/PersistentContainerFactory.php',
415
+ 'WPDesk\\SaasPlatformClient\\Persistence\\Wordpress\\WordpressOptionsContainer' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Persistence/Wordpress/WordpressOptionsContainer.php',
416
+ 'WPDesk\\SaasPlatformClient\\Persistence\\Wordpress\\WordpressTransientContainer' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Persistence/Wordpress/WordpressTransientContainer.php',
417
+ 'WPDesk\\SaasPlatformClient\\Platform' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Platform.php',
418
+ 'WPDesk\\SaasPlatformClient\\PlatformAdminContext' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformAdminContext.php',
419
+ 'WPDesk\\SaasPlatformClient\\PlatformFactory' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformFactory.php',
420
+ 'WPDesk\\SaasPlatformClient\\PlatformFactoryOptions' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformFactoryOptions.php',
421
+ 'WPDesk\\SaasPlatformClient\\PlatformFactoryWordpressOptions' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformFactoryWordpressOptions.php',
422
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\HttpClientOptions' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformOption/HttpClientOptions.php',
423
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\PersistenceOptions' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformOption/PersistenceOptions.php',
424
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\PlatformUrlOptions' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformOption/PlatformUrlOptions.php',
425
+ 'WPDesk\\SaasPlatformClient\\PlatformOption\\SerializerOptions' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/PlatformOption/SerializerOptions.php',
426
+ 'WPDesk\\SaasPlatformClient\\Request\\AuthRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/AuthRequest.php',
427
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\ConnectKeyInfoRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/ConnectKeyInfoRequest.php',
428
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\ConnectKeyResetRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/ConnectKeyResetRequest.php',
429
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\RegisterRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/RegisterRequest.php',
430
+ 'WPDesk\\SaasPlatformClient\\Request\\Authentication\\TokenRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Authentication/TokenRequest.php',
431
+ 'WPDesk\\SaasPlatformClient\\Request\\BasicRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/BasicRequest.php',
432
+ 'WPDesk\\SaasPlatformClient\\Request\\Cancel\\PostCancelRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Cancel/PostCancelRequest.php',
433
+ 'WPDesk\\SaasPlatformClient\\Request\\Fields\\GetFieldsRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Fields/GetFieldsRequest.php',
434
+ 'WPDesk\\SaasPlatformClient\\Request\\Label\\PostLabelRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Label/PostLabelRequest.php',
435
+ 'WPDesk\\SaasPlatformClient\\Request\\Rate\\PostRateRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Rate/PostRateRequest.php',
436
+ 'WPDesk\\SaasPlatformClient\\Request\\Request' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Request.php',
437
+ 'WPDesk\\SaasPlatformClient\\Request\\Shipment\\GetUserListShipmentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/GetUserListShipmentRequest.php',
438
+ 'WPDesk\\SaasPlatformClient\\Request\\Shipment\\PostShipmentRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Shipment/PostShipmentRequest.php',
439
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingPlan\\PutShippingPlanRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingPlan/PutShippingPlanRequest.php',
440
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\GetSettingsRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/GetSettingsRequest.php',
441
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\PostSettingsRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/PostSettingsRequest.php',
442
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\PutSettingsRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/PutSettingsRequest.php',
443
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServicesSettings\\Test\\GetSettingsTestRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServicesSettings/Test/GetSettingsTestRequest.php',
444
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServices\\GetListRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServices/GetListRequest.php',
445
+ 'WPDesk\\SaasPlatformClient\\Request\\ShippingServices\\GetServiceRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/ShippingServices/GetServiceRequest.php',
446
+ 'WPDesk\\SaasPlatformClient\\Request\\Status\\GetStatusRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Status/GetStatusRequest.php',
447
+ 'WPDesk\\SaasPlatformClient\\Request\\Traits\\SettingsItemRequestHelper' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Traits/SettingsItemRequestHelper.php',
448
+ 'WPDesk\\SaasPlatformClient\\Request\\Users\\GetUserRequest' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Request/Users/GetUserRequest.php',
449
+ 'WPDesk\\SaasPlatformClient\\Response\\ApiResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ApiResponse.php',
450
+ 'WPDesk\\SaasPlatformClient\\Response\\AuthApiResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/AuthApiResponse.php',
451
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyInfoResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyInfoResponse.php',
452
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\ConnectKeyResetResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/ConnectKeyResetResponse.php',
453
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\RegisterResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/RegisterResponse.php',
454
+ 'WPDesk\\SaasPlatformClient\\Response\\Authentication\\TokenResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Authentication/TokenResponse.php',
455
+ 'WPDesk\\SaasPlatformClient\\Response\\Cancel\\PostCancelResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Cancel/PostCancelResponse.php',
456
+ 'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyMessageFromResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyMessageFromResponse.php',
457
+ 'WPDesk\\SaasPlatformClient\\Response\\Exception\\EmptyStatusFromResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/EmptyStatusFromResponse.php',
458
+ 'WPDesk\\SaasPlatformClient\\Response\\Exception\\TriedExtractDataFromErrorResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Exception/TriedExtractDataFromErrorResponse.php',
459
+ 'WPDesk\\SaasPlatformClient\\Response\\Fields\\GetFieldsResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Fields/GetFieldsResponse.php',
460
+ 'WPDesk\\SaasPlatformClient\\Response\\Label\\PostLabelResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Label/PostLabelResponse.php',
461
+ 'WPDesk\\SaasPlatformClient\\Response\\Maintenance\\MaintenanceResponseContext' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Maintenance/MaintenanceResponseContext.php',
462
+ 'WPDesk\\SaasPlatformClient\\Response\\ProtectedResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ProtectedResponse.php',
463
+ 'WPDesk\\SaasPlatformClient\\Response\\Rate\\PostRateResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Rate/PostRateResponse.php',
464
+ 'WPDesk\\SaasPlatformClient\\Response\\RawResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php',
465
+ 'WPDesk\\SaasPlatformClient\\Response\\Response' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Response.php',
466
+ 'WPDesk\\SaasPlatformClient\\Response\\Shipment\\GetListShipmentAdminContextResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/GetListShipmentAdminContextResponse.php',
467
+ 'WPDesk\\SaasPlatformClient\\Response\\Shipment\\PostShipmentResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Shipment/PostShipmentResponse.php',
468
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\GetSettingsResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/GetSettingsResponse.php',
469
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServicesSettings\\Test\\GetSettingsTestResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServicesSettings/Test/GetSettingsTestResponse.php',
470
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServices\\GetShippingServiceResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServices/GetShippingServiceResponse.php',
471
+ 'WPDesk\\SaasPlatformClient\\Response\\ShippingServices\\GetShippingServicesListResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/ShippingServices/GetShippingServicesListResponse.php',
472
+ 'WPDesk\\SaasPlatformClient\\Response\\Status\\GetStatusResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Status/GetStatusResponse.php',
473
+ 'WPDesk\\SaasPlatformClient\\Response\\Traits\\ApiResponseDecorator' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Traits/ApiResponseDecorator.php',
474
+ 'WPDesk\\SaasPlatformClient\\Response\\Traits\\AuthApiResponseDecorator' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Traits/AuthApiResponseDecorator.php',
475
+ 'WPDesk\\SaasPlatformClient\\Response\\Traits\\PagedListImplementation' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Traits/PagedListImplementation.php',
476
+ 'WPDesk\\SaasPlatformClient\\Response\\Users\\GetUserResponse' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Response/Users/GetUserResponse.php',
477
+ 'WPDesk\\SaasPlatformClient\\Serializer\\Exception\\CannotUnserializeException' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Serializer/Exception/CannotUnserializeException.php',
478
+ 'WPDesk\\SaasPlatformClient\\Serializer\\JsonSerializer' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Serializer/JsonSerializer.php',
479
+ 'WPDesk\\SaasPlatformClient\\Serializer\\Serializer' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Serializer/Serializer.php',
480
+ 'WPDesk\\SaasPlatformClient\\Serializer\\SerializerFactory' => __DIR__ . '/..' . '/wpdesk/wp-saas-platform-client/src/Serializer/SerializerFactory.php',
481
+ 'WPDesk\\View\\Renderer\\LoadTemplatePlugin' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Renderer/LoadTemplatePlugin.php',
482
+ 'WPDesk\\View\\Renderer\\Renderer' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Renderer/Renderer.php',
483
+ 'WPDesk\\View\\Renderer\\SimplePhpRenderer' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Renderer/SimplePhpRenderer.php',
484
+ 'WPDesk\\View\\Resolver\\ChainResolver' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Resolver/ChainResolver.php',
485
+ 'WPDesk\\View\\Resolver\\DirResolver' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Resolver/DirResolver.php',
486
+ 'WPDesk\\View\\Resolver\\Exception\\CanNotResolve' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Resolver/Exception/CanNotResolve.php',
487
+ 'WPDesk\\View\\Resolver\\NullResolver' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Resolver/NullResolver.php',
488
+ 'WPDesk\\View\\Resolver\\Resolver' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Resolver/Resolver.php',
489
+ 'WPDesk\\View\\Resolver\\WPThemeResolver' => __DIR__ . '/..' . '/wpdesk/wp-view/src/Resolver/WPThemeResolver.php',
490
  'WPDesk_Flexible_Shipping' => __DIR__ . '/../..' . '/classes/shipping-method.php',
491
+ 'WPDesk_Flexible_Shipping_Add_Shipping' => __DIR__ . '/../..' . '/classes/class-order-add-shipping.php',
492
  'WPDesk_Flexible_Shipping_Admin_Notices' => __DIR__ . '/../..' . '/classes/admin-notices.php',
493
  'WPDesk_Flexible_Shipping_Bulk_Actions' => __DIR__ . '/../..' . '/classes/bulk-actions.php',
494
+ 'WPDesk_Flexible_Shipping_Cancel_Shipment_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-cancel-shipment-exception.php',
495
  'WPDesk_Flexible_Shipping_Export' => __DIR__ . '/../..' . '/classes/flexible-shipping-export.php',
496
+ 'WPDesk_Flexible_Shipping_Get_Label_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-get-label-exception.php',
497
+ 'WPDesk_Flexible_Shipping_Label_Not_Available_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-label-not-available-exception.php',
498
+ 'WPDesk_Flexible_Shipping_Logger_Factory' => __DIR__ . '/../..' . '/classes/logger/class-logger-factory.php',
499
  'WPDesk_Flexible_Shipping_Manifest' => __DIR__ . '/../..' . '/classes/manifest/class-manifest.php',
500
  'WPDesk_Flexible_Shipping_Manifest_FS' => __DIR__ . '/../..' . '/classes/manifest/class-manifest-fs.php',
501
  'WPDesk_Flexible_Shipping_Manifest_Interface' => __DIR__ . '/../..' . '/classes/manifest/interface-manifest.php',
502
+ 'WPDesk_Flexible_Shipping_Menu' => __DIR__ . '/../..' . '/classes/class-menu.php',
503
+ 'WPDesk_Flexible_Shipping_Money_Formatter' => __DIR__ . '/../..' . '/classes/shipment/class-money-formatter.php',
504
  'WPDesk_Flexible_Shipping_Multicurrency' => __DIR__ . '/../..' . '/classes/multicurrency.php',
505
  'WPDesk_Flexible_Shipping_Multilingual' => __DIR__ . '/../..' . '/classes/multilingual.php',
506
+ 'WPDesk_Flexible_Shipping_SaaS_Add_Shipping_Handler' => __DIR__ . '/../..' . '/classes/saas/class-saas-add-shipping-handler.php',
507
+ 'WPDesk_Flexible_Shipping_SaaS_Auth_Params' => __DIR__ . '/../..' . '/classes/saas/class-saas-auth-params.php',
508
+ 'WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory' => __DIR__ . '/../..' . '/classes/saas/class-saas-platform-factory.php',
509
+ 'WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception' => __DIR__ . '/../..' . '/classes/saas/class-saas-bad-credentials-exception.php',
510
+ 'WPDesk_Flexible_Shipping_SaaS_Connection' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection.php',
511
+ 'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection-status-ajax.php',
512
+ 'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection-status-field.php',
513
+ 'WPDesk_Flexible_Shipping_SaaS_Country_State_Field' => __DIR__ . '/../..' . '/classes/saas/class-saas-country-state-field.php',
514
+ 'WPDesk_Flexible_Shipping_SaaS_Custom_Services_Settings' => __DIR__ . '/../..' . '/classes/saas/class-saas-custom-services-setting.php',
515
+ 'WPDesk_Flexible_Shipping_SaaS_Default_Value_Compute_Handler' => __DIR__ . '/../..' . '/classes/saas/class-saas-default-value-compute-handler.php',
516
+ 'WPDesk_Flexible_Shipping_SaaS_Free_Shipping_Metadata_Handler' => __DIR__ . '/../..' . '/classes/saas/class-saas-free-shipping-metadata-handler.php',
517
+ 'WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler' => __DIR__ . '/../..' . '/classes/saas/class-saas-live-rates-fallback-metadata-handler.php',
518
+ 'WPDesk_Flexible_Shipping_SaaS_Live_Rates_Handler' => __DIR__ . '/../..' . '/classes/saas/class-saas-live-rates-handler.php',
519
+ 'WPDesk_Flexible_Shipping_SaaS_Logger_Downloader' => __DIR__ . '/../..' . '/classes/logger/class-saas-logger-downloader.php',
520
+ 'WPDesk_Flexible_Shipping_SaaS_Logger_Settings' => __DIR__ . '/../..' . '/classes/logger/class-saas-logger-settings.php',
521
+ 'WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception' => __DIR__ . '/../..' . '/classes/saas/class-saas-maintenance-mode-exception.php',
522
+ 'WPDesk_Flexible_Shipping_SaaS_Platform_Links' => __DIR__ . '/../..' . '/classes/saas/class-saas-platform-links.php',
523
+ 'WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice' => __DIR__ . '/../..' . '/classes/saas/class-saas-registration-second-notice.php',
524
+ 'WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found' => __DIR__ . '/../..' . '/classes/saas/class-saas-service-settings-not-found-exception.php',
525
+ 'WPDesk_Flexible_Shipping_SaaS_Services_Manager' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipping-services-manager.php',
526
+ 'WPDesk_Flexible_Shipping_SaaS_Settings' => __DIR__ . '/../..' . '/classes/saas/class-saas-settings.php',
527
+ 'WPDesk_Flexible_Shipping_SaaS_Settings_Service_Checkbox' => __DIR__ . '/../..' . '/classes/saas/class-saas-settings-service-checkbox.php',
528
+ 'WPDesk_Flexible_Shipping_SaaS_Shipment_Auto_Create' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipment-auto-create.php',
529
+ 'WPDesk_Flexible_Shipping_SaaS_Shipment_Order_Auto_Complete' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipment-order-auto-complete.php',
530
+ 'WPDesk_Flexible_Shipping_SaaS_Shipment_Settings_Field' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipment-settings-field.php',
531
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Method_Integration_Settings' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipping-method-integration-settings.php',
532
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Service' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipping-service.php',
533
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Service_Settings' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipping-service-settings.php',
534
+ 'WPDesk_Flexible_Shipping_SaaS_Shipping_Services' => __DIR__ . '/../..' . '/classes/saas/class-saas-shipping-services.php',
535
+ 'WPDesk_Flexible_Shipping_SaaS_Tracker' => __DIR__ . '/../..' . '/classes/saas/tracker/class-saas-tracker.php',
536
+ 'WPDesk_Flexible_Shipping_SaaS_User_Registration' => __DIR__ . '/../..' . '/classes/saas/class-saas-user-registration.php',
537
+ 'WPDesk_Flexible_Shipping_Saas_Connection_Aware' => __DIR__ . '/../..' . '/classes/saas/interface-saas-connection-aware.php',
538
+ 'WPDesk_Flexible_Shipping_Send_Shipment_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-send-shipment-exception.php',
539
  'WPDesk_Flexible_Shipping_Shipment' => __DIR__ . '/../..' . '/classes/shipment/class-shipment.php',
540
  'WPDesk_Flexible_Shipping_Shipment_Ajax' => __DIR__ . '/../..' . '/classes/shipment/ajax.php',
541
  'WPDesk_Flexible_Shipping_Shipment_CPT' => __DIR__ . '/../..' . '/classes/shipment/cpt-shipment.php',
542
+ 'WPDesk_Flexible_Shipping_Shipment_Counter' => __DIR__ . '/../..' . '/classes/shipment/class-shipment-counter.php',
543
  'WPDesk_Flexible_Shipping_Shipment_Interface' => __DIR__ . '/../..' . '/classes/shipment/interface-shipment.php',
544
+ 'WPDesk_Flexible_Shipping_Shipment_Plan_Exceeded_Exception' => __DIR__ . '/../..' . '/classes/shipment/class-shipment-plan-exceeded-exception.php',
545
+ 'WPDesk_Flexible_Shipping_Shipment_Request_Fields' => __DIR__ . '/../..' . '/classes/shipment/class-shipment-request-fields.php',
546
+ 'WPDesk_Flexible_Shipping_Shipment_Saas' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas.php',
547
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Ajax' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-ajax.php',
548
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Message_Formatter' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-message-formatter.php',
549
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Metabox' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-metabox.php',
550
+ 'WPDesk_Flexible_Shipping_Shipment_Saas_Send' => __DIR__ . '/../..' . '/classes/shipment/saas/class-shipment-saas-send.php',
551
  'WPDesk_Flexible_Shipping_Shipping_Manifest_CPT' => __DIR__ . '/../..' . '/classes/manifest/cpt-shipping-manifest.php',
552
+ 'WPDesk_Flexible_Shipping_Shipping_Zone_Data_Extractor' => __DIR__ . '/../..' . '/classes/class-shipping-zone-data-extractor.php',
553
+ 'WPDesk_Flexible_Shipping_Shorcode_Unit_Dimension' => __DIR__ . '/../..' . '/classes/class-shortcode-unit-dimension.php',
554
+ 'WPDesk_Flexible_Shipping_Shorcode_Unit_Weight' => __DIR__ . '/../..' . '/classes/class-shortcode-unit-weight.php',
555
  'WPDesk_Flexible_Shipping_Tracker' => __DIR__ . '/../..' . '/classes/tracker.php',
556
+ 'WPDesk_Flexible_Shipping_UK_States' => __DIR__ . '/../..' . '/classes/class-uk-states.php',
557
+ 'WPDesk_Flexible_Shipping_WooCommerce_Context_Logger' => __DIR__ . '/../..' . '/classes/logger/class-woocommerce-context-logger.php',
558
+ 'WPDesk_S214_Settings' => __DIR__ . '/..' . '/wpdesk/wp-settings/source/class.wpdesk-s214-settings.php',
 
 
 
559
  'WPDesk_Tracker' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/class-wpdesk-tracker.php',
560
  'WPDesk_Tracker_Data_Provider' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider.php',
561
  'WPDesk_Tracker_Data_Provider_Gateways' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/data_provider/class-wpdesk-tracker-data-provider-gateways.php',
584
  'WPDesk_Tracker_Sender_Exception_WpError' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/sender/Exception/class-wpdesk-tracker-sender-exception-wperror.php',
585
  'WPDesk_Tracker_Sender_Logged' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-logged.php',
586
  'WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => __DIR__ . '/../..' . '/inc/wpdesk-tracker/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
587
+ 'WPDesk_WP_Settings' => __DIR__ . '/..' . '/wpdesk/wp-settings/source/class.wpdesk-wp-settings.php',
588
  );
589
 
590
  public static function getInitializer(ClassLoader $loader)
591
  {
592
  return \Closure::bind(function () use ($loader) {
593
+ $loader->prefixLengthsPsr4 = ComposerStaticInitad64371326e4ceae5e5911f45824f78b::$prefixLengthsPsr4;
594
+ $loader->prefixDirsPsr4 = ComposerStaticInitad64371326e4ceae5e5911f45824f78b::$prefixDirsPsr4;
595
+ $loader->classMap = ComposerStaticInitad64371326e4ceae5e5911f45824f78b::$classMap;
596
 
597
  }, null, ClassLoader::class);
598
  }
vendor/composer/installed.json CHANGED
@@ -1,21 +1,567 @@
1
  [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  {
3
  "name": "wpdesk/wp-mutex",
4
- "version": "dev-master",
5
- "version_normalized": "9999999-dev",
6
  "source": {
7
  "type": "git",
8
  "url": "https://gitlab.com/wpdesk/wp-mutex.git",
9
- "reference": "557f824ee255bbf22954cd8f94bfb96aa3faeded"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-mutex/repository/archive.zip?sha=557f824ee255bbf22954cd8f94bfb96aa3faeded",
14
- "reference": "557f824ee255bbf22954cd8f94bfb96aa3faeded",
15
  "shasum": ""
16
  },
17
  "require": {
18
- "php": ">=5.5"
19
  },
20
  "require-dev": {
21
  "10up/wp_mock": "*",
@@ -25,13 +571,16 @@
25
  "wimg/php-compatibility": "^8",
26
  "wp-coding-standards/wpcs": "^0.14.1"
27
  },
28
- "time": "2018-10-17T11:24:21+00:00",
29
  "type": "library",
30
- "installation-source": "source",
31
  "autoload": {
32
  "psr-4": {
33
  "WPDesk\\Mutex\\": "src/WPDesk/Mutex/"
34
- }
 
 
 
35
  },
36
  "notification-url": "https://packagist.org/downloads/",
37
  "license": [
@@ -54,5 +603,199 @@
54
  "mutex",
55
  "wordpress"
56
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
  ]
1
  [
2
+ {
3
+ "name": "composer/installers",
4
+ "version": "v1.6.0",
5
+ "version_normalized": "1.6.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/composer/installers.git",
9
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
14
+ "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "composer-plugin-api": "^1.0"
19
+ },
20
+ "replace": {
21
+ "roundcube/plugin-installer": "*",
22
+ "shama/baton": "*"
23
+ },
24
+ "require-dev": {
25
+ "composer/composer": "1.0.*@dev",
26
+ "phpunit/phpunit": "^4.8.36"
27
+ },
28
+ "time": "2018-08-27T06:10:37+00:00",
29
+ "type": "composer-plugin",
30
+ "extra": {
31
+ "class": "Composer\\Installers\\Plugin",
32
+ "branch-alias": {
33
+ "dev-master": "1.0-dev"
34
+ }
35
+ },
36
+ "installation-source": "dist",
37
+ "autoload": {
38
+ "psr-4": {
39
+ "Composer\\Installers\\": "src/Composer/Installers"
40
+ }
41
+ },
42
+ "notification-url": "https://packagist.org/downloads/",
43
+ "license": [
44
+ "MIT"
45
+ ],
46
+ "authors": [
47
+ {
48
+ "name": "Kyle Robinson Young",
49
+ "email": "kyle@dontkry.com",
50
+ "homepage": "https://github.com/shama"
51
+ }
52
+ ],
53
+ "description": "A multi-framework Composer library installer",
54
+ "homepage": "https://composer.github.io/installers/",
55
+ "keywords": [
56
+ "Craft",
57
+ "Dolibarr",
58
+ "Eliasis",
59
+ "Hurad",
60
+ "ImageCMS",
61
+ "Kanboard",
62
+ "Lan Management System",
63
+ "MODX Evo",
64
+ "Mautic",
65
+ "Maya",
66
+ "OXID",
67
+ "Plentymarkets",
68
+ "Porto",
69
+ "RadPHP",
70
+ "SMF",
71
+ "Thelia",
72
+ "WolfCMS",
73
+ "agl",
74
+ "aimeos",
75
+ "annotatecms",
76
+ "attogram",
77
+ "bitrix",
78
+ "cakephp",
79
+ "chef",
80
+ "cockpit",
81
+ "codeigniter",
82
+ "concrete5",
83
+ "croogo",
84
+ "dokuwiki",
85
+ "drupal",
86
+ "eZ Platform",
87
+ "elgg",
88
+ "expressionengine",
89
+ "fuelphp",
90
+ "grav",
91
+ "installer",
92
+ "itop",
93
+ "joomla",
94
+ "kohana",
95
+ "laravel",
96
+ "lavalite",
97
+ "lithium",
98
+ "magento",
99
+ "majima",
100
+ "mako",
101
+ "mediawiki",
102
+ "modulework",
103
+ "modx",
104
+ "moodle",
105
+ "osclass",
106
+ "phpbb",
107
+ "piwik",
108
+ "ppi",
109
+ "puppet",
110
+ "pxcms",
111
+ "reindex",
112
+ "roundcube",
113
+ "shopware",
114
+ "silverstripe",
115
+ "sydes",
116
+ "symfony",
117
+ "typo3",
118
+ "wordpress",
119
+ "yawik",
120
+ "zend",
121
+ "zikula"
122
+ ]
123
+ },
124
+ {
125
+ "name": "moneyphp/money",
126
+ "version": "v3.1.3",
127
+ "version_normalized": "3.1.3.0",
128
+ "source": {
129
+ "type": "git",
130
+ "url": "https://github.com/moneyphp/money.git",
131
+ "reference": "5e6a3c98ba2cb190d48d35656967eacf30716034"
132
+ },
133
+ "dist": {
134
+ "type": "zip",
135
+ "url": "https://api.github.com/repos/moneyphp/money/zipball/5e6a3c98ba2cb190d48d35656967eacf30716034",
136
+ "reference": "5e6a3c98ba2cb190d48d35656967eacf30716034",
137
+ "shasum": ""
138
+ },
139
+ "require": {
140
+ "php": ">=5.6"
141
+ },
142
+ "require-dev": {
143
+ "cache/taggable-cache": "^0.4.0",
144
+ "doctrine/instantiator": "^1.0.5",
145
+ "ext-bcmath": "*",
146
+ "ext-gmp": "*",
147
+ "ext-intl": "*",
148
+ "florianv/swap": "^3.0",
149
+ "leanphp/phpspec-code-coverage": "^3.0 || ^4.0",
150
+ "moneyphp/iso-currencies": "^3.0",
151
+ "php-http/message": "^1.4",
152
+ "php-http/mock-client": "^0.3.3",
153
+ "phpspec/phpspec": "^3.0",
154
+ "phpunit/phpunit": "^5",
155
+ "psr/cache": "^1.0",
156
+ "sllh/php-cs-fixer-styleci-bridge": "^2.1",
157
+ "symfony/phpunit-bridge": "^4"
158
+ },
159
+ "suggest": {
160
+ "ext-bcmath": "Calculate without integer limits",
161
+ "ext-gmp": "Calculate without integer limits",
162
+ "ext-intl": "Format Money objects with intl",
163
+ "florianv/swap": "Exchange rates library for PHP",
164
+ "psr/cache-implementation": "Used for Currency caching"
165
+ },
166
+ "time": "2018-02-16T11:04:16+00:00",
167
+ "type": "library",
168
+ "extra": {
169
+ "branch-alias": {
170
+ "dev-master": "3.0-dev"
171
+ }
172
+ },
173
+ "installation-source": "dist",
174
+ "autoload": {
175
+ "psr-4": {
176
+ "Money\\": "src/"
177
+ }
178
+ },
179
+ "notification-url": "https://packagist.org/downloads/",
180
+ "license": [
181
+ "MIT"
182
+ ],
183
+ "authors": [
184
+ {
185
+ "name": "Mathias Verraes",
186
+ "email": "mathias@verraes.net",
187
+ "homepage": "http://verraes.net"
188
+ },
189
+ {
190
+ "name": "Frederik Bosch",
191
+ "email": "f.bosch@genkgo.nl"
192
+ },
193
+ {
194
+ "name": "Márk Sági-Kazár",
195
+ "email": "mark.sagi-kazar@gmail.com"
196
+ }
197
+ ],
198
+ "description": "PHP implementation of Fowler's Money pattern",
199
+ "homepage": "http://verraes.net/2011/04/fowler-money-pattern-in-php/",
200
+ "keywords": [
201
+ "Value Object",
202
+ "money",
203
+ "vo"
204
+ ]
205
+ },
206
+ {
207
+ "name": "monolog/monolog",
208
+ "version": "1.24.0",
209
+ "version_normalized": "1.24.0.0",
210
+ "source": {
211
+ "type": "git",
212
+ "url": "https://github.com/Seldaek/monolog.git",
213
+ "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
214
+ },
215
+ "dist": {
216
+ "type": "zip",
217
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
218
+ "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
219
+ "shasum": ""
220
+ },
221
+ "require": {
222
+ "php": ">=5.3.0",
223
+ "psr/log": "~1.0"
224
+ },
225
+ "provide": {
226
+ "psr/log-implementation": "1.0.0"
227
+ },
228
+ "require-dev": {
229
+ "aws/aws-sdk-php": "^2.4.9 || ^3.0",
230
+ "doctrine/couchdb": "~1.0@dev",
231
+ "graylog2/gelf-php": "~1.0",
232
+ "jakub-onderka/php-parallel-lint": "0.9",
233
+ "php-amqplib/php-amqplib": "~2.4",
234
+ "php-console/php-console": "^3.1.3",
235
+ "phpunit/phpunit": "~4.5",
236
+ "phpunit/phpunit-mock-objects": "2.3.0",
237
+ "ruflin/elastica": ">=0.90 <3.0",
238
+ "sentry/sentry": "^0.13",
239
+ "swiftmailer/swiftmailer": "^5.3|^6.0"
240
+ },
241
+ "suggest": {
242
+ "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
243
+ "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
244
+ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
245
+ "ext-mongo": "Allow sending log messages to a MongoDB server",
246
+ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
247
+ "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
248
+ "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
249
+ "php-console/php-console": "Allow sending log messages to Google Chrome",
250
+ "rollbar/rollbar": "Allow sending log messages to Rollbar",
251
+ "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
252
+ "sentry/sentry": "Allow sending log messages to a Sentry server"
253
+ },
254
+ "time": "2018-11-05T09:00:11+00:00",
255
+ "type": "library",
256
+ "extra": {
257
+ "branch-alias": {
258
+ "dev-master": "2.0.x-dev"
259
+ }
260
+ },
261
+ "installation-source": "dist",
262
+ "autoload": {
263
+ "psr-4": {
264
+ "Monolog\\": "src/Monolog"
265
+ }
266
+ },
267
+ "notification-url": "https://packagist.org/downloads/",
268
+ "license": [
269
+ "MIT"
270
+ ],
271
+ "authors": [
272
+ {
273
+ "name": "Jordi Boggiano",
274
+ "email": "j.boggiano@seld.be",
275
+ "homepage": "http://seld.be"
276
+ }
277
+ ],
278
+ "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
279
+ "homepage": "http://github.com/Seldaek/monolog",
280
+ "keywords": [
281
+ "log",
282
+ "logging",
283
+ "psr-3"
284
+ ]
285
+ },
286
+ {
287
+ "name": "psr/log",
288
+ "version": "1.1.0",
289
+ "version_normalized": "1.1.0.0",
290
+ "source": {
291
+ "type": "git",
292
+ "url": "https://github.com/php-fig/log.git",
293
+ "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
294
+ },
295
+ "dist": {
296
+ "type": "zip",
297
+ "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
298
+ "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
299
+ "shasum": ""
300
+ },
301
+ "require": {
302
+ "php": ">=5.3.0"
303
+ },
304
+ "time": "2018-11-20T15:27:04+00:00",
305
+ "type": "library",
306
+ "extra": {
307
+ "branch-alias": {
308
+ "dev-master": "1.0.x-dev"
309
+ }
310
+ },
311
+ "installation-source": "dist",
312
+ "autoload": {
313
+ "psr-4": {
314
+ "Psr\\Log\\": "Psr/Log/"
315
+ }
316
+ },
317
+ "notification-url": "https://packagist.org/downloads/",
318
+ "license": [
319
+ "MIT"
320
+ ],
321
+ "authors": [
322
+ {
323
+ "name": "PHP-FIG",
324
+ "homepage": "http://www.php-fig.org/"
325
+ }
326
+ ],
327
+ "description": "Common interface for logging libraries",
328
+ "homepage": "https://github.com/php-fig/log",
329
+ "keywords": [
330
+ "log",
331
+ "psr",
332
+ "psr-3"
333
+ ]
334
+ },
335
+ {
336
+ "name": "psr/simple-cache",
337
+ "version": "1.0.1",
338
+ "version_normalized": "1.0.1.0",
339
+ "source": {
340
+ "type": "git",
341
+ "url": "https://github.com/php-fig/simple-cache.git",
342
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
343
+ },
344
+ "dist": {
345
+ "type": "zip",
346
+ "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
347
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
348
+ "shasum": ""
349
+ },
350
+ "require": {
351
+ "php": ">=5.3.0"
352
+ },
353
+ "time": "2017-10-23T01:57:42+00:00",
354
+ "type": "library",
355
+ "extra": {
356
+ "branch-alias": {
357
+ "dev-master": "1.0.x-dev"
358
+ }
359
+ },
360
+ "installation-source": "dist",
361
+ "autoload": {
362
+ "psr-4": {
363
+ "Psr\\SimpleCache\\": "src/"
364
+ }
365
+ },
366
+ "notification-url": "https://packagist.org/downloads/",
367
+ "license": [
368
+ "MIT"
369
+ ],
370
+ "authors": [
371
+ {
372
+ "name": "PHP-FIG",
373
+ "homepage": "http://www.php-fig.org/"
374
+ }
375
+ ],
376
+ "description": "Common interfaces for simple caching",
377
+ "keywords": [
378
+ "cache",
379
+ "caching",
380
+ "psr",
381
+ "psr-16",
382
+ "simple-cache"
383
+ ]
384
+ },
385
+ {
386
+ "name": "wpdesk/wp-autoloader",
387
+ "version": "1.1",
388
+ "version_normalized": "1.1.0.0",
389
+ "source": {
390
+ "type": "git",
391
+ "url": "https://gitlab.com/wpdesk/wp-autoloader.git",
392
+ "reference": "2c471071e240b0f093610d45e20601369e3e3d92"
393
+ },
394
+ "dist": {
395
+ "type": "zip",
396
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-autoloader/repository/archive.zip?sha=2c471071e240b0f093610d45e20601369e3e3d92",
397
+ "reference": "2c471071e240b0f093610d45e20601369e3e3d92",
398
+ "shasum": ""
399
+ },
400
+ "require": {
401
+ "php": ">=5.5",
402
+ "psr/log": "^1.0",
403
+ "wpdesk/wp-basic-requirements": "^2.0"
404
+ },
405
+ "require-dev": {
406
+ "10up/wp_mock": "*",
407
+ "mockery/mockery": "*",
408
+ "phpunit/phpunit": "<7",
409
+ "squizlabs/php_codesniffer": "^3.0.2",
410
+ "wimg/php-compatibility": "^8",
411
+ "wp-coding-standards/wpcs": "^0.14.1"
412
+ },
413
+ "time": "2018-10-18T13:10:55+00:00",
414
+ "type": "library",
415
+ "installation-source": "dist",
416
+ "notification-url": "https://packagist.org/downloads/",
417
+ "authors": [
418
+ {
419
+ "name": "Krzysiek",
420
+ "email": "krzysiek@wpdesk.pl"
421
+ }
422
+ ]
423
+ },
424
+ {
425
+ "name": "wpdesk/wp-basic-requirements",
426
+ "version": "2.0",
427
+ "version_normalized": "2.0.0.0",
428
+ "source": {
429
+ "type": "git",
430
+ "url": "https://gitlab.com/wpdesk/wp-basic-requirements.git",
431
+ "reference": "57d76f5acf312f632210db71884f282d8fcf1838"
432
+ },
433
+ "dist": {
434
+ "type": "zip",
435
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-basic-requirements/repository/archive.zip?sha=57d76f5acf312f632210db71884f282d8fcf1838",
436
+ "reference": "57d76f5acf312f632210db71884f282d8fcf1838",
437
+ "shasum": ""
438
+ },
439
+ "require": {
440
+ "php": ">=5.2"
441
+ },
442
+ "require-dev": {
443
+ "10up/wp_mock": "*",
444
+ "mockery/mockery": "*",
445
+ "php": ">=5.5",
446
+ "phpunit/phpunit": "<7",
447
+ "squizlabs/php_codesniffer": "^3.0.2",
448
+ "wimg/php-compatibility": "^8",
449
+ "wp-coding-standards/wpcs": "^0.14.1"
450
+ },
451
+ "time": "2018-08-05T15:46:18+00:00",
452
+ "type": "library",
453
+ "installation-source": "dist",
454
+ "notification-url": "https://packagist.org/downloads/",
455
+ "authors": [
456
+ {
457
+ "name": "Krzysiek",
458
+ "email": "krzysiek@wpdesk.pl"
459
+ }
460
+ ]
461
+ },
462
+ {
463
+ "name": "wpdesk/wp-builder",
464
+ "version": "1.1",
465
+ "version_normalized": "1.1.0.0",
466
+ "source": {
467
+ "type": "git",
468
+ "url": "https://gitlab.com/wpdesk/wp-builder.git",
469
+ "reference": "7e54daed6f86260705fa65d2668ae65f9e66114f"
470
+ },
471
+ "dist": {
472
+ "type": "zip",
473
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-builder/repository/archive.zip?sha=7e54daed6f86260705fa65d2668ae65f9e66114f",
474
+ "reference": "7e54daed6f86260705fa65d2668ae65f9e66114f",
475
+ "shasum": ""
476
+ },
477
+ "require": {
478
+ "php": ">=5.5",
479
+ "wpdesk/wp-basic-requirements": "^2.0"
480
+ },
481
+ "require-dev": {
482
+ "10up/wp_mock": "*",
483
+ "mockery/mockery": "*",
484
+ "phpunit/phpunit": "<7",
485
+ "squizlabs/php_codesniffer": "^3.0.2",
486
+ "wimg/php-compatibility": "^8",
487
+ "wp-coding-standards/wpcs": "^0.14.1"
488
+ },
489
+ "time": "2018-10-18T13:11:44+00:00",
490
+ "type": "library",
491
+ "installation-source": "dist",
492
+ "autoload": {
493
+ "psr-4": {
494
+ "WPDesk\\PluginBuilder\\": "src/"
495
+ }
496
+ },
497
+ "notification-url": "https://packagist.org/downloads/",
498
+ "authors": [
499
+ {
500
+ "name": "Krzysiek",
501
+ "email": "krzysiek@wpdesk.pl"
502
+ }
503
+ ]
504
+ },
505
+ {
506
+ "name": "wpdesk/wp-logs",
507
+ "version": "1.3.0",
508
+ "version_normalized": "1.3.0.0",
509
+ "source": {
510
+ "type": "git",
511
+ "url": "https://gitlab.com/wpdesk/wp-logs.git",
512
+ "reference": "1cb5b1b1e23b4b30bc4668aafd916c89a2aa0d8b"
513
+ },
514
+ "dist": {
515
+ "type": "zip",
516
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-logs/repository/archive.zip?sha=1cb5b1b1e23b4b30bc4668aafd916c89a2aa0d8b",
517
+ "reference": "1cb5b1b1e23b4b30bc4668aafd916c89a2aa0d8b",
518
+ "shasum": ""
519
+ },
520
+ "require": {
521
+ "monolog/monolog": "^1.23",
522
+ "php": ">=5.6",
523
+ "psr/log": "^1.0.1"
524
+ },
525
+ "require-dev": {
526
+ "10up/wp_mock": "^0.3",
527
+ "phpunit/phpunit": "^6",
528
+ "squizlabs/php_codesniffer": "^3.0.2",
529
+ "wimg/php-compatibility": "^8",
530
+ "wp-coding-standards/wpcs": "^0.14.1"
531
+ },
532
+ "time": "2018-10-30T14:45:49+00:00",
533
+ "type": "library",
534
+ "installation-source": "dist",
535
+ "autoload": {
536
+ "psr-4": {
537
+ "WPDesk\\Logger\\": "src/"
538
+ }
539
+ },
540
+ "notification-url": "https://packagist.org/downloads/",
541
+ "authors": [
542
+ {
543
+ "name": "Krzysiek",
544
+ "email": "krzysiek@wpdesk.pl"
545
+ }
546
+ ]
547
+ },
548
  {
549
  "name": "wpdesk/wp-mutex",
550
+ "version": "1.1",
551
+ "version_normalized": "1.1.0.0",
552
  "source": {
553
  "type": "git",
554
  "url": "https://gitlab.com/wpdesk/wp-mutex.git",
555
+ "reference": "4df845e751382179fadf2fff3c8e243b77e7d773"
556
  },
557
  "dist": {
558
  "type": "zip",
559
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-mutex/repository/archive.zip?sha=4df845e751382179fadf2fff3c8e243b77e7d773",
560
+ "reference": "4df845e751382179fadf2fff3c8e243b77e7d773",
561
  "shasum": ""
562
  },
563
  "require": {
564
+ "php": ">=5.6"
565
  },
566
  "require-dev": {
567
  "10up/wp_mock": "*",
571
  "wimg/php-compatibility": "^8",
572
  "wp-coding-standards/wpcs": "^0.14.1"
573
  },
574
+ "time": "2018-11-13T12:27:39+00:00",
575
  "type": "library",
576
+ "installation-source": "dist",
577
  "autoload": {
578
  "psr-4": {
579
  "WPDesk\\Mutex\\": "src/WPDesk/Mutex/"
580
+ },
581
+ "files": [
582
+ "src/WPDesk/functions.php"
583
+ ]
584
  },
585
  "notification-url": "https://packagist.org/downloads/",
586
  "license": [
603
  "mutex",
604
  "wordpress"
605
  ]
606
+ },
607
+ {
608
+ "name": "wpdesk/wp-notice",
609
+ "version": "2.1.1",
610
+ "version_normalized": "2.1.1.0",
611
+ "source": {
612
+ "type": "git",
613
+ "url": "https://gitlab.com/wpdesk/wp-notice.git",
614
+ "reference": "437e2cbd6477f0b22ebfc0fe7c15f6b9a77fda00"
615
+ },
616
+ "dist": {
617
+ "type": "zip",
618
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-notice/repository/archive.zip?sha=437e2cbd6477f0b22ebfc0fe7c15f6b9a77fda00",
619
+ "reference": "437e2cbd6477f0b22ebfc0fe7c15f6b9a77fda00",
620
+ "shasum": ""
621
+ },
622
+ "require": {
623
+ "php": ">=5.5",
624
+ "wpdesk/wp-basic-requirements": "^2.0",
625
+ "wpdesk/wp-builder": "^1.0"
626
+ },
627
+ "require-dev": {
628
+ "10up/wp_mock": "*",
629
+ "mockery/mockery": "*",
630
+ "phpunit/phpunit": "<7",
631
+ "squizlabs/php_codesniffer": "^3.0.2",
632
+ "wimg/php-compatibility": "^8",
633
+ "wp-coding-standards/wpcs": "^0.14.1"
634
+ },
635
+ "time": "2018-11-16T08:22:51+00:00",
636
+ "type": "library",
637
+ "installation-source": "dist",
638
+ "autoload": {
639
+ "psr-4": {
640
+ "WPDesk\\Notice\\": "src/WPDesk/Notice/"
641
+ },
642
+ "files": [
643
+ "src/WPDesk/functions.php"
644
+ ]
645
+ },
646
+ "notification-url": "https://packagist.org/downloads/",
647
+ "license": [
648
+ "MIT"
649
+ ],
650
+ "authors": [
651
+ {
652
+ "name": "grola",
653
+ "email": "grola@wpdesk.net"
654
+ }
655
+ ],
656
+ "description": "Library for displaying Wordpress notices.",
657
+ "homepage": "https://gitlab.com/wpdesk/wp-notice",
658
+ "keywords": [
659
+ "admin",
660
+ "notice",
661
+ "wordpress"
662
+ ]
663
+ },
664
+ {
665
+ "name": "wpdesk/wp-saas-platform-client",
666
+ "version": "1.5.1",
667
+ "version_normalized": "1.5.1.0",
668
+ "source": {
669
+ "type": "git",
670
+ "url": "https://gitlab.com/wpdesk/wp-saas-platform-client.git",
671
+ "reference": "e3669bd609727c8e5ed5568b9140e1b85469738d"
672
+ },
673
+ "dist": {
674
+ "type": "zip",
675
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-saas-platform-client/repository/archive.zip?sha=e3669bd609727c8e5ed5568b9140e1b85469738d",
676
+ "reference": "e3669bd609727c8e5ed5568b9140e1b85469738d",
677
+ "shasum": ""
678
+ },
679
+ "require": {
680
+ "ext-curl": "*",
681
+ "ext-json": "*",
682
+ "php": ">=5.5",
683
+ "psr/log": "^1.0.1",
684
+ "psr/simple-cache": "^1.0"
685
+ },
686
+ "require-dev": {
687
+ "mockery/mockery": "^1.1",
688
+ "phpunit/phpunit": "<7",
689
+ "squizlabs/php_codesniffer": "^3.0.2",
690
+ "wimg/php-compatibility": "^8",
691
+ "wp-coding-standards/wpcs": "^0.14.1"
692
+ },
693
+ "time": "2018-11-16T12:09:19+00:00",
694
+ "type": "library",
695
+ "installation-source": "dist",
696
+ "autoload": {
697
+ "psr-4": {
698
+ "WPDesk\\SaasPlatformClient\\": "src/"
699
+ }
700
+ },
701
+ "notification-url": "https://packagist.org/downloads/",
702
+ "authors": [
703
+ {
704
+ "name": "Krzysiek",
705
+ "email": "krzysiek@wpdesk.pl"
706
+ }
707
+ ]
708
+ },
709
+ {
710
+ "name": "wpdesk/wp-settings",
711
+ "version": "1.0",
712
+ "version_normalized": "1.0.0.0",
713
+ "source": {
714
+ "type": "git",
715
+ "url": "https://gitlab.com/wpdesk/wp-settings.git",
716
+ "reference": "6575bc86da10a47a9cbccaef9ba475601d52617a"
717
+ },
718
+ "dist": {
719
+ "type": "zip",
720
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-settings/repository/archive.zip?sha=6575bc86da10a47a9cbccaef9ba475601d52617a",
721
+ "reference": "6575bc86da10a47a9cbccaef9ba475601d52617a",
722
+ "shasum": ""
723
+ },
724
+ "require": {
725
+ "composer/installers": "~1.0",
726
+ "php": ">=5.3.0"
727
+ },
728
+ "require-dev": {
729
+ "phpunit/php-invoker": "1.1.3",
730
+ "phpunit/phpunit": "3.7.31",
731
+ "satooshi/php-coveralls": "dev-master"
732
+ },
733
+ "time": "2018-08-01T11:34:33+00:00",
734
+ "type": "library",
735
+ "installation-source": "dist",
736
+ "autoload": {
737
+ "classmap": [
738
+ "source/"
739
+ ]
740
+ },
741
+ "notification-url": "https://packagist.org/downloads/",
742
+ "license": [
743
+ "GPL-2.0+"
744
+ ],
745
+ "authors": [
746
+ {
747
+ "name": "WP Desk",
748
+ "email": "wpdesk@wpdesk.net"
749
+ }
750
+ ],
751
+ "description": "A PHP library for implementing a simple, transparent WordPress settings panel.",
752
+ "homepage": "https://wpdesk.net/",
753
+ "keywords": [
754
+ "Settings",
755
+ "options",
756
+ "wpdesk"
757
+ ]
758
+ },
759
+ {
760
+ "name": "wpdesk/wp-view",
761
+ "version": "1.0.2",
762
+ "version_normalized": "1.0.2.0",
763
+ "source": {
764
+ "type": "git",
765
+ "url": "https://gitlab.com/wpdesk/wp-view.git",
766
+ "reference": "08393dd1cc5c5bc72e232c5b18af68e064ec8362"
767
+ },
768
+ "dist": {
769
+ "type": "zip",
770
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-view/repository/archive.zip?sha=08393dd1cc5c5bc72e232c5b18af68e064ec8362",
771
+ "reference": "08393dd1cc5c5bc72e232c5b18af68e064ec8362",
772
+ "shasum": ""
773
+ },
774
+ "require": {
775
+ "php": ">=5.5"
776
+ },
777
+ "require-dev": {
778
+ "10up/wp_mock": "*",
779
+ "mockery/mockery": "*",
780
+ "phpunit/phpunit": "<7",
781
+ "squizlabs/php_codesniffer": "^3.0.2",
782
+ "wimg/php-compatibility": "^8",
783
+ "wp-coding-standards/wpcs": "^0.14.1"
784
+ },
785
+ "time": "2018-10-18T13:44:18+00:00",
786
+ "type": "library",
787
+ "installation-source": "dist",
788
+ "autoload": {
789
+ "psr-4": {
790
+ "WPDesk\\View\\": "src/"
791
+ }
792
+ },
793
+ "notification-url": "https://packagist.org/downloads/",
794
+ "authors": [
795
+ {
796
+ "name": "Krzysiek",
797
+ "email": "krzysiek@wpdesk.pl"
798
+ }
799
+ ]
800
  }
801
  ]
vendor/composer/installers/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2012 Kyle Robinson Young
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
vendor/composer/installers/composer.json ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "composer/installers",
3
+ "type": "composer-plugin",
4
+ "license": "MIT",
5
+ "description": "A multi-framework Composer library installer",
6
+ "keywords": [
7
+ "installer",
8
+ "Aimeos",
9
+ "AGL",
10
+ "AnnotateCms",
11
+ "Attogram",
12
+ "Bitrix",
13
+ "CakePHP",
14
+ "Chef",
15
+ "Cockpit",
16
+ "CodeIgniter",
17
+ "concrete5",
18
+ "Craft",
19
+ "Croogo",
20
+ "DokuWiki",
21
+ "Dolibarr",
22
+ "Drupal",
23
+ "Elgg",
24
+ "Eliasis",
25
+ "ExpressionEngine",
26
+ "eZ Platform",
27
+ "FuelPHP",
28
+ "Grav",
29
+ "Hurad",
30
+ "ImageCMS",
31
+ "iTop",
32
+ "Joomla",
33
+ "Kanboard",
34
+ "Kohana",
35
+ "Lan Management System",
36
+ "Laravel",
37
+ "Lavalite",
38
+ "Lithium",
39
+ "Magento",
40
+ "majima",
41
+ "Mako",
42
+ "Mautic",
43
+ "Maya",
44
+ "MODX",
45
+ "MODX Evo",
46
+ "MediaWiki",
47
+ "OXID",
48
+ "osclass",
49
+ "MODULEWork",
50
+ "Moodle",
51
+ "Piwik",
52
+ "pxcms",
53
+ "phpBB",
54
+ "Plentymarkets",
55
+ "PPI",
56
+ "Puppet",
57
+ "Porto",
58
+ "RadPHP",
59
+ "ReIndex",
60
+ "Roundcube",
61
+ "shopware",
62
+ "SilverStripe",
63
+ "SMF",
64
+ "SyDES",
65
+ "symfony",
66
+ "Thelia",
67
+ "TYPO3",
68
+ "WolfCMS",
69
+ "WordPress",
70
+ "YAWIK",
71
+ "Zend",
72
+ "Zikula"
73
+ ],
74
+ "homepage": "https://composer.github.io/installers/",
75
+ "authors": [
76
+ {
77
+ "name": "Kyle Robinson Young",
78
+ "email": "kyle@dontkry.com",
79
+ "homepage": "https://github.com/shama"
80
+ }
81
+ ],
82
+ "autoload": {
83
+ "psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
84
+ },
85
+ "extra": {
86
+ "class": "Composer\\Installers\\Plugin",
87
+ "branch-alias": {
88
+ "dev-master": "1.0-dev"
89
+ }
90
+ },
91
+ "replace": {
92
+ "shama/baton": "*",
93
+ "roundcube/plugin-installer": "*"
94
+ },
95
+ "require": {
96
+ "composer-plugin-api": "^1.0"
97
+ },
98
+ "require-dev": {
99
+ "composer/composer": "1.0.*@dev",
100
+ "phpunit/phpunit": "^4.8.36"
101
+ },
102
+ "scripts": {
103
+ "test": "phpunit"
104
+ }
105
+ }
vendor/composer/installers/src/Composer/Installers/AglInstaller.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AglInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'More/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format package name to CamelCase
12
+ */
13
+ public function inflectPackageVars($vars)
14
+ {
15
+ $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
16
+ return strtoupper($matches[1]);
17
+ }, $vars['name']);
18
+
19
+ return $vars;
20
+ }
21
+ }
vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AimeosInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'ext/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AnnotateCmsInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'addons/modules/{$name}/',
8
+ 'component' => 'addons/components/{$name}/',
9
+ 'service' => 'addons/services/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AsgardInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'Modules/{$name}/',
8
+ 'theme' => 'Themes/{$name}/'
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type asgard-module, cut off a trailing '-plugin' if present.
15
+ *
16
+ * For package type asgard-theme, cut off a trailing '-theme' if present.
17
+ *
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ if ($vars['type'] === 'asgard-module') {
22
+ return $this->inflectPluginVars($vars);
23
+ }
24
+
25
+ if ($vars['type'] === 'asgard-theme') {
26
+ return $this->inflectThemeVars($vars);
27
+ }
28
+
29
+ return $vars;
30
+ }
31
+
32
+ protected function inflectPluginVars($vars)
33
+ {
34
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
35
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37
+
38
+ return $vars;
39
+ }
40
+
41
+ protected function inflectThemeVars($vars)
42
+ {
43
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
44
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46
+
47
+ return $vars;
48
+ }
49
+ }
vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class AttogramInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/BaseInstaller.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\IO\IOInterface;
5
+ use Composer\Composer;
6
+ use Composer\Package\PackageInterface;
7
+
8
+ abstract class BaseInstaller
9
+ {
10
+ protected $locations = array();
11
+ protected $composer;
12
+ protected $package;
13
+ protected $io;
14
+
15
+ /**
16
+ * Initializes base installer.
17
+ *
18
+ * @param PackageInterface $package
19
+ * @param Composer $composer
20
+ * @param IOInterface $io
21
+ */
22
+ public function __construct(PackageInterface $package = null, Composer $composer = null, IOInterface $io = null)
23
+ {
24
+ $this->composer = $composer;
25
+ $this->package = $package;
26
+ $this->io = $io;
27
+ }
28
+
29
+ /**
30
+ * Return the install path based on package type.
31
+ *
32
+ * @param PackageInterface $package
33
+ * @param string $frameworkType
34
+ * @return string
35
+ */
36
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
37
+ {
38
+ $type = $this->package->getType();
39
+
40
+ $prettyName = $this->package->getPrettyName();
41
+ if (strpos($prettyName, '/') !== false) {
42
+ list($vendor, $name) = explode('/', $prettyName);
43
+ } else {
44
+ $vendor = '';
45
+ $name = $prettyName;
46
+ }
47
+
48
+ $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
49
+
50
+ $extra = $package->getExtra();
51
+ if (!empty($extra['installer-name'])) {
52
+ $availableVars['name'] = $extra['installer-name'];
53
+ }
54
+
55
+ if ($this->composer->getPackage()) {
56
+ $extra = $this->composer->getPackage()->getExtra();
57
+ if (!empty($extra['installer-paths'])) {
58
+ $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
59
+ if ($customPath !== false) {
60
+ return $this->templatePath($customPath, $availableVars);
61
+ }
62
+ }
63
+ }
64
+
65
+ $packageType = substr($type, strlen($frameworkType) + 1);
66
+ $locations = $this->getLocations();
67
+ if (!isset($locations[$packageType])) {
68
+ throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
69
+ }
70
+
71
+ return $this->templatePath($locations[$packageType], $availableVars);
72
+ }
73
+
74
+ /**
75
+ * For an installer to override to modify the vars per installer.
76
+ *
77
+ * @param array $vars
78
+ * @return array
79
+ */
80
+ public function inflectPackageVars($vars)
81
+ {
82
+ return $vars;
83
+ }
84
+
85
+ /**
86
+ * Gets the installer's locations
87
+ *
88
+ * @return array
89
+ */
90
+ public function getLocations()
91
+ {
92
+ return $this->locations;
93
+ }
94
+
95
+ /**
96
+ * Replace vars in a path
97
+ *
98
+ * @param string $path
99
+ * @param array $vars
100
+ * @return string
101
+ */
102
+ protected function templatePath($path, array $vars = array())
103
+ {
104
+ if (strpos($path, '{') !== false) {
105
+ extract($vars);
106
+ preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
107
+ if (!empty($matches[1])) {
108
+ foreach ($matches[1] as $var) {
109
+ $path = str_replace('{$' . $var . '}', $$var, $path);
110
+ }
111
+ }
112
+ }
113
+
114
+ return $path;
115
+ }
116
+
117
+ /**
118
+ * Search through a passed paths array for a custom install path.
119
+ *
120
+ * @param array $paths
121
+ * @param string $name
122
+ * @param string $type
123
+ * @param string $vendor = NULL
124
+ * @return string
125
+ */
126
+ protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
127
+ {
128
+ foreach ($paths as $path => $names) {
129
+ if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
130
+ return $path;
131
+ }
132
+ }
133
+
134
+ return false;
135
+ }
136
+ }
vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ use Composer\Util\Filesystem;
6
+
7
+ /**
8
+ * Installer for Bitrix Framework. Supported types of extensions:
9
+ * - `bitrix-d7-module` — copy the module to directory `bitrix/modules/<vendor>.<name>`.
10
+ * - `bitrix-d7-component` — copy the component to directory `bitrix/components/<vendor>/<name>`.
11
+ * - `bitrix-d7-template` — copy the template to directory `bitrix/templates/<vendor>_<name>`.
12
+ *
13
+ * You can set custom path to directory with Bitrix kernel in `composer.json`:
14
+ *
15
+ * ```json
16
+ * {
17
+ * "extra": {
18
+ * "bitrix-dir": "s1/bitrix"
19
+ * }
20
+ * }
21
+ * ```
22
+ *
23
+ * @author Nik Samokhvalov <nik@samokhvalov.info>
24
+ * @author Denis Kulichkin <onexhovia@gmail.com>
25
+ */
26
+ class BitrixInstaller extends BaseInstaller
27
+ {
28
+ protected $locations = array(
29
+ 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
30
+ 'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
31
+ 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
32
+ 'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
33
+ 'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
34
+ 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
35
+ );
36
+
37
+ /**
38
+ * @var array Storage for informations about duplicates at all the time of installation packages.
39
+ */
40
+ private static $checkedDuplicates = array();
41
+
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function inflectPackageVars($vars)
46
+ {
47
+ if ($this->composer->getPackage()) {
48
+ $extra = $this->composer->getPackage()->getExtra();
49
+
50
+ if (isset($extra['bitrix-dir'])) {
51
+ $vars['bitrix_dir'] = $extra['bitrix-dir'];
52
+ }
53
+ }
54
+
55
+ if (!isset($vars['bitrix_dir'])) {
56
+ $vars['bitrix_dir'] = 'bitrix';
57
+ }
58
+
59
+ return parent::inflectPackageVars($vars);
60
+ }
61
+
62
+ /**
63
+ * {@inheritdoc}
64
+ */
65
+ protected function templatePath($path, array $vars = array())
66
+ {
67
+ $templatePath = parent::templatePath($path, $vars);
68
+ $this->checkDuplicates($templatePath, $vars);
69
+
70
+ return $templatePath;
71
+ }
72
+
73
+ /**
74
+ * Duplicates search packages.
75
+ *
76
+ * @param string $path
77
+ * @param array $vars
78
+ */
79
+ protected function checkDuplicates($path, array $vars = array())
80
+ {
81
+ $packageType = substr($vars['type'], strlen('bitrix') + 1);
82
+ $localDir = explode('/', $vars['bitrix_dir']);
83
+ array_pop($localDir);
84
+ $localDir[] = 'local';
85
+ $localDir = implode('/', $localDir);
86
+
87
+ $oldPath = str_replace(
88
+ array('{$bitrix_dir}', '{$name}'),
89
+ array($localDir, $vars['name']),
90
+ $this->locations[$packageType]
91
+ );
92
+
93
+ if (in_array($oldPath, static::$checkedDuplicates)) {
94
+ return;
95
+ }
96
+
97
+ if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) {
98
+
99
+ $this->io->writeError(' <error>Duplication of packages:</error>');
100
+ $this->io->writeError(' <info>Package ' . $oldPath . ' will be called instead package ' . $path . '</info>');
101
+
102
+ while (true) {
103
+ switch ($this->io->ask(' <info>Delete ' . $oldPath . ' [y,n,?]?</info> ', '?')) {
104
+ case 'y':
105
+ $fs = new Filesystem();
106
+ $fs->removeDirectory($oldPath);
107
+ break 2;
108
+
109
+ case 'n':
110
+ break 2;
111
+
112
+ case '?':
113
+ default:
114
+ $this->io->writeError(array(
115
+ ' y - delete package ' . $oldPath . ' and to continue with the installation',
116
+ ' n - don\'t delete and to continue with the installation',
117
+ ));
118
+ $this->io->writeError(' ? - print help');
119
+ break;
120
+ }
121
+ }
122
+ }
123
+
124
+ static::$checkedDuplicates[] = $oldPath;
125
+ }
126
+ }
vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class BonefishInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'Packages/{$vendor}/{$name}/'
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\DependencyResolver\Pool;
5
+
6
+ class CakePHPInstaller extends BaseInstaller
7
+ {
8
+ protected $locations = array(
9
+ 'plugin' => 'Plugin/{$name}/',
10
+ );
11
+
12
+ /**
13
+ * Format package name to CamelCase
14
+ */
15
+ public function inflectPackageVars($vars)
16
+ {
17
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
18
+ return $vars;
19
+ }
20
+
21
+ $nameParts = explode('/', $vars['name']);
22
+ foreach ($nameParts as &$value) {
23
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
24
+ $value = str_replace(array('-', '_'), ' ', $value);
25
+ $value = str_replace(' ', '', ucwords($value));
26
+ }
27
+ $vars['name'] = implode('/', $nameParts);
28
+
29
+ return $vars;
30
+ }
31
+
32
+ /**
33
+ * Change the default plugin location when cakephp >= 3.0
34
+ */
35
+ public function getLocations()
36
+ {
37
+ if ($this->matchesCakeVersion('>=', '3.0.0')) {
38
+ $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
39
+ }
40
+ return $this->locations;
41
+ }
42
+
43
+ /**
44
+ * Check if CakePHP version matches against a version
45
+ *
46
+ * @param string $matcher
47
+ * @param string $version
48
+ * @return bool
49
+ */
50
+ protected function matchesCakeVersion($matcher, $version)
51
+ {
52
+ if (class_exists('Composer\Semver\Constraint\MultiConstraint')) {
53
+ $multiClass = 'Composer\Semver\Constraint\MultiConstraint';
54
+ $constraintClass = 'Composer\Semver\Constraint\Constraint';
55
+ } else {
56
+ $multiClass = 'Composer\Package\LinkConstraint\MultiConstraint';
57
+ $constraintClass = 'Composer\Package\LinkConstraint\VersionConstraint';
58
+ }
59
+
60
+ $repositoryManager = $this->composer->getRepositoryManager();
61
+ if ($repositoryManager) {
62
+ $repos = $repositoryManager->getLocalRepository();
63
+ if (!$repos) {
64
+ return false;
65
+ }
66
+ $cake3 = new $multiClass(array(
67
+ new $constraintClass($matcher, $version),
68
+ new $constraintClass('!=', '9999999-dev'),
69
+ ));
70
+ $pool = new Pool('dev');
71
+ $pool->addRepository($repos);
72
+ $packages = $pool->whatProvides('cakephp/cakephp');
73
+ foreach ($packages as $package) {
74
+ $installed = new $constraintClass('=', $package->getVersion());
75
+ if ($cake3->matches($installed)) {
76
+ return true;
77
+ }
78
+ }
79
+ }
80
+ return false;
81
+ }
82
+ }
vendor/composer/installers/src/Composer/Installers/ChefInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ChefInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'cookbook' => 'Chef/{$vendor}/{$name}/',
8
+ 'role' => 'Chef/roles/{$name}/',
9
+ );
10
+ }
11
+
vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CiviCrmInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'ext' => 'ext/{$name}/'
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ClanCatsFrameworkInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'ship' => 'CCF/orbit/{$name}/',
8
+ 'theme' => 'CCF/app/themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CockpitInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'cockpit/modules/addons/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format module name.
12
+ *
13
+ * Strip `module-` prefix from package name.
14
+ *
15
+ * @param array @vars
16
+ *
17
+ * @return array
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ if ($vars['type'] == 'cockpit-module') {
22
+ return $this->inflectModuleVars($vars);
23
+ }
24
+
25
+ return $vars;
26
+ }
27
+
28
+ public function inflectModuleVars($vars)
29
+ {
30
+ $vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name']));
31
+
32
+ return $vars;
33
+ }
34
+ }
vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CodeIgniterInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'application/libraries/{$name}/',
8
+ 'third-party' => 'application/third_party/{$name}/',
9
+ 'module' => 'application/modules/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class Concrete5Installer extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'core' => 'concrete/',
8
+ 'block' => 'application/blocks/{$name}/',
9
+ 'package' => 'packages/{$name}/',
10
+ 'theme' => 'application/themes/{$name}/',
11
+ 'update' => 'updates/{$name}/',
12
+ );
13
+ }
vendor/composer/installers/src/Composer/Installers/CraftInstaller.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Installer for Craft Plugins
6
+ */
7
+ class CraftInstaller extends BaseInstaller
8
+ {
9
+ const NAME_PREFIX = 'craft';
10
+ const NAME_SUFFIX = 'plugin';
11
+
12
+ protected $locations = array(
13
+ 'plugin' => 'craft/plugins/{$name}/',
14
+ );
15
+
16
+ /**
17
+ * Strip `craft-` prefix and/or `-plugin` suffix from package names
18
+ *
19
+ * @param array $vars
20
+ *
21
+ * @return array
22
+ */
23
+ final public function inflectPackageVars($vars)
24
+ {
25
+ return $this->inflectPluginVars($vars);
26
+ }
27
+
28
+ private function inflectPluginVars($vars)
29
+ {
30
+ $vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']);
31
+ $vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']);
32
+
33
+ return $vars;
34
+ }
35
+ }
vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class CroogoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'Plugin/{$name}/',
8
+ 'theme' => 'View/Themed/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name to CamelCase
13
+ */
14
+ public function inflectPackageVars($vars)
15
+ {
16
+ $vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
17
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
18
+
19
+ return $vars;
20
+ }
21
+ }
vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class DecibelInstaller extends BaseInstaller
5
+ {
6
+ /** @var array */
7
+ protected $locations = array(
8
+ 'app' => 'app/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class DokuWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'lib/plugins/{$name}/',
8
+ 'template' => 'lib/tpl/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type dokuwiki-plugin, cut off a trailing '-plugin',
15
+ * or leading dokuwiki_ if present.
16
+ *
17
+ * For package type dokuwiki-template, cut off a trailing '-template' if present.
18
+ *
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+
23
+ if ($vars['type'] === 'dokuwiki-plugin') {
24
+ return $this->inflectPluginVars($vars);
25
+ }
26
+
27
+ if ($vars['type'] === 'dokuwiki-template') {
28
+ return $this->inflectTemplateVars($vars);
29
+ }
30
+
31
+ return $vars;
32
+ }
33
+
34
+ protected function inflectPluginVars($vars)
35
+ {
36
+ $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
37
+ $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
38
+
39
+ return $vars;
40
+ }
41
+
42
+ protected function inflectTemplateVars($vars)
43
+ {
44
+ $vars['name'] = preg_replace('/-template$/', '', $vars['name']);
45
+ $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
46
+
47
+ return $vars;
48
+ }
49
+
50
+ }
vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Class DolibarrInstaller
6
+ *
7
+ * @package Composer\Installers
8
+ * @author Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
9
+ */
10
+ class DolibarrInstaller extends BaseInstaller
11
+ {
12
+ //TODO: Add support for scripts and themes
13
+ protected $locations = array(
14
+ 'module' => 'htdocs/custom/{$name}/',
15
+ );
16
+ }
vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class DrupalInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'core' => 'core/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'theme' => 'themes/{$name}/',
10
+ 'library' => 'libraries/{$name}/',
11
+ 'profile' => 'profiles/{$name}/',
12
+ 'drush' => 'drush/{$name}/',
13
+ 'custom-theme' => 'themes/custom/{$name}/',
14
+ 'custom-module' => 'modules/custom/{$name}/',
15
+ );
16
+ }
vendor/composer/installers/src/Composer/Installers/ElggInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ElggInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'mod/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class EliasisInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'component' => 'components/{$name}/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'plugin' => 'plugins/{$name}/',
10
+ 'template' => 'templates/{$name}/',
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Package\PackageInterface;
5
+
6
+ class ExpressionEngineInstaller extends BaseInstaller
7
+ {
8
+
9
+ protected $locations = array();
10
+
11
+ private $ee2Locations = array(
12
+ 'addon' => 'system/expressionengine/third_party/{$name}/',
13
+ 'theme' => 'themes/third_party/{$name}/',
14
+ );
15
+
16
+ private $ee3Locations = array(
17
+ 'addon' => 'system/user/addons/{$name}/',
18
+ 'theme' => 'themes/user/{$name}/',
19
+ );
20
+
21
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
22
+ {
23
+
24
+ $version = "{$frameworkType}Locations";
25
+ $this->locations = $this->$version;
26
+
27
+ return parent::getInstallPath($package, $frameworkType);
28
+ }
29
+ }
vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class EzPlatformInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'meta-assets' => 'web/assets/ezplatform/',
8
+ 'assets' => 'web/assets/ezplatform/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/FuelInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class FuelInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'fuel/app/modules/{$name}/',
8
+ 'package' => 'fuel/packages/{$name}/',
9
+ 'theme' => 'fuel/app/themes/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class FuelphpInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'component' => 'components/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/GravInstaller.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class GravInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'user/plugins/{$name}/',
8
+ 'theme' => 'user/themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name
13
+ *
14
+ * @param array $vars
15
+ *
16
+ * @return array
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ $restrictedWords = implode('|', array_keys($this->locations));
21
+
22
+ $vars['name'] = strtolower($vars['name']);
23
+ $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
24
+ '$1',
25
+ $vars['name']
26
+ );
27
+
28
+ return $vars;
29
+ }
30
+ }
vendor/composer/installers/src/Composer/Installers/HuradInstaller.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class HuradInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ 'theme' => 'plugins/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name to CamelCase
13
+ */
14
+ public function inflectPackageVars($vars)
15
+ {
16
+ $nameParts = explode('/', $vars['name']);
17
+ foreach ($nameParts as &$value) {
18
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
19
+ $value = str_replace(array('-', '_'), ' ', $value);
20
+ $value = str_replace(' ', '', ucwords($value));
21
+ }
22
+ $vars['name'] = implode('/', $nameParts);
23
+ return $vars;
24
+ }
25
+ }
vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ImageCMSInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'template' => 'templates/{$name}/',
8
+ 'module' => 'application/modules/{$name}/',
9
+ 'library' => 'application/libraries/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/Installer.php ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ use Composer\Composer;
6
+ use Composer\Installer\BinaryInstaller;
7
+ use Composer\Installer\LibraryInstaller;
8
+ use Composer\IO\IOInterface;
9
+ use Composer\Package\PackageInterface;
10
+ use Composer\Repository\InstalledRepositoryInterface;
11
+ use Composer\Util\Filesystem;
12
+
13
+ class Installer extends LibraryInstaller
14
+ {
15
+
16
+ /**
17
+ * Package types to installer class map
18
+ *
19
+ * @var array
20
+ */
21
+ private $supportedTypes = array(
22
+ 'aimeos' => 'AimeosInstaller',
23
+ 'asgard' => 'AsgardInstaller',
24
+ 'attogram' => 'AttogramInstaller',
25
+ 'agl' => 'AglInstaller',
26
+ 'annotatecms' => 'AnnotateCmsInstaller',
27
+ 'bitrix' => 'BitrixInstaller',
28
+ 'bonefish' => 'BonefishInstaller',
29
+ 'cakephp' => 'CakePHPInstaller',
30
+ 'chef' => 'ChefInstaller',
31
+ 'civicrm' => 'CiviCrmInstaller',
32
+ 'ccframework' => 'ClanCatsFrameworkInstaller',
33
+ 'cockpit' => 'CockpitInstaller',
34
+ 'codeigniter' => 'CodeIgniterInstaller',
35
+ 'concrete5' => 'Concrete5Installer',
36
+ 'craft' => 'CraftInstaller',
37
+ 'croogo' => 'CroogoInstaller',
38
+ 'dokuwiki' => 'DokuWikiInstaller',
39
+ 'dolibarr' => 'DolibarrInstaller',
40
+ 'decibel' => 'DecibelInstaller',
41
+ 'drupal' => 'DrupalInstaller',
42
+ 'elgg' => 'ElggInstaller',
43
+ 'eliasis' => 'EliasisInstaller',
44
+ 'ee3' => 'ExpressionEngineInstaller',
45
+ 'ee2' => 'ExpressionEngineInstaller',
46
+ 'ezplatform' => 'EzPlatformInstaller',
47
+ 'fuel' => 'FuelInstaller',
48
+ 'fuelphp' => 'FuelphpInstaller',
49
+ 'grav' => 'GravInstaller',
50
+ 'hurad' => 'HuradInstaller',
51
+ 'imagecms' => 'ImageCMSInstaller',
52
+ 'itop' => 'ItopInstaller',
53
+ 'joomla' => 'JoomlaInstaller',
54
+ 'kanboard' => 'KanboardInstaller',
55
+ 'kirby' => 'KirbyInstaller',
56
+ 'kodicms' => 'KodiCMSInstaller',
57
+ 'kohana' => 'KohanaInstaller',
58
+ 'lms' => 'LanManagementSystemInstaller',
59
+ 'laravel' => 'LaravelInstaller',
60
+ 'lavalite' => 'LavaLiteInstaller',
61
+ 'lithium' => 'LithiumInstaller',
62
+ 'magento' => 'MagentoInstaller',
63
+ 'majima' => 'MajimaInstaller',
64
+ 'mako' => 'MakoInstaller',
65
+ 'maya' => 'MayaInstaller',
66
+ 'mautic' => 'MauticInstaller',
67
+ 'mediawiki' => 'MediaWikiInstaller',
68
+ 'microweber' => 'MicroweberInstaller',
69
+ 'modulework' => 'MODULEWorkInstaller',
70
+ 'modx' => 'ModxInstaller',
71
+ 'modxevo' => 'MODXEvoInstaller',
72
+ 'moodle' => 'MoodleInstaller',
73
+ 'october' => 'OctoberInstaller',
74
+ 'ontowiki' => 'OntoWikiInstaller',
75
+ 'oxid' => 'OxidInstaller',
76
+ 'osclass' => 'OsclassInstaller',
77
+ 'pxcms' => 'PxcmsInstaller',
78
+ 'phpbb' => 'PhpBBInstaller',
79
+ 'pimcore' => 'PimcoreInstaller',
80
+ 'piwik' => 'PiwikInstaller',
81
+ 'plentymarkets'=> 'PlentymarketsInstaller',
82
+ 'ppi' => 'PPIInstaller',
83
+ 'puppet' => 'PuppetInstaller',
84
+ 'radphp' => 'RadPHPInstaller',
85
+ 'phifty' => 'PhiftyInstaller',
86
+ 'porto' => 'PortoInstaller',
87
+ 'redaxo' => 'RedaxoInstaller',
88
+ 'reindex' => 'ReIndexInstaller',
89
+ 'roundcube' => 'RoundcubeInstaller',
90
+ 'shopware' => 'ShopwareInstaller',
91
+ 'sitedirect' => 'SiteDirectInstaller',
92
+ 'silverstripe' => 'SilverStripeInstaller',
93
+ 'smf' => 'SMFInstaller',
94
+ 'sydes' => 'SyDESInstaller',
95
+ 'symfony1' => 'Symfony1Installer',
96
+ 'thelia' => 'TheliaInstaller',
97
+ 'tusk' => 'TuskInstaller',
98
+ 'typo3-cms' => 'TYPO3CmsInstaller',
99
+ 'typo3-flow' => 'TYPO3FlowInstaller',
100
+ 'userfrosting' => 'UserFrostingInstaller',
101
+ 'vanilla' => 'VanillaInstaller',
102
+ 'whmcs' => 'WHMCSInstaller',
103
+ 'wolfcms' => 'WolfCMSInstaller',
104
+ 'wordpress' => 'WordPressInstaller',
105
+ 'yawik' => 'YawikInstaller',
106
+ 'zend' => 'ZendInstaller',
107
+ 'zikula' => 'ZikulaInstaller',
108
+ 'prestashop' => 'PrestashopInstaller'
109
+ );
110
+
111
+ /**
112
+ * Installer constructor.
113
+ *
114
+ * Disables installers specified in main composer extra installer-disable
115
+ * list
116
+ *
117
+ * @param IOInterface $io
118
+ * @param Composer $composer
119
+ * @param string $type
120
+ * @param Filesystem|null $filesystem
121
+ * @param BinaryInstaller|null $binaryInstaller
122
+ */
123
+ public function __construct(
124
+ IOInterface $io,
125
+ Composer $composer,
126
+ $type = 'library',
127
+ Filesystem $filesystem = null,
128
+ BinaryInstaller $binaryInstaller = null
129
+ ) {
130
+ parent::__construct($io, $composer, $type, $filesystem,
131
+ $binaryInstaller);
132
+ $this->removeDisabledInstallers();
133
+ }
134
+
135
+ /**
136
+ * {@inheritDoc}
137
+ */
138
+ public function getInstallPath(PackageInterface $package)
139
+ {
140
+ $type = $package->getType();
141
+ $frameworkType = $this->findFrameworkType($type);
142
+
143
+ if ($frameworkType === false) {
144
+ throw new \InvalidArgumentException(
145
+ 'Sorry the package type of this package is not yet supported.'
146
+ );
147
+ }
148
+
149
+ $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
150
+ $installer = new $class($package, $this->composer, $this->getIO());
151
+
152
+ return $installer->getInstallPath($package, $frameworkType);
153
+ }
154
+
155
+ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
156
+ {
157
+ parent::uninstall($repo, $package);
158
+ $installPath = $this->getPackageBasePath($package);
159
+ $this->io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
160
+ }
161
+
162
+ /**
163
+ * {@inheritDoc}
164
+ */
165
+ public function supports($packageType)
166
+ {
167
+ $frameworkType = $this->findFrameworkType($packageType);
168
+
169
+ if ($frameworkType === false) {
170
+ return false;
171
+ }
172
+
173
+ $locationPattern = $this->getLocationPattern($frameworkType);
174
+
175
+ return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1;
176
+ }
177
+
178
+ /**
179
+ * Finds a supported framework type if it exists and returns it
180
+ *
181
+ * @param string $type
182
+ * @return string
183
+ */
184
+ protected function findFrameworkType($type)
185
+ {
186
+ $frameworkType = false;
187
+
188
+ krsort($this->supportedTypes);
189
+
190
+ foreach ($this->supportedTypes as $key => $val) {
191
+ if ($key === substr($type, 0, strlen($key))) {
192
+ $frameworkType = substr($type, 0, strlen($key));
193
+ break;
194
+ }
195
+ }
196
+
197
+ return $frameworkType;
198
+ }
199
+
200
+ /**
201
+ * Get the second part of the regular expression to check for support of a
202
+ * package type
203
+ *
204
+ * @param string $frameworkType
205
+ * @return string
206
+ */
207
+ protected function getLocationPattern($frameworkType)
208
+ {
209
+ $pattern = false;
210
+ if (!empty($this->supportedTypes[$frameworkType])) {
211
+ $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType];
212
+ /** @var BaseInstaller $framework */
213
+ $framework = new $frameworkClass(null, $this->composer, $this->getIO());
214
+ $locations = array_keys($framework->getLocations());
215
+ $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
216
+ }
217
+
218
+ return $pattern ? : '(\w+)';
219
+ }
220
+
221
+ /**
222
+ * Get I/O object
223
+ *
224
+ * @return IOInterface
225
+ */
226
+ private function getIO()
227
+ {
228
+ return $this->io;
229
+ }
230
+
231
+ /**
232
+ * Look for installers set to be disabled in composer's extra config and
233
+ * remove them from the list of supported installers.
234
+ *
235
+ * Globals:
236
+ * - true, "all", and "*" - disable all installers.
237
+ * - false - enable all installers (useful with
238
+ * wikimedia/composer-merge-plugin or similar)
239
+ *
240
+ * @return void
241
+ */
242
+ protected function removeDisabledInstallers()
243
+ {
244
+ $extra = $this->composer->getPackage()->getExtra();
245
+
246
+ if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
247
+ // No installers are disabled
248
+ return;
249
+ }
250
+
251
+ // Get installers to disable
252
+ $disable = $extra['installer-disable'];
253
+
254
+ // Ensure $disabled is an array
255
+ if (!is_array($disable)) {
256
+ $disable = array($disable);
257
+ }
258
+
259
+ // Check which installers should be disabled
260
+ $all = array(true, "all", "*");
261
+ $intersect = array_intersect($all, $disable);
262
+ if (!empty($intersect)) {
263
+ // Disable all installers
264
+ $this->supportedTypes = array();
265
+ } else {
266
+ // Disable specified installers
267
+ foreach ($disable as $key => $installer) {
268
+ if (is_string($installer) && key_exists($installer, $this->supportedTypes)) {
269
+ unset($this->supportedTypes[$installer]);
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
vendor/composer/installers/src/Composer/Installers/ItopInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ItopInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'extensions/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class JoomlaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'component' => 'components/{$name}/',
8
+ 'module' => 'modules/{$name}/',
9
+ 'template' => 'templates/{$name}/',
10
+ 'plugin' => 'plugins/{$name}/',
11
+ 'library' => 'libraries/{$name}/',
12
+ );
13
+
14
+ // TODO: Add inflector for mod_ and com_ names
15
+ }
vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ *
6
+ * Installer for kanboard plugins
7
+ *
8
+ * kanboard.net
9
+ *
10
+ * Class KanboardInstaller
11
+ * @package Composer\Installers
12
+ */
13
+ class KanboardInstaller extends BaseInstaller
14
+ {
15
+ protected $locations = array(
16
+ 'plugin' => 'plugins/{$name}/',
17
+ );
18
+ }
vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KirbyInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'site/plugins/{$name}/',
8
+ 'field' => 'site/fields/{$name}/',
9
+ 'tag' => 'site/tags/{$name}/'
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KodiCMSInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'cms/plugins/{$name}/',
8
+ 'media' => 'cms/media/vendor/{$name}/'
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class KohanaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class LanManagementSystemInstaller extends BaseInstaller
6
+ {
7
+
8
+ protected $locations = array(
9
+ 'plugin' => 'plugins/{$name}/',
10
+ 'template' => 'templates/{$name}/',
11
+ 'document-template' => 'documents/templates/{$name}/',
12
+ 'userpanel-module' => 'userpanel/modules/{$name}/',
13
+ );
14
+
15
+ /**
16
+ * Format package name to CamelCase
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
21
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
22
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
23
+
24
+ return $vars;
25
+ }
26
+
27
+ }
vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class LaravelInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'libraries/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class LavaLiteInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'packages/{$vendor}/{$name}/',
8
+ 'theme' => 'public/themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class LithiumInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'libraries/{$name}/',
8
+ 'source' => 'libraries/_source/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MODULEWorkInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle MODX Evolution specifics when installing packages.
6
+ */
7
+ class MODXEvoInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'snippet' => 'assets/snippets/{$name}/',
11
+ 'plugin' => 'assets/plugins/{$name}/',
12
+ 'module' => 'assets/modules/{$name}/',
13
+ 'template' => 'assets/templates/{$name}/',
14
+ 'lib' => 'assets/lib/{$name}/'
15
+ );
16
+ }
vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MagentoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'theme' => 'app/design/frontend/{$name}/',
8
+ 'skin' => 'skin/frontend/default/{$name}/',
9
+ 'library' => 'lib/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Plugin/theme installer for majima
6
+ * @author David Neustadt
7
+ */
8
+ class MajimaInstaller extends BaseInstaller
9
+ {
10
+ protected $locations = array(
11
+ 'plugin' => 'plugins/{$name}/',
12
+ );
13
+
14
+ /**
15
+ * Transforms the names
16
+ * @param array $vars
17
+ * @return array
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ return $this->correctPluginName($vars);
22
+ }
23
+
24
+ /**
25
+ * Change hyphenated names to camelcase
26
+ * @param array $vars
27
+ * @return array
28
+ */
29
+ private function correctPluginName($vars)
30
+ {
31
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
32
+ return strtoupper($matches[0][1]);
33
+ }, $vars['name']);
34
+ $vars['name'] = ucfirst($camelCasedName);
35
+ return $vars;
36
+ }
37
+ }
vendor/composer/installers/src/Composer/Installers/MakoInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MakoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'package' => 'app/packages/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/MauticInstaller.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MauticInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name of mautic-plugins to CamelCase
13
+ */
14
+ public function inflectPackageVars($vars)
15
+ {
16
+ if ($vars['type'] == 'mautic-plugin') {
17
+ $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
18
+ return strtoupper($matches[0][1]);
19
+ }, ucfirst($vars['name']));
20
+ }
21
+
22
+ return $vars;
23
+ }
24
+
25
+ }
vendor/composer/installers/src/Composer/Installers/MayaInstaller.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MayaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format package name.
12
+ *
13
+ * For package type maya-module, cut off a trailing '-module' if present.
14
+ *
15
+ */
16
+ public function inflectPackageVars($vars)
17
+ {
18
+ if ($vars['type'] === 'maya-module') {
19
+ return $this->inflectModuleVars($vars);
20
+ }
21
+
22
+ return $vars;
23
+ }
24
+
25
+ protected function inflectModuleVars($vars)
26
+ {
27
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
28
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
29
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
30
+
31
+ return $vars;
32
+ }
33
+ }
vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MediaWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'core' => 'core/',
8
+ 'extension' => 'extensions/{$name}/',
9
+ 'skin' => 'skins/{$name}/',
10
+ );
11
+
12
+ /**
13
+ * Format package name.
14
+ *
15
+ * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
16
+ * to CamelCase keeping existing uppercase chars.
17
+ *
18
+ * For package type mediawiki-skin, cut off a trailing '-skin' if present.
19
+ *
20
+ */
21
+ public function inflectPackageVars($vars)
22
+ {
23
+
24
+ if ($vars['type'] === 'mediawiki-extension') {
25
+ return $this->inflectExtensionVars($vars);
26
+ }
27
+
28
+ if ($vars['type'] === 'mediawiki-skin') {
29
+ return $this->inflectSkinVars($vars);
30
+ }
31
+
32
+ return $vars;
33
+ }
34
+
35
+ protected function inflectExtensionVars($vars)
36
+ {
37
+ $vars['name'] = preg_replace('/-extension$/', '', $vars['name']);
38
+ $vars['name'] = str_replace('-', ' ', $vars['name']);
39
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
40
+
41
+ return $vars;
42
+ }
43
+
44
+ protected function inflectSkinVars($vars)
45
+ {
46
+ $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
47
+
48
+ return $vars;
49
+ }
50
+
51
+ }
vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MicroweberInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'userfiles/modules/{$name}/',
8
+ 'module-skin' => 'userfiles/modules/{$name}/templates/',
9
+ 'template' => 'userfiles/templates/{$name}/',
10
+ 'element' => 'userfiles/elements/{$name}/',
11
+ 'vendor' => 'vendor/{$name}/',
12
+ 'components' => 'components/{$name}/'
13
+ );
14
+
15
+ /**
16
+ * Format package name.
17
+ *
18
+ * For package type microweber-module, cut off a trailing '-module' if present
19
+ *
20
+ * For package type microweber-template, cut off a trailing '-template' if present.
21
+ *
22
+ */
23
+ public function inflectPackageVars($vars)
24
+ {
25
+ if ($vars['type'] === 'microweber-template') {
26
+ return $this->inflectTemplateVars($vars);
27
+ }
28
+ if ($vars['type'] === 'microweber-templates') {
29
+ return $this->inflectTemplatesVars($vars);
30
+ }
31
+ if ($vars['type'] === 'microweber-core') {
32
+ return $this->inflectCoreVars($vars);
33
+ }
34
+ if ($vars['type'] === 'microweber-adapter') {
35
+ return $this->inflectCoreVars($vars);
36
+ }
37
+ if ($vars['type'] === 'microweber-module') {
38
+ return $this->inflectModuleVars($vars);
39
+ }
40
+ if ($vars['type'] === 'microweber-modules') {
41
+ return $this->inflectModulesVars($vars);
42
+ }
43
+ if ($vars['type'] === 'microweber-skin') {
44
+ return $this->inflectSkinVars($vars);
45
+ }
46
+ if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
47
+ return $this->inflectElementVars($vars);
48
+ }
49
+
50
+ return $vars;
51
+ }
52
+
53
+ protected function inflectTemplateVars($vars)
54
+ {
55
+ $vars['name'] = preg_replace('/-template$/', '', $vars['name']);
56
+ $vars['name'] = preg_replace('/template-$/', '', $vars['name']);
57
+
58
+ return $vars;
59
+ }
60
+
61
+ protected function inflectTemplatesVars($vars)
62
+ {
63
+ $vars['name'] = preg_replace('/-templates$/', '', $vars['name']);
64
+ $vars['name'] = preg_replace('/templates-$/', '', $vars['name']);
65
+
66
+ return $vars;
67
+ }
68
+
69
+ protected function inflectCoreVars($vars)
70
+ {
71
+ $vars['name'] = preg_replace('/-providers$/', '', $vars['name']);
72
+ $vars['name'] = preg_replace('/-provider$/', '', $vars['name']);
73
+ $vars['name'] = preg_replace('/-adapter$/', '', $vars['name']);
74
+
75
+ return $vars;
76
+ }
77
+
78
+ protected function inflectModuleVars($vars)
79
+ {
80
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
81
+ $vars['name'] = preg_replace('/module-$/', '', $vars['name']);
82
+
83
+ return $vars;
84
+ }
85
+
86
+ protected function inflectModulesVars($vars)
87
+ {
88
+ $vars['name'] = preg_replace('/-modules$/', '', $vars['name']);
89
+ $vars['name'] = preg_replace('/modules-$/', '', $vars['name']);
90
+
91
+ return $vars;
92
+ }
93
+
94
+ protected function inflectSkinVars($vars)
95
+ {
96
+ $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
97
+ $vars['name'] = preg_replace('/skin-$/', '', $vars['name']);
98
+
99
+ return $vars;
100
+ }
101
+
102
+ protected function inflectElementVars($vars)
103
+ {
104
+ $vars['name'] = preg_replace('/-elements$/', '', $vars['name']);
105
+ $vars['name'] = preg_replace('/elements-$/', '', $vars['name']);
106
+ $vars['name'] = preg_replace('/-element$/', '', $vars['name']);
107
+ $vars['name'] = preg_replace('/element-$/', '', $vars['name']);
108
+
109
+ return $vars;
110
+ }
111
+ }
vendor/composer/installers/src/Composer/Installers/ModxInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle MODX specifics when installing packages.
6
+ */
7
+ class ModxInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'extra' => 'core/packages/{$name}/'
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class MoodleInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'mod' => 'mod/{$name}/',
8
+ 'admin_report' => 'admin/report/{$name}/',
9
+ 'atto' => 'lib/editor/atto/plugins/{$name}/',
10
+ 'tool' => 'admin/tool/{$name}/',
11
+ 'assignment' => 'mod/assignment/type/{$name}/',
12
+ 'assignsubmission' => 'mod/assign/submission/{$name}/',
13
+ 'assignfeedback' => 'mod/assign/feedback/{$name}/',
14
+ 'auth' => 'auth/{$name}/',
15
+ 'availability' => 'availability/condition/{$name}/',
16
+ 'block' => 'blocks/{$name}/',
17
+ 'booktool' => 'mod/book/tool/{$name}/',
18
+ 'cachestore' => 'cache/stores/{$name}/',
19
+ 'cachelock' => 'cache/locks/{$name}/',
20
+ 'calendartype' => 'calendar/type/{$name}/',
21
+ 'format' => 'course/format/{$name}/',
22
+ 'coursereport' => 'course/report/{$name}/',
23
+ 'datafield' => 'mod/data/field/{$name}/',
24
+ 'datapreset' => 'mod/data/preset/{$name}/',
25
+ 'editor' => 'lib/editor/{$name}/',
26
+ 'enrol' => 'enrol/{$name}/',
27
+ 'filter' => 'filter/{$name}/',
28
+ 'gradeexport' => 'grade/export/{$name}/',
29
+ 'gradeimport' => 'grade/import/{$name}/',
30
+ 'gradereport' => 'grade/report/{$name}/',
31
+ 'gradingform' => 'grade/grading/form/{$name}/',
32
+ 'local' => 'local/{$name}/',
33
+ 'logstore' => 'admin/tool/log/store/{$name}/',
34
+ 'ltisource' => 'mod/lti/source/{$name}/',
35
+ 'ltiservice' => 'mod/lti/service/{$name}/',
36
+ 'message' => 'message/output/{$name}/',
37
+ 'mnetservice' => 'mnet/service/{$name}/',
38
+ 'plagiarism' => 'plagiarism/{$name}/',
39
+ 'portfolio' => 'portfolio/{$name}/',
40
+ 'qbehaviour' => 'question/behaviour/{$name}/',
41
+ 'qformat' => 'question/format/{$name}/',
42
+ 'qtype' => 'question/type/{$name}/',
43
+ 'quizaccess' => 'mod/quiz/accessrule/{$name}/',
44
+ 'quiz' => 'mod/quiz/report/{$name}/',
45
+ 'report' => 'report/{$name}/',
46
+ 'repository' => 'repository/{$name}/',
47
+ 'scormreport' => 'mod/scorm/report/{$name}/',
48
+ 'search' => 'search/engine/{$name}/',
49
+ 'theme' => 'theme/{$name}/',
50
+ 'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
51
+ 'profilefield' => 'user/profile/field/{$name}/',
52
+ 'webservice' => 'webservice/{$name}/',
53
+ 'workshopallocation' => 'mod/workshop/allocation/{$name}/',
54
+ 'workshopeval' => 'mod/workshop/eval/{$name}/',
55
+ 'workshopform' => 'mod/workshop/form/{$name}/'
56
+ );
57
+ }
vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class OctoberInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ 'plugin' => 'plugins/{$vendor}/{$name}/',
9
+ 'theme' => 'themes/{$name}/'
10
+ );
11
+
12
+ /**
13
+ * Format package name.
14
+ *
15
+ * For package type october-plugin, cut off a trailing '-plugin' if present.
16
+ *
17
+ * For package type october-theme, cut off a trailing '-theme' if present.
18
+ *
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+ if ($vars['type'] === 'october-plugin') {
23
+ return $this->inflectPluginVars($vars);
24
+ }
25
+
26
+ if ($vars['type'] === 'october-theme') {
27
+ return $this->inflectThemeVars($vars);
28
+ }
29
+
30
+ return $vars;
31
+ }
32
+
33
+ protected function inflectPluginVars($vars)
34
+ {
35
+ $vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
36
+ $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
37
+
38
+ return $vars;
39
+ }
40
+
41
+ protected function inflectThemeVars($vars)
42
+ {
43
+ $vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
44
+
45
+ return $vars;
46
+ }
47
+ }
vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class OntoWikiInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'extensions/{$name}/',
8
+ 'theme' => 'extensions/themes/{$name}/',
9
+ 'translation' => 'extensions/translations/{$name}/',
10
+ );
11
+
12
+ /**
13
+ * Format package name to lower case and remove ".ontowiki" suffix
14
+ */
15
+ public function inflectPackageVars($vars)
16
+ {
17
+ $vars['name'] = strtolower($vars['name']);
18
+ $vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
19
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
20
+ $vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
21
+
22
+ return $vars;
23
+ }
24
+ }
vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+
5
+ class OsclassInstaller extends BaseInstaller
6
+ {
7
+
8
+ protected $locations = array(
9
+ 'plugin' => 'oc-content/plugins/{$name}/',
10
+ 'theme' => 'oc-content/themes/{$name}/',
11
+ 'language' => 'oc-content/languages/{$name}/',
12
+ );
13
+
14
+ }
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Package\PackageInterface;
5
+
6
+ class OxidInstaller extends BaseInstaller
7
+ {
8
+ const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
9
+
10
+ protected $locations = array(
11
+ 'module' => 'modules/{$name}/',
12
+ 'theme' => 'application/views/{$name}/',
13
+ 'out' => 'out/{$name}/',
14
+ );
15
+
16
+ /**
17
+ * getInstallPath
18
+ *
19
+ * @param PackageInterface $package
20
+ * @param string $frameworkType
21
+ * @return void
22
+ */
23
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+ {
25
+ $installPath = parent::getInstallPath($package, $frameworkType);
26
+ $type = $this->package->getType();
27
+ if ($type === 'oxid-module') {
28
+ $this->prepareVendorDirectory($installPath);
29
+ }
30
+ return $installPath;
31
+ }
32
+
33
+ /**
34
+ * prepareVendorDirectory
35
+ *
36
+ * Makes sure there is a vendormetadata.php file inside
37
+ * the vendor folder if there is a vendor folder.
38
+ *
39
+ * @param string $installPath
40
+ * @return void
41
+ */
42
+ protected function prepareVendorDirectory($installPath)
43
+ {
44
+ $matches = '';
45
+ $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
+ if (!$hasVendorDirectory) {
47
+ return;
48
+ }
49
+
50
+ $vendorDirectory = $matches['vendor'];
51
+ $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
+ if (!file_exists($vendorPath)) {
53
+ mkdir($vendorPath, 0755, true);
54
+ }
55
+
56
+ $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
+ touch($vendorMetaDataPath);
58
+ }
59
+ }
vendor/composer/installers/src/Composer/Installers/PPIInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PPIInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PhiftyInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'bundle' => 'bundles/{$name}/',
8
+ 'library' => 'libraries/{$name}/',
9
+ 'framework' => 'frameworks/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PhpBBInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'extension' => 'ext/{$vendor}/{$name}/',
8
+ 'language' => 'language/{$name}/',
9
+ 'style' => 'styles/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PimcoreInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Format package name to CamelCase
12
+ */
13
+ public function inflectPackageVars($vars)
14
+ {
15
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
16
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
17
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
18
+
19
+ return $vars;
20
+ }
21
+ }
vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Class PiwikInstaller
6
+ *
7
+ * @package Composer\Installers
8
+ */
9
+ class PiwikInstaller extends BaseInstaller
10
+ {
11
+ /**
12
+ * @var array
13
+ */
14
+ protected $locations = array(
15
+ 'plugin' => 'plugins/{$name}/',
16
+ );
17
+
18
+ /**
19
+ * Format package name to CamelCase
20
+ * @param array $vars
21
+ *
22
+ * @return array
23
+ */
24
+ public function inflectPackageVars($vars)
25
+ {
26
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
27
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
28
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
29
+
30
+ return $vars;
31
+ }
32
+ }
vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PlentymarketsInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => '{$name}/'
8
+ );
9
+
10
+ /**
11
+ * Remove hyphen, "plugin" and format to camelcase
12
+ * @param array $vars
13
+ *
14
+ * @return array
15
+ */
16
+ public function inflectPackageVars($vars)
17
+ {
18
+ $vars['name'] = explode("-", $vars['name']);
19
+ foreach ($vars['name'] as $key => $name) {
20
+ $vars['name'][$key] = ucfirst($vars['name'][$key]);
21
+ if (strcasecmp($name, "Plugin") == 0) {
22
+ unset($vars['name'][$key]);
23
+ }
24
+ }
25
+ $vars['name'] = implode("",$vars['name']);
26
+
27
+ return $vars;
28
+ }
29
+ }
vendor/composer/installers/src/Composer/Installers/Plugin.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ use Composer\Composer;
6
+ use Composer\IO\IOInterface;
7
+ use Composer\Plugin\PluginInterface;
8
+
9
+ class Plugin implements PluginInterface
10
+ {
11
+
12
+ public function activate(Composer $composer, IOInterface $io)
13
+ {
14
+ $installer = new Installer($io, $composer);
15
+ $composer->getInstallationManager()->addInstaller($installer);
16
+ }
17
+ }
vendor/composer/installers/src/Composer/Installers/PortoInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PortoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'container' => 'app/Containers/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PrestashopInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class PuppetInstaller extends BaseInstaller
6
+ {
7
+
8
+ protected $locations = array(
9
+ 'module' => 'modules/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class PxcmsInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'app/Modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * @param array $vars
15
+ *
16
+ * @return array
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ if ($vars['type'] === 'pxcms-module') {
21
+ return $this->inflectModuleVars($vars);
22
+ }
23
+
24
+ if ($vars['type'] === 'pxcms-theme') {
25
+ return $this->inflectThemeVars($vars);
26
+ }
27
+
28
+ return $vars;
29
+ }
30
+
31
+ /**
32
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
33
+ *
34
+ * return string
35
+ */
36
+ protected function inflectModuleVars($vars)
37
+ {
38
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39
+ $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40
+ $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
43
+
44
+ return $vars;
45
+ }
46
+
47
+
48
+ /**
49
+ * For package type pxcms-module, cut off a trailing '-plugin' if present.
50
+ *
51
+ * return string
52
+ */
53
+ protected function inflectThemeVars($vars)
54
+ {
55
+ $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56
+ $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58
+ $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59
+ $vars['name'] = ucwords($vars['name']); // make module name camelcased
60
+
61
+ return $vars;
62
+ }
63
+ }
vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class RadPHPInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'bundle' => 'src/{$name}/'
8
+ );
9
+
10
+ /**
11
+ * Format package name to CamelCase
12
+ */
13
+ public function inflectPackageVars($vars)
14
+ {
15
+ $nameParts = explode('/', $vars['name']);
16
+ foreach ($nameParts as &$value) {
17
+ $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
18
+ $value = str_replace(array('-', '_'), ' ', $value);
19
+ $value = str_replace(' ', '', ucwords($value));
20
+ }
21
+ $vars['name'] = implode('/', $nameParts);
22
+ return $vars;
23
+ }
24
+ }
vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ReIndexInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'theme' => 'themes/{$name}/',
8
+ 'plugin' => 'plugins/{$name}/'
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class RedaxoInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'addon' => 'redaxo/include/addons/{$name}/',
8
+ 'bestyle-plugin' => 'redaxo/include/addons/be_style/plugins/{$name}/'
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class RoundcubeInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ );
9
+
10
+ /**
11
+ * Lowercase name and changes the name to a underscores
12
+ *
13
+ * @param array $vars
14
+ * @return array
15
+ */
16
+ public function inflectPackageVars($vars)
17
+ {
18
+ $vars['name'] = strtolower(str_replace('-', '_', $vars['name']));
19
+
20
+ return $vars;
21
+ }
22
+ }
vendor/composer/installers/src/Composer/Installers/SMFInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class SMFInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'Sources/{$name}/',
8
+ 'theme' => 'Themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Plugin/theme installer for shopware
6
+ * @author Benjamin Boit
7
+ */
8
+ class ShopwareInstaller extends BaseInstaller
9
+ {
10
+ protected $locations = array(
11
+ 'backend-plugin' => 'engine/Shopware/Plugins/Local/Backend/{$name}/',
12
+ 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/',
13
+ 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/',
14
+ 'theme' => 'templates/{$name}/',
15
+ 'plugin' => 'custom/plugins/{$name}/',
16
+ 'frontend-theme' => 'themes/Frontend/{$name}/',
17
+ );
18
+
19
+ /**
20
+ * Transforms the names
21
+ * @param array $vars
22
+ * @return array
23
+ */
24
+ public function inflectPackageVars($vars)
25
+ {
26
+ if ($vars['type'] === 'shopware-theme') {
27
+ return $this->correctThemeName($vars);
28
+ }
29
+
30
+ return $this->correctPluginName($vars);
31
+ }
32
+
33
+ /**
34
+ * Changes the name to a camelcased combination of vendor and name
35
+ * @param array $vars
36
+ * @return array
37
+ */
38
+ private function correctPluginName($vars)
39
+ {
40
+ $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
41
+ return strtoupper($matches[0][1]);
42
+ }, $vars['name']);
43
+
44
+ $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
45
+
46
+ return $vars;
47
+ }
48
+
49
+ /**
50
+ * Changes the name to a underscore separated name
51
+ * @param array $vars
52
+ * @return array
53
+ */
54
+ private function correctThemeName($vars)
55
+ {
56
+ $vars['name'] = str_replace('-', '_', $vars['name']);
57
+
58
+ return $vars;
59
+ }
60
+ }
vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ use Composer\Package\PackageInterface;
5
+
6
+ class SilverStripeInstaller extends BaseInstaller
7
+ {
8
+ protected $locations = array(
9
+ 'module' => '{$name}/',
10
+ 'theme' => 'themes/{$name}/',
11
+ );
12
+
13
+ /**
14
+ * Return the install path based on package type.
15
+ *
16
+ * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
17
+ * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
18
+ *
19
+ * @param PackageInterface $package
20
+ * @param string $frameworkType
21
+ * @return string
22
+ */
23
+ public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+ {
25
+ if (
26
+ $package->getName() == 'silverstripe/framework'
27
+ && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
28
+ && version_compare($package->getVersion(), '2.999.999') < 0
29
+ ) {
30
+ return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
31
+ }
32
+
33
+ return parent::getInstallPath($package, $frameworkType);
34
+ }
35
+ }
vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class SiteDirectInstaller extends BaseInstaller
6
+ {
7
+ protected $locations = array(
8
+ 'module' => 'modules/{$vendor}/{$name}/',
9
+ 'plugin' => 'plugins/{$vendor}/{$name}/'
10
+ );
11
+
12
+ public function inflectPackageVars($vars)
13
+ {
14
+ return $this->parseVars($vars);
15
+ }
16
+
17
+ protected function parseVars($vars)
18
+ {
19
+ $vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
20
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
21
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
22
+
23
+ return $vars;
24
+ }
25
+ }
vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class SyDESInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'app/modules/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+
11
+ /**
12
+ * Format module name.
13
+ *
14
+ * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
15
+ *
16
+ * @param array @vars
17
+ *
18
+ * @return array
19
+ */
20
+ public function inflectPackageVars($vars)
21
+ {
22
+ if ($vars['type'] == 'sydes-module') {
23
+ return $this->inflectModuleVars($vars);
24
+ }
25
+
26
+ if ($vars['type'] === 'sydes-theme') {
27
+ return $this->inflectThemeVars($vars);
28
+ }
29
+
30
+ return $vars;
31
+ }
32
+
33
+ public function inflectModuleVars($vars)
34
+ {
35
+ $vars['name'] = preg_replace('/(^sydes-|-module$)/i', '', $vars['name']);
36
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
37
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
38
+
39
+ return $vars;
40
+ }
41
+
42
+ protected function inflectThemeVars($vars)
43
+ {
44
+ $vars['name'] = preg_replace('/(^sydes-|-theme$)/', '', $vars['name']);
45
+ $vars['name'] = strtolower($vars['name']);
46
+
47
+ return $vars;
48
+ }
49
+ }
vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Plugin installer for symfony 1.x
6
+ *
7
+ * @author Jérôme Tamarelle <jerome@tamarelle.net>
8
+ */
9
+ class Symfony1Installer extends BaseInstaller
10
+ {
11
+ protected $locations = array(
12
+ 'plugin' => 'plugins/{$name}/',
13
+ );
14
+
15
+ /**
16
+ * Format package name to CamelCase
17
+ */
18
+ public function inflectPackageVars($vars)
19
+ {
20
+ $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
21
+ return strtoupper($matches[0][1]);
22
+ }, $vars['name']);
23
+
24
+ return $vars;
25
+ }
26
+ }
vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * Extension installer for TYPO3 CMS
6
+ *
7
+ * @deprecated since 1.0.25, use https://packagist.org/packages/typo3/cms-composer-installers instead
8
+ *
9
+ * @author Sascha Egerer <sascha.egerer@dkd.de>
10
+ */
11
+ class TYPO3CmsInstaller extends BaseInstaller
12
+ {
13
+ protected $locations = array(
14
+ 'extension' => 'typo3conf/ext/{$name}/',
15
+ );
16
+ }
vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ /**
5
+ * An installer to handle TYPO3 Flow specifics when installing packages.
6
+ */
7
+ class TYPO3FlowInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'package' => 'Packages/Application/{$name}/',
11
+ 'framework' => 'Packages/Framework/{$name}/',
12
+ 'plugin' => 'Packages/Plugins/{$name}/',
13
+ 'site' => 'Packages/Sites/{$name}/',
14
+ 'boilerplate' => 'Packages/Boilerplates/{$name}/',
15
+ 'build' => 'Build/{$name}/',
16
+ );
17
+
18
+ /**
19
+ * Modify the package name to be a TYPO3 Flow style key.
20
+ *
21
+ * @param array $vars
22
+ * @return array
23
+ */
24
+ public function inflectPackageVars($vars)
25
+ {
26
+ $autoload = $this->package->getAutoload();
27
+ if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) {
28
+ $namespace = key($autoload['psr-0']);
29
+ $vars['name'] = str_replace('\\', '.', $namespace);
30
+ }
31
+ if (isset($autoload['psr-4']) && is_array($autoload['psr-4'])) {
32
+ $namespace = key($autoload['psr-4']);
33
+ $vars['name'] = rtrim(str_replace('\\', '.', $namespace), '.');
34
+ }
35
+
36
+ return $vars;
37
+ }
38
+ }
vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class TheliaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'local/modules/{$name}/',
8
+ 'frontoffice-template' => 'templates/frontOffice/{$name}/',
9
+ 'backoffice-template' => 'templates/backOffice/{$name}/',
10
+ 'email-template' => 'templates/email/{$name}/',
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/TuskInstaller.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+ /**
4
+ * Composer installer for 3rd party Tusk utilities
5
+ * @author Drew Ewing <drew@phenocode.com>
6
+ */
7
+ class TuskInstaller extends BaseInstaller
8
+ {
9
+ protected $locations = array(
10
+ 'task' => '.tusk/tasks/{$name}/',
11
+ 'command' => '.tusk/commands/{$name}/',
12
+ 'asset' => 'assets/tusk/{$name}/',
13
+ );
14
+ }
vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class UserFrostingInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'sprinkle' => 'app/sprinkles/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class VanillaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'plugins/{$name}/',
8
+ 'theme' => 'themes/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class VgmcpInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'bundle' => 'src/{$vendor}/{$name}/',
8
+ 'theme' => 'themes/{$name}/'
9
+ );
10
+
11
+ /**
12
+ * Format package name.
13
+ *
14
+ * For package type vgmcp-bundle, cut off a trailing '-bundle' if present.
15
+ *
16
+ * For package type vgmcp-theme, cut off a trailing '-theme' if present.
17
+ *
18
+ */
19
+ public function inflectPackageVars($vars)
20
+ {
21
+ if ($vars['type'] === 'vgmcp-bundle') {
22
+ return $this->inflectPluginVars($vars);
23
+ }
24
+
25
+ if ($vars['type'] === 'vgmcp-theme') {
26
+ return $this->inflectThemeVars($vars);
27
+ }
28
+
29
+ return $vars;
30
+ }
31
+
32
+ protected function inflectPluginVars($vars)
33
+ {
34
+ $vars['name'] = preg_replace('/-bundle$/', '', $vars['name']);
35
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37
+
38
+ return $vars;
39
+ }
40
+
41
+ protected function inflectThemeVars($vars)
42
+ {
43
+ $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
44
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46
+
47
+ return $vars;
48
+ }
49
+ }
vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer\Installers;
4
+
5
+ class WHMCSInstaller extends BaseInstaller
6
+ {
7
+ protected $locations = array(
8
+ 'gateway' => 'modules/gateways/{$name}/',
9
+ );
10
+ }
vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class WolfCMSInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'wolf/plugins/{$name}/',
8
+ );
9
+ }
vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class WordPressInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'plugin' => 'wp-content/plugins/{$name}/',
8
+ 'theme' => 'wp-content/themes/{$name}/',
9
+ 'muplugin' => 'wp-content/mu-plugins/{$name}/',
10
+ 'dropin' => 'wp-content/{$name}/',
11
+ );
12
+ }
vendor/composer/installers/src/Composer/Installers/YawikInstaller.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: cbleek
5
+ * Date: 25.03.16
6
+ * Time: 20:55
7
+ */
8
+
9
+ namespace Composer\Installers;
10
+
11
+
12
+ class YawikInstaller extends BaseInstaller
13
+ {
14
+ protected $locations = array(
15
+ 'module' => 'module/{$name}/',
16
+ );
17
+
18
+ /**
19
+ * Format package name to CamelCase
20
+ * @param array $vars
21
+ *
22
+ * @return array
23
+ */
24
+ public function inflectPackageVars($vars)
25
+ {
26
+ $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
27
+ $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
28
+ $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
29
+
30
+ return $vars;
31
+ }
32
+ }
vendor/composer/installers/src/Composer/Installers/ZendInstaller.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ZendInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'library' => 'library/{$name}/',
8
+ 'extra' => 'extras/library/{$name}/',
9
+ 'module' => 'module/{$name}/',
10
+ );
11
+ }
vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Composer\Installers;
3
+
4
+ class ZikulaInstaller extends BaseInstaller
5
+ {
6
+ protected $locations = array(
7
+ 'module' => 'modules/{$vendor}-{$name}/',
8
+ 'theme' => 'themes/{$vendor}-{$name}/'
9
+ );
10
+ }
vendor/composer/installers/src/bootstrap.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function includeIfExists($file)
3
+ {
4
+ if (file_exists($file)) {
5
+ return include $file;
6
+ }
7
+ }
8
+ if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
9
+ die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
10
+ 'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
11
+ 'php composer.phar install'.PHP_EOL);
12
+ }
13
+ return $loader;
vendor/moneyphp/money/.scrutinizer.yml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ filter:
2
+ paths: [src/*]
3
+ checks:
4
+ php:
5
+ code_rating: true
6
+ duplication: true
7
+ tools:
8
+ external_code_coverage:
9
+ runs: 2
vendor/moneyphp/money/CHANGELOG.md ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+
4
+ All notable changes to this project will be documented in this file.
5
+
6
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
7
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
8
+
9
+
10
+ ## [Unreleased]
11
+
12
+
13
+ ## [3.1.3] - 2018-02-16
14
+
15
+ ### Fixed
16
+
17
+ - Allocation when the amount is smaller than the number of ratios
18
+
19
+
20
+ ## [3.1.2] - 2018-02-16
21
+
22
+ ### Added
23
+
24
+ - `Number::fromNumber` to be used when the actual type is not known
25
+
26
+ ### Changed
27
+
28
+ - Refactored `Number` usage to make the code cleaner and use less casting
29
+
30
+ ### Fixed
31
+
32
+ - Float cast to string issue on certain locales
33
+
34
+
35
+ ## [3.1.1] - 2018-01-19
36
+
37
+ ### Fixed
38
+
39
+ - Float cast to string issue on certain locales
40
+ - Deal with numbers represented with E-XX
41
+
42
+
43
+ ## [3.1.0] - 2018-01-10
44
+
45
+ ### Added
46
+
47
+ - CurrencyList to instantiate in-memory currencies
48
+ - modulus method to Money
49
+ - ratioOf method to Money
50
+ - Comparator for easier testing Money object with PHPUnit
51
+ - IntlLocalizedDecimalParser and IntlLocalizedDecimalFormatter
52
+
53
+ ### Changed
54
+
55
+ - `MoneyParser::parse` method now expects a Currency object
56
+ - Dropped PHP 5.5
57
+
58
+ ### Deprecated
59
+
60
+ - Passing currency code as string to `MoneyParser::parse`
61
+
62
+ ### Fixed
63
+
64
+ - Do not allocate remainder to a ratio of zero
65
+ - Conversion result is always 0 when subunit difference is large enough
66
+ - Unexpected result when converting small Bitcoin amounts
67
+ - Fixed StyleCI being too aggressive
68
+
69
+
70
+ ## [3.0.9] - 2017-11-05
71
+
72
+ ### Fixed
73
+
74
+ - Bitcoin currency symbol
75
+
76
+
77
+ ## [3.0.8] - 2017-10-03
78
+
79
+ ### Fixed
80
+
81
+ - Rounding issue in Number class.
82
+ - Reduce composer package file size by leaving out docs and logo.
83
+ - Missing Travis tests for PHP 7.2.
84
+
85
+
86
+ ## [3.0.7] - 2017-08-07
87
+
88
+ ### Changed
89
+
90
+ - Currencies
91
+
92
+
93
+ ## [3.0.6] - 2017-07-25
94
+
95
+ ### Added
96
+
97
+ - IndirectExchange: a way to get an exchange rate through a minimal set of intermediate conversions.
98
+
99
+ ### Fixed
100
+
101
+ - Tests for HHVM
102
+ - Incorrect documentation on Bitcoin parser
103
+
104
+
105
+ ## [3.0.5] - 2017-04-26
106
+
107
+ ### Added
108
+
109
+ - numericCodeFor method to ISOCurrencies
110
+
111
+
112
+ ## [3.0.4] - 2017-04-21
113
+
114
+ ### Added
115
+
116
+ - Negative method
117
+
118
+ ### Changed
119
+
120
+ - Updated ISO Currencies
121
+ - Removed old Belarusian ruble from ISOCurrencies (BYR)
122
+
123
+ ### Fixed
124
+
125
+ - ISOCurrencies will no longer have a blank currency
126
+ - Double symbol when formatting negative Bitcoin amounts
127
+
128
+
129
+ ## [3.0.3] - 2017-03-22
130
+
131
+ ### Fixed
132
+
133
+ - Parsing empty strings and number starting or ending with a decimal point for DecimalMoneyParser
134
+ - Parsing zero for DecimalMoneyParser
135
+ - Multiplying and dividing with a locale that use commas as separator
136
+
137
+ ## [3.0.2] - 2017-03-11
138
+
139
+ ### Fixed
140
+
141
+ - BCMath / GMP: comparing values smaller than one
142
+ - GMP: multiplying with zero
143
+ - ISOCurrencies: minor refactoring, remove duplication of code
144
+
145
+
146
+ ## [3.0.1] - 2017-02-14
147
+
148
+ ### Added
149
+
150
+ - Reversed Currencies Exchange to try resolving reverse of a currency pair
151
+ - Documentation on allowed integer(ish) values when constructing Money
152
+
153
+ ### Fixed
154
+
155
+ - Passing integer validation when chunk started with a dash
156
+ - Passing integer validation when the fractional part started with a dash
157
+ - Formatting problem for Bitcoin currency with small amounts in PHP < 7.0
158
+ - Money constructed from a string with fractional zeroes equals to a Money constructed without the fractional part (eg. `'5.00'` and `'5'`)
159
+
160
+
161
+ ## [3.0.0] - 2016-10-26
162
+
163
+ ### Added
164
+
165
+ - DecimalMoneyFormatter: returns locale-independent raw decimal string
166
+
167
+ ### Changed
168
+
169
+ - **[BC break]** Replaced StringToUnitsParser with DecimalMoneyParser
170
+ - **[BC break]** Moved `Money\Exception\Exception` to `Money\Exception`
171
+ - **[BC break]** UnkownCurrencyException is now DomainException instead of RuntimeException
172
+ - **[Doctrine break]** In `Currency` the private variable `name` was renamed to `code`, which could break your Doctrine mapping if you are using embeddables or any other Reflection related implementation.
173
+
174
+
175
+ ## [3.0.0-beta.3] - 2016-10-04
176
+
177
+ ### Added
178
+
179
+ - FixedExchange: returns fixed exchange rates based on a list (array)
180
+
181
+ ### Changed
182
+
183
+ - **[BC break]** Convert method now moved to its own class: Converter
184
+ - **[BC break]** Exchange had one method getCurrencyPair which is now renamed to quote
185
+ - Minor documentation issues
186
+
187
+ ### Fixed
188
+
189
+ - Integer detection when the number overflows the integer type and contains zeros
190
+ - Rounding numbers containg trailing zeros
191
+ - Converting Money to currency with different number of subunits
192
+
193
+
194
+ ## [3.0.0-beta.2] - 2016-08-03
195
+
196
+ ### Added
197
+
198
+ - PHP Spec tests
199
+ - absolute method to Money and Calculator
200
+ - subunitFor method to Currencies
201
+ - Currencies now extends IteratorAggregate
202
+ - Library exceptions now implement a common interface
203
+ - Formatter and Parser implementation are now rounding half up
204
+
205
+ ### Changed
206
+
207
+ - **[BC break]** Dropped PHP 5.4 support
208
+ - **[BC break]** Intl and Bitcoin formatters and parsers now require Currencies
209
+ - ISOCurrencies now uses moneyphp/iso-currencies as currency data source
210
+
211
+ ### Fixed
212
+
213
+ - Documentation to be inline with upcoming version 3
214
+ - Rounding issues in calculators with negative numbers
215
+ - Formatting and parser issues for amounts and numbers with a trailing zero
216
+ - Improved many exception messages
217
+ - Registration of own Calculator implementations
218
+
219
+
220
+ ## [3.0.0-beta] - 2016-03-01
221
+
222
+ ### Added
223
+
224
+ - Bitcoin parser and formatter
225
+ - Also checking tests folder for StyleCI
226
+
227
+ ### Fixed
228
+
229
+ - Currencies are now included in the repo
230
+ - Currency list generation moved to dev dependency: reduces repo size
231
+ - BC Math calculator adding and subtracting failed when bcscale was set
232
+ - Parsing zero for StringToUnitsParser
233
+
234
+
235
+ ## 3.0.0-alpha - 2016-02-04
236
+
237
+ ### Added
238
+
239
+ - Currency repositories (ISO currencies included)
240
+ - Money exchange (including [Swap](https://github.com/florianv/swap) implementation)
241
+ - Money formatting (including intl formatter)
242
+ - Money parsing (including intl parser)
243
+ - Big integer support utilizing different, transparent calculation logic upon availability (bcmath, gmp, plain php)
244
+ - Money and Currency implements JsonSerializable
245
+ - Rounding up and down
246
+ - Allocation to N targets
247
+
248
+ ### Changed
249
+
250
+ - **[BC break]** Money::getAmount() returns a string instead of an int value
251
+ - **[BC break]** Moved stringToUnits to StringToUnitsParser parser
252
+ - Library requires at least PHP 5.4
253
+ - Library uses PSR-4
254
+
255
+ ### Fixed
256
+
257
+ - Integer overflow
258
+
259
+ ### Removed
260
+
261
+ - **[BC break]** UnkownCurrency exception
262
+ - **[BC break]** Currency list is now provided by [umpirsky/currency-list](https://github.com/umpirsky/currency-list/)
263
+ - **[BC break]** RoundingMode class
264
+ - **[BC break]** Announced deprecations are removed (Currency::getName, CurrencyPair::getRatio, Money::getUnits)
265
+
266
+
267
+ ## Pre 3.0
268
+
269
+ - 2015-03-23 Minimum php version is now 5.4
270
+ - 2015-03-23 JsonSerializable
271
+ - (... missing changelog because who remembers to document stuff anyway?)
272
+ - 2014-03-22 Removed \Money\InvalidArgumentException in favour of plain old InvalidArgumentException
273
+ - 2014-03-22 Introduce RoundingMode object, used to specify desired rounding
274
+ - 2014-03-22 Introduced RoundingMode backwards compatible API changes to Money::multiply and Money::divide
275
+ - 2014-03-22 Allow RoundingMode to be specified when converting currencies
276
+ - 2014-03-22 CurrencyPair has an equals() method
277
+ - 2013-10-13 Base currency and counter currency in CurrencyPair named correctly.
278
+ - 2013-01-08 Removed the Doctrine2\MoneyType helper, to be replaced by something better in the future. It's available
279
+ at https://gist.github.com/4485025 in case you need it.
280
+ - 2013-01-08 Use vendor/autoload.php instead of lib/bootstrap.php (or use PSR-0 autolaoding)
281
+ - 2012-12-10 Renamed Money::getUnits() to Money::getAmount()
282
+
283
+
284
+ [Unreleased]: https://github.com/moneyphp/money/compare/v3.1.3...HEAD
285
+ [3.1.3]: https://github.com/moneyphp/money/compare/v3.1.2...v3.1.3
286
+ [3.1.2]: https://github.com/moneyphp/money/compare/v3.1.1...v3.1.2
287
+ [3.1.1]: https://github.com/moneyphp/money/compare/v3.1.0...v3.1.1
288
+ [3.1.0]: https://github.com/moneyphp/money/compare/v3.0.9...v3.1.0
289
+ [3.0.9]: https://github.com/moneyphp/money/compare/v3.0.8...v3.0.9
290
+ [3.0.8]: https://github.com/moneyphp/money/compare/v3.0.7...v3.0.8
291
+ [3.0.7]: https://github.com/moneyphp/money/compare/v3.0.6...v3.0.7
292
+ [3.0.6]: https://github.com/moneyphp/money/compare/v3.0.5...v3.0.6
293
+ [3.0.5]: https://github.com/moneyphp/money/compare/v3.0.4...v3.0.5
294
+ [3.0.4]: https://github.com/moneyphp/money/compare/v3.0.3...v3.0.4
295
+ [3.0.3]: https://github.com/moneyphp/money/compare/v3.0.2...v3.0.3
296
+ [3.0.2]: https://github.com/moneyphp/money/compare/v3.0.1...v3.0.2
297
+ [3.0.1]: https://github.com/moneyphp/money/compare/v3.0.0...v3.0.1
298
+ [3.0.0]: https://github.com/moneyphp/money/compare/v3.0.0-beta.4...v3.0.0
299
+ [3.0.0-beta4]: https://github.com/moneyphp/money/compare/v3.0.0-beta.3...v3.0.0-beta.4
300
+ [3.0.0-beta3]: https://github.com/moneyphp/money/compare/v3.0.0-beta.2...v3.0.0-beta.3
301
+ [3.0.0-beta2]: https://github.com/moneyphp/money/compare/v3.0.0-beta...v3.0.0-beta.2
302
+ [3.0.0-beta]: https://github.com/moneyphp/money/compare/v3.0.0-alpha...v3.0.0-beta
vendor/moneyphp/money/Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM php:7.2-cli
2
+
3
+ RUN set -xe \
4
+ && apt-get update \
5
+ && apt-get install -qqy libicu-dev locales libgmp-dev \
6
+ && docker-php-ext-install -j$(nproc) intl bcmath gmp
7
+
8
+ RUN set -xe \
9
+ && echo en_US ISO-8859-1 >> /etc/locale.gen \
10
+ && echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \
11
+ && echo en_CA ISO-8859-1 >> /etc/locale.gen \
12
+ && echo en_CA.UTF-8 UTF-8 >> /etc/locale.gen \
13
+ && echo es_ES ISO-8859-1 >> /etc/locale.gen \
14
+ && echo es_ES.UTF-8 UTF-8 >> /etc/locale.gen \
15
+ && echo ru_RU ISO-8859-5 >> /etc/locale.gen \
16
+ && echo ru_RU.UTF-8 UTF-8 >> /etc/locale.gen \
17
+ && locale-gen \
18
+ && update-locale
vendor/moneyphp/money/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2011-2016 Mathias Verraes
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
vendor/moneyphp/money/README.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Money
2
+
3
+ [![Latest Version](https://img.shields.io/github/release/moneyphp/money.svg?style=flat-square)](https://github.com/moneyphp/money/releases)
4
+ [![Build Status](https://img.shields.io/travis/moneyphp/money.svg?style=flat-square)](https://travis-ci.org/moneyphp/money)
5
+ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/moneyphp/money.svg?style=flat-square)](https://scrutinizer-ci.com/g/moneyphp/money)
6
+ [![Quality Score](https://img.shields.io/scrutinizer/g/moneyphp/money.svg?style=flat-square)](https://scrutinizer-ci.com/g/moneyphp/money)
7
+ [![Total Downloads](https://img.shields.io/packagist/dt/moneyphp/money.svg?style=flat-square)](https://packagist.org/packages/moneyphp/money)
8
+
9
+ [![Email](https://img.shields.io/badge/email-team@moneyphp.org-blue.svg?style=flat-square)](mailto:team@moneyphp.org)
10
+
11
+ ![Money PHP](/resources/logo.png?raw=true)
12
+
13
+ PHP library to make working with money safer, easier, and fun!
14
+
15
+ > "If I had a dime for every time I've seen someone use FLOAT to store currency, I'd have $999.997634" -- [Bill Karwin](https://twitter.com/billkarwin/status/347561901460447232)
16
+
17
+ In short: You shouldn't represent monetary values by a float. Wherever
18
+ you need to represent money, use this Money value object. Since version
19
+ 3.0 this library uses [strings internally](https://github.com/moneyphp/money/pull/136)
20
+ in order to support unlimited integers.
21
+
22
+ ```php
23
+ <?php
24
+
25
+ use Money\Money;
26
+
27
+ $fiveEur = Money::EUR(500);
28
+ $tenEur = $fiveEur->add($fiveEur);
29
+
30
+ list($part1, $part2, $part3) = $tenEur->allocate(array(1, 1, 1));
31
+ assert($part1->equals(Money::EUR(334)));
32
+ assert($part2->equals(Money::EUR(333)));
33
+ assert($part3->equals(Money::EUR(333)));
34
+ ```
35
+
36
+ The documentation is available at http://moneyphp.org
37
+
38
+
39
+ ## Requirements
40
+
41
+ PHP 5.6+. Other than that, this library has no external requirements. MoneyPHP will not provide any support to
42
+ PHP versions that are [not supported by the language itself](http://php.net/supported-versions.php). There might be
43
+ additional dependencies for specific feature, e.g. the swap implementation.
44
+
45
+
46
+ ## Install
47
+
48
+ Via Composer
49
+
50
+ ```bash
51
+ $ composer require moneyphp/money
52
+ ```
53
+
54
+
55
+ ## Features
56
+
57
+ - JSON Serialization
58
+ - Big integer support utilizing different, transparent calculation logic upon availability (bcmath, gmp, plain php)
59
+ - Money formatting (including intl formatter)
60
+ - Currency repositories (ISO currencies included)
61
+ - Money exchange (including [Swap](http://swap.voutzinos.org) implementation)
62
+
63
+
64
+ ## Documentation
65
+
66
+ Please see the [official documentation](http://moneyphp.org).
67
+
68
+
69
+ ## Testing
70
+
71
+ We try to follow BDD and TDD, as such we use both [phpspec](http://www.phpspec.net) and [phpunit](https://phpunit.de) to test this library.
72
+
73
+ ```bash
74
+ $ composer test
75
+ ```
76
+
77
+ ### Running the tests in Docker
78
+
79
+ Money requires a set of dependencies, so you might want to run it in Docker.
80
+
81
+ First, build the image locally:
82
+
83
+ ```bash
84
+ $ docker build -t moneyphp .
85
+ ```
86
+
87
+ Then run the tests:
88
+
89
+ ```bash
90
+ $ docker run --rm -it -v $PWD:/app -w /app moneyphp vendor/bin/phpunit --exclude-group segmentation
91
+ ```
92
+
93
+
94
+ ## Contributing
95
+
96
+ We would love to see you helping us to make this library better and better.
97
+ Please keep in mind we do not use suffixes and prefixes in class names,
98
+ so not `CurrenciesInterface`, but `Currencies`. Other than that, Style CI will help you
99
+ using the same code style as we are using. Please provide tests when creating a PR and clear descriptions of bugs when filing issues.
100
+
101
+
102
+ ## Security
103
+
104
+ If you discover any security related issues, please contact us at [team@moneyphp.org](mailto:team@moneyphp.org).
105
+
106
+
107
+ ## License
108
+
109
+ The MIT License (MIT). Please see [License File](LICENSE) for more information.
110
+
111
+
112
+ ## Acknowledgements
113
+
114
+ This library is heavily inspired by [Martin Fowler's Money pattern](http://martinfowler.com/eaaCatalog/money.html).
115
+ A special remark goes to [Mathias Verraes](https://github.com/mathiasverraes), without his contributions,
116
+ in code and via his [blog](http://verraes.net/#blog), this library would not be where it stands now.
vendor/moneyphp/money/composer.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "moneyphp/money",
3
+ "description": "PHP implementation of Fowler's Money pattern",
4
+ "keywords": ["money", "vo", "value object"],
5
+ "homepage": "http://verraes.net/2011/04/fowler-money-pattern-in-php/",
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "Mathias Verraes",
10
+ "email": "mathias@verraes.net",
11
+ "homepage": "http://verraes.net"
12
+ },
13
+ {
14
+ "name": "Márk Sági-Kazár",
15
+ "email": "mark.sagi-kazar@gmail.com"
16
+ },
17
+ {
18
+ "name": "Frederik Bosch",
19
+ "email": "f.bosch@genkgo.nl"
20
+ }
21
+ ],
22
+ "require": {
23
+ "php": ">=5.6"
24
+ },
25
+ "require-dev": {
26
+ "phpunit/phpunit": "^5",
27
+ "symfony/phpunit-bridge": "^4",
28
+ "ext-bcmath": "*",
29
+ "ext-gmp": "*",
30
+ "ext-intl": "*",
31
+ "florianv/swap": "^3.0",
32
+ "psr/cache": "^1.0",
33
+ "cache/taggable-cache": "^0.4.0",
34
+ "phpspec/phpspec": "^3.0",
35
+ "leanphp/phpspec-code-coverage": "^3.0 || ^4.0",
36
+ "doctrine/instantiator": "^1.0.5",
37
+ "moneyphp/iso-currencies": "^3.0",
38
+ "sllh/php-cs-fixer-styleci-bridge": "^2.1",
39
+ "php-http/message": "^1.4",
40
+ "php-http/mock-client": "^0.3.3"
41
+ },
42
+ "suggest": {
43
+ "ext-bcmath": "Calculate without integer limits",
44
+ "ext-gmp": "Calculate without integer limits",
45
+ "ext-intl": "Format Money objects with intl",
46
+ "florianv/swap": "Exchange rates library for PHP",
47
+ "psr/cache-implementation": "Used for Currency caching"
48
+ },
49
+ "autoload": {
50
+ "psr-4": {
51
+ "Money\\": "src/"
52
+ }
53
+ },
54
+ "autoload-dev": {
55
+ "psr-4": {
56
+ "Tests\\Money\\": "tests/",
57
+ "spec\\Money\\": "spec/"
58
+ }
59
+ },
60
+ "scripts": {
61
+ "test": [
62
+ "vendor/bin/phpspec run",
63
+ "vendor/bin/phpunit -v"
64
+ ],
65
+ "test-ci": [
66
+ "vendor/bin/phpspec run -c phpspec.ci.yml",
67
+ "vendor/bin/phpunit -v --coverage-text --coverage-clover=build/unit_coverage.xml"
68
+ ],
69
+ "update-currencies": "cp vendor/moneyphp/iso-currencies/resources/current.php resources/currency.php"
70
+ },
71
+ "extra": {
72
+ "branch-alias": {
73
+ "dev-master": "3.0-dev"
74
+ }
75
+ }
76
+ }
vendor/moneyphp/money/resources/currency.php ADDED
@@ -0,0 +1,1248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php return array (
2
+ 'AFN' =>
3
+ array (
4
+ 'alphabeticCode' => 'AFN',
5
+ 'currency' => 'Afghani',
6
+ 'minorUnit' => 2,
7
+ 'numericCode' => 971,
8
+ ),
9
+ 'EUR' =>
10
+ array (
11
+ 'alphabeticCode' => 'EUR',
12
+ 'currency' => 'Euro',
13
+ 'minorUnit' => 2,
14
+ 'numericCode' => 978,
15
+ ),
16
+ 'ALL' =>
17
+ array (
18
+ 'alphabeticCode' => 'ALL',
19
+ 'currency' => 'Lek',
20
+ 'minorUnit' => 2,
21
+ 'numericCode' => 8,
22
+ ),
23
+ 'DZD' =>
24
+ array (
25
+ 'alphabeticCode' => 'DZD',
26
+ 'currency' => 'Algerian Dinar',
27
+ 'minorUnit' => 2,
28
+ 'numericCode' => 12,
29
+ ),
30
+ 'USD' =>
31
+ array (
32
+ 'alphabeticCode' => 'USD',
33
+ 'currency' => 'US Dollar',
34
+ 'minorUnit' => 2,
35
+ 'numericCode' => 840,
36
+ ),
37
+ 'AOA' =>
38
+ array (
39
+ 'alphabeticCode' => 'AOA',
40
+ 'currency' => 'Kwanza',
41
+ 'minorUnit' => 2,
42
+ 'numericCode' => 973,
43
+ ),
44
+ 'XCD' =>
45
+ array (
46
+ 'alphabeticCode' => 'XCD',
47
+ 'currency' => 'East Caribbean Dollar',
48
+ 'minorUnit' => 2,
49
+ 'numericCode' => 951,
50
+ ),
51
+ 'ARS' =>
52
+ array (
53
+ 'alphabeticCode' => 'ARS',
54
+ 'currency' => 'Argentine Peso',
55
+ 'minorUnit' => 2,
56
+ 'numericCode' => 32,
57
+ ),
58
+ 'AMD' =>
59
+ array (
60
+ 'alphabeticCode' => 'AMD',
61
+ 'currency' => 'Armenian Dram',
62
+ 'minorUnit' => 2,
63
+ 'numericCode' => 51,
64
+ ),
65
+ 'AWG' =>
66
+ array (
67
+ 'alphabeticCode' => 'AWG',
68
+ 'currency' => 'Aruban Florin',
69
+ 'minorUnit' => 2,
70
+ 'numericCode' => 533,
71
+ ),
72
+ 'AUD' =>
73
+ array (
74
+ 'alphabeticCode' => 'AUD',
75
+ 'currency' => 'Australian Dollar',
76
+ 'minorUnit' => 2,
77
+ 'numericCode' => 36,
78
+ ),
79
+ 'AZN' =>
80
+ array (
81
+ 'alphabeticCode' => 'AZN',
82
+ 'currency' => 'Azerbaijan Manat',
83
+ 'minorUnit' => 2,
84
+ 'numericCode' => 944,
85
+ ),
86
+ 'BSD' =>
87
+ array (
88
+ 'alphabeticCode' => 'BSD',
89
+ 'currency' => 'Bahamian Dollar',
90
+ 'minorUnit' => 2,
91
+ 'numericCode' => 44,
92
+ ),
93
+ 'BHD' =>
94
+ array (
95
+ 'alphabeticCode' => 'BHD',
96
+ 'currency' => 'Bahraini Dinar',
97
+ 'minorUnit' => 3,
98
+ 'numericCode' => 48,
99
+ ),
100
+ 'BDT' =>
101
+ array (
102
+ 'alphabeticCode' => 'BDT',
103
+ 'currency' => 'Taka',
104
+ 'minorUnit' => 2,
105
+ 'numericCode' => 50,
106
+ ),
107
+ 'BBD' =>
108
+ array (
109
+ 'alphabeticCode' => 'BBD',
110
+ 'currency' => 'Barbados Dollar',
111
+ 'minorUnit' => 2,
112
+ 'numericCode' => 52,
113
+ ),
114
+ 'BYN' =>
115
+ array (
116
+ 'alphabeticCode' => 'BYN',
117
+ 'currency' => 'Belarusian Ruble',
118
+ 'minorUnit' => 2,
119
+ 'numericCode' => 933,
120
+ ),
121
+ 'BZD' =>
122
+ array (
123
+ 'alphabeticCode' => 'BZD',
124
+ 'currency' => 'Belize Dollar',
125
+ 'minorUnit' => 2,
126
+ 'numericCode' => 84,
127
+ ),
128
+ 'XOF' =>
129
+ array (
130
+ 'alphabeticCode' => 'XOF',
131
+ 'currency' => 'CFA Franc BCEAO',
132
+ 'minorUnit' => 0,
133
+ 'numericCode' => 952,
134
+ ),
135
+ 'BMD' =>
136
+ array (
137
+ 'alphabeticCode' => 'BMD',
138
+ 'currency' => 'Bermudian Dollar',
139
+ 'minorUnit' => 2,
140
+ 'numericCode' => 60,
141
+ ),
142
+ 'INR' =>
143
+ array (
144
+ 'alphabeticCode' => 'INR',
145
+ 'currency' => 'Indian Rupee',
146
+ 'minorUnit' => 2,
147
+ 'numericCode' => 356,
148
+ ),
149
+ 'BTN' =>
150
+ array (
151
+ 'alphabeticCode' => 'BTN',
152
+ 'currency' => 'Ngultrum',
153
+ 'minorUnit' => 2,
154
+ 'numericCode' => 64,
155
+ ),
156
+ 'BOB' =>
157
+ array (
158
+ 'alphabeticCode' => 'BOB',
159
+ 'currency' => 'Boliviano',
160
+ 'minorUnit' => 2,
161
+ 'numericCode' => 68,
162
+ ),
163
+ 'BOV' =>
164
+ array (
165
+ 'alphabeticCode' => 'BOV',
166
+ 'currency' => 'Mvdol',
167
+ 'minorUnit' => 2,
168
+ 'numericCode' => 984,
169
+ ),
170
+ 'BAM' =>
171
+ array (
172
+ 'alphabeticCode' => 'BAM',
173
+ 'currency' => 'Convertible Mark',
174
+ 'minorUnit' => 2,
175
+ 'numericCode' => 977,
176
+ ),
177
+ 'BWP' =>
178
+ array (
179
+ 'alphabeticCode' => 'BWP',
180
+ 'currency' => 'Pula',
181
+ 'minorUnit' => 2,
182
+ 'numericCode' => 72,
183
+ ),
184
+ 'NOK' =>
185
+ array (
186
+ 'alphabeticCode' => 'NOK',
187
+ 'currency' => 'Norwegian Krone',
188
+ 'minorUnit' => 2,
189
+ 'numericCode' => 578,
190
+ ),
191
+ 'BRL' =>
192
+ array (
193
+ 'alphabeticCode' => 'BRL',
194
+ 'currency' => 'Brazilian Real',
195
+ 'minorUnit' => 2,
196
+ 'numericCode' => 986,
197
+ ),
198
+ 'BND' =>
199
+ array (
200
+ 'alphabeticCode' => 'BND',
201
+ 'currency' => 'Brunei Dollar',
202
+ 'minorUnit' => 2,
203
+ 'numericCode' => 96,
204
+ ),
205
+ 'BGN' =>
206
+ array (
207
+ 'alphabeticCode' => 'BGN',
208
+ 'currency' => 'Bulgarian Lev',
209
+ 'minorUnit' => 2,
210
+ 'numericCode' => 975,
211
+ ),
212
+ 'BIF' =>
213
+ array (
214
+ 'alphabeticCode' => 'BIF',
215
+ 'currency' => 'Burundi Franc',
216
+ 'minorUnit' => 0,
217
+ 'numericCode' => 108,
218
+ ),
219
+ 'CVE' =>
220
+ array (
221
+ 'alphabeticCode' => 'CVE',
222
+ 'currency' => 'Cabo Verde Escudo',
223
+ 'minorUnit' => 2,
224
+ 'numericCode' => 132,
225
+ ),
226
+ 'KHR' =>
227
+ array (
228
+ 'alphabeticCode' => 'KHR',
229
+ 'currency' => 'Riel',
230
+ 'minorUnit' => 2,
231
+ 'numericCode' => 116,
232
+ ),
233
+ 'XAF' =>
234
+ array (
235
+ 'alphabeticCode' => 'XAF',
236
+ 'currency' => 'CFA Franc BEAC',
237
+ 'minorUnit' => 0,
238
+ 'numericCode' => 950,
239
+ ),
240
+ 'CAD' =>
241
+ array (
242
+ 'alphabeticCode' => 'CAD',
243
+ 'currency' => 'Canadian Dollar',
244
+ 'minorUnit' => 2,
245
+ 'numericCode' => 124,
246
+ ),
247
+ 'KYD' =>
248
+ array (
249
+ 'alphabeticCode' => 'KYD',
250
+ 'currency' => 'Cayman Islands Dollar',
251
+ 'minorUnit' => 2,
252
+ 'numericCode' => 136,
253
+ ),
254
+ 'CLP' =>
255
+ array (
256
+ 'alphabeticCode' => 'CLP',
257
+ 'currency' => 'Chilean Peso',
258
+ 'minorUnit' => 0,
259
+ 'numericCode' => 152,
260
+ ),
261
+ 'CLF' =>
262
+ array (
263
+ 'alphabeticCode' => 'CLF',
264
+ 'currency' => 'Unidad de Fomento',
265
+ 'minorUnit' => 4,
266
+ 'numericCode' => 990,
267
+ ),
268
+ 'CNY' =>
269
+ array (
270
+ 'alphabeticCode' => 'CNY',
271
+ 'currency' => 'Yuan Renminbi',
272
+ 'minorUnit' => 2,
273
+ 'numericCode' => 156,
274
+ ),
275
+ 'COP' =>
276
+ array (
277
+ 'alphabeticCode' => 'COP',
278
+ 'currency' => 'Colombian Peso',
279
+ 'minorUnit' => 2,
280
+ 'numericCode' => 170,
281
+ ),
282
+ 'COU' =>
283
+ array (
284
+ 'alphabeticCode' => 'COU',
285
+ 'currency' => 'Unidad de Valor Real',
286
+ 'minorUnit' => 2,
287
+ 'numericCode' => 970,
288
+ ),
289
+ 'KMF' =>
290
+ array (
291
+ 'alphabeticCode' => 'KMF',
292
+ 'currency' => 'Comorian Franc ',
293
+ 'minorUnit' => 0,
294
+ 'numericCode' => 174,
295
+ ),
296
+ 'CDF' =>
297
+ array (
298
+ 'alphabeticCode' => 'CDF',
299
+ 'currency' => 'Congolese Franc',
300
+ 'minorUnit' => 2,
301
+ 'numericCode' => 976,
302
+ ),
303
+ 'NZD' =>
304
+ array (
305
+ 'alphabeticCode' => 'NZD',
306
+ 'currency' => 'New Zealand Dollar',
307
+ 'minorUnit' => 2,
308
+ 'numericCode' => 554,
309
+ ),
310
+ 'CRC' =>
311
+ array (
312
+ 'alphabeticCode' => 'CRC',
313
+ 'currency' => 'Costa Rican Colon',
314
+ 'minorUnit' => 2,
315
+ 'numericCode' => 188,
316
+ ),
317
+ 'HRK' =>
318
+ array (
319
+ 'alphabeticCode' => 'HRK',
320
+ 'currency' => 'Kuna',
321
+ 'minorUnit' => 2,
322
+ 'numericCode' => 191,
323
+ ),
324
+ 'CUP' =>
325
+ array (
326
+ 'alphabeticCode' => 'CUP',
327
+ 'currency' => 'Cuban Peso',
328
+ 'minorUnit' => 2,
329
+ 'numericCode' => 192,
330
+ ),
331
+ 'CUC' =>
332
+ array (
333
+ 'alphabeticCode' => 'CUC',
334
+ 'currency' => 'Peso Convertible',
335
+ 'minorUnit' => 2,
336
+ 'numericCode' => 931,
337
+ ),
338
+ 'ANG' =>
339
+ array (
340
+ 'alphabeticCode' => 'ANG',
341
+ 'currency' => 'Netherlands Antillean Guilder',
342
+ 'minorUnit' => 2,
343
+ 'numericCode' => 532,
344
+ ),
345
+ 'CZK' =>
346
+ array (
347
+ 'alphabeticCode' => 'CZK',
348
+ 'currency' => 'Czech Koruna',
349
+ 'minorUnit' => 2,
350
+ 'numericCode' => 203,
351
+ ),
352
+ 'DKK' =>
353
+ array (
354
+ 'alphabeticCode' => 'DKK',
355
+ 'currency' => 'Danish Krone',
356
+ 'minorUnit' => 2,
357
+ 'numericCode' => 208,
358
+ ),
359
+ 'DJF' =>
360
+ array (
361
+ 'alphabeticCode' => 'DJF',
362
+ 'currency' => 'Djibouti Franc',
363
+ 'minorUnit' => 0,
364
+ 'numericCode' => 262,
365
+ ),
366
+ 'DOP' =>
367
+ array (
368
+ 'alphabeticCode' => 'DOP',
369
+ 'currency' => 'Dominican Peso',
370
+ 'minorUnit' => 2,
371
+ 'numericCode' => 214,
372
+ ),
373
+ 'EGP' =>
374
+ array (
375
+ 'alphabeticCode' => 'EGP',
376
+ 'currency' => 'Egyptian Pound',
377
+ 'minorUnit' => 2,
378
+ 'numericCode' => 818,
379
+ ),
380
+ 'SVC' =>
381
+ array (
382
+ 'alphabeticCode' => 'SVC',
383
+ 'currency' => 'El Salvador Colon',
384
+ 'minorUnit' => 2,
385
+ 'numericCode' => 222,
386
+ ),
387
+ 'ERN' =>
388
+ array (
389
+ 'alphabeticCode' => 'ERN',
390
+ 'currency' => 'Nakfa',
391
+ 'minorUnit' => 2,
392
+ 'numericCode' => 232,
393
+ ),
394
+ 'ETB' =>
395
+ array (
396
+ 'alphabeticCode' => 'ETB',
397
+ 'currency' => 'Ethiopian Birr',
398
+ 'minorUnit' => 2,
399
+ 'numericCode' => 230,
400
+ ),
401
+ 'FKP' =>
402
+ array (
403
+ 'alphabeticCode' => 'FKP',
404
+ 'currency' => 'Falkland Islands Pound',
405
+ 'minorUnit' => 2,
406
+ 'numericCode' => 238,
407
+ ),
408
+ 'FJD' =>
409
+ array (
410
+ 'alphabeticCode' => 'FJD',
411
+ 'currency' => 'Fiji Dollar',
412
+ 'minorUnit' => 2,
413
+ 'numericCode' => 242,
414
+ ),
415
+ 'XPF' =>
416
+ array (
417
+ 'alphabeticCode' => 'XPF',
418
+ 'currency' => 'CFP Franc',
419
+ 'minorUnit' => 0,
420
+ 'numericCode' => 953,
421
+ ),
422
+ 'GMD' =>
423
+ array (
424
+ 'alphabeticCode' => 'GMD',
425
+ 'currency' => 'Dalasi',
426
+ 'minorUnit' => 2,
427
+ 'numericCode' => 270,
428
+ ),
429
+ 'GEL' =>
430
+ array (
431
+ 'alphabeticCode' => 'GEL',
432
+ 'currency' => 'Lari',
433
+ 'minorUnit' => 2,
434
+ 'numericCode' => 981,
435
+ ),
436
+ 'GHS' =>
437
+ array (
438
+ 'alphabeticCode' => 'GHS',
439
+ 'currency' => 'Ghana Cedi',
440
+ 'minorUnit' => 2,
441
+ 'numericCode' => 936,
442
+ ),
443
+ 'GIP' =>
444
+ array (
445
+ 'alphabeticCode' => 'GIP',
446
+ 'currency' => 'Gibraltar Pound',
447
+ 'minorUnit' => 2,
448
+ 'numericCode' => 292,
449
+ ),
450
+ 'GTQ' =>
451
+ array (
452
+ 'alphabeticCode' => 'GTQ',
453
+ 'currency' => 'Quetzal',
454
+ 'minorUnit' => 2,
455
+ 'numericCode' => 320,
456
+ ),
457
+ 'GBP' =>
458
+ array (
459
+ 'alphabeticCode' => 'GBP',
460
+ 'currency' => 'Pound Sterling',
461
+ 'minorUnit' => 2,
462
+ 'numericCode' => 826,
463
+ ),
464
+ 'GNF' =>
465
+ array (
466
+ 'alphabeticCode' => 'GNF',
467
+ 'currency' => 'Guinean Franc',
468
+ 'minorUnit' => 0,
469
+ 'numericCode' => 324,
470
+ ),
471
+ 'GYD' =>
472
+ array (
473
+ 'alphabeticCode' => 'GYD',
474
+ 'currency' => 'Guyana Dollar',
475
+ 'minorUnit' => 2,
476
+ 'numericCode' => 328,
477
+ ),
478
+ 'HTG' =>
479
+ array (
480
+ 'alphabeticCode' => 'HTG',
481
+ 'currency' => 'Gourde',
482
+ 'minorUnit' => 2,
483
+ 'numericCode' => 332,
484
+ ),
485
+ 'HNL' =>
486
+ array (
487
+ 'alphabeticCode' => 'HNL',
488
+ 'currency' => 'Lempira',
489
+ 'minorUnit' => 2,
490
+ 'numericCode' => 340,
491
+ ),
492
+ 'HKD' =>
493
+ array (
494
+ 'alphabeticCode' => 'HKD',
495
+ 'currency' => 'Hong Kong Dollar',
496
+ 'minorUnit' => 2,
497
+ 'numericCode' => 344,
498
+ ),
499
+ 'HUF' =>
500
+ array (
501
+ 'alphabeticCode' => 'HUF',
502
+ 'currency' => 'Forint',
503
+ 'minorUnit' => 2,
504
+ 'numericCode' => 348,
505
+ ),
506
+ 'ISK' =>
507
+ array (
508
+ 'alphabeticCode' => 'ISK',
509
+ 'currency' => 'Iceland Krona',
510
+ 'minorUnit' => 0,
511
+ 'numericCode' => 352,
512
+ ),
513
+ 'IDR' =>
514
+ array (
515
+ 'alphabeticCode' => 'IDR',
516
+ 'currency' => 'Rupiah',
517
+ 'minorUnit' => 2,
518
+ 'numericCode' => 360,
519
+ ),
520
+ 'XDR' =>
521
+ array (
522
+ 'alphabeticCode' => 'XDR',
523
+ 'currency' => 'SDR (Special Drawing Right)',
524
+ 'minorUnit' => 0,
525
+ 'numericCode' => 960,
526
+ ),
527
+ 'IRR' =>
528
+ array (
529
+ 'alphabeticCode' => 'IRR',
530
+ 'currency' => 'Iranian Rial',
531
+ 'minorUnit' => 2,
532
+ 'numericCode' => 364,
533
+ ),
534
+ 'IQD' =>
535
+ array (
536
+ 'alphabeticCode' => 'IQD',
537
+ 'currency' => 'Iraqi Dinar',
538
+ 'minorUnit' => 3,
539
+ 'numericCode' => 368,
540
+ ),
541
+ 'ILS' =>
542
+ array (
543
+ 'alphabeticCode' => 'ILS',
544
+ 'currency' => 'New Israeli Sheqel',
545
+ 'minorUnit' => 2,
546
+ 'numericCode' => 376,
547
+ ),
548
+ 'JMD' =>
549
+ array (
550
+ 'alphabeticCode' => 'JMD',
551
+ 'currency' => 'Jamaican Dollar',
552
+ 'minorUnit' => 2,
553
+ 'numericCode' => 388,
554
+ ),
555
+ 'JPY' =>
556
+ array (
557
+ 'alphabeticCode' => 'JPY',
558
+ 'currency' => 'Yen',
559
+ 'minorUnit' => 0,
560
+ 'numericCode' => 392,
561
+ ),
562
+ 'JOD' =>
563
+ array (
564
+ 'alphabeticCode' => 'JOD',
565
+ 'currency' => 'Jordanian Dinar',
566
+ 'minorUnit' => 3,
567
+ 'numericCode' => 400,
568
+ ),
569
+ 'KZT' =>
570
+ array (
571
+ 'alphabeticCode' => 'KZT',
572
+ 'currency' => 'Tenge',
573
+ 'minorUnit' => 2,
574
+ 'numericCode' => 398,
575
+ ),
576
+ 'KES' =>
577
+ array (
578
+ 'alphabeticCode' => 'KES',
579
+ 'currency' => 'Kenyan Shilling',
580
+ 'minorUnit' => 2,
581
+ 'numericCode' => 404,
582
+ ),
583
+ 'KPW' =>
584
+ array (
585
+ 'alphabeticCode' => 'KPW',
586
+ 'currency' => 'North Korean Won',
587
+ 'minorUnit' => 2,
588
+ 'numericCode' => 408,
589
+ ),
590
+ 'KRW' =>
591
+ array (
592
+ 'alphabeticCode' => 'KRW',
593
+ 'currency' => 'Won',
594
+ 'minorUnit' => 0,
595
+ 'numericCode' => 410,
596
+ ),
597
+ 'KWD' =>
598
+ array (
599
+ 'alphabeticCode' => 'KWD',
600
+ 'currency' => 'Kuwaiti Dinar',
601
+ 'minorUnit' => 3,
602
+ 'numericCode' => 414,
603
+ ),
604
+ 'KGS' =>
605
+ array (
606
+ 'alphabeticCode' => 'KGS',
607
+ 'currency' => 'Som',
608
+ 'minorUnit' => 2,
609
+ 'numericCode' => 417,
610
+ ),
611
+ 'LAK' =>
612
+ array (
613
+ 'alphabeticCode' => 'LAK',
614
+ 'currency' => 'Lao Kip',
615
+ 'minorUnit' => 2,
616
+ 'numericCode' => 418,
617
+ ),
618
+ 'LBP' =>
619
+ array (
620
+ 'alphabeticCode' => 'LBP',
621
+ 'currency' => 'Lebanese Pound',
622
+ 'minorUnit' => 2,
623
+ 'numericCode' => 422,
624
+ ),
625
+ 'LSL' =>
626
+ array (
627
+ 'alphabeticCode' => 'LSL',
628
+ 'currency' => 'Loti',
629
+ 'minorUnit' => 2,
630
+ 'numericCode' => 426,
631
+ ),
632
+ 'ZAR' =>
633
+ array (
634
+ 'alphabeticCode' => 'ZAR',
635
+ 'currency' => 'Rand',
636
+ 'minorUnit' => 2,
637
+ 'numericCode' => 710,
638
+ ),
639
+ 'LRD' =>
640
+ array (
641
+ 'alphabeticCode' => 'LRD',
642
+ 'currency' => 'Liberian Dollar',
643
+ 'minorUnit' => 2,
644
+ 'numericCode' => 430,
645
+ ),
646
+ 'LYD' =>
647
+ array (
648
+ 'alphabeticCode' => 'LYD',
649
+ 'currency' => 'Libyan Dinar',
650
+ 'minorUnit' => 3,
651
+ 'numericCode' => 434,
652
+ ),
653
+ 'CHF' =>
654
+ array (
655
+ 'alphabeticCode' => 'CHF',
656
+ 'currency' => 'Swiss Franc',
657
+ 'minorUnit' => 2,
658
+ 'numericCode' => 756,
659
+ ),
660
+ 'MOP' =>
661
+ array (
662
+ 'alphabeticCode' => 'MOP',
663
+ 'currency' => 'Pataca',
664
+ 'minorUnit' => 2,
665
+ 'numericCode' => 446,
666
+ ),
667
+ 'MKD' =>
668
+ array (
669
+ 'alphabeticCode' => 'MKD',
670
+ 'currency' => 'Denar',
671
+ 'minorUnit' => 2,
672
+ 'numericCode' => 807,
673
+ ),
674
+ 'MGA' =>
675
+ array (
676
+ 'alphabeticCode' => 'MGA',
677
+ 'currency' => 'Malagasy Ariary',
678
+ 'minorUnit' => 2,
679
+ 'numericCode' => 969,
680
+ ),
681
+ 'MWK' =>
682
+ array (
683
+ 'alphabeticCode' => 'MWK',
684
+ 'currency' => 'Malawi Kwacha',
685
+ 'minorUnit' => 2,
686
+ 'numericCode' => 454,
687
+ ),
688
+ 'MYR' =>
689
+ array (
690
+ 'alphabeticCode' => 'MYR',
691
+ 'currency' => 'Malaysian Ringgit',
692
+ 'minorUnit' => 2,
693
+ 'numericCode' => 458,
694
+ ),
695
+ 'MVR' =>
696
+ array (
697
+ 'alphabeticCode' => 'MVR',
698
+ 'currency' => 'Rufiyaa',
699
+ 'minorUnit' => 2,
700
+ 'numericCode' => 462,
701
+ ),
702
+ 'MRO' =>
703
+ array (
704
+ 'alphabeticCode' => 'MRO',
705
+ 'currency' => 'Ouguiya',
706
+ 'minorUnit' => 2,
707
+ 'numericCode' => 478,
708
+ ),
709
+ 'MUR' =>
710
+ array (
711
+ 'alphabeticCode' => 'MUR',
712
+ 'currency' => 'Mauritius Rupee',
713
+ 'minorUnit' => 2,
714
+ 'numericCode' => 480,
715
+ ),
716
+ 'XUA' =>
717
+ array (
718
+ 'alphabeticCode' => 'XUA',
719
+ 'currency' => 'ADB Unit of Account',
720
+ 'minorUnit' => 0,
721
+ 'numericCode' => 965,
722
+ ),
723
+ 'MXN' =>
724
+ array (
725
+ 'alphabeticCode' => 'MXN',
726
+ 'currency' => 'Mexican Peso',
727
+ 'minorUnit' => 2,
728
+ 'numericCode' => 484,
729
+ ),
730
+ 'MXV' =>
731
+ array (
732
+ 'alphabeticCode' => 'MXV',
733
+ 'currency' => 'Mexican Unidad de Inversion (UDI)',
734
+ 'minorUnit' => 2,
735
+ 'numericCode' => 979,
736
+ ),
737
+ 'MDL' =>
738
+ array (
739
+ 'alphabeticCode' => 'MDL',
740
+ 'currency' => 'Moldovan Leu',
741
+ 'minorUnit' => 2,
742
+ 'numericCode' => 498,
743
+ ),
744
+ 'MNT' =>
745
+ array (
746
+ 'alphabeticCode' => 'MNT',
747
+ 'currency' => 'Tugrik',
748
+ 'minorUnit' => 2,
749
+ 'numericCode' => 496,
750
+ ),
751
+ 'MAD' =>
752
+ array (
753
+ 'alphabeticCode' => 'MAD',
754
+ 'currency' => 'Moroccan Dirham',
755
+ 'minorUnit' => 2,
756
+ 'numericCode' => 504,
757
+ ),
758
+ 'MZN' =>
759
+ array (
760
+ 'alphabeticCode' => 'MZN',
761
+ 'currency' => 'Mozambique Metical',
762
+ 'minorUnit' => 2,
763
+ 'numericCode' => 943,
764
+ ),
765
+ 'MMK' =>
766
+ array (
767
+ 'alphabeticCode' => 'MMK',
768
+ 'currency' => 'Kyat',
769
+ 'minorUnit' => 2,
770
+ 'numericCode' => 104,
771
+ ),
772
+ 'NAD' =>
773
+ array (
774
+ 'alphabeticCode' => 'NAD',
775
+ 'currency' => 'Namibia Dollar',
776
+ 'minorUnit' => 2,
777
+ 'numericCode' => 516,
778
+ ),
779
+ 'NPR' =>
780
+ array (
781
+ 'alphabeticCode' => 'NPR',
782
+ 'currency' => 'Nepalese Rupee',
783
+ 'minorUnit' => 2,
784
+ 'numericCode' => 524,
785
+ ),
786
+ 'NIO' =>
787
+ array (
788
+ 'alphabeticCode' => 'NIO',
789
+ 'currency' => 'Cordoba Oro',
790
+ 'minorUnit' => 2,
791
+ 'numericCode' => 558,
792
+ ),
793
+ 'NGN' =>
794
+ array (
795
+ 'alphabeticCode' => 'NGN',
796
+ 'currency' => 'Naira',
797
+ 'minorUnit' => 2,
798
+ 'numericCode' => 566,
799
+ ),
800
+ 'OMR' =>
801
+ array (
802
+ 'alphabeticCode' => 'OMR',
803
+ 'currency' => 'Rial Omani',
804
+ 'minorUnit' => 3,
805
+ 'numericCode' => 512,
806
+ ),
807
+ 'PKR' =>
808
+ array (
809
+ 'alphabeticCode' => 'PKR',
810
+ 'currency' => 'Pakistan Rupee',
811
+ 'minorUnit' => 2,
812
+ 'numericCode' => 586,
813
+ ),
814
+ 'PAB' =>
815
+ array (
816
+ 'alphabeticCode' => 'PAB',
817
+ 'currency' => 'Balboa',
818
+ 'minorUnit' => 2,
819
+ 'numericCode' => 590,
820
+ ),
821
+ 'PGK' =>
822
+ array (
823
+ 'alphabeticCode' => 'PGK',
824
+ 'currency' => 'Kina',
825
+ 'minorUnit' => 2,
826
+ 'numericCode' => 598,
827
+ ),
828
+ 'PYG' =>
829
+ array (
830
+ 'alphabeticCode' => 'PYG',
831
+ 'currency' => 'Guarani',
832
+ 'minorUnit' => 0,
833
+ 'numericCode' => 600,
834
+ ),
835
+ 'PEN' =>
836
+ array (
837
+ 'alphabeticCode' => 'PEN',
838
+ 'currency' => 'Sol',
839
+ 'minorUnit' => 2,
840
+ 'numericCode' => 604,
841
+ ),
842
+ 'PHP' =>
843
+ array (
844
+ 'alphabeticCode' => 'PHP',
845
+ 'currency' => 'Philippine Peso',
846
+ 'minorUnit' => 2,
847
+ 'numericCode' => 608,
848
+ ),
849
+ 'PLN' =>
850
+ array (
851
+ 'alphabeticCode' => 'PLN',
852
+ 'currency' => 'Zloty',
853
+ 'minorUnit' => 2,
854
+ 'numericCode' => 985,
855
+ ),
856
+ 'QAR' =>
857
+ array (
858
+ 'alphabeticCode' => 'QAR',
859
+ 'currency' => 'Qatari Rial',
860
+ 'minorUnit' => 2,
861
+ 'numericCode' => 634,
862
+ ),
863
+ 'RON' =>
864
+ array (
865
+ 'alphabeticCode' => 'RON',
866
+ 'currency' => 'Romanian Leu',
867
+ 'minorUnit' => 2,
868
+ 'numericCode' => 946,
869
+ ),
870
+ 'RUB' =>
871
+ array (
872
+ 'alphabeticCode' => 'RUB',
873
+ 'currency' => 'Russian Ruble',
874
+ 'minorUnit' => 2,
875
+ 'numericCode' => 643,
876
+ ),
877
+ 'RWF' =>
878
+ array (
879
+ 'alphabeticCode' => 'RWF',
880
+ 'currency' => 'Rwanda Franc',
881
+ 'minorUnit' => 0,
882
+ 'numericCode' => 646,
883
+ ),
884
+ 'SHP' =>
885
+ array (
886
+ 'alphabeticCode' => 'SHP',
887
+ 'currency' => 'Saint Helena Pound',
888
+ 'minorUnit' => 2,
889
+ 'numericCode' => 654,
890
+ ),
891
+ 'WST' =>
892
+ array (
893
+ 'alphabeticCode' => 'WST',
894
+ 'currency' => 'Tala',
895
+ 'minorUnit' => 2,
896
+ 'numericCode' => 882,
897
+ ),
898
+ 'STD' =>
899
+ array (
900
+ 'alphabeticCode' => 'STD',
901
+ 'currency' => 'Dobra',
902
+ 'minorUnit' => 2,
903
+ 'numericCode' => 678,
904
+ ),
905
+ 'SAR' =>
906
+ array (
907
+ 'alphabeticCode' => 'SAR',
908
+ 'currency' => 'Saudi Riyal',
909
+ 'minorUnit' => 2,
910
+ 'numericCode' => 682,
911
+ ),
912
+ 'RSD' =>
913
+ array (
914
+ 'alphabeticCode' => 'RSD',
915
+ 'currency' => 'Serbian Dinar',
916
+ 'minorUnit' => 2,
917
+ 'numericCode' => 941,
918
+ ),
919
+ 'SCR' =>
920
+ array (
921
+ 'alphabeticCode' => 'SCR',
922
+ 'currency' => 'Seychelles Rupee',
923
+ 'minorUnit' => 2,
924
+ 'numericCode' => 690,
925
+ ),
926
+ 'SLL' =>
927
+ array (
928
+ 'alphabeticCode' => 'SLL',
929
+ 'currency' => 'Leone',
930
+ 'minorUnit' => 2,
931
+ 'numericCode' => 694,
932
+ ),
933
+ 'SGD' =>
934
+ array (
935
+ 'alphabeticCode' => 'SGD',
936
+ 'currency' => 'Singapore Dollar',
937
+ 'minorUnit' => 2,
938
+ 'numericCode' => 702,
939
+ ),
940
+ 'XSU' =>
941
+ array (
942
+ 'alphabeticCode' => 'XSU',
943
+ 'currency' => 'Sucre',
944
+ 'minorUnit' => 0,
945
+ 'numericCode' => 994,
946
+ ),
947
+ 'SBD' =>
948
+ array (
949
+ 'alphabeticCode' => 'SBD',
950
+ 'currency' => 'Solomon Islands Dollar',
951
+ 'minorUnit' => 2,
952
+ 'numericCode' => 90,
953
+ ),
954
+ 'SOS' =>
955
+ array (
956
+ 'alphabeticCode' => 'SOS',
957
+ 'currency' => 'Somali Shilling',
958
+ 'minorUnit' => 2,
959
+ 'numericCode' => 706,
960
+ ),
961
+ 'SSP' =>
962
+ array (
963
+ 'alphabeticCode' => 'SSP',
964
+ 'currency' => 'South Sudanese Pound',
965
+ 'minorUnit' => 2,
966
+ 'numericCode' => 728,
967
+ ),
968
+ 'LKR' =>
969
+ array (
970
+ 'alphabeticCode' => 'LKR',
971
+ 'currency' => 'Sri Lanka Rupee',
972
+ 'minorUnit' => 2,
973
+ 'numericCode' => 144,
974
+ ),
975
+ 'SDG' =>
976
+ array (
977
+ 'alphabeticCode' => 'SDG',
978
+ 'currency' => 'Sudanese Pound',
979
+ 'minorUnit' => 2,
980
+ 'numericCode' => 938,
981
+ ),
982
+ 'SRD' =>
983
+ array (
984
+ 'alphabeticCode' => 'SRD',
985
+ 'currency' => 'Surinam Dollar',
986
+ 'minorUnit' => 2,
987
+ 'numericCode' => 968,
988
+ ),
989
+ 'SZL' =>
990
+ array (
991
+ 'alphabeticCode' => 'SZL',
992
+ 'currency' => 'Lilangeni',
993
+ 'minorUnit' => 2,
994
+ 'numericCode' => 748,
995
+ ),
996
+ 'SEK' =>
997
+ array (
998
+ 'alphabeticCode' => 'SEK',
999
+ 'currency' => 'Swedish Krona',
1000
+ 'minorUnit' => 2,
1001
+ 'numericCode' => 752,
1002
+ ),
1003
+ 'CHE' =>
1004
+ array (
1005
+ 'alphabeticCode' => 'CHE',
1006
+ 'currency' => 'WIR Euro',
1007
+ 'minorUnit' => 2,
1008
+ 'numericCode' => 947,
1009
+ ),
1010
+ 'CHW' =>
1011
+ array (
1012
+ 'alphabeticCode' => 'CHW',
1013
+ 'currency' => 'WIR Franc',
1014
+ 'minorUnit' => 2,
1015
+ 'numericCode' => 948,
1016
+ ),
1017
+ 'SYP' =>
1018
+ array (
1019
+ 'alphabeticCode' => 'SYP',
1020
+ 'currency' => 'Syrian Pound',
1021
+ 'minorUnit' => 2,
1022
+ 'numericCode' => 760,
1023
+ ),
1024
+ 'TWD' =>
1025
+ array (
1026
+ 'alphabeticCode' => 'TWD',
1027
+ 'currency' => 'New Taiwan Dollar',
1028
+ 'minorUnit' => 2,
1029
+ 'numericCode' => 901,
1030
+ ),
1031
+ 'TJS' =>
1032
+ array (
1033
+ 'alphabeticCode' => 'TJS',
1034
+ 'currency' => 'Somoni',
1035
+ 'minorUnit' => 2,
1036
+ 'numericCode' => 972,
1037
+ ),
1038
+ 'TZS' =>
1039
+ array (
1040
+ 'alphabeticCode' => 'TZS',
1041
+ 'currency' => 'Tanzanian Shilling',
1042
+ 'minorUnit' => 2,
1043
+ 'numericCode' => 834,
1044
+ ),
1045
+ 'THB' =>
1046
+ array (
1047
+ 'alphabeticCode' => 'THB',
1048
+ 'currency' => 'Baht',
1049
+ 'minorUnit' => 2,
1050
+ 'numericCode' => 764,
1051
+ ),
1052
+ 'TOP' =>
1053
+ array (
1054
+ 'alphabeticCode' => 'TOP',
1055
+ 'currency' => 'Pa’anga',
1056
+ 'minorUnit' => 2,
1057
+ 'numericCode' => 776,
1058
+ ),
1059
+ 'TTD' =>
1060
+ array (
1061
+ 'alphabeticCode' => 'TTD',
1062
+ 'currency' => 'Trinidad and Tobago Dollar',
1063
+ 'minorUnit' => 2,
1064
+ 'numericCode' => 780,
1065
+ ),
1066
+ 'TND' =>
1067
+ array (
1068
+ 'alphabeticCode' => 'TND',
1069
+ 'currency' => 'Tunisian Dinar',
1070
+ 'minorUnit' => 3,
1071
+ 'numericCode' => 788,
1072
+ ),
1073
+ 'TRY' =>
1074
+ array (
1075
+ 'alphabeticCode' => 'TRY',
1076
+ 'currency' => 'Turkish Lira',
1077
+ 'minorUnit' => 2,
1078
+ 'numericCode' => 949,
1079
+ ),
1080
+ 'TMT' =>
1081
+ array (
1082
+ 'alphabeticCode' => 'TMT',
1083
+ 'currency' => 'Turkmenistan New Manat',
1084
+ 'minorUnit' => 2,
1085
+ 'numericCode' => 934,
1086
+ ),
1087
+ 'UGX' =>
1088
+ array (
1089
+ 'alphabeticCode' => 'UGX',
1090
+ 'currency' => 'Uganda Shilling',
1091
+ 'minorUnit' => 0,
1092
+ 'numericCode' => 800,
1093
+ ),
1094
+ 'UAH' =>
1095
+ array (
1096
+ 'alphabeticCode' => 'UAH',
1097
+ 'currency' => 'Hryvnia',
1098
+ 'minorUnit' => 2,
1099
+ 'numericCode' => 980,
1100
+ ),
1101
+ 'AED' =>
1102
+ array (
1103
+ 'alphabeticCode' => 'AED',
1104
+ 'currency' => 'UAE Dirham',
1105
+ 'minorUnit' => 2,
1106
+ 'numericCode' => 784,
1107
+ ),
1108
+ 'USN' =>
1109
+ array (
1110
+ 'alphabeticCode' => 'USN',
1111
+ 'currency' => 'US Dollar (Next day)',
1112
+ 'minorUnit' => 2,
1113
+ 'numericCode' => 997,
1114
+ ),
1115
+ 'UYU' =>
1116
+ array (
1117
+ 'alphabeticCode' => 'UYU',
1118
+ 'currency' => 'Peso Uruguayo',
1119
+ 'minorUnit' => 2,
1120
+ 'numericCode' => 858,
1121
+ ),
1122
+ 'UYI' =>
1123
+ array (
1124
+ 'alphabeticCode' => 'UYI',
1125
+ 'currency' => 'Uruguay Peso en Unidades Indexadas (URUIURUI)',
1126
+ 'minorUnit' => 0,
1127
+ 'numericCode' => 940,
1128
+ ),
1129
+ 'UZS' =>
1130
+ array (
1131
+ 'alphabeticCode' => 'UZS',
1132
+ 'currency' => 'Uzbekistan Sum',
1133
+ 'minorUnit' => 2,
1134
+ 'numericCode' => 860,
1135
+ ),
1136
+ 'VUV' =>
1137
+ array (
1138
+ 'alphabeticCode' => 'VUV',
1139
+ 'currency' => 'Vatu',
1140
+ 'minorUnit' => 0,
1141
+ 'numericCode' => 548,
1142
+ ),
1143
+ 'VEF' =>
1144
+ array (
1145
+ 'alphabeticCode' => 'VEF',
1146
+ 'currency' => 'Bolívar',
1147
+ 'minorUnit' => 2,
1148
+ 'numericCode' => 937,
1149
+ ),
1150
+ 'VND' =>
1151
+ array (
1152
+ 'alphabeticCode' => 'VND',
1153
+ 'currency' => 'Dong',
1154
+ 'minorUnit' => 0,
1155
+ 'numericCode' => 704,
1156
+ ),
1157
+ 'YER' =>
1158
+ array (
1159
+ 'alphabeticCode' => 'YER',
1160
+ 'currency' => 'Yemeni Rial',
1161
+ 'minorUnit' => 2,
1162
+ 'numericCode' => 886,
1163
+ ),
1164
+ 'ZMW' =>
1165
+ array (
1166
+ 'alphabeticCode' => 'ZMW',
1167
+ 'currency' => 'Zambian Kwacha',
1168
+ 'minorUnit' => 2,
1169
+ 'numericCode' => 967,
1170
+ ),
1171
+ 'ZWL' =>
1172
+ array (
1173
+ 'alphabeticCode' => 'ZWL',
1174
+ 'currency' => 'Zimbabwe Dollar',
1175
+ 'minorUnit' => 2,
1176
+ 'numericCode' => 932,
1177
+ ),
1178
+ 'XBA' =>
1179
+ array (
1180
+ 'alphabeticCode' => 'XBA',
1181
+ 'currency' => 'Bond Markets Unit European Composite Unit (EURCO)',
1182
+ 'minorUnit' => 0,
1183
+ 'numericCode' => 955,
1184
+ ),
1185
+ 'XBB' =>
1186
+ array (
1187
+ 'alphabeticCode' => 'XBB',
1188
+ 'currency' => 'Bond Markets Unit European Monetary Unit (E.M.U.-6)',
1189
+ 'minorUnit' => 0,
1190
+ 'numericCode' => 956,
1191
+ ),
1192
+ 'XBC' =>
1193
+ array (
1194
+ 'alphabeticCode' => 'XBC',
1195
+ 'currency' => 'Bond Markets Unit European Unit of Account 9 (E.U.A.-9)',
1196
+ 'minorUnit' => 0,
1197
+ 'numericCode' => 957,
1198
+ ),
1199
+ 'XBD' =>
1200
+ array (
1201
+ 'alphabeticCode' => 'XBD',
1202
+ 'currency' => 'Bond Markets Unit European Unit of Account 17 (E.U.A.-17)',
1203
+ 'minorUnit' => 0,
1204
+ 'numericCode' => 958,
1205
+ ),
1206
+ 'XTS' =>
1207
+ array (
1208
+ 'alphabeticCode' => 'XTS',
1209
+ 'currency' => 'Codes specifically reserved for testing purposes',
1210
+ 'minorUnit' => 0,
1211
+ 'numericCode' => 963,
1212
+ ),
1213
+ 'XXX' =>
1214
+ array (
1215
+ 'alphabeticCode' => 'XXX',
1216
+ 'currency' => 'The codes assigned for transactions where no currency is involved',
1217
+ 'minorUnit' => 0,
1218
+ 'numericCode' => 999,
1219
+ ),
1220
+ 'XAU' =>
1221
+ array (
1222
+ 'alphabeticCode' => 'XAU',
1223
+ 'currency' => 'Gold',
1224
+ 'minorUnit' => 0,
1225
+ 'numericCode' => 959,
1226
+ ),
1227
+ 'XPD' =>
1228
+ array (
1229
+ 'alphabeticCode' => 'XPD',
1230
+ 'currency' => 'Palladium',
1231
+ 'minorUnit' => 0,
1232
+ 'numericCode' => 964,
1233
+ ),
1234
+ 'XPT' =>
1235
+ array (
1236
+ 'alphabeticCode' => 'XPT',
1237
+ 'currency' => 'Platinum',
1238
+ 'minorUnit' => 0,
1239
+ 'numericCode' => 962,
1240
+ ),
1241
+ 'XAG' =>
1242
+ array (
1243
+ 'alphabeticCode' => 'XAG',
1244
+ 'currency' => 'Silver',
1245
+ 'minorUnit' => 0,
1246
+ 'numericCode' => 961,
1247
+ ),
1248
+ );
vendor/moneyphp/money/src/Calculator.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Money calculations abstracted away from the Money value object.
7
+ *
8
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
9
+ */
10
+ interface Calculator
11
+ {
12
+ /**
13
+ * Returns whether the calculator is supported in
14
+ * the current server environment.
15
+ *
16
+ * @return bool
17
+ */
18
+ public static function supported();
19
+
20
+ /**
21
+ * Compare a to b.
22
+ *
23
+ * @param string $a
24
+ * @param string $b
25
+ *
26
+ * @return int
27
+ */
28
+ public function compare($a, $b);
29
+
30
+ /**
31
+ * Add added to amount.
32
+ *
33
+ * @param string $amount
34
+ * @param string $addend
35
+ *
36
+ * @return string
37
+ */
38
+ public function add($amount, $addend);
39
+
40
+ /**
41
+ * Subtract subtrahend from amount.
42
+ *
43
+ * @param string $amount
44
+ * @param string $subtrahend
45
+ *
46
+ * @return string
47
+ */
48
+ public function subtract($amount, $subtrahend);
49
+
50
+ /**
51
+ * Multiply amount with multiplier.
52
+ *
53
+ * @param string $amount
54
+ * @param int|float|string $multiplier
55
+ *
56
+ * @return string
57
+ */
58
+ public function multiply($amount, $multiplier);
59
+
60
+ /**
61
+ * Divide amount with divisor.
62
+ *
63
+ * @param string $amount
64
+ * @param int|float|string $divisor
65
+ *
66
+ * @return string
67
+ */
68
+ public function divide($amount, $divisor);
69
+
70
+ /**
71
+ * Round number to following integer.
72
+ *
73
+ * @param string $number
74
+ *
75
+ * @return string
76
+ */
77
+ public function ceil($number);
78
+
79
+ /**
80
+ * Round number to preceding integer.
81
+ *
82
+ * @param string $number
83
+ *
84
+ * @return string
85
+ */
86
+ public function floor($number);
87
+
88
+ /**
89
+ * Returns the absolute value of the number.
90
+ *
91
+ * @param string $number
92
+ *
93
+ * @return string
94
+ */
95
+ public function absolute($number);
96
+
97
+ /**
98
+ * Round number, use rounding mode for tie-breaker.
99
+ *
100
+ * @param int|float|string $number
101
+ * @param int $roundingMode
102
+ *
103
+ * @return string
104
+ */
105
+ public function round($number, $roundingMode);
106
+
107
+ /**
108
+ * Share amount among ratio / total portions.
109
+ *
110
+ * @param string $amount
111
+ * @param int|float $ratio
112
+ * @param int|float $total
113
+ *
114
+ * @return string
115
+ */
116
+ public function share($amount, $ratio, $total);
117
+
118
+ /**
119
+ * Get the modulus of an amount.
120
+ *
121
+ * @param string $amount
122
+ * @param int|float|string $divisor
123
+ *
124
+ * @return string
125
+ */
126
+ public function mod($amount, $divisor);
127
+ }
vendor/moneyphp/money/src/Calculator/BcMathCalculator.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Calculator;
4
+
5
+ use Money\Calculator;
6
+ use Money\Money;
7
+ use Money\Number;
8
+
9
+ /**
10
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
11
+ */
12
+ final class BcMathCalculator implements Calculator
13
+ {
14
+ /**
15
+ * @var string
16
+ */
17
+ private $scale;
18
+
19
+ /**
20
+ * @param int $scale
21
+ */
22
+ public function __construct($scale = 14)
23
+ {
24
+ $this->scale = $scale;
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public static function supported()
31
+ {
32
+ return extension_loaded('bcmath');
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function compare($a, $b)
39
+ {
40
+ return bccomp($a, $b, $this->scale);
41
+ }
42
+
43
+ /**
44
+ * {@inheritdoc}
45
+ */
46
+ public function add($amount, $addend)
47
+ {
48
+ return bcadd($amount, $addend, 0);
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ *
54
+ * @param $amount
55
+ * @param $subtrahend
56
+ *
57
+ * @return string
58
+ */
59
+ public function subtract($amount, $subtrahend)
60
+ {
61
+ return bcsub($amount, $subtrahend, 0);
62
+ }
63
+
64
+ /**
65
+ * {@inheritdoc}
66
+ */
67
+ public function multiply($amount, $multiplier)
68
+ {
69
+ $multiplier = Number::fromNumber($multiplier);
70
+
71
+ return bcmul($amount, (string) $multiplier, $this->scale);
72
+ }
73
+
74
+ /**
75
+ * {@inheritdoc}
76
+ */
77
+ public function divide($amount, $divisor)
78
+ {
79
+ $divisor = Number::fromNumber($divisor);
80
+
81
+ return bcdiv($amount, (string) $divisor, $this->scale);
82
+ }
83
+
84
+ /**
85
+ * {@inheritdoc}
86
+ */
87
+ public function ceil($number)
88
+ {
89
+ $number = Number::fromNumber($number);
90
+
91
+ if ($number->isInteger()) {
92
+ return (string) $number;
93
+ }
94
+
95
+ if ($number->isNegative()) {
96
+ return bcadd((string) $number, '0', 0);
97
+ }
98
+
99
+ return bcadd((string) $number, '1', 0);
100
+ }
101
+
102
+ /**
103
+ * {@inheritdoc}
104
+ */
105
+ public function floor($number)
106
+ {
107
+ $number = Number::fromNumber($number);
108
+
109
+ if ($number->isInteger()) {
110
+ return (string) $number;
111
+ }
112
+
113
+ if ($number->isNegative()) {
114
+ return bcadd((string) $number, '-1', 0);
115
+ }
116
+
117
+ return bcadd($number, '0', 0);
118
+ }
119
+
120
+ /**
121
+ * {@inheritdoc}
122
+ */
123
+ public function absolute($number)
124
+ {
125
+ return ltrim($number, '-');
126
+ }
127
+
128
+ /**
129
+ * {@inheritdoc}
130
+ */
131
+ public function round($number, $roundingMode)
132
+ {
133
+ $number = Number::fromNumber($number);
134
+
135
+ if ($number->isInteger()) {
136
+ return (string) $number;
137
+ }
138
+
139
+ if ($number->isHalf() === false) {
140
+ return $this->roundDigit($number);
141
+ }
142
+
143
+ if (Money::ROUND_HALF_UP === $roundingMode) {
144
+ return bcadd(
145
+ (string) $number,
146
+ $number->getIntegerRoundingMultiplier(),
147
+ 0
148
+ );
149
+ }
150
+
151
+ if (Money::ROUND_HALF_DOWN === $roundingMode) {
152
+ return bcadd((string) $number, '0', 0);
153
+ }
154
+
155
+ if (Money::ROUND_HALF_EVEN === $roundingMode) {
156
+ if ($number->isCurrentEven()) {
157
+ return bcadd((string) $number, '0', 0);
158
+ }
159
+
160
+ return bcadd(
161
+ (string) $number,
162
+ $number->getIntegerRoundingMultiplier(),
163
+ 0
164
+ );
165
+ }
166
+
167
+ if (Money::ROUND_HALF_ODD === $roundingMode) {
168
+ if ($number->isCurrentEven()) {
169
+ return bcadd(
170
+ (string) $number,
171
+ $number->getIntegerRoundingMultiplier(),
172
+ 0
173
+ );
174
+ }
175
+
176
+ return bcadd((string) $number, '0', 0);
177
+ }
178
+
179
+ if (Money::ROUND_HALF_POSITIVE_INFINITY === $roundingMode) {
180
+ if ($number->isNegative()) {
181
+ return bcadd((string) $number, '0', 0);
182
+ }
183
+
184
+ return bcadd(
185
+ (string) $number,
186
+ $number->getIntegerRoundingMultiplier(),
187
+ 0
188
+ );
189
+ }
190
+
191
+ if (Money::ROUND_HALF_NEGATIVE_INFINITY === $roundingMode) {
192
+ if ($number->isNegative()) {
193
+ return bcadd(
194
+ (string) $number,
195
+ $number->getIntegerRoundingMultiplier(),
196
+ 0
197
+ );
198
+ }
199
+
200
+ return bcadd(
201
+ (string) $number,
202
+ '0',
203
+ 0
204
+ );
205
+ }
206
+
207
+ throw new \InvalidArgumentException('Unknown rounding mode');
208
+ }
209
+
210
+ /**
211
+ * @param $number
212
+ *
213
+ * @return string
214
+ */
215
+ private function roundDigit(Number $number)
216
+ {
217
+ if ($number->isCloserToNext()) {
218
+ return bcadd(
219
+ (string) $number,
220
+ $number->getIntegerRoundingMultiplier(),
221
+ 0
222
+ );
223
+ }
224
+
225
+ return bcadd((string) $number, '0', 0);
226
+ }
227
+
228
+ /**
229
+ * {@inheritdoc}
230
+ */
231
+ public function share($amount, $ratio, $total)
232
+ {
233
+ return $this->floor(bcdiv(bcmul($amount, $ratio, $this->scale), $total, $this->scale));
234
+ }
235
+
236
+ /**
237
+ * {@inheritdoc}
238
+ */
239
+ public function mod($amount, $divisor)
240
+ {
241
+ return bcmod($amount, $divisor);
242
+ }
243
+ }
vendor/moneyphp/money/src/Calculator/GmpCalculator.php ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Calculator;
4
+
5
+ use Money\Calculator;
6
+ use Money\Money;
7
+ use Money\Number;
8
+
9
+ /**
10
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
11
+ */
12
+ final class GmpCalculator implements Calculator
13
+ {
14
+ /**
15
+ * @var string
16
+ */
17
+ private $scale;
18
+
19
+ /**
20
+ * @param int $scale
21
+ */
22
+ public function __construct($scale = 14)
23
+ {
24
+ $this->scale = $scale;
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public static function supported()
31
+ {
32
+ return extension_loaded('gmp');
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function compare($a, $b)
39
+ {
40
+ $aNum = Number::fromNumber($a);
41
+ $bNum = Number::fromNumber($b);
42
+
43
+ if ($aNum->isDecimal() || $bNum->isDecimal()) {
44
+ $integersCompared = gmp_cmp($aNum->getIntegerPart(), $bNum->getIntegerPart());
45
+ if ($integersCompared !== 0) {
46
+ return $integersCompared;
47
+ }
48
+
49
+ return gmp_cmp($aNum->getFractionalPart(), $bNum->getFractionalPart());
50
+ }
51
+
52
+ return gmp_cmp($a, $b);
53
+ }
54
+
55
+ /**
56
+ * {@inheritdoc}
57
+ */
58
+ public function add($amount, $addend)
59
+ {
60
+ return gmp_strval(gmp_add($amount, $addend));
61
+ }
62
+
63
+ /**
64
+ * {@inheritdoc}
65
+ */
66
+ public function subtract($amount, $subtrahend)
67
+ {
68
+ return gmp_strval(gmp_sub($amount, $subtrahend));
69
+ }
70
+
71
+ /**
72
+ * {@inheritdoc}
73
+ */
74
+ public function multiply($amount, $multiplier)
75
+ {
76
+ $multiplier = Number::fromNumber($multiplier);
77
+
78
+ if ($multiplier->isDecimal()) {
79
+ $decimalPlaces = strlen($multiplier->getFractionalPart());
80
+ $multiplierBase = $multiplier->getIntegerPart();
81
+
82
+ if ($multiplierBase) {
83
+ $multiplierBase .= $multiplier->getFractionalPart();
84
+ } else {
85
+ $multiplierBase = ltrim($multiplier->getFractionalPart(), '0');
86
+ }
87
+
88
+ $resultBase = gmp_strval(gmp_mul(gmp_init($amount), gmp_init($multiplierBase)));
89
+
90
+ if ('0' === $resultBase) {
91
+ return '0';
92
+ }
93
+
94
+ $result = substr($resultBase, $decimalPlaces * -1);
95
+ $resultLength = strlen($result);
96
+ if ($decimalPlaces > $resultLength) {
97
+ return '0.'.str_pad('', $decimalPlaces - $resultLength, '0').$result;
98
+ }
99
+
100
+ return substr($resultBase, 0, $decimalPlaces * -1).'.'.$result;
101
+ }
102
+
103
+ return gmp_strval(gmp_mul(gmp_init($amount), gmp_init((string) $multiplier)));
104
+ }
105
+
106
+ /**
107
+ * {@inheritdoc}
108
+ */
109
+ public function divide($amount, $divisor)
110
+ {
111
+ $divisor = Number::fromNumber($divisor);
112
+
113
+ if ($divisor->isDecimal()) {
114
+ $decimalPlaces = strlen($divisor->getFractionalPart());
115
+
116
+ if ($divisor->getIntegerPart()) {
117
+ $divisor = new Number($divisor->getIntegerPart().$divisor->getFractionalPart());
118
+ } else {
119
+ $divisor = new Number(ltrim($divisor->getFractionalPart(), '0'));
120
+ }
121
+
122
+ $amount = gmp_strval(gmp_mul(gmp_init($amount), gmp_init('1'.str_pad('', $decimalPlaces, '0'))));
123
+ }
124
+
125
+ list($integer, $remainder) = gmp_div_qr(gmp_init($amount), gmp_init((string) $divisor));
126
+
127
+ if (gmp_cmp($remainder, '0') === 0) {
128
+ return gmp_strval($integer);
129
+ }
130
+
131
+ $divisionOfRemainder = gmp_strval(
132
+ gmp_div_q(
133
+ gmp_mul($remainder, gmp_init('1'.str_pad('', $this->scale, '0'))),
134
+ gmp_init((string) $divisor),
135
+ GMP_ROUND_MINUSINF
136
+ )
137
+ );
138
+
139
+ return gmp_strval($integer).'.'.str_pad($divisionOfRemainder, $this->scale, '0', STR_PAD_LEFT);
140
+ }
141
+
142
+ /**
143
+ * {@inheritdoc}
144
+ */
145
+ public function ceil($number)
146
+ {
147
+ $number = Number::fromNumber($number);
148
+
149
+ if ($number->isInteger()) {
150
+ return (string) $number;
151
+ }
152
+
153
+ if ($number->isNegative()) {
154
+ return $this->add($number->getIntegerPart(), '0');
155
+ }
156
+
157
+ return $this->add($number->getIntegerPart(), '1');
158
+ }
159
+
160
+ /**
161
+ * {@inheritdoc}
162
+ */
163
+ public function floor($number)
164
+ {
165
+ $number = Number::fromNumber($number);
166
+
167
+ if ($number->isInteger()) {
168
+ return (string) $number;
169
+ }
170
+
171
+ if ($number->isNegative()) {
172
+ return $this->add($number->getIntegerPart(), '-1');
173
+ }
174
+
175
+ return $this->add($number->getIntegerPart(), '0');
176
+ }
177
+
178
+ /**
179
+ * {@inheritdoc}
180
+ */
181
+ public function absolute($number)
182
+ {
183
+ return ltrim($number, '-');
184
+ }
185
+
186
+ /**
187
+ * {@inheritdoc}
188
+ */
189
+ public function round($number, $roundingMode)
190
+ {
191
+ $number = Number::fromNumber($number);
192
+
193
+ if ($number->isInteger()) {
194
+ return (string) $number;
195
+ }
196
+
197
+ if ($number->isHalf() === false) {
198
+ return $this->roundDigit($number);
199
+ }
200
+
201
+ if (Money::ROUND_HALF_UP === $roundingMode) {
202
+ return $this->add(
203
+ $number->getIntegerPart(),
204
+ $number->getIntegerRoundingMultiplier()
205
+ );
206
+ }
207
+
208
+ if (Money::ROUND_HALF_DOWN === $roundingMode) {
209
+ return $this->add($number->getIntegerPart(), '0');
210
+ }
211
+
212
+ if (Money::ROUND_HALF_EVEN === $roundingMode) {
213
+ if ($number->isCurrentEven()) {
214
+ return $this->add($number->getIntegerPart(), '0');
215
+ }
216
+
217
+ return $this->add(
218
+ $number->getIntegerPart(),
219
+ $number->getIntegerRoundingMultiplier()
220
+ );
221
+ }
222
+
223
+ if (Money::ROUND_HALF_ODD === $roundingMode) {
224
+ if ($number->isCurrentEven()) {
225
+ return $this->add(
226
+ $number->getIntegerPart(),
227
+ $number->getIntegerRoundingMultiplier()
228
+ );
229
+ }
230
+
231
+ return $this->add($number->getIntegerPart(), '0');
232
+ }
233
+
234
+ if (Money::ROUND_HALF_POSITIVE_INFINITY === $roundingMode) {
235
+ if ($number->isNegative()) {
236
+ return $this->add(
237
+ $number->getIntegerPart(),
238
+ '0'
239
+ );
240
+ }
241
+
242
+ return $this->add(
243
+ $number->getIntegerPart(),
244
+ $number->getIntegerRoundingMultiplier()
245
+ );
246
+ }
247
+
248
+ if (Money::ROUND_HALF_NEGATIVE_INFINITY === $roundingMode) {
249
+ if ($number->isNegative()) {
250
+ return $this->add(
251
+ $number->getIntegerPart(),
252
+ $number->getIntegerRoundingMultiplier()
253
+ );
254
+ }
255
+
256
+ return $this->add(
257
+ $number->getIntegerPart(),
258
+ '0'
259
+ );
260
+ }
261
+
262
+ throw new \InvalidArgumentException('Unknown rounding mode');
263
+ }
264
+
265
+ /**
266
+ * @param $number
267
+ *
268
+ * @return string
269
+ */
270
+ private function roundDigit(Number $number)
271
+ {
272
+ if ($number->isCloserToNext()) {
273
+ return $this->add(
274
+ $number->getIntegerPart(),
275
+ $number->getIntegerRoundingMultiplier()
276
+ );
277
+ }
278
+
279
+ return $this->add($number->getIntegerPart(), '0');
280
+ }
281
+
282
+ /**
283
+ * {@inheritdoc}
284
+ */
285
+ public function share($amount, $ratio, $total)
286
+ {
287
+ return $this->floor($this->divide($this->multiply($amount, $ratio), $total));
288
+ }
289
+
290
+ /**
291
+ * {@inheritdoc}
292
+ */
293
+ public function mod($amount, $divisor)
294
+ {
295
+ // gmp_mod() only calculates non-negative integers, so we use absolutes
296
+ $remainder = gmp_mod($this->absolute($amount), $this->absolute($divisor));
297
+
298
+ // If the amount was negative, we negate the result of the modulus operation
299
+ $amount = Number::fromNumber($amount);
300
+
301
+ if ($amount->isNegative()) {
302
+ $remainder = gmp_neg($remainder);
303
+ }
304
+
305
+ return gmp_strval($remainder);
306
+ }
307
+ }
vendor/moneyphp/money/src/Calculator/PhpCalculator.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Calculator;
4
+
5
+ use Money\Calculator;
6
+ use Money\Money;
7
+ use Money\Number;
8
+
9
+ /**
10
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
11
+ */
12
+ final class PhpCalculator implements Calculator
13
+ {
14
+ /**
15
+ * {@inheritdoc}
16
+ */
17
+ public static function supported()
18
+ {
19
+ return true;
20
+ }
21
+
22
+ /**
23
+ * {@inheritdoc}
24
+ */
25
+ public function compare($a, $b)
26
+ {
27
+ return ($a < $b) ? -1 : (($a > $b) ? 1 : 0);
28
+ }
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public function add($amount, $addend)
34
+ {
35
+ $result = $amount + $addend;
36
+
37
+ $this->assertInteger($result);
38
+
39
+ return (string) $result;
40
+ }
41
+
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function subtract($amount, $subtrahend)
46
+ {
47
+ $result = $amount - $subtrahend;
48
+
49
+ $this->assertInteger($result);
50
+
51
+ return (string) $result;
52
+ }
53
+
54
+ /**
55
+ * {@inheritdoc}
56
+ */
57
+ public function multiply($amount, $multiplier)
58
+ {
59
+ $result = $amount * $multiplier;
60
+
61
+ $this->assertIntegerBounds($result);
62
+
63
+ return $this->castString($result);
64
+ }
65
+
66
+ /**
67
+ * {@inheritdoc}
68
+ */
69
+ public function divide($amount, $divisor)
70
+ {
71
+ $result = $amount / $divisor;
72
+
73
+ $this->assertIntegerBounds($result);
74
+
75
+ return $this->castString($result);
76
+ }
77
+
78
+ /**
79
+ * {@inheritdoc}
80
+ */
81
+ public function ceil($number)
82
+ {
83
+ return $this->castInteger(ceil($number));
84
+ }
85
+
86
+ /**
87
+ * {@inheritdoc}
88
+ */
89
+ public function floor($number)
90
+ {
91
+ return $this->castInteger(floor($number));
92
+ }
93
+
94
+ /**
95
+ * {@inheritdoc}
96
+ */
97
+ public function absolute($number)
98
+ {
99
+ $result = ltrim($number, '-');
100
+
101
+ $this->assertIntegerBounds($result);
102
+
103
+ return (string) $result;
104
+ }
105
+
106
+ /**
107
+ * {@inheritdoc}
108
+ */
109
+ public function round($number, $roundingMode)
110
+ {
111
+ if (Money::ROUND_HALF_POSITIVE_INFINITY === $roundingMode) {
112
+ $number = Number::fromNumber($number);
113
+
114
+ if ($number->isHalf()) {
115
+ return $this->castInteger(ceil((string) $number));
116
+ }
117
+
118
+ return $this->castInteger(round((string) $number, 0, Money::ROUND_HALF_UP));
119
+ }
120
+
121
+ if (Money::ROUND_HALF_NEGATIVE_INFINITY === $roundingMode) {
122
+ $number = Number::fromNumber($number);
123
+
124
+ if ($number->isHalf()) {
125
+ return $this->castInteger(floor((string) $number));
126
+ }
127
+
128
+ return $this->castInteger(round((string) $number, 0, Money::ROUND_HALF_DOWN));
129
+ }
130
+
131
+ return $this->castInteger(round($number, 0, $roundingMode));
132
+ }
133
+
134
+ /**
135
+ * {@inheritdoc}
136
+ */
137
+ public function share($amount, $ratio, $total)
138
+ {
139
+ return $this->castInteger(floor($amount * $ratio / $total));
140
+ }
141
+
142
+ /**
143
+ * {@inheritdoc}
144
+ */
145
+ public function mod($amount, $divisor)
146
+ {
147
+ $result = $amount % $divisor;
148
+
149
+ $this->assertIntegerBounds($result);
150
+
151
+ return (string) $result;
152
+ }
153
+
154
+ /**
155
+ * Asserts that an integer value didn't become something else
156
+ * (after some arithmetic operation).
157
+ *
158
+ * @param int $amount
159
+ *
160
+ * @throws \OverflowException If integer overflow occured
161
+ * @throws \UnderflowException If integer underflow occured
162
+ */
163
+ private function assertIntegerBounds($amount)
164
+ {
165
+ if ($amount > PHP_INT_MAX) {
166
+ throw new \OverflowException('You overflowed the maximum allowed integer (PHP_INT_MAX)');
167
+ } elseif ($amount < ~PHP_INT_MAX) {
168
+ throw new \UnderflowException('You underflowed the minimum allowed integer (PHP_INT_MAX)');
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Casts an amount to integer ensuring that an overflow/underflow did not occur.
174
+ *
175
+ * @param int $amount
176
+ *
177
+ * @return string
178
+ */
179
+ private function castInteger($amount)
180
+ {
181
+ $this->assertIntegerBounds($amount);
182
+
183
+ return (string) intval($amount);
184
+ }
185
+
186
+ /**
187
+ * Asserts that integer remains integer after arithmetic operations.
188
+ *
189
+ * @param int $amount
190
+ */
191
+ private function assertInteger($amount)
192
+ {
193
+ if (filter_var($amount, FILTER_VALIDATE_INT) === false) {
194
+ throw new \UnexpectedValueException('The result of arithmetic operation is not an integer');
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Casts an amount to string ensuring that the decimal separator is dot regardless of the locale.
200
+ *
201
+ * @param int|float $amount
202
+ *
203
+ * @return string
204
+ */
205
+ private function castString($amount)
206
+ {
207
+ if (is_float($amount)) {
208
+ return sprintf('%.14F', $amount);
209
+ }
210
+
211
+ return (string) $amount;
212
+ }
213
+ }
vendor/moneyphp/money/src/Converter.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Provides a way to convert Money to Money in another Currency using an exchange rate.
7
+ *
8
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
9
+ */
10
+ final class Converter
11
+ {
12
+ /**
13
+ * @var Currencies
14
+ */
15
+ private $currencies;
16
+
17
+ /**
18
+ * @var Exchange
19
+ */
20
+ private $exchange;
21
+
22
+ /**
23
+ * @param Currencies $currencies
24
+ * @param Exchange $exchange
25
+ */
26
+ public function __construct(Currencies $currencies, Exchange $exchange)
27
+ {
28
+ $this->currencies = $currencies;
29
+ $this->exchange = $exchange;
30
+ }
31
+
32
+ /**
33
+ * @param Money $money
34
+ * @param Currency $counterCurrency
35
+ * @param int $roundingMode
36
+ *
37
+ * @return Money
38
+ */
39
+ public function convert(Money $money, Currency $counterCurrency, $roundingMode = Money::ROUND_HALF_UP)
40
+ {
41
+ $baseCurrency = $money->getCurrency();
42
+ $ratio = $this->exchange->quote($baseCurrency, $counterCurrency)->getConversionRatio();
43
+
44
+ $baseCurrencySubunit = $this->currencies->subunitFor($baseCurrency);
45
+ $counterCurrencySubunit = $this->currencies->subunitFor($counterCurrency);
46
+ $subunitDifference = $baseCurrencySubunit - $counterCurrencySubunit;
47
+
48
+ $ratio = (string) Number::fromFloat($ratio)->base10($subunitDifference);
49
+
50
+ $counterValue = $money->multiply($ratio, $roundingMode);
51
+
52
+ return new Money($counterValue->getAmount(), $counterCurrency);
53
+ }
54
+ }
vendor/moneyphp/money/src/Currencies.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ use Money\Exception\UnknownCurrencyException;
6
+
7
+ /**
8
+ * Implement this to provide a list of currencies.
9
+ *
10
+ * @author Mathias Verraes
11
+ */
12
+ interface Currencies extends \IteratorAggregate
13
+ {
14
+ /**
15
+ * Checks whether a currency is available in the current context.
16
+ *
17
+ * @param Currency $currency
18
+ *
19
+ * @return bool
20
+ */
21
+ public function contains(Currency $currency);
22
+
23
+ /**
24
+ * Returns the subunit for a currency.
25
+ *
26
+ * @param Currency $currency
27
+ *
28
+ * @return int
29
+ *
30
+ * @throws UnknownCurrencyException If currency is not available in the current context
31
+ */
32
+ public function subunitFor(Currency $currency);
33
+ }
vendor/moneyphp/money/src/Currencies/AggregateCurrencies.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Currencies;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currency;
7
+ use Money\Exception\UnknownCurrencyException;
8
+
9
+ /**
10
+ * Aggregates several currency repositories.
11
+ *
12
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
13
+ */
14
+ final class AggregateCurrencies implements Currencies
15
+ {
16
+ /**
17
+ * @var Currencies[]
18
+ */
19
+ private $currencies;
20
+
21
+ /**
22
+ * @param Currencies[] $currencies
23
+ */
24
+ public function __construct(array $currencies)
25
+ {
26
+ foreach ($currencies as $c) {
27
+ if (false === $c instanceof Currencies) {
28
+ throw new \InvalidArgumentException('All currency repositories must implement '.Currencies::class);
29
+ }
30
+ }
31
+
32
+ $this->currencies = $currencies;
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function contains(Currency $currency)
39
+ {
40
+ foreach ($this->currencies as $currencies) {
41
+ if ($currencies->contains($currency)) {
42
+ return true;
43
+ }
44
+ }
45
+
46
+ return false;
47
+ }
48
+
49
+ /**
50
+ * {@inheritdoc}
51
+ */
52
+ public function subunitFor(Currency $currency)
53
+ {
54
+ foreach ($this->currencies as $currencies) {
55
+ if ($currencies->contains($currency)) {
56
+ return $currencies->subunitFor($currency);
57
+ }
58
+ }
59
+
60
+ throw new UnknownCurrencyException('Cannot find currency '.$currency->getCode());
61
+ }
62
+
63
+ /**
64
+ * {@inheritdoc}
65
+ */
66
+ public function getIterator()
67
+ {
68
+ $iterator = new \AppendIterator();
69
+
70
+ foreach ($this->currencies as $currencies) {
71
+ $iterator->append($currencies->getIterator());
72
+ }
73
+
74
+ return $iterator;
75
+ }
76
+ }
vendor/moneyphp/money/src/Currencies/BitcoinCurrencies.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Currencies;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currency;
7
+ use Money\Exception\UnknownCurrencyException;
8
+
9
+ /**
10
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
11
+ */
12
+ final class BitcoinCurrencies implements Currencies
13
+ {
14
+ const CODE = 'XBT';
15
+
16
+ const SYMBOL = "\xC9\x83";
17
+
18
+ /**
19
+ * {@inheritdoc}
20
+ */
21
+ public function contains(Currency $currency)
22
+ {
23
+ return self::CODE === $currency->getCode();
24
+ }
25
+
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ public function subunitFor(Currency $currency)
30
+ {
31
+ if ($currency->getCode() !== self::CODE) {
32
+ throw new UnknownCurrencyException(
33
+ $currency->getCode().' is not bitcoin and is not supported by this currency repository'
34
+ );
35
+ }
36
+
37
+ return 8;
38
+ }
39
+
40
+ /**
41
+ * {@inheritdoc}
42
+ */
43
+ public function getIterator()
44
+ {
45
+ return new \ArrayIterator([new Currency(self::CODE)]);
46
+ }
47
+ }
vendor/moneyphp/money/src/Currencies/CachedCurrencies.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Currencies;
4
+
5
+ use Cache\Taggable\TaggableItemInterface;
6
+ use Money\Currencies;
7
+ use Money\Currency;
8
+ use Psr\Cache\CacheItemPoolInterface;
9
+
10
+ /**
11
+ * Cache the result of currency checking.
12
+ *
13
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
14
+ */
15
+ final class CachedCurrencies implements Currencies
16
+ {
17
+ /**
18
+ * @var Currencies
19
+ */
20
+ private $currencies;
21
+
22
+ /**
23
+ * @var CacheItemPoolInterface
24
+ */
25
+ private $pool;
26
+
27
+ /**
28
+ * @param Currencies $currencies
29
+ * @param CacheItemPoolInterface $pool
30
+ */
31
+ public function __construct(Currencies $currencies, CacheItemPoolInterface $pool)
32
+ {
33
+ $this->currencies = $currencies;
34
+ $this->pool = $pool;
35
+ }
36
+
37
+ /**
38
+ * {@inheritdoc}
39
+ */
40
+ public function contains(Currency $currency)
41
+ {
42
+ $item = $this->pool->getItem('currency|availability|'.$currency->getCode());
43
+
44
+ if (false === $item->isHit()) {
45
+ $item->set($this->currencies->contains($currency));
46
+
47
+ if ($item instanceof TaggableItemInterface) {
48
+ $item->addTag('currency.availability');
49
+ }
50
+
51
+ $this->pool->save($item);
52
+ }
53
+
54
+ return $item->get();
55
+ }
56
+
57
+ /**
58
+ * {@inheritdoc}
59
+ */
60
+ public function subunitFor(Currency $currency)
61
+ {
62
+ $item = $this->pool->getItem('currency|subunit|'.$currency->getCode());
63
+
64
+ if (false === $item->isHit()) {
65
+ $item->set($this->currencies->subunitFor($currency));
66
+
67
+ if ($item instanceof TaggableItemInterface) {
68
+ $item->addTag('currency.subunit');
69
+ }
70
+
71
+ $this->pool->save($item);
72
+ }
73
+
74
+ return $item->get();
75
+ }
76
+
77
+ /**
78
+ * {@inheritdoc}
79
+ */
80
+ public function getIterator()
81
+ {
82
+ return new \CallbackFilterIterator(
83
+ $this->currencies->getIterator(),
84
+ function (Currency $currency) {
85
+ $item = $this->pool->getItem('currency|availability|'.$currency->getCode());
86
+ $item->set(true);
87
+
88
+ if ($item instanceof TaggableItemInterface) {
89
+ $item->addTag('currency.availability');
90
+ }
91
+
92
+ $this->pool->save($item);
93
+
94
+ return true;
95
+ }
96
+ );
97
+ }
98
+ }
vendor/moneyphp/money/src/Currencies/CurrencyList.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Currencies;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currency;
7
+ use Money\Exception\UnknownCurrencyException;
8
+
9
+ /**
10
+ * A list of custom currencies.
11
+ *
12
+ * @author George Mponos <gmponos@gmail.com>
13
+ */
14
+ final class CurrencyList implements Currencies
15
+ {
16
+ /**
17
+ * Map of currencies indexed by code.
18
+ *
19
+ * @var array
20
+ */
21
+ private $currencies;
22
+
23
+ public function __construct(array $currencies)
24
+ {
25
+ foreach ($currencies as $currencyCode => $subunit) {
26
+ if (empty($currencyCode) || !is_string($currencyCode)) {
27
+ throw new \InvalidArgumentException(
28
+ sprintf('Currency code must be a string and not empty. "%s" given', $currencyCode)
29
+ );
30
+ }
31
+
32
+ if (!is_int($subunit) || $subunit < 0) {
33
+ throw new \InvalidArgumentException(
34
+ sprintf('Currency %s does not have a valid minor unit. Must be a positive integer.', $currencyCode)
35
+ );
36
+ }
37
+ }
38
+
39
+ $this->currencies = $currencies;
40
+ }
41
+
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function contains(Currency $currency)
46
+ {
47
+ return isset($this->currencies[$currency->getCode()]);
48
+ }
49
+
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ public function subunitFor(Currency $currency)
54
+ {
55
+ if (!$this->contains($currency)) {
56
+ throw new UnknownCurrencyException('Cannot find currency '.$currency->getCode());
57
+ }
58
+
59
+ return $this->currencies[$currency->getCode()];
60
+ }
61
+
62
+ /**
63
+ * {@inheritdoc}
64
+ */
65
+ public function getIterator()
66
+ {
67
+ return new \ArrayIterator(
68
+ array_map(
69
+ function ($code) {
70
+ return new Currency($code);
71
+ },
72
+ array_keys($this->currencies)
73
+ )
74
+ );
75
+ }
76
+ }
vendor/moneyphp/money/src/Currencies/ISOCurrencies.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Currencies;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currency;
7
+ use Money\Exception\UnknownCurrencyException;
8
+
9
+ /**
10
+ * List of supported ISO 4217 currency codes and names.
11
+ *
12
+ * @author Mathias Verraes
13
+ */
14
+ final class ISOCurrencies implements Currencies
15
+ {
16
+ /**
17
+ * Map of known currencies indexed by code.
18
+ *
19
+ * @var array
20
+ */
21
+ private static $currencies;
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ */
26
+ public function contains(Currency $currency)
27
+ {
28
+ return isset($this->getCurrencies()[$currency->getCode()]);
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function subunitFor(Currency $currency)
35
+ {
36
+ if (!$this->contains($currency)) {
37
+ throw new UnknownCurrencyException('Cannot find ISO currency '.$currency->getCode());
38
+ }
39
+
40
+ return $this->getCurrencies()[$currency->getCode()]['minorUnit'];
41
+ }
42
+
43
+ /**
44
+ * Returns the numeric code for a currency.
45
+ *
46
+ * @param Currency $currency
47
+ *
48
+ * @return int
49
+ *
50
+ * @throws UnknownCurrencyException If currency is not available in the current context
51
+ */
52
+ public function numericCodeFor(Currency $currency)
53
+ {
54
+ if (!$this->contains($currency)) {
55
+ throw new UnknownCurrencyException('Cannot find ISO currency '.$currency->getCode());
56
+ }
57
+
58
+ return $this->getCurrencies()[$currency->getCode()]['numericCode'];
59
+ }
60
+
61
+ /**
62
+ * @return \Traversable
63
+ */
64
+ public function getIterator()
65
+ {
66
+ return new \ArrayIterator(
67
+ array_map(
68
+ function ($code) {
69
+ return new Currency($code);
70
+ },
71
+ array_keys($this->getCurrencies())
72
+ )
73
+ );
74
+ }
75
+
76
+ /**
77
+ * Returns a map of known currencies indexed by code.
78
+ *
79
+ * @return array
80
+ */
81
+ private function getCurrencies()
82
+ {
83
+ if (null === self::$currencies) {
84
+ self::$currencies = $this->loadCurrencies();
85
+ }
86
+
87
+ return self::$currencies;
88
+ }
89
+
90
+ /**
91
+ * @return array
92
+ */
93
+ private function loadCurrencies()
94
+ {
95
+ $file = __DIR__.'/../../resources/currency.php';
96
+
97
+ if (file_exists($file)) {
98
+ return require $file;
99
+ }
100
+
101
+ throw new \RuntimeException('Failed to load currency ISO codes.');
102
+ }
103
+ }
vendor/moneyphp/money/src/Currency.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Currency Value Object.
7
+ *
8
+ * Holds Currency specific data.
9
+ *
10
+ * @author Mathias Verraes
11
+ */
12
+ final class Currency implements \JsonSerializable
13
+ {
14
+ /**
15
+ * Currency code.
16
+ *
17
+ * @var string
18
+ */
19
+ private $code;
20
+
21
+ /**
22
+ * @param string $code
23
+ */
24
+ public function __construct($code)
25
+ {
26
+ if (!is_string($code)) {
27
+ throw new \InvalidArgumentException('Currency code should be string');
28
+ }
29
+
30
+ $this->code = $code;
31
+ }
32
+
33
+ /**
34
+ * Returns the currency code.
35
+ *
36
+ * @return string
37
+ */
38
+ public function getCode()
39
+ {
40
+ return $this->code;
41
+ }
42
+
43
+ /**
44
+ * Checks whether this currency is the same as an other.
45
+ *
46
+ * @param Currency $other
47
+ *
48
+ * @return bool
49
+ */
50
+ public function equals(Currency $other)
51
+ {
52
+ return $this->code === $other->code;
53
+ }
54
+
55
+ /**
56
+ * Checks whether this currency is available in the passed context.
57
+ *
58
+ * @param Currencies $currencies
59
+ *
60
+ * @return bool
61
+ */
62
+ public function isAvailableWithin(Currencies $currencies)
63
+ {
64
+ return $currencies->contains($this);
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function __toString()
71
+ {
72
+ return $this->getCode();
73
+ }
74
+
75
+ /**
76
+ * {@inheritdoc}
77
+ *
78
+ * @return string
79
+ */
80
+ public function jsonSerialize()
81
+ {
82
+ return $this->code;
83
+ }
84
+ }
vendor/moneyphp/money/src/CurrencyPair.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Currency Pair holding a base, a counter currency and a conversion ratio.
7
+ *
8
+ * @author Mathias Verraes
9
+ *
10
+ * @see http://en.wikipedia.org/wiki/Currency_pair
11
+ */
12
+ final class CurrencyPair implements \JsonSerializable
13
+ {
14
+ /**
15
+ * Currency to convert from.
16
+ *
17
+ * @var Currency
18
+ */
19
+ private $baseCurrency;
20
+
21
+ /**
22
+ * Currency to convert to.
23
+ *
24
+ * @var Currency
25
+ */
26
+ private $counterCurrency;
27
+
28
+ /**
29
+ * @var float
30
+ */
31
+ private $conversionRatio;
32
+
33
+ /**
34
+ * @param Currency $baseCurrency
35
+ * @param Currency $counterCurrency
36
+ * @param float $conversionRatio
37
+ *
38
+ * @throws \InvalidArgumentException If conversion ratio is not numeric
39
+ */
40
+ public function __construct(Currency $baseCurrency, Currency $counterCurrency, $conversionRatio)
41
+ {
42
+ if (!is_numeric($conversionRatio)) {
43
+ throw new \InvalidArgumentException('Conversion ratio must be numeric');
44
+ }
45
+
46
+ $this->counterCurrency = $counterCurrency;
47
+ $this->baseCurrency = $baseCurrency;
48
+ $this->conversionRatio = (float) $conversionRatio;
49
+ }
50
+
51
+ /**
52
+ * Creates a new Currency Pair based on "EUR/USD 1.2500" form representation.
53
+ *
54
+ * @param string $iso String representation of the form "EUR/USD 1.2500"
55
+ *
56
+ * @return CurrencyPair
57
+ *
58
+ * @throws \InvalidArgumentException Format of $iso is invalid
59
+ */
60
+ public static function createFromIso($iso)
61
+ {
62
+ $currency = '([A-Z]{2,3})';
63
+ $ratio = "([0-9]*\.?[0-9]+)"; // @see http://www.regular-expressions.info/floatingpoint.html
64
+ $pattern = '#'.$currency.'/'.$currency.' '.$ratio.'#';
65
+
66
+ $matches = [];
67
+
68
+ if (!preg_match($pattern, $iso, $matches)) {
69
+ throw new \InvalidArgumentException(
70
+ sprintf(
71
+ 'Cannot create currency pair from ISO string "%s", format of string is invalid',
72
+ $iso
73
+ )
74
+ );
75
+ }
76
+
77
+ return new self(new Currency($matches[1]), new Currency($matches[2]), $matches[3]);
78
+ }
79
+
80
+ /**
81
+ * Returns the counter currency.
82
+ *
83
+ * @return Currency
84
+ */
85
+ public function getCounterCurrency()
86
+ {
87
+ return $this->counterCurrency;
88
+ }
89
+
90
+ /**
91
+ * Returns the base currency.
92
+ *
93
+ * @return Currency
94
+ */
95
+ public function getBaseCurrency()
96
+ {
97
+ return $this->baseCurrency;
98
+ }
99
+
100
+ /**
101
+ * Returns the conversion ratio.
102
+ *
103
+ * @return float
104
+ */
105
+ public function getConversionRatio()
106
+ {
107
+ return $this->conversionRatio;
108
+ }
109
+
110
+ /**
111
+ * Checks if an other CurrencyPair has the same parameters as this.
112
+ *
113
+ * @param CurrencyPair $other
114
+ *
115
+ * @return bool
116
+ */
117
+ public function equals(CurrencyPair $other)
118
+ {
119
+ return
120
+ $this->baseCurrency->equals($other->baseCurrency)
121
+ && $this->counterCurrency->equals($other->counterCurrency)
122
+ && $this->conversionRatio === $other->conversionRatio
123
+ ;
124
+ }
125
+
126
+ /**
127
+ * {@inheritdoc}
128
+ *
129
+ * @return array
130
+ */
131
+ public function jsonSerialize()
132
+ {
133
+ return [
134
+ 'baseCurrency' => $this->baseCurrency,
135
+ 'counterCurrency' => $this->counterCurrency,
136
+ 'ratio' => $this->conversionRatio,
137
+ ];
138
+ }
139
+ }
vendor/moneyphp/money/src/Exception.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Common interface for all exceptions thrown by this library.
7
+ *
8
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
9
+ */
10
+ interface Exception
11
+ {
12
+ }
vendor/moneyphp/money/src/Exception/FormatterException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exception;
4
+
5
+ use Money\Exception;
6
+
7
+ /**
8
+ * Thrown when a Money object cannot be formatted into a string.
9
+ *
10
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
11
+ */
12
+ final class FormatterException extends \RuntimeException implements Exception
13
+ {
14
+ }
vendor/moneyphp/money/src/Exception/ParserException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exception;
4
+
5
+ use Money\Exception;
6
+
7
+ /**
8
+ * Thrown when a string cannot be parsed to a Money object.
9
+ *
10
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
11
+ */
12
+ final class ParserException extends \RuntimeException implements Exception
13
+ {
14
+ }
vendor/moneyphp/money/src/Exception/UnknownCurrencyException.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exception;
4
+
5
+ use Money\Exception;
6
+
7
+ /**
8
+ * Thrown when trying to get ISO currency that does not exists.
9
+ *
10
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
11
+ */
12
+ final class UnknownCurrencyException extends \DomainException implements Exception
13
+ {
14
+ }
vendor/moneyphp/money/src/Exception/UnresolvableCurrencyPairException.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exception;
4
+
5
+ use Money\Currency;
6
+ use Money\Exception;
7
+
8
+ /**
9
+ * Thrown when there is no currency pair (rate) available for the given currencies.
10
+ *
11
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
12
+ */
13
+ final class UnresolvableCurrencyPairException extends \InvalidArgumentException implements Exception
14
+ {
15
+ /**
16
+ * Creates an exception from Currency objects.
17
+ *
18
+ * @param Currency $baseCurrency
19
+ * @param Currency $counterCurrency
20
+ *
21
+ * @return UnresolvableCurrencyPairException
22
+ */
23
+ public static function createFromCurrencies(Currency $baseCurrency, Currency $counterCurrency)
24
+ {
25
+ $message = sprintf(
26
+ 'Cannot resolve a currency pair for currencies: %s/%s',
27
+ $baseCurrency->getCode(),
28
+ $counterCurrency->getCode()
29
+ );
30
+
31
+ return new self($message);
32
+ }
33
+ }
vendor/moneyphp/money/src/Exchange.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ use Money\Exception\UnresolvableCurrencyPairException;
6
+
7
+ /**
8
+ * Provides a way to get exchange rate from a third-party source and return a currency pair.
9
+ *
10
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
11
+ */
12
+ interface Exchange
13
+ {
14
+ /**
15
+ * Returns a currency pair for the passed currencies with the rate coming from a third-party source.
16
+ *
17
+ * @param Currency $baseCurrency
18
+ * @param Currency $counterCurrency
19
+ *
20
+ * @return CurrencyPair
21
+ *
22
+ * @throws UnresolvableCurrencyPairException When there is no currency pair (rate) available for the given currencies
23
+ */
24
+ public function quote(Currency $baseCurrency, Currency $counterCurrency);
25
+ }
vendor/moneyphp/money/src/Exchange/FixedExchange.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exchange;
4
+
5
+ use Money\Currency;
6
+ use Money\CurrencyPair;
7
+ use Money\Exception\UnresolvableCurrencyPairException;
8
+ use Money\Exchange;
9
+
10
+ /**
11
+ * Provides a way to get exchange rate from a static list (array).
12
+ *
13
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
14
+ */
15
+ final class FixedExchange implements Exchange
16
+ {
17
+ /**
18
+ * @var array
19
+ */
20
+ private $list;
21
+
22
+ /**
23
+ * @param array $list
24
+ */
25
+ public function __construct(array $list)
26
+ {
27
+ $this->list = $list;
28
+ }
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public function quote(Currency $baseCurrency, Currency $counterCurrency)
34
+ {
35
+ if (isset($this->list[$baseCurrency->getCode()][$counterCurrency->getCode()])) {
36
+ return new CurrencyPair(
37
+ $baseCurrency,
38
+ $counterCurrency,
39
+ $this->list[$baseCurrency->getCode()][$counterCurrency->getCode()]
40
+ );
41
+ }
42
+
43
+ throw UnresolvableCurrencyPairException::createFromCurrencies($baseCurrency, $counterCurrency);
44
+ }
45
+ }
vendor/moneyphp/money/src/Exchange/IndirectExchange.php ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exchange;
4
+
5
+ use Money\Calculator;
6
+ use Money\Calculator\BcMathCalculator;
7
+ use Money\Calculator\GmpCalculator;
8
+ use Money\Calculator\PhpCalculator;
9
+ use Money\Currencies;
10
+ use Money\Currency;
11
+ use Money\CurrencyPair;
12
+ use Money\Exception\UnresolvableCurrencyPairException;
13
+ use Money\Exchange;
14
+
15
+ /**
16
+ * Provides a way to get an exchange rate through a minimal set of intermediate conversions.
17
+ *
18
+ * @author Michael Cordingley <Michael.Cordingley@gmail.com>
19
+ */
20
+ final class IndirectExchange implements Exchange
21
+ {
22
+ /**
23
+ * @var Calculator
24
+ */
25
+ private static $calculator;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ private static $calculators = [
31
+ BcMathCalculator::class,
32
+ GmpCalculator::class,
33
+ PhpCalculator::class,
34
+ ];
35
+
36
+ /**
37
+ * @var Currencies
38
+ */
39
+ private $currencies;
40
+
41
+ /**
42
+ * @var Exchange
43
+ */
44
+ private $exchange;
45
+
46
+ /**
47
+ * @param Exchange $exchange
48
+ * @param Currencies $currencies
49
+ */
50
+ public function __construct(Exchange $exchange, Currencies $currencies)
51
+ {
52
+ $this->exchange = $exchange;
53
+ $this->currencies = $currencies;
54
+ }
55
+
56
+ /**
57
+ * @param string $calculator
58
+ */
59
+ public static function registerCalculator($calculator)
60
+ {
61
+ if (is_a($calculator, Calculator::class, true) === false) {
62
+ throw new \InvalidArgumentException('Calculator must implement '.Calculator::class);
63
+ }
64
+
65
+ array_unshift(self::$calculators, $calculator);
66
+ }
67
+
68
+ /**
69
+ * {@inheritdoc}
70
+ */
71
+ public function quote(Currency $baseCurrency, Currency $counterCurrency)
72
+ {
73
+ try {
74
+ return $this->exchange->quote($baseCurrency, $counterCurrency);
75
+ } catch (UnresolvableCurrencyPairException $exception) {
76
+ $rate = array_reduce($this->getConversions($baseCurrency, $counterCurrency), function ($carry, CurrencyPair $pair) {
77
+ return static::getCalculator()->multiply($carry, $pair->getConversionRatio());
78
+ }, '1.0');
79
+
80
+ return new CurrencyPair($baseCurrency, $counterCurrency, $rate);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * @param Currency $baseCurrency
86
+ * @param Currency $counterCurrency
87
+ *
88
+ * @return CurrencyPair[]
89
+ *
90
+ * @throws UnresolvableCurrencyPairException
91
+ */
92
+ private function getConversions(Currency $baseCurrency, Currency $counterCurrency)
93
+ {
94
+ $startNode = $this->initializeNode($baseCurrency);
95
+ $startNode->discovered = true;
96
+
97
+ $nodes = [$baseCurrency->getCode() => $startNode];
98
+
99
+ $frontier = new \SplQueue();
100
+ $frontier->enqueue($startNode);
101
+
102
+ while ($frontier->count()) {
103
+ /** @var \stdClass $currentNode */
104
+ $currentNode = $frontier->dequeue();
105
+
106
+ /** @var Currency $currentCurrency */
107
+ $currentCurrency = $currentNode->currency;
108
+
109
+ if ($currentCurrency->equals($counterCurrency)) {
110
+ return $this->reconstructConversionChain($nodes, $currentNode);
111
+ }
112
+
113
+ /** @var Currency $candidateCurrency */
114
+ foreach ($this->currencies as $candidateCurrency) {
115
+ if (!isset($nodes[$candidateCurrency->getCode()])) {
116
+ $nodes[$candidateCurrency->getCode()] = $this->initializeNode($candidateCurrency);
117
+ }
118
+
119
+ /** @var \stdClass $node */
120
+ $node = $nodes[$candidateCurrency->getCode()];
121
+
122
+ if (!$node->discovered) {
123
+ try {
124
+ // Check if the candidate is a neighbor. This will throw an exception if it isn't.
125
+ $this->exchange->quote($currentCurrency, $candidateCurrency);
126
+
127
+ $node->discovered = true;
128
+ $node->parent = $currentNode;
129
+
130
+ $frontier->enqueue($node);
131
+ } catch (UnresolvableCurrencyPairException $exception) {
132
+ // Not a neighbor. Move on.
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ throw UnresolvableCurrencyPairException::createFromCurrencies($baseCurrency, $counterCurrency);
139
+ }
140
+
141
+ /**
142
+ * @param Currency $currency
143
+ *
144
+ * @return \stdClass
145
+ */
146
+ private function initializeNode(Currency $currency)
147
+ {
148
+ $node = new \stdClass();
149
+
150
+ $node->currency = $currency;
151
+ $node->discovered = false;
152
+ $node->parent = null;
153
+
154
+ return $node;
155
+ }
156
+
157
+ /**
158
+ * @param array $currencies
159
+ * @param \stdClass $goalNode
160
+ *
161
+ * @return CurrencyPair[]
162
+ */
163
+ private function reconstructConversionChain(array $currencies, \stdClass $goalNode)
164
+ {
165
+ $current = $goalNode;
166
+ $conversions = [];
167
+
168
+ while ($current->parent) {
169
+ $previous = $currencies[$current->parent->currency->getCode()];
170
+ $conversions[] = $this->exchange->quote($previous->currency, $current->currency);
171
+ $current = $previous;
172
+ }
173
+
174
+ return array_reverse($conversions);
175
+ }
176
+
177
+ /**
178
+ * @return Calculator
179
+ */
180
+ private function getCalculator()
181
+ {
182
+ if (null === self::$calculator) {
183
+ self::$calculator = self::initializeCalculator();
184
+ }
185
+
186
+ return self::$calculator;
187
+ }
188
+
189
+ /**
190
+ * @return Calculator
191
+ *
192
+ * @throws \RuntimeException If cannot find calculator for money calculations
193
+ */
194
+ private static function initializeCalculator()
195
+ {
196
+ $calculators = self::$calculators;
197
+
198
+ foreach ($calculators as $calculator) {
199
+ /** @var Calculator $calculator */
200
+ if ($calculator::supported()) {
201
+ return new $calculator();
202
+ }
203
+ }
204
+
205
+ throw new \RuntimeException('Cannot find calculator for money calculations');
206
+ }
207
+ }
vendor/moneyphp/money/src/Exchange/ReversedCurrenciesExchange.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exchange;
4
+
5
+ use Money\Currency;
6
+ use Money\CurrencyPair;
7
+ use Money\Exception\UnresolvableCurrencyPairException;
8
+ use Money\Exchange;
9
+
10
+ /**
11
+ * Tries the reverse of the currency pair if one is not available.
12
+ *
13
+ * Note: adding nested ReversedCurrenciesExchange could cause a huge performance hit.
14
+ *
15
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
16
+ */
17
+ final class ReversedCurrenciesExchange implements Exchange
18
+ {
19
+ /**
20
+ * @var Exchange
21
+ */
22
+ private $exchange;
23
+
24
+ /**
25
+ * @param Exchange $exchange
26
+ */
27
+ public function __construct(Exchange $exchange)
28
+ {
29
+ $this->exchange = $exchange;
30
+ }
31
+
32
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function quote(Currency $baseCurrency, Currency $counterCurrency)
36
+ {
37
+ try {
38
+ return $this->exchange->quote($baseCurrency, $counterCurrency);
39
+ } catch (UnresolvableCurrencyPairException $exception) {
40
+ try {
41
+ $currencyPair = $this->exchange->quote($counterCurrency, $baseCurrency);
42
+
43
+ return new CurrencyPair($baseCurrency, $counterCurrency, 1 / $currencyPair->getConversionRatio());
44
+ } catch (UnresolvableCurrencyPairException $inversedException) {
45
+ throw $exception;
46
+ }
47
+ }
48
+ }
49
+ }
vendor/moneyphp/money/src/Exchange/SwapExchange.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Exchange;
4
+
5
+ use Exchanger\Exception\Exception as ExchangerException;
6
+ use Money\Currency;
7
+ use Money\CurrencyPair;
8
+ use Money\Exception\UnresolvableCurrencyPairException;
9
+ use Money\Exchange;
10
+ use Swap\Swap;
11
+
12
+ /**
13
+ * Provides a way to get exchange rate from a third-party source and return a currency pair.
14
+ *
15
+ * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
16
+ */
17
+ final class SwapExchange implements Exchange
18
+ {
19
+ /**
20
+ * @var Swap
21
+ */
22
+ private $swap;
23
+
24
+ /**
25
+ * @param Swap $swap
26
+ */
27
+ public function __construct(Swap $swap)
28
+ {
29
+ $this->swap = $swap;
30
+ }
31
+
32
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function quote(Currency $baseCurrency, Currency $counterCurrency)
36
+ {
37
+ try {
38
+ $rate = $this->swap->latest($baseCurrency->getCode().'/'.$counterCurrency->getCode());
39
+ } catch (ExchangerException $e) {
40
+ throw UnresolvableCurrencyPairException::createFromCurrencies($baseCurrency, $counterCurrency);
41
+ }
42
+
43
+ return new CurrencyPair($baseCurrency, $counterCurrency, $rate->getValue());
44
+ }
45
+ }
vendor/moneyphp/money/src/Formatter/AggregateMoneyFormatter.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Formatter;
4
+
5
+ use Money\Exception\FormatterException;
6
+ use Money\Money;
7
+ use Money\MoneyFormatter;
8
+
9
+ /**
10
+ * Formats a Money object using other Money formatters.
11
+ *
12
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
13
+ */
14
+ final class AggregateMoneyFormatter implements MoneyFormatter
15
+ {
16
+ /**
17
+ * @var MoneyFormatter[]
18
+ */
19
+ private $formatters = [];
20
+
21
+ /**
22
+ * @param MoneyFormatter[] $formatters
23
+ */
24
+ public function __construct(array $formatters)
25
+ {
26
+ if (empty($formatters)) {
27
+ throw new \InvalidArgumentException(sprintf('Initialize an empty %s is not possible', self::class));
28
+ }
29
+
30
+ foreach ($formatters as $currencyCode => $formatter) {
31
+ if (false === $formatter instanceof MoneyFormatter) {
32
+ throw new \InvalidArgumentException('All formatters must implement '.MoneyFormatter::class);
33
+ }
34
+
35
+ $this->formatters[$currencyCode] = $formatter;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function format(Money $money)
43
+ {
44
+ $currencyCode = $money->getCurrency()->getCode();
45
+
46
+ if (isset($this->formatters[$currencyCode])) {
47
+ return $this->formatters[$currencyCode]->format($money);
48
+ }
49
+
50
+ if (isset($this->formatters['*'])) {
51
+ return $this->formatters['*']->format($money);
52
+ }
53
+
54
+ throw new FormatterException('No formatter found for currency '.$currencyCode);
55
+ }
56
+ }
vendor/moneyphp/money/src/Formatter/BitcoinMoneyFormatter.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Formatter;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currencies\BitcoinCurrencies;
7
+ use Money\Exception\FormatterException;
8
+ use Money\Money;
9
+ use Money\MoneyFormatter;
10
+ use Money\Number;
11
+
12
+ /**
13
+ * Formats Money to Bitcoin currency.
14
+ *
15
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
16
+ */
17
+ final class BitcoinMoneyFormatter implements MoneyFormatter
18
+ {
19
+ /**
20
+ * @var int
21
+ */
22
+ private $fractionDigits;
23
+
24
+ /**
25
+ * @var Currencies
26
+ */
27
+ private $currencies;
28
+
29
+ /**
30
+ * @param int $fractionDigits
31
+ * @param Currencies $currencies
32
+ */
33
+ public function __construct($fractionDigits, Currencies $currencies)
34
+ {
35
+ $this->fractionDigits = $fractionDigits;
36
+ $this->currencies = $currencies;
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function format(Money $money)
43
+ {
44
+ if (BitcoinCurrencies::CODE !== $money->getCurrency()->getCode()) {
45
+ throw new FormatterException('Bitcoin Formatter can only format Bitcoin currency');
46
+ }
47
+
48
+ $valueBase = $money->getAmount();
49
+ $negative = false;
50
+
51
+ if ('-' === $valueBase[0]) {
52
+ $negative = true;
53
+ $valueBase = substr($valueBase, 1);
54
+ }
55
+
56
+ $subunit = $this->currencies->subunitFor($money->getCurrency());
57
+ $valueBase = Number::roundMoneyValue($valueBase, $this->fractionDigits, $subunit);
58
+ $valueLength = strlen($valueBase);
59
+
60
+ if ($valueLength > $subunit) {
61
+ $formatted = substr($valueBase, 0, $valueLength - $subunit);
62
+
63
+ if ($subunit) {
64
+ $formatted .= '.';
65
+ $formatted .= substr($valueBase, $valueLength - $subunit);
66
+ }
67
+ } else {
68
+ $formatted = '0.'.str_pad('', $subunit - $valueLength, '0').$valueBase;
69
+ }
70
+
71
+ if ($this->fractionDigits === 0) {
72
+ $formatted = substr($formatted, 0, strpos($formatted, '.'));
73
+ } elseif ($this->fractionDigits > $subunit) {
74
+ $formatted .= str_pad('', $this->fractionDigits - $subunit, '0');
75
+ } elseif ($this->fractionDigits < $subunit) {
76
+ $lastDigit = strpos($formatted, '.') + $this->fractionDigits + 1;
77
+ $formatted = substr($formatted, 0, $lastDigit);
78
+ }
79
+
80
+ $formatted = BitcoinCurrencies::SYMBOL.$formatted;
81
+
82
+ if (true === $negative) {
83
+ $formatted = '-'.$formatted;
84
+ }
85
+
86
+ return $formatted;
87
+ }
88
+ }
vendor/moneyphp/money/src/Formatter/DecimalMoneyFormatter.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Formatter;
4
+
5
+ use Money\Currencies;
6
+ use Money\Money;
7
+ use Money\MoneyFormatter;
8
+
9
+ /**
10
+ * Formats a Money object as a decimal string.
11
+ *
12
+ * @author Teoh Han Hui <teohhanhui@gmail.com>
13
+ */
14
+ final class DecimalMoneyFormatter implements MoneyFormatter
15
+ {
16
+ /**
17
+ * @var Currencies
18
+ */
19
+ private $currencies;
20
+
21
+ /**
22
+ * @param Currencies $currencies
23
+ */
24
+ public function __construct(Currencies $currencies)
25
+ {
26
+ $this->currencies = $currencies;
27
+ }
28
+
29
+ /**
30
+ * {@inheritdoc}
31
+ */
32
+ public function format(Money $money)
33
+ {
34
+ $valueBase = $money->getAmount();
35
+ $negative = false;
36
+
37
+ if ($valueBase[0] === '-') {
38
+ $negative = true;
39
+ $valueBase = substr($valueBase, 1);
40
+ }
41
+
42
+ $subunit = $this->currencies->subunitFor($money->getCurrency());
43
+ $valueLength = strlen($valueBase);
44
+
45
+ if ($valueLength > $subunit) {
46
+ $formatted = substr($valueBase, 0, $valueLength - $subunit);
47
+ $decimalDigits = substr($valueBase, $valueLength - $subunit);
48
+
49
+ if (strlen($decimalDigits) > 0) {
50
+ $formatted .= '.'.$decimalDigits;
51
+ }
52
+ } else {
53
+ $formatted = '0.'.str_pad('', $subunit - $valueLength, '0').$valueBase;
54
+ }
55
+
56
+ if ($negative === true) {
57
+ $formatted = '-'.$formatted;
58
+ }
59
+
60
+ return $formatted;
61
+ }
62
+ }
vendor/moneyphp/money/src/Formatter/IntlLocalizedDecimalFormatter.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Formatter;
4
+
5
+ use Money\Currencies;
6
+ use Money\Money;
7
+ use Money\MoneyFormatter;
8
+
9
+ /**
10
+ * Formats a Money object using intl extension.
11
+ *
12
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
13
+ */
14
+ final class IntlLocalizedDecimalFormatter implements MoneyFormatter
15
+ {
16
+ /**
17
+ * @var \NumberFormatter
18
+ */
19
+ private $formatter;
20
+
21
+ /**
22
+ * @var Currencies
23
+ */
24
+ private $currencies;
25
+
26
+ /**
27
+ * @param \NumberFormatter $formatter
28
+ * @param Currencies $currencies
29
+ */
30
+ public function __construct(\NumberFormatter $formatter, Currencies $currencies)
31
+ {
32
+ $this->formatter = $formatter;
33
+ $this->currencies = $currencies;
34
+ }
35
+
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function format(Money $money)
40
+ {
41
+ $valueBase = $money->getAmount();
42
+ $negative = false;
43
+
44
+ if ($valueBase[0] === '-') {
45
+ $negative = true;
46
+ $valueBase = substr($valueBase, 1);
47
+ }
48
+
49
+ $subunit = $this->currencies->subunitFor($money->getCurrency());
50
+ $valueLength = strlen($valueBase);
51
+
52
+ if ($valueLength > $subunit) {
53
+ $formatted = substr($valueBase, 0, $valueLength - $subunit);
54
+ $decimalDigits = substr($valueBase, $valueLength - $subunit);
55
+
56
+ if (strlen($decimalDigits) > 0) {
57
+ $formatted .= '.'.$decimalDigits;
58
+ }
59
+ } else {
60
+ $formatted = '0.'.str_pad('', $subunit - $valueLength, '0').$valueBase;
61
+ }
62
+
63
+ if ($negative === true) {
64
+ $formatted = '-'.$formatted;
65
+ }
66
+
67
+ return $this->formatter->format($formatted);
68
+ }
69
+ }
vendor/moneyphp/money/src/Formatter/IntlMoneyFormatter.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Formatter;
4
+
5
+ use Money\Currencies;
6
+ use Money\Money;
7
+ use Money\MoneyFormatter;
8
+
9
+ /**
10
+ * Formats a Money object using intl extension.
11
+ *
12
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
13
+ */
14
+ final class IntlMoneyFormatter implements MoneyFormatter
15
+ {
16
+ /**
17
+ * @var \NumberFormatter
18
+ */
19
+ private $formatter;
20
+
21
+ /**
22
+ * @var Currencies
23
+ */
24
+ private $currencies;
25
+
26
+ /**
27
+ * @param \NumberFormatter $formatter
28
+ * @param Currencies $currencies
29
+ */
30
+ public function __construct(\NumberFormatter $formatter, Currencies $currencies)
31
+ {
32
+ $this->formatter = $formatter;
33
+ $this->currencies = $currencies;
34
+ }
35
+
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function format(Money $money)
40
+ {
41
+ $valueBase = $money->getAmount();
42
+ $negative = false;
43
+
44
+ if ($valueBase[0] === '-') {
45
+ $negative = true;
46
+ $valueBase = substr($valueBase, 1);
47
+ }
48
+
49
+ $subunit = $this->currencies->subunitFor($money->getCurrency());
50
+ $valueLength = strlen($valueBase);
51
+
52
+ if ($valueLength > $subunit) {
53
+ $formatted = substr($valueBase, 0, $valueLength - $subunit);
54
+ $decimalDigits = substr($valueBase, $valueLength - $subunit);
55
+
56
+ if (strlen($decimalDigits) > 0) {
57
+ $formatted .= '.'.$decimalDigits;
58
+ }
59
+ } else {
60
+ $formatted = '0.'.str_pad('', $subunit - $valueLength, '0').$valueBase;
61
+ }
62
+
63
+ if ($negative === true) {
64
+ $formatted = '-'.$formatted;
65
+ }
66
+
67
+ return $this->formatter->formatCurrency($formatted, $money->getCurrency()->getCode());
68
+ }
69
+ }
vendor/moneyphp/money/src/Money.php ADDED
@@ -0,0 +1,563 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ use Money\Calculator\BcMathCalculator;
6
+ use Money\Calculator\GmpCalculator;
7
+ use Money\Calculator\PhpCalculator;
8
+
9
+ /**
10
+ * Money Value Object.
11
+ *
12
+ * @author Mathias Verraes
13
+ */
14
+ final class Money implements \JsonSerializable
15
+ {
16
+ const ROUND_HALF_UP = PHP_ROUND_HALF_UP;
17
+
18
+ const ROUND_HALF_DOWN = PHP_ROUND_HALF_DOWN;
19
+
20
+ const ROUND_HALF_EVEN = PHP_ROUND_HALF_EVEN;
21
+
22
+ const ROUND_HALF_ODD = PHP_ROUND_HALF_ODD;
23
+
24
+ const ROUND_UP = 5;
25
+
26
+ const ROUND_DOWN = 6;
27
+
28
+ const ROUND_HALF_POSITIVE_INFINITY = 7;
29
+
30
+ const ROUND_HALF_NEGATIVE_INFINITY = 8;
31
+
32
+ /**
33
+ * Internal value.
34
+ *
35
+ * @var string
36
+ */
37
+ private $amount;
38
+
39
+ /**
40
+ * @var Currency
41
+ */
42
+ private $currency;
43
+
44
+ /**
45
+ * @var Calculator
46
+ */
47
+ private static $calculator;
48
+
49
+ /**
50
+ * @var array
51
+ */
52
+ private static $calculators = [
53
+ BcMathCalculator::class,
54
+ GmpCalculator::class,
55
+ PhpCalculator::class,
56
+ ];
57
+
58
+ /**
59
+ * @param int|string $amount Amount, expressed in the smallest units of $currency (eg cents)
60
+ * @param Currency $currency
61
+ *
62
+ * @throws \InvalidArgumentException If amount is not integer
63
+ */
64
+ public function __construct($amount, Currency $currency)
65
+ {
66
+ if (filter_var($amount, FILTER_VALIDATE_INT) === false) {
67
+ $numberFromString = Number::fromString($amount);
68
+ if (!$numberFromString->isInteger()) {
69
+ throw new \InvalidArgumentException('Amount must be an integer(ish) value');
70
+ }
71
+
72
+ $amount = $numberFromString->getIntegerPart();
73
+ }
74
+
75
+ $this->amount = (string) $amount;
76
+ $this->currency = $currency;
77
+ }
78
+
79
+ /**
80
+ * Convenience factory method for a Money object.
81
+ *
82
+ * <code>
83
+ * $fiveDollar = Money::USD(500);
84
+ * </code>
85
+ *
86
+ * @param string $method
87
+ * @param array $arguments
88
+ *
89
+ * @return Money
90
+ *
91
+ * @throws \InvalidArgumentException If amount is not integer
92
+ */
93
+ public static function __callStatic($method, $arguments)
94
+ {
95
+ return new self($arguments[0], new Currency($method));
96
+ }
97
+
98
+ /**
99
+ * Returns a new Money instance based on the current one using the Currency.
100
+ *
101
+ * @param int|string $amount
102
+ *
103
+ * @return Money
104
+ *
105
+ * @throws \InvalidArgumentException If amount is not integer
106
+ */
107
+ private function newInstance($amount)
108
+ {
109
+ return new self($amount, $this->currency);
110
+ }
111
+
112
+ /**
113
+ * Checks whether a Money has the same Currency as this.
114
+ *
115
+ * @param Money $other
116
+ *
117
+ * @return bool
118
+ */
119
+ public function isSameCurrency(Money $other)
120
+ {
121
+ return $this->currency->equals($other->currency);
122
+ }
123
+
124
+ /**
125
+ * Asserts that a Money has the same currency as this.
126
+ *
127
+ * @param Money $other
128
+ *
129
+ * @throws \InvalidArgumentException If $other has a different currency
130
+ */
131
+ private function assertSameCurrency(Money $other)
132
+ {
133
+ if (!$this->isSameCurrency($other)) {
134
+ throw new \InvalidArgumentException('Currencies must be identical');
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Checks whether the value represented by this object equals to the other.
140
+ *
141
+ * @param Money $other
142
+ *
143
+ * @return bool
144
+ */
145
+ public function equals(Money $other)
146
+ {
147
+ return $this->isSameCurrency($other) && $this->amount === $other->amount;
148
+ }
149
+
150
+ /**
151
+ * Returns an integer less than, equal to, or greater than zero
152
+ * if the value of this object is considered to be respectively
153
+ * less than, equal to, or greater than the other.
154
+ *
155
+ * @param Money $other
156
+ *
157
+ * @return int
158
+ */
159
+ public function compare(Money $other)
160
+ {
161
+ $this->assertSameCurrency($other);
162
+
163
+ return $this->getCalculator()->compare($this->amount, $other->amount);
164
+ }
165
+
166
+ /**
167
+ * Checks whether the value represented by this object is greater than the other.
168
+ *
169
+ * @param Money $other
170
+ *
171
+ * @return bool
172
+ */
173
+ public function greaterThan(Money $other)
174
+ {
175
+ return $this->compare($other) === 1;
176
+ }
177
+
178
+ /**
179
+ * @param \Money\Money $other
180
+ *
181
+ * @return bool
182
+ */
183
+ public function greaterThanOrEqual(Money $other)
184
+ {
185
+ return $this->compare($other) >= 0;
186
+ }
187
+
188
+ /**
189
+ * Checks whether the value represented by this object is less than the other.
190
+ *
191
+ * @param Money $other
192
+ *
193
+ * @return bool
194
+ */
195
+ public function lessThan(Money $other)
196
+ {
197
+ return $this->compare($other) === -1;
198
+ }
199
+
200
+ /**
201
+ * @param \Money\Money $other
202
+ *
203
+ * @return bool
204
+ */
205
+ public function lessThanOrEqual(Money $other)
206
+ {
207
+ return $this->compare($other) <= 0;
208
+ }
209
+
210
+ /**
211
+ * Returns the value represented by this object.
212
+ *
213
+ * @return string
214
+ */
215
+ public function getAmount()
216
+ {
217
+ return $this->amount;
218
+ }
219
+
220
+ /**
221
+ * Returns the currency of this object.
222
+ *
223
+ * @return Currency
224
+ */
225
+ public function getCurrency()
226
+ {
227
+ return $this->currency;
228
+ }
229
+
230
+ /**
231
+ * Returns a new Money object that represents
232
+ * the sum of this and an other Money object.
233
+ *
234
+ * @param Money $addend
235
+ *
236
+ * @return Money
237
+ */
238
+ public function add(Money $addend)
239
+ {
240
+ $this->assertSameCurrency($addend);
241
+
242
+ return new self($this->getCalculator()->add($this->amount, $addend->amount), $this->currency);
243
+ }
244
+
245
+ /**
246
+ * Returns a new Money object that represents
247
+ * the difference of this and an other Money object.
248
+ *
249
+ * @param Money $subtrahend
250
+ *
251
+ * @return Money
252
+ */
253
+ public function subtract(Money $subtrahend)
254
+ {
255
+ $this->assertSameCurrency($subtrahend);
256
+
257
+ return new self($this->getCalculator()->subtract($this->amount, $subtrahend->amount), $this->currency);
258
+ }
259
+
260
+ /**
261
+ * Asserts that the operand is integer or float.
262
+ *
263
+ * @param float|int|string $operand
264
+ *
265
+ * @throws \InvalidArgumentException If $operand is neither integer nor float
266
+ */
267
+ private function assertOperand($operand)
268
+ {
269
+ if (!is_numeric($operand)) {
270
+ throw new \InvalidArgumentException(sprintf(
271
+ 'Operand should be a numeric value, "%s" given.',
272
+ is_object($operand) ? get_class($operand) : gettype($operand)
273
+ ));
274
+ }
275
+ }
276
+
277
+ /**
278
+ * Asserts that rounding mode is a valid integer value.
279
+ *
280
+ * @param int $roundingMode
281
+ *
282
+ * @throws \InvalidArgumentException If $roundingMode is not valid
283
+ */
284
+ private function assertRoundingMode($roundingMode)
285
+ {
286
+ if (!in_array(
287
+ $roundingMode, [
288
+ self::ROUND_HALF_DOWN, self::ROUND_HALF_EVEN, self::ROUND_HALF_ODD,
289
+ self::ROUND_HALF_UP, self::ROUND_UP, self::ROUND_DOWN,
290
+ self::ROUND_HALF_POSITIVE_INFINITY, self::ROUND_HALF_NEGATIVE_INFINITY,
291
+ ], true
292
+ )) {
293
+ throw new \InvalidArgumentException(
294
+ 'Rounding mode should be Money::ROUND_HALF_DOWN | '.
295
+ 'Money::ROUND_HALF_EVEN | Money::ROUND_HALF_ODD | '.
296
+ 'Money::ROUND_HALF_UP | Money::ROUND_UP | Money::ROUND_DOWN'.
297
+ 'Money::ROUND_HALF_POSITIVE_INFINITY | Money::ROUND_HALF_NEGATIVE_INFINITY'
298
+ );
299
+ }
300
+ }
301
+
302
+ /**
303
+ * Returns a new Money object that represents
304
+ * the multiplied value by the given factor.
305
+ *
306
+ * @param float|int|string $multiplier
307
+ * @param int $roundingMode
308
+ *
309
+ * @return Money
310
+ */
311
+ public function multiply($multiplier, $roundingMode = self::ROUND_HALF_UP)
312
+ {
313
+ $this->assertOperand($multiplier);
314
+ $this->assertRoundingMode($roundingMode);
315
+
316
+ $product = $this->round($this->getCalculator()->multiply($this->amount, $multiplier), $roundingMode);
317
+
318
+ return $this->newInstance($product);
319
+ }
320
+
321
+ /**
322
+ * Returns a new Money object that represents
323
+ * the divided value by the given factor.
324
+ *
325
+ * @param float|int|string $divisor
326
+ * @param int $roundingMode
327
+ *
328
+ * @return Money
329
+ */
330
+ public function divide($divisor, $roundingMode = self::ROUND_HALF_UP)
331
+ {
332
+ $this->assertOperand($divisor);
333
+ $this->assertRoundingMode($roundingMode);
334
+
335
+ $divisor = (string) Number::fromNumber($divisor);
336
+
337
+ if ($this->getCalculator()->compare($divisor, '0') === 0) {
338
+ throw new \InvalidArgumentException('Division by zero');
339
+ }
340
+
341
+ $quotient = $this->round($this->getCalculator()->divide($this->amount, $divisor), $roundingMode);
342
+
343
+ return $this->newInstance($quotient);
344
+ }
345
+
346
+ /**
347
+ * Returns a new Money object that represents
348
+ * the remainder after dividing the value by
349
+ * the given factor.
350
+ *
351
+ * @param Money $divisor
352
+ *
353
+ * @return Money
354
+ */
355
+ public function mod(Money $divisor)
356
+ {
357
+ $this->assertSameCurrency($divisor);
358
+
359
+ return new self($this->getCalculator()->mod($this->amount, $divisor->amount), $this->currency);
360
+ }
361
+
362
+ /**
363
+ * Allocate the money according to a list of ratios.
364
+ *
365
+ * @param array $ratios
366
+ *
367
+ * @return Money[]
368
+ */
369
+ public function allocate(array $ratios)
370
+ {
371
+ if (count($ratios) === 0) {
372
+ throw new \InvalidArgumentException('Cannot allocate to none, ratios cannot be an empty array');
373
+ }
374
+
375
+ $remainder = $this->amount;
376
+ $results = [];
377
+ $total = array_sum($ratios);
378
+
379
+ if ($total <= 0) {
380
+ throw new \InvalidArgumentException('Cannot allocate to none, sum of ratios must be greater than zero');
381
+ }
382
+
383
+ foreach ($ratios as $ratio) {
384
+ if ($ratio < 0) {
385
+ throw new \InvalidArgumentException('Cannot allocate to none, ratio must be zero or positive');
386
+ }
387
+
388
+ $share = $this->getCalculator()->share($this->amount, $ratio, $total);
389
+ $results[] = $this->newInstance($share);
390
+ $remainder = $this->getCalculator()->subtract($remainder, $share);
391
+ }
392
+
393
+ for ($i = 0; $this->getCalculator()->compare($remainder, 0) === 1; ++$i) {
394
+ if (!$ratios[$i]) {
395
+ continue;
396
+ }
397
+
398
+ $results[$i]->amount = (string) $this->getCalculator()->add($results[$i]->amount, 1);
399
+ $remainder = $this->getCalculator()->subtract($remainder, 1);
400
+ }
401
+
402
+ return $results;
403
+ }
404
+
405
+ /**
406
+ * Allocate the money among N targets.
407
+ *
408
+ * @param int $n
409
+ *
410
+ * @return Money[]
411
+ *
412
+ * @throws \InvalidArgumentException If number of targets is not an integer
413
+ */
414
+ public function allocateTo($n)
415
+ {
416
+ if (!is_int($n)) {
417
+ throw new \InvalidArgumentException('Number of targets must be an integer');
418
+ }
419
+
420
+ if ($n <= 0) {
421
+ throw new \InvalidArgumentException('Cannot allocate to none, target must be greater than zero');
422
+ }
423
+
424
+ return $this->allocate(array_fill(0, $n, 1));
425
+ }
426
+
427
+ /**
428
+ * @param Money $money
429
+ *
430
+ * @return string
431
+ */
432
+ public function ratioOf(Money $money)
433
+ {
434
+ if ($money->isZero()) {
435
+ throw new \InvalidArgumentException('Cannot calculate a ratio of zero');
436
+ }
437
+
438
+ return $this->getCalculator()->divide($this->amount, $money->amount);
439
+ }
440
+
441
+ /**
442
+ * @param string $amount
443
+ * @param int $rounding_mode
444
+ *
445
+ * @return string
446
+ */
447
+ private function round($amount, $rounding_mode)
448
+ {
449
+ $this->assertRoundingMode($rounding_mode);
450
+
451
+ if ($rounding_mode === self::ROUND_UP) {
452
+ return $this->getCalculator()->ceil($amount);
453
+ }
454
+
455
+ if ($rounding_mode === self::ROUND_DOWN) {
456
+ return $this->getCalculator()->floor($amount);
457
+ }
458
+
459
+ return $this->getCalculator()->round($amount, $rounding_mode);
460
+ }
461
+
462
+ /**
463
+ * @return Money
464
+ */
465
+ public function absolute()
466
+ {
467
+ return $this->newInstance($this->getCalculator()->absolute($this->amount));
468
+ }
469
+
470
+ /**
471
+ * @return Money
472
+ */
473
+ public function negative()
474
+ {
475
+ return $this->newInstance(0)->subtract($this);
476
+ }
477
+
478
+ /**
479
+ * Checks if the value represented by this object is zero.
480
+ *
481
+ * @return bool
482
+ */
483
+ public function isZero()
484
+ {
485
+ return $this->getCalculator()->compare($this->amount, 0) === 0;
486
+ }
487
+
488
+ /**
489
+ * Checks if the value represented by this object is positive.
490
+ *
491
+ * @return bool
492
+ */
493
+ public function isPositive()
494
+ {
495
+ return $this->getCalculator()->compare($this->amount, 0) === 1;
496
+ }
497
+
498
+ /**
499
+ * Checks if the value represented by this object is negative.
500
+ *
501
+ * @return bool
502
+ */
503
+ public function isNegative()
504
+ {
505
+ return $this->getCalculator()->compare($this->amount, 0) === -1;
506
+ }
507
+
508
+ /**
509
+ * {@inheritdoc}
510
+ *
511
+ * @return array
512
+ */
513
+ public function jsonSerialize()
514
+ {
515
+ return [
516
+ 'amount' => $this->amount,
517
+ 'currency' => $this->currency,
518
+ ];
519
+ }
520
+
521
+ /**
522
+ * @param string $calculator
523
+ */
524
+ public static function registerCalculator($calculator)
525
+ {
526
+ if (is_a($calculator, Calculator::class, true) === false) {
527
+ throw new \InvalidArgumentException('Calculator must implement '.Calculator::class);
528
+ }
529
+
530
+ array_unshift(self::$calculators, $calculator);
531
+ }
532
+
533
+ /**
534
+ * @return Calculator
535
+ *
536
+ * @throws \RuntimeException If cannot find calculator for money calculations
537
+ */
538
+ private static function initializeCalculator()
539
+ {
540
+ $calculators = self::$calculators;
541
+
542
+ foreach ($calculators as $calculator) {
543
+ /** @var Calculator $calculator */
544
+ if ($calculator::supported()) {
545
+ return new $calculator();
546
+ }
547
+ }
548
+
549
+ throw new \RuntimeException('Cannot find calculator for money calculations');
550
+ }
551
+
552
+ /**
553
+ * @return Calculator
554
+ */
555
+ private function getCalculator()
556
+ {
557
+ if (null === self::$calculator) {
558
+ self::$calculator = self::initializeCalculator();
559
+ }
560
+
561
+ return self::$calculator;
562
+ }
563
+ }
vendor/moneyphp/money/src/MoneyFormatter.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Formats Money objects.
7
+ *
8
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
9
+ */
10
+ interface MoneyFormatter
11
+ {
12
+ /**
13
+ * Formats a Money object as string.
14
+ *
15
+ * @param Money $money
16
+ *
17
+ * @return string
18
+ *
19
+ * Exception\FormatterException
20
+ */
21
+ public function format(Money $money);
22
+ }
vendor/moneyphp/money/src/MoneyParser.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Parses a string into a Money object.
7
+ *
8
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
9
+ */
10
+ interface MoneyParser
11
+ {
12
+ /**
13
+ * Parses a string into a Money object (including currency).
14
+ *
15
+ * @param string $money
16
+ * @param Currency|string|null $forceCurrency
17
+ *
18
+ * @return Money
19
+ *
20
+ * @throws Exception\ParserException
21
+ */
22
+ public function parse($money, $forceCurrency = null);
23
+ }
vendor/moneyphp/money/src/Number.php ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money;
4
+
5
+ /**
6
+ * Represents a numeric value.
7
+ *
8
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
9
+ */
10
+ final class Number
11
+ {
12
+ /**
13
+ * @var string
14
+ */
15
+ private $integerPart;
16
+
17
+ /**
18
+ * @var string
19
+ */
20
+ private $fractionalPart;
21
+
22
+ /**
23
+ * @var array
24
+ */
25
+ private static $numbers = [0 => 1, 1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1, 6 => 1, 7 => 1, 8 => 1, 9 => 1];
26
+
27
+ /**
28
+ * @param string $integerPart
29
+ * @param string $fractionalPart
30
+ */
31
+ public function __construct($integerPart, $fractionalPart = '')
32
+ {
33
+ if ('' === $integerPart && '' === $fractionalPart) {
34
+ throw new \InvalidArgumentException('Empty number is invalid');
35
+ }
36
+
37
+ $this->integerPart = $this->parseIntegerPart((string) $integerPart);
38
+ $this->fractionalPart = $this->parseFractionalPart((string) $fractionalPart);
39
+ }
40
+
41
+ /**
42
+ * @param $number
43
+ *
44
+ * @return self
45
+ */
46
+ public static function fromString($number)
47
+ {
48
+ $decimalSeparatorPosition = strpos($number, '.');
49
+ if ($decimalSeparatorPosition === false) {
50
+ return new self($number, '');
51
+ }
52
+
53
+ return new self(
54
+ substr($number, 0, $decimalSeparatorPosition),
55
+ rtrim(substr($number, $decimalSeparatorPosition + 1), '0')
56
+ );
57
+ }
58
+
59
+ /**
60
+ * @param float $number
61
+ *
62
+ * @return self
63
+ */
64
+ public static function fromFloat($number)
65
+ {
66
+ if (is_float($number) === false) {
67
+ throw new \InvalidArgumentException('Floating point value expected');
68
+ }
69
+
70
+ return self::fromString(sprintf('%.14F', $number));
71
+ }
72
+
73
+ /**
74
+ * @param float|int|string $number
75
+ *
76
+ * @return self
77
+ */
78
+ public static function fromNumber($number)
79
+ {
80
+ if (is_float($number)) {
81
+ return self::fromString(sprintf('%.14F', $number));
82
+ }
83
+
84
+ if (is_int($number)) {
85
+ return new self($number);
86
+ }
87
+
88
+ if (is_string($number)) {
89
+ return self::fromString($number);
90
+ }
91
+
92
+ throw new \InvalidArgumentException('Valid numeric value expected');
93
+ }
94
+
95
+ /**
96
+ * @return bool
97
+ */
98
+ public function isDecimal()
99
+ {
100
+ return $this->fractionalPart !== '';
101
+ }
102
+
103
+ /**
104
+ * @return bool
105
+ */
106
+ public function isInteger()
107
+ {
108
+ return $this->fractionalPart === '';
109
+ }
110
+
111
+ /**
112
+ * @return bool
113
+ */
114
+ public function isHalf()
115
+ {
116
+ return $this->fractionalPart === '5';
117
+ }
118
+
119
+ /**
120
+ * @return bool
121
+ */
122
+ public function isCurrentEven()
123
+ {
124
+ $lastIntegerPartNumber = $this->integerPart[strlen($this->integerPart) - 1];
125
+
126
+ return $lastIntegerPartNumber % 2 === 0;
127
+ }
128
+
129
+ /**
130
+ * @return bool
131
+ */
132
+ public function isCloserToNext()
133
+ {
134
+ if ($this->fractionalPart === '') {
135
+ return false;
136
+ }
137
+
138
+ return $this->fractionalPart[0] >= 5;
139
+ }
140
+
141
+ /**
142
+ * @return string
143
+ */
144
+ public function __toString()
145
+ {
146
+ if ($this->fractionalPart === '') {
147
+ return $this->integerPart;
148
+ }
149
+
150
+ return $this->integerPart.'.'.$this->fractionalPart;
151
+ }
152
+
153
+ /**
154
+ * @return bool
155
+ */
156
+ public function isNegative()
157
+ {
158
+ return $this->integerPart[0] === '-';
159
+ }
160
+
161
+ /**
162
+ * @return string
163
+ */
164
+ public function getIntegerPart()
165
+ {
166
+ return $this->integerPart;
167
+ }
168
+
169
+ /**
170
+ * @return string
171
+ */
172
+ public function getFractionalPart()
173
+ {
174
+ return $this->fractionalPart;
175
+ }
176
+
177
+ /**
178
+ * @return string
179
+ */
180
+ public function getIntegerRoundingMultiplier()
181
+ {
182
+ if ($this->integerPart[0] === '-') {
183
+ return '-1';
184
+ }
185
+
186
+ return '1';
187
+ }
188
+
189
+ /**
190
+ * @param int $number
191
+ *
192
+ * @return self
193
+ */
194
+ public function base10($number)
195
+ {
196
+ if (!is_int($number)) {
197
+ throw new \InvalidArgumentException('Expecting integer');
198
+ }
199
+
200
+ if ($this->integerPart === '0' && !$this->fractionalPart) {
201
+ return $this;
202
+ }
203
+
204
+ $sign = '';
205
+ $integerPart = $this->integerPart;
206
+
207
+ if ($integerPart[0] === '-') {
208
+ $sign = '-';
209
+ $integerPart = substr($integerPart, 1);
210
+ }
211
+
212
+ if ($number >= 0) {
213
+ $integerPart = ltrim($integerPart, '0');
214
+ $lengthIntegerPart = strlen($integerPart);
215
+ $integers = $lengthIntegerPart - min($number, $lengthIntegerPart);
216
+ $zeroPad = $number - min($number, $lengthIntegerPart);
217
+
218
+ return new self(
219
+ $sign.substr($integerPart, 0, $integers),
220
+ rtrim(str_pad('', $zeroPad, '0').substr($integerPart, $integers).$this->fractionalPart, '0')
221
+ );
222
+ }
223
+
224
+ $number = abs($number);
225
+ $lengthFractionalPart = strlen($this->fractionalPart);
226
+ $fractions = $lengthFractionalPart - min($number, $lengthFractionalPart);
227
+ $zeroPad = $number - min($number, $lengthFractionalPart);
228
+
229
+ return new self(
230
+ $sign.ltrim($integerPart.substr($this->fractionalPart, 0, $lengthFractionalPart - $fractions).str_pad('', $zeroPad, '0'), '0'),
231
+ substr($this->fractionalPart, $lengthFractionalPart - $fractions)
232
+ );
233
+ }
234
+
235
+ /**
236
+ * @param string $number
237
+ *
238
+ * @return string
239
+ */
240
+ private static function parseIntegerPart($number)
241
+ {
242
+ if ('' === $number || '0' === $number) {
243
+ return '0';
244
+ }
245
+
246
+ if ('-' === $number) {
247
+ return '-0';
248
+ }
249
+
250
+ $nonZero = false;
251
+
252
+ for ($position = 0, $characters = strlen($number); $position < $characters; ++$position) {
253
+ $digit = $number[$position];
254
+
255
+ if (!isset(static::$numbers[$digit]) && !(0 === $position && '-' === $digit)) {
256
+ throw new \InvalidArgumentException(
257
+ sprintf('Invalid integer part %1$s. Invalid digit %2$s found', $number, $digit)
258
+ );
259
+ }
260
+
261
+ if (false === $nonZero && '0' === $digit) {
262
+ throw new \InvalidArgumentException(
263
+ 'Leading zeros are not allowed'
264
+ );
265
+ }
266
+
267
+ $nonZero = true;
268
+ }
269
+
270
+ return $number;
271
+ }
272
+
273
+ /**
274
+ * @param string $number
275
+ *
276
+ * @return string
277
+ */
278
+ private static function parseFractionalPart($number)
279
+ {
280
+ if ('' === $number) {
281
+ return $number;
282
+ }
283
+
284
+ for ($position = 0, $characters = strlen($number); $position < $characters; ++$position) {
285
+ $digit = $number[$position];
286
+ if (!isset(static::$numbers[$digit])) {
287
+ throw new \InvalidArgumentException(
288
+ sprintf('Invalid fractional part %1$s. Invalid digit %2$s found', $number, $digit)
289
+ );
290
+ }
291
+ }
292
+
293
+ return $number;
294
+ }
295
+
296
+ /**
297
+ * @param string $moneyValue
298
+ * @param int $targetDigits
299
+ * @param int $havingDigits
300
+ *
301
+ * @return string
302
+ */
303
+ public static function roundMoneyValue($moneyValue, $targetDigits, $havingDigits)
304
+ {
305
+ $valueLength = strlen($moneyValue);
306
+ $shouldRound = $targetDigits < $havingDigits && $valueLength - $havingDigits + $targetDigits > 0;
307
+
308
+ if ($shouldRound && $moneyValue[$valueLength - $havingDigits + $targetDigits] >= 5) {
309
+ $position = $valueLength - $havingDigits + $targetDigits;
310
+ $addend = 1;
311
+
312
+ while ($position > 0) {
313
+ $newValue = (string) ((int) $moneyValue[$position - 1] + $addend);
314
+
315
+ if ($newValue >= 10) {
316
+ $moneyValue[$position - 1] = $newValue[1];
317
+ $addend = $newValue[0];
318
+ --$position;
319
+ if ($position === 0) {
320
+ $moneyValue = $addend.$moneyValue;
321
+ }
322
+ } else {
323
+ if ($moneyValue[$position - 1] === '-') {
324
+ $moneyValue[$position - 1] = $newValue[0];
325
+ $moneyValue = '-'.$moneyValue;
326
+ } else {
327
+ $moneyValue[$position - 1] = $newValue[0];
328
+ }
329
+
330
+ break;
331
+ }
332
+ }
333
+ }
334
+
335
+ return $moneyValue;
336
+ }
337
+ }
vendor/moneyphp/money/src/PHPUnit/Comparator.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\PHPUnit;
4
+
5
+ use Money\Currencies\AggregateCurrencies;
6
+ use Money\Currencies\BitcoinCurrencies;
7
+ use Money\Currencies\ISOCurrencies;
8
+ use Money\Formatter\IntlMoneyFormatter;
9
+ use Money\Money;
10
+ use SebastianBergmann\Comparator\ComparisonFailure;
11
+
12
+ /**
13
+ * The comparator is for comparing Money objects in PHPUnit tests.
14
+ *
15
+ * Add this to your bootstrap file:
16
+ *
17
+ * \SebastianBergmann\Comparator\Factory::getInstance()->register(new \Money\PHPUnit\Comparator());
18
+ */
19
+ final class Comparator extends \SebastianBergmann\Comparator\Comparator
20
+ {
21
+ /**
22
+ * @var IntlMoneyFormatter
23
+ */
24
+ private $formatter;
25
+
26
+ public function __construct()
27
+ {
28
+ parent::__construct();
29
+
30
+ $currencies = new AggregateCurrencies([
31
+ new ISOCurrencies(),
32
+ new BitcoinCurrencies(),
33
+ ]);
34
+
35
+ $numberFormatter = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY);
36
+ $this->formatter = new IntlMoneyFormatter($numberFormatter, $currencies);
37
+ }
38
+
39
+ public function accepts($expected, $actual)
40
+ {
41
+ return $expected instanceof Money && $actual instanceof Money;
42
+ }
43
+
44
+ /**
45
+ * @param Money $expected
46
+ * @param Money $actual
47
+ * @param float $delta
48
+ * @param bool $canonicalize
49
+ * @param bool $ignoreCase
50
+ * @param array $processed
51
+ */
52
+ public function assertEquals(
53
+ $expected,
54
+ $actual,
55
+ $delta = 0.0,
56
+ $canonicalize = false,
57
+ $ignoreCase = false,
58
+ array &$processed = []
59
+ ) {
60
+ if (!$expected->equals($actual)) {
61
+ throw new ComparisonFailure(
62
+ $expected,
63
+ $actual,
64
+ $this->formatter->format($expected),
65
+ $this->formatter->format($actual),
66
+ false,
67
+ 'Failed asserting that two Money objects are equal.'
68
+ );
69
+ }
70
+ }
71
+ }
vendor/moneyphp/money/src/Parser/AggregateMoneyParser.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Parser;
4
+
5
+ use Money\Exception;
6
+ use Money\MoneyParser;
7
+
8
+ /**
9
+ * Parses a string into a Money object using other parsers.
10
+ *
11
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
12
+ */
13
+ final class AggregateMoneyParser implements MoneyParser
14
+ {
15
+ /**
16
+ * @var MoneyParser[]
17
+ */
18
+ private $parsers = [];
19
+
20
+ /**
21
+ * @param MoneyParser[] $parsers
22
+ */
23
+ public function __construct(array $parsers)
24
+ {
25
+ if (empty($parsers)) {
26
+ throw new \InvalidArgumentException(sprintf('Initialize an empty %s is not possible', self::class));
27
+ }
28
+
29
+ foreach ($parsers as $parser) {
30
+ if (false === $parser instanceof MoneyParser) {
31
+ throw new \InvalidArgumentException('All parsers must implement '.MoneyParser::class);
32
+ }
33
+
34
+ $this->parsers[] = $parser;
35
+ }
36
+ }
37
+
38
+ /**
39
+ * {@inheritdoc}
40
+ */
41
+ public function parse($money, $forceCurrency = null)
42
+ {
43
+ foreach ($this->parsers as $parser) {
44
+ try {
45
+ return $parser->parse($money, $forceCurrency);
46
+ } catch (Exception\ParserException $e) {
47
+ }
48
+ }
49
+
50
+ throw new Exception\ParserException(sprintf('Unable to parse %s', $money));
51
+ }
52
+ }
vendor/moneyphp/money/src/Parser/BitcoinMoneyParser.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Parser;
4
+
5
+ use Money\Currencies\BitcoinCurrencies;
6
+ use Money\Currency;
7
+ use Money\Exception\ParserException;
8
+ use Money\Money;
9
+ use Money\MoneyParser;
10
+
11
+ /**
12
+ * Parses Bitcoin currency to Money.
13
+ *
14
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
15
+ */
16
+ final class BitcoinMoneyParser implements MoneyParser
17
+ {
18
+ /**
19
+ * @var int
20
+ */
21
+ private $fractionDigits;
22
+
23
+ /**
24
+ * @param int $fractionDigits
25
+ */
26
+ public function __construct($fractionDigits)
27
+ {
28
+ $this->fractionDigits = $fractionDigits;
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function parse($money, $forceCurrency = null)
35
+ {
36
+ if (is_string($money) === false) {
37
+ throw new ParserException('Formatted raw money should be string, e.g. $1.00');
38
+ }
39
+
40
+ if (strpos($money, BitcoinCurrencies::SYMBOL) === false) {
41
+ throw new ParserException('Value cannot be parsed as Bitcoin');
42
+ }
43
+
44
+ $decimal = str_replace(BitcoinCurrencies::SYMBOL, '', $money);
45
+ $decimalSeparator = strpos($decimal, '.');
46
+
47
+ if (false !== $decimalSeparator) {
48
+ $lengthDecimal = strlen($decimal);
49
+ $decimal = str_replace('.', '', $decimal);
50
+ $decimal .= str_pad('', ($lengthDecimal - $decimalSeparator - $this->fractionDigits - 1) * -1, '0');
51
+ } else {
52
+ $decimal .= str_pad('', $this->fractionDigits, '0');
53
+ }
54
+
55
+ if (substr($decimal, 0, 1) === '-') {
56
+ $decimal = '-'.ltrim(substr($decimal, 1), '0');
57
+ } else {
58
+ $decimal = ltrim($decimal, '0');
59
+ }
60
+
61
+ if ('' === $decimal) {
62
+ $decimal = '0';
63
+ }
64
+
65
+ return new Money($decimal, new Currency(BitcoinCurrencies::CODE));
66
+ }
67
+ }
vendor/moneyphp/money/src/Parser/DecimalMoneyParser.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Parser;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currency;
7
+ use Money\Exception\ParserException;
8
+ use Money\Money;
9
+ use Money\MoneyParser;
10
+ use Money\Number;
11
+
12
+ /**
13
+ * Parses a decimal string into a Money object.
14
+ *
15
+ * @author Teoh Han Hui <teohhanhui@gmail.com>
16
+ */
17
+ final class DecimalMoneyParser implements MoneyParser
18
+ {
19
+ const DECIMAL_PATTERN = '/^(?P<sign>-)?(?P<digits>0|[1-9]\d*)?\.?(?P<fraction>\d+)?$/';
20
+
21
+ /**
22
+ * @var Currencies
23
+ */
24
+ private $currencies;
25
+
26
+ /**
27
+ * @param Currencies $currencies
28
+ */
29
+ public function __construct(Currencies $currencies)
30
+ {
31
+ $this->currencies = $currencies;
32
+ }
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ */
37
+ public function parse($money, $forceCurrency = null)
38
+ {
39
+ if (!is_string($money)) {
40
+ throw new ParserException('Formatted raw money should be string, e.g. 1.00');
41
+ }
42
+
43
+ if (null === $forceCurrency) {
44
+ throw new ParserException(
45
+ 'DecimalMoneyParser cannot parse currency symbols. Use forceCurrency argument'
46
+ );
47
+ }
48
+
49
+ /*
50
+ * This conversion is only required whilst currency can be either a string or a
51
+ * Currency object.
52
+ */
53
+ $currency = $forceCurrency;
54
+ if (!$currency instanceof Currency) {
55
+ @trigger_error('Passing a currency as string is deprecated since 3.1 and will be removed in 4.0. Please pass a '.Currency::class.' instance instead.', E_USER_DEPRECATED);
56
+ $currency = new Currency($currency);
57
+ }
58
+
59
+ $decimal = trim($money);
60
+
61
+ if ($decimal === '') {
62
+ return new Money(0, $currency);
63
+ }
64
+
65
+ $subunit = $this->currencies->subunitFor($currency);
66
+
67
+ if (!preg_match(self::DECIMAL_PATTERN, $decimal, $matches) || !isset($matches['digits'])) {
68
+ throw new ParserException(sprintf(
69
+ 'Cannot parse "%s" to Money.',
70
+ $decimal
71
+ ));
72
+ }
73
+
74
+ $negative = isset($matches['sign']) && $matches['sign'] === '-';
75
+
76
+ $decimal = $matches['digits'];
77
+
78
+ if ($negative) {
79
+ $decimal = '-'.$decimal;
80
+ }
81
+
82
+ if (isset($matches['fraction'])) {
83
+ $fractionDigits = strlen($matches['fraction']);
84
+ $decimal .= $matches['fraction'];
85
+ $decimal = Number::roundMoneyValue($decimal, $subunit, $fractionDigits);
86
+
87
+ if ($fractionDigits > $subunit) {
88
+ $decimal = substr($decimal, 0, $subunit - $fractionDigits);
89
+ } elseif ($fractionDigits < $subunit) {
90
+ $decimal .= str_pad('', $subunit - $fractionDigits, '0');
91
+ }
92
+ } else {
93
+ $decimal .= str_pad('', $subunit, '0');
94
+ }
95
+
96
+ if ($negative) {
97
+ $decimal = '-'.ltrim(substr($decimal, 1), '0');
98
+ } else {
99
+ $decimal = ltrim($decimal, '0');
100
+ }
101
+
102
+ if ($decimal === '' || $decimal === '-') {
103
+ $decimal = '0';
104
+ }
105
+
106
+ return new Money($decimal, $currency);
107
+ }
108
+ }
vendor/moneyphp/money/src/Parser/IntlLocalizedDecimalParser.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Parser;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currency;
7
+ use Money\Exception\ParserException;
8
+ use Money\Money;
9
+ use Money\MoneyParser;
10
+ use Money\Number;
11
+
12
+ /**
13
+ * Parses a string into a Money object using intl extension.
14
+ *
15
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
16
+ */
17
+ final class IntlLocalizedDecimalParser implements MoneyParser
18
+ {
19
+ /**
20
+ * @var \NumberFormatter
21
+ */
22
+ private $formatter;
23
+
24
+ /**
25
+ * @var Currencies
26
+ */
27
+ private $currencies;
28
+
29
+ /**
30
+ * @param \NumberFormatter $formatter
31
+ * @param Currencies $currencies
32
+ */
33
+ public function __construct(\NumberFormatter $formatter, Currencies $currencies)
34
+ {
35
+ $this->formatter = $formatter;
36
+ $this->currencies = $currencies;
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function parse($money, $forceCurrency = null)
43
+ {
44
+ if (!is_string($money)) {
45
+ throw new ParserException('Formatted raw money should be string, e.g. $1.00');
46
+ }
47
+
48
+ if (null === $forceCurrency) {
49
+ throw new ParserException(
50
+ 'IntlLocalizedDecimalParser cannot parse currency symbols. Use forceCurrency argument'
51
+ );
52
+ }
53
+
54
+ $decimal = $this->formatter->parse($money);
55
+
56
+ if (false === $decimal) {
57
+ throw new ParserException(
58
+ 'Cannot parse '.$money.' to Money. '.$this->formatter->getErrorMessage()
59
+ );
60
+ }
61
+
62
+ /*
63
+ * This conversion is only required whilst currency can be either a string or a
64
+ * Currency object.
65
+ */
66
+ if (!$forceCurrency instanceof Currency) {
67
+ @trigger_error('Passing a currency as string is deprecated since 3.1 and will be removed in 4.0. Please pass a '.Currency::class.' instance instead.', E_USER_DEPRECATED);
68
+ $forceCurrency = new Currency($forceCurrency);
69
+ }
70
+
71
+ $decimal = (string) $decimal;
72
+ $subunit = $this->currencies->subunitFor($forceCurrency);
73
+ $decimalPosition = strpos($decimal, '.');
74
+
75
+ if (false !== $decimalPosition) {
76
+ $decimalLength = strlen($decimal);
77
+ $fractionDigits = $decimalLength - $decimalPosition - 1;
78
+ $decimal = str_replace('.', '', $decimal);
79
+ $decimal = Number::roundMoneyValue($decimal, $subunit, $fractionDigits);
80
+
81
+ if ($fractionDigits > $subunit) {
82
+ $decimal = substr($decimal, 0, $decimalPosition + $subunit);
83
+ } elseif ($fractionDigits < $subunit) {
84
+ $decimal .= str_pad('', $subunit - $fractionDigits, '0');
85
+ }
86
+ } else {
87
+ $decimal .= str_pad('', $subunit, '0');
88
+ }
89
+
90
+ if ('-' === $decimal[0]) {
91
+ $decimal = '-'.ltrim(substr($decimal, 1), '0');
92
+ } else {
93
+ $decimal = ltrim($decimal, '0');
94
+ }
95
+
96
+ if ('' === $decimal) {
97
+ $decimal = '0';
98
+ }
99
+
100
+ return new Money($decimal, $forceCurrency);
101
+ }
102
+ }
vendor/moneyphp/money/src/Parser/IntlMoneyParser.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Money\Parser;
4
+
5
+ use Money\Currencies;
6
+ use Money\Currency;
7
+ use Money\Exception\ParserException;
8
+ use Money\Money;
9
+ use Money\MoneyParser;
10
+ use Money\Number;
11
+
12
+ /**
13
+ * Parses a string into a Money object using intl extension.
14
+ *
15
+ * @author Frederik Bosch <f.bosch@genkgo.nl>
16
+ */
17
+ final class IntlMoneyParser implements MoneyParser
18
+ {
19
+ /**
20
+ * @var \NumberFormatter
21
+ */
22
+ private $formatter;
23
+
24
+ /**
25
+ * @var Currencies
26
+ */
27
+ private $currencies;
28
+
29
+ /**
30
+ * @param \NumberFormatter $formatter
31
+ * @param Currencies $currencies
32
+ */
33
+ public function __construct(\NumberFormatter $formatter, Currencies $currencies)
34
+ {
35
+ $this->formatter = $formatter;
36
+ $this->currencies = $currencies;
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function parse($money, $forceCurrency = null)
43
+ {
44
+ if (!is_string($money)) {
45
+ throw new ParserException('Formatted raw money should be string, e.g. $1.00');
46
+ }
47
+
48
+ $currency = null;
49
+ $decimal = $this->formatter->parseCurrency($money, $currency);
50
+
51
+ if (false === $decimal) {
52
+ throw new ParserException(
53
+ 'Cannot parse '.$money.' to Money. '.$this->formatter->getErrorMessage()
54
+ );
55
+ }
56
+
57
+ if (null !== $forceCurrency) {
58
+ $currency = $forceCurrency;
59
+ } else {
60
+ $currency = new Currency($currency);
61
+ }
62
+
63
+ /*
64
+ * This conversion is only required whilst currency can be either a string or a
65
+ * Currency object.
66
+ */
67
+ if (!$currency instanceof Currency) {
68
+ @trigger_error('Passing a currency as string is deprecated since 3.1 and will be removed in 4.0. Please pass a '.Currency::class.' instance instead.', E_USER_DEPRECATED);
69
+ $currency = new Currency($currency);
70
+ }
71
+
72
+ $decimal = (string) $decimal;
73
+ $subunit = $this->currencies->subunitFor($currency);
74
+ $decimalPosition = strpos($decimal, '.');
75
+
76
+ if (false !== $decimalPosition) {
77
+ $decimalLength = strlen($decimal);
78
+ $fractionDigits = $decimalLength - $decimalPosition - 1;
79
+ $decimal = str_replace('.', '', $decimal);
80
+ $decimal = Number::roundMoneyValue($decimal, $subunit, $fractionDigits);
81
+
82
+ if ($fractionDigits > $subunit) {
83
+ $decimal = substr($decimal, 0, $decimalPosition + $subunit);
84
+ } elseif ($fractionDigits < $subunit) {
85
+ $decimal .= str_pad('', $subunit - $fractionDigits, '0');
86
+ }
87
+ } else {
88
+ $decimal .= str_pad('', $subunit, '0');
89
+ }
90
+
91
+ if ('-' === $decimal[0]) {
92
+ $decimal = '-'.ltrim(substr($decimal, 1), '0');
93
+ } else {
94
+ $decimal = ltrim($decimal, '0');
95
+ }
96
+
97
+ if ('' === $decimal) {
98
+ $decimal = '0';
99
+ }
100
+
101
+ return new Money($decimal, $currency);
102
+ }
103
+ }
vendor/monolog/monolog/.php_cs ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $header = <<<EOF
4
+ This file is part of the Monolog package.
5
+
6
+ (c) Jordi Boggiano <j.boggiano@seld.be>
7
+
8
+ For the full copyright and license information, please view the LICENSE
9
+ file that was distributed with this source code.
10
+ EOF;
11
+
12
+ $finder = Symfony\CS\Finder::create()
13
+ ->files()
14
+ ->name('*.php')
15
+ ->exclude('Fixtures')
16
+ ->in(__DIR__.'/src')
17
+ ->in(__DIR__.'/tests')
18
+ ;
19
+
20
+ return Symfony\CS\Config::create()
21
+ ->setUsingCache(true)
22
+ //->setUsingLinter(false)
23
+ ->setRiskyAllowed(true)
24
+ ->setRules(array(
25
+ '@PSR2' => true,
26
+ 'binary_operator_spaces' => true,
27
+ 'blank_line_before_return' => true,
28
+ 'header_comment' => array('header' => $header),
29
+ 'include' => true,
30
+ 'long_array_syntax' => true,
31
+ 'method_separation' => true,
32
+ 'no_blank_lines_after_class_opening' => true,
33
+ 'no_blank_lines_after_phpdoc' => true,
34
+ 'no_blank_lines_between_uses' => true,
35
+ 'no_duplicate_semicolons' => true,
36
+ 'no_extra_consecutive_blank_lines' => true,
37
+ 'no_leading_import_slash' => true,
38
+ 'no_leading_namespace_whitespace' => true,
39
+ 'no_trailing_comma_in_singleline_array' => true,
40
+ 'no_unused_imports' => true,
41
+ 'object_operator_without_whitespace' => true,
42
+ 'phpdoc_align' => true,
43
+ 'phpdoc_indent' => true,
44
+ 'phpdoc_no_access' => true,
45
+ 'phpdoc_no_package' => true,
46
+ 'phpdoc_order' => true,
47
+ 'phpdoc_scalar' => true,
48
+ 'phpdoc_trim' => true,
49
+ 'phpdoc_type_to_var' => true,
50
+ 'psr0' => true,
51
+ 'single_blank_line_before_namespace' => true,
52
+ 'spaces_cast' => true,
53
+ 'standardize_not_equals' => true,
54
+ 'ternary_operator_spaces' => true,
55
+ 'trailing_comma_in_multiline_array' => true,
56
+ 'whitespacy_lines' => true,
57
+ ))
58
+ ->finder($finder)
59
+ ;
vendor/monolog/monolog/CHANGELOG.md ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### 1.24.0 (2018-11-05)
2
+
3
+ * Added a `ResettableInterface` in order to reset/reset/clear/flush handlers and processors
4
+ * Added a `ProcessorInterface` as an optional way to label a class as being a processor (mostly useful for autowiring dependency containers)
5
+ * Added a way to log signals being received using Monolog\SignalHandler
6
+ * Added ability to customize error handling at the Logger level using Logger::setExceptionHandler
7
+ * Added InsightOpsHandler to migrate users of the LogEntriesHandler
8
+ * Added protection to NormalizerHandler against circular and very deep structures, it now stops normalizing at a depth of 9
9
+ * Added capture of stack traces to ErrorHandler when logging PHP errors
10
+ * Added RavenHandler support for a `contexts` context or extra key to forward that to Sentry's contexts
11
+ * Added forwarding of context info to FluentdFormatter
12
+ * Added SocketHandler::setChunkSize to override the default chunk size in case you must send large log lines to rsyslog for example
13
+ * Added ability to extend/override BrowserConsoleHandler
14
+ * Added SlackWebhookHandler::getWebhookUrl and SlackHandler::getToken to enable class extensibility
15
+ * Added SwiftMailerHandler::getSubjectFormatter to enable class extensibility
16
+ * Dropped official support for HHVM in test builds
17
+ * Fixed normalization of exception traces when call_user_func is used to avoid serializing objects and the data they contain
18
+ * Fixed naming of fields in Slack handler, all field names are now capitalized in all cases
19
+ * Fixed HipChatHandler bug where slack dropped messages randomly
20
+ * Fixed normalization of objects in Slack handlers
21
+ * Fixed support for PHP7's Throwable in NewRelicHandler
22
+ * Fixed race bug when StreamHandler sometimes incorrectly reported it failed to create a directory
23
+ * Fixed table row styling issues in HtmlFormatter
24
+ * Fixed RavenHandler dropping the message when logging exception
25
+ * Fixed WhatFailureGroupHandler skipping processors when using handleBatch
26
+ and implement it where possible
27
+ * Fixed display of anonymous class names
28
+
29
+ ### 1.23.0 (2017-06-19)
30
+
31
+ * Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument
32
+ * Fixed GelfHandler truncation to be per field and not per message
33
+ * Fixed compatibility issue with PHP <5.3.6
34
+ * Fixed support for headless Chrome in ChromePHPHandler
35
+ * Fixed support for latest Aws SDK in DynamoDbHandler
36
+ * Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler
37
+
38
+ ### 1.22.1 (2017-03-13)
39
+
40
+ * Fixed lots of minor issues in the new Slack integrations
41
+ * Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces
42
+
43
+ ### 1.22.0 (2016-11-26)
44
+
45
+ * Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily
46
+ * Added MercurialProcessor to add mercurial revision and branch names to log records
47
+ * Added support for AWS SDK v3 in DynamoDbHandler
48
+ * Fixed fatal errors occuring when normalizing generators that have been fully consumed
49
+ * Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix)
50
+ * Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore
51
+ * Fixed SyslogUdpHandler to avoid sending empty frames
52
+ * Fixed a few PHP 7.0 and 7.1 compatibility issues
53
+
54
+ ### 1.21.0 (2016-07-29)
55
+
56
+ * Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues
57
+ * Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order
58
+ * Added ability to format the main line of text the SlackHandler sends by explictly setting a formatter on the handler
59
+ * Added information about SoapFault instances in NormalizerFormatter
60
+ * Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level
61
+
62
+ ### 1.20.0 (2016-07-02)
63
+
64
+ * Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy
65
+ * Added StreamHandler::getUrl to retrieve the stream's URL
66
+ * Added ability to override addRow/addTitle in HtmlFormatter
67
+ * Added the $context to context information when the ErrorHandler handles a regular php error
68
+ * Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d
69
+ * Fixed WhatFailureGroupHandler to work with PHP7 throwables
70
+ * Fixed a few minor bugs
71
+
72
+ ### 1.19.0 (2016-04-12)
73
+
74
+ * Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed
75
+ * Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors
76
+ * Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler
77
+ * Fixed HipChatHandler handling of long messages
78
+
79
+ ### 1.18.2 (2016-04-02)
80
+
81
+ * Fixed ElasticaFormatter to use more precise dates
82
+ * Fixed GelfMessageFormatter sending too long messages
83
+
84
+ ### 1.18.1 (2016-03-13)
85
+
86
+ * Fixed SlackHandler bug where slack dropped messages randomly
87
+ * Fixed RedisHandler issue when using with the PHPRedis extension
88
+ * Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension
89
+ * Fixed BrowserConsoleHandler regression
90
+
91
+ ### 1.18.0 (2016-03-01)
92
+
93
+ * Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond
94
+ * Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames
95
+ * Added `Logger->withName` to clone a logger (keeping all handlers) with a new name
96
+ * Added FluentdFormatter for the Fluentd unix socket protocol
97
+ * Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed
98
+ * Added support for replacing context sub-keys using `%context.*%` in LineFormatter
99
+ * Added support for `payload` context value in RollbarHandler
100
+ * Added setRelease to RavenHandler to describe the application version, sent with every log
101
+ * Added support for `fingerprint` context value in RavenHandler
102
+ * Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed
103
+ * Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()`
104
+ * Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places
105
+
106
+ ### 1.17.2 (2015-10-14)
107
+
108
+ * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers
109
+ * Fixed SlackHandler handling to use slack functionalities better
110
+ * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id
111
+ * Fixed 5.3 compatibility regression
112
+
113
+ ### 1.17.1 (2015-08-31)
114
+
115
+ * Fixed RollbarHandler triggering PHP notices
116
+
117
+ ### 1.17.0 (2015-08-30)
118
+
119
+ * Added support for `checksum` and `release` context/extra values in RavenHandler
120
+ * Added better support for exceptions in RollbarHandler
121
+ * Added UidProcessor::getUid
122
+ * Added support for showing the resource type in NormalizedFormatter
123
+ * Fixed IntrospectionProcessor triggering PHP notices
124
+
125
+ ### 1.16.0 (2015-08-09)
126
+
127
+ * Added IFTTTHandler to notify ifttt.com triggers
128
+ * Added Logger::setHandlers() to allow setting/replacing all handlers
129
+ * Added $capSize in RedisHandler to cap the log size
130
+ * Fixed StreamHandler creation of directory to only trigger when the first log write happens
131
+ * Fixed bug in the handling of curl failures
132
+ * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler
133
+ * Fixed missing fatal errors records with handlers that need to be closed to flush log records
134
+ * Fixed TagProcessor::addTags support for associative arrays
135
+
136
+ ### 1.15.0 (2015-07-12)
137
+
138
+ * Added addTags and setTags methods to change a TagProcessor
139
+ * Added automatic creation of directories if they are missing for a StreamHandler to open a log file
140
+ * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure
141
+ * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used
142
+ * Fixed HTML/JS escaping in BrowserConsoleHandler
143
+ * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only)
144
+
145
+ ### 1.14.0 (2015-06-19)
146
+
147
+ * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library
148
+ * Added support for objects implementing __toString in the NormalizerFormatter
149
+ * Added support for HipChat's v2 API in HipChatHandler
150
+ * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app
151
+ * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true)
152
+ * Fixed curl errors being silently suppressed
153
+
154
+ ### 1.13.1 (2015-03-09)
155
+
156
+ * Fixed regression in HipChat requiring a new token to be created
157
+
158
+ ### 1.13.0 (2015-03-05)
159
+
160
+ * Added Registry::hasLogger to check for the presence of a logger instance
161
+ * Added context.user support to RavenHandler
162
+ * Added HipChat API v2 support in the HipChatHandler
163
+ * Added NativeMailerHandler::addParameter to pass params to the mail() process
164
+ * Added context data to SlackHandler when $includeContextAndExtra is true
165
+ * Added ability to customize the Swift_Message per-email in SwiftMailerHandler
166
+ * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided
167
+ * Fixed serialization of INF and NaN values in Normalizer and LineFormatter
168
+
169
+ ### 1.12.0 (2014-12-29)
170
+
171
+ * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers.
172
+ * Added PsrHandler to forward records to another PSR-3 logger
173
+ * Added SamplingHandler to wrap around a handler and include only every Nth record
174
+ * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now)
175
+ * Added exception codes in the output of most formatters
176
+ * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line)
177
+ * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data
178
+ * Added $host to HipChatHandler for users of private instances
179
+ * Added $transactionName to NewRelicHandler and support for a transaction_name context value
180
+ * Fixed MandrillHandler to avoid outputing API call responses
181
+ * Fixed some non-standard behaviors in SyslogUdpHandler
182
+
183
+ ### 1.11.0 (2014-09-30)
184
+
185
+ * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names
186
+ * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails
187
+ * Added MandrillHandler to send emails via the Mandrillapp.com API
188
+ * Added SlackHandler to log records to a Slack.com account
189
+ * Added FleepHookHandler to log records to a Fleep.io account
190
+ * Added LogglyHandler::addTag to allow adding tags to an existing handler
191
+ * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end
192
+ * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing
193
+ * Added support for PhpAmqpLib in the AmqpHandler
194
+ * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs
195
+ * Added support for adding extra fields from $_SERVER in the WebProcessor
196
+ * Fixed support for non-string values in PrsLogMessageProcessor
197
+ * Fixed SwiftMailer messages being sent with the wrong date in long running scripts
198
+ * Fixed minor PHP 5.6 compatibility issues
199
+ * Fixed BufferHandler::close being called twice
200
+
201
+ ### 1.10.0 (2014-06-04)
202
+
203
+ * Added Logger::getHandlers() and Logger::getProcessors() methods
204
+ * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached
205
+ * Added support for extra data in NewRelicHandler
206
+ * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines
207
+
208
+ ### 1.9.1 (2014-04-24)
209
+
210
+ * Fixed regression in RotatingFileHandler file permissions
211
+ * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records
212
+ * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative
213
+
214
+ ### 1.9.0 (2014-04-20)
215
+
216
+ * Added LogEntriesHandler to send logs to a LogEntries account
217
+ * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler
218
+ * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes
219
+ * Added support for table formatting in FirePHPHandler via the table context key
220
+ * Added a TagProcessor to add tags to records, and support for tags in RavenHandler
221
+ * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files
222
+ * Added sound support to the PushoverHandler
223
+ * Fixed multi-threading support in StreamHandler
224
+ * Fixed empty headers issue when ChromePHPHandler received no records
225
+ * Fixed default format of the ErrorLogHandler
226
+
227
+ ### 1.8.0 (2014-03-23)
228
+
229
+ * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them
230
+ * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output
231
+ * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler
232
+ * Added FlowdockHandler to send logs to a Flowdock account
233
+ * Added RollbarHandler to send logs to a Rollbar account
234
+ * Added HtmlFormatter to send prettier log emails with colors for each log level
235
+ * Added GitProcessor to add the current branch/commit to extra record data
236
+ * Added a Monolog\Registry class to allow easier global access to pre-configured loggers
237
+ * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement
238
+ * Added support for HHVM
239
+ * Added support for Loggly batch uploads
240
+ * Added support for tweaking the content type and encoding in NativeMailerHandler
241
+ * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor
242
+ * Fixed batch request support in GelfHandler
243
+
244
+ ### 1.7.0 (2013-11-14)
245
+
246
+ * Added ElasticSearchHandler to send logs to an Elastic Search server
247
+ * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB
248
+ * Added SyslogUdpHandler to send logs to a remote syslogd server
249
+ * Added LogglyHandler to send logs to a Loggly account
250
+ * Added $level to IntrospectionProcessor so it only adds backtraces when needed
251
+ * Added $version to LogstashFormatter to allow using the new v1 Logstash format
252
+ * Added $appName to NewRelicHandler
253
+ * Added configuration of Pushover notification retries/expiry
254
+ * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default
255
+ * Added chainability to most setters for all handlers
256
+ * Fixed RavenHandler batch processing so it takes the message from the record with highest priority
257
+ * Fixed HipChatHandler batch processing so it sends all messages at once
258
+ * Fixed issues with eAccelerator
259
+ * Fixed and improved many small things
260
+
261
+ ### 1.6.0 (2013-07-29)
262
+
263
+ * Added HipChatHandler to send logs to a HipChat chat room
264
+ * Added ErrorLogHandler to send logs to PHP's error_log function
265
+ * Added NewRelicHandler to send logs to NewRelic's service
266
+ * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler
267
+ * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel
268
+ * Added stack traces output when normalizing exceptions (json output & co)
269
+ * Added Monolog\Logger::API constant (currently 1)
270
+ * Added support for ChromePHP's v4.0 extension
271
+ * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel
272
+ * Added support for sending messages to multiple users at once with the PushoverHandler
273
+ * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler)
274
+ * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now
275
+ * Fixed issue in RotatingFileHandler when an open_basedir restriction is active
276
+ * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0
277
+ * Fixed SyslogHandler issue when many were used concurrently with different facilities
278
+
279
+ ### 1.5.0 (2013-04-23)
280
+
281
+ * Added ProcessIdProcessor to inject the PID in log records
282
+ * Added UidProcessor to inject a unique identifier to all log records of one request/run
283
+ * Added support for previous exceptions in the LineFormatter exception serialization
284
+ * Added Monolog\Logger::getLevels() to get all available levels
285
+ * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle
286
+
287
+ ### 1.4.1 (2013-04-01)
288
+
289
+ * Fixed exception formatting in the LineFormatter to be more minimalistic
290
+ * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0
291
+ * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days
292
+ * Fixed WebProcessor array access so it checks for data presence
293
+ * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors
294
+
295
+ ### 1.4.0 (2013-02-13)
296
+
297
+ * Added RedisHandler to log to Redis via the Predis library or the phpredis extension
298
+ * Added ZendMonitorHandler to log to the Zend Server monitor
299
+ * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor
300
+ * Added `$useSSL` option to the PushoverHandler which is enabled by default
301
+ * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously
302
+ * Fixed header injection capability in the NativeMailHandler
303
+
304
+ ### 1.3.1 (2013-01-11)
305
+
306
+ * Fixed LogstashFormatter to be usable with stream handlers
307
+ * Fixed GelfMessageFormatter levels on Windows
308
+
309
+ ### 1.3.0 (2013-01-08)
310
+
311
+ * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface`
312
+ * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance
313
+ * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash)
314
+ * Added PushoverHandler to send mobile notifications
315
+ * Added CouchDBHandler and DoctrineCouchDBHandler
316
+ * Added RavenHandler to send data to Sentry servers
317
+ * Added support for the new MongoClient class in MongoDBHandler
318
+ * Added microsecond precision to log records' timestamps
319
+ * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing
320
+ the oldest entries
321
+ * Fixed normalization of objects with cyclic references
322
+
323
+ ### 1.2.1 (2012-08-29)
324
+
325
+ * Added new $logopts arg to SyslogHandler to provide custom openlog options
326
+ * Fixed fatal error in SyslogHandler
327
+
328
+ ### 1.2.0 (2012-08-18)
329
+
330
+ * Added AmqpHandler (for use with AMQP servers)
331
+ * Added CubeHandler
332
+ * Added NativeMailerHandler::addHeader() to send custom headers in mails
333
+ * Added the possibility to specify more than one recipient in NativeMailerHandler
334
+ * Added the possibility to specify float timeouts in SocketHandler
335
+ * Added NOTICE and EMERGENCY levels to conform with RFC 5424
336
+ * Fixed the log records to use the php default timezone instead of UTC
337
+ * Fixed BufferHandler not being flushed properly on PHP fatal errors
338
+ * Fixed normalization of exotic resource types
339
+ * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog
340
+
341
+ ### 1.1.0 (2012-04-23)
342
+
343
+ * Added Monolog\Logger::isHandling() to check if a handler will
344
+ handle the given log level
345
+ * Added ChromePHPHandler
346
+ * Added MongoDBHandler
347
+ * Added GelfHandler (for use with Graylog2 servers)
348
+ * Added SocketHandler (for use with syslog-ng for example)
349
+ * Added NormalizerFormatter
350
+ * Added the possibility to change the activation strategy of the FingersCrossedHandler
351
+ * Added possibility to show microseconds in logs
352
+ * Added `server` and `referer` to WebProcessor output
353
+
354
+ ### 1.0.2 (2011-10-24)
355
+
356
+ * Fixed bug in IE with large response headers and FirePHPHandler
357
+
358
+ ### 1.0.1 (2011-08-25)
359
+
360
+ * Added MemoryPeakUsageProcessor and MemoryUsageProcessor
361
+ * Added Monolog\Logger::getName() to get a logger's channel name
362
+
363
+ ### 1.0.0 (2011-07-06)
364
+
365
+ * Added IntrospectionProcessor to get info from where the logger was called
366
+ * Fixed WebProcessor in CLI
367
+
368
+ ### 1.0.0-RC1 (2011-07-01)
369
+
370
+ * Initial release
vendor/monolog/monolog/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2011-2016 Jordi Boggiano
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
vendor/monolog/monolog/README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Monolog - Logging for PHP [![Build Status](https://img.shields.io/travis/Seldaek/monolog.svg)](https://travis-ci.org/Seldaek/monolog)
2
+
3
+ [![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog)
4
+ [![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog)
5
+
6
+
7
+ Monolog sends your logs to files, sockets, inboxes, databases and various
8
+ web services. See the complete list of handlers below. Special handlers
9
+ allow you to build advanced logging strategies.
10
+
11
+ This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
12
+ interface that you can type-hint against in your own libraries to keep
13
+ a maximum of interoperability. You can also use it in your applications to
14
+ make sure you can always use another compatible logger at a later time.
15
+ As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels.
16
+ Internally Monolog still uses its own level scheme since it predates PSR-3.
17
+
18
+ ## Installation
19
+
20
+ Install the latest version with
21
+
22
+ ```bash
23
+ $ composer require monolog/monolog
24
+ ```
25
+
26
+ ## Basic Usage
27
+
28
+ ```php
29
+ <?php
30
+
31
+ use Monolog\Logger;
32
+ use Monolog\Handler\StreamHandler;
33
+
34
+ // create a log channel
35
+ $log = new Logger('name');
36
+ $log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
37
+
38
+ // add records to the log
39
+ $log->addWarning('Foo');
40
+ $log->addError('Bar');
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ - [Usage Instructions](doc/01-usage.md)
46
+ - [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md)
47
+ - [Utility classes](doc/03-utilities.md)
48
+ - [Extending Monolog](doc/04-extending.md)
49
+
50
+ ## Third Party Packages
51
+
52
+ Third party handlers, formatters and processors are
53
+ [listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You
54
+ can also add your own there if you publish one.
55
+
56
+ ## About
57
+
58
+ ### Requirements
59
+
60
+ - Monolog works with PHP 5.3 or above, and is also tested to work with HHVM.
61
+
62
+ ### Submitting bugs and feature requests
63
+
64
+ Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues)
65
+
66
+ ### Framework Integrations
67
+
68
+ - Frameworks and