WP eCommerce - Version 3.11.0

Version Description

  • Potentially breaking change: wpsc_add_to_cart() now checks the $_REQUEST super global, rather than $_POST. This allows for future features, such as populating carts from a URL token, etc. Anywhere you may have code that checks for $_POST, in this context, it should now check $_REQUEST. See #1852.
  • Fix: Improvements to internationalization across the board, including updates to introduce compatibility for translate.wordpress.org.
  • Fix: Show admin notice if administrator has not set any target markets. See #711.
  • Fix: Check post_status more stringently in single page template controller. See #844.
  • Fix: The Google Analytics integration was calculating products once, not once per quantity in the cart. See #1718.
  • Fix: The Google Analytics integration was incompatible with the Yoast Analytics plugin. See #1736.
  • Fix: Resolve scenarios where variation combinations for products that were unavailable could still allow for cart addition (adding the parent product, rather than the variation). See #1373.
  • Fix: Order totals on sales log page did not count Closed Orders, but did Orders Received. This has been reversed, as that is the paradigm used throughout the rest of the project. See #1728.
  • Fix: Deleting a purchase log now also deletes the purchase meta associated with that log. See #1877.
  • Fix: Deleting a purchase log now also deletes the download status entries for that log. See #1964.
  • Fix: In the rare occurrence that an insert for a purchase log entry fails, we now return an error saying so. See #1892.
  • Fix: When creating a variation, you should be limited to selecting only variation sets as parents, not other variations. See #1893.
  • Enhancement: General performance improvements surrounding meta retreival, especially for countries. Including caching, cache invalidation, etc. See #1894.
  • Enhancement: New 3.0 Payment Gateway API now has a method that checks for currencies that don't use fractions. Our code formally had several areas these currencies were hard-coded, and egregiously incomplete. See #1917.
  • Enhancement: Mass improvements to 2.0 theme engine. Bug fixes, rich markup support, and much more. Want to test it out before 4.0? We have a filter for that.
  • Enhancement: Filter bulk messages to reflect that users are updating products, not posts. See #844.
  • Enhancement: Improvements to code for Australia Post. See #1337.
  • Enhancement: Standardize on a single, filterable method for checking the completion status of an order. See #1360.
  • Enhancement: Significant improvements to how digital downloads are handled and made available. See #37.
  • Enhancement: Improve admin performance for sorted product categories. See #1389.
  • Enhancement: Regions are now filtered. See #1930.
  • Enhancement: Improve flexibility of product duplication functionality. Ensures that post meta tied to specific IDs have the available filters to update those IDs. See #1672.
  • Enhancement: All front-end AJAX responses are now filtered. See #1698.
  • New: Introducing Amazon Payments as an available payment gateway.
  • New: Introduced better filtering mechanisms for custom purchase statuses and related bulk actions and labels for those statuses. See #1525 and related issues/PRs.
  • New: Introduced a new filter, wpsc_checkout_get_fields, allowing you to add, remove, and modify checkout form fields. See #1837.
Download this release

Release Info

Developer JustinSainton
Plugin Icon 128x128 WP eCommerce
Version 3.11.0
Comparing to
See all releases

Code changes from version 3.10.1 to 3.11.0

Files changed (304) hide show
  1. images/cc.png +0 -0
  2. package.json +0 -16
  3. phpunit.xml +0 -14
  4. readme.md +0 -39
  5. readme.txt +33 -6
  6. wp-shopping-cart.php +28 -14
  7. wpsc-admin/admin-form-functions.php +48 -48
  8. wpsc-admin/admin.php +188 -364
  9. wpsc-admin/ajax-and-init.php +4 -17
  10. wpsc-admin/ajax.php +52 -18
  11. wpsc-admin/css/admin.css +28 -15
  12. wpsc-admin/css/settingspage.css +9 -2
  13. wpsc-admin/db-upgrades/routines/1.php +25 -25
  14. wpsc-admin/db-upgrades/routines/10.php +3 -3
  15. wpsc-admin/db-upgrades/routines/11.php +5 -5
  16. wpsc-admin/db-upgrades/routines/13.php +1 -1
  17. wpsc-admin/db-upgrades/routines/14.php +4 -4
  18. wpsc-admin/db-upgrades/routines/2.php +105 -105
  19. wpsc-admin/db-upgrades/routines/3.php +5 -5
  20. wpsc-admin/db-upgrades/routines/4.php +13 -3
  21. wpsc-admin/db-upgrades/routines/8.php +1 -1
  22. wpsc-admin/db-upgrades/upgrade.php +9 -9
  23. wpsc-admin/db-upgrades/views/main.php +3 -3
  24. wpsc-admin/display-coupon-add.php +36 -36
  25. wpsc-admin/display-coupon-edit.php +59 -58
  26. wpsc-admin/display-coupons.php +35 -60
  27. wpsc-admin/display-debug.page.php +0 -353
  28. wpsc-admin/display-items.page.php +19 -20
  29. wpsc-admin/display-options-settings.page.php +15 -7
  30. wpsc-admin/display-sales-logs.php +50 -50
  31. wpsc-admin/display-update.page.php +23 -15
  32. wpsc-admin/display-upgrades.page.php +124 -64
  33. wpsc-admin/includes/coupon-list-table-class.php +87 -80
  34. wpsc-admin/includes/display-items-functions.php +131 -122
  35. wpsc-admin/includes/duplicate-product-class.php +447 -0
  36. wpsc-admin/includes/product-functions.php +6 -10
  37. wpsc-admin/includes/product-variation-list-table.class.php +38 -35
  38. wpsc-admin/includes/product-variations-manage.page.php +2 -2
  39. wpsc-admin/includes/product-variations-page.class.php +10 -10
  40. wpsc-admin/includes/product-variations-setup.page.php +8 -8
  41. wpsc-admin/includes/product-variations.page.php +1 -1
  42. wpsc-admin/includes/purchase-log-action-links.php +5 -5
  43. wpsc-admin/includes/purchase-log-list-table-class.php +365 -66
  44. wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php +3 -3
  45. wpsc-admin/includes/purchase-logs-page/item-details.php +37 -35
  46. wpsc-admin/includes/purchase-logs-page/list-table.php +8 -8
  47. wpsc-admin/includes/purchase-logs-page/packing-slip.php +13 -13
  48. wpsc-admin/includes/purchase-logs-page/upgrade.php +4 -4
  49. wpsc-admin/includes/save-data.functions.php +60 -60
  50. wpsc-admin/includes/settings-tabs/admin.php +25 -25
  51. wpsc-admin/includes/settings-tabs/checkout.php +67 -66
  52. wpsc-admin/includes/settings-tabs/gateway.php +16 -18
  53. wpsc-admin/includes/settings-tabs/general.php +44 -30
  54. wpsc-admin/includes/settings-tabs/import.php +45 -45
  55. wpsc-admin/includes/settings-tabs/marketing.php +32 -32
  56. wpsc-admin/includes/settings-tabs/shipping.php +49 -51
  57. wpsc-admin/includes/settings-tabs/taxes.php +27 -27
  58. wpsc-admin/includes/tax_and_shipping.php +10 -9
  59. wpsc-admin/includes/updating-functions.php +17 -17
  60. wpsc-admin/includes/walker-variation-checklist.php +1 -1
  61. wpsc-admin/init.php +62 -40
  62. wpsc-admin/js/admin-legacy.js +0 -37
  63. wpsc-admin/js/admin.js +20 -0
  64. wpsc-admin/js/product-variations.js +5 -5
  65. wpsc-admin/js/purchase-log-action-links.js +7 -5
  66. wpsc-admin/js/purchase-logs.js +1 -0
  67. wpsc-admin/js/set-post-thumbnail.js +1 -0
  68. wpsc-admin/js/settings-page.js +18 -11
  69. wpsc-admin/js/variations.js +3 -1
  70. wpsc-admin/media.php +10 -5
  71. wpsc-admin/settings-page.php +11 -11
  72. wpsc-admin/users.php +1 -1
  73. wpsc-components/marketplace-core-v1/library/Sputnik.php +4 -4
  74. wpsc-components/marketplace-core-v1/library/Sputnik/API.php +3 -3
  75. wpsc-components/marketplace-core-v1/library/Sputnik/API/Auth.php +1 -1
  76. wpsc-components/marketplace-core-v1/library/Sputnik/Admin.php +79 -77
  77. wpsc-components/marketplace-core-v1/library/Sputnik/Library/TwitterOAuth.php +3 -3
  78. wpsc-components/marketplace-core-v1/library/Sputnik/List/Account.php +7 -7
  79. wpsc-components/marketplace-core-v1/library/Sputnik/List/Install.php +41 -41
  80. wpsc-components/marketplace-core-v1/library/Sputnik/Pointers.php +3 -3
  81. wpsc-components/marketplace-core-v1/library/Sputnik/ThemeUpgrader.php +3 -3
  82. wpsc-components/marketplace-core-v1/library/Sputnik/Theme_Upgrader.php +3 -3
  83. wpsc-components/marketplace-core-v1/library/Sputnik/Updater.php +2 -2
  84. wpsc-components/marketplace-core-v1/library/Sputnik/Upgrader.php +3 -3
  85. wpsc-components/marketplace-core-v1/library/Sputnik/Upgrader/Skin.php +6 -6
  86. wpsc-components/marketplace-core-v1/library/Sputnik/View.php +3 -3
  87. wpsc-components/marketplace-core-v1/library/Sputnik/View/Account.php +13 -13
  88. wpsc-components/marketplace-core-v1/library/Sputnik/View/Auth.php +1 -1
  89. wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser.php +9 -9
  90. wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser/Grid.php +23 -23
  91. wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser/List.php +13 -13
  92. wpsc-components/marketplace-core-v1/library/Sputnik/View/Info.php +24 -24
  93. wpsc-components/marketplace-core-v1/library/Sputnik/View/Install.php +3 -3
  94. wpsc-components/marketplace-core-v1/library/Sputnik/View/Install/Skin.php +6 -6
  95. wpsc-components/marketplace-core-v1/library/Sputnik/View/Upgrade.php +4 -4
  96. wpsc-components/marketplace-core-v1/static/admin.js +1 -0
  97. wpsc-components/marketplace-core-v1/static/modal.js +3 -2
  98. wpsc-components/merchant-core-v2/helpers/admin.php +6 -6
  99. wpsc-components/merchant-core-v2/helpers/checkout.php +16 -3
  100. wpsc-components/merchant-core-v2/helpers/gateways.php +9 -9
  101. wpsc-components/merchant-core-v3/classes/payment-gateway.php +11 -11
  102. wpsc-components/merchant-core-v3/gateways/amazon-payments.php +1846 -0
  103. wpsc-components/merchant-core-v3/gateways/dg.css +0 -0
  104. wpsc-components/merchant-core-v3/gateways/manual.php +4 -4
  105. wpsc-components/merchant-core-v3/gateways/paypal-digital-goods.php +38 -38
  106. wpsc-components/merchant-core-v3/gateways/paypal-express-checkout.php +33 -33
  107. wpsc-components/merchant-core-v3/gateways/paypal-pro.php +24 -24
  108. wpsc-components/merchant-core-v3/gateways/php-merchant/README.md +0 -0
  109. wpsc-components/merchant-core-v3/gateways/php-merchant/common/exception.php +0 -0
  110. wpsc-components/merchant-core-v3/gateways/php-merchant/common/helpers.php +0 -0
  111. wpsc-components/merchant-core-v3/gateways/php-merchant/common/http-curl.php +0 -0
  112. wpsc-components/merchant-core-v3/gateways/php-merchant/common/http.php +0 -0
  113. wpsc-components/merchant-core-v3/gateways/php-merchant/common/php-merchant.php +0 -0
  114. wpsc-components/merchant-core-v3/gateways/php-merchant/common/response.php +0 -0
  115. wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-express-checkout-response.php +0 -0
  116. wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-express-checkout.php +1 -1
  117. wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-ipn.php +0 -0
  118. wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-pro-response.php +0 -0
  119. wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-pro.php +1 -1
  120. wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-response.php +0 -0
  121. wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal.php +0 -0
  122. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/common/http-curl.php +0 -0
  123. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/common/php-merchant.php +0 -0
  124. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/common/test-accounts.php +0 -0
  125. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/gateways/paypal-express-checkout.php +0 -0
  126. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/gateways/paypal-ipn.php +0 -0
  127. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/gateways/paypal.php +0 -0
  128. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/index.php +0 -0
  129. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/http-curl.php +0 -0
  130. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x1.php +0 -0
  131. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x2.php +0 -0
  132. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x3.php +0 -0
  133. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x4.php +0 -0
  134. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x1.php +0 -0
  135. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x2.php +0 -0
  136. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x3.php +0 -0
  137. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x4.php +0 -0
  138. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x5.php +0 -0
  139. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x6.php +0 -0
  140. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-express-checkout.php +0 -0
  141. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-pro-cert-x1.php +0 -0
  142. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-pro-cert-x2.php +0 -0
  143. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE +0 -0
  144. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/LICENSE +0 -0
  145. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/README +0 -0
  146. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/VERSION +0 -0
  147. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/authentication.php +0 -0
  148. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/autorun.php +0 -0
  149. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/browser.php +0 -0
  150. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/collector.php +0 -0
  151. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/compatibility.php +0 -0
  152. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/cookies.php +0 -0
  153. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/default_reporter.php +0 -0
  154. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/detached.php +0 -0
  155. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/authentication_documentation.html +0 -0
  156. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/browser_documentation.html +0 -0
  157. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/docs.css +0 -0
  158. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/expectation_documentation.html +0 -0
  159. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/form_testing_documentation.html +0 -0
  160. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/group_test_documentation.html +0 -0
  161. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/index.html +0 -0
  162. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/mock_objects_documentation.html +0 -0
  163. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/overview.html +0 -0
  164. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/partial_mocks_documentation.html +0 -0
  165. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/reporter_documentation.html +0 -0
  166. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/unit_test_documentation.html +0 -0
  167. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/web_tester_documentation.html +0 -0
  168. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/authentication_documentation.html +0 -0
  169. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/browser_documentation.html +0 -0
  170. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/docs.css +0 -0
  171. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/expectation_documentation.html +0 -0
  172. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/form_testing_documentation.html +0 -0
  173. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/group_test_documentation.html +0 -0
  174. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/index.html +0 -0
  175. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/mock_objects_documentation.html +0 -0
  176. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/overview.html +0 -0
  177. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/partial_mocks_documentation.html +0 -0
  178. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/reporter_documentation.html +0 -0
  179. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/unit_test_documentation.html +0 -0
  180. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/web_tester_documentation.html +0 -0
  181. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/dumper.php +0 -0
  182. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/eclipse.php +0 -0
  183. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/encoding.php +0 -0
  184. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/errors.php +0 -0
  185. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/exceptions.php +0 -0
  186. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/expectation.php +0 -0
  187. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/extensions/pear_test_case.php +0 -0
  188. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/extensions/testdox.php +0 -0
  189. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/extensions/testdox/test.php +0 -0
  190. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/form.php +0 -0
  191. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/frames.php +0 -0
  192. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/http.php +0 -0
  193. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/invoker.php +0 -0
  194. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/mock_objects.php +0 -0
  195. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/page.php +0 -0
  196. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/php_parser.php +0 -0
  197. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/reflection_php4.php +0 -0
  198. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/reflection_php5.php +0 -0
  199. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/remote.php +0 -0
  200. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/reporter.php +0 -0
  201. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/scorer.php +0 -0
  202. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/selector.php +0 -0
  203. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/shell_tester.php +0 -0
  204. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/simpletest.php +0 -0
  205. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/socket.php +0 -0
  206. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/tag.php +0 -0
  207. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/acceptance_test.php +0 -0
  208. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/adapter_test.php +0 -0
  209. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/all_tests.php +0 -0
  210. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/authentication_test.php +0 -0
  211. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/autorun_test.php +0 -0
  212. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/bad_test_suite.php +0 -0
  213. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/browser_test.php +0 -0
  214. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/collector_test.php +0 -0
  215. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/command_line_test.php +0 -0
  216. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/compatibility_test.php +0 -0
  217. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/cookies_test.php +0 -0
  218. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/detached_test.php +0 -0
  219. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/dumper_test.php +0 -0
  220. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/eclipse_test.php +0 -0
  221. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/encoding_test.php +0 -0
  222. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/errors_test.php +0 -0
  223. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/exceptions_test.php +0 -0
  224. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/expectation_test.php +0 -0
  225. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/form_test.php +0 -0
  226. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/frames_test.php +0 -0
  227. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/http_test.php +0 -0
  228. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/interfaces_test.php +0 -0
  229. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/interfaces_test_php5_1.php +0 -0
  230. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/live_test.php +0 -0
  231. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/mock_objects_test.php +0 -0
  232. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/page_test.php +0 -0
  233. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/parse_error_test.php +0 -0
  234. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/parsing_test.php +0 -0
  235. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/php_parser_test.php +0 -0
  236. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/reflection_php4_test.php +0 -0
  237. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/reflection_php5_test.php +0 -0
  238. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/remote_test.php +0 -0
  239. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/shell_test.php +0 -0
  240. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/shell_tester_test.php +0 -0
  241. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/simpletest_test.php +0 -0
  242. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/site/file.html +0 -0
  243. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/socket_test.php +0 -0
  244. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/collector/collectable.1 +0 -0
  245. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/collector/collectable.2 +0 -0
  246. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/empty_test_file.php +0 -0
  247. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/failing_test.php +0 -0
  248. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/latin1_sample +0 -0
  249. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/passing_test.php +0 -0
  250. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/spl_examples.php +0 -0
  251. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/supplementary_upload_sample.txt +0 -0
  252. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/test1.php +0 -0
  253. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/upload_sample.txt +0 -0
  254. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/tag_test.php +0 -0
  255. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/test_with_parse_error.php +0 -0
  256. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/unit_tester_test.php +0 -0
  257. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/unit_tests.php +0 -0
  258. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/url_test.php +0 -0
  259. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/user_agent_test.php +0 -0
  260. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/visual_test.php +0 -0
  261. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/web_tester_test.php +0 -0
  262. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/xml_test.php +0 -0
  263. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test_case.php +0 -0
  264. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/tidy_parser.php +0 -0
  265. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/unit_tester.php +0 -0
  266. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/url.php +0 -0
  267. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/user_agent.php +0 -0
  268. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/varlog.php +0 -0
  269. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/web_tester.php +0 -0
  270. wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/xml.php +0 -0
  271. wpsc-components/merchant-core-v3/helpers/admin.php +4 -4
  272. wpsc-components/merchant-core-v3/helpers/payment-gateway.php +0 -0
  273. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/css/style.css +45 -0
  274. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-de.php +24 -0
  275. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-en.php +27 -0
  276. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-es.php +22 -0
  277. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-fr.php +22 -0
  278. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-it.php +24 -0
  279. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-de.php +26 -0
  280. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-en.php +27 -0
  281. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-es.php +26 -0
  282. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-fr.php +26 -0
  283. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-it.php +28 -0
  284. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/images/amazon-payments.gif +0 -0
  285. wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/js/amazon-checkout.js +60 -0
  286. wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/Client.php +1551 -0
  287. wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/HttpCurl.php +126 -0
  288. wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/Interface.php +473 -0
  289. wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/IpnHandler.php +407 -0
  290. wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/ResponseParser.php +83 -0
  291. wpsc-components/theme-engine-v1/classes/breadcrumbs.php +51 -5
  292. wpsc-components/theme-engine-v1/classes/checkout-ajax.php +3 -3
  293. wpsc-components/theme-engine-v1/classes/checkout-localization.php +3 -3
  294. wpsc-components/theme-engine-v1/classes/hide-subcatsprods-in-cat.php +19 -31
  295. wpsc-components/theme-engine-v1/classes/settings-tab-presentation.php +182 -183
  296. wpsc-components/theme-engine-v1/classes/wpsc-products-by-category.php +28 -85
  297. wpsc-components/theme-engine-v1/helpers/admin.php +1 -1
  298. wpsc-components/theme-engine-v1/helpers/ajax.php +72 -55
  299. wpsc-components/theme-engine-v1/helpers/checkout.php +2 -2
  300. wpsc-components/theme-engine-v1/helpers/form.php +2 -52
  301. wpsc-components/theme-engine-v1/helpers/page.php +51 -25
  302. wpsc-components/theme-engine-v1/helpers/product.php +11 -11
  303. wpsc-components/theme-engine-v1/helpers/query.php +3 -3
  304. wpsc-components/theme-engine-v1/helpers/template-tags.php +42 -45
images/cc.png ADDED
Binary file
package.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "name": "wp-e-commerce",
3
- "version": "3.10.1",
4
- "private": true,
5
- "devDependencies": {
6
- "grunt": "~0.4.5",
7
- "grunt-exec": "~0.4.5",
8
- "grunt-potomo": "~2.1.0",
9
- "grunt-wp-i18n": "~0.4.9",
10
- "load-grunt-tasks": "~0.2.0",
11
- "grunt-contrib-compress": "~0.8.0",
12
- "grunt-contrib-clean": "~0.5.0",
13
- "grunt-contrib-copy": "~0.5.0",
14
- "grunt-contrib-jshint": "^0.10.0"
15
- }
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
phpunit.xml DELETED
@@ -1,14 +0,0 @@
1
- <phpunit
2
- bootstrap="tests/bootstrap.php"
3
- backupGlobals="false"
4
- colors="true"
5
- convertErrorsToExceptions="true"
6
- convertNoticesToExceptions="false"
7
- convertWarningsToExceptions="false"
8
- >
9
- <testsuites>
10
- <testsuite>
11
- <directory prefix="test-" suffix=".php">./tests/</directory>
12
- </testsuite>
13
- </testsuites>
14
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.md DELETED
@@ -1,39 +0,0 @@
1
- WP eCommerce [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/wp-e-commerce/WP-e-Commerce/badges/quality-score.png?s=155ede743c82bcf5116904bf155dcf215da820b0)](https://scrutinizer-ci.com/g/wp-e-commerce/WP-e-Commerce/) [![Coverage Status](https://img.shields.io/coveralls/wp-e-commerce/WP-e-Commerce.svg)](https://coveralls.io/r/wp-e-commerce/WP-e-Commerce) [![Build Status](https://travis-ci.org/wp-e-commerce/WP-e-Commerce.svg?branch=master)](https://travis-ci.org/wp-e-commerce/WP-e-Commerce)
2
- ============
3
-
4
- About
5
- -----
6
-
7
- WP eCommerce is a free open-source WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
8
-
9
- More details about this plugin features can be found on our website at [wpecommerce.org](http://wpecommerce.org/features/).
10
-
11
- User documentation can be found at [docs.wpecommerce.org](http://docs.wpecommerce.org).
12
-
13
- If you're looking for general user support, please submit your support request on [our community support forums](https://wordpress.org/support/plugin/wp-e-commerce).
14
-
15
- Development status
16
- -------------------------
17
-
18
- * The latest stable version is [3.10.1](http://wordpress.org/extend/plugins/wp-e-commerce).
19
- * Active development version: 4.0-dev (branch [master](https://github.com/wp-e-commerce/WP-e-Commerce))
20
- * [Roadmap for 4.0](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Roadmap)
21
- * [4.0 tickets](https://github.com/wp-e-commerce/WP-e-Commerce/milestones/4.0)
22
-
23
- How to contribute code
24
- -----------------------------
25
- * [Coding standards and code quality](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Coding-Standards-and-Code-Quality)
26
- * [Submitting code](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Submitting-Code)
27
- * [Code review](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Code-Review)
28
- * [Merging pull requests](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Merging-Pull-Requests)
29
-
30
- How to report issues
31
- --------------------
32
- * [Reporting a security issue](wiki/Reporting-a-security-issue)
33
- * [What makes a perfect issue ticket?](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Creating-issue-tickets)
34
- * [Issue labels and workflow](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Issue-Labels-and-Workflow)
35
-
36
- Translating WPEC
37
- ----------------
38
- * [How to get involved](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Getting-involved-with-translation)
39
- * [Current status](https://github.com/wp-e-commerce/wp-e-commerce/wiki/i18n-Status)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP eCommerce ===
2
- Contributors: JustinSainton, mufasa
3
  Donate link: https://wpecommerce.org
4
- Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
  Requires at least: 4.1
6
  Tested up to: 4.3
7
- Stable tag: 3.10.1
8
 
9
  WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
@@ -36,6 +36,36 @@ After upgrading from earlier versions look for link "Update Store". This will up
36
 
37
  == Changelog ==
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  = 3.10.1 =
40
 
41
  * Fix: Uses version_compare() for comparing wpsc_version constant in legacy code (from 5 years ago). Using comparators was causing 3.10.0 to be "less than" 3.8, resulting in an unnecessary admin notice.
@@ -68,9 +98,6 @@ After upgrading from earlier versions look for link "Update Store". This will up
68
  * Fix: Taxes were broken following some refactoring of the admin saving callbacks.
69
  * Fix: Quick edit was overwriting variation SKUs and sale prices.
70
  * Fix: RSS Feed error.
71
- * Fix: Ensure flat rates settings are pre-populated by default, to avoid notices on new installs.
72
- * Fix: Forcing SSL when no SSL certificate is installed caused some core post type admin pages to fail to load.
73
- * Fix: In some circumstances, the javascript for country/region selection would fail. See [#1404](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1404)
74
 
75
  = 3.9.1 =
76
 
1
  === WP eCommerce ===
2
+ Contributors: JustinSainton
3
  Donate link: https://wpecommerce.org
4
+ Tags: e-commerce, woocommerce, digital downloads, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
  Requires at least: 4.1
6
  Tested up to: 4.3
7
+ Stable tag: 3.11.0
8
 
9
  WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
36
 
37
  == Changelog ==
38
 
39
+ = 3.11.0 =
40
+
41
+ * _Potentially breaking change_: wpsc_add_to_cart() now checks the `$_REQUEST` super global, rather than `$_POST`. This allows for future features, such as populating carts from a URL token, etc. Anywhere you may have code that checks for $_POST, in this context, it should now check $_REQUEST. See [#1852](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1852).
42
+ * Fix: Improvements to internationalization across the board, including updates to introduce compatibility for translate.wordpress.org.
43
+ * Fix: Show admin notice if administrator has not set any target markets. See [#711](https://github.com/wp-e-commerce/WP-e-Commerce/issues/711).
44
+ * Fix: Check post_status more stringently in single page template controller. See [#844](https://github.com/wp-e-commerce/WP-e-Commerce/issues/844).
45
+ * Fix: The Google Analytics integration was calculating products once, not once per quantity in the cart. See [#1718](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1718).
46
+ * Fix: The Google Analytics integration was incompatible with the Yoast Analytics plugin. See [#1736](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1736).
47
+ * Fix: Resolve scenarios where variation combinations for products that were unavailable could still allow for cart addition (adding the parent product, rather than the variation). See [#1373](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1373).
48
+ * Fix: Order totals on sales log page did not count Closed Orders, but did Orders Received. This has been reversed, as that is the paradigm used throughout the rest of the project. See [#1728](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1728).
49
+ * Fix: Deleting a purchase log now also deletes the purchase meta associated with that log. See [#1877](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1877).
50
+ * Fix: Deleting a purchase log now also deletes the download status entries for that log. See [#1964](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1964).
51
+ * Fix: In the rare occurrence that an insert for a purchase log entry fails, we now return an error saying so. See [#1892](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1892).
52
+ * Fix: When creating a variation, you should be limited to selecting only variation sets as parents, not other variations. See [#1893](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1893).
53
+ * Enhancement: General performance improvements surrounding meta retreival, especially for countries. Including caching, cache invalidation, etc. See [#1894](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1894).
54
+ * Enhancement: New 3.0 Payment Gateway API now has a method that checks for currencies that don't use fractions. Our code formally had several areas these currencies were hard-coded, and egregiously incomplete. See [#1917](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1917).
55
+ * Enhancement: Mass improvements to 2.0 theme engine. Bug fixes, rich markup support, and much more. Want to test it out before 4.0? We have a filter for that.
56
+ * Enhancement: Filter bulk messages to reflect that users are updating products, not posts. See [#844](https://github.com/wp-e-commerce/WP-e-Commerce/issues/844).
57
+ * Enhancement: Improvements to code for Australia Post. See [#1337](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1337).
58
+ * Enhancement: Standardize on a single, filterable method for checking the completion status of an order. See [#1360](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1360).
59
+ * Enhancement: Significant improvements to how digital downloads are handled and made available. See [#37](https://github.com/wp-e-commerce/WP-e-Commerce/issues/37).
60
+ * Enhancement: Improve admin performance for sorted product categories. See [#1389](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1389).
61
+ * Enhancement: Regions are now filtered. See [#1930](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1930).
62
+ * Enhancement: Improve flexibility of product duplication functionality. Ensures that post meta tied to specific IDs have the available filters to update those IDs. See [#1672](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1672).
63
+ * Enhancement: All front-end AJAX responses are now filtered. See [#1698](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1698).
64
+ * New: Introducing Amazon Payments as an available payment gateway.
65
+ * New: Introduced better filtering mechanisms for custom purchase statuses and related bulk actions and labels for those statuses. See [#1525](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1525) and related issues/PRs.
66
+ * New: Introduced a new filter, `wpsc_checkout_get_fields`, allowing you to add, remove, and modify checkout form fields. See [#1837](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1837).
67
+
68
+
69
  = 3.10.1 =
70
 
71
  * Fix: Uses version_compare() for comparing wpsc_version constant in legacy code (from 5 years ago). Using comparators was causing 3.10.0 to be "less than" 3.8, resulting in an unnecessary admin notice.
98
  * Fix: Taxes were broken following some refactoring of the admin saving callbacks.
99
  * Fix: Quick edit was overwriting variation SKUs and sale prices.
100
  * Fix: RSS Feed error.
 
 
 
101
 
102
  = 3.9.1 =
103
 
wp-shopping-cart.php CHANGED
@@ -3,9 +3,10 @@
3
  * Plugin Name: WP eCommerce
4
  * Plugin URI: http://wpecommerce.org/
5
  * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://wpecommerce.org" target="_blank">WPeCommerce.org</a> | <a href="https://wordpress.org/support/plugin/wp-e-commerce/" target="_blank">Support Forum</a> | <a href="http://docs.wpecommerce.org/" target="_blank">Documentation</a>
6
- * Version: 3.10.1
7
  * Author: WP eCommerce
8
  * Author URI: http://wpecommerce.org/
 
9
  **/
10
 
11
  /**
@@ -26,7 +27,7 @@ class WP_eCommerce {
26
  * Start WPEC on plugins loaded
27
  *
28
  * @uses add_action() Attaches to 'plugins_loaded' hook
29
- * @uses add_action() Attaches to 'wpsc_components' hook
30
  */
31
  public function __construct() {
32
  add_action( 'plugins_loaded' , array( $this, 'init' ), 8 );
@@ -46,7 +47,6 @@ class WP_eCommerce {
46
  public function init() {
47
  // Previous to initializing
48
  do_action( 'wpsc_pre_init' );
49
-
50
  // Initialize
51
  $this->start();
52
  $this->constants();
@@ -70,19 +70,19 @@ class WP_eCommerce {
70
  */
71
  public function _register_core_components( $components ) {
72
  $components['merchant']['core-v2'] = array(
73
- 'title' => __( 'WP eCommerce Merchant API v2', 'wpsc' ),
74
  'includes' =>
75
  WPSC_FILE_PATH . '/wpsc-components/merchant-core-v2/merchant-core-v2.php'
76
  );
77
 
78
  $components['merchant']['core-v3'] = array(
79
- 'title' => __( 'WP eCommerce Merchant API v3', 'wpsc' ),
80
  'includes' =>
81
  WPSC_FILE_PATH . '/wpsc-components/merchant-core-v3/merchant-core-v3.php'
82
  );
83
 
84
  $components['marketplace']['core-v1'] = array(
85
- 'title' => __( 'WP eCommerce Marketplace API v1', 'wpsc' ),
86
  'includes' =>
87
  WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/marketplace-core-v1.php'
88
  );
@@ -110,15 +110,31 @@ class WP_eCommerce {
110
  define( 'WPSC_FOLDER', dirname( WPSC_PLUGIN_BASENAME ) );
111
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
112
 
 
 
113
  //load text domain
114
- if ( ! load_plugin_textdomain( 'wpsc', false, '../languages/' ) ) {
115
- load_plugin_textdomain( 'wpsc', false, dirname( WPSC_PLUGIN_BASENAME ) . '/wpsc-languages/' );
116
  }
117
 
118
  // Finished starting
119
  do_action( 'wpsc_started' );
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  /**
123
  * Sets table names as WPDB properties.
124
  *
@@ -163,8 +179,6 @@ class WP_eCommerce {
163
  $wpdb->wpsc_visitors ,
164
  $wpdb->wpsc_visitormeta ,
165
  );
166
-
167
-
168
  }
169
 
170
  /**
@@ -229,7 +243,7 @@ class WP_eCommerce {
229
  foreach ( $registered as $component ) {
230
 
231
  if ( ! is_array( $component['includes'] ) ) {
232
- $component['includes'] = array( $component['includes' ] );
233
  }
234
 
235
  foreach ( $component['includes'] as $include ) {
@@ -271,12 +285,12 @@ class WP_eCommerce {
271
  add_action( 'init', '_wpsc_action_setup_customer', 1 );
272
 
273
  // WPEC is ready to use as soon as WordPress and customer is setup and loaded
274
- add_action( 'init', array( &$this, '_wpsc_fire_ready_action' ), 100 );
275
 
276
  // Load the purchase log statuses
277
  wpsc_core_load_purchase_log_statuses();
278
 
279
- // Load unique names and checout form types
280
  wpsc_core_load_checkout_data();
281
 
282
  // Load the gateways
@@ -330,4 +344,4 @@ $wpec = new WP_eCommerce();
330
 
331
  // Activation
332
  register_activation_hook( __FILE__ , array( $wpec, 'install' ) );
333
- register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
3
  * Plugin Name: WP eCommerce
4
  * Plugin URI: http://wpecommerce.org/
5
  * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://wpecommerce.org" target="_blank">WPeCommerce.org</a> | <a href="https://wordpress.org/support/plugin/wp-e-commerce/" target="_blank">Support Forum</a> | <a href="http://docs.wpecommerce.org/" target="_blank">Documentation</a>
6
+ * Version: 3.11.0
7
  * Author: WP eCommerce
8
  * Author URI: http://wpecommerce.org/
9
+ * Text Domain: wp-e-commerce
10
  **/
11
 
12
  /**
27
  * Start WPEC on plugins loaded
28
  *
29
  * @uses add_action() Attaches to 'plugins_loaded' hook
30
+ * @uses add_filter() Attaches to 'wpsc_components' hook
31
  */
32
  public function __construct() {
33
  add_action( 'plugins_loaded' , array( $this, 'init' ), 8 );
47
  public function init() {
48
  // Previous to initializing
49
  do_action( 'wpsc_pre_init' );
 
50
  // Initialize
51
  $this->start();
52
  $this->constants();
70
  */
71
  public function _register_core_components( $components ) {
72
  $components['merchant']['core-v2'] = array(
73
+ 'title' => __( 'WP eCommerce Merchant API v2', 'wp-e-commerce' ),
74
  'includes' =>
75
  WPSC_FILE_PATH . '/wpsc-components/merchant-core-v2/merchant-core-v2.php'
76
  );
77
 
78
  $components['merchant']['core-v3'] = array(
79
+ 'title' => __( 'WP eCommerce Merchant API v3', 'wp-e-commerce' ),
80
  'includes' =>
81
  WPSC_FILE_PATH . '/wpsc-components/merchant-core-v3/merchant-core-v3.php'
82
  );
83
 
84
  $components['marketplace']['core-v1'] = array(
85
+ 'title' => __( 'WP eCommerce Marketplace API v1', 'wp-e-commerce' ),
86
  'includes' =>
87
  WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/marketplace-core-v1.php'
88
  );
110
  define( 'WPSC_FOLDER', dirname( WPSC_PLUGIN_BASENAME ) );
111
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
112
 
113
+ add_filter( 'load_textdomain_mofile', array( $this, 'load_old_textdomain' ), 10, 2 );
114
+
115
  //load text domain
116
+ if ( ! load_plugin_textdomain( 'wp-e-commerce', false, '../languages/' ) ) {
117
+ load_plugin_textdomain( 'wp-e-commerce', false, dirname( WPSC_PLUGIN_BASENAME ) . '/wpsc-languages/' );
118
  }
119
 
120
  // Finished starting
121
  do_action( 'wpsc_started' );
122
  }
123
 
124
+ /**
125
+ * Load a .mo file for the old textdomain if one exists
126
+ * Necessary to maintain backwards compatibility after changing text-domains.
127
+ *
128
+ * @since 3.11.0
129
+ * @link: https://github.com/10up/grunt-wp-plugin/issues/21#issuecomment-62003284
130
+ */
131
+ public function load_old_textdomain( $mofile, $textdomain ) {
132
+ if ( $textdomain === 'wp-e-commerce' && ! file_exists( $mofile ) ) {
133
+ $mofile = dirname( $mofile ) . DIRECTORY_SEPARATOR . str_replace( $textdomain, 'wpsc', basename( $mofile ) );
134
+ }
135
+ return $mofile;
136
+ }
137
+
138
  /**
139
  * Sets table names as WPDB properties.
140
  *
179
  $wpdb->wpsc_visitors ,
180
  $wpdb->wpsc_visitormeta ,
181
  );
 
 
182
  }
183
 
184
  /**
243
  foreach ( $registered as $component ) {
244
 
245
  if ( ! is_array( $component['includes'] ) ) {
246
+ $component['includes'] = array( $component['includes'] );
247
  }
248
 
249
  foreach ( $component['includes'] as $include ) {
285
  add_action( 'init', '_wpsc_action_setup_customer', 1 );
286
 
287
  // WPEC is ready to use as soon as WordPress and customer is setup and loaded
288
+ add_action( 'init', array( $this, '_wpsc_fire_ready_action' ), 100 );
289
 
290
  // Load the purchase log statuses
291
  wpsc_core_load_purchase_log_statuses();
292
 
293
+ // Load unique names and checkout form types
294
  wpsc_core_load_checkout_data();
295
 
296
  // Load the gateways
344
 
345
  // Activation
346
  register_activation_hook( __FILE__ , array( $wpec, 'install' ) );
347
+ register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
wpsc-admin/admin-form-functions.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
- /**
3
  * The Admin Form Functions
4
- *
5
  * These are the functions that power administrative forms in the WordPress admin
6
- *
7
  * @package wp-e-commerce
8
- */
9
  function coupon_edit_form($coupon) {
10
 
11
  $conditions = maybe_unserialize($coupon['condition']);
@@ -17,13 +17,13 @@ $conditions = maybe_unserialize($coupon['condition']);
17
  $output .= "<form name='edit_coupon' id='".$coupon['coupon_code']."' method='post' action=''>\n\r";
18
  $output .= "<table class='add-coupon'>\n\r";
19
  $output .= " <tr>\n\r";
20
- $output .= " <th>".esc_html__('Coupon Code', 'wpsc')."</th>\n\r";
21
- $output .= " <th>".esc_html__('Discount', 'wpsc')."</th>\n\r";
22
- $output .= " <th>".esc_html__('Start', 'wpsc')."</th>\n\r";
23
- $output .= " <th>".esc_html__('Expiry', 'wpsc')."</th>\n\r";
24
- $output .= " <th>".esc_html__('Use Once', 'wpsc')."</th>\n\r";
25
- $output .= " <th>".esc_html__('Active', 'wpsc')."</th>\n\r";
26
- $output .= " <th>".esc_html__('Apply On All Products', 'wpsc')."</th>\n\r";
27
  $output .= " <th></th>\n\r";
28
  $output .= " </tr>\n\r";
29
  $output .= " <tr>\n\r";
@@ -37,7 +37,7 @@ $conditions = maybe_unserialize($coupon['condition']);
37
  $output .= " <select name='edit_coupon[".$id."][is-percentage]'>";
38
  $output .= " <option value='0' ".(($coupon['is-percentage'] == 0) ? "selected='true'" : '')." >$</option>\n\r";//
39
  $output .= " <option value='1' ".(($coupon['is-percentage'] == 1) ? "selected='true'" : '')." >%</option>\n\r";
40
- $output .= " <option value='2' ".(($coupon['is-percentage'] == 2) ? "selected='true'" : '')." >" . esc_html__( 'Free shipping', 'wpsc' ) . "</option>\n\r";
41
  $output .= " </select>\n\r";
42
  $output .= " </td>\n\r";
43
  $output .= " <td>\n\r";
@@ -68,20 +68,20 @@ $conditions = maybe_unserialize($coupon['condition']);
68
  if($conditions != null){
69
  $output .= "<tr>";
70
  $output .= "<th>";
71
- $output .= esc_html__("Conditions", 'wpsc');
72
  $output .= "</th>";
73
  $output .= "</tr>";
74
  $output .= "<th>";
75
- $output .= esc_html__("Delete", 'wpsc');
76
  $output .= "</th>";
77
  $output .= "<th>";
78
- $output .= esc_html__("Property", 'wpsc');
79
  $output .= "</th>";
80
  $output .= "<th>";
81
- $output .= esc_html__("Logic", 'wpsc');
82
  $output .= "</th>";
83
  $output .= "<th>";
84
- $output .= esc_html__("Value", 'wpsc');
85
  $output .= "</th>";
86
  $output .= " </tr>\n\r";
87
 
@@ -90,7 +90,7 @@ $conditions = maybe_unserialize($coupon['condition']);
90
  $output .= "<td>";
91
  $output .= "<input type='hidden' name='coupon_id' value='".$id."' />";
92
  $output .= "<input type='submit' id='delete_condition".$i."' style='display:none;' value='".$i."' name='delete_condition' />";
93
- $output .= "<span style='cursor:pointer;' class='delete_button' onclick='jQuery(\"#delete_condition".$i."\").click()'>" . esc_html__('Delete', 'wpsc' ) . "</span>";
94
  $output .= "</td>";
95
  $output .= "<td>";
96
  $output .= $condition['property'];
@@ -121,25 +121,25 @@ function wpsc_coupons_conditions($id){
121
 
122
  $output ='
123
  <input type="hidden" name="coupon_id" value="'.$id.'" />
124
- <tr><td colspan="3"><b>' . esc_html__( 'Add Conditions', 'wpsc') . '</b></td></tr>
125
  <tr><td colspan="6">
126
  <div class="coupon_condition">
127
  <div>
128
  <select class="ruleprops" name="rules[property][]">
129
- <option value="item_name" rel="order">' . esc_html__( 'Item name', 'wpsc') . '</option>
130
- <option value="item_quantity" rel="order">' . esc_html__( 'Item quantity', 'wpsc') . '</option>
131
- <option value="total_quantity" rel="order">' . esc_html__( 'Total quantity', 'wpsc') . '</option>
132
- <option value="subtotal_amount" rel="order">' . esc_html__( 'Subtotal amount', 'wpsc') . '</option>
133
  ' . apply_filters( 'wpsc_coupon_rule_property_options', '' ) . '
134
  </select>
135
  <select name="rules[logic][]">
136
- <option value="equal">' . esc_html__( 'Is equal to', 'wpsc') . '</option>
137
- <option value="greater">' . esc_html__( 'Is greater than', 'wpsc') . '</option>
138
- <option value="less">' . esc_html__( 'Is less than', 'wpsc') . '</option>
139
- <option value="contains">' . esc_html__( 'Contains', 'wpsc') . '</option>
140
- <option value="not_contain">' . esc_html__( 'Does not contain', 'wpsc') . '</option>
141
- <option value="begins">' . esc_html__( 'Begins with', 'wpsc') . '</option>
142
- <option value="ends">' . esc_html__( 'Ends with', 'wpsc') . '</option>
143
  </select>
144
  <span>
145
  <input type="text" name="rules[value][]"/>
@@ -152,7 +152,7 @@ $output ='
152
  <td>
153
  </td>
154
  <td colspan="3">
155
- <input type="submit" value="'.esc_attr__("Update Coupon", "wpsc").'" class="button-primary" name="edit_coupon['.$id.'][submit_coupon]" />';
156
 
157
  $nonced_url = admin_url( 'admin.php' );
158
  $nonced_url = add_query_arg(
@@ -165,7 +165,7 @@ $output ='
165
  );
166
  $nonced_url = wp_nonce_url( $nonced_url, 'delete-coupon' );
167
 
168
- $output.= "<a class='delete_button' style='text-decoration:none;' href=" .$nonced_url.">" . esc_html__( 'Delete', 'wpsc' ) . "</a>";
169
 
170
  $output.='
171
  </td>
@@ -177,16 +177,16 @@ return $output;
177
  function setting_button(){
178
  $next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
179
 
180
- // $output.="<div><img src='" . plugins_url( WPSC_DIR_NAME . '/images/settings_button.jpg' ) . "' onclick='display_settings_button()'>";
181
- $output.="<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".esc_html__('Settings', 'wpsc')." &raquo;</a>";
182
- $output.="<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
183
- $output.="<ul class='settings_button'>";
184
 
185
- $output.="<li><a href='admin.php?page=wpsc-settings'>".__('Shop Settings', 'wpsc')."</a></li>";
186
- $output.="<li><a href='admin.php?page=wpsc-settings&amp;tab=gateway'>".__('Money and Payment', 'wpsc')."</a></li>";
187
- $output.="<li><a href='admin.php?page=wpsc-settings&amp;tab=checkout'>".__('Checkout Page Settings', 'wpsc')."</a></li>";
188
- $output.="</ul>";
189
- $output.="</span>&emsp;&emsp;</div>";
190
 
191
  return $output;
192
  }
@@ -212,20 +212,20 @@ function wpsc_right_now() {
212
  $theme = get_option('wpsc_selected_theme');
213
  ?>
214
  <div class='table'>
215
- <p class='sub'><?php esc_html_e( 'At a Glance', 'wpsc' ); ?></p>
216
  <table style='border-top:1px solid #ececec;'>
217
  <tr class='first'>
218
  <td class='first b'>
219
  <?php echo $product_count; ?>
220
  </td>
221
  <td class='t'>
222
- <?php echo _nx( 'Product', 'Products', $product_count, 'dashboard widget', 'wpsc' ); ?>
223
  </td>
224
  <td class='b'>
225
  <?php echo $sales_count; ?>
226
  </td>
227
  <td class='last'>
228
- <?php echo _nx( 'Sale', 'Sales', $sales_count, 'dashboard widget', 'wpsc' ); ?>
229
  </td>
230
  </tr>
231
  <tr>
@@ -233,13 +233,13 @@ function wpsc_right_now() {
233
  <?php echo $group_count; ?>
234
  </td>
235
  <td class='t'>
236
- <?php echo _nx( 'Category', 'Categories', $group_count, 'dashboard widget', 'wpsc' ); ?>
237
  </td>
238
  <td class='b'>
239
  <?php echo $pending_sales; ?>
240
  </td>
241
  <td class='last t waiting'>
242
- <?php echo _n( 'Pending sale', 'Pending sales', $pending_sales, 'wpsc' ); ?>
243
  </td>
244
  </tr>
245
  <tr>
@@ -247,13 +247,13 @@ function wpsc_right_now() {
247
  <?php echo $variation_count; ?>
248
  </td>
249
  <td class='t'>
250
- <?php echo _nx( 'Variation', 'Variations', $variation_count, 'dashboard widget', 'wpsc' ); ?>
251
  </td>
252
  <td class='b'>
253
  <?php echo $accept_sales; ?>
254
  </td>
255
  <td class='last t approved'>
256
- <?php echo _n( 'Closed sale', 'Closed sales', $accept_sales, 'wpsc'); ?>
257
  </td>
258
  </tr>
259
  </table>
1
  <?php
2
+ /**
3
  * The Admin Form Functions
4
+ *
5
  * These are the functions that power administrative forms in the WordPress admin
6
+ *
7
  * @package wp-e-commerce
8
+ */
9
  function coupon_edit_form($coupon) {
10
 
11
  $conditions = maybe_unserialize($coupon['condition']);
17
  $output .= "<form name='edit_coupon' id='".$coupon['coupon_code']."' method='post' action=''>\n\r";
18
  $output .= "<table class='add-coupon'>\n\r";
19
  $output .= " <tr>\n\r";
20
+ $output .= " <th>".esc_html__('Coupon Code', 'wp-e-commerce')."</th>\n\r";
21
+ $output .= " <th>".esc_html__('Discount', 'wp-e-commerce')."</th>\n\r";
22
+ $output .= " <th>".esc_html__('Start', 'wp-e-commerce')."</th>\n\r";
23
+ $output .= " <th>".esc_html__('Expiry', 'wp-e-commerce')."</th>\n\r";
24
+ $output .= " <th>".esc_html__('Use Once', 'wp-e-commerce')."</th>\n\r";
25
+ $output .= " <th>".esc_html__('Active', 'wp-e-commerce')."</th>\n\r";
26
+ $output .= " <th>".esc_html__('Apply On All Products', 'wp-e-commerce')."</th>\n\r";
27
  $output .= " <th></th>\n\r";
28
  $output .= " </tr>\n\r";
29
  $output .= " <tr>\n\r";
37
  $output .= " <select name='edit_coupon[".$id."][is-percentage]'>";
38
  $output .= " <option value='0' ".(($coupon['is-percentage'] == 0) ? "selected='true'" : '')." >$</option>\n\r";//
39
  $output .= " <option value='1' ".(($coupon['is-percentage'] == 1) ? "selected='true'" : '')." >%</option>\n\r";
40
+ $output .= " <option value='2' ".(($coupon['is-percentage'] == 2) ? "selected='true'" : '')." >" . esc_html__( 'Free shipping', 'wp-e-commerce' ) . "</option>\n\r";
41
  $output .= " </select>\n\r";
42
  $output .= " </td>\n\r";
43
  $output .= " <td>\n\r";
68
  if($conditions != null){
69
  $output .= "<tr>";
70
  $output .= "<th>";
71
+ $output .= esc_html__("Conditions", 'wp-e-commerce');
72
  $output .= "</th>";
73
  $output .= "</tr>";
74
  $output .= "<th>";
75
+ $output .= esc_html__("Delete", 'wp-e-commerce');
76
  $output .= "</th>";
77
  $output .= "<th>";
78
+ $output .= esc_html__("Property", 'wp-e-commerce');
79
  $output .= "</th>";
80
  $output .= "<th>";
81
+ $output .= esc_html__("Logic", 'wp-e-commerce');
82
  $output .= "</th>";
83
  $output .= "<th>";
84
+ $output .= esc_html__("Value", 'wp-e-commerce');
85
  $output .= "</th>";
86
  $output .= " </tr>\n\r";
87
 
90
  $output .= "<td>";
91
  $output .= "<input type='hidden' name='coupon_id' value='".$id."' />";
92
  $output .= "<input type='submit' id='delete_condition".$i."' style='display:none;' value='".$i."' name='delete_condition' />";
93
+ $output .= "<span style='cursor:pointer;' class='delete_button' onclick='jQuery(\"#delete_condition".$i."\").click()'>" . esc_html__('Delete', 'wp-e-commerce' ) . "</span>";
94
  $output .= "</td>";
95
  $output .= "<td>";
96
  $output .= $condition['property'];
121
 
122
  $output ='
123
  <input type="hidden" name="coupon_id" value="'.$id.'" />
124
+ <tr><td colspan="3"><b>' . esc_html__( 'Add Conditions', 'wp-e-commerce') . '</b></td></tr>
125
  <tr><td colspan="6">
126
  <div class="coupon_condition">
127
  <div>
128
  <select class="ruleprops" name="rules[property][]">
129
+ <option value="item_name" rel="order">' . esc_html__( 'Item name', 'wp-e-commerce') . '</option>
130
+ <option value="item_quantity" rel="order">' . esc_html__( 'Item quantity', 'wp-e-commerce') . '</option>
131
+ <option value="total_quantity" rel="order">' . esc_html__( 'Total quantity', 'wp-e-commerce') . '</option>
132
+ <option value="subtotal_amount" rel="order">' . esc_html__( 'Subtotal amount', 'wp-e-commerce') . '</option>
133
  ' . apply_filters( 'wpsc_coupon_rule_property_options', '' ) . '
134
  </select>
135
  <select name="rules[logic][]">
136
+ <option value="equal">' . esc_html__( 'Is equal to', 'wp-e-commerce') . '</option>
137
+ <option value="greater">' . esc_html__( 'Is greater than', 'wp-e-commerce') . '</option>
138
+ <option value="less">' . esc_html__( 'Is less than', 'wp-e-commerce') . '</option>
139
+ <option value="contains">' . esc_html__( 'Contains', 'wp-e-commerce') . '</option>
140
+ <option value="not_contain">' . esc_html__( 'Does not contain', 'wp-e-commerce') . '</option>
141
+ <option value="begins">' . esc_html__( 'Begins with', 'wp-e-commerce') . '</option>
142
+ <option value="ends">' . esc_html__( 'Ends with', 'wp-e-commerce') . '</option>
143
  </select>
144
  <span>
145
  <input type="text" name="rules[value][]"/>
152
  <td>
153
  </td>
154
  <td colspan="3">
155
+ <input type="submit" value="'.esc_attr__("Update Coupon", 'wp-e-commerce').'" class="button-primary" name="edit_coupon['.$id.'][submit_coupon]" />';
156
 
157
  $nonced_url = admin_url( 'admin.php' );
158
  $nonced_url = add_query_arg(
165
  );
166
  $nonced_url = wp_nonce_url( $nonced_url, 'delete-coupon' );
167
 
168
+ $output.= "<a class='delete_button' style='text-decoration:none;' href=" .$nonced_url.">" . esc_html__( 'Delete', 'wp-e-commerce' ) . "</a>";
169
 
170
  $output.='
171
  </td>
177
  function setting_button(){
178
  $next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
179
 
180
+ $output = '';
181
+ $output .= "<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".esc_html__('Settings', 'wp-e-commerce')." &raquo;</a>";
182
+ $output .= "<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
183
+ $output .= "<ul class='settings_button'>";
184
 
185
+ $output .= "<li><a href='admin.php?page=wpsc-settings'>".__('Shop Settings', 'wp-e-commerce')."</a></li>";
186
+ $output .= "<li><a href='admin.php?page=wpsc-settings&amp;tab=gateway'>".__('Money and Payment', 'wp-e-commerce')."</a></li>";
187
+ $output .= "<li><a href='admin.php?page=wpsc-settings&amp;tab=checkout'>".__('Checkout Page Settings', 'wp-e-commerce')."</a></li>";
188
+ $output .= "</ul>";
189
+ $output .= "</span>&emsp;&emsp;</div>";
190
 
191
  return $output;
192
  }
212
  $theme = get_option('wpsc_selected_theme');
213
  ?>
214
  <div class='table'>
215
+ <p class='sub'><?php esc_html_e( 'At a Glance', 'wp-e-commerce' ); ?></p>
216
  <table style='border-top:1px solid #ececec;'>
217
  <tr class='first'>
218
  <td class='first b'>
219
  <?php echo $product_count; ?>
220
  </td>
221
  <td class='t'>
222
+ <?php echo _nx( 'Product', 'Products', $product_count, 'dashboard widget', 'wp-e-commerce' ); ?>
223
  </td>
224
  <td class='b'>
225
  <?php echo $sales_count; ?>
226
  </td>
227
  <td class='last'>
228
+ <?php echo _nx( 'Sale', 'Sales', $sales_count, 'dashboard widget', 'wp-e-commerce' ); ?>
229
  </td>
230
  </tr>
231
  <tr>
233
  <?php echo $group_count; ?>
234
  </td>
235
  <td class='t'>
236
+ <?php echo _nx( 'Category', 'Categories', $group_count, 'dashboard widget', 'wp-e-commerce' ); ?>
237
  </td>
238
  <td class='b'>
239
  <?php echo $pending_sales; ?>
240
  </td>
241
  <td class='last t waiting'>
242
+ <?php echo _n( 'Pending sale', 'Pending sales', $pending_sales, 'wp-e-commerce' ); ?>
243
  </td>
244
  </tr>
245
  <tr>
247
  <?php echo $variation_count; ?>
248
  </td>
249
  <td class='t'>
250
+ <?php echo _nx( 'Variation', 'Variations', $variation_count, 'dashboard widget', 'wp-e-commerce' ); ?>
251
  </td>
252
  <td class='b'>
253
  <?php echo $accept_sales; ?>
254
  </td>
255
  <td class='last t approved'>
256
+ <?php echo _n( 'Closed sale', 'Closed sales', $accept_sales, 'wp-e-commerce'); ?>
257
  </td>
258
  </tr>
259
  </table>
wpsc-admin/admin.php CHANGED
@@ -15,6 +15,7 @@ require_once( WPSC_FILE_PATH . '/wpsc-admin/display-upgrades.page.php' );
15
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/display-items-functions.php' );
16
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-functions.php' );
17
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/save-data.functions.php' );
 
18
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/updating-functions.php' );
19
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-coupons.php' );
20
  require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs.class.php' );
@@ -26,11 +27,8 @@ require_once( WPSC_FILE_PATH . '/wpsc-admin/display-options-settings.page.php' )
26
  require_once( WPSC_FILE_PATH . '/wpsc-admin/db-upgrades/upgrade.php' );
27
  require_once( WPSC_FILE_PATH . '/wpsc-admin/media.php' );
28
 
29
- if ( ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( $_SESSION['wpsc_activate_debug_page'] == true ) ) || ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( constant( 'WPSC_ADD_DEBUG_PAGE' ) == true ) ) )
30
- require_once( WPSC_FILE_PATH . '/wpsc-admin/display-debug.page.php' );
31
-
32
  if ( ! get_option( 'wpsc_checkout_form_sets' ) ) {
33
- $form_sets = array( __( 'Default Checkout Forms', 'wpsc' ) );
34
  update_option( 'wpsc_checkout_form_sets', $form_sets );
35
  }
36
 
@@ -111,6 +109,28 @@ function wpsc_set_screen_option($status, $option, $value){
111
  }
112
  add_filter('set-screen-option', 'wpsc_set_screen_option', 99, 3);
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
116
  * @access public
@@ -194,28 +214,24 @@ function wpsc_admin_pages() {
194
  $page_hooks = array();
195
 
196
  if ( wpsc_show_update_link() ) {
197
- $page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wpsc' ), __( 'Store Update', 'wpsc' ), $store_upgrades_cap, 'wpsc-update', 'wpsc_display_update_page' );
198
  }
199
 
200
- $page_hooks[] = add_submenu_page( 'index.php', __( 'Store Upgrades', 'wpsc' ), __( 'Store Upgrades', 'wpsc' ), $store_upgrades_cap, 'wpsc-upgrades', 'wpsc_display_upgrades_page' );
201
-
202
  $purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', 'administrator' );
203
- $page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), $purchase_logs_cap, 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );
 
 
204
 
205
  // Set the base page for Products
206
  $products_page = 'edit.php?post_type=wpsc-product';
207
 
208
  $manage_coupon_cap = apply_filters( 'wpsc_coupon_cap', 'administrator' );
209
- $page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page , __( 'Coupons', 'wpsc' ), __( 'Coupons', 'wpsc' ), $manage_coupon_cap, 'wpsc-edit-coupons', 'wpsc_display_coupons_page' );
210
 
211
  // Add Settings pages
212
- $page_hooks[] = $edit_options_page = add_options_page( __( 'Store Settings', 'wpsc' ), __( 'Store', 'wpsc' ), 'administrator', 'wpsc-settings', 'wpsc_display_settings_page' );
213
  add_action( 'admin_print_scripts-' . $edit_options_page , 'wpsc_print_admin_scripts' );
214
 
215
- // Debug Page
216
- if ( ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( WPSC_ADD_DEBUG_PAGE == true ) ) || ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( true == $_SESSION['wpsc_activate_debug_page'] ) ) )
217
- $page_hooks[] = add_options_page( __( 'Store Debug', 'wpsc' ), __( 'Store Debug', 'wpsc' ), 'administrator', 'wpsc-debug', 'wpsc_debug_page' );
218
-
219
  $page_hooks = apply_filters( 'wpsc_additional_pages', $page_hooks, $products_page );
220
 
221
  do_action( 'wpsc_add_submenu' );
@@ -245,8 +261,8 @@ function wpsc_admin_pages() {
245
 
246
  // Some updating code is run from here, is as good a place as any, and better than some
247
  if ( ( null == get_option( 'wpsc_trackingid_subject' ) ) && ( null == get_option( 'wpsc_trackingid_message' ) ) ) {
248
- update_option( 'wpsc_trackingid_subject', __( 'Product Tracking Email', 'wpsc' ) );
249
- update_option( 'wpsc_trackingid_message', __( "Track & Trace means you may track the progress of your parcel with our online parcel tracker, just login to our website and enter the following Tracking ID to view the status of your order.\n\nTracking ID: %trackid%\n", 'wpsc' ) );
250
  }
251
 
252
  add_action( 'load-' . $edit_options_page, 'wpsc_load_settings_page', 1 );
@@ -284,68 +300,68 @@ function wpsc_add_help_tabs() {
284
  $tabs = array(
285
  // Store Settings Page
286
  'settings_page_wpsc-settings' => array(
287
- 'title' => _x( 'Store Settings', 'contextual help tab', 'wpsc' ),
288
  'links' => array(
289
- 'category/configuring-your-store/store-settings/' => _x( 'Store Settings Overview' , 'contextual help link', 'wpsc' ),
290
- 'category/configuring-your-store/payment-gateways/' => _x( 'Configuring Your Payment Gateways', 'contextual help link', 'wpsc' ),
291
- 'category/configuring-your-store/shipping/' => _x( 'Configuring Your Shipping Modules', 'contextual help link', 'wpsc' ),
292
  ),
293
  ),
294
 
295
  // Sales Log Page
296
  'dashboard_page_wpsc-purchase-logs' => array(
297
- 'title' => _x( 'Sales Log', 'contextual help tab', 'wpsc' ),
298
  'links' => array(
299
- 'documentation/sales/' => _x( 'Monitor and Manage Your Sales', 'contextual help link', 'wpsc' ),
300
  ),
301
  ),
302
 
303
  // Main Products Listing Admin Page (edit.php?post_type=wpsc-product)
304
  'edit-wpsc-product' => array(
305
- 'title' => _x( 'Product Catalog', 'contextual help tab', 'wpsc' ),
306
  'links' => array(
307
- 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wpsc' ),
308
  ),
309
  ),
310
 
311
  // Add and Edit Product Pages
312
  'wpsc-product' => array(
313
- 'title' => _x( 'Add and Edit Product', 'contextual help tab', 'wpsc' ),
314
  'links' => array(
315
- 'category/managing-your-store/' => _x( 'Managing Your Store' , 'contextual help link', 'wpsc' ),
316
- 'resource/video-adding-products/' => _x( 'Video: Adding Products', 'contextual help link', 'wpsc' ),
317
  ),
318
  ),
319
 
320
  // Product Tags Page
321
  'edit-product_tag' => array(
322
- 'title' => _x( 'Product Tags', 'contextual help tab', 'wpsc' ),
323
  'links' =>array(
324
- 'resource/video-product-tags/' => _x( 'Video: Product Tags', 'contextual help link', 'wpsc' ),
325
  ),
326
  ),
327
 
328
  // Product Category Page
329
  'edit-wpsc_product_category' => array(
330
- 'title' => _x( 'Product Categories', 'contextual help tab', 'wpsc' ),
331
  'links' => array(
332
- 'resource/video-creating-product-categories/' => _x( 'Video: Creating Product Categories', 'contextual help link', 'wpsc' ),
333
  ),
334
  ),
335
 
336
  // Product Variations Page
337
  'edit-wpsc-variation' => array(
338
- 'title' => _x( 'Product Variations', 'contextual help tab', 'wpsc' ),
339
  'links' => array(
340
- 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wpsc' ),
341
  ),
342
  ),
343
 
344
  // Coupon Page
345
  'wpsc-product_page_wpsc-edit-coupons' => array(
346
- 'title' => _x( 'Coupons', 'contextual help tab', 'wpsc' ),
347
  'links' => array(
348
- 'resource/video-creating-coupons/' => _x( 'Video: Creating Coupons', 'contextual help link', 'wpsc' ),
349
  ),
350
  ),
351
  );
@@ -353,7 +369,7 @@ function wpsc_add_help_tabs() {
353
  $screen = get_current_screen();
354
  if ( array_key_exists( $screen->id, $tabs ) ) {
355
  $tab = $tabs[$screen->id];
356
- $content = '<p><strong>' . __( 'For More Information', 'wpsc' ) . '</strong></p>';
357
  $links = array();
358
  foreach( $tab['links'] as $link => $link_title ) {
359
  $link = 'http://docs.wpecommerce.org/' . $link;
@@ -382,7 +398,7 @@ function wpsc_add_purchase_logs_screen_option(){
382
 
383
  // setup Screen Option for purchase logs per page
384
  add_screen_option( 'per_page', array(
385
- 'label' => __("Sales Orders", 'wpsc'),
386
  'default' => 20,
387
  'option' => 'wpsc_purchases_per_page'
388
  ) );
@@ -406,8 +422,8 @@ function wpsc_admin_include_purchase_logs_css_and_js() {
406
  'change_purchase_log_status_nonce' => _wpsc_create_ajax_nonce( 'change_purchase_log_status' ),
407
  'purchase_log_save_tracking_id_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_save_tracking_id' ),
408
  'purchase_log_send_tracking_email_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_send_tracking_email' ),
409
- 'sending_message' => _x( 'sending...', 'sending tracking email for purchase log', 'wpsc' ),
410
- 'sent_message' => _x( 'Email Sent!', 'sending tracking email for purchase log', 'wpsc' ),
411
  'current_view' => empty( $_REQUEST['status'] ) ? 'all' : $_REQUEST['status'],
412
  'current_filter' => empty( $_REQUEST['m'] ) ? '' : $_REQUEST['m'],
413
  'current_page' => empty( $_REQUEST['paged'] ) ? '' : $_REQUEST['paged'],
@@ -461,7 +477,7 @@ function wpsc_display_purchase_logs_page() {
461
  * @uses admin_url() Retrieves URL to the WordPress admin
462
  */
463
  function wpsc_product_log_rss_feed() {
464
- echo "<link type='application/rss+xml' href='" . add_query_arg( array( 'rss' => 'true', 'rss_key' => 'key', 'action' => 'purchase_log', 'type' => 'rss' ), admin_url( 'index.php' ) ) . "' title='" . esc_attr__( 'WP eCommerce Purchase Log RSS', 'wpsc' ) . "' rel='alternate' />";
465
  }
466
 
467
  /**
@@ -519,11 +535,11 @@ function wpsc_admin_include_optionspage_css_and_js() {
519
  'update_checkout_fields_order_nonce' => _wpsc_create_ajax_nonce( 'update_checkout_fields_order' ),
520
  'add_tax_rate_nonce' => _wpsc_create_ajax_nonce( 'add_tax_rate' ),
521
  'current_tab' => WPSC_Settings_Page::get_instance()->get_current_tab_id(),
522
- 'before_unload_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wpsc' ),
523
- 'ajax_navigate_confirm_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wpsc' ) . "\n\n" . __( 'Click OK to discard your changes, or Cancel to remain on this page.' ),
524
- 'edit_field_options' => __( 'Edit Options', 'wpsc' ),
525
- 'hide_edit_field_options' => __( 'Hide Options', 'wpsc' ),
526
- 'delete_form_set_confirm' => __( 'Are you sure you want to delete %s? Submitted data of this form set will also be removed from sales logs.', 'wpsc' ),
527
  ) );
528
 
529
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
@@ -543,17 +559,17 @@ function wpsc_meta_boxes() {
543
 
544
  //if a variation page do not show these metaboxes
545
  if ( is_object( $post ) && $post->post_parent == 0 ) {
546
- add_meta_box( 'wpsc_product_variation_forms' , __( 'Variations', 'wpsc' ) , 'wpsc_product_variation_forms' , $pagename, 'normal', 'high' );
547
  } else if( is_object( $post ) && $post->post_status == "inherit" ) {
548
  remove_meta_box( 'tagsdiv-product_tag' , 'wpsc-product', 'core' );
549
  remove_meta_box( 'wpsc_product_categorydiv' , 'wpsc-product', 'core' );
550
  }
551
 
552
- add_meta_box( 'wpsc_price_control_forms', __('Product Pricing', 'wpsc'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
553
- add_meta_box( 'wpsc_stock_control_forms', __('Stock Inventory', 'wpsc'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
554
- add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wpsc'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
555
- add_meta_box( 'wpsc_product_delivery_forms', __('Product Delivery', 'wpsc'), 'wpsc_product_delivery_forms', $pagename, 'normal', 'high' );
556
- add_meta_box( 'wpsc_product_details_forms', __('Product Details', 'wpsc'), 'wpsc_product_details_forms', $pagename, 'normal', 'high' );
557
  }
558
 
559
  add_action( 'admin_footer', 'wpsc_meta_boxes' );
@@ -606,7 +622,7 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
606
  'wp-e-commerce-variations', // handle
607
  'WPSC_Variations', // variable name
608
  array( // args
609
- 'thickbox_title' => __( 'Add Media - %s', 'wpsc' ),
610
  )
611
  );
612
  }
@@ -620,19 +636,19 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
620
  'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
621
  'save_product_order_nonce' => _wpsc_create_ajax_nonce( 'save_product_order' ),
622
  'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};',
623
- 'empty_coupon' => esc_html__( 'Please enter a coupon code.', 'wpsc' ),
624
- 'bulk_edit_no_vars' => esc_html__( 'Quick Edit options are limited when editing products that have variations. You will need to edit the variations themselves.', 'wpsc' ),
625
  'wpsc_core_images_url' => WPSC_CORE_IMAGES_URL,
626
- 'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wpsc' ),
627
  /* translators : This string is prepended to the 'New Variation Set' string */
628
- 'variation_helper_text' => esc_html_x( 'Choose the Variation Set you want to add variants to. If you\'re creating a new variation set then select', 'Variation helper text', 'wpsc' ),
629
- 'variations_tutorial' => esc_html__( 'Variations allow you to create options for your products. For example, if you\'re selling T-Shirts, they will generally have a "Size" option. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by dragging and dropping them within their Variation Set.', 'wpsc' ),
630
  /* translators : These strings are dynamically inserted as a drop-down for the Coupon comparison conditions */
631
- 'coupons_compare_or' => esc_html_x( 'OR' , 'Coupon comparison logic', 'wpsc' ),
632
- 'coupons_compare_and' => esc_html_x( 'AND' , 'Coupon comparison logic', 'wpsc' ),
633
- 'meta_downloads_plural' => __( ' downloads', 'live preview for downloads metabox', 'wpsc' ),
634
- 'meta_downloads_singular' => __( ' download' , 'live preview for downloads metabox', 'wpsc' ),
635
- 'wpsc_inline_css_error' => __( 'It is not possible to enable the inline CSS without also enabling the common CSS.' )
636
  ) );
637
 
638
  $_wpsc_admin_l10n_loaded = true;
@@ -658,10 +674,10 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
658
  wp_dequeue_script( 'set-post-thumbnail' );
659
  wp_enqueue_script( 'wpsc-set-post-thumbnail', WPSC_URL . '/wpsc-admin/js/set-post-thumbnail.js', array( 'jquery', 'wp-e-commerce-admin' ), $version_identifier );
660
  wp_localize_script( 'wpsc-set-post-thumbnail', 'WPSC_Set_Post_Thumbnail', array(
661
- 'link_text' => __( 'Use as Product Thumbnail', 'wpsc' ),
662
- 'saving' => __( 'Saving...' ),
663
- 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
664
- 'done' => __( 'Done' ),
665
  'nonce' => _wpsc_create_ajax_nonce( 'set_variation_product_thumbnail' ),
666
  ) );
667
  }
@@ -700,7 +716,7 @@ function _wpsc_admin_localizations( $localizations ) {
700
  $form_types .= '<option value="' . $form_type . '">' . $form_type . '</option>';
701
  }
702
 
703
- $unique_names = '<option value="-1">' . __( 'Select a Unique Name', 'wpsc' ) . '</option>';
704
  foreach ( $unique_names_option as $unique_name ) {
705
  $unique_names .= '<option value="' . $unique_name . '">' . $unique_name . '</option>';
706
  }
@@ -708,27 +724,27 @@ function _wpsc_admin_localizations( $localizations ) {
708
  $localizations['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
709
  $localizations['hidden_boxes'] = '"' . esc_js( $hidden_boxes ) . '"';
710
  $localizations['IS_WP27'] = '"' . esc_js( IS_WP27 ) . '"';
711
- $localizations['TXT_WPSC_DELETE'] = '"' . esc_js( __( 'Delete', 'wpsc' ) ) . '"';
712
- $localizations['TXT_WPSC_TEXT'] = '"' . esc_js( __( 'Text', 'wpsc' ) ) . '"';
713
- $localizations['TXT_WPSC_EMAIL'] = '"' . esc_js( __( 'Email', 'wpsc' ) ) . '"';
714
- $localizations['TXT_WPSC_COUNTRY'] = '"' . esc_js( __( 'Country', 'wpsc' ) ) . '"';
715
- $localizations['TXT_WPSC_TEXTAREA'] = '"' . esc_js( __( 'Textarea', 'wpsc' ) ) . '"';
716
- $localizations['TXT_WPSC_HEADING'] = '"' . esc_js( __( 'Heading', 'wpsc' ) ) . '"';
717
- $localizations['TXT_WPSC_COUPON'] = '"' . esc_js( __( 'Coupon', 'wpsc' ) ) . '"';
718
 
719
  $localizations['HTML_FORM_FIELD_TYPES'] = '"' . esc_js( $form_types ) . '"';
720
  $localizations['HTML_FORM_FIELD_UNIQUE_NAMES'] = '"' . esc_js( $unique_names ) . '"';
721
 
722
- $localizations['TXT_WPSC_LABEL'] = '"' . esc_js( __( 'Label', 'wpsc' ) ) . '"';
723
- $localizations['TXT_WPSC_LABEL_DESC'] = '"' . esc_js( __( 'Label Description', 'wpsc' ) ) . '"';
724
- $localizations['TXT_WPSC_ITEM_NUMBER'] = '"' . esc_js( __( 'Item Number', 'wpsc' ) ) . '"';
725
- $localizations['TXT_WPSC_LIFE_NUMBER'] = '"' . esc_js( __( 'Life Number', 'wpsc' ) ) . '"';
726
- $localizations['TXT_WPSC_PRODUCT_CODE'] = '"' . esc_js( __( 'Product Code', 'wpsc' ) ) . '"';
727
- $localizations['TXT_WPSC_PDF'] = '"' . esc_js( __( 'PDF', 'wpsc' ) ) . '"';
728
 
729
- $localizations['TXT_WPSC_AND_ABOVE'] = '"' . esc_js( __( ' and above', 'wpsc' ) ) . '"';
730
- $localizations['TXT_WPSC_IF_PRICE_IS'] = '"' . esc_js( __( 'If price is ', 'wpsc' ) ) . '"';
731
- $localizations['TXT_WPSC_IF_WEIGHT_IS'] = '"' . esc_js( __( 'If weight is ', 'wpsc' ) ) . '"';
732
 
733
  // we only want to add these localizations once, it should happen on the first admin script load
734
  remove_filter( 'wpsc_javascript_localizations', '_wpsc_admin_localizations', 1 );
@@ -770,7 +786,7 @@ function wpsc_admin_latest_activity() {
770
  * This is the right hand side for the past 30 days revenue on the wp dashboard
771
  */
772
  echo "<div id='leftDashboard'>";
773
- echo "<strong class='dashboardHeading'>" . esc_html__( 'Current Month', 'wpsc' ) . "</strong><br />";
774
  echo "<p class='dashboardWidgetSpecial'>";
775
  // calculates total amount of orders for the month
776
  $year = date( "Y" );
@@ -783,13 +799,13 @@ function wpsc_admin_latest_activity() {
783
  //calculates amount of money made for the month
784
  $currentMonthsSales = wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) );
785
  echo $currentMonthsSales;
786
- echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
787
  echo "</p>";
788
  echo "<p class='dashboardWidgetSpecial'>";
789
  echo "<span class='pricedisplay'>";
790
  echo $currentMonthOrders;
791
  echo "</span>";
792
- echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $currentMonthOrders, 'wpsc' ) . "</span>";
793
  echo "</p>";
794
  echo "<p class='dashboardWidgetSpecial'>";
795
  //calculates average sales amount per order for the month
@@ -798,7 +814,7 @@ function wpsc_admin_latest_activity() {
798
  echo wpsc_currency_display( $monthsAverage );
799
  }
800
  //echo "</span>";
801
- echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wpsc' ) . "</span>";
802
  echo "</p>";
803
  echo "</div>";
804
  /*
@@ -806,17 +822,17 @@ function wpsc_admin_latest_activity() {
806
  */
807
 
808
  echo "<div id='rightDashboard' >";
809
- echo "<strong class='dashboardHeading'>" . esc_html__( 'Total Income', 'wpsc' ) . "</strong><br />";
810
 
811
  echo "<p class='dashboardWidgetSpecial'>";
812
  echo wpsc_currency_display( admin_display_total_price() );
813
- echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
814
  echo "</p>";
815
  echo "<p class='dashboardWidgetSpecial'>";
816
  echo "<span class='pricedisplay'>";
817
  echo $totalOrders;
818
  echo "</span>";
819
- echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $totalOrders, 'wpsc' ) . "</span>";
820
  echo "</p>";
821
  echo "<p class='dashboardWidgetSpecial'>";
822
  //calculates average sales amount per order for the month
@@ -827,7 +843,7 @@ function wpsc_admin_latest_activity() {
827
  }
828
  echo wpsc_currency_display( $totalAverage );
829
  //echo "</span>";
830
- echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wpsc' ) . "</span>";
831
  echo "</p>";
832
  echo "</div>";
833
  echo "<div style='clear:both'></div>";
@@ -858,13 +874,13 @@ function wpsc_dashboard_widget_setup() {
858
 
859
  // Add the dashboard widgets
860
  if ( current_user_can( $news_cap ) )
861
- wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'WP eCommerce News' , 'wpsc' ), 'wpsc_dashboard_news' );
862
  if ( current_user_can( $sales_cap ) )
863
- wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
864
  if ( current_user_can( $quarterly_sales_cap ) )
865
- wp_add_dashboard_widget( 'wpsc_quarterly_dashboard_widget', __( 'Sales by Quarter', 'wpsc' ), 'wpsc_quarterly_dashboard_widget' );
866
  if ( current_user_can( $monthly_sales_cap ) )
867
- wp_add_dashboard_widget( 'wpsc_dashboard_4months_widget', __( 'Sales by Month', 'wpsc' ), 'wpsc_dashboard_4months_widget' );
868
 
869
  // Sort the Dashboard widgets so ours it at the top
870
  global $wp_meta_boxes;
@@ -934,6 +950,7 @@ function wpsc_get_quarterly_summary() {
934
  $fourthquarter = (int)get_option( 'wpsc_fourth_quart' );
935
  $finalquarter = (int)get_option( 'wpsc_final_quart' );
936
 
 
937
  $results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
938
  $results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
939
  $results[] = admin_display_total_price( $firstquarter + 1, $secondquarter );
@@ -951,7 +968,7 @@ function wpsc_quarterly_dashboard_widget() {
951
  if ( get_option( 'wpsc_business_year_start' ) == false ) {
952
  ?>
953
  <form action='' method='post'>
954
- <label for='date_start'><?php esc_html_e( 'Financial Year End' , 'wpsc' ); ?>: </label>
955
  <input id='date_start' type='text' class='pickdate' size='11' value='<?php echo get_option( 'wpsc_last_date' ); ?>' name='add_start' />
956
  <!--<select name='add_start[day]'>
957
  <?php
@@ -1008,8 +1025,8 @@ function wpsc_quarterly_dashboard_widget() {
1008
  ?>
1009
  <div id='box'>
1010
  <p class='atglance'>
1011
- <span class='wpsc_quart_left'><?php esc_html_e( 'At a Glance' , 'wpsc' ); ?></span>
1012
- <span class='wpsc_quart_right'><?php esc_html_e( 'Revenue' , 'wpsc' ); ?></span>
1013
  </p>
1014
  <div style='clear:both'></div>
1015
  <p class='quarterly'>
@@ -1062,6 +1079,7 @@ function wpsc_dashboard_4months_widget() {
1062
  $this_year = date( "Y" ); //get current year and month
1063
  $this_month = date( "n" );
1064
 
 
1065
  $months[] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //generate unix time stamps fo 4 last months
1066
  $months[] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1067
  $months[] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
@@ -1078,6 +1096,7 @@ function wpsc_dashboard_4months_widget() {
1078
  ORDER BY SUM(`cart`.`price` * `cart`.`quantity`) DESC
1079
  LIMIT 4", ARRAY_A ); //get 4 products with top income in 4 last months.
1080
 
 
1081
  $timeranges[0]["start"] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //make array of time ranges
1082
  $timeranges[0]["end"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1083
  $timeranges[1]["start"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
@@ -1112,10 +1131,10 @@ function wpsc_dashboard_4months_widget() {
1112
  $tablerow = 1;
1113
  ob_start();
1114
  ?>
1115
- <div style="padding-bottom:15px; "><?php esc_html_e( 'Last four months of sales on a per product basis:', 'wpsc' ); ?></div>
1116
  <table style="width:100%" border="0" cellspacing="0">
1117
  <tr style="font-style:italic; color:#666;" height="20">
1118
- <td colspan="2" style=" font-family:\'Times New Roman\', Times, serif; font-size:15px; border-bottom:solid 1px #000;"><?php esc_html_e( 'At a Glance', 'wpsc' ); ?></td>
1119
  <?php foreach ( $months as $mnth ): ?>
1120
  <td align="center" style=" font-family:\'Times New Roman\'; font-size:15px; border-bottom:solid 1px #000;"><?php echo date( "M", $mnth ); ?></td>
1121
  <?php endforeach; ?>
@@ -1200,7 +1219,7 @@ function wpsc_ajax_ie_save() {
1200
  $product_post_type = get_post_type_object( 'wpsc-product' );
1201
 
1202
  if ( !current_user_can( $product_post_type->cap->edit_posts ) ) {
1203
- echo '({"error":"' . __( 'Error: you don\'t have required permissions to edit this product', 'wpsc' ) . '", "id": "'. esc_js( $_POST['id'] ) .'"})';
1204
  die();
1205
  }
1206
 
@@ -1238,14 +1257,14 @@ function wpsc_ajax_ie_save() {
1238
  $price = get_product_meta( $id, 'price', true );
1239
  $special_price = get_product_meta( $id, 'special_price', true );
1240
  $sku = get_product_meta( $id, 'sku', true );
1241
- $sku = ( $sku )?$sku:__('N/A', 'wpsc');
1242
  $stock = get_product_meta( $id, 'stock', true );
1243
- $stock = ( $stock === '' )?__('N/A', 'wpsc'):$stock;
1244
  $results = array( 'id' => $id, 'title' => $post->post_title, 'weight' => wpsc_convert_weight($meta['weight'], 'pound', $parent_meta['weight_unit']), 'price' => wpsc_currency_display( $price ), 'special_price' => wpsc_currency_display( $special_price ), 'sku' => $sku, 'stock' => $stock );
1245
  echo '(' . json_encode( $results ) . ')';
1246
  die();
1247
  } else {
1248
- echo '({"error":"' . __( 'Error updating product', 'wpsc' ) . '", "id": "'. esc_js( $_POST['id'] ) .'"})';
1249
  }
1250
  die();
1251
  }
@@ -1256,7 +1275,7 @@ function wpsc_ajax_ie_save() {
1256
  * @uses add_meta_box Allows addition of metaboxes to the wpsc_add_meta_boxes admin
1257
  */
1258
  function wpsc_add_meta_boxes(){
1259
- add_meta_box( 'dashboard_right_now', __( 'Current Month', 'wpsc' ), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
1260
  }
1261
 
1262
  /**
@@ -1281,15 +1300,15 @@ function _wpsc_action_admin_notices_deprecated_countries_notice() {
1281
 
1282
  switch ( $base_country ) {
1283
  case 'YU':
1284
- $message = __( 'Yugoslavia is no longer a valid official country name according to <a href="%1$s">ISO 3166</a> while both Serbia and Montenegro have been added to the country list.<br /> As a result, we highly recommend changing your <em>Base Country</em> to reflect this change on the <a href="%2$s">General Settings</a> page.', 'wpsc' );
1285
  break;
1286
  case 'UK':
1287
- $message = __( 'Prior to WP eCommerce 3.8.9, in your database, United Kingdom\'s country code is UK and you have already selected that country code as the base country. However, now that you\'re using WP eCommerce version %3$s, it is recommended that you change your base country to the official "GB" country code, according to <a href="%1$s">ISO 3166</a>.<br /> Please go to <a href="%2$s">General Settings</a> page to make this change.<br />The legacy "UK" item will be marked as "U.K. (legacy)" on the country drop down list. Simply switch to the official "United Kingdom (ISO 3166)" to use the "GB" country code.' , 'wpsc' );
1288
  break;
1289
  case 'AN':
1290
- $message = __( 'Netherlands Antilles is no longer a valid official country name according to <a href="%1$s">ISO 3166</a>.<br />Please consider changing your <em>Base Country</em> to reflect this change on the <a href="%2$s">General Settings</a> page.', 'wpsc' );
1291
  case 'TP':
1292
- $message = __( 'Prior to WP eCommerce 3.8.9, in your database, East Timor\'s country code is TP and you have already selected that country code as the base country. However, now that you\'re using WP eCommerce version %3$s, it is recommended that you change your base country to the official "TL" country code, according to <a href="%1$s">ISO 3166</a>.<br /> Please go to <a href="%2$s">General Settings</a> page to make this change.<br />The legacy "TP" item will be marked as "East Timor (legacy)" on the country drop down list. Simply switch to the official "Timor-Leste (ISO 3166)" to use the "TL" country code.' , 'wpsc' );
1293
  break;
1294
  }
1295
 
@@ -1328,247 +1347,16 @@ function _wpsc_delete_file( $product_id, $file_name ) {
1328
 
1329
  $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_parent = %d AND post_type ='wpsc-product-file'", $file_name, $product_id );
1330
  $product_id_to_delete = $wpdb->get_var( $sql );
1331
- return wp_delete_post( $product_id_to_delete, true );
1332
- }
1333
-
1334
- /**
1335
- * Duplicates a product
1336
- *
1337
- * @uses wp_insert_post() Inserts a new post to the database
1338
- * @uses wpsc_duplicate_taxonomies() Copy the taxonomies of a post to another post
1339
- * @uses wpsc_duplicate_product_meta() Copy the metadata of a post to another post
1340
- * @uses wpsc_duplicate_children() Copy the children of the product
1341
- *
1342
- * @param object $post req The post object
1343
- * @param bool $new_parent_id opt The parent post id
1344
- *
1345
- * @return int|WP_Error New post id or error
1346
- */
1347
- function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
1348
- $new_post_date = $post->post_date;
1349
- $new_post_date_gmt = get_gmt_from_date( $new_post_date );
1350
-
1351
- $new_post_type = $post->post_type;
1352
- $post_content = $post->post_content;
1353
- $post_content_filtered = $post->post_content_filtered;
1354
- $post_excerpt = $post->post_excerpt;
1355
- $post_title = sprintf( __( '%s (Duplicate)', 'wpsc' ), $post->post_title );
1356
- $post_name = $post->post_name;
1357
- $comment_status = $post->comment_status;
1358
- $ping_status = $post->ping_status;
1359
-
1360
- $defaults = array(
1361
- 'post_status' => $post->post_status,
1362
- 'post_type' => $new_post_type,
1363
- 'ping_status' => $ping_status,
1364
- 'post_parent' => $new_parent_id ? $new_parent_id : $post->post_parent,
1365
- 'menu_order' => $post->menu_order,
1366
- 'to_ping' => $post->to_ping,
1367
- 'pinged' => $post->pinged,
1368
- 'post_excerpt' => $post_excerpt,
1369
- 'post_title' => $post_title,
1370
- 'post_content' => $post_content,
1371
- 'post_content_filtered' => $post_content_filtered,
1372
- 'post_mime_type' => $post->post_mime_type,
1373
- 'import_id' => 0
1374
- );
1375
-
1376
- if ( 'attachment' == $post->post_type )
1377
- $defaults['guid'] = $post->guid;
1378
-
1379
- $defaults = stripslashes_deep( $defaults );
1380
-
1381
- // Insert the new template in the post table
1382
- $new_post_id = wp_insert_post($defaults);
1383
-
1384
- // Copy the taxonomies
1385
- wpsc_duplicate_taxonomies( $post->ID, $new_post_id, $post->post_type );
1386
-
1387
- // Copy the meta information
1388
- wpsc_duplicate_product_meta( $post->ID, $new_post_id );
1389
-
1390
- do_action( 'wpsc_duplicate_product', $post, $new_post_id );
1391
-
1392
- // Finds children (Which includes product files AND product images), their meta values, and duplicates them.
1393
- wpsc_duplicate_children( $post->ID, $new_post_id );
1394
-
1395
- return $new_post_id;
1396
- }
1397
 
1398
- /**
1399
- * Copy the taxonomies of a post to another post
1400
- *
1401
- * @uses get_object_taxonomies() Gets taxonomies for the give object
1402
- * @uses wp_get_object_terms() Gets terms for the taxonomies
1403
- * @uses wp_set_object_terms() Sets the terms for a post object
1404
- *
1405
- * @param int $id req ID of the post we are duping
1406
- * @param int $new_id req ID of the new post
1407
- * @param string $post_type req The post type we are setting
1408
- */
1409
- function wpsc_duplicate_taxonomies( $id, $new_id, $post_type ) {
1410
- $taxonomies = get_object_taxonomies( $post_type ); //array("category", "post_tag");
1411
- foreach ( $taxonomies as $taxonomy ) {
1412
- $post_terms = wpsc_get_product_terms( $id, $taxonomy );
1413
- foreach ( $post_terms as $post_term ) {
1414
- wp_set_object_terms( $new_id, $post_term->slug, $taxonomy, true );
1415
- }
1416
- }
1417
- }
1418
-
1419
- /**
1420
- * Copy the meta information of a post to another post
1421
- *
1422
- * @uses $wpdb WordPress database object for queries
1423
- * @uses get_results() Gets generic multirow results from the database
1424
- * @uses prepare() Prepares a database query making it safe
1425
- * @uses query() Runs an SQL query
1426
- *
1427
- * @param int $id req ID of the post we are duping
1428
- * @param int $new_id req ID of the new post
1429
- */
1430
- function wpsc_duplicate_product_meta( $id, $new_id ) {
1431
- global $wpdb;
1432
-
1433
- $post_meta_infos = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $id ) );
1434
-
1435
- if ( count( $post_meta_infos ) ) {
1436
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
1437
- $values = array();
1438
- foreach ( $post_meta_infos as $meta_info ) {
1439
- $meta_key = $meta_info->meta_key;
1440
- $meta_value = addslashes( $meta_info->meta_value );
1441
-
1442
- $sql_query_sel[] = "( $new_id, '$meta_key', '$meta_value' )";
1443
- $values[] = $new_id;
1444
- $values[] = $meta_key;
1445
- $values[] = $meta_value;
1446
- $values += array( $new_id, $meta_key, $meta_value );
1447
- }
1448
- $sql_query.= implode( ",", $sql_query_sel );
1449
- $sql_query = $wpdb->prepare( $sql_query, $values );
1450
- $wpdb->query( $sql_query );
1451
- clean_post_cache( $new_id );
1452
- }
1453
-
1454
- }
1455
-
1456
- /**
1457
- * Duplicates children product and children meta
1458
- *
1459
- * @uses get_posts() Gets an array of posts given array of arguments
1460
- * @uses wpsc_duplicate_product_process() Duplicates product
1461
- *
1462
- * @param int $old_parent_id req Post id for old parent
1463
- * @param int $new_parenc_id req Post id for the new parent
1464
- */
1465
- function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
1466
-
1467
- // Get children products and duplicate them
1468
- $child_posts = get_posts( array(
1469
- 'post_parent' => $old_parent_id,
1470
- 'post_type' => 'any',
1471
- 'post_status' => 'any',
1472
- 'numberposts' => -1,
1473
- 'order' => 'ASC',
1474
- ) );
1475
-
1476
- foreach ( $child_posts as $child_post ) {
1477
-
1478
- // Duplicate product images and child posts
1479
- if ( 'attachment' == get_post_type( $child_post ) ) {
1480
- wpsc_duplicate_product_image_process( $child_post, $new_parent_id );
1481
- } else {
1482
- wpsc_duplicate_product_process( $child_post, $new_parent_id );
1483
- }
1484
-
1485
- do_action( 'wpsc_duplicate_product_child', $child_post, $new_parent_id );
1486
-
1487
- }
1488
-
1489
- }
1490
-
1491
- /**
1492
- * Duplicates a product image.
1493
- *
1494
- * Uses a portion of code from media_sideload_image() in `wp-admin/includes/media.php`
1495
- * to check file before downloading from URL.
1496
- *
1497
- * @since 3.9.0
1498
- *
1499
- * @uses get_post_type() Gets post type.
1500
- * @uses wp_get_attachment_url() Gets attachment URL.
1501
- * @uses download_url() Download file from URl to temp location.
1502
- * @uses is_wp_error() Is WP error?
1503
- * @uses media_handle_sideload() Handle creation of new attachment and attach to post.
1504
- *
1505
- * @param object $post The post object.
1506
- * @param bool $new_parent_id Optional. The parent post id.
1507
- * @return int Attachment ID.
1508
- */
1509
- function wpsc_duplicate_product_image_process( $child_post, $new_parent_id ) {
1510
-
1511
- if ( 'attachment' == get_post_type( $child_post ) && apply_filters( 'wpsc_duplicate_product_attachment', true, $child_post ) ) {
1512
-
1513
- $file = wp_get_attachment_url( $child_post->ID );
1514
-
1515
- if ( ! empty( $file ) ) {
1516
-
1517
- // Set variables for storage, fix file filename for query strings.
1518
- preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
1519
- $file_array = array();
1520
- $file_array['name'] = basename( $matches[0] );
1521
-
1522
- // Download file to temp location.
1523
- $file_array['tmp_name'] = download_url( $file );
1524
-
1525
- // If error storing temporarily, return the error.
1526
- if ( is_wp_error( $file_array['tmp_name'] ) ) {
1527
- return $file_array['tmp_name'];
1528
- }
1529
-
1530
- // Do the validation and storage stuff.
1531
- $id = media_handle_sideload( $file_array, $new_parent_id );
1532
-
1533
- // If error storing permanently, unlink.
1534
- if ( is_wp_error( $id ) ) {
1535
- @unlink( $file_array['tmp_name'] );
1536
- }
1537
-
1538
- // Re-attribute featured image
1539
- if ( has_post_thumbnail( $new_parent_id ) && $child_post->ID == get_post_thumbnail_id( $new_parent_id ) ) {
1540
- set_post_thumbnail( $new_parent_id, $id );
1541
- }
1542
-
1543
- // Copy attachment data
1544
- $post_data = array(
1545
- 'ID' => $id,
1546
- 'post_content' => $child_post->post_content,
1547
- 'post_title' => $child_post->post_title,
1548
- 'post_excerpt' => $child_post->post_excerpt,
1549
- 'post_status' => $child_post->post_status,
1550
- 'comment_status' => $child_post->comment_status,
1551
- 'ping_status' => $child_post->ping_status,
1552
- 'post_password' => $child_post->post_password,
1553
- 'post_content_filtered' => $child_post->post_content_filtered,
1554
- 'menu_order' => $child_post->menu_order
1555
- );
1556
-
1557
- wp_update_post( $post_data );
1558
-
1559
- // Copy alt text
1560
- update_post_meta( $id, '_wp_attachment_image_alt', get_post_meta( $child_post->ID, '_wp_attachment_image_alt', true ) );
1561
-
1562
- return $id;
1563
-
1564
- }
1565
-
1566
- }
1567
 
 
1568
  }
1569
 
1570
  /**
1571
  * @todo docs
 
1572
  * @access private
1573
  *
1574
  * @uses add_query_arg() Adds argument to the WordPress query
@@ -1576,8 +1364,8 @@ function wpsc_duplicate_product_image_process( $child_post, $new_parent_id ) {
1576
  * @uses get_option() Gets option from the database given string
1577
  */
1578
  function _wpsc_admin_notices_3dot8dot9() {
1579
- $message = '<p>' . __( 'You are currently using WP eCommerce 3.8.9. There have been major changes in WP eCommerce 3.8.9, so backward-compatibility with existing plugins might not always be guaranteed. If you are unsure, please roll back to 3.8.8.5, and set up a test site with 3.8.9 to make sure WP eCommerce 3.8.9 is compatible with your existing themes and plugins.<br />If you find any incompatibility issues, please <a href="%1$s">report them to us</a> as well as the other plugins or themes\' developers.' , 'wpsc' ) . '</p>';
1580
- $message .= "\n<p>" . __( '<a href="%2$s">Hide this warning</a>', 'wpsc' ) . '</p>';
1581
  $message = sprintf(
1582
  $message,
1583
  'https://wpecommerce.org/wp-e-commerce-3-8-9-compatibility-issues/',
@@ -1587,12 +1375,6 @@ function _wpsc_admin_notices_3dot8dot9() {
1587
  echo '<div id="wpsc-3.8.9-notice" class="error">' . $message . '</div>';
1588
  }
1589
 
1590
- if ( isset( $_REQUEST['dismiss_389_upgrade_notice'] ) || version_compare( WPSC_VERSION, '3.8.10', '>=' ) )
1591
- update_option( 'wpsc_hide_3.8.9_notices', true );
1592
-
1593
- if ( ! get_option( 'wpsc_hide_3.8.9_notices' ) )
1594
- add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot9' );
1595
-
1596
  /**
1597
  * Checks to ensure that shipping is enabled, and one or both of the shipping/billing states are not displayed.
1598
  * If those condtions are met, and the user has not previously dismissed the notice, then we notify them
@@ -1622,8 +1404,8 @@ function _wpsc_admin_notices_3_8_14_1() {
1622
  settings are correct for your store.<br><br><i>The visibility of the checkout billing and shipping
1623
  drop downs that show states and provinces is now controlled by the "billingstate" and "shippingstate"
1624
  options set in the <b>Store Settings</b> on the <b>Checkout</b> tab. Prior versions used
1625
- the "billingcountry" and "shippingcountry" settings to control the visibility of the drop downs.</i>' , 'wpsc' ) . '</p>';
1626
- $message .= "\n<p>" . __( '<a href="%s">Hide this warning</a>', 'wpsc' ) . '</p>';
1627
  $message = sprintf(
1628
  $message,
1629
  esc_url( add_query_arg( 'dismiss_3_8_14_1_upgrade_notice', 1 ) )
@@ -1632,13 +1414,14 @@ the "billingcountry" and "shippingcountry" settings to control the visibility of
1632
  echo '<div id="wpsc-3-8-14-1-notice" class="error">' . $message . '</div>';
1633
  }
1634
 
1635
- if ( isset( $_REQUEST['dismiss_3_8_14_1_upgrade_notice'] ) || version_compare( WPSC_VERSION, '3.9', '>=' ) ) {
1636
- update_option( 'wpsc_hide_3_8_14_1_notices', true );
1637
- }
1638
-
1639
- if ( ! get_option( 'wpsc_hide_3_8_14_1_notices' ) )
1640
  add_action( 'admin_notices', '_wpsc_admin_notices_3_8_14_1' );
1641
 
 
 
 
 
 
1642
  /**
1643
  * @todo docs
1644
  * @access private
@@ -1648,8 +1431,8 @@ if ( ! get_option( 'wpsc_hide_3_8_14_1_notices' ) )
1648
  * @uses get_option() Gets option from the database given string
1649
  */
1650
  function _wpsc_admin_notices_3dot8dot11() {
1651
- $message = '<p>' . __( 'You are currently using WPeC %1$s. We introduced a regression in WPeC 3.8.10 which affects your customer user account page. We have included a fix for a <a href="%2$s">bug on the User Account management page</a>. We are able to fix this automatically on most sites, but it appears that you have made changes to your wpsc-user-log.php page. For that reason, we have some <a href="%3$s">simple instructions for you to follow</a> to resolve the issue. We are sorry for the inconvenience.' , 'wpsc' ) . '</p>';
1652
- $message .= "\n<p>" . __( '<a href="%4$s">Hide this warning</a>', 'wpsc' ) . '</p>';
1653
  $message = sprintf(
1654
  $message,
1655
  WPSC_VERSION,
@@ -1680,7 +1463,7 @@ function _wpsc_notify_google_checkout_deprecation() {
1680
 
1681
  update_option( 'custom_gateway_options', $gateways );
1682
 
1683
- $message = '<p>' . __( 'Effective November 20th, 2013, Google Checkout was shut down and is no longer processing payments. You are seeing this warning because it appears that Google Checkout was your payment gateway processor. If it was your sole processor, we have enabled the Test Gateway to ensure that orders are coming through on your site, but we highly recommend enabling a proper gateway. If you have no preference, we highly recommend Stripe.' , 'wpsc' ) . '</p>';
1684
 
1685
  echo '<div id="wpsc-3.8.11-notice" class="error">' . $message . '</div>';
1686
  }
@@ -1698,10 +1481,51 @@ if ( in_array( 'google', get_option( 'custom_gateway_options', array() ) ) ) {
1698
  * @return array $links Updated links
1699
  */
1700
  function wpsc_support_links( $links ) {
1701
- $links[] = sprintf( '<a href="%s">%s</a>', _x( 'https://wpecommerce.org/premium-support/', 'Premium Support URL', 'wpsc' ), __( 'Premium Support', 'wpsc' ) );
1702
- $links[] = sprintf( '<a href="%s">%s</a>', _x( 'http://docs.wpecommerce.org/', 'Documentation URL', 'wpsc' ), __( 'Documentation', 'wpsc' ) );
1703
 
1704
  return $links;
1705
  }
1706
 
1707
  add_filter( 'plugin_action_links_' . WPSC_PLUGIN_BASENAME, 'wpsc_support_links' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/display-items-functions.php' );
16
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-functions.php' );
17
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/save-data.functions.php' );
18
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/duplicate-product-class.php' );
19
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/updating-functions.php' );
20
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-coupons.php' );
21
  require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs.class.php' );
27
  require_once( WPSC_FILE_PATH . '/wpsc-admin/db-upgrades/upgrade.php' );
28
  require_once( WPSC_FILE_PATH . '/wpsc-admin/media.php' );
29
 
 
 
 
30
  if ( ! get_option( 'wpsc_checkout_form_sets' ) ) {
31
+ $form_sets = array( __( 'Default Checkout Forms', 'wp-e-commerce' ) );
32
  update_option( 'wpsc_checkout_form_sets', $form_sets );
33
  }
34
 
109
  }
110
  add_filter('set-screen-option', 'wpsc_set_screen_option', 99, 3);
111
 
112
+ /**
113
+ * Limit admin variation dropdown to show variantion sets only.
114
+ *
115
+ * @param array $args Dropdown args.
116
+ * @param string $taxonomy Taxonomy.
117
+ * @param string $context Context.
118
+ *
119
+ * @since 4.0
120
+ *
121
+ * @return array Filtered dropdown args.
122
+ */
123
+ function wpsc_variation_parent_dropdown_args( $args, $taxonomy, $context ) {
124
+
125
+ if ( 'wpsc-variation' == $taxonomy && 'edit' == $context ) {
126
+ $args['depth'] = 1;
127
+ }
128
+
129
+ return $args;
130
+
131
+ }
132
+ add_filter( 'taxonomy_parent_dropdown_args', 'wpsc_variation_parent_dropdown_args', 10, 3 );
133
+
134
  /**
135
  * When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
136
  * @access public
214
  $page_hooks = array();
215
 
216
  if ( wpsc_show_update_link() ) {
217
+ $page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wp-e-commerce' ), __( 'Store Update', 'wp-e-commerce' ), $store_upgrades_cap, 'wpsc-update', 'wpsc_display_update_page' );
218
  }
219
 
 
 
220
  $purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', 'administrator' );
221
+ $page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wp-e-commerce' ), __( 'Store Sales', 'wp-e-commerce' ), $purchase_logs_cap, 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );
222
+
223
+ $page_hooks[] = add_submenu_page( 'index.php', __( 'WPeC License', 'wp-e-commerce' ), __( 'WPeC Licensing', 'wp-e-commerce' ), $store_upgrades_cap, 'wpsc-upgrades', 'wpsc_display_upgrades_page' );
224
 
225
  // Set the base page for Products
226
  $products_page = 'edit.php?post_type=wpsc-product';
227
 
228
  $manage_coupon_cap = apply_filters( 'wpsc_coupon_cap', 'administrator' );
229
+ $page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page , __( 'Coupons', 'wp-e-commerce' ), __( 'Coupons', 'wp-e-commerce' ), $manage_coupon_cap, 'wpsc-edit-coupons', 'wpsc_display_coupons_page' );
230
 
231
  // Add Settings pages
232
+ $page_hooks[] = $edit_options_page = add_options_page( __( 'Store Settings', 'wp-e-commerce' ), __( 'Store', 'wp-e-commerce' ), 'administrator', 'wpsc-settings', 'wpsc_display_settings_page' );
233
  add_action( 'admin_print_scripts-' . $edit_options_page , 'wpsc_print_admin_scripts' );
234
 
 
 
 
 
235
  $page_hooks = apply_filters( 'wpsc_additional_pages', $page_hooks, $products_page );
236
 
237
  do_action( 'wpsc_add_submenu' );
261
 
262
  // Some updating code is run from here, is as good a place as any, and better than some
263
  if ( ( null == get_option( 'wpsc_trackingid_subject' ) ) && ( null == get_option( 'wpsc_trackingid_message' ) ) ) {
264
+ update_option( 'wpsc_trackingid_subject', __( 'Product Tracking Email', 'wp-e-commerce' ) );
265
+ update_option( 'wpsc_trackingid_message', __( "Track & Trace means you may track the progress of your parcel with our online parcel tracker, just login to our website and enter the following Tracking ID to view the status of your order.\n\nTracking ID: %trackid%\n", 'wp-e-commerce' ) );
266
  }
267
 
268
  add_action( 'load-' . $edit_options_page, 'wpsc_load_settings_page', 1 );
300
  $tabs = array(
301
  // Store Settings Page
302
  'settings_page_wpsc-settings' => array(
303
+ 'title' => _x( 'Store Settings', 'contextual help tab', 'wp-e-commerce' ),
304
  'links' => array(
305
+ 'category/configuring-your-store/store-settings/' => _x( 'Store Settings Overview' , 'contextual help link', 'wp-e-commerce' ),
306
+ 'category/configuring-your-store/payment-gateways/' => _x( 'Configuring Your Payment Gateways', 'contextual help link', 'wp-e-commerce' ),
307
+ 'category/configuring-your-store/shipping/' => _x( 'Configuring Your Shipping Modules', 'contextual help link', 'wp-e-commerce' ),
308
  ),
309
  ),
310
 
311
  // Sales Log Page
312
  'dashboard_page_wpsc-purchase-logs' => array(
313
+ 'title' => _x( 'Sales Log', 'contextual help tab', 'wp-e-commerce' ),
314
  'links' => array(
315
+ 'documentation/sales/' => _x( 'Monitor and Manage Your Sales', 'contextual help link', 'wp-e-commerce' ),
316
  ),
317
  ),
318
 
319
  // Main Products Listing Admin Page (edit.php?post_type=wpsc-product)
320
  'edit-wpsc-product' => array(
321
+ 'title' => _x( 'Product Catalog', 'contextual help tab', 'wp-e-commerce' ),
322
  'links' => array(
323
+ 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wp-e-commerce' ),
324
  ),
325
  ),
326
 
327
  // Add and Edit Product Pages
328
  'wpsc-product' => array(
329
+ 'title' => _x( 'Add and Edit Product', 'contextual help tab', 'wp-e-commerce' ),
330
  'links' => array(
331
+ 'category/managing-your-store/' => _x( 'Managing Your Store' , 'contextual help link', 'wp-e-commerce' ),
332
+ 'resource/video-adding-products/' => _x( 'Video: Adding Products', 'contextual help link', 'wp-e-commerce' ),
333
  ),
334
  ),
335
 
336
  // Product Tags Page
337
  'edit-product_tag' => array(
338
+ 'title' => _x( 'Product Tags', 'contextual help tab', 'wp-e-commerce' ),
339
  'links' =>array(
340
+ 'resource/video-product-tags/' => _x( 'Video: Product Tags', 'contextual help link', 'wp-e-commerce' ),
341
  ),
342
  ),
343
 
344
  // Product Category Page
345
  'edit-wpsc_product_category' => array(
346
+ 'title' => _x( 'Product Categories', 'contextual help tab', 'wp-e-commerce' ),
347
  'links' => array(
348
+ 'resource/video-creating-product-categories/' => _x( 'Video: Creating Product Categories', 'contextual help link', 'wp-e-commerce' ),
349
  ),
350
  ),
351
 
352
  // Product Variations Page
353
  'edit-wpsc-variation' => array(
354
+ 'title' => _x( 'Product Variations', 'contextual help tab', 'wp-e-commerce' ),
355
  'links' => array(
356
+ 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wp-e-commerce' ),
357
  ),
358
  ),
359
 
360
  // Coupon Page
361
  'wpsc-product_page_wpsc-edit-coupons' => array(
362
+ 'title' => _x( 'Coupons', 'contextual help tab', 'wp-e-commerce' ),
363
  'links' => array(
364
+ 'resource/video-creating-coupons/' => _x( 'Video: Creating Coupons', 'contextual help link', 'wp-e-commerce' ),
365
  ),
366
  ),
367
  );
369
  $screen = get_current_screen();
370
  if ( array_key_exists( $screen->id, $tabs ) ) {
371
  $tab = $tabs[$screen->id];
372
+ $content = '<p><strong>' . __( 'For More Information', 'wp-e-commerce' ) . '</strong></p>';
373
  $links = array();
374
  foreach( $tab['links'] as $link => $link_title ) {
375
  $link = 'http://docs.wpecommerce.org/' . $link;
398
 
399
  // setup Screen Option for purchase logs per page
400
  add_screen_option( 'per_page', array(
401
+ 'label' => __("Sales Orders", 'wp-e-commerce'),
402
  'default' => 20,
403
  'option' => 'wpsc_purchases_per_page'
404
  ) );
422
  'change_purchase_log_status_nonce' => _wpsc_create_ajax_nonce( 'change_purchase_log_status' ),
423
  'purchase_log_save_tracking_id_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_save_tracking_id' ),
424
  'purchase_log_send_tracking_email_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_send_tracking_email' ),
425
+ 'sending_message' => _x( 'sending...', 'sending tracking email for purchase log', 'wp-e-commerce' ),
426
+ 'sent_message' => _x( 'Email Sent!', 'sending tracking email for purchase log', 'wp-e-commerce' ),
427
  'current_view' => empty( $_REQUEST['status'] ) ? 'all' : $_REQUEST['status'],
428
  'current_filter' => empty( $_REQUEST['m'] ) ? '' : $_REQUEST['m'],
429
  'current_page' => empty( $_REQUEST['paged'] ) ? '' : $_REQUEST['paged'],
477
  * @uses admin_url() Retrieves URL to the WordPress admin
478
  */
479
  function wpsc_product_log_rss_feed() {
480
+ echo "<link type='application/rss+xml' href='" . add_query_arg( array( 'rss' => 'true', 'rss_key' => 'key', 'action' => 'purchase_log', 'type' => 'rss' ), admin_url( 'index.php' ) ) . "' title='" . esc_attr__( 'WP eCommerce Purchase Log RSS', 'wp-e-commerce' ) . "' rel='alternate' />";
481
  }
482
 
483
  /**
535
  'update_checkout_fields_order_nonce' => _wpsc_create_ajax_nonce( 'update_checkout_fields_order' ),
536
  'add_tax_rate_nonce' => _wpsc_create_ajax_nonce( 'add_tax_rate' ),
537
  'current_tab' => WPSC_Settings_Page::get_instance()->get_current_tab_id(),
538
+ 'before_unload_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wp-e-commerce' ),
539
+ 'ajax_navigate_confirm_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wp-e-commerce' ) . "\n\n" . __( 'Click OK to discard your changes, or Cancel to remain on this page.', 'wp-e-commerce' ),
540
+ 'edit_field_options' => __( 'Edit Options', 'wp-e-commerce' ),
541
+ 'hide_edit_field_options' => __( 'Hide Options', 'wp-e-commerce' ),
542
+ 'delete_form_set_confirm' => __( 'Are you sure you want to delete %s? Submitted data of this form set will also be removed from sales logs.', 'wp-e-commerce' ),
543
  ) );
544
 
545
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
559
 
560
  //if a variation page do not show these metaboxes
561
  if ( is_object( $post ) && $post->post_parent == 0 ) {
562
+ add_meta_box( 'wpsc_product_variation_forms' , __( 'Variations', 'wp-e-commerce' ) , 'wpsc_product_variation_forms' , $pagename, 'normal', 'high' );
563
  } else if( is_object( $post ) && $post->post_status == "inherit" ) {
564
  remove_meta_box( 'tagsdiv-product_tag' , 'wpsc-product', 'core' );
565
  remove_meta_box( 'wpsc_product_categorydiv' , 'wpsc-product', 'core' );
566
  }
567
 
568
+ add_meta_box( 'wpsc_price_control_forms', __('Product Pricing', 'wp-e-commerce'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
569
+ add_meta_box( 'wpsc_stock_control_forms', __('Stock Inventory', 'wp-e-commerce'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
570
+ add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wp-e-commerce'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
571
+ add_meta_box( 'wpsc_product_delivery_forms', __('Product Delivery', 'wp-e-commerce'), 'wpsc_product_delivery_forms', $pagename, 'normal', 'high' );
572
+ add_meta_box( 'wpsc_product_details_forms', __('Product Details', 'wp-e-commerce'), 'wpsc_product_details_forms', $pagename, 'normal', 'high' );
573
  }
574
 
575
  add_action( 'admin_footer', 'wpsc_meta_boxes' );
622
  'wp-e-commerce-variations', // handle
623
  'WPSC_Variations', // variable name
624
  array( // args
625
+ 'thickbox_title' => __( 'Add Media - %s', 'wp-e-commerce' ),
626
  )
627
  );
628
  }
636
  'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
637
  'save_product_order_nonce' => _wpsc_create_ajax_nonce( 'save_product_order' ),
638
  'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};',
639
+ 'empty_coupon' => esc_html__( 'Please enter a coupon code.', 'wp-e-commerce' ),
640
+ 'bulk_edit_no_vars' => esc_html__( 'Quick Edit options are limited when editing products that have variations. You will need to edit the variations themselves.', 'wp-e-commerce' ),
641
  'wpsc_core_images_url' => WPSC_CORE_IMAGES_URL,
642
+ 'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wp-e-commerce' ),
643
  /* translators : This string is prepended to the 'New Variation Set' string */
644
+ 'variation_helper_text' => esc_html_x( 'Choose the Variation Set you want to add variants to. If you\'re creating a new variation set, then select', 'Variation helper text', 'wp-e-commerce' ),
645
+ 'variations_tutorial' => esc_html__( 'Variations allow you to create options for your products. For example, if you\'re selling T-Shirts, they will generally have a "Size" option. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by dragging and dropping them within their Variation Set.', 'wp-e-commerce' ),
646
  /* translators : These strings are dynamically inserted as a drop-down for the Coupon comparison conditions */
647
+ 'coupons_compare_or' => esc_html_x( 'OR' , 'Coupon comparison logic', 'wp-e-commerce' ),
648
+ 'coupons_compare_and' => esc_html_x( 'AND' , 'Coupon comparison logic', 'wp-e-commerce' ),
649
+ 'meta_downloads_plural' => _x( ' downloads', 'live preview for downloads metabox', 'wp-e-commerce' ),
650
+ 'meta_downloads_singular' => _x( ' download' , 'live preview for downloads metabox', 'wp-e-commerce' ),
651
+ 'wpsc_inline_css_error' => __( 'It is not possible to change the state of the inline CSS without also changing the common CSS.', 'wp-e-commerce' )
652
  ) );
653
 
654
  $_wpsc_admin_l10n_loaded = true;
674
  wp_dequeue_script( 'set-post-thumbnail' );
675
  wp_enqueue_script( 'wpsc-set-post-thumbnail', WPSC_URL . '/wpsc-admin/js/set-post-thumbnail.js', array( 'jquery', 'wp-e-commerce-admin' ), $version_identifier );
676
  wp_localize_script( 'wpsc-set-post-thumbnail', 'WPSC_Set_Post_Thumbnail', array(
677
+ 'link_text' => __( 'Use as Product Thumbnail', 'wp-e-commerce' ),
678
+ 'saving' => __( 'Saving...', 'wp-e-commerce' ),
679
+ 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.', 'wp-e-commerce' ),
680
+ 'done' => __( 'Done', 'wp-e-commerce' ),
681
  'nonce' => _wpsc_create_ajax_nonce( 'set_variation_product_thumbnail' ),
682
  ) );
683
  }
716
  $form_types .= '<option value="' . $form_type . '">' . $form_type . '</option>';
717
  }
718
 
719
+ $unique_names = '<option value="-1">' . __( 'Select a Unique Name', 'wp-e-commerce' ) . '</option>';
720
  foreach ( $unique_names_option as $unique_name ) {
721
  $unique_names .= '<option value="' . $unique_name . '">' . $unique_name . '</option>';
722
  }
724
  $localizations['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
725
  $localizations['hidden_boxes'] = '"' . esc_js( $hidden_boxes ) . '"';
726
  $localizations['IS_WP27'] = '"' . esc_js( IS_WP27 ) . '"';
727
+ $localizations['TXT_WPSC_DELETE'] = '"' . esc_js( __( 'Delete', 'wp-e-commerce' ) ) . '"';
728
+ $localizations['TXT_WPSC_TEXT'] = '"' . esc_js( __( 'Text', 'wp-e-commerce' ) ) . '"';
729
+ $localizations['TXT_WPSC_EMAIL'] = '"' . esc_js( __( 'Email', 'wp-e-commerce' ) ) . '"';
730
+ $localizations['TXT_WPSC_COUNTRY'] = '"' . esc_js( __( 'Country', 'wp-e-commerce' ) ) . '"';
731
+ $localizations['TXT_WPSC_TEXTAREA'] = '"' . esc_js( __( 'Textarea', 'wp-e-commerce' ) ) . '"';
732
+ $localizations['TXT_WPSC_HEADING'] = '"' . esc_js( __( 'Heading', 'wp-e-commerce' ) ) . '"';
733
+ $localizations['TXT_WPSC_COUPON'] = '"' . esc_js( __( 'Coupon', 'wp-e-commerce' ) ) . '"';
734
 
735
  $localizations['HTML_FORM_FIELD_TYPES'] = '"' . esc_js( $form_types ) . '"';
736
  $localizations['HTML_FORM_FIELD_UNIQUE_NAMES'] = '"' . esc_js( $unique_names ) . '"';
737
 
738
+ $localizations['TXT_WPSC_LABEL'] = '"' . esc_js( __( 'Label', 'wp-e-commerce' ) ) . '"';
739
+ $localizations['TXT_WPSC_LABEL_DESC'] = '"' . esc_js( __( 'Label Description', 'wp-e-commerce' ) ) . '"';
740
+ $localizations['TXT_WPSC_ITEM_NUMBER'] = '"' . esc_js( __( 'Item Number', 'wp-e-commerce' ) ) . '"';
741
+ $localizations['TXT_WPSC_LIFE_NUMBER'] = '"' . esc_js( __( 'Life Number', 'wp-e-commerce' ) ) . '"';
742
+ $localizations['TXT_WPSC_PRODUCT_CODE'] = '"' . esc_js( __( 'Product Code', 'wp-e-commerce' ) ) . '"';
743
+ $localizations['TXT_WPSC_PDF'] = '"' . esc_js( __( 'PDF', 'wp-e-commerce' ) ) . '"';
744
 
745
+ $localizations['TXT_WPSC_AND_ABOVE'] = '"' . esc_js( __( ' and above', 'wp-e-commerce' ) ) . '"';
746
+ $localizations['TXT_WPSC_IF_PRICE_IS'] = '"' . esc_js( __( 'If price is ', 'wp-e-commerce' ) ) . '"';
747
+ $localizations['TXT_WPSC_IF_WEIGHT_IS'] = '"' . esc_js( __( 'If weight is ', 'wp-e-commerce' ) ) . '"';
748
 
749
  // we only want to add these localizations once, it should happen on the first admin script load
750
  remove_filter( 'wpsc_javascript_localizations', '_wpsc_admin_localizations', 1 );
786
  * This is the right hand side for the past 30 days revenue on the wp dashboard
787
  */
788
  echo "<div id='leftDashboard'>";
789
+ echo "<strong class='dashboardHeading'>" . esc_html__( 'Current Month', 'wp-e-commerce' ) . "</strong><br />";
790
  echo "<p class='dashboardWidgetSpecial'>";
791
  // calculates total amount of orders for the month
792
  $year = date( "Y" );
799
  //calculates amount of money made for the month
800
  $currentMonthsSales = wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) );
801
  echo $currentMonthsSales;
802
+ echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wp-e-commerce' ) . "</span>";
803
  echo "</p>";
804
  echo "<p class='dashboardWidgetSpecial'>";
805
  echo "<span class='pricedisplay'>";
806
  echo $currentMonthOrders;
807
  echo "</span>";
808
+ echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $currentMonthOrders, 'wp-e-commerce' ) . "</span>";
809
  echo "</p>";
810
  echo "<p class='dashboardWidgetSpecial'>";
811
  //calculates average sales amount per order for the month
814
  echo wpsc_currency_display( $monthsAverage );
815
  }
816
  //echo "</span>";
817
+ echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wp-e-commerce' ) . "</span>";
818
  echo "</p>";
819
  echo "</div>";
820
  /*
822
  */
823
 
824
  echo "<div id='rightDashboard' >";
825
+ echo "<strong class='dashboardHeading'>" . esc_html__( 'Total Income', 'wp-e-commerce' ) . "</strong><br />";
826
 
827
  echo "<p class='dashboardWidgetSpecial'>";
828
  echo wpsc_currency_display( admin_display_total_price() );
829
+ echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wp-e-commerce' ) . "</span>";
830
  echo "</p>";
831
  echo "<p class='dashboardWidgetSpecial'>";
832
  echo "<span class='pricedisplay'>";
833
  echo $totalOrders;
834
  echo "</span>";
835
+ echo "<span class='dashboardWidget'>" . _n( 'Order', 'Orders', $totalOrders, 'wp-e-commerce' ) . "</span>";
836
  echo "</p>";
837
  echo "<p class='dashboardWidgetSpecial'>";
838
  //calculates average sales amount per order for the month
843
  }
844
  echo wpsc_currency_display( $totalAverage );
845
  //echo "</span>";
846
+ echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wp-e-commerce' ) . "</span>";
847
  echo "</p>";
848
  echo "</div>";
849
  echo "<div style='clear:both'></div>";
874
 
875
  // Add the dashboard widgets
876
  if ( current_user_can( $news_cap ) )
877
+ wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'WP eCommerce News' , 'wp-e-commerce' ), 'wpsc_dashboard_news' );
878
  if ( current_user_can( $sales_cap ) )
879
+ wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wp-e-commerce' ), 'wpsc_dashboard_widget' );
880
  if ( current_user_can( $quarterly_sales_cap ) )
881
+ wp_add_dashboard_widget( 'wpsc_quarterly_dashboard_widget', __( 'Sales by Quarter', 'wp-e-commerce' ), 'wpsc_quarterly_dashboard_widget' );
882
  if ( current_user_can( $monthly_sales_cap ) )
883
+ wp_add_dashboard_widget( 'wpsc_dashboard_4months_widget', __( 'Sales by Month', 'wp-e-commerce' ), 'wpsc_dashboard_4months_widget' );
884
 
885
  // Sort the Dashboard widgets so ours it at the top
886
  global $wp_meta_boxes;
950
  $fourthquarter = (int)get_option( 'wpsc_fourth_quart' );
951
  $finalquarter = (int)get_option( 'wpsc_final_quart' );
952
 
953
+ $results = array();
954
  $results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
955
  $results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
956
  $results[] = admin_display_total_price( $firstquarter + 1, $secondquarter );
968
  if ( get_option( 'wpsc_business_year_start' ) == false ) {
969
  ?>
970
  <form action='' method='post'>
971
+ <label for='date_start'><?php esc_html_e( 'Financial Year End' , 'wp-e-commerce' ); ?>: </label>
972
  <input id='date_start' type='text' class='pickdate' size='11' value='<?php echo get_option( 'wpsc_last_date' ); ?>' name='add_start' />
973
  <!--<select name='add_start[day]'>
974
  <?php
1025
  ?>
1026
  <div id='box'>
1027
  <p class='atglance'>
1028
+ <span class='wpsc_quart_left'><?php esc_html_e( 'At a Glance' , 'wp-e-commerce' ); ?></span>
1029
+ <span class='wpsc_quart_right'><?php esc_html_e( 'Revenue' , 'wp-e-commerce' ); ?></span>
1030
  </p>
1031
  <div style='clear:both'></div>
1032
  <p class='quarterly'>
1079
  $this_year = date( "Y" ); //get current year and month
1080
  $this_month = date( "n" );
1081
 
1082
+ $months = array();
1083
  $months[] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //generate unix time stamps fo 4 last months
1084
  $months[] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1085
  $months[] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
1096
  ORDER BY SUM(`cart`.`price` * `cart`.`quantity`) DESC
1097
  LIMIT 4", ARRAY_A ); //get 4 products with top income in 4 last months.
1098
 
1099
+ $timeranges = array();
1100
  $timeranges[0]["start"] = mktime( 0, 0, 0, $this_month - 3, 1, $this_year ); //make array of time ranges
1101
  $timeranges[0]["end"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1102
  $timeranges[1]["start"] = mktime( 0, 0, 0, $this_month - 2, 1, $this_year );
1131
  $tablerow = 1;
1132
  ob_start();
1133
  ?>
1134
+ <div style="padding-bottom:15px; "><?php esc_html_e( 'Last four months of sales on a per product basis:', 'wp-e-commerce' ); ?></div>
1135
  <table style="width:100%" border="0" cellspacing="0">
1136
  <tr style="font-style:italic; color:#666;" height="20">
1137
+ <td colspan="2" style=" font-family:\'Times New Roman\', Times, serif; font-size:15px; border-bottom:solid 1px #000;"><?php esc_html_e( 'At a Glance', 'wp-e-commerce' ); ?></td>
1138
  <?php foreach ( $months as $mnth ): ?>
1139
  <td align="center" style=" font-family:\'Times New Roman\'; font-size:15px; border-bottom:solid 1px #000;"><?php echo date( "M", $mnth ); ?></td>
1140
  <?php endforeach; ?>
1219
  $product_post_type = get_post_type_object( 'wpsc-product' );
1220
 
1221
  if ( !current_user_can( $product_post_type->cap->edit_posts ) ) {
1222
+ echo '({"error":"' . __( 'Error: you don\'t have required permissions to edit this product', 'wp-e-commerce' ) . '", "id": "'. esc_js( $_POST['id'] ) .'"})';
1223
  die();
1224
  }
1225
 
1257
  $price = get_product_meta( $id, 'price', true );
1258
  $special_price = get_product_meta( $id, 'special_price', true );
1259
  $sku = get_product_meta( $id, 'sku', true );
1260
+ $sku = ( $sku )?$sku:__('N/A', 'wp-e-commerce');
1261
  $stock = get_product_meta( $id, 'stock', true );
1262
+ $stock = ( $stock === '' )?__('N/A', 'wp-e-commerce'):$stock;
1263
  $results = array( 'id' => $id, 'title' => $post->post_title, 'weight' => wpsc_convert_weight($meta['weight'], 'pound', $parent_meta['weight_unit']), 'price' => wpsc_currency_display( $price ), 'special_price' => wpsc_currency_display( $special_price ), 'sku' => $sku, 'stock' => $stock );
1264
  echo '(' . json_encode( $results ) . ')';
1265
  die();
1266
  } else {
1267
+ echo '({"error":"' . __( 'Error updating product', 'wp-e-commerce' ) . '", "id": "'. esc_js( $_POST['id'] ) .'"})';
1268
  }
1269
  die();
1270
  }
1275
  * @uses add_meta_box Allows addition of metaboxes to the wpsc_add_meta_boxes admin
1276
  */
1277
  function wpsc_add_meta_boxes(){
1278
+ add_meta_box( 'dashboard_right_now', __( 'Current Month', 'wp-e-commerce' ), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
1279
  }
1280
 
1281
  /**
1300
 
1301
  switch ( $base_country ) {
1302
  case 'YU':
1303
+ $message = __( 'Yugoslavia is no longer a valid official country name according to <a href="%1$s">ISO 3166</a> while both Serbia and Montenegro have been added to the country list.<br /> As a result, we highly recommend changing your <em>Base Country</em> to reflect this change on the <a href="%2$s">General Settings</a> page.', 'wp-e-commerce' );
1304
  break;
1305
  case 'UK':
1306
+ $message = __( 'Prior to WP eCommerce 3.8.9, in your database, United Kingdom\'s country code is UK and you have already selected that country code as the base country. However, now that you\'re using WP eCommerce version %3$s, it is recommended that you change your base country to the official "GB" country code, according to <a href="%1$s">ISO 3166</a>.<br /> Please go to <a href="%2$s">General Settings</a> page to make this change.<br />The legacy "UK" item will be marked as "U.K. (legacy)" on the country drop down list. Simply switch to the official "United Kingdom (ISO 3166)" to use the "GB" country code.' , 'wp-e-commerce' );
1307
  break;
1308
  case 'AN':
1309
+ $message = __( 'Netherlands Antilles is no longer a valid official country name according to <a href="%1$s">ISO 3166</a>.<br />Please consider changing your <em>Base Country</em> to reflect this change on the <a href="%2$s">General Settings</a> page.', 'wp-e-commerce' );
1310
  case 'TP':
1311
+ $message = __( 'Prior to WP eCommerce 3.8.9, in your database, East Timor\'s country code is TP and you have already selected that country code as the base country. However, now that you\'re using WP eCommerce version %3$s, it is recommended that you change your base country to the official "TL" country code, according to <a href="%1$s">ISO 3166</a>.<br /> Please go to <a href="%2$s">General Settings</a> page to make this change.<br />The legacy "TP" item will be marked as "East Timor (legacy)" on the country drop down list. Simply switch to the official "Timor-Leste (ISO 3166)" to use the "TL" country code.' , 'wp-e-commerce' );
1312
  break;
1313
  }
1314
 
1347
 
1348
  $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_parent = %d AND post_type ='wpsc-product-file'", $file_name, $product_id );
1349
  $product_id_to_delete = $wpdb->get_var( $sql );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1350
 
1351
+ //Delete wpsc_download_status entry for this file
1352
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` WHERE `fileid`=%d AND `product_id` = %d", $product_id_to_delete, $product_id ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1353
 
1354
+ return wp_delete_post( $product_id_to_delete, true );
1355
  }
1356
 
1357
  /**
1358
  * @todo docs
1359
+ *
1360
  * @access private
1361
  *
1362
  * @uses add_query_arg() Adds argument to the WordPress query
1364
  * @uses get_option() Gets option from the database given string
1365
  */
1366
  function _wpsc_admin_notices_3dot8dot9() {
1367
+ $message = '<p>' . __( 'You are currently using WP eCommerce. There have been major changes in WP eCommerce 3.8.9, so backward-compatibility with existing plugins might not always be guaranteed. If you are unsure, please roll back to 3.8.8.5, and set up a test site with 3.8.9 to make sure WP eCommerce 3.8.9 is compatible with your existing themes and plugins.<br />If you find any incompatibility issues, please <a href="%1$s">report them to us</a> as well as the other plugins or themes\' developers.' , 'wp-e-commerce' ) . '</p>';
1368
+ $message .= "\n<p>" . __( '<a href="%2$s">Hide this warning</a>', 'wp-e-commerce' ) . '</p>';
1369
  $message = sprintf(
1370
  $message,
1371
  'https://wpecommerce.org/wp-e-commerce-3-8-9-compatibility-issues/',
1375
  echo '<div id="wpsc-3.8.9-notice" class="error">' . $message . '</div>';
1376
  }
1377
 
 
 
 
 
 
 
1378
  /**
1379
  * Checks to ensure that shipping is enabled, and one or both of the shipping/billing states are not displayed.
1380
  * If those condtions are met, and the user has not previously dismissed the notice, then we notify them
1404
  settings are correct for your store.<br><br><i>The visibility of the checkout billing and shipping
1405
  drop downs that show states and provinces is now controlled by the "billingstate" and "shippingstate"
1406
  options set in the <b>Store Settings</b> on the <b>Checkout</b> tab. Prior versions used
1407
+ the "billingcountry" and "shippingcountry" settings to control the visibility of the drop downs.</i>' , 'wp-e-commerce' ) . '</p>';
1408
+ $message .= "\n<p>" . __( '<a href="%s">Hide this warning</a>', 'wp-e-commerce' ) . '</p>';
1409
  $message = sprintf(
1410
  $message,
1411
  esc_url( add_query_arg( 'dismiss_3_8_14_1_upgrade_notice', 1 ) )
1414
  echo '<div id="wpsc-3-8-14-1-notice" class="error">' . $message . '</div>';
1415
  }
1416
 
1417
+ if ( ! get_option( 'wpsc_hide_3_8_14_1_notices' ) ) {
 
 
 
 
1418
  add_action( 'admin_notices', '_wpsc_admin_notices_3_8_14_1' );
1419
 
1420
+ if ( isset( $_REQUEST['dismiss_3_8_14_1_upgrade_notice'] ) ) {
1421
+ update_option( 'wpsc_hide_3_8_14_1_notices', true );
1422
+ }
1423
+ }
1424
+
1425
  /**
1426
  * @todo docs
1427
  * @access private
1431
  * @uses get_option() Gets option from the database given string
1432
  */
1433
  function _wpsc_admin_notices_3dot8dot11() {
1434
+ $message = '<p>' . __( 'You are currently using WPeC %1$s. We introduced a regression in WPeC 3.8.10 which affects your customer user account page. We have included a fix for a <a href="%2$s">bug on the User Account management page</a>. We are able to fix this automatically on most sites, but it appears that you have made changes to your wpsc-user-log.php page. For that reason, we have some <a href="%3$s">simple instructions for you to follow</a> to resolve the issue. We are sorry for the inconvenience.' , 'wp-e-commerce' ) . '</p>';
1435
+ $message .= "\n<p>" . __( '<a href="%4$s">Hide this warning</a>', 'wp-e-commerce' ) . '</p>';
1436
  $message = sprintf(
1437
  $message,
1438
  WPSC_VERSION,
1463
 
1464
  update_option( 'custom_gateway_options', $gateways );
1465
 
1466
+ $message = '<p>' . __( 'Effective November 20th, 2013, Google Checkout was shut down and is no longer processing payments. You are seeing this warning because it appears that Google Checkout was your payment gateway processor. If it was your sole processor, we have enabled the Test Gateway to ensure that orders are coming through on your site, but we highly recommend enabling a proper gateway. If you have no preference, we highly recommend Stripe.' , 'wp-e-commerce' ) . '</p>';
1467
 
1468
  echo '<div id="wpsc-3.8.11-notice" class="error">' . $message . '</div>';
1469
  }
1481
  * @return array $links Updated links
1482
  */
1483
  function wpsc_support_links( $links ) {
1484
+ $links[] = sprintf( '<a href="%s">%s</a>', _x( 'https://wpecommerce.org/premium-support/', 'Premium Support URL', 'wp-e-commerce' ), __( 'Premium Support', 'wp-e-commerce' ) );
1485
+ $links[] = sprintf( '<a href="%s">%s</a>', _x( 'http://docs.wpecommerce.org/', 'Documentation URL', 'wp-e-commerce' ), __( 'Documentation', 'wp-e-commerce' ) );
1486
 
1487
  return $links;
1488
  }
1489
 
1490
  add_filter( 'plugin_action_links_' . WPSC_PLUGIN_BASENAME, 'wpsc_support_links' );
1491
+
1492
+ /**
1493
+ * Adds removable query args, for compatibility with dismissable notices.
1494
+ *
1495
+ * @param array $args Array of removable query args.
1496
+ *
1497
+ * @since 4.0
1498
+ *
1499
+ * @return array $args Array of removable query args.
1500
+ */
1501
+ function wpsc_removable_query_args( $args ) {
1502
+ $args[] = 'shipping_disabled';
1503
+ return $args;
1504
+ }
1505
+
1506
+ add_filter( 'removable_query_args', 'wpsc_removable_query_args' );
1507
+
1508
+ /**
1509
+ * Modify bulk post messages.
1510
+ *
1511
+ * @param array $bulk_messages Array of bulk messages.
1512
+ * @param int $bulk_counts The amount of messages affected.
1513
+ *
1514
+ * @since 4.0
1515
+ *
1516
+ * @return array Array of bulk messages.
1517
+ */
1518
+ function wpsc_bulk_updated_messages( $bulk_messages, $bulk_counts ) {
1519
+ $bulk_messages['wpsc-product'] = array(
1520
+ 'updated' => _n( '%s product updated.', '%s products updated.', $bulk_counts['updated'], 'wp-e-commerce' ),
1521
+ 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 product not updated, somebody is editing it.', 'wp-e-commerce' ) :
1522
+ _n( '%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $bulk_counts['locked'], 'wp-e-commerce' ),
1523
+ 'deleted' => _n( '%s product permanently deleted.', '%s products permanently deleted.', $bulk_counts['deleted'], 'wp-e-commerce' ),
1524
+ 'trashed' => _n( '%s product moved to the Trash.', '%s products moved to the Trash.', $bulk_counts['trashed'], 'wp-e-commerce' ),
1525
+ 'untrashed' => _n( '%s product restored from the Trash.', '%s products restored from the Trash.', $bulk_counts['untrashed'], 'wp-e-commerce' ),
1526
+ );
1527
+
1528
+ return $bulk_messages;
1529
+ }
1530
+
1531
+ add_filter( 'bulk_post_updated_messages', 'wpsc_bulk_updated_messages', 10, 2 );
wpsc-admin/ajax-and-init.php CHANGED
@@ -25,22 +25,6 @@ function wpsc_admin_ajax() {
25
 
26
  global $wpdb;
27
 
28
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'product-page-order' ) {
29
- $current_order = get_option( 'wpsc_product_page_order' );
30
- $new_order = $_POST['order'];
31
-
32
- if ( isset( $new_order["advanced"] ) ) {
33
- $current_order["advanced"] = array_unique( explode( ',', $new_order["advanced"] ) );
34
- }
35
- if ( isset( $new_order["side"] ) ) {
36
- $current_order["side"] = array_unique( explode( ',', $new_order["side"] ) );
37
- }
38
-
39
- update_option( 'wpsc_product_page_order', $current_order );
40
- exit( print_r( $order, 1 ) );
41
- }
42
-
43
-
44
  if ( isset( $_POST['save_image_upload_state'] ) && $_POST['save_image_upload_state'] == 'true' && is_numeric( $_POST['image_upload_state'] ) ) {
45
  $upload_state = (int)(bool)$_POST['image_upload_state'];
46
  update_option( 'wpsc_use_flash_uploader', $upload_state );
@@ -95,7 +79,8 @@ if ( isset( $_REQUEST['ajax'] ) && isset( $_REQUEST['admin'] ) && ($_REQUEST['aj
95
  add_action( 'admin_init', 'wpsc_admin_ajax' );
96
 
97
  /**
98
- * @todo docs
 
99
  * @uses $wpdb WordPress database object for queries
100
  */
101
  function wpsc_change_currency() {
@@ -104,6 +89,8 @@ function wpsc_change_currency() {
104
  return;
105
  }
106
 
 
 
107
  if ( is_numeric( $_POST['currencyid'] ) ) {
108
  $currency_data = $wpdb->get_results( $wpdb->prepare( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`=%d LIMIT 1", $_POST['currencyid'] ), ARRAY_A );
109
  $price_out = null;
25
 
26
  global $wpdb;
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  if ( isset( $_POST['save_image_upload_state'] ) && $_POST['save_image_upload_state'] == 'true' && is_numeric( $_POST['image_upload_state'] ) ) {
29
  $upload_state = (int)(bool)$_POST['image_upload_state'];
30
  update_option( 'wpsc_use_flash_uploader', $upload_state );
79
  add_action( 'admin_init', 'wpsc_admin_ajax' );
80
 
81
  /**
82
+ * The function that changes the main currency in the DB
83
+ *
84
  * @uses $wpdb WordPress database object for queries
85
  */
86
  function wpsc_change_currency() {
89
  return;
90
  }
91
 
92
+ global $wpdb;
93
+
94
  if ( is_numeric( $_POST['currencyid'] ) ) {
95
  $currency_data = $wpdb->get_results( $wpdb->prepare( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`=%d LIMIT 1", $_POST['currencyid'] ), ARRAY_A );
96
  $price_out = null;
wpsc-admin/ajax.php CHANGED
@@ -31,7 +31,7 @@ function _wpsc_ajax_verify_nonce( $ajax_action ) {
31
  }
32
 
33
  function _wpsc_error_invalid_nonce() {
34
- return new WP_Error( 'wpsc_ajax_invalid_nonce', __( 'Your session has expired. Please refresh the page and try again.', 'wpsc' ) );
35
  }
36
 
37
  /**
@@ -52,7 +52,7 @@ function _wpsc_ajax_fire_callback( $ajax_action ) {
52
  if ( is_callable( $callback ) )
53
  $result = call_user_func( $callback );
54
  else
55
- $result = new WP_Error( 'wpsc_invalid_ajax_callback', __( 'Invalid AJAX callback.', 'wpsc' ) );
56
 
57
  return $result;
58
  }
@@ -74,13 +74,15 @@ function _wpsc_ajax_fire_callback( $ajax_action ) {
74
  function _wpsc_ajax_handler() {
75
  $ajax_action = str_replace( '-', '_', $_REQUEST['wpsc_action'] );
76
 
77
- if ( is_callable( '_wpsc_ajax_verify_' . $ajax_action ) )
78
  $result = call_user_func( '_wpsc_ajax_verify_' . $ajax_action );
79
- else
80
  $result = _wpsc_ajax_verify_nonce( $ajax_action );
 
81
 
82
- if ( ! is_wp_error( $result ) )
83
  $result = _wpsc_ajax_fire_callback( $ajax_action );
 
84
 
85
  $output = array(
86
  'is_successful' => false,
@@ -111,8 +113,9 @@ add_action( 'wp_ajax_wpsc_ajax', '_wpsc_ajax_handler' );
111
  function wpsc_is_doing_ajax( $action = '' ) {
112
  $ajax = defined( 'DOING_AJAX' ) && DOING_AJAX && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'wpsc_ajax';
113
 
114
- if ( $action )
115
  $ajax = $ajax && ! empty( $_REQUEST['wpsc_action'] ) && $action == str_replace( '-', '_', $_REQUEST['wpsc_action'] );
 
116
 
117
  return $ajax;
118
  }
@@ -179,7 +182,7 @@ function _wpsc_ajax_add_variation_set() {
179
  }
180
 
181
  if ( empty( $variation_set_id ) )
182
- return new WP_Error( 'wpsc_invalid_variation_id', __( 'Cannot retrieve the variation set in order to proceed.', 'wpsc' ) );
183
 
184
  foreach ( $variants as $variant ) {
185
  $results = wp_insert_term( apply_filters( 'wpsc_new_variant', $variant, $variation_set_id ), 'wpsc-variation', array( 'parent' => $variation_set_id ) );
@@ -241,6 +244,7 @@ function _wpsc_ajax_add_variation_set() {
241
  * @return array Response args
242
  */
243
  function _wpsc_ajax_payment_gateway_settings_form() {
 
244
  require_once( 'settings-page.php' );
245
  require_once( 'includes/settings-tabs/gateway.php' );
246
 
@@ -350,7 +354,7 @@ function _wpsc_ajax_purchase_log_save_tracking_id() {
350
  );
351
 
352
  if ( ! $result )
353
- return new WP_Error( 'wpsc_cannot_save_tracking_id', __( "Couldn't save tracking ID of the transaction. Please try again.", 'wpsc' ) );
354
 
355
  $return = array(
356
  'rows_affected' => $result,
@@ -397,8 +401,9 @@ function _wpsc_ajax_purchase_log_send_tracking_email() {
397
 
398
  $result = wp_mail( $email, $subject, $message);
399
 
400
- if ( ! $result )
401
- return new WP_Error( 'wpsc_cannot_send_tracking_email', __( "Couldn't send tracking email. Please try again.", 'wpsc' ) );
 
402
 
403
  $return = array(
404
  'id' => $id,
@@ -446,7 +451,7 @@ function _wpsc_ajax_purchase_log_action_link() {
446
 
447
  }
448
 
449
- return new WP_Error( 'wpsc_ajax_invalid_purchase_log_action', __( 'Purchase log action failed.', 'wpsc' ) );
450
 
451
  }
452
 
@@ -511,7 +516,7 @@ function _wpsc_ajax_delete_file() {
511
  $result = _wpsc_delete_file( $product_id, $file_name );
512
 
513
  if ( ! $result )
514
- return new WP_Error( 'wpsc_cannot_delete_file', __( "Couldn't delete the file. Please try again.", 'wpsc' ) );
515
 
516
  $return = array(
517
  'product_id' => $product_id,
@@ -535,7 +540,7 @@ function _wpsc_ajax_delete_file() {
535
  function _wpsc_ajax_remove_product_meta() {
536
  $meta_id = (int) $_POST['meta_id'];
537
  if ( ! delete_meta( $meta_id ) )
538
- return new WP_Error( 'wpsc_cannot_delete_product_meta', __( "Couldn't delete product meta. Please try again.", 'wpsc' ) );
539
 
540
  return array( 'meta_id' => $meta_id );
541
  }
@@ -558,7 +563,7 @@ function _wpsc_ajax_remove_product_meta() {
558
  function _wpsc_ajax_change_purchase_log_status() {
559
  $result = wpsc_purchlog_edit_status( $_POST['id'], $_POST['new_status'] );
560
  if ( ! $result )
561
- return new WP_Error( 'wpsc_cannot_edit_purchase_log_status', __( "Couldn't modify purchase log's status. Please try again.", 'wpsc' ) );
562
 
563
  $args = array();
564
 
@@ -630,7 +635,7 @@ function _wpsc_ajax_save_product_order() {
630
  'failed_ids' => $failed,
631
  );
632
 
633
- return new WP_Error( 'wpsc_cannot_save_product_sort_order', __( "Couldn't save the products' sort order. Please try again.", 'wpsc' ), $error_data );
634
  }
635
 
636
  return array(
@@ -713,7 +718,7 @@ function _wpsc_ajax_update_checkout_fields_order() {
713
  }
714
 
715
  if ( ! empty( $failed ) )
716
- return new WP_Error( 'wpsc_cannot_save_checkout_field_sort_order', __( "Couldn't save checkout field sort order. Please try again.", 'wpsc' ), array( 'failed_ids' => $failed ) );
717
 
718
  return array(
719
  'modified' => $modified,
@@ -790,8 +795,8 @@ function _wpsc_ajax_upload_product_file() {
790
  $output .= '<td style="padding-right: 30px;">' . $attachment['post_title'] . '</td>';
791
  $output .= '<td>' . wpsc_convert_byte( $file_size ) . '</td>';
792
  $output .= '<td>.' . wpsc_get_extension( $attachment['post_title'] ) . '</td>';
793
- $output .= "<td><a data-file-name='" . esc_attr( $attachment['post_title'] ) . "' data-product-id='" . esc_attr( $product_id ) . "' data-nonce='" . esc_attr( $delete_nonce ) . "' class='file_delete_button' href='{$deletion_url}' >" . _x( 'Delete', 'Digital Download UI row', 'wpsc' ) . "</a></td>";
794
- $output .= '<td><a href=' .$file_url .'>' . _x( 'Download', 'Digital Download UI row', 'wpsc' ) . '</a></td>';
795
  $output .= '</tr>';
796
  }
797
 
@@ -924,3 +929,32 @@ function _wpsc_ajax_set_variation_product_thumbnail() {
924
  exit;
925
  }
926
  add_action( 'wp_ajax_wpsc_set_variation_product_thumbnail', '_wpsc_ajax_set_variation_product_thumbnail' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  function _wpsc_error_invalid_nonce() {
34
+ return new WP_Error( 'wpsc_ajax_invalid_nonce', __( 'Your session has expired. Please refresh the page and try again.', 'wp-e-commerce' ) );
35
  }
36
 
37
  /**
52
  if ( is_callable( $callback ) )
53
  $result = call_user_func( $callback );
54
  else
55
+ $result = new WP_Error( 'wpsc_invalid_ajax_callback', __( 'Invalid AJAX callback.', 'wp-e-commerce' ) );
56
 
57
  return $result;
58
  }
74
  function _wpsc_ajax_handler() {
75
  $ajax_action = str_replace( '-', '_', $_REQUEST['wpsc_action'] );
76
 
77
+ if ( is_callable( '_wpsc_ajax_verify_' . $ajax_action ) ) {
78
  $result = call_user_func( '_wpsc_ajax_verify_' . $ajax_action );
79
+ } else {
80
  $result = _wpsc_ajax_verify_nonce( $ajax_action );
81
+ }
82
 
83
+ if ( ! is_wp_error( $result ) ) {
84
  $result = _wpsc_ajax_fire_callback( $ajax_action );
85
+ }
86
 
87
  $output = array(
88
  'is_successful' => false,
113
  function wpsc_is_doing_ajax( $action = '' ) {
114
  $ajax = defined( 'DOING_AJAX' ) && DOING_AJAX && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'wpsc_ajax';
115
 
116
+ if ( $action ) {
117
  $ajax = $ajax && ! empty( $_REQUEST['wpsc_action'] ) && $action == str_replace( '-', '_', $_REQUEST['wpsc_action'] );
118
+ }
119
 
120
  return $ajax;
121
  }
182
  }
183
 
184
  if ( empty( $variation_set_id ) )
185
+ return new WP_Error( 'wpsc_invalid_variation_id', __( 'Cannot retrieve the variation set in order to proceed.', 'wp-e-commerce' ) );
186
 
187
  foreach ( $variants as $variant ) {
188
  $results = wp_insert_term( apply_filters( 'wpsc_new_variant', $variant, $variation_set_id ), 'wpsc-variation', array( 'parent' => $variation_set_id ) );
244
  * @return array Response args
245
  */
246
  function _wpsc_ajax_payment_gateway_settings_form() {
247
+
248
  require_once( 'settings-page.php' );
249
  require_once( 'includes/settings-tabs/gateway.php' );
250
 
354
  );
355
 
356
  if ( ! $result )
357
+ return new WP_Error( 'wpsc_cannot_save_tracking_id', __( "Couldn't save tracking ID of the transaction. Please try again.", 'wp-e-commerce' ) );
358
 
359
  $return = array(
360
  'rows_affected' => $result,
401
 
402
  $result = wp_mail( $email, $subject, $message);
403
 
404
+ if ( ! $result ) {
405
+ return new WP_Error( 'wpsc_cannot_send_tracking_email', __( "Couldn't send tracking email. Please try again.", 'wp-e-commerce' ) );
406
+ }
407
 
408
  $return = array(
409
  'id' => $id,
451
 
452
  }
453
 
454
+ return new WP_Error( 'wpsc_ajax_invalid_purchase_log_action', __( 'Purchase log action failed.', 'wp-e-commerce' ) );
455
 
456
  }
457
 
516
  $result = _wpsc_delete_file( $product_id, $file_name );
517
 
518
  if ( ! $result )
519
+ return new WP_Error( 'wpsc_cannot_delete_file', __( "Couldn't delete the file. Please try again.", 'wp-e-commerce' ) );
520
 
521
  $return = array(
522
  'product_id' => $product_id,
540
  function _wpsc_ajax_remove_product_meta() {
541
  $meta_id = (int) $_POST['meta_id'];
542
  if ( ! delete_meta( $meta_id ) )
543
+ return new WP_Error( 'wpsc_cannot_delete_product_meta', __( "Couldn't delete product meta. Please try again.", 'wp-e-commerce' ) );
544
 
545
  return array( 'meta_id' => $meta_id );
546
  }
563
  function _wpsc_ajax_change_purchase_log_status() {
564
  $result = wpsc_purchlog_edit_status( $_POST['id'], $_POST['new_status'] );
565
  if ( ! $result )
566
+ return new WP_Error( 'wpsc_cannot_edit_purchase_log_status', __( "Couldn't modify purchase log's status. Please try again.", 'wp-e-commerce' ) );
567
 
568
  $args = array();
569
 
635
  'failed_ids' => $failed,
636
  );
637
 
638
+ return new WP_Error( 'wpsc_cannot_save_product_sort_order', __( "Couldn't save the products' sort order. Please try again.", 'wp-e-commerce' ), $error_data );
639
  }
640
 
641
  return array(
718
  }
719
 
720
  if ( ! empty( $failed ) )
721
+ return new WP_Error( 'wpsc_cannot_save_checkout_field_sort_order', __( "Couldn't save checkout field sort order. Please try again.", 'wp-e-commerce' ), array( 'failed_ids' => $failed ) );
722
 
723
  return array(
724
  'modified' => $modified,
795
  $output .= '<td style="padding-right: 30px;">' . $attachment['post_title'] . '</td>';
796
  $output .= '<td>' . wpsc_convert_byte( $file_size ) . '</td>';
797
  $output .= '<td>.' . wpsc_get_extension( $attachment['post_title'] ) . '</td>';
798
+ $output .= "<td><a data-file-name='" . esc_attr( $attachment['post_title'] ) . "' data-product-id='" . esc_attr( $product_id ) . "' data-nonce='" . esc_attr( $delete_nonce ) . "' class='file_delete_button' href='{$deletion_url}' >" . _x( 'Delete', 'Digital Download UI row', 'wp-e-commerce' ) . "</a></td>";
799
+ $output .= '<td><a href=' .$file_url .'>' . _x( 'Download', 'Digital Download UI row', 'wp-e-commerce' ) . '</a></td>';
800
  $output .= '</tr>';
801
  }
802
 
929
  exit;
930
  }
931
  add_action( 'wp_ajax_wpsc_set_variation_product_thumbnail', '_wpsc_ajax_set_variation_product_thumbnail' );
932
+
933
+ /**
934
+ * Delete WPSC product image from gallery
935
+ *
936
+ * @uses check_ajax_referer() Verifies the AJAX request to prevent processing external requests
937
+ * @uses get_post_meta() Returns meta from the specified post
938
+ * @uses update_post_meta() Updates meta from the specified post
939
+ */
940
+ function product_gallery_image_delete_action() {
941
+
942
+ $product_gallery = array();
943
+ $gallery_image_id = $gallery_post_id = '';
944
+
945
+ $gallery_image_id = absint($_POST['product_gallery_image_id']);
946
+ $gallery_post_id = absint($_POST['product_gallery_post_id']);
947
+
948
+ check_ajax_referer( 'wpsc_gallery_nonce', 'wpsc_gallery_nonce_check' );
949
+
950
+ $product_gallery = get_post_meta( $gallery_post_id, '_wpsc_product_gallery', true );
951
+
952
+ foreach ( $product_gallery as $index => $image_id ) {
953
+ if ( $image_id == $gallery_image_id ) {
954
+ unset( $product_gallery[$index] );
955
+ }
956
+ }
957
+
958
+ update_post_meta( $gallery_post_id, '_wpsc_product_gallery', $product_gallery );
959
+ }
960
+ add_action( 'wp_ajax_product_gallery_image_delete', 'product_gallery_image_delete_action' );
wpsc-admin/css/admin.css CHANGED
@@ -468,8 +468,8 @@ table.widefat tbody tr td.product-image img {
468
  .wpsc_delete_currency_layer,
469
  .wpsc-quantity-discounts .remove_line {
470
  color: #bbb;
471
- display: block-inline;
472
- font size: 16px;
473
  line-height: 20px;
474
  margin: 4px 0 0 0;
475
  text-align: center;
@@ -1006,7 +1006,7 @@ a.file_delete_button {
1006
  }
1007
 
1008
  a.delete_button {
1009
- border-color: -moz-use-text-color -moz-use-text-color #FF0000;
1010
  border-style: none none solid;
1011
  border-width: medium medium 1px;
1012
  color: #FF0000;
@@ -1392,34 +1392,33 @@ table.category_forms td.last_row {
1392
  margin: 5px 20px 0 0;
1393
  }
1394
 
1395
- #gold_cart_form .postbox p img {
1396
  padding-bottom: 10px;
1397
  }
1398
 
1399
- #wpsc_gold_options_outside {
1400
  width: 400px;
1401
  }
1402
 
1403
- #gold_cart_form .postbox p {
1404
  padding-left: 4px;
1405
  }
1406
 
1407
- #gold_cart_form .postbox {
1408
  width: 100%;
1409
  max-width: 500px;
1410
  }
1411
 
1412
- #gold_cart_form .postbox p {
1413
  padding-left: 10px;
1414
  }
1415
 
1416
- #gold_cart_form .postbox p label {
1417
  width: 80px;
1418
  float: left;
1419
  }
1420
 
1421
  a.admin_download {
1422
- display: block;
1423
  height: 26px;
1424
  border-bottom: none;
1425
  text-decoration: none;
@@ -1484,11 +1483,6 @@ a.variation_handle {
1484
  display: none;
1485
  }
1486
 
1487
- .meta-box-sortables-wpec .postbox:hover .handlediv {
1488
- background: transparent url(../../wpsc-core/images/menu-bits.gif) no-repeat scroll 0% -111px;
1489
- }
1490
-
1491
-
1492
  /**
1493
  * Marketing / coupon page styling
1494
  */
@@ -2523,3 +2517,22 @@ a.wpsc_remove_meta {
2523
  .branch-3-6 .wpsc-quantity-discounts td.remove a:hover {
2524
  background-position: -10px 0;
2525
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  .wpsc_delete_currency_layer,
469
  .wpsc-quantity-discounts .remove_line {
470
  color: #bbb;
471
+ display: inline-block;
472
+ font-size: 16px;
473
  line-height: 20px;
474
  margin: 4px 0 0 0;
475
  text-align: center;
1006
  }
1007
 
1008
  a.delete_button {
1009
+ border-color: -moz-use-text-color;
1010
  border-style: none none solid;
1011
  border-width: medium medium 1px;
1012
  color: #FF0000;
1392
  margin: 5px 20px 0 0;
1393
  }
1394
 
1395
+ #product_license_box .postbox p img {
1396
  padding-bottom: 10px;
1397
  }
1398
 
1399
+ #product_license_box_outside {
1400
  width: 400px;
1401
  }
1402
 
1403
+ #product_license_box .postbox p {
1404
  padding-left: 4px;
1405
  }
1406
 
1407
+ #product_license_box .postbox {
1408
  width: 100%;
1409
  max-width: 500px;
1410
  }
1411
 
1412
+ #product_license_box .postbox p {
1413
  padding-left: 10px;
1414
  }
1415
 
1416
+ #product_license_box .postbox p label {
1417
  width: 80px;
1418
  float: left;
1419
  }
1420
 
1421
  a.admin_download {
 
1422
  height: 26px;
1423
  border-bottom: none;
1424
  text-decoration: none;
1483
  display: none;
1484
  }
1485
 
 
 
 
 
 
1486
  /**
1487
  * Marketing / coupon page styling
1488
  */
2517
  .branch-3-6 .wpsc-quantity-discounts td.remove a:hover {
2518
  background-position: -10px 0;
2519
  }
2520
+
2521
+ .product_gallery_image_delete_button {
2522
+ display: none;
2523
+ }
2524
+
2525
+ .list_gallery_image {
2526
+ position: relative;
2527
+ }
2528
+
2529
+ .product_gallery_image_delete_button {
2530
+ position: absolute;
2531
+ right: 0;
2532
+ top: 0;
2533
+ font-size: 16px;
2534
+ }
2535
+
2536
+ .product_gallery_image_delete_button:hover {
2537
+ cursor: pointer
2538
+ }
wpsc-admin/css/settingspage.css CHANGED
@@ -453,8 +453,6 @@ table.form-table td .updated.shipwire-update {
453
  }
454
 
455
  /* tax */
456
-
457
-
458
  .wpsc-tax-bands-row, .wpsc-tax-rates-row {
459
  line-height: 3.2;
460
  }
@@ -462,4 +460,13 @@ table.form-table td .updated.shipwire-update {
462
  .wpsc-tax-bands-row.prototype,
463
  .wpsc-tax-rates-row.prototype {
464
  display: none;
 
 
 
 
 
 
 
 
 
465
  }
453
  }
454
 
455
  /* tax */
 
 
456
  .wpsc-tax-bands-row, .wpsc-tax-rates-row {
457
  line-height: 3.2;
458
  }
460
  .wpsc-tax-bands-row.prototype,
461
  .wpsc-tax-rates-row.prototype {
462
  display: none;
463
+ }
464
+
465
+ #wpsc-amazon-payments-secret-key {
466
+ width: 400px;
467
+ }
468
+
469
+ #wpsc-amazon-payments-client_id,
470
+ #wpsc-amazon-payments-ipn {
471
+ width: 500px;
472
  }
wpsc-admin/db-upgrades/routines/1.php CHANGED
@@ -23,9 +23,9 @@ function _wpsc_fix_checkout_field_limitation() {
23
  function _wpsc_fix_mexico_currency_sign() {
24
  $country = new WPSC_Country( array(
25
  'isocode' => 'MX',
26
- 'currency' => __( 'Mexican Peso', 'wpsc' ),
27
- 'symbol' => __( '$', 'wpsc' ),
28
- 'symbol_html' => __( '&#036;', 'wpsc' ),
29
  'has_regions' => '1'
30
  ) );
31
  }
@@ -73,69 +73,69 @@ function _wpsc_fix_canadian_province_codes() {
73
  function _wpsc_fix_colombia_currency() {
74
  $country = new WPSC_Country( array(
75
  'isocode' => 'CO',
76
- 'symbol' => __( '$', 'wpsc' ),
77
- 'symbol_html' => __( '&#036;', 'wpsc' ),
78
  ) );
79
  }
80
 
81
  function _wpsc_fix_ukraine_currency() {
82
  $country = new WPSC_Country( array(
83
  'isocode' => 'UA',
84
- 'code' => __( 'UAH', 'wpsc' ),
85
- 'symbol' => __( '₴', 'wpsc' ),
86
- 'symbol_html' => __( '&#8372;', 'wpsc' ),
87
  ) );
88
  }
89
 
90
  function _wpsc_fix_russia_currency() {
91
  $country = new WPSC_Country( array(
92
  'isocode' => 'RU',
93
- 'code' => __( 'RUB', 'wpsc' )
94
  ) );
95
  }
96
 
97
  function _wpsc_fix_belarus_currency() {
98
- $country = new WPSC_Country( array(
99
  'isocode' => 'BY',
100
- 'code' => __( 'BYR', 'wpsc' )
101
  ) );
102
  }
103
 
104
  function _wpsc_fix_estonia_currency() {
105
  $country = new WPSC_Country( array(
106
  'isocode' => 'EE',
107
- 'currency' => __( 'Euro', 'wpsc' ),
108
- 'symbol' => __( '€', 'wpsc' ),
109
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
110
- 'code' => __( 'EUR', 'wpsc' )
111
  ) );
112
  }
113
 
114
  function _wpsc_fix_slovenia_currency() {
115
  $country = new WPSC_Country( array(
116
  'isocode' => 'SI',
117
- 'currency' => __( 'Euro', 'wpsc' ),
118
- 'symbol' => __( '€', 'wpsc' ),
119
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
120
- 'code' => __( 'EUR', 'wpsc' )
121
  ) );
122
  }
123
 
124
  function _wpsc_fix_sudan_currency() {
125
  $country = new WPSC_Country( array(
126
  'isocode' => 'SD',
127
- 'currency' => __( 'Sudanese Pound', 'wpsc' ),
128
- 'code' => __( 'SDG', 'wpsc' )
129
  ) );
130
  }
131
 
132
  function _wpsc_create_south_sudan() {
133
  $country = new WPSC_Country( array(
134
  'id' => '242',
135
- 'country' => __( 'South Sudan', 'wpsc' ),
136
- 'isocode' => __( 'SS', 'wpsc' ),
137
- 'currency' => __( 'South Sudanese Pound', 'wpsc' ),
138
- 'code' => __( 'SSP', 'wpsc' ),
139
  'continent' => 'africa',
140
  'visible' => 0,
141
  ) );
23
  function _wpsc_fix_mexico_currency_sign() {
24
  $country = new WPSC_Country( array(
25
  'isocode' => 'MX',
26
+ 'currency' => __( 'Mexican Peso', 'wp-e-commerce' ),
27
+ 'symbol' => __( '$', 'wp-e-commerce' ),
28
+ 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
29
  'has_regions' => '1'
30
  ) );
31
  }
73
  function _wpsc_fix_colombia_currency() {
74
  $country = new WPSC_Country( array(
75
  'isocode' => 'CO',
76
+ 'symbol' => __( '$', 'wp-e-commerce' ),
77
+ 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
78
  ) );
79
  }
80
 
81
  function _wpsc_fix_ukraine_currency() {
82
  $country = new WPSC_Country( array(
83
  'isocode' => 'UA',
84
+ 'code' => __( 'UAH', 'wp-e-commerce' ),
85
+ 'symbol' => __( '₴', 'wp-e-commerce' ),
86
+ 'symbol_html' => __( '&#8372;', 'wp-e-commerce' ),
87
  ) );
88
  }
89
 
90
  function _wpsc_fix_russia_currency() {
91
  $country = new WPSC_Country( array(
92
  'isocode' => 'RU',
93
+ 'code' => __( 'RUB', 'wp-e-commerce' )
94
  ) );
95
  }
96
 
97
  function _wpsc_fix_belarus_currency() {
98
+ $country = new WPSC_Country( array(
99
  'isocode' => 'BY',
100
+ 'code' => __( 'BYR', 'wp-e-commerce' )
101
  ) );
102
  }
103
 
104
  function _wpsc_fix_estonia_currency() {
105
  $country = new WPSC_Country( array(
106
  'isocode' => 'EE',
107
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
108
+ 'symbol' => __( '€', 'wp-e-commerce' ),
109
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
110
+ 'code' => __( 'EUR', 'wp-e-commerce' )
111
  ) );
112
  }
113
 
114
  function _wpsc_fix_slovenia_currency() {
115
  $country = new WPSC_Country( array(
116
  'isocode' => 'SI',
117
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
118
+ 'symbol' => __( '€', 'wp-e-commerce' ),
119
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
120
+ 'code' => __( 'EUR', 'wp-e-commerce' )
121
  ) );
122
  }
123
 
124
  function _wpsc_fix_sudan_currency() {
125
  $country = new WPSC_Country( array(
126
  'isocode' => 'SD',
127
+ 'currency' => __( 'Sudanese Pound', 'wp-e-commerce' ),
128
+ 'code' => __( 'SDG', 'wp-e-commerce' )
129
  ) );
130
  }
131
 
132
  function _wpsc_create_south_sudan() {
133
  $country = new WPSC_Country( array(
134
  'id' => '242',
135
+ 'country' => __( 'South Sudan', 'wp-e-commerce' ),
136
+ 'isocode' => __( 'SS', 'wp-e-commerce' ),
137
+ 'currency' => __( 'South Sudanese Pound', 'wp-e-commerce' ),
138
+ 'code' => __( 'SSP', 'wp-e-commerce' ),
139
  'continent' => 'africa',
140
  'visible' => 0,
141
  ) );
wpsc-admin/db-upgrades/routines/10.php CHANGED
@@ -23,10 +23,10 @@ function _wpsc_db_upgrade_10() {
23
  */
24
  function _wpsc_add_region_name_meta() {
25
  $wpsc_country = new WPSC_Country( 'US' );
26
- $wpsc_country->set( 'region_label', __( 'State', 'wpsc' ) );
27
 
28
  $wpsc_country = new WPSC_Country( 'CA' );
29
- $wpsc_country->set( 'region_label', __( 'Province', 'wpsc' ) );
30
  }
31
 
32
  /**
@@ -66,7 +66,7 @@ function _wpsc_meta_migrate_anonymous_users() {
66
  $role = get_role( 'wpsc_anonymous' );
67
 
68
  if ( $role ) {
69
- remove_role( 'wpsc_anonymous', __( 'Anonymous', 'wpsc' ) );
70
  }
71
 
72
  wp_schedule_single_event( time() + 5 , 'wpsc_migrate_anonymous_user_cron' );
23
  */
24
  function _wpsc_add_region_name_meta() {
25
  $wpsc_country = new WPSC_Country( 'US' );
26
+ $wpsc_country->set( 'region_label', __( 'State', 'wp-e-commerce' ) );
27
 
28
  $wpsc_country = new WPSC_Country( 'CA' );
29
+ $wpsc_country->set( 'region_label', __( 'Province', 'wp-e-commerce' ) );
30
  }
31
 
32
  /**
66
  $role = get_role( 'wpsc_anonymous' );
67
 
68
  if ( $role ) {
69
+ remove_role( 'wpsc_anonymous', __( 'Anonymous', 'wp-e-commerce' ) );
70
  }
71
 
72
  wp_schedule_single_event( time() + 5 , 'wpsc_migrate_anonymous_user_cron' );
wpsc-admin/db-upgrades/routines/11.php CHANGED
@@ -37,12 +37,12 @@ function _wpsc_fix_united_kingdom() {
37
 
38
  $wpsc_country = new WPSC_Country(
39
  array(
40
- 'country' => __( 'United Kingdom', 'wpsc' ),
41
  'isocode' => 'GB',
42
- 'currency' => __( 'Pound Sterling', 'wpsc' ),
43
- 'symbol' => __( '£', 'wpsc' ),
44
- 'symbol_html' => __( '&#163;', 'wpsc' ),
45
- 'code' => __( 'GBP', 'wpsc' ),
46
  'continent' => 'europe',
47
  'visible' => $legacy_ok_country_was_visible ? '0' : '1',
48
  'has_regions' => '0',
37
 
38
  $wpsc_country = new WPSC_Country(
39
  array(
40
+ 'country' => __( 'United Kingdom', 'wp-e-commerce' ),
41
  'isocode' => 'GB',
42
+ 'currency' => __( 'Pound Sterling', 'wp-e-commerce' ),
43
+ 'symbol' => __( '£', 'wp-e-commerce' ),
44
+ 'symbol_html' => __( '&#163;', 'wp-e-commerce' ),
45
+ 'code' => __( 'GBP', 'wp-e-commerce' ),
46
  'continent' => 'europe',
47
  'visible' => $legacy_ok_country_was_visible ? '0' : '1',
48
  'has_regions' => '0',
wpsc-admin/db-upgrades/routines/13.php CHANGED
@@ -19,7 +19,7 @@ function _wpsc_db_upgrade_13() {
19
  */
20
  function _wpsc_add_region_label_to_uk() {
21
  $wpsc_country = new WPSC_Country( 'GB' );
22
- $wpsc_country->set( 'region_label', __( 'County', 'wpsc' ) );
23
  }
24
 
25
  function _wpsc_fix_bad_checkout_form_rows() {
19
  */
20
  function _wpsc_add_region_label_to_uk() {
21
  $wpsc_country = new WPSC_Country( 'GB' );
22
+ $wpsc_country->set( 'region_label', __( 'County', 'wp-e-commerce' ) );
23
  }
24
 
25
  function _wpsc_fix_bad_checkout_form_rows() {
wpsc-admin/db-upgrades/routines/14.php CHANGED
@@ -19,10 +19,10 @@ function _wpsc_db_upgrade_14() {
19
  function _wpsc_fix_latvia_currency() {
20
  $country = new WPSC_Country( array(
21
  'isocode' => 'LV',
22
- 'currency' => __( 'Euro', 'wpsc' ),
23
- 'symbol' => __( '€', 'wpsc' ),
24
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
25
- 'code' => __( 'EUR', 'wpsc' )
26
  ) );
27
 
28
  }
19
  function _wpsc_fix_latvia_currency() {
20
  $country = new WPSC_Country( array(
21
  'isocode' => 'LV',
22
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
23
+ 'symbol' => __( '€', 'wp-e-commerce' ),
24
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
25
+ 'code' => __( 'EUR', 'wp-e-commerce' )
26
  ) );
27
 
28
  }
wpsc-admin/db-upgrades/routines/2.php CHANGED
@@ -46,7 +46,7 @@ function _wpsc_db_upgrade_2() {
46
  function _wpsc_fix_UK_country_code() {
47
  $country = new WPSC_Country( array(
48
  'isocode' => 'GB',
49
- 'country', __( 'United Kingdom', 'wpsc' )
50
  ) );
51
  }
52
 
@@ -59,10 +59,10 @@ function _wpsc_fix_guernsey_country_code() {
59
  function _wpsc_new_country_serbia() {
60
  $country = new WPSC_Country( array(
61
  'id' => 243,
62
- 'country' => __( 'Serbia', 'wpsc' ),
63
  'isocode' => 'RS',
64
- 'currency' => __('Serbian Dinar', 'wpsc'),
65
- 'code' => __('RSD', 'wpsc'),
66
  'continent' => 'europe',
67
  'visible' => '0',
68
  ) );
@@ -71,12 +71,12 @@ function _wpsc_new_country_serbia() {
71
  function _wpsc_new_country_montenegro() {
72
  $country = new WPSC_Country( array(
73
  'id' => 244,
74
- 'country' => __( 'Montenegro', 'wpsc' ),
75
  'isocode' => 'ME',
76
- 'currency' => __( 'Euro', 'wpsc' ),
77
- 'symbol' => __( '€', 'wpsc' ),
78
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
79
- 'code' => __( 'EUR', 'wpsc' ),
80
  'continent' => 'europe',
81
  'visible' => '0',
82
  ) );
@@ -85,11 +85,11 @@ function _wpsc_new_country_montenegro() {
85
  function _wpsc_fix_timor_leste_name() {
86
  $country = new WPSC_Country( array(
87
  'id' => 245,
88
- 'country' => __( 'Timor-Leste', 'wpsc' ),
89
  'isocode' => 'TL',
90
- 'currency' => __( 'US Dollar', 'wpsc' ),
91
- 'symbol' => __( '$', 'wpsc' ),
92
- 'symbol_html' => __( '&#036', 'wpsc' ),
93
  'code' => 'USD',
94
  'continent' => 'asiapacific',
95
  'visible' => '0',
@@ -99,12 +99,12 @@ function _wpsc_fix_timor_leste_name() {
99
  function _wpsc_new_country_aland_islands() {
100
  $country = new WPSC_Country( array(
101
  'id' => 246,
102
- 'country' => __( 'Aland Islands', 'wpsc' ),
103
  'isocode' => 'AX',
104
- 'currency' => __( 'Euro', 'wpsc' ),
105
- 'symbol' => __( '€', 'wpsc' ),
106
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
107
- 'code' => __( 'EUR', 'wpsc' ),
108
  'continent' => 'europe',
109
  'visible' => '0',
110
  ) );
@@ -113,12 +113,12 @@ function _wpsc_new_country_aland_islands() {
113
  function _wpsc_new_country_saint_barthelemy() {
114
  $country = new WPSC_Country( array(
115
  'id' => 247,
116
- 'country' => __( 'Saint Barthelemy', 'wpsc' ),
117
  'isocode' => 'BL',
118
- 'currency' => __( 'Euro', 'wpsc' ),
119
- 'symbol' => __( '€', 'wpsc' ),
120
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
121
- 'code' => __( 'EUR', 'wpsc' ),
122
  'continent' => 'europe',
123
  'visible' => '0',
124
  ) );
@@ -127,12 +127,12 @@ function _wpsc_new_country_saint_barthelemy() {
127
  function _wpsc_new_country_bonaire_et_al() {
128
  $country = new WPSC_Country( array(
129
  'id' => 248,
130
- 'country' => __( 'Bonaire, Sint Eustatius and Saba', 'wpsc' ),
131
  'isocode' => 'BQ',
132
- 'currency' => __( 'US Dollar', 'wpsc' ),
133
- 'symbol' => __( '$', 'wpsc' ),
134
- 'symbol_html' => __( '&#036;', 'wpsc' ),
135
- 'code' => __( 'USD', 'wpsc' ),
136
  'continent' => 'southamerica',
137
  'visible' => '0',
138
  ) );
@@ -141,12 +141,12 @@ function _wpsc_new_country_bonaire_et_al() {
141
  function _wpsc_new_country_curacao() {
142
  $country = new WPSC_Country( array(
143
  'id' => 249,
144
- 'country' => __( 'Curacao', 'wpsc' ),
145
  'isocode' => 'CW',
146
- 'currency' => __( 'Netherlands Antillean Guilder', 'wpsc' ),
147
- 'symbol' => __( 'ƒ', 'wpsc' ),
148
- 'symbol_html' => __( '&#402;', 'wpsc' ),
149
- 'code' => __( 'ANG', 'wpsc' ),
150
  'continent' => 'southamerica',
151
  'visible' => '0',
152
  ) );
@@ -155,12 +155,12 @@ function _wpsc_new_country_curacao() {
155
  function _wpsc_new_country_saint_martin_french() {
156
  $country = new WPSC_Country( array(
157
  'id' => 250,
158
- 'country' => __( 'Saint Martin (French Part)', 'wpsc' ),
159
  'isocode' => 'MF',
160
- 'currency' => __( 'Euro', 'wpsc' ),
161
- 'symbol' => __( '€', 'wpsc' ),
162
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
163
- 'code' => __( 'EUR', 'wpsc' ),
164
  'continent' => 'southamerica',
165
  'visible' => '0',
166
  ) );
@@ -169,12 +169,12 @@ function _wpsc_new_country_saint_martin_french() {
169
  function _wpsc_new_country_palestinian_territories() {
170
  $country = new WPSC_Country( array(
171
  'id' => 251,
172
- 'country' => __( 'Palestinian Territories', 'wpsc' ),
173
  'isocode' => 'PS',
174
- 'currency' => __( 'Israeli New Sheqel', 'wpsc' ),
175
- 'symbol' => __( '₪', 'wpsc' ),
176
- 'symbol_html' => __( '&#8362;', 'wpsc' ),
177
- 'code' => __( 'ILS', 'wpsc' ),
178
  'continent' => 'asiapacific',
179
  'visible' => '0',
180
  ) );
@@ -183,20 +183,20 @@ function _wpsc_new_country_palestinian_territories() {
183
  function _wpsc_update_israeli_new_shekel_symbol() {
184
  $country = new WPSC_Country( array(
185
  'isocode' => 'IL',
186
- 'symbol' => __( '₪', 'wpsc' ),
187
- 'symbol_html' => __( '&#8362;', 'wpsc' ),
188
  ) );
189
  }
190
 
191
  function _wpsc_new_country_sint_maarten_dutch() {
192
  $country = new WPSC_Country( array(
193
  'id' => 252,
194
- 'country' => __( 'Sint Maarten (Dutch Part)', 'wpsc' ),
195
  'isocode' => 'SX',
196
- 'currency' => __( 'Netherlands Antillean Guilder', 'wpsc' ),
197
- 'symbol' => __( 'ƒ', 'wpsc' ),
198
- 'symbol_html' => __( '&#402;', 'wpsc' ),
199
- 'code' => __( 'ANG', 'wpsc' ),
200
  'continent' => 'southamerica',
201
  'visible' => '0',
202
  ) );
@@ -205,12 +205,12 @@ function _wpsc_new_country_sint_maarten_dutch() {
205
  function _wpsc_new_country_french_guiana() {
206
  $country = new WPSC_Country( array(
207
  'id' => 253,
208
- 'country' => __( 'French Guiana', 'wpsc' ),
209
  'isocode' => 'GF',
210
- 'currency' => __( 'Euro', 'wpsc' ),
211
- 'symbol' => __( '€', 'wpsc' ),
212
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
213
- 'code' => __( 'EUR', 'wpsc' ),
214
  'continent' => 'southamerica',
215
  'visible' => '0',
216
  ) );
@@ -219,8 +219,8 @@ function _wpsc_new_country_french_guiana() {
219
  function _wpsc_fix_netherlands_antille() {
220
  $country = new WPSC_Country( array(
221
  'isocode' => 'AN',
222
- 'symbol' => __( 'ƒ', 'wpsc' ),
223
- 'symbol_html' => __( '&#402;', 'wpsc' ),
224
  'continent' => 'southamerica',
225
  ) );
226
  }
@@ -229,54 +229,54 @@ function _wpsc_fix_angola_kwanza() {
229
  $country = new WPSC_Country( array(
230
  'isocode' => 'AO',
231
  'code' => 'AOA',
232
- 'currency' => __( 'Angolan Kwanza', 'wpsc' ),
233
- 'symbol' => __( 'Kz', 'wpsc' ),
234
- 'symbol_html' => __( 'Kz', 'wpsc' ),
235
  ) );
236
  }
237
 
238
  function _wpsc_fix_aruban_florin() {
239
  $country = new WPSC_Country( array(
240
  'isocode' => 'AW',
241
- 'currency' => __( 'Aruban Florin', 'wpsc' ),
242
- 'symbol' => __( 'Afl.', 'wpsc' ),
243
- 'symbol_html' => __( 'Afl.', 'wpsc' ),
244
  ) );
245
  }
246
 
247
  function _wpsc_fix_azerbaijani_manat() {
248
  $country = new WPSC_Country( array(
249
  'isocode' => 'AZ',
250
- 'currency' => __('Azerbaijani Manat', 'wpsc'),
251
  'code' => 'AZN',
252
- 'symbol' => _x( 'm', 'azerbaijani manat symbol', 'wpsc' ),
253
- 'symbol_html' => _x( 'm', 'azerbaijani manat symbol html', 'wpsc' ),
254
  ) );
255
  }
256
 
257
  function _wpsc_fix_cyprus_currency() {
258
  $country = new WPSC_Country( array(
259
  'isocode' => 'CY',
260
- 'currency' => __( 'Euro', 'wpsc' ),
261
- 'symbol' => __( '€', 'wpsc' ),
262
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
263
- 'code' => __( 'EUR', 'wpsc' ),
264
  ) );
265
  }
266
 
267
  function _wpsc_fix_republic_of_the_congo() {
268
  $country = new WPSC_Country( array(
269
  'isocode' => 'CG',
270
- 'country' => __( 'Republic of the Congo', 'wpsc' ),
271
  ) );
272
  }
273
 
274
  function _wpsc_fix_currency_el_salvador() {
275
  $country = new WPSC_Country( array(
276
  'isocode' => 'SV',
277
- 'currency' => __( 'US Dollar', 'wpsc' ),
278
- 'symbol' => __( '$', 'wpsc' ),
279
- 'symbol_html' => __( '&#036', 'wpsc' ),
280
  'code' => 'USD',
281
  ) );
282
  }
@@ -298,133 +298,133 @@ function _wpsc_fix_guatemala_currency() {
298
  function _wpsc_fix_guinea_bissau_currency() {
299
  $country = new WPSC_Country( array(
300
  'isocode' => 'GW',
301
- 'currency' => __( 'CFA Franc BEAC', 'wpsc' ),
302
- 'code' => __('XAF', 'wpsc'),
303
  ) );
304
  }
305
 
306
  function _wpsc_fix_madagascar_currency() {
307
  $country = new WPSC_Country( array(
308
  'isocode' => 'MG',
309
- 'currency' => __( 'Malagasy Ariary', 'wpsc' ),
310
- 'code' => __( 'MGA', 'wpsc' ),
311
  ) );
312
  }
313
 
314
  function _wpsc_fix_malta_currency() {
315
  $country = new WPSC_Country( array(
316
  'isocode' => 'MT',
317
- 'currency' => __( 'Euro', 'wpsc' ),
318
- 'symbol' => __( '€', 'wpsc' ),
319
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
320
- 'code' => __( 'EUR', 'wpsc' ),
321
  ) );
322
  }
323
 
324
  function _wpsc_fix_mozambique_currency() {
325
  $country = new WPSC_Country( array(
326
  'isocode' => 'MZ',
327
- 'code' => __( 'MZN', 'wpsc' )
328
  ) );
329
  }
330
 
331
  function _wpsc_fix_nicaragua_currency() {
332
  $country = new WPSC_Country( array(
333
  'isocode' => 'NI',
334
- 'code' => __( 'NIO', 'wpsc' )
335
  ) );
336
  }
337
 
338
  function _wpsc_fix_romania_currency() {
339
  $country = new WPSC_Country( array(
340
  'isocode' => 'RO',
341
- 'currency' => __( 'Romanian New Leu', 'wpsc' )
342
  ) );
343
  }
344
 
345
  function _wpsc_fix_san_marino_currency() {
346
  $country = new WPSC_Country( array(
347
  'isocode' => 'SM',
348
- 'currency' => __( 'Euro', 'wpsc' ),
349
- 'symbol' => __( '€', 'wpsc' ),
350
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
351
- 'code' => __( 'EUR', 'wpsc' ),
352
  ) );
353
  }
354
 
355
  function _wpsc_fix_somalia_currency() {
356
  $country = new WPSC_Country( array(
357
  'isocode' => 'SO',
358
- 'code' => __( 'SOS', 'wpsc' )
359
  ) );
360
  }
361
 
362
  function _wpsc_fix_suriname_currency() {
363
  $country = new WPSC_Country( array(
364
  'isocode' => 'SR',
365
- 'currency' => __( 'Surinamese Dollar', 'wpsc' ),
366
- 'code' => __( 'SRD', 'wpsc' ),
367
  ) );
368
  }
369
 
370
  function _wpsc_fix_taiwan_currency() {
371
  $country = new WPSC_Country( array(
372
  'isocode' => 'TW',
373
- 'currency' => __( 'New Taiwanese Dollar', 'wpsc' )
374
  ) );
375
  }
376
 
377
  function _wpsc_fix_tajikistan_currency() {
378
  $country = new WPSC_Country( array(
379
  'isocode' => 'TJ',
380
- 'currency' => __( 'Tajikistan Somoni', 'wpsc' ),
381
- 'code' => __( 'TJS', 'wpsc' ),
382
  ) );
383
  }
384
 
385
  function _wpsc_fix_tunisia_currency() {
386
  $country = new WPSC_Country( array(
387
  'isocode' => 'TN',
388
- 'currency' => __( 'Tunisian Dollar', 'wpsc' )
389
  ) );
390
  }
391
 
392
  function _wpsc_fix_turkey_currency() {
393
  $country = new WPSC_Country( array(
394
  'isocode' => 'TR',
395
- 'code' => __( 'TRY', 'wpsc' )
396
  ) );
397
  }
398
 
399
  function _wpsc_fix_uganda_currency() {
400
  $country = new WPSC_Country( array(
401
  'isocode' => 'UG',
402
- 'code' => __( 'UGX', 'wpsc' )
403
  ) );
404
  }
405
 
406
  function _wpsc_fix_uruguay_currency() {
407
  $country = new WPSC_Country( array(
408
  'isocode' => 'UY',
409
- 'code' => __( 'UYU', 'wpsc' )
410
  ) );
411
  }
412
 
413
  function _wpsc_fix_venezuela_currency() {
414
  $country = new WPSC_Country( array(
415
  'isocode' => 'VE',
416
- 'currency' => __( 'Venezuelan Bolivar Fuerte', 'wpsc' ),
417
- 'code' => __( 'VEF', 'wpsc' ),
418
  ) );
419
  }
420
 
421
  function _wpsc_fix_zimbabwe_currency() {
422
  $country = new WPSC_Country( array(
423
  'isocode' => 'ZW',
424
- 'currency' => __( 'US Dollar', 'wpsc' ),
425
- 'symbol' => __( '$', 'wpsc' ),
426
- 'symbol_html' => __( '&#036', 'wpsc' ),
427
  'code' => 'USD',
428
  'continent' => 'asiapacific',
429
  ) );
430
- }
46
  function _wpsc_fix_UK_country_code() {
47
  $country = new WPSC_Country( array(
48
  'isocode' => 'GB',
49
+ 'country', __( 'United Kingdom', 'wp-e-commerce' )
50
  ) );
51
  }
52
 
59
  function _wpsc_new_country_serbia() {
60
  $country = new WPSC_Country( array(
61
  'id' => 243,
62
+ 'country' => __( 'Serbia', 'wp-e-commerce' ),
63
  'isocode' => 'RS',
64
+ 'currency' => __('Serbian Dinar', 'wp-e-commerce'),
65
+ 'code' => __('RSD', 'wp-e-commerce'),
66
  'continent' => 'europe',
67
  'visible' => '0',
68
  ) );
71
  function _wpsc_new_country_montenegro() {
72
  $country = new WPSC_Country( array(
73
  'id' => 244,
74
+ 'country' => __( 'Montenegro', 'wp-e-commerce' ),
75
  'isocode' => 'ME',
76
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
77
+ 'symbol' => __( '€', 'wp-e-commerce' ),
78
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
79
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
80
  'continent' => 'europe',
81
  'visible' => '0',
82
  ) );
85
  function _wpsc_fix_timor_leste_name() {
86
  $country = new WPSC_Country( array(
87
  'id' => 245,
88
+ 'country' => __( 'Timor-Leste', 'wp-e-commerce' ),
89
  'isocode' => 'TL',
90
+ 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
91
+ 'symbol' => __( '$', 'wp-e-commerce' ),
92
+ 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
93
  'code' => 'USD',
94
  'continent' => 'asiapacific',
95
  'visible' => '0',
99
  function _wpsc_new_country_aland_islands() {
100
  $country = new WPSC_Country( array(
101
  'id' => 246,
102
+ 'country' => __( 'Aland Islands', 'wp-e-commerce' ),
103
  'isocode' => 'AX',
104
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
105
+ 'symbol' => __( '€', 'wp-e-commerce' ),
106
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
107
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
108
  'continent' => 'europe',
109
  'visible' => '0',
110
  ) );
113
  function _wpsc_new_country_saint_barthelemy() {
114
  $country = new WPSC_Country( array(
115
  'id' => 247,
116
+ 'country' => __( 'Saint Barthelemy', 'wp-e-commerce' ),
117
  'isocode' => 'BL',
118
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
119
+ 'symbol' => __( '€', 'wp-e-commerce' ),
120
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
121
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
122
  'continent' => 'europe',
123
  'visible' => '0',
124
  ) );
127
  function _wpsc_new_country_bonaire_et_al() {
128
  $country = new WPSC_Country( array(
129
  'id' => 248,
130
+ 'country' => __( 'Bonaire, Sint Eustatius and Saba', 'wp-e-commerce' ),
131
  'isocode' => 'BQ',
132
+ 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
133
+ 'symbol' => __( '$', 'wp-e-commerce' ),
134
+ 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
135
+ 'code' => __( 'USD', 'wp-e-commerce' ),
136
  'continent' => 'southamerica',
137
  'visible' => '0',
138
  ) );
141
  function _wpsc_new_country_curacao() {
142
  $country = new WPSC_Country( array(
143
  'id' => 249,
144
+ 'country' => __( 'Curacao', 'wp-e-commerce' ),
145
  'isocode' => 'CW',
146
+ 'currency' => __( 'Netherlands Antillean Guilder', 'wp-e-commerce' ),
147
+ 'symbol' => __( 'ƒ', 'wp-e-commerce' ),
148
+ 'symbol_html' => __( '&#402;', 'wp-e-commerce' ),
149
+ 'code' => __( 'ANG', 'wp-e-commerce' ),
150
  'continent' => 'southamerica',
151
  'visible' => '0',
152
  ) );
155
  function _wpsc_new_country_saint_martin_french() {
156
  $country = new WPSC_Country( array(
157
  'id' => 250,
158
+ 'country' => __( 'Saint Martin (French Part)', 'wp-e-commerce' ),
159
  'isocode' => 'MF',
160
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
161
+ 'symbol' => __( '€', 'wp-e-commerce' ),
162
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
163
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
164
  'continent' => 'southamerica',
165
  'visible' => '0',
166
  ) );
169
  function _wpsc_new_country_palestinian_territories() {
170
  $country = new WPSC_Country( array(
171
  'id' => 251,
172
+ 'country' => __( 'Palestinian Territories', 'wp-e-commerce' ),
173
  'isocode' => 'PS',
174
+ 'currency' => __( 'Israeli New Shekel', 'wp-e-commerce' ),
175
+ 'symbol' => __( '₪', 'wp-e-commerce' ),
176
+ 'symbol_html' => __( '&#8362;', 'wp-e-commerce' ),
177
+ 'code' => __( 'ILS', 'wp-e-commerce' ),
178
  'continent' => 'asiapacific',
179
  'visible' => '0',
180
  ) );
183
  function _wpsc_update_israeli_new_shekel_symbol() {
184
  $country = new WPSC_Country( array(
185
  'isocode' => 'IL',
186
+ 'symbol' => __( '₪', 'wp-e-commerce' ),
187
+ 'symbol_html' => __( '&#8362;', 'wp-e-commerce' ),
188
  ) );
189
  }
190
 
191
  function _wpsc_new_country_sint_maarten_dutch() {
192
  $country = new WPSC_Country( array(
193
  'id' => 252,
194
+ 'country' => __( 'Sint Maarten (Dutch Part)', 'wp-e-commerce' ),
195
  'isocode' => 'SX',
196
+ 'currency' => __( 'Netherlands Antillean Guilder', 'wp-e-commerce' ),
197
+ 'symbol' => __( 'ƒ', 'wp-e-commerce' ),
198
+ 'symbol_html' => __( '&#402;', 'wp-e-commerce' ),
199
+ 'code' => __( 'ANG', 'wp-e-commerce' ),
200
  'continent' => 'southamerica',
201
  'visible' => '0',
202
  ) );
205
  function _wpsc_new_country_french_guiana() {
206
  $country = new WPSC_Country( array(
207
  'id' => 253,
208
+ 'country' => __( 'French Guiana', 'wp-e-commerce' ),
209
  'isocode' => 'GF',
210
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
211
+ 'symbol' => __( '€', 'wp-e-commerce' ),
212
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
213
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
214
  'continent' => 'southamerica',
215
  'visible' => '0',
216
  ) );
219
  function _wpsc_fix_netherlands_antille() {
220
  $country = new WPSC_Country( array(
221
  'isocode' => 'AN',
222
+ 'symbol' => __( 'ƒ', 'wp-e-commerce' ),
223
+ 'symbol_html' => __( '&#402;', 'wp-e-commerce' ),
224
  'continent' => 'southamerica',
225
  ) );
226
  }
229
  $country = new WPSC_Country( array(
230
  'isocode' => 'AO',
231
  'code' => 'AOA',
232
+ 'currency' => __( 'Angolan Kwanza', 'wp-e-commerce' ),
233
+ 'symbol' => __( 'Kz', 'wp-e-commerce' ),
234
+ 'symbol_html' => __( 'Kz', 'wp-e-commerce' ),
235
  ) );
236
  }
237
 
238
  function _wpsc_fix_aruban_florin() {
239
  $country = new WPSC_Country( array(
240
  'isocode' => 'AW',
241
+ 'currency' => __( 'Aruban Florin', 'wp-e-commerce' ),
242
+ 'symbol' => __( 'Afl.', 'wp-e-commerce' ),
243
+ 'symbol_html' => __( 'Afl.', 'wp-e-commerce' ),
244
  ) );
245
  }
246
 
247
  function _wpsc_fix_azerbaijani_manat() {
248
  $country = new WPSC_Country( array(
249
  'isocode' => 'AZ',
250
+ 'currency' => __('Azerbaijani Manat', 'wp-e-commerce'),
251
  'code' => 'AZN',
252
+ 'symbol' => _x( 'm', 'azerbaijani manat symbol', 'wp-e-commerce' ),
253
+ 'symbol_html' => _x( 'm', 'azerbaijani manat symbol html', 'wp-e-commerce' ),
254
  ) );
255
  }
256
 
257
  function _wpsc_fix_cyprus_currency() {
258
  $country = new WPSC_Country( array(
259
  'isocode' => 'CY',
260
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
261
+ 'symbol' => __( '€', 'wp-e-commerce' ),
262
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
263
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
264
  ) );
265
  }
266
 
267
  function _wpsc_fix_republic_of_the_congo() {
268
  $country = new WPSC_Country( array(
269
  'isocode' => 'CG',
270
+ 'country' => __( 'Republic of the Congo', 'wp-e-commerce' ),
271
  ) );
272
  }
273
 
274
  function _wpsc_fix_currency_el_salvador() {
275
  $country = new WPSC_Country( array(
276
  'isocode' => 'SV',
277
+ 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
278
+ 'symbol' => __( '$', 'wp-e-commerce' ),
279
+ 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
280
  'code' => 'USD',
281
  ) );
282
  }
298
  function _wpsc_fix_guinea_bissau_currency() {
299
  $country = new WPSC_Country( array(
300
  'isocode' => 'GW',
301
+ 'currency' => __( 'CFA Franc BEAC', 'wp-e-commerce' ),
302
+ 'code' => __('XAF', 'wp-e-commerce'),
303
  ) );
304
  }
305
 
306
  function _wpsc_fix_madagascar_currency() {
307
  $country = new WPSC_Country( array(
308
  'isocode' => 'MG',
309
+ 'currency' => __( 'Malagasy Ariary', 'wp-e-commerce' ),
310
+ 'code' => __( 'MGA', 'wp-e-commerce' ),
311
  ) );
312
  }
313
 
314
  function _wpsc_fix_malta_currency() {
315
  $country = new WPSC_Country( array(
316
  'isocode' => 'MT',
317
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
318
+ 'symbol' => __( '€', 'wp-e-commerce' ),
319
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
320
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
321
  ) );
322
  }
323
 
324
  function _wpsc_fix_mozambique_currency() {
325
  $country = new WPSC_Country( array(
326
  'isocode' => 'MZ',
327
+ 'code' => __( 'MZN', 'wp-e-commerce' )
328
  ) );
329
  }
330
 
331
  function _wpsc_fix_nicaragua_currency() {
332
  $country = new WPSC_Country( array(
333
  'isocode' => 'NI',
334
+ 'code' => __( 'NIO', 'wp-e-commerce' )
335
  ) );
336
  }
337
 
338
  function _wpsc_fix_romania_currency() {
339
  $country = new WPSC_Country( array(
340
  'isocode' => 'RO',
341
+ 'currency' => __( 'Romanian New Leu', 'wp-e-commerce' )
342
  ) );
343
  }
344
 
345
  function _wpsc_fix_san_marino_currency() {
346
  $country = new WPSC_Country( array(
347
  'isocode' => 'SM',
348
+ 'currency' => __( 'Euro', 'wp-e-commerce' ),
349
+ 'symbol' => __( '€', 'wp-e-commerce' ),
350
+ 'symbol_html' => __( '&#8364;', 'wp-e-commerce' ),
351
+ 'code' => __( 'EUR', 'wp-e-commerce' ),
352
  ) );
353
  }
354
 
355
  function _wpsc_fix_somalia_currency() {
356
  $country = new WPSC_Country( array(
357
  'isocode' => 'SO',
358
+ 'code' => __( 'SOS', 'wp-e-commerce' )
359
  ) );
360
  }
361
 
362
  function _wpsc_fix_suriname_currency() {
363
  $country = new WPSC_Country( array(
364
  'isocode' => 'SR',
365
+ 'currency' => __( 'Surinamese Dollar', 'wp-e-commerce' ),
366
+ 'code' => __( 'SRD', 'wp-e-commerce' ),
367
  ) );
368
  }
369
 
370
  function _wpsc_fix_taiwan_currency() {
371
  $country = new WPSC_Country( array(
372
  'isocode' => 'TW',
373
+ 'currency' => __( 'New Taiwanese Dollar', 'wp-e-commerce' )
374
  ) );
375
  }
376
 
377
  function _wpsc_fix_tajikistan_currency() {
378
  $country = new WPSC_Country( array(
379
  'isocode' => 'TJ',
380
+ 'currency' => __( 'Tajikistan Somoni', 'wp-e-commerce' ),
381
+ 'code' => __( 'TJS', 'wp-e-commerce' ),
382
  ) );
383
  }
384
 
385
  function _wpsc_fix_tunisia_currency() {
386
  $country = new WPSC_Country( array(
387
  'isocode' => 'TN',
388
+ 'currency' => __( 'Tunisian Dollar', 'wp-e-commerce' )
389
  ) );
390
  }
391
 
392
  function _wpsc_fix_turkey_currency() {
393
  $country = new WPSC_Country( array(
394
  'isocode' => 'TR',
395
+ 'code' => __( 'TRY', 'wp-e-commerce' )
396
  ) );
397
  }
398
 
399
  function _wpsc_fix_uganda_currency() {
400
  $country = new WPSC_Country( array(
401
  'isocode' => 'UG',
402
+ 'code' => __( 'UGX', 'wp-e-commerce' )
403
  ) );
404
  }
405
 
406
  function _wpsc_fix_uruguay_currency() {
407
  $country = new WPSC_Country( array(
408
  'isocode' => 'UY',
409
+ 'code' => __( 'UYU', 'wp-e-commerce' )
410
  ) );
411
  }
412
 
413
  function _wpsc_fix_venezuela_currency() {
414
  $country = new WPSC_Country( array(
415
  'isocode' => 'VE',
416
+ 'currency' => __( 'Venezuelan Bolivar Fuerte', 'wp-e-commerce' ),
417
+ 'code' => __( 'VEF', 'wp-e-commerce' ),
418
  ) );
419
  }
420
 
421
  function _wpsc_fix_zimbabwe_currency() {
422
  $country = new WPSC_Country( array(
423
  'isocode' => 'ZW',
424
+ 'currency' => __( 'US Dollar', 'wp-e-commerce' ),
425
+ 'symbol' => __( '$', 'wp-e-commerce' ),
426
+ 'symbol_html' => __( '&#036;', 'wp-e-commerce' ),
427
  'code' => 'USD',
428
  'continent' => 'asiapacific',
429
  ) );
430
+ }
wpsc-admin/db-upgrades/routines/3.php CHANGED
@@ -8,11 +8,11 @@ function _wpsc_maybe_create_UK() {
8
  $country = new WPSC_Country( array(
9
  'isocode' => 'GB',
10
  'id' => 138,
11
- 'country' => __( 'United Kingdom', 'wpsc' ),
12
- 'currency' => __( 'Pound Sterling', 'wpsc' ),
13
- 'symbol' => __( '£', 'wpsc' ),
14
- 'symbol_html' => __( '&#163;', 'wpsc' ),
15
- 'code' => __( 'GBP', 'wpsc' ),
16
  'continent' => 'europe',
17
  ) );
18
  }
8
  $country = new WPSC_Country( array(
9
  'isocode' => 'GB',
10
  'id' => 138,
11
+ 'country' => __( 'United Kingdom', 'wp-e-commerce' ),
12
+ 'currency' => __( 'Pound Sterling', 'wp-e-commerce' ),
13
+ 'symbol' => __( '£', 'wp-e-commerce' ),
14
+ 'symbol_html' => __( '&#163;', 'wp-e-commerce' ),
15
+ 'code' => __( 'GBP', 'wp-e-commerce' ),
16
  'continent' => 'europe',
17
  ) );
18
  }
wpsc-admin/db-upgrades/routines/4.php CHANGED
@@ -19,18 +19,28 @@ function _wpsc_maybe_update_user_log_file() {
19
  '3.8.10' => '09e2cb9c753587c9228a4e9e8008a82f',
20
  );
21
 
22
- if ( function_exists( 'wpsc_flush_theme_transients' ) )
23
  wpsc_flush_theme_transients( true );
 
 
 
 
 
 
24
 
25
  //Make sure the theme has actually been moved.
26
  $file = wpsc_get_template_file_path( 'wpsc-user-log.php' );
27
- if ( false !== strpos( WPSC_CORE_THEME_PATH, $file ) )
 
28
  return;
 
29
 
30
  //If it has been moved, but it's the 3.8.10 version, we should be good to go.
31
  $hash = md5_file( $file );
32
- if ( $hashes['3.8.10'] === $hash )
 
33
  return;
 
34
 
35
  //At this point, we know the file has been moved to the active file folder. Checking now if it has been modified.
36
  if ( in_array( $hash, $hashes ) ) {
19
  '3.8.10' => '09e2cb9c753587c9228a4e9e8008a82f',
20
  );
21
 
22
+ if ( function_exists( 'wpsc_flush_theme_transients' ) ) {
23
  wpsc_flush_theme_transients( true );
24
+ }
25
+
26
+ // Using TEv2
27
+ if ( ! function_exists( 'wpsc_get_template_file_path' ) ) {
28
+ return;
29
+ }
30
 
31
  //Make sure the theme has actually been moved.
32
  $file = wpsc_get_template_file_path( 'wpsc-user-log.php' );
33
+
34
+ if ( false !== strpos( WPSC_CORE_THEME_PATH, $file ) ) {
35
  return;
36
+ }
37
 
38
  //If it has been moved, but it's the 3.8.10 version, we should be good to go.
39
  $hash = md5_file( $file );
40
+
41
+ if ( $hashes['3.8.10'] === $hash ) {
42
  return;
43
+ }
44
 
45
  //At this point, we know the file has been moved to the active file folder. Checking now if it has been modified.
46
  if ( in_array( $hash, $hashes ) ) {
wpsc-admin/db-upgrades/routines/8.php CHANGED
@@ -7,6 +7,6 @@ function _wpsc_db_upgrade_8() {
7
  function _wpsc_fix_bulgaria_currency() {
8
  $country = new WPSC_Country( array(
9
  'isocode' => 'BG',
10
- 'code' => __( 'BGN', 'wpsc' ),
11
  ) );
12
  }
7
  function _wpsc_fix_bulgaria_currency() {
8
  $country = new WPSC_Country( array(
9
  'isocode' => 'BG',
10
+ 'code' => __( 'BGN', 'wp-e-commerce' ),
11
  ) );
12
  }
wpsc-admin/db-upgrades/upgrade.php CHANGED
@@ -22,25 +22,25 @@ function _wpsc_maybe_upgrade() {
22
  for ( $i = $current_db_ver + 1; $i <= WPSC_DB_VERSION; $i++ ) {
23
  $file_path = WPSC_FILE_PATH . '/wpsc-admin/db-upgrades/routines/' . $i . '.php';
24
 
25
- if ( file_exists( $file_path ) )
26
  require_once( $file_path );
 
27
 
28
- if ( ! function_exists( '_wpsc_db_upgrade_' . $i ) )
29
  continue;
 
30
 
31
  wpsc_core_flush_temporary_data();
32
 
33
  call_user_func( '_wpsc_db_upgrade_' . $i );
34
  update_option( 'wpsc_db_version', $i );
35
-
36
  }
37
 
38
  wpsc_core_flush_temporary_data();
39
-
40
  }
41
 
42
  function _wpsc_upgrade_display_backup_warning() {
43
- $message = __( '<strong>Important:</strong> Before proceeding with the database upgrade, <a href="%1$s">please backup your database and files</a>.<br>We recommend using <a href="%2$s">VaultPress</a> or <a href="%3$s">BackupBuddy</a> to regularly backup your WordPress installation.', 'wpsc' );
44
  $message = sprintf(
45
  $message,
46
  'http://codex.wordpress.org/WordPress_Backups',
@@ -55,7 +55,7 @@ function _wpsc_upgrade_display_backup_warning() {
55
  }
56
 
57
  function _wpsc_upgrade_display_prompt() {
58
- $message = __( '<strong>WP eCommerce %1$s is almost ready.</strong> Some database routines need to be run before the upgrade is complete. <a href="%2$s">Click here to start!</a>');
59
  $message = sprintf( $message, WPSC_VERSION, admin_url( '?page=wpsc-db-upgrade' ) );
60
  ?>
61
  <div id="wpsc-upgrade-warning" class="error">
@@ -65,7 +65,7 @@ function _wpsc_upgrade_display_prompt() {
65
  }
66
 
67
  function _wpsc_upgrade_display_successful() {
68
- $message = __( 'WP eCommerce has been successfully updated to %s. Enjoy!', 'wpsc' );
69
  $message = sprintf( $message, WPSC_VERSION );
70
  ?>
71
  <div id="wpsc-upgrade-warning" class="updated">
@@ -131,7 +131,7 @@ function _wpsc_is_db_upgrade_page() {
131
 
132
  function _wpsc_action_admin_menu_db_upgrade() {
133
  if ( _wpsc_needs_upgrade() ) {
134
- $page_hook = add_submenu_page( 'index.php', __( 'Database Upgrade', 'wpsc' ), __( 'Database Upgrade', 'wpsc' ), 'update_plugins', 'wpsc-db-upgrade', '_wpsc_callback_display_db_upgrade_page' );
135
  add_action( 'load-' . $page_hook, '_wpsc_action_load_db_upgrade' );
136
  }
137
  }
@@ -150,6 +150,6 @@ function _wpsc_action_load_db_upgrade() {
150
  }
151
 
152
  function _wpsc_callback_display_db_upgrade_page() {
153
- $update_title = sprintf( __( 'Your database needs to be upgraded before you can use WP eCommerce %s', 'wpsc' ), WPSC_VERSION );
154
  include( 'views/main.php' );
155
  }
22
  for ( $i = $current_db_ver + 1; $i <= WPSC_DB_VERSION; $i++ ) {
23
  $file_path = WPSC_FILE_PATH . '/wpsc-admin/db-upgrades/routines/' . $i . '.php';
24
 
25
+ if ( file_exists( $file_path ) ) {
26
  require_once( $file_path );
27
+ }
28
 
29
+ if ( ! function_exists( '_wpsc_db_upgrade_' . $i ) ) {
30
  continue;
31
+ }
32
 
33
  wpsc_core_flush_temporary_data();
34
 
35
  call_user_func( '_wpsc_db_upgrade_' . $i );
36
  update_option( 'wpsc_db_version', $i );
 
37
  }
38
 
39
  wpsc_core_flush_temporary_data();
 
40
  }
41
 
42
  function _wpsc_upgrade_display_backup_warning() {
43
+ $message = __( '<strong>Important:</strong> Before proceeding with the database upgrade, <a href="%1$s">please backup your database and files</a>.<br>We recommend using <a href="%2$s">VaultPress</a> or <a href="%3$s">BackupBuddy</a> to regularly backup your WordPress installation.', 'wp-e-commerce' );
44
  $message = sprintf(
45
  $message,
46
  'http://codex.wordpress.org/WordPress_Backups',
55
  }
56
 
57
  function _wpsc_upgrade_display_prompt() {
58
+ $message = __( '<strong>WP eCommerce %1$s is almost ready.</strong> Some database routines need to be run before the upgrade is complete. <a href="%2$s">Click here to start!</a>', 'wp-e-commerce' );
59
  $message = sprintf( $message, WPSC_VERSION, admin_url( '?page=wpsc-db-upgrade' ) );
60
  ?>
61
  <div id="wpsc-upgrade-warning" class="error">
65
  }
66
 
67
  function _wpsc_upgrade_display_successful() {
68
+ $message = __( 'WP eCommerce has been successfully updated to %s. Enjoy!', 'wp-e-commerce' );
69
  $message = sprintf( $message, WPSC_VERSION );
70
  ?>
71
  <div id="wpsc-upgrade-warning" class="updated">
131
 
132
  function _wpsc_action_admin_menu_db_upgrade() {
133
  if ( _wpsc_needs_upgrade() ) {
134
+ $page_hook = add_submenu_page( 'index.php', __( 'Database Upgrade', 'wp-e-commerce' ), __( 'Database Upgrade', 'wp-e-commerce' ), 'update_plugins', 'wpsc-db-upgrade', '_wpsc_callback_display_db_upgrade_page' );
135
  add_action( 'load-' . $page_hook, '_wpsc_action_load_db_upgrade' );
136
  }
137
  }
150
  }
151
 
152
  function _wpsc_callback_display_db_upgrade_page() {
153
+ $update_title = sprintf( __( 'Your database needs to be upgraded before you can use WP eCommerce %s', 'wp-e-commerce' ), WPSC_VERSION );
154
  include( 'views/main.php' );
155
  }
wpsc-admin/db-upgrades/views/main.php CHANGED
@@ -1,11 +1,11 @@
1
  <div class="wrap">
2
  <div id="icon-tools" class="icon32"><br></div>
3
- <h2><?php esc_html_e( 'WP eCommerce Database Upgrade', 'wpsc' ); ?></h2>
4
  <form class="wpsc-db-upgrade" action="" method="post">
5
  <h3><?php echo esc_html( $update_title ); ?></h3>
6
- <p><?php esc_html_e( 'Click "Start Database Upgrade" when you are ready.', 'wpsc' ); ?></p>
7
  <?php wp_nonce_field( 'wpsc_db_upgrade' ); ?>
8
  <input type="hidden" name="action" value="start_upgrade" />
9
- <?php submit_button( __( 'Start Database Upgrade', 'wpsc' ), 'primary', 'submit', false ); ?>
10
  </form>
11
  </div>
1
  <div class="wrap">
2
  <div id="icon-tools" class="icon32"><br></div>
3
+ <h2><?php esc_html_e( 'WP eCommerce Database Upgrade', 'wp-e-commerce' ); ?></h2>
4
  <form class="wpsc-db-upgrade" action="" method="post">
5
  <h3><?php echo esc_html( $update_title ); ?></h3>
6
+ <p><?php esc_html_e( 'Click "Start Database Upgrade" when you are ready.', 'wp-e-commerce' ); ?></p>
7
  <?php wp_nonce_field( 'wpsc_db_upgrade' ); ?>
8
  <input type="hidden" name="action" value="start_upgrade" />
9
+ <?php submit_button( __( 'Start Database Upgrade', 'wp-e-commerce' ), 'primary', 'submit', false ); ?>
10
  </form>
11
  </div>
wpsc-admin/display-coupon-add.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class="wrap" id="coupon_data">
2
  <div id="add_coupon_box">
3
- <h2><?php _e( 'Add Coupon', 'wpsc' ); ?></h2>
4
  <form name='add_coupon' method="post" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
5
  <table class="form-table">
6
  <tbody>
@@ -9,114 +9,114 @@
9
 
10
  <tr class="form-field">
11
  <th scope="row" valign="top">
12
- <label for="add_coupon_code"><?php _e( 'Coupon Code', 'wpsc' ); ?></label>
13
  </th>
14
  <td>
15
  <input name="add_coupon_code" id="add_coupon_code" type="text" style="width: 300px;"/>
16
- <p class="description"><?php _e( 'The code entered to receive the discount', 'wpsc' ); ?></p>
17
  </td>
18
  </tr>
19
 
20
  <tr class="form-field" id="discount_amount">
21
  <th scope="row" valign="top">
22
- <label for="add-coupon-code"><?php _e( 'Discount', 'wpsc' ); ?></label>
23
  </th>
24
  <td>
25
  <input name="add_discount" step=".01" id="add-coupon-code" type="number" class="small-text" min="0" style="width: 300px" />
26
- <p class="description"><?php _e( 'The discount amount', 'wpsc' ); ?></p>
27
  </td>
28
  </tr>
29
 
30
  <tr class="form-field">
31
  <th scope="row" valign="top">
32
- <label for="add_discount_type"><?php _e( 'Discount Type', 'wpsc' ); ?></label>
33
  </th>
34
  <td>
35
  <select name='add_discount_type' id='add_discount_type'>
36
- <option value='0'><?php _e( 'Fixed Amount', 'wpsc' ); ?></option>
37
- <option value='1'><?php _e( 'Percentage', 'wpsc' ); ?></option>
38
- <option value='2'><?php _e( 'Free shipping', 'wpsc' ); ?></option>
39
  </select>
40
- <p class="description"><?php _e( 'The discount type', 'wpsc' ); ?></p>
41
  </td>
42
  </tr>
43
 
44
  <tr class="form-field">
45
  <th scope="row" valign="top">
46
- <label for="add_start"><?php _e( 'Start and End', 'wpsc' ); ?></label>
47
  </th>
48
  <td>
49
- <span class="description"><?php _e( 'Start: ', 'wpsc' ); ?></span>
50
  <input name="add_start" id="add_start" type="text" class="regular-text pickdate" style="width: 100px"/>
51
- <span class="description"><?php _e( 'End: ', 'wpsc' ); ?></span>
52
  <input name="add_end" id="add_end" type="text" class="regular-text pickdate" style="width: 100px"/>
53
- <p class="description"><?php _e( 'If date fields are left empty, there will be no expiration on this coupon.', 'wpsc' ); ?></p>
54
  </td>
55
  </tr>
56
 
57
  <tr>
58
  <th scope="row" valign="top">
59
- <?php _e( 'Active', 'wpsc' ); ?>
60
  </th>
61
  <td>
62
  <input type='hidden' value='0' name='add_active' />
63
  <input type="checkbox" value='1' checked='checked' name='add_active' id="add_active" />
64
- <label for="add_active"><?php _e( 'Activate coupon on creation.', 'wpsc' ) ?></label>
65
  </td>
66
  </tr>
67
 
68
  <tr>
69
  <th scope="row" valign="top">
70
- <?php _e( 'Use Once', 'wpsc' ); ?>
71
  </th>
72
  <td>
73
  <input type='hidden' value='0' name='add_use-once' />
74
  <input type='checkbox' value='1' name='add_use-once' id="add_use-once" />
75
- <label for="add_use-once"><?php _e( 'Deactivate coupon after it has been used.', 'wpsc' ) ?></label>
76
  </td>
77
  </tr>
78
 
79
  <tr>
80
  <th scope="row" valign="top">
81
- <?php _e( 'Apply On All Products', 'wpsc' ); ?>
82
  </th>
83
  <td>
84
  </span><input type='hidden' value='0' name='add_every_product' />
85
  <input type="checkbox" value="1" name='add_every_product' id="add_every-product"/>
86
- <label for="add_every-product"><?php _e( 'This coupon affects each product at checkout.', 'wpsc' ) ?></label>
87
  </td>
88
  </tr>
89
 
90
  <tr class="form-field coupon-conditions">
91
  <th scope="row" valign="top">
92
- <label><strong><?php _e( 'Conditions', 'wpsc' ); ?></strong></label>
93
  </th>
94
  <td>
95
  <input type="hidden" name="rules[operator][]" value="" />
96
  <div class='coupon-condition'>
97
  <select class="ruleprops" name="rules[property][]">
98
- <option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
99
- <option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
100
- <option value="total_quantity" rel="order"><?php _e( 'Total quantity', 'wpsc' ); ?></option>
101
- <option value="subtotal_amount" rel="order"><?php _e( 'Subtotal amount', 'wpsc' ); ?></option>
102
  <?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
103
  </select>
104
 
105
  <select name="rules[logic][]">
106
- <option value="equal"><?php _e( 'Is equal to', 'wpsc' ); ?></option>
107
- <option value="greater"><?php _e( 'Is greater than', 'wpsc' ); ?></option>
108
- <option value="less"><?php _e( 'Is less than', 'wpsc' ); ?></option>
109
- <option value="contains"><?php _e( 'Contains', 'wpsc' ); ?></option>
110
- <option value="not_contain"><?php _e( 'Does not contain', 'wpsc' ); ?></option>
111
- <option value="begins"><?php _e( 'Begins with', 'wpsc' ); ?></option>
112
- <option value="ends"><?php _e( 'Ends with', 'wpsc' ); ?></option>
113
- <option value="category"><?php _e( 'In Category', 'wpsc' ); ?></option>
114
  <?php echo apply_filters( 'wpsc_coupon_rule_logic_options', '' ); ?>
115
  </select>
116
 
117
  <input type="text" name="rules[value][]" style="width: 150px;"/>
118
- <a title="<?php esc_attr_e( 'Delete condition', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wpsc' ); ?></a>
119
- <a title="<?php esc_attr_e( 'Add condition', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wpsc' ); ?></a>
120
  </div>
121
  </td>
122
  </tr>
@@ -126,7 +126,7 @@
126
  </tbody>
127
  </table>
128
  <?php wp_nonce_field( 'wpsc_coupon', 'wpsc-coupon-add' ); ?>
129
- <?php submit_button( __( 'Add Coupon', 'wpsc' ), 'primary', 'add_coupon' ); ?>
130
 
131
  </form>
132
  </div>
1
  <div class="wrap" id="coupon_data">
2
  <div id="add_coupon_box">
3
+ <h2><?php _e( 'Add Coupon', 'wp-e-commerce' ); ?></h2>
4
  <form name='add_coupon' method="post" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
5
  <table class="form-table">
6
  <tbody>
9
 
10
  <tr class="form-field">
11
  <th scope="row" valign="top">
12
+ <label for="add_coupon_code"><?php _e( 'Coupon Code', 'wp-e-commerce' ); ?></label>
13
  </th>
14
  <td>
15
  <input name="add_coupon_code" id="add_coupon_code" type="text" style="width: 300px;"/>
16
+ <p class="description"><?php _e( 'The code entered to receive the discount', 'wp-e-commerce' ); ?></p>
17
  </td>
18
  </tr>
19
 
20
  <tr class="form-field" id="discount_amount">
21
  <th scope="row" valign="top">
22
+ <label for="add-coupon-code"><?php _e( 'Discount', 'wp-e-commerce' ); ?></label>
23
  </th>
24
  <td>
25
  <input name="add_discount" step=".01" id="add-coupon-code" type="number" class="small-text" min="0" style="width: 300px" />
26
+ <p class="description"><?php _e( 'The discount amount', 'wp-e-commerce' ); ?></p>
27
  </td>
28
  </tr>
29
 
30
  <tr class="form-field">
31
  <th scope="row" valign="top">
32
+ <label for="add_discount_type"><?php _e( 'Discount Type', 'wp-e-commerce' ); ?></label>
33
  </th>
34
  <td>
35
  <select name='add_discount_type' id='add_discount_type'>
36
+ <option value='0'><?php _e( 'Fixed Amount', 'wp-e-commerce' ); ?></option>
37
+ <option value='1'><?php _e( 'Percentage', 'wp-e-commerce' ); ?></option>
38
+ <option value='2'><?php _e( 'Free shipping', 'wp-e-commerce' ); ?></option>
39
  </select>
40
+ <p class="description"><?php _e( 'The discount type', 'wp-e-commerce' ); ?></p>
41
  </td>
42
  </tr>
43
 
44
  <tr class="form-field">
45
  <th scope="row" valign="top">
46
+ <label for="add_start"><?php _e( 'Start and End', 'wp-e-commerce' ); ?></label>
47
  </th>
48
  <td>
49
+ <span class="description"><?php _e( 'Start: ', 'wp-e-commerce' ); ?></span>
50
  <input name="add_start" id="add_start" type="text" class="regular-text pickdate" style="width: 100px"/>
51
+ <span class="description"><?php _e( 'End: ', 'wp-e-commerce' ); ?></span>
52
  <input name="add_end" id="add_end" type="text" class="regular-text pickdate" style="width: 100px"/>
53
+ <p class="description"><?php _e( 'If date fields are left empty, there will be no expiration on this coupon.', 'wp-e-commerce' ); ?></p>
54
  </td>
55
  </tr>
56
 
57
  <tr>
58
  <th scope="row" valign="top">
59
+ <?php _e( 'Active', 'wp-e-commerce' ); ?>
60
  </th>
61
  <td>
62
  <input type='hidden' value='0' name='add_active' />
63
  <input type="checkbox" value='1' checked='checked' name='add_active' id="add_active" />
64
+ <label for="add_active"><?php _e( 'Activate coupon on creation.', 'wp-e-commerce' ) ?></label>
65
  </td>
66
  </tr>
67
 
68
  <tr>
69
  <th scope="row" valign="top">
70
+ <?php _e( 'Use Once', 'wp-e-commerce' ); ?>
71
  </th>
72
  <td>
73
  <input type='hidden' value='0' name='add_use-once' />
74
  <input type='checkbox' value='1' name='add_use-once' id="add_use-once" />
75
+ <label for="add_use-once"><?php _e( 'Deactivate coupon after it has been used.', 'wp-e-commerce' ) ?></label>
76
  </td>
77
  </tr>
78
 
79
  <tr>
80
  <th scope="row" valign="top">
81
+ <?php _e( 'Apply On All Products', 'wp-e-commerce' ); ?>
82
  </th>
83
  <td>
84
  </span><input type='hidden' value='0' name='add_every_product' />
85
  <input type="checkbox" value="1" name='add_every_product' id="add_every-product"/>
86
+ <label for="add_every-product"><?php _e( 'This coupon affects each product at checkout.', 'wp-e-commerce' ) ?></label>
87
  </td>
88
  </tr>
89
 
90
  <tr class="form-field coupon-conditions">
91
  <th scope="row" valign="top">
92
+ <label><strong><?php _e( 'Conditions', 'wp-e-commerce' ); ?></strong></label>
93
  </th>
94
  <td>
95
  <input type="hidden" name="rules[operator][]" value="" />
96
  <div class='coupon-condition'>
97
  <select class="ruleprops" name="rules[property][]">
98
+ <option value="item_name" rel="order"><?php _e( 'Item name', 'wp-e-commerce' ); ?></option>
99
+ <option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wp-e-commerce' ); ?></option>
100
+ <option value="total_quantity" rel="order"><?php _e( 'Total quantity', 'wp-e-commerce' ); ?></option>
101
+ <option value="subtotal_amount" rel="order"><?php _e( 'Subtotal amount', 'wp-e-commerce' ); ?></option>
102
  <?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
103
  </select>
104
 
105
  <select name="rules[logic][]">
106
+ <option value="equal"><?php _e( 'Is equal to', 'wp-e-commerce' ); ?></option>
107
+ <option value="greater"><?php _e( 'Is greater than', 'wp-e-commerce' ); ?></option>
108
+ <option value="less"><?php _e( 'Is less than', 'wp-e-commerce' ); ?></option>
109
+ <option value="contains"><?php _e( 'Contains', 'wp-e-commerce' ); ?></option>
110
+ <option value="not_contain"><?php _e( 'Does not contain', 'wp-e-commerce' ); ?></option>
111
+ <option value="begins"><?php _e( 'Begins with', 'wp-e-commerce' ); ?></option>
112
+ <option value="ends"><?php _e( 'Ends with', 'wp-e-commerce' ); ?></option>
113
+ <option value="category"><?php _e( 'In Category', 'wp-e-commerce' ); ?></option>
114
  <?php echo apply_filters( 'wpsc_coupon_rule_logic_options', '' ); ?>
115
  </select>
116
 
117
  <input type="text" name="rules[value][]" style="width: 150px;"/>
118
+ <a title="<?php esc_attr_e( 'Delete condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
119
+ <a title="<?php esc_attr_e( 'Add condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
120
  </div>
121
  </td>
122
  </tr>
126
  </tbody>
127
  </table>
128
  <?php wp_nonce_field( 'wpsc_coupon', 'wpsc-coupon-add' ); ?>
129
+ <?php submit_button( __( 'Add Coupon', 'wp-e-commerce' ), 'primary', 'add_coupon' ); ?>
130
 
131
  </form>
132
  </div>
wpsc-admin/display-coupon-edit.php CHANGED
@@ -1,15 +1,16 @@
1
  <?php
2
 
3
- // die if accessed directly
4
- if( !defined( 'ABSPATH' ) )
5
  die();
 
 
 
6
 
7
- $coupon_id = absint( $_GET['coupon'] );
8
- $coupon = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = %d", $coupon_id ), ARRAY_A );
9
  ?>
10
  <div class="wrap" id="coupon_data">
11
  <div id="edit_coupon_box">
12
- <h2><?php _e( 'Edit Coupon', 'wpsc' ); ?></h2>
13
 
14
  <script type='text/javascript'>
15
  jQuery(".pickdate").datepicker();
@@ -22,40 +23,40 @@ $coupon = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_COUP
22
  <table class="form-table">
23
  <tbody>
24
 
25
- <?php do_action( 'wpsc_coupon_edit_top', $coupon_id, $coupon ); ?>
26
 
27
  <tr class="form-field">
28
  <th scope="row" valign="top">
29
- <label for="edit_coupon_code"><?php _e( 'Coupon Code', 'wpsc' ); ?></label>
30
  </th>
31
  <td>
32
- <input name="edit_coupon_code" id="edit_coupon_code" type="text" value="<?php esc_attr_e( $coupon['coupon_code'] ); ?>" style="width: 300px;"/>
33
- <p class="description"><?php _e( 'The code entered to receive the discount', 'wpsc' ); ?></p>
34
  </td>
35
  </tr>
36
 
37
  <tr class="form-field" id="discount_amount">
38
  <th scope="row" valign="top">
39
- <label for="edit_coupon_amount"><?php _e( 'Discount', 'wpsc' ); ?></label>
40
  </th>
41
  <td>
42
- <input name="edit_coupon_amount" id="edit_coupon_amount" type="number" step=".01" value="<?php esc_attr_e( $coupon['value'] ); ?>" class="small-text" min="0" style="width: 300px" />
43
- <p class="description"><?php _e( 'The discount amount', 'wpsc' ); ?></p>
44
  </td>
45
  </tr>
46
 
47
  <tr class="form-field">
48
  <th scope="row" valign="top">
49
- <label for="edit_discount_type"><?php _e( 'Discount Type', 'wpsc' ); ?></label>
50
  </th>
51
  <td>
52
- <?php $type = absint( $coupon['is-percentage'] ); ?>
53
  <select name='edit_discount_type' id='edit_discount_type'>
54
- <option value='0'<?php selected( 0, $type ); ?>><?php _e( 'Fixed Amount', 'wpsc' ); ?></option>
55
- <option value='1'<?php selected( 1, $type ); ?>><?php _e( 'Percentage', 'wpsc' ); ?></option>
56
- <option value='2'<?php selected( 2, $type ); ?>><?php _e( 'Free shipping', 'wpsc' ); ?></option>
57
  </select>
58
- <p class="description"><?php _e( 'The discount type', 'wpsc' ); ?></p>
59
 
60
  <?php $display = $type == 2 ? '' : 'style="display:none;"'; ?>
61
  </td>
@@ -63,62 +64,62 @@ $coupon = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_COUP
63
 
64
  <tr class="form-field">
65
  <th scope="row" valign="top">
66
- <label for="edit_coupon_start"><?php _e( 'Start and End', 'wpsc' ); ?></label>
67
  </th>
68
  <td>
69
  <?php
70
- $start = $coupon['start'] == '0000-00-00 00:00:00' ? '' : get_date_from_gmt( $coupon['start'], 'Y-m-d' );
71
- $end = $coupon['expiry'] == '0000-00-00 00:00:00' ? '' : get_date_from_gmt( $coupon['expiry'], 'Y-m-d' );
72
  ?>
73
- <span class="description"><?php _e( 'Start: ', 'wpsc' ); ?></span>
74
- <input name="edit_coupon_start" id="edit_coupon_start" type="text" value="<?php esc_attr_e( $start ); ?>" class="regular-text pickdate" style="width: 100px"/>
75
- <span class="description"><?php _e( 'End: ', 'wpsc' ); ?></span>
76
- <input name="edit_coupon_end" id="edit_coupon_end" type="text" value="<?php esc_attr_e( $end ); ?>" class="regular-text pickdate" style="width: 100px"/>
77
- <p class="description"><?php _e( 'If date fields are left empty, there will be no expiration on this coupon.', 'wpsc' ); ?></p>
78
  </td>
79
  </tr>
80
 
81
  <tr>
82
  <th scope="row" valign="top">
83
- <?php _e( 'Active', 'wpsc' ); ?>
84
  </th>
85
  <td>
86
  <input type='hidden' value='0' name='edit_coupon_active' />
87
- <input type="checkbox" value='1'<?php checked( 1, $coupon['active'] ); ?> name='edit_coupon_active' id="edit_coupon_active" />
88
- <label for="edit_coupon_active"><?php _e( 'Is this coupon active?', 'wpsc' ) ?></label>
89
  </td>
90
  </tr>
91
 
92
  <tr>
93
  <th scope="row" valign="top">
94
- <?php _e( 'Use Once', 'wpsc' ); ?>
95
  </th>
96
  <td>
97
  <input type='hidden' value='0' name='edit_coupon_use_once' />
98
- <input type='checkbox' value='1'<?php checked( 1, $coupon['use-once'] ); ?> name='edit_coupon_use_once' id="edit_coupon_use_once" />
99
- <label for="edit_coupon_use_once"><?php _e( 'Deactivate coupon after it has been used.', 'wpsc' ) ?></label>
100
  </td>
101
  </tr>
102
 
103
  <tr>
104
  <th scope="row" valign="top">
105
- <?php _e( 'Apply On All Products', 'wpsc' ); ?>
106
  </th>
107
  <td>
108
  </span><input type='hidden' value='0' name='edit_coupon_every_product' />
109
- <input type="checkbox" value="1"<?php checked( 1, $coupon['every_product'] ); ?> name='edit_coupon_every_product' id="edit-coupon-every-product"/>
110
- <label for="edit-coupon-every-product"><?php _e( 'This coupon affects each product at checkout.', 'wpsc' ) ?></label>
111
  </td>
112
  </tr>
113
 
114
  <tr class="form-field coupon-conditions">
115
  <th scope="row" valign="top">
116
- <label><strong><?php _e( 'Conditions', 'wpsc' ); ?></strong></label>
117
  </th>
118
  <td>
119
  <input type="hidden" name="rules[operator][]" value="" />
120
  <?php
121
- $conditions = maybe_unserialize( $coupon['condition'] );
122
 
123
  if ( empty( $conditions ) )
124
  $conditions = array(
@@ -135,47 +136,47 @@ $coupon = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_COUP
135
  if ( isset( $condition["operator"] ) && ! empty( $condition["operator"] ) ) :
136
  ?>
137
  <select name="rules[operator][]">
138
- <option value="and"<?php selected( 'and', $condition["operator"] ); ?>><?php _ex( 'AND', 'Coupon comparison logic', 'wpsc' );?></option>
139
- <option value="or"<?php selected( 'or' , $condition["operator"] ); ?>><?php _ex( 'OR' , 'Coupon comparison logic', 'wpsc' );?></option>
140
  </select>
141
  <?php endif; ?>
142
  <select class="ruleprops" name="rules[property][]">
143
- <option value="item_name"<?php selected( 'item_name', $condition['property'] ); ?> rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
144
- <option value="item_quantity"<?php selected( 'item_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
145
- <option value="total_quantity"<?php selected( 'total_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Total quantity', 'wpsc' ); ?></option>
146
- <option value="subtotal_amount"<?php selected( 'subtotal_amount', $condition['property'] ); ?> rel="order"><?php _e( 'Subtotal amount', 'wpsc' ); ?></option>
147
  <?php do_action( 'wpsc_coupon_rule_property_options', $condition['property'] ); ?>
148
  </select>
149
 
150
  <select name="rules[logic][]">
151
- <option value="equal"<?php selected( 'equal', $condition['logic'] ); ?>><?php _e( 'Is equal to', 'wpsc' ); ?></option>
152
- <option value="greater"<?php selected( 'greater', $condition['logic'] ); ?>><?php _e( 'Is greater than', 'wpsc' ); ?></option>
153
- <option value="less"<?php selected( 'less', $condition['logic'] ); ?>><?php _e( 'Is less than', 'wpsc' ); ?></option>
154
- <option value="contains"<?php selected( 'contains', $condition['logic'] ); ?>><?php _e( 'Contains', 'wpsc' ); ?></option>
155
- <option value="not_contain"<?php selected( 'not_contain', $condition['logic'] ); ?>><?php _e( 'Does not contain', 'wpsc' ); ?></option>
156
- <option value="begins"<?php selected( 'begins', $condition['logic'] ); ?>><?php _e( 'Begins with', 'wpsc' ); ?></option>
157
- <option value="ends"<?php selected( 'ends', $condition['logic'] ); ?>><?php _e( 'Ends with', 'wpsc' ); ?></option>
158
- <option value="category"<?php selected( 'category', $condition['logic'] ); ?>><?php _e( 'In Category', 'wpsc' ); ?></option>
159
  </select>
160
 
161
- <input type="text" name="rules[value][]" value="<?php esc_attr_e( $condition['value'] ); ?>" style="width: 150px;"/>
162
- <a title="<?php esc_attr_e( 'Delete condition', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wpsc' ); ?></a>
163
- <a title="<?php esc_attr_e( 'Add condition', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wpsc' ); ?></a>
164
  </div>
165
  <?php endforeach; ?>
166
  </td>
167
  </tr>
168
 
169
- <?php do_action( 'wpsc_coupon_edit_top', $coupon_id, $coupon ); ?>
170
 
171
  </tbody>
172
  </table>
173
- <input type="hidden" name="coupon_id" value="<?php echo esc_attr( $coupon_id ); ?>"/>
174
- <input type="hidden" name="edit_coupon_is_used" value="<?php echo esc_attr( $coupon['is-used'] ); ?>"/>
175
  <input type="hidden" name="is_edit_coupon" value="true" />
176
 
177
  <?php wp_nonce_field( 'wpsc_coupon', 'wpsc-coupon-edit' ); ?>
178
- <?php submit_button( __( 'Update Coupon', 'wpsc' ), 'primary' ); ?>
179
 
180
  </form>
181
  </div>
1
  <?php
2
 
3
+ // Die if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
  die();
6
+ }
7
+
8
+ $coupon = new WPSC_Coupon( $_GET['coupon'] );
9
 
 
 
10
  ?>
11
  <div class="wrap" id="coupon_data">
12
  <div id="edit_coupon_box">
13
+ <h2><?php _e( 'Edit Coupon', 'wp-e-commerce' ); ?></h2>
14
 
15
  <script type='text/javascript'>
16
  jQuery(".pickdate").datepicker();
23
  <table class="form-table">
24
  <tbody>
25
 
26
+ <?php do_action( 'wpsc_coupon_edit_top', $coupon->get( 'id' ), $coupon->get_data() ); ?>
27
 
28
  <tr class="form-field">
29
  <th scope="row" valign="top">
30
+ <label for="edit_coupon_code"><?php _e( 'Coupon Code', 'wp-e-commerce' ); ?></label>
31
  </th>
32
  <td>
33
+ <input name="edit_coupon_code" id="edit_coupon_code" type="text" value="<?php echo esc_attr( $coupon->get( 'coupon_code' ) ); ?>" style="width: 300px;"/>
34
+ <p class="description"><?php _e( 'The code entered to receive the discount', 'wp-e-commerce' ); ?></p>
35
  </td>
36
  </tr>
37
 
38
  <tr class="form-field" id="discount_amount">
39
  <th scope="row" valign="top">
40
+ <label for="edit_coupon_amount"><?php _e( 'Discount', 'wp-e-commerce' ); ?></label>
41
  </th>
42
  <td>
43
+ <input name="edit_coupon_amount" id="edit_coupon_amount" type="number" step=".01" value="<?php echo esc_attr( $coupon->get( 'value' ) ); ?>" class="small-text" min="0" style="width: 300px" />
44
+ <p class="description"><?php _e( 'The discount amount', 'wp-e-commerce' ); ?></p>
45
  </td>
46
  </tr>
47
 
48
  <tr class="form-field">
49
  <th scope="row" valign="top">
50
+ <label for="edit_discount_type"><?php _e( 'Discount Type', 'wp-e-commerce' ); ?></label>
51
  </th>
52
  <td>
53
+ <?php $type = absint( $coupon->get( 'is-percentage' ) ); ?>
54
  <select name='edit_discount_type' id='edit_discount_type'>
55
+ <option value='0'<?php selected( 0, $type ); ?>><?php _e( 'Fixed Amount', 'wp-e-commerce' ); ?></option>
56
+ <option value='1'<?php selected( 1, $type ); ?>><?php _e( 'Percentage', 'wp-e-commerce' ); ?></option>
57
+ <option value='2'<?php selected( 2, $type ); ?>><?php _e( 'Free shipping', 'wp-e-commerce' ); ?></option>
58
  </select>
59
+ <p class="description"><?php _e( 'The discount type', 'wp-e-commerce' ); ?></p>
60
 
61
  <?php $display = $type == 2 ? '' : 'style="display:none;"'; ?>
62
  </td>
64
 
65
  <tr class="form-field">
66
  <th scope="row" valign="top">
67
+ <label for="edit_coupon_start"><?php _e( 'Start and End', 'wp-e-commerce' ); ?></label>
68
  </th>
69
  <td>
70
  <?php
71
+ $start = $coupon->get( 'start' ) == '0000-00-00 00:00:00' ? '' : get_date_from_gmt( $coupon->get( 'start' ), 'Y-m-d' );
72
+ $end = $coupon->get( 'expiry' ) == '0000-00-00 00:00:00' ? '' : get_date_from_gmt( $coupon->get( 'expiry' ), 'Y-m-d' );
73
  ?>
74
+ <span class="description"><?php _e( 'Start: ', 'wp-e-commerce' ); ?></span>
75
+ <input name="edit_coupon_start" id="edit_coupon_start" type="text" value="<?php echo esc_attr( $start ); ?>" class="regular-text pickdate" style="width: 100px"/>
76
+ <span class="description"><?php _e( 'End: ', 'wp-e-commerce' ); ?></span>
77
+ <input name="edit_coupon_end" id="edit_coupon_end" type="text" value="<?php echo esc_attr( $end ); ?>" class="regular-text pickdate" style="width: 100px"/>
78
+ <p class="description"><?php _e( 'If date fields are left empty, there will be no expiration on this coupon.', 'wp-e-commerce' ); ?></p>
79
  </td>
80
  </tr>
81
 
82
  <tr>
83
  <th scope="row" valign="top">
84
+ <?php _e( 'Active', 'wp-e-commerce' ); ?>
85
  </th>
86
  <td>
87
  <input type='hidden' value='0' name='edit_coupon_active' />
88
+ <input type="checkbox" value='1'<?php checked( 1, $coupon->get( 'active' ) ); ?> name='edit_coupon_active' id="edit_coupon_active" />
89
+ <label for="edit_coupon_active"><?php _e( 'Is this coupon active?', 'wp-e-commerce' ) ?></label>
90
  </td>
91
  </tr>
92
 
93
  <tr>
94
  <th scope="row" valign="top">
95
+ <?php _e( 'Use Once', 'wp-e-commerce' ); ?>
96
  </th>
97
  <td>
98
  <input type='hidden' value='0' name='edit_coupon_use_once' />
99
+ <input type='checkbox' value='1'<?php checked( 1, $coupon->get( 'use-once' ) ); ?> name='edit_coupon_use_once' id="edit_coupon_use_once" />
100
+ <label for="edit_coupon_use_once"><?php _e( 'Deactivate coupon after it has been used.', 'wp-e-commerce' ) ?></label>
101
  </td>
102
  </tr>
103
 
104
  <tr>
105
  <th scope="row" valign="top">
106
+ <?php _e( 'Apply On All Products', 'wp-e-commerce' ); ?>
107
  </th>
108
  <td>
109
  </span><input type='hidden' value='0' name='edit_coupon_every_product' />
110
+ <input type="checkbox" value="1"<?php checked( 1, $coupon->get( 'every_product' ) ); ?> name='edit_coupon_every_product' id="edit-coupon-every-product"/>
111
+ <label for="edit-coupon-every-product"><?php _e( 'This coupon affects each product at checkout.', 'wp-e-commerce' ) ?></label>
112
  </td>
113
  </tr>
114
 
115
  <tr class="form-field coupon-conditions">
116
  <th scope="row" valign="top">
117
+ <label><strong><?php _e( 'Conditions', 'wp-e-commerce' ); ?></strong></label>
118
  </th>
119
  <td>
120
  <input type="hidden" name="rules[operator][]" value="" />
121
  <?php
122
+ $conditions = maybe_unserialize( $coupon->get( 'condition' ) );
123
 
124
  if ( empty( $conditions ) )
125
  $conditions = array(
136
  if ( isset( $condition["operator"] ) && ! empty( $condition["operator"] ) ) :
137
  ?>
138
  <select name="rules[operator][]">
139
+ <option value="and"<?php selected( 'and', $condition["operator"] ); ?>><?php _ex( 'AND', 'Coupon comparison logic', 'wp-e-commerce' );?></option>
140
+ <option value="or"<?php selected( 'or' , $condition["operator"] ); ?>><?php _ex( 'OR' , 'Coupon comparison logic', 'wp-e-commerce' );?></option>
141
  </select>
142
  <?php endif; ?>
143
  <select class="ruleprops" name="rules[property][]">
144
+ <option value="item_name"<?php selected( 'item_name', $condition['property'] ); ?> rel="order"><?php _e( 'Item name', 'wp-e-commerce' ); ?></option>
145
+ <option value="item_quantity"<?php selected( 'item_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Item quantity', 'wp-e-commerce' ); ?></option>
146
+ <option value="total_quantity"<?php selected( 'total_quantity', $condition['property'] ); ?> rel="order"><?php _e( 'Total quantity', 'wp-e-commerce' ); ?></option>
147
+ <option value="subtotal_amount"<?php selected( 'subtotal_amount', $condition['property'] ); ?> rel="order"><?php _e( 'Subtotal amount', 'wp-e-commerce' ); ?></option>
148
  <?php do_action( 'wpsc_coupon_rule_property_options', $condition['property'] ); ?>
149
  </select>
150
 
151
  <select name="rules[logic][]">
152
+ <option value="equal"<?php selected( 'equal', $condition['logic'] ); ?>><?php _e( 'Is equal to', 'wp-e-commerce' ); ?></option>
153
+ <option value="greater"<?php selected( 'greater', $condition['logic'] ); ?>><?php _e( 'Is greater than', 'wp-e-commerce' ); ?></option>
154
+ <option value="less"<?php selected( 'less', $condition['logic'] ); ?>><?php _e( 'Is less than', 'wp-e-commerce' ); ?></option>
155
+ <option value="contains"<?php selected( 'contains', $condition['logic'] ); ?>><?php _e( 'Contains', 'wp-e-commerce' ); ?></option>
156
+ <option value="not_contain"<?php selected( 'not_contain', $condition['logic'] ); ?>><?php _e( 'Does not contain', 'wp-e-commerce' ); ?></option>
157
+ <option value="begins"<?php selected( 'begins', $condition['logic'] ); ?>><?php _e( 'Begins with', 'wp-e-commerce' ); ?></option>
158
+ <option value="ends"<?php selected( 'ends', $condition['logic'] ); ?>><?php _e( 'Ends with', 'wp-e-commerce' ); ?></option>
159
+ <option value="category"<?php selected( 'category', $condition['logic'] ); ?>><?php _e( 'In Category', 'wp-e-commerce' ); ?></option>
160
  </select>
161
 
162
+ <input type="text" name="rules[value][]" value="<?php echo esc_attr( $condition['value'] ); ?>" style="width: 150px;"/>
163
+ <a title="<?php esc_attr_e( 'Delete condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
164
+ <a title="<?php esc_attr_e( 'Add condition', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
165
  </div>
166
  <?php endforeach; ?>
167
  </td>
168
  </tr>
169
 
170
+ <?php do_action( 'wpsc_coupon_edit_bottom', $coupon->get( 'id' ), $coupon->get_data() ); ?>
171
 
172
  </tbody>
173
  </table>
174
+ <input type="hidden" name="coupon_id" value="<?php echo esc_attr( $coupon->get( 'id' ) ); ?>"/>
175
+ <input type="hidden" name="edit_coupon_is_used" value="<?php echo esc_attr( $coupon->get( 'is-used' ) ); ?>"/>
176
  <input type="hidden" name="is_edit_coupon" value="true" />
177
 
178
  <?php wp_nonce_field( 'wpsc_coupon', 'wpsc-coupon-edit' ); ?>
179
+ <?php submit_button( __( 'Update Coupon', 'wp-e-commerce' ), 'primary' ); ?>
180
 
181
  </form>
182
  </div>
wpsc-admin/display-coupons.php CHANGED
@@ -36,35 +36,23 @@ function wpsc_display_coupons_page() {
36
  unset( $new_rules[$key] );
37
  }
38
 
39
- $insert = $wpdb->insert(
40
- WPSC_TABLE_COUPON_CODES,
41
- array(
42
- 'coupon_code' => $coupon_code,
43
- 'value' => $discount,
44
- 'is-percentage' => $discount_type,
45
- 'use-once' => $use_once,
46
- 'is-used' => 0,
47
- 'active' => $is_active,
48
- 'every_product' => $every_product,
49
- 'start' => $start_date,
50
- 'expiry' => $end_date,
51
- 'condition' => serialize( $new_rules )
52
- ),
53
- array(
54
- '%s',
55
- '%f',
56
- '%s',
57
- '%s',
58
- '%s',
59
- '%s',
60
- '%s',
61
- '%s',
62
- '%s',
63
- '%s',
64
- )
65
- );
66
- if ( $insert )
67
- echo "<div class='updated'><p>" . __( 'The coupon has been added.', 'wpsc' ) . "</p></div>";
68
 
69
  }
70
 
@@ -87,39 +75,26 @@ function wpsc_display_coupons_page() {
87
  unset( $new_rules[$key] );
88
  }
89
 
90
- $update = $wpdb->update(
91
- WPSC_TABLE_COUPON_CODES,
92
- array(
93
- 'coupon_code' => $_POST['edit_coupon_code'],
94
- 'value' => $_POST['edit_coupon_amount'],
95
- 'is-percentage' => $_POST['edit_discount_type'],
96
- 'use-once' => $_POST['edit_coupon_use_once'],
97
- 'is-used' => $_POST['edit_coupon_is_used'],
98
- 'active' => $_POST['edit_coupon_active'],
99
- 'every_product' => $_POST['edit_coupon_every_product'],
100
- 'start' => ! empty( $_POST['edit_coupon_start'] ) ? get_gmt_from_date( $_POST['edit_coupon_start'] . ' 00:00:00' ) : null,
101
- 'expiry' => ! empty( $_POST['edit_coupon_end'] ) ? get_gmt_from_date( $_POST['edit_coupon_end'] . ' 23:59:59' ) : null,
102
- 'condition' => serialize( $new_rules )
103
- ),
104
- array( 'id' => absint( $_POST['coupon_id'] ) ),
105
- array(
106
- '%s',
107
- '%f',
108
- '%s',
109
- '%s',
110
- '%s',
111
- '%s',
112
- '%s',
113
- '%s',
114
- '%s',
115
- '%s'
116
- ),
117
- array( '%d' )
118
- );
119
 
120
  if ( $update ) {
121
- echo "<div class='updated'><p>" . __( 'The coupon has been updated.', 'wpsc' ) . "</p></div>";
122
  }
 
123
  }
124
  }
125
 
@@ -140,7 +115,7 @@ function wpsc_display_coupons_page() {
140
  $coupons_table = new WPSC_Coupons_List_Table();
141
  $coupons_table->prepare_items(); ?>
142
  <div class="wrap">
143
- <h2><?php _e( 'Coupons', 'wpsc' ); ?><a href="<?php echo esc_url( add_query_arg( 'wpsc-action', 'add_coupon' ) ); ?>" class="add-new-h2"><?php _e( 'Add Coupon', 'wpsc' ); ?></a></h2>
144
  <?php do_action( 'wpsc_coupons_page_top' ); ?>
145
  <form id="wpsc-coupons-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
146
 
36
  unset( $new_rules[$key] );
37
  }
38
 
39
+ $new_coupon = new WPSC_Coupon( array(
40
+ 'coupon_code' => $coupon_code,
41
+ 'value' => $discount,
42
+ 'is-percentage' => $discount_type,
43
+ 'use-once' => $use_once,
44
+ 'is-used' => 0,
45
+ 'active' => $is_active,
46
+ 'every_product' => $every_product,
47
+ 'start' => $start_date,
48
+ 'expiry' => $end_date,
49
+ 'condition' => $new_rules
50
+ ) );
51
+ $insert = $new_coupon->save();
52
+
53
+ if ( $insert ) {
54
+ echo '<div class="updated"><p>' . __( 'The coupon has been added.', 'wp-e-commerce' ) . '</p></div>';
55
+ }
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  }
58
 
75
  unset( $new_rules[$key] );
76
  }
77
 
78
+ $update_coupon = new WPSC_Coupon( $_POST['coupon_id'] );
79
+ $update_coupon->set( array(
80
+ 'coupon_code' => $_POST['edit_coupon_code'],
81
+ 'value' => $_POST['edit_coupon_amount'],
82
+ 'is-percentage' => $_POST['edit_discount_type'],
83
+ 'use-once' => $_POST['edit_coupon_use_once'],
84
+ 'is-used' => $_POST['edit_coupon_is_used'],
85
+ 'active' => $_POST['edit_coupon_active'],
86
+ 'every_product' => $_POST['edit_coupon_every_product'],
87
+ 'start' => ! empty( $_POST['edit_coupon_start'] ) ? get_gmt_from_date( $_POST['edit_coupon_start'] . ' 00:00:00' ) : null,
88
+ 'expiry' => ! empty( $_POST['edit_coupon_end'] ) ? get_gmt_from_date( $_POST['edit_coupon_end'] . ' 23:59:59' ) : null,
89
+ 'condition' => $new_rules
90
+ ) );
91
+
92
+ $update = $update_coupon->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  if ( $update ) {
95
+ echo '<div class="updated"><p>' . __( 'The coupon has been updated.', 'wp-e-commerce' ) . '</p></div>';
96
  }
97
+
98
  }
99
  }
100
 
115
  $coupons_table = new WPSC_Coupons_List_Table();
116
  $coupons_table->prepare_items(); ?>
117
  <div class="wrap">
118
+ <h2><?php _e( 'Coupons', 'wp-e-commerce' ); ?><a href="<?php echo esc_url( add_query_arg( 'wpsc-action', 'add_coupon' ) ); ?>" class="add-new-h2"><?php _e( 'Add Coupon', 'wp-e-commerce' ); ?></a></h2>
119
  <?php do_action( 'wpsc_coupons_page_top' ); ?>
120
  <form id="wpsc-coupons-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
121
 
wpsc-admin/display-debug.page.php DELETED
@@ -1,353 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * WP eCommerce Debug page and functions
5
- *
6
- * This is debugging and unsafe updating code to debug or fix specific problems on some sites that is either not safe to run automatically or not usually needed
7
- * It is unwise to use anything on this page unless you know exactly what it will do and why you need to run it.
8
- *
9
- * @package wp-e-commerce
10
- * @since 3.7
11
- *
12
- * @uses wp_die() Kill WordPress execution and display HTML message with error message.
13
- * @uses $wpdb WordPress database variable for queries
14
- * @uses admin_url() Gets URL to the admin of the current site
15
- * @uses wp_nonce_url() Retrieve URL with nonce added to URL query.
16
- * @uses wpsc_convert_products_to_posts() Converts legacy data format to post_types
17
- * @todo docs
18
- */
19
- function wpsc_debug_page() {
20
- if ( !current_user_can('manage_options') )
21
- wp_die("You don't look like an administrator.");
22
-
23
- $fixpage = admin_url( 'admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs' );
24
- ?>
25
- <div class="wrap">
26
- <h2>Debugging Page</h2>
27
- <?php
28
- if ( !isset( $_GET['wpsc_debug_action'] ) ) {
29
- ?>
30
- <p>
31
- This is debugging and unsafe updating code to debug or fix specific problems on some sites that is either not safe to run automatically or not usually needed<br />
32
- It is unwise to use anything on this page unless you know exactly what it will do and why you need to run it.
33
- </p>
34
- <h4>Action List</h4>
35
- <ul>
36
- <li>
37
- <a href='?page=wpsc-debug&amp;wpsc_debug_action=convert_products_to_posts'>Convert Products to Posts</a>
38
- </li>
39
- <li>
40
- <a href='?page=wpsc-debug&amp;wpsc_debug_action=phpinfo'>Display phpinfo</a>
41
- </li>
42
- <li>
43
- <a href='?page=wpsc-debug&amp;wpsc_debug_action=wpsc_expire_subscriptions'>Expire Subscriptions</a>
44
- </li>
45
- <li>
46
- <a href='<?php echo $fixpage; ?>'>Fix Purchaselogs</a>
47
- </li>
48
- <li>
49
- <a href='<?php echo wp_nonce_url("?wpsc_admin_action=update_page_urls"); ?>' ><?php _e('Update Page URLs', 'wpsc'); ?></a>
50
- </li>
51
- <li>
52
- <a href='<?php echo wp_nonce_url("?wpsc_admin_action=clean_categories"); ?>'><?php _e('Fix Product Group Permalinks', 'wpsc'); ?></a>
53
- </li>
54
- </ul>
55
- <?php
56
- if ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && (constant( 'WPSC_ADD_DEBUG_PAGE' ) == true) ) {
57
- ?>
58
- <h4>Development Code List</h4>
59
- <p> And this code is probably useless for anything other than working out how to write better code to do the same thing, unless you want to do that, leave it alone</p>
60
- <ul>
61
- <li>
62
- <a href='?page=wpsc-debug&amp;wpsc_debug_action=unicode_permalinks'>Test Unicode Category permalinks</a>
63
- </li>
64
-
65
- <li>
66
- <a href='?page=wpsc-debug&amp;wpsc_debug_action=create_also_bought_list'>Create also bought list</a>
67
- </li>
68
- </ul>
69
- <?php
70
- }
71
- }
72
- ?>
73
- <pre style='font-family:\"Lucida Grande\",Verdana,Arial,\"Bitstream Vera Sans\",sans-serif; font-size:8px;'><?php
74
- switch ( $_GET['wpsc_debug_action'] ) {
75
- case 'convert_products_to_posts':
76
- wpsc_convert_products_to_posts();
77
- break;
78
-
79
- case 'download_links':
80
- wpsc_group_and_update_download_links();
81
- break;
82
-
83
-
84
- case 'product_url_names':
85
- wpsc_clean_product_url_names();
86
- break;
87
-
88
- case 'redo_product_url_names':
89
- wpsc_redo_product_url_names();
90
- break;
91
-
92
-
93
- case 'test_copying_themes':
94
- wpsc_test_copying_themes();
95
- break;
96
-
97
- case 'test_making_product_url_names':
98
- wpsc_test_making_product_url_names();
99
- break;
100
-
101
- case 'resize_thumbnails':
102
- wpsc_mass_resize_thumbnails_and_clean_images();
103
- break;
104
-
105
- case 'images_reupload':
106
- wpsc_update_image_records( true );
107
- break;
108
-
109
- case 'filters':
110
- global $wp_filter, $merged_filters;
111
- print_r( $wp_filter );
112
- break;
113
-
114
- case 'wpsc_expire_subscriptions':
115
- if ( function_exists( 'wpsc_expire_subscriptions' ) ) {
116
- wpsc_expire_subscriptions();
117
- }
118
- break;
119
-
120
- case 'phpinfo':
121
- echo "</pre>";
122
- phpinfo();
123
- echo "<pre style='font-family:\"Lucida Grande\",Verdana,Arial,\"Bitstream Vera Sans\",sans-serif; font-size:8px;'>";
124
- break;
125
-
126
- case 'wp-cron':
127
- $cron = get_option( 'cron' );
128
- print_r( $cron );
129
- break;
130
-
131
- case 'wp_get_object_terms':
132
- global $wp_taxonomies;
133
- $tags = wp_get_object_terms( 108, 'product_tag', array( 'fields' => 'names' ) );
134
- print_r( $tags );
135
- break;
136
-
137
- case 'unicode_permalinks':
138
- $original_string = "バンプ・オブ・チキン";
139
- $sanitized_string = sanitize_title( $original_string );
140
- $string_regex = str_replace( "%", "\x", $sanitized_string );
141
- $full_regex = "/^({$string_regex}){1}$/";
142
-
143
- echo "Original String: {$original_string} \n";
144
- echo "Sanitized String: {$sanitized_string} \n";
145
- echo "String regex: {$string_regex} \n";
146
- echo "Full regex: {$full_regex} \n";
147
-
148
- if ( preg_match( $full_regex, $original_string ) ) {
149
- echo "<strong>Matches</strong>";
150
- } else {
151
- echo "<strong>Does Not Match</strong>";
152
- }
153
-
154
- break;
155
- }
156
- ?></pre>
157
- </div>
158
- <?php
159
- }
160
-
161
- function wpsc_test_copying_themes() {
162
- if ( !current_user_can('manage_options') )
163
- wp_die("You don't look like an administrator.");
164
-
165
- $new_dir = @opendir( WPSC_THEMES_PATH );
166
- $num = 0;
167
- $file_names = array();
168
-
169
- while ( false !== ( $file = @readdir( $new_dir ) ) ) {
170
- if ( is_dir( WPSC_THEMES_PATH . $file ) && ( $file != ".." ) && ( $file != "." ) ) {
171
- $file_names[] = $file;
172
- }
173
- }
174
-
175
- if ( count( $file_names ) < 1 ) {
176
- $old_dir = @opendir( WPSC_CORE_THEME_PATH );
177
- while ( ($file = @readdir( $old_dir )) !== false ) {
178
- if ( is_dir( WPSC_CORE_THEME_PATH . $file ) && ( $file != ".." ) && ( $file != "." ) ) {
179
- $success = wpsc_recursive_copy( WPSC_CORE_THEME_PATH . $file, WPSC_THEMES_PATH . $file );
180
- echo "old_file:" . WPSC_CORE_THEME_PATH . $file . "<br />";
181
- echo "new_file:" . WPSC_THEMES_PATH . $file . "<br />";
182
- echo "<pre>" . print_r( $success, true ) . "</pre>";
183
- }
184
- }
185
- }
186
- }
187
-
188
- function wpsc_group_and_update_download_links() {
189
- if ( !current_user_can('manage_options') )
190
- wp_die("You don't look like an administrator.");
191
- global $wpdb;
192
- $unique_file_names = $wpdb->get_col( "SELECT DISTINCT `filename` FROM `" . WPSC_TABLE_PRODUCT_FILES . "`" );
193
- foreach ( (array)$unique_file_names as $filename ) {
194
- echo "$filename \n";
195
- $file_id_list = array( );
196
- $file_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `filename` IN ('$filename')", ARRAY_A );
197
- foreach ( $file_data as $file_row ) {
198
- $file_id_list[] = $file_row['id'];
199
- }
200
- $product_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `file` IN ('" . implode( "', '", $file_id_list ) . "') AND `active` IN('1') ORDER BY `id` DESC LIMIT 1 ", ARRAY_A );
201
- $product_id = $product_data['id'];
202
- if ( $product_id > 0 ) {
203
- if ( $wpdb->query( "UPDATE `" . WPSC_TABLE_PRODUCT_FILES . "` SET `product_id` = '{$product_id}' WHERE `id` IN ('" . implode( "', '", $file_id_list ) . "')" ) ) {
204
- if ( $wpdb->query( "UPDATE `" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `product_id` = '{$product_id}' WHERE `fileid` IN ('" . implode( "', '", $file_id_list ) . "')" ) ) {
205
- echo "$filename done \n";
206
- }
207
- }
208
- }
209
- }
210
- }
211
-
212
- /**
213
- * wpsc_clean_product_url_names, cleans dupicates
214
- */
215
- function wpsc_clean_product_url_names() {
216
- if ( !current_user_can('manage_options') )
217
- wp_die("You don't look like an administrator.");
218
- global $wpdb;
219
-
220
- $duplicated_meta_data = $wpdb->get_col( "SELECT `meta_value` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `meta_key` IN('url_name') GROUP BY `meta_value` HAVING COUNT(`meta_value`) > 1 " );
221
-
222
- $product_data = $wpdb->get_results( "SELECT DISTINCT `products`.* FROM `" . WPSC_TABLE_PRODUCTMETA . "` AS `meta` LEFT JOIN `" . WPSC_TABLE_PRODUCT_LIST . "` AS `products` ON `meta`.`product_id` = `products`.`id` WHERE `meta`.`meta_key` IN('url_name') AND `meta`.`meta_value` IN('" . implode( "', '", $duplicated_meta_data ) . "') AND `products`.`active` = '1' ORDER BY `meta`.`meta_value` DESC", ARRAY_A );
223
-
224
- foreach ( (array)$product_data as $product_row ) {
225
- if ( $product_row['name'] != '' ) {
226
- $tidied_name = strtolower( trim( stripslashes( $product_row['name'] ) ) );
227
- $url_name = sanitize_title( $tidied_name );
228
- $similar_names = $wpdb->get_row( "SELECT COUNT(*) AS `count`, MAX(REPLACE(`meta_value`, '$url_name', '')) AS `max_number` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `meta_key` IN ('url_name') AND `meta_value` REGEXP '^($url_name){1}[[:digit:]]*$' ", ARRAY_A );
229
- $extension_number = '';
230
- if ( $similar_names['count'] > 0 ) {
231
- $extension_number = (int)$similar_names['max_number'] + 1;
232
- }
233
- $url_name .= $extension_number;
234
- echo "{$product_row['name']} => {$url_name}\n\r";
235
- update_product_meta( $product_row['id'], 'url_name', $url_name );
236
- }
237
- }
238
- }
239
-
240
- /**
241
- * wpsc_redo_product_url_names, deletes all product URL names, then remakes then
242
- */
243
- function wpsc_redo_product_url_names() {
244
- if ( !current_user_can('manage_options') )
245
- wp_die("You don't look like an administrator.");
246
- global $wpdb;
247
-
248
- $product_data = $wpdb->get_results( "SELECT DISTINCT `products`.* FROM `" . WPSC_TABLE_PRODUCTMETA . "` AS `meta` LEFT JOIN `" . WPSC_TABLE_PRODUCT_LIST . "` AS `products` ON `meta`.`product_id` = `products`.`id` WHERE `products`.`active` = '1' ORDER BY `meta`.`meta_value` DESC", ARRAY_A );
249
-
250
- foreach ( (array)$product_data as $product_row ) {
251
- $product_id = $product_row['id'];
252
- $post_data = $product_row;
253
-
254
-
255
- if ( $post_data['name'] != '' ) {
256
- $existing_name = get_product_meta( $product_id, 'url_name' );
257
- $tidied_name = strtolower( trim( stripslashes( $post_data['name'] ) ) );
258
- $url_name = sanitize_title( $tidied_name );
259
-
260
- $similar_names = (array)$wpdb->get_col( "SELECT `meta_value` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `product_id` NOT IN('{$product_id}}') AND `meta_key` IN ('url_name') AND `meta_value` REGEXP '^(" . $wpdb->escape( preg_quote( $url_name ) ) . "){1}[[:digit:]]*$' " );
261
-
262
- echo "<strong>Product {$product_id}:</strong> {$product_row['name']}\n";
263
- echo "Current Name: {$existing_name}\n";
264
- echo "Originally Proposed Name: {$url_name}\n";
265
-
266
- if ( array_search( $url_name, $similar_names ) !== false ) {
267
- $i = 0;
268
- do {
269
- $i++;
270
- echo "Proposed Name #$i: " . ($url_name . $i) . "\n";
271
- } while ( array_search( ($url_name . $i ), $similar_names ) !== false );
272
- $url_name .= $i;
273
- }
274
- echo "Accepted Name: {$url_name}\n";
275
-
276
-
277
- if ( $existing_name != $url_name ) {
278
- update_product_meta( $product_id, 'url_name', $url_name );
279
- }
280
-
281
- echo "\n";
282
- }
283
- }
284
- }
285
-
286
- function wpsc_recreate_product_url_names() {
287
- if ( !current_user_can('manage_options') )
288
- wp_die("You don't look like an administrator.");
289
- global $wpdb;
290
-
291
- $product_data = $wpdb->get_results( "SELECT `id`, `name` FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `active` IN ('1')", ARRAY_A );
292
- echo "<pre>";
293
- foreach ( $product_data as $product_row ) {
294
- $product_id = $product_row['id'];
295
- $tidied_name = trim( $product_row['name'] );
296
- $tidied_name = strtolower( $tidied_name );
297
- $url_name = sanitize_title( $tidied_name );
298
-
299
- echo "<strong>Product {$product_id}:</strong> {$product_row['name']}\n";
300
-
301
- echo "Originally Proposed Name: {$url_name}\n";
302
- $similar_names = (array)$wpdb->get_col( "SELECT `meta_value` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `product_id` NOT IN('{$product_id}}') AND `meta_key` IN ('url_name') AND `meta_value` REGEXP '^(" . $wpdb->escape( preg_quote( $url_name ) ) . "){1}[[:digit:]]*$' " );
303
-
304
- if ( array_search( $url_name, $similar_names ) !== false ) {
305
- // If it is, try to add a number to the end, if that is taken, try the next highest number...
306
- $i = 0;
307
- do {
308
- $i++;
309
- if ( $i > 100 ) {
310
- break;
311
- }
312
- echo "Proposed Name #$i: " . ($url_name . $i) . "\n";
313
- } while ( array_search( ($url_name . $i ), $similar_names ) !== false );
314
- // Concatenate the first number found that wasn't taken
315
- $url_name .= $i;
316
- }
317
-
318
- echo "Accepted Name: {$url_name}\n";
319
- $existing_name = get_product_meta( $product_id, 'url_name', true );
320
- if ( is_array( $existing_name ) ) {
321
- $existing_name = array_pop( $existing_name );
322
- }
323
- if ( $existing_name != $url_name ) {
324
- update_product_meta( $product_id, 'url_name', $url_name );
325
- }
326
-
327
- echo "\n\n\n";
328
- }
329
- }
330
-
331
- function wpsc_mass_resize_thumbnails_and_clean_images() {
332
- if ( !current_user_can('manage_options') )
333
- wp_die("You don't look like an administrator.");
334
- global $wpdb;
335
-
336
- $height = get_option( 'product_image_height' );
337
- $width = get_option( 'product_image_width' );
338
-
339
- $product_data = $wpdb->get_results( "SELECT `product`.`id`, `product`.`image` AS `image_id`, `images`.`image` AS `file` FROM `" . WPSC_TABLE_PRODUCT_LIST . "` AS `product` INNER JOIN `" . WPSC_TABLE_PRODUCT_IMAGES . "` AS `images` ON `product`.`image` = `images`.`id` WHERE `product`.`image` > 0 ", ARRAY_A );
340
- foreach ( (array)$product_data as $product ) {
341
- $image_input = WPSC_IMAGE_DIR . $product['file'];
342
- $image_output = WPSC_THUMBNAIL_DIR . $product['file'];
343
- if ( ($product['file'] != '') and file_exists( $image_input ) ) {
344
- image_processing( $image_input, $image_output, $width, $height );
345
- update_product_meta( $product['id'], 'thumbnail_width', $width );
346
- update_product_meta( $product['id'], 'thumbnail_height', $height );
347
- } else {
348
- $wpdb->query( "DELETE FROM `" . WPSC_TABLE_PRODUCT_IMAGES . "` WHERE `id` IN('{$product['image_id']}') LIMIT 1" );
349
- $wpdb->query( "UPDATE `" . WPSC_TABLE_PRODUCT_LIST . "` SET `image` = NULL WHERE `id` = '" . $product['id'] . "' LIMIT 1" );
350
- }
351
- }
352
- $wpdb->query( "DELETE FROM `" . WPSC_TABLE_PRODUCT_IMAGES . "` WHERE `product_id` IN('0')" );
353
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/display-items.page.php CHANGED
@@ -8,7 +8,6 @@
8
  * @since 3.7
9
  */
10
 
11
-
12
  require_once(WPSC_FILE_PATH . '/wpsc-admin/includes/products.php');
13
 
14
  /**
@@ -24,16 +23,16 @@ function wpsc_additional_column_names( $columns ){
24
 
25
  $columns['cb'] = '<input type="checkbox" />';
26
  $columns['image'] = '';
27
- $columns['title'] = __('Name', 'wpsc');
28
- $columns['stock'] = __('Stock', 'wpsc');
29
- $columns['price'] = __('Price', 'wpsc');
30
- $columns['sale_price'] = __('Sale', 'wpsc');
31
- $columns['SKU'] = __('SKU', 'wpsc');
32
- $columns['weight'] = __('Weight', 'wpsc');
33
- $columns['cats'] = __('Categories', 'wpsc');
34
- $columns['featured'] = '<img src="' . WPSC_CORE_IMAGES_URL . '/black-star.png" alt="' . __( 'Featured', 'wpsc' ) . '" title="' . __( 'Featured', 'wpsc' ) . '">';
35
  $columns['hidden_alerts'] = '';
36
- $columns['date'] = __('Date', 'wpsc');
37
 
38
  return $columns;
39
  }
@@ -93,7 +92,7 @@ add_action( 'wpsc_manage_products_column_image', '_wpsc_manage_products_column_i
93
  */
94
  function _wpsc_manage_products_column_weight( $post, $post_id, $has_variations ) {
95
  if( $has_variations ) {
96
- esc_html_e( 'N/A', 'wpsc' );
97
  return;
98
  }
99
  $product_data = array();
@@ -140,7 +139,7 @@ function _wpsc_manage_products_column_stock( $post, $post_id, $has_variations )
140
  $stock = get_post_meta( $post->ID, '_wpsc_stock', true );
141
 
142
  if( $stock == '' )
143
- $stock = __('N/A', 'wpsc');
144
 
145
  if ( $has_variations ) {
146
  echo '~ ' . wpsc_variations_stock_remaining( $post->ID );
@@ -223,7 +222,7 @@ add_action( 'wpsc_manage_products_column_sale_price', '_wpsc_manage_products_col
223
  function _wpsc_manage_products_column_sku( $post, $post_id ) {
224
  $sku = get_post_meta( $post->ID, '_wpsc_sku', true );
225
  if( $sku == '' )
226
- $sku = __('N/A', 'wpsc');
227
 
228
  echo $sku;
229
  echo '<div id="inline_' . $post->ID . '_sku" class="hidden">' . esc_html( $sku ) . '</div>';
@@ -251,7 +250,7 @@ function _wpsc_manage_products_column_cats( $post, $post_id ) {
251
  $out[] = "<a href='?post_type=wpsc-product&amp;wpsc_product_category={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . "</a>";
252
  echo join( ', ', $out );
253
  } else {
254
- _e('Uncategorized', 'wpsc');
255
  }
256
  }
257
  add_action( 'wpsc_manage_products_column_cats', '_wpsc_manage_products_column_cats', 10, 2 );
@@ -272,10 +271,10 @@ function _wpsc_manage_products_column_featured( $post, $post_id ) {
272
  $featured_product_url = wp_nonce_url( "index.php?wpsc_admin_action=update_featured_product&amp;product_id=$post->ID", 'feature_product_' . $post->ID);
273
  if ( in_array( $post->ID, (array) get_option( 'sticky_products' ) ) ) {
274
  $class = 'gold-star';
275
- $title = __( 'Unmark as Featured', 'wpsc' );
276
  } else {
277
  $class = 'grey-star';
278
- $title = __( 'Mark as Featured', 'wpsc' );
279
  }
280
  ?>
281
  <a class="wpsc_featured_product_toggle featured_toggle_<?php echo $post->ID; ?> <?php echo esc_attr( $class ); ?>" href='<?php echo $featured_product_url; ?>' title="<?php echo esc_attr( $title ); ?>" ></a>
@@ -406,7 +405,7 @@ function wpsc_cats_restrict_manage_posts() {
406
  // retrieve array of term objects per taxonomy
407
  // output html for taxonomy dropdown filter
408
  echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
409
- echo "<option value=''>" . esc_html( sprintf( _x( 'Show All %s', 'Show all [category name]', 'wpsc' ), $tax_name ) ) . "</option>";
410
  wpsc_cats_restrict_manage_posts_print_terms($tax_slug);
411
  echo "</select>";
412
  }
@@ -503,7 +502,7 @@ add_filter( 'manage_wpsc-product_posts_columns' , 'wpsc_additional_column
503
 
504
 
505
  /**
506
- * wpsc_update_featured_products function.
507
  *
508
  * @access public
509
  * @return void
@@ -545,7 +544,7 @@ function wpsc_update_featured_products() {
545
 
546
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
547
  $json_response = array(
548
- 'text' => $new_status ? esc_attr__( 'Unmark as Featured', 'wpsc' ) : esc_attr__( 'Mark as Featured', 'wpsc' ),
549
  'product_id' => $product_id,
550
  'color' => $new_status ? 'gold-star' : 'grey-star',
551
  'image' => $new_status ? WPSC_CORE_IMAGES_URL . '/gold-star.png' : WPSC_CORE_IMAGES_URL . '/grey-star.png'
@@ -579,7 +578,7 @@ function wpsc_action_row( $actions, $post ) {
579
  $url = admin_url( 'edit.php' );
580
  $url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
581
 
582
- $actions['duplicate'] = '<a href="'.esc_url( $url ).'">' . esc_html_x( 'Duplicate', 'row-actions', 'wpsc' ) . '</a>';
583
  return $actions;
584
  }
585
 
8
  * @since 3.7
9
  */
10
 
 
11
  require_once(WPSC_FILE_PATH . '/wpsc-admin/includes/products.php');
12
 
13
  /**
23
 
24
  $columns['cb'] = '<input type="checkbox" />';
25
  $columns['image'] = '';
26
+ $columns['title'] = __('Name', 'wp-e-commerce');
27
+ $columns['stock'] = __('Stock', 'wp-e-commerce');
28
+ $columns['price'] = __('Price', 'wp-e-commerce');
29
+ $columns['sale_price'] = __('Sale', 'wp-e-commerce');
30
+ $columns['SKU'] = __('SKU', 'wp-e-commerce');
31
+ $columns['weight'] = __('Weight', 'wp-e-commerce');
32
+ $columns['cats'] = __('Categories', 'wp-e-commerce');
33
+ $columns['featured'] = '<img src="' . WPSC_CORE_IMAGES_URL . '/black-star.png" alt="' . __( 'Featured', 'wp-e-commerce' ) . '" title="' . __( 'Featured', 'wp-e-commerce' ) . '">';
34
  $columns['hidden_alerts'] = '';
35
+ $columns['date'] = __('Date', 'wp-e-commerce');
36
 
37
  return $columns;
38
  }
92
  */
93
  function _wpsc_manage_products_column_weight( $post, $post_id, $has_variations ) {
94
  if( $has_variations ) {
95
+ esc_html_e( 'N/A', 'wp-e-commerce' );
96
  return;
97
  }
98
  $product_data = array();
139
  $stock = get_post_meta( $post->ID, '_wpsc_stock', true );
140
 
141
  if( $stock == '' )
142
+ $stock = __('N/A', 'wp-e-commerce');
143
 
144
  if ( $has_variations ) {
145
  echo '~ ' . wpsc_variations_stock_remaining( $post->ID );
222
  function _wpsc_manage_products_column_sku( $post, $post_id ) {
223
  $sku = get_post_meta( $post->ID, '_wpsc_sku', true );
224
  if( $sku == '' )
225
+ $sku = __('N/A', 'wp-e-commerce');
226
 
227
  echo $sku;
228
  echo '<div id="inline_' . $post->ID . '_sku" class="hidden">' . esc_html( $sku ) . '</div>';
250
  $out[] = "<a href='?post_type=wpsc-product&amp;wpsc_product_category={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . "</a>";
251
  echo join( ', ', $out );
252
  } else {
253
+ _e('Uncategorized', 'wp-e-commerce');
254
  }
255
  }
256
  add_action( 'wpsc_manage_products_column_cats', '_wpsc_manage_products_column_cats', 10, 2 );
271
  $featured_product_url = wp_nonce_url( "index.php?wpsc_admin_action=update_featured_product&amp;product_id=$post->ID", 'feature_product_' . $post->ID);
272
  if ( in_array( $post->ID, (array) get_option( 'sticky_products' ) ) ) {
273
  $class = 'gold-star';
274
+ $title = __( 'Unmark as Featured', 'wp-e-commerce' );
275
  } else {
276
  $class = 'grey-star';
277
+ $title = __( 'Mark as Featured', 'wp-e-commerce' );
278
  }
279
  ?>
280
  <a class="wpsc_featured_product_toggle featured_toggle_<?php echo $post->ID; ?> <?php echo esc_attr( $class ); ?>" href='<?php echo $featured_product_url; ?>' title="<?php echo esc_attr( $title ); ?>" ></a>
405
  // retrieve array of term objects per taxonomy
406
  // output html for taxonomy dropdown filter
407
  echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
408
+ echo "<option value=''>" . esc_html( sprintf( _x( 'Show All %s', 'Show all [category name]', 'wp-e-commerce' ), $tax_name ) ) . "</option>";
409
  wpsc_cats_restrict_manage_posts_print_terms($tax_slug);
410
  echo "</select>";
411
  }
502
 
503
 
504
  /**
505
+ * Update featured prodcuts using AJAX.
506
  *
507
  * @access public
508
  * @return void
544
 
545
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
546
  $json_response = array(
547
+ 'text' => $new_status ? esc_attr__( 'Unmark as Featured', 'wp-e-commerce' ) : esc_attr__( 'Mark as Featured', 'wp-e-commerce' ),
548
  'product_id' => $product_id,
549
  'color' => $new_status ? 'gold-star' : 'grey-star',
550
  'image' => $new_status ? WPSC_CORE_IMAGES_URL . '/gold-star.png' : WPSC_CORE_IMAGES_URL . '/grey-star.png'
578
  $url = admin_url( 'edit.php' );
579
  $url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
580
 
581
+ $actions['duplicate'] = '<a href="'.esc_url( $url ).'">' . esc_html_x( 'Duplicate', 'row-actions', 'wp-e-commerce' ) . '</a>';
582
  return $actions;
583
  }
584
 
wpsc-admin/display-options-settings.page.php CHANGED
@@ -1,8 +1,16 @@
1
  <?php
2
- /*
3
  * Display Settings page
 
 
 
4
  */
5
 
 
 
 
 
 
6
  function wpsc_display_settings_page() {
7
  WPSC_Settings_Page::get_instance()->display();
8
  }
@@ -31,28 +39,28 @@ function wpsc_settings_page_update_notification() {
31
  <?php
32
 
33
  if ( isset( $_GET['updated'] ) && (int)$_GET['updated'] ) {
34
- printf( _n( '%s Setting options updated.', ' %s Settings options updated.', $_GET['updated'], 'wpsc' ), absint( $_GET['updated'] ) );
35
  unset( $_GET['updated'] );
36
  $message = true;
37
  }
38
  if ( isset( $_GET['deleted'] ) && (int)$_GET['deleted'] ) {
39
- printf( _n( '%s Setting option deleted.', '%s Setting option deleted.', $_GET['deleted'], 'wpsc' ), absint( $_GET['deleted'] ) );
40
  unset( $_GET['deleted'] );
41
  $message = true;
42
  }
43
  if ( isset( $_GET['shipadd'] ) && (int)$_GET['shipadd'] ) {
44
- printf( _n( '%s Shipping option updated.', '%s Shipping option updated.', $_GET['shipadd'], 'wpsc' ), absint( $_GET['shipadd'] ) );
45
  unset( $_GET['shipadd'] );
46
  $message = true;
47
  }
48
  if ( isset( $_GET['added'] ) && (int)$_GET['added'] ) {
49
- printf( _n( '%s Checkout field added.', '%s Checkout fields added.', $_GET['added'], 'wpsc' ), absint( $_GET['added'] ) );
50
  unset( $_GET['added'] );
51
  $message = true;
52
  }
53
 
54
  if ( ! isset( $message ) )
55
- _e( 'Settings successfully updated.', 'wpsc' );
56
 
57
  $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'locked', 'regenerate', 'skipped', 'updated', 'deleted', 'wpsc_downloadcsv', 'rss_key', 'start_timestamp', 'end_timestamp', 'email_buyer_id' ), $_SERVER['REQUEST_URI'] ) ); ?>
58
  </p></div>
@@ -61,4 +69,4 @@ function wpsc_settings_page_update_notification() {
61
  }
62
  }
63
 
64
- ?>
1
  <?php
2
+ /**
3
  * Display Settings page
4
+ *
5
+ * @package wp-e-commerce
6
+ * @since 3.8
7
  */
8
 
9
+ /**
10
+ * Get the WPSC_Settings_Page class to display the page
11
+ *
12
+ * @since 3.8.9
13
+ */
14
  function wpsc_display_settings_page() {
15
  WPSC_Settings_Page::get_instance()->display();
16
  }
39
  <?php
40
 
41
  if ( isset( $_GET['updated'] ) && (int)$_GET['updated'] ) {
42
+ printf( _n( '%s Setting options updated.', ' %s Settings options updated.', $_GET['updated'], 'wp-e-commerce' ), absint( $_GET['updated'] ) );
43
  unset( $_GET['updated'] );
44
  $message = true;
45
  }
46
  if ( isset( $_GET['deleted'] ) && (int)$_GET['deleted'] ) {
47
+ printf( _n( '%s Setting option deleted.', '%s Setting option deleted.', $_GET['deleted'], 'wp-e-commerce' ), absint( $_GET['deleted'] ) );
48
  unset( $_GET['deleted'] );
49
  $message = true;
50
  }
51
  if ( isset( $_GET['shipadd'] ) && (int)$_GET['shipadd'] ) {
52
+ printf( _n( '%s Shipping option updated.', '%s Shipping option updated.', $_GET['shipadd'], 'wp-e-commerce' ), absint( $_GET['shipadd'] ) );
53
  unset( $_GET['shipadd'] );
54
  $message = true;
55
  }
56
  if ( isset( $_GET['added'] ) && (int)$_GET['added'] ) {
57
+ printf( _n( '%s Checkout field added.', '%s Checkout fields added.', $_GET['added'], 'wp-e-commerce' ), absint( $_GET['added'] ) );
58
  unset( $_GET['added'] );
59
  $message = true;
60
  }
61
 
62
  if ( ! isset( $message ) )
63
+ _e( 'Settings successfully updated.', 'wp-e-commerce' );
64
 
65
  $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'locked', 'regenerate', 'skipped', 'updated', 'deleted', 'wpsc_downloadcsv', 'rss_key', 'start_timestamp', 'end_timestamp', 'email_buyer_id' ), $_SERVER['REQUEST_URI'] ) ); ?>
66
  </p></div>
69
  }
70
  }
71
 
72
+ ?>
wpsc-admin/display-sales-logs.php CHANGED
@@ -54,23 +54,23 @@ class WPSC_Purchase_Log_Page {
54
  private function purchase_logs_fix_options( $id ) {
55
  ?>
56
  <select name='<?php echo $id; ?>'>
57
- <option value='-1'><?php echo esc_html_x( 'Select an Option', 'Dropdown default when called in uniquename dropdown', 'wpsc' ); ?></option>
58
- <option value='billingfirstname'><?php esc_html_e( 'Billing First Name', 'wpsc' ); ?></option>
59
- <option value='billinglastname'><?php esc_html_e( 'Billing Last Name', 'wpsc' ); ?></option>
60
- <option value='billingaddress'><?php esc_html_e( 'Billing Address', 'wpsc' ); ?></option>
61
- <option value='billingcity'><?php esc_html_e( 'Billing City', 'wpsc' ); ?></option>
62
- <option value='billingstate'><?php esc_html_e( 'Billing State', 'wpsc' ); ?></option>
63
- <option value='billingcountry'><?php esc_html_e( 'Billing Country', 'wpsc' ); ?></option>
64
- <option value='billingemail'><?php esc_html_e( 'Billing Email', 'wpsc' ); ?></option>
65
- <option value='billingphone'><?php esc_html_e( 'Billing Phone', 'wpsc' ); ?></option>
66
- <option value='billingpostcode'><?php esc_html_e( 'Billing Post Code', 'wpsc' ); ?></option>
67
- <option value='shippingfirstname'><?php esc_html_e( 'Shipping First Name', 'wpsc' ); ?></option>
68
- <option value='shippinglastname'><?php esc_html_e( 'Shipping Last Name', 'wpsc' ); ?></option>
69
- <option value='shippingaddress'><?php esc_html_e( 'Shipping Address', 'wpsc' ); ?></option>
70
- <option value='shippingcity'><?php esc_html_e( 'Shipping City', 'wpsc' ); ?></option>
71
- <option value='shippingstate'><?php esc_html_e( 'Shipping State', 'wpsc' ); ?></option>
72
- <option value='shippingcountry'><?php esc_html_e( 'Shipping Country', 'wpsc' ); ?></option>
73
- <option value='shippingpostcode'><?php esc_html_e( 'Shipping Post Code', 'wpsc' ); ?></option>
74
  </select>
75
  <?php
76
  }
@@ -120,9 +120,9 @@ class WPSC_Purchase_Log_Page {
120
  public function display_upgrade_purchase_logs_3_8() {
121
  ?>
122
  <div class="wrap">
123
- <h2><?php echo esc_html( __('Sales', 'wpsc') ); ?> </h2>
124
  <div class="updated">
125
- <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wpsc' ), esc_url( remove_query_arg( 'c' ) ) ); ?></p>
126
  </div>
127
  </div>
128
  <?php
@@ -147,7 +147,7 @@ class WPSC_Purchase_Log_Page {
147
  $disabled = '';
148
  }
149
  ?>
150
- <a href='<?php esc_attr_e( $href ); ?>' class='prev-page <?php echo $disabled; ?>'>&lsaquo; <?php _e( 'Previous', 'wpsc' ); ?></a>
151
  <?php
152
 
153
  $max_purchase_id = wpsc_max_purchase_id();
@@ -158,7 +158,7 @@ class WPSC_Purchase_Log_Page {
158
  $disabled = '';
159
  }
160
  ?>
161
- <a href='<?php esc_attr_e( $href ); ?>' class='next-page <?php echo $disabled; ?>'><?php _e( 'Next', 'wpsc' ); ?> &rsaquo;</a>
162
 
163
  </span></span></span>
164
  <?php
@@ -171,7 +171,7 @@ class WPSC_Purchase_Log_Page {
171
  ?>
172
  <div class="metabox-holder">
173
  <div id="custom_checkout_fields" class="postbox">
174
- <h3 class='hndle'><?php esc_html_e( 'Additional Checkout Fields' , 'wpsc' ); ?></h3>
175
  <div class='inside'>
176
  <?php
177
  foreach( (array) $purchlogitem->additional_fields as $value ) {
@@ -183,7 +183,7 @@ class WPSC_Purchase_Log_Page {
183
  } else {
184
  $thevalue = esc_html( stripslashes( $value['value'] ));
185
  if ( empty( $thevalue ) ) {
186
- $thevalue = __( '<em>blank</em>', 'wpsc' );
187
  }
188
  ?>
189
  <p><strong><?php echo $value['name']; ?> :</strong> <?php echo $thevalue; ?></p>
@@ -198,23 +198,23 @@ class WPSC_Purchase_Log_Page {
198
  }
199
  }
200
 
201
- private function purchase_log_custom_fields(){
202
  if( wpsc_purchlogs_has_customfields() ){?>
203
  <div class='metabox-holder'>
204
  <div id='purchlogs_customfields' class='postbox'>
205
- <h3 class='hndle'><?php esc_html_e( 'Users Custom Fields' , 'wpsc' ); ?></h3>
206
  <div class='inside'>
207
  <?php $messages = wpsc_purchlogs_custommessages(); ?>
208
  <?php $files = wpsc_purchlogs_customfiles(); ?>
209
  <?php if(count($files) > 0){ ?>
210
- <h4><?php esc_html_e( 'Cart Items with Custom Files' , 'wpsc' ); ?>:</h4>
211
  <?php
212
  foreach($files as $file){
213
  echo $file;
214
  }
215
  }?>
216
  <?php if(count($messages) > 0){ ?>
217
- <h4><?php esc_html_e( 'Cart Items with Custom Messages' , 'wpsc' ); ?>:</h4>
218
  <?php
219
  foreach($messages as $message){
220
  echo esc_html( $message['title'] ) . ':<br />' . nl2br( esc_html( $message['message'] ) );
@@ -254,7 +254,7 @@ class WPSC_Purchase_Log_Page {
254
  public function controller_item_details() {
255
 
256
  if ( ! isset( $_REQUEST['id'] ) || ( isset( $_REQUEST['id'] ) && ! is_numeric( $_REQUEST['id'] ) ) ) {
257
- wp_die( __( 'Invalid sales log ID', 'wpsc' ) );
258
  }
259
 
260
  global $purchlogitem;
@@ -263,28 +263,29 @@ class WPSC_Purchase_Log_Page {
263
  $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
264
 
265
  $columns = array(
266
- 'title' => __( 'Name', 'wpsc' ),
267
- 'sku' => __( 'SKU', 'wpsc' ),
268
- 'quantity' => __( 'Quantity','wpsc' ),
269
- 'price' => __( 'Price', 'wpsc' ),
270
- 'shipping' => __( 'Item Shipping', 'wpsc'),
271
  );
272
 
273
  if ( wpec_display_product_tax() ) {
274
- $columns['tax'] = __( 'Item Tax', 'wpsc' );
275
  }
276
 
277
- $columns['total'] = __( 'Item Total','wpsc' );
278
 
279
  register_column_headers( 'wpsc_purchase_log_item_details', $columns );
280
 
281
  add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_purchase_log' ) );
 
282
  }
283
 
284
  public function controller_packing_slip() {
285
 
286
  if ( ! isset( $_REQUEST['id'] ) || ( isset( $_REQUEST['id'] ) && ! is_numeric( $_REQUEST['id'] ) ) ) {
287
- wp_die( __( 'Invalid sales log ID', 'wpsc' ) );
288
  }
289
 
290
  global $purchlogitem;
@@ -292,18 +293,18 @@ class WPSC_Purchase_Log_Page {
292
  $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
293
 
294
  $columns = array(
295
- 'title' => __( 'Item Name', 'wpsc' ),
296
- 'sku' => __( 'SKU', 'wpsc' ),
297
- 'quantity' => __( 'Quantity', 'wpsc' ),
298
- 'price' => __( 'Price', 'wpsc' ),
299
- 'shipping' => __( 'Item Shipping','wpsc' ),
300
  );
301
 
302
  if ( wpec_display_product_tax() ) {
303
- $columns['tax'] = __( 'Item Tax', 'wpsc' );
304
  }
305
 
306
- $columns['total'] = __( 'Item Total','wpsc' );
307
 
308
  $cols = count( $columns ) - 2;
309
 
@@ -393,12 +394,11 @@ class WPSC_Purchase_Log_Page {
393
  return;
394
 
395
  $ids = array_map( 'intval', $_REQUEST['post'] );
396
- $in = implode( ', ', $ids );
397
- $wpdb->query( "DELETE FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE id IN ($in)" );
398
- $wpdb->query( "DELETE FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid IN ($in)" );
399
- $wpdb->query( "DELETE FROM " . WPSC_TABLE_SUBMITTED_FORM_DATA . " WHERE log_id IN ($in)" );
400
- $claimed_query = new WPSC_Claimed_Stock( array( 'cart_id' => $in ) );
401
- $claimed_query->clear_claimed_stock( 0 );
402
 
403
  $sendback = add_query_arg( array(
404
  'paged' => $_REQUEST['last_paged'],
@@ -409,7 +409,7 @@ class WPSC_Purchase_Log_Page {
409
  }
410
 
411
  // change status actions
412
- if ( is_numeric( $current_action ) && $current_action < 7 && ! empty( $_REQUEST['post'] ) ) {
413
 
414
  foreach ( $_REQUEST['post'] as $id )
415
  wpsc_purchlog_edit_status( $id, $current_action );
54
  private function purchase_logs_fix_options( $id ) {
55
  ?>
56
  <select name='<?php echo $id; ?>'>
57
+ <option value='-1'><?php echo esc_html_x( 'Select an Option', 'Dropdown default when called in uniquename dropdown', 'wp-e-commerce' ); ?></option>
58
+ <option value='billingfirstname'><?php esc_html_e( 'Billing First Name', 'wp-e-commerce' ); ?></option>
59
+ <option value='billinglastname'><?php esc_html_e( 'Billing Last Name', 'wp-e-commerce' ); ?></option>
60
+ <option value='billingaddress'><?php esc_html_e( 'Billing Address', 'wp-e-commerce' ); ?></option>
61
+ <option value='billingcity'><?php esc_html_e( 'Billing City', 'wp-e-commerce' ); ?></option>
62
+ <option value='billingstate'><?php esc_html_e( 'Billing State', 'wp-e-commerce' ); ?></option>
63
+ <option value='billingcountry'><?php esc_html_e( 'Billing Country', 'wp-e-commerce' ); ?></option>
64
+ <option value='billingemail'><?php esc_html_e( 'Billing Email', 'wp-e-commerce' ); ?></option>
65
+ <option value='billingphone'><?php esc_html_e( 'Billing Phone', 'wp-e-commerce' ); ?></option>
66
+ <option value='billingpostcode'><?php esc_html_e( 'Billing Post Code', 'wp-e-commerce' ); ?></option>
67
+ <option value='shippingfirstname'><?php esc_html_e( 'Shipping First Name', 'wp-e-commerce' ); ?></option>
68
+ <option value='shippinglastname'><?php esc_html_e( 'Shipping Last Name', 'wp-e-commerce' ); ?></option>
69
+ <option value='shippingaddress'><?php esc_html_e( 'Shipping Address', 'wp-e-commerce' ); ?></option>
70
+ <option value='shippingcity'><?php esc_html_e( 'Shipping City', 'wp-e-commerce' ); ?></option>
71
+ <option value='shippingstate'><?php esc_html_e( 'Shipping State', 'wp-e-commerce' ); ?></option>
72
+ <option value='shippingcountry'><?php esc_html_e( 'Shipping Country', 'wp-e-commerce' ); ?></option>
73
+ <option value='shippingpostcode'><?php esc_html_e( 'Shipping Post Code', 'wp-e-commerce' ); ?></option>
74
  </select>
75
  <?php
76
  }
120
  public function display_upgrade_purchase_logs_3_8() {
121
  ?>
122
  <div class="wrap">
123
+ <h2><?php echo esc_html( __('Sales', 'wp-e-commerce') ); ?> </h2>
124
  <div class="updated">
125
+ <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wp-e-commerce' ), esc_url( remove_query_arg( 'c' ) ) ); ?></p>
126
  </div>
127
  </div>
128
  <?php
147
  $disabled = '';
148
  }
149
  ?>
150
+ <a href='<?php esc_url( $href ); ?>' class='prev-page <?php echo $disabled; ?>'>&lsaquo; <?php _e( 'Previous', 'wp-e-commerce' ); ?></a>
151
  <?php
152
 
153
  $max_purchase_id = wpsc_max_purchase_id();
158
  $disabled = '';
159
  }
160
  ?>
161
+ <a href='<?php esc_url( $href ); ?>' class='next-page <?php echo $disabled; ?>'><?php _e( 'Next', 'wp-e-commerce' ); ?> &rsaquo;</a>
162
 
163
  </span></span></span>
164
  <?php
171
  ?>
172
  <div class="metabox-holder">
173
  <div id="custom_checkout_fields" class="postbox">
174
+ <h3 class='hndle'><?php esc_html_e( 'Additional Checkout Fields' , 'wp-e-commerce' ); ?></h3>
175
  <div class='inside'>
176
  <?php
177
  foreach( (array) $purchlogitem->additional_fields as $value ) {
183
  } else {
184
  $thevalue = esc_html( stripslashes( $value['value'] ));
185
  if ( empty( $thevalue ) ) {
186
+ $thevalue = __( '<em>blank</em>', 'wp-e-commerce' );
187
  }
188
  ?>
189
  <p><strong><?php echo $value['name']; ?> :</strong> <?php echo $thevalue; ?></p>
198
  }
199
  }
200
 
201
+ public function purchase_log_custom_fields(){
202
  if( wpsc_purchlogs_has_customfields() ){?>
203
  <div class='metabox-holder'>
204
  <div id='purchlogs_customfields' class='postbox'>
205
+ <h3 class='hndle'><?php esc_html_e( 'Users Custom Fields' , 'wp-e-commerce' ); ?></h3>
206
  <div class='inside'>
207
  <?php $messages = wpsc_purchlogs_custommessages(); ?>
208
  <?php $files = wpsc_purchlogs_customfiles(); ?>
209
  <?php if(count($files) > 0){ ?>
210
+ <h4><?php esc_html_e( 'Cart Items with Custom Files' , 'wp-e-commerce' ); ?>:</h4>
211
  <?php
212
  foreach($files as $file){
213
  echo $file;
214
  }
215
  }?>
216
  <?php if(count($messages) > 0){ ?>
217
+ <h4><?php esc_html_e( 'Cart Items with Custom Messages' , 'wp-e-commerce' ); ?>:</h4>
218
  <?php
219
  foreach($messages as $message){
220
  echo esc_html( $message['title'] ) . ':<br />' . nl2br( esc_html( $message['message'] ) );
254
  public function controller_item_details() {
255
 
256
  if ( ! isset( $_REQUEST['id'] ) || ( isset( $_REQUEST['id'] ) && ! is_numeric( $_REQUEST['id'] ) ) ) {
257
+ wp_die( __( 'Invalid sales log ID', 'wp-e-commerce' ) );
258
  }
259
 
260
  global $purchlogitem;
263
  $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
264
 
265
  $columns = array(
266
+ 'title' => __( 'Name', 'wp-e-commerce' ),
267
+ 'sku' => __( 'SKU', 'wp-e-commerce' ),
268
+ 'quantity' => __( 'Quantity','wp-e-commerce' ),
269
+ 'price' => __( 'Price', 'wp-e-commerce' ),
270
+ 'shipping' => __( 'Item Shipping', 'wp-e-commerce'),
271
  );
272
 
273
  if ( wpec_display_product_tax() ) {
274
+ $columns['tax'] = __( 'Item Tax', 'wp-e-commerce' );
275
  }
276
 
277
+ $columns['total'] = __( 'Item Total','wp-e-commerce' );
278
 
279
  register_column_headers( 'wpsc_purchase_log_item_details', $columns );
280
 
281
  add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_purchase_log' ) );
282
+ add_action( 'wpsc_purchlogitem_metabox_start', array( $this, 'purchase_log_custom_fields' ) );
283
  }
284
 
285
  public function controller_packing_slip() {
286
 
287
  if ( ! isset( $_REQUEST['id'] ) || ( isset( $_REQUEST['id'] ) && ! is_numeric( $_REQUEST['id'] ) ) ) {
288
+ wp_die( __( 'Invalid sales log ID', 'wp-e-commerce' ) );
289
  }
290
 
291
  global $purchlogitem;
293
  $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
294
 
295
  $columns = array(
296
+ 'title' => __( 'Item Name', 'wp-e-commerce' ),
297
+ 'sku' => __( 'SKU', 'wp-e-commerce' ),
298
+ 'quantity' => __( 'Quantity', 'wp-e-commerce' ),
299
+ 'price' => __( 'Price', 'wp-e-commerce' ),
300
+ 'shipping' => __( 'Item Shipping','wp-e-commerce' ),
301
  );
302
 
303
  if ( wpec_display_product_tax() ) {
304
+ $columns['tax'] = __( 'Item Tax', 'wp-e-commerce' );
305
  }
306
 
307
+ $columns['total'] = __( 'Item Total','wp-e-commerce' );
308
 
309
  $cols = count( $columns ) - 2;
310
 
394
  return;
395
 
396
  $ids = array_map( 'intval', $_REQUEST['post'] );
397
+
398
+ foreach ( $ids as $id ) {
399
+ $log = new WPSC_Purchase_Log( $id );
400
+ $log->delete();
401
+ }
 
402
 
403
  $sendback = add_query_arg( array(
404
  'paged' => $_REQUEST['last_paged'],
409
  }
410
 
411
  // change status actions
412
+ if ( is_numeric( $current_action ) && ! empty( $_REQUEST['post'] ) ) {
413
 
414
  foreach ( $_REQUEST['post'] as $id )
415
  wpsc_purchlog_edit_status( $id, $current_action );
wpsc-admin/display-update.page.php CHANGED
@@ -36,7 +36,7 @@ if ( ! get_option( 'wpsc_needs_update', false ) ) {
36
  if ( $product_count > 0 ) {
37
 
38
  function wpsc_display_update_notice() {
39
- echo "<div id='wpsc-warning' class='error fade'><p><strong>" . __( 'WP eCommerce is almost ready.', 'wpsc' ) . "</strong> " . sprintf( __( 'You must <a href="%1$s">update your database</a> to import all of your products.', 'wpsc' ), "admin.php?page=wpsc-update") . "</p></div>";
40
  }
41
 
42
  if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'wpsc-update' )
@@ -48,31 +48,39 @@ if ( ! get_option( 'wpsc_needs_update', false ) ) {
48
  }
49
  }
50
 
 
 
 
 
 
51
  function wpsc_display_php_version_notice() {
52
  ?>
53
- <div id='wpsc-warning' class='error fade'><p><?php printf( __( 'You are using PHP %s. WP eCommerce %s requires PHP 5.0 or above. Please contact your hosting provider for further assistance.', 'wpsc' ), PHP_VERSION, WPSC_VERSION ); ?></p></div>
54
  <?php
55
  }
56
 
 
 
 
57
  function wpsc_display_update_page() {
58
  global $wpdb;
59
  ?>
60
 
61
  <div class="wrap">
62
- <h2><?php esc_html_e( 'Update WP eCommerce', 'wpsc' ); ?> </h2>
63
  <br />
64
  <?php
65
  if ( isset( $_REQUEST['run_updates'] ) ) :
66
  ob_implicit_flush( true );
67
  $wpsc_update = WPSC_Update::get_instance();
68
  $update_stages = array(
69
- 'convert_category_groups' => __( 'Updating Categories...' , 'wpsc' ),
70
- 'convert_variation_sets' => __( 'Updating Variations...' , 'wpsc' ),
71
- 'convert_products_to_posts' => __( 'Updating Products ...' , 'wpsc' ),
72
- 'convert_variation_combinations' => __( 'Updating Child Products...', 'wpsc' ),
73
- 'update_files' => __( 'Updating Product Files...' , 'wpsc' ),
74
- 'update_purchase_logs' => __( 'Updating Purchase Logs... ', 'wpsc' ),
75
- 'create_or_update_tables' => __( 'Updating Database...' , 'wpsc' ),
76
  'update_database' => '',
77
  );
78
 
@@ -80,9 +88,9 @@ function wpsc_display_update_page() {
80
  $wpsc_update->run( $function, $message );
81
  }
82
 
83
- echo '<br /><br /><strong>' . esc_html__( 'WP eCommerce updated successfully!', 'wpsc' ) . '</strong><br />';
84
  if( '' != get_option('permalink_structure')){ ?>
85
- <em><?php echo esc_html( sprintf( __( 'Note: It looks like you have custom permalinks, you will need to refresh your permalinks <a href="%s">here</a>', 'wpsc' ) , admin_url( 'options-permalink.php' ) ) ); ?></em>
86
  <?php
87
  }
88
  update_option('wpsc_version', 3.8);
@@ -93,15 +101,15 @@ function wpsc_display_update_page() {
93
  else:
94
 
95
 
96
- esc_html_e( 'Your WP eCommerce database needs to be updated for WP eCommerce 3.8. To perform this update, press the button below. It is highly recommended that you back up your database before performing this update.', 'wpsc' );
97
  ?> <br />
98
  <br />
99
- <em><?php esc_html_e( 'Note: If the server times out or runs out of memory, just reload this page, the server will pick up where it left off.', 'wpsc' ); ?></em>
100
  <br />
101
 
102
  <form action="" method="post" id="setup">
103
  <input type="hidden" name="run_updates" value="true" id="run_updates">
104
- <p class="step"><input type="submit" class="button" value="<?php esc_attr_e( 'Update WP eCommerce', 'wpsc' ); ?>" name="Submit"></p>
105
  </form>
106
  <?php
107
  endif;
36
  if ( $product_count > 0 ) {
37
 
38
  function wpsc_display_update_notice() {
39
+ echo "<div id='wpsc-warning' class='error fade'><p><strong>" . __( 'WP eCommerce is almost ready.', 'wp-e-commerce' ) . "</strong> " . sprintf( __( 'You must <a href="%1$s">update your database</a> to import all of your products.', 'wp-e-commerce' ), "admin.php?page=wpsc-update") . "</p></div>";
40
  }
41
 
42
  if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'wpsc-update' )
48
  }
49
  }
50
 
51
+ /**
52
+ * Throw a warning if the PHP version is not compatible with WP e-Commerce
53
+ *
54
+ * @since 3.8
55
+ */
56
  function wpsc_display_php_version_notice() {
57
  ?>
58
+ <div id='wpsc-warning' class='error fade'><p><?php printf( __( 'You are using PHP %s. WP eCommerce %s requires PHP 5.0 or above. Please contact your hosting provider for further assistance.', 'wp-e-commerce' ), PHP_VERSION, WPSC_VERSION ); ?></p></div>
59
  <?php
60
  }
61
 
62
+ /**
63
+ * Display the "Update WP e-Commerce page"
64
+ */
65
  function wpsc_display_update_page() {
66
  global $wpdb;
67
  ?>
68
 
69
  <div class="wrap">
70
+ <h2><?php esc_html_e( 'Update WP eCommerce', 'wp-e-commerce' ); ?> </h2>
71
  <br />
72
  <?php
73
  if ( isset( $_REQUEST['run_updates'] ) ) :
74
  ob_implicit_flush( true );
75
  $wpsc_update = WPSC_Update::get_instance();
76
  $update_stages = array(
77
+ 'convert_category_groups' => __( 'Updating Categories...' , 'wp-e-commerce' ),
78
+ 'convert_variation_sets' => __( 'Updating Variations...' , 'wp-e-commerce' ),
79
+ 'convert_products_to_posts' => __( 'Updating Products ...' , 'wp-e-commerce' ),
80
+ 'convert_variation_combinations' => __( 'Updating Child Products...', 'wp-e-commerce' ),
81
+ 'update_files' => __( 'Updating Product Files...' , 'wp-e-commerce' ),
82
+ 'update_purchase_logs' => __( 'Updating Purchase Logs... ', 'wp-e-commerce' ),
83
+ 'create_or_update_tables' => __( 'Updating Database...' , 'wp-e-commerce' ),
84
  'update_database' => '',
85
  );
86
 
88
  $wpsc_update->run( $function, $message );
89
  }
90
 
91
+ echo '<br /><br /><strong>' . esc_html__( 'WP eCommerce updated successfully!', 'wp-e-commerce' ) . '</strong><br />';
92
  if( '' != get_option('permalink_structure')){ ?>
93
+ <em><?php echo esc_html( sprintf( __( 'Note: It looks like you have custom permalinks, you will need to refresh your permalinks <a href="%s">here</a>', 'wp-e-commerce' ) , admin_url( 'options-permalink.php' ) ) ); ?></em>
94
  <?php
95
  }
96
  update_option('wpsc_version', 3.8);
101
  else:
102
 
103
 
104
+ esc_html_e( 'Your WP eCommerce database needs to be updated for WP eCommerce 3.8. To perform this update, press the button below. It is highly recommended that you back up your database before performing this update.', 'wp-e-commerce' );
105
  ?> <br />
106
  <br />
107
+ <em><?php esc_html_e( 'Note: If the server times out or runs out of memory, just reload this page, the server will pick up where it left off.', 'wp-e-commerce' ); ?></em>
108
  <br />
109
 
110
  <form action="" method="post" id="setup">
111
  <input type="hidden" name="run_updates" value="true" id="run_updates">
112
+ <p class="step"><input type="submit" class="button" value="<?php esc_attr_e( 'Update WP eCommerce', 'wp-e-commerce' ); ?>" name="Submit"></p>
113
  </form>
114
  <?php
115
  endif;
wpsc-admin/display-upgrades.page.php CHANGED
@@ -1,77 +1,137 @@
1
  <?php
2
-
3
  function wpsc_display_upgrades_page() {
4
 
5
- do_action( 'wpsc_gold_module_activation' ); ?>
6
 
7
  <div class='wrap'>
8
  <div class='metabox-holder wpsc_gold_side'>
9
-
10
- <h2><?php esc_html_e( 'Upgrades', 'wpsc' ); ?></h2>
11
- <div>
12
- <?php if ( defined( 'WPSC_GOLD_MODULE_PRESENT' ) && ( true == WPSC_GOLD_MODULE_PRESENT ) ) {?>
13
- <p><?php esc_html_e( 'Enter your API Username and API Key below.', 'wpsc' ); ?></p>
14
- <p><a href="http://docs.wpecommerce.org/category/extending-your-store/premium-plugins/gold-cart/"><?php esc_html_e( 'For more information visit our documentation page.', 'wpsc' ); ?></a></p>
15
- <?php } ?>
16
- <div class='metabox-holder'>
17
- <form method='post' id='gold_cart_form' action=''>
18
-
19
- <?php
20
- if ( defined( 'WPSC_GOLD_MODULE_PRESENT' ) && ( true == WPSC_GOLD_MODULE_PRESENT ) ) {
21
- do_action( 'wpsc_gold_module_activation_forms' );
22
- } else {
23
- ?>
24
-
25
- <div id='wpsc_gold_options_outside'>
26
- <div class='form-wrap' >
27
- <p>
28
- <?php esc_html_e( "You don't have any Upgrades yet!", 'wpsc' ); ?>
29
- </p>
30
- </div>
31
- </div>
32
- <?php } ?>
33
- </form>
34
- <?php do_meta_boxes('wpsc_upgrade_page', 'top', true); ?>
35
- </div>
36
- </div>
37
-
38
- <strong><?php esc_html_e( 'WP eCommerce Upgrades', 'wpsc' ); ?></strong><br />
39
-
40
- <span><?php esc_html_e( 'Add more functionality to your eCommerce site. Prices may be subject to change.', 'wpsc' ); ?><input type='button' class='button-primary' onclick='window.open ("http://wpecommerce.org/store/premium-plugins/","mywindow");' value='<?php esc_html_e( 'Buy Now', 'wpsc' ); ?>' id='visitInstinct' name='visitInstinct' /></span>
41
-
42
- <br />
43
- <div class='wpsc_gold_module'>
44
- <br />
45
- <a href="https://wpecommerce.org/store/premium-plugins/gold-cart/" target="_blank"><strong><?php esc_html_e( 'Gold Cart', 'wpsc' ); ?></strong></a>
46
- <p class='wpsc_gold_text'><?php esc_html_e( 'Add product search, multiple image upload, gallery view, Grid View and multiple payment gateway options to your shop', 'wpsc' ); ?></p>
47
  </div>
 
 
 
 
 
48
 
49
- <div class='wpsc_gold_module'>
50
- <br />
51
- <a href="https://wpecommerce.org/store/premium-plugins/membership-subscriptions/" target="_blank"><strong><?php esc_html_e( 'Members Access Plugin', 'wpsc' ); ?></strong></a>
52
- <p class='wpsc_gold_text'><?php esc_html_e( 'Create product memberships and sell them in your store. Use these memberships to restrict premium content on your posts and pages creating a "members only" area perfect for: Forums, Images and Movies and Podcasts', 'wpsc' ); ?></p>
53
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
- <div class='wpsc_gold_module'>
56
- <br />
57
- <a href="https://wpecommerce.org/store/premium-plugins/nextgen-gallery-buy-now-buttons/" target="_blank"><strong><?php esc_html_e( 'NextGen Gallery Buy Now Buttons', 'wpsc' ); ?> </strong></a>
58
- <p class='wpsc_gold_text'><?php esc_html_e( 'Make your Online photo gallery into an eCommerce solution.', 'wpsc' ); ?></p>
59
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
- <div class='wpsc_gold_module'>
62
- <br />
63
- <a href="https://wpecommerce.org/store/premium-plugins/mp3-player-plugin/" target="_blank"><strong><?php esc_html_e( 'JPlayer - MP3 Plugin', 'wpsc' ); ?> </strong></a>
64
- <p class='wpsc_gold_text'><?php esc_html_e( 'MP3 Player Plugin for WordPress', 'wpsc' ); ?></p>
65
- </div>
66
- <div class='wpsc_gold_module'>
67
- <br />
68
- <a href="https://wpecommerce.org/store/premium-plugins/fedex-shipping-module/" target="_blank"><strong><?php esc_html_e( 'FedEx Plugin', 'wpsc' ); ?> </strong></a>
69
- <p class='wpsc_gold_text'><?php esc_html_e( 'This plugin offers shop owners the ability to provide Fedex Shipping Quotes for products with weights.', 'wpsc' ); ?></p>
70
- </div>
71
- </div>
72
 
73
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
- ?>
1
  <?php
 
2
  function wpsc_display_upgrades_page() {
3
 
4
+ do_action( 'wpsc_upgrades_license_activation' ); ?>
5
 
6
  <div class='wrap'>
7
  <div class='metabox-holder wpsc_gold_side'>
8
+ <div class='metabox-holder'>
9
+ <form method='post' id='product_license_box' action=''>
10
+ <div class="postbox">
11
+ <h3 class="hndle"><?php _e( 'Product License Registration', 'wp-e-commerce' );?></h3>
12
+ <p>
13
+ <label for="activation_key"><?php _e( 'License Key ', 'wp-e-commerce' ); ?>:</label>
14
+ <input type="text" id="activation_key" name="product_license" size="48" value="" class="text" />
15
+ </p>
16
+ <p>
17
+ <input type="hidden" value="true" name="product_license_key" />
18
+ <button type="submit" name="submit_values" value="submit_values" class="button button-primary"><?php _e( 'Register License', 'wp-e-commerce' ); ?></button>
19
+ <button type="submit" name="reset_values" value="reset_values"><?php _e( 'Reset License', 'wp-e-commerce' ); ?></button>
20
+ </p>
21
+ <p>
22
+ <?php _e( 'In order to receive automatic plugin updates you need to Register your License for each product that provides one. ', 'wp-e-commerce' ); ?></br>
23
+ <?php _e( 'Old API Keys will not work! ', 'wp-e-commerce' ); ?>
24
+ </p>
25
+ </div>
26
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  </div>
28
+ </div>
29
+ </div>
30
+ <?php
31
+ wpse_license_page_display_licenses();
32
+ }
33
 
34
+ function wpse_license_page_display_licenses () {
35
+ $licenses = get_option( 'wpec_license_active_products', array() );
36
+ ?>
37
+ <table class="wp-list-table widefat striped">
38
+ <thead>
39
+ <tr>
40
+ <th scope="col" id="product_name" class="manage-column column-product_name column-primary"><?php _e('Product Name', 'wp-e-commerce'); ?></th>
41
+ <th scope="col" id="product_license" class="manage-column column-product_license"><?php _e('License Key', 'wp-e-commerce'); ?></th>
42
+ <th scope="col" id="product_expiry" class="manage-column column-product_expiry"><?php _e('License Expiration', 'wp-e-commerce'); ?></th>
43
+ </tr>
44
+ </thead>
45
+ <tbody id="the-list">
46
+ <?php
47
+ if ( ! empty( $licenses ) ) {
48
+ foreach ( (array) $licenses as $license ) { ?>
49
+ <tr><td class="product_name column-product_name"><p><strong><?php echo esc_html( $license['name'] ); ?></strong></p></td>
50
+ <td class="product_license column-product_license"><p><strong><?php echo esc_html( $license['license'] ); ?></strong></p></td>
51
+ <td class="product_expiry column-product_expiry"><p><strong><?php echo esc_html( $license['expires'] ); ?></strong></p></td></tr>
52
+ <?php }
53
+ } else {
54
+ ?>
55
+ <tr class="no-items"><td class="colspanchange" colspan="4"><p><?php _e('No Licenses found.', 'wp-e-commerce'); ?></p></td></tr>
56
+ <?php
57
+ }
58
+ ?>
59
+ </tbody>
60
+ <tfoot>
61
+ <tr>
62
+ <th scope="col" class="manage-column column-product_name column-primary"><?php _e('Product Name', 'wp-e-commerce'); ?></th>
63
+ <th scope="col" class="manage-column column-product_license"><?php _e('License Key', 'wp-e-commerce'); ?></th>
64
+ <th scope="col" class="manage-column column-product_expiry"><?php _e('License Expiration', 'wp-e-commerce'); ?></th>
65
+ </tr>
66
+ </tfoot>
67
+ </table>
68
+ <?php
69
+ }
70
 
71
+ /**
72
+ * Activate Gold Cart plugin
73
+ */
74
+ function wpsc_licenses_action_stuff() {
75
+ //Activate a new Product License
76
+ if ( isset( $_POST['product_license_key'] ) && $_POST['product_license_key'] == 'true' ) {
77
+ if ( isset( $_POST['product_license'] ) && $_POST['product_license'] != '' ) {
78
+
79
+ //Do stuff
80
+ $url = "https://wpecommerce.org/wp-license-api/license_register.php";
81
+ $params = array (
82
+ 'api' => 'v2',
83
+ 'key' => base64_encode( stripslashes( $_POST['product_license'] ) ),
84
+ 'url' => base64_encode( esc_url_raw( site_url() ) )
85
+ );
86
+
87
+ $args = array(
88
+ 'httpversion' => '1.0',
89
+ 'sslverify' => false,
90
+ 'timeout' => 15,
91
+ 'user-agent' => 'WP eCommerce Licensing/' . get_bloginfo( 'url' ),
92
+ );
93
+
94
+ if ( isset( $_POST['submit_values'] ) && $_POST['submit_values'] == 'submit_values' ) {
95
+ $params['action'] = 'activate';
96
+ } elseif ( isset( $_POST['reset_values'] ) && $_POST['reset_values'] == 'reset_values' ) {
97
+ $params['action'] = 'deactivate';
98
+ }
99
+
100
+ $url = add_query_arg( $params, $url );
101
+
102
 
103
+ $response = json_decode( wp_remote_retrieve_body( wp_remote_get( $url, $args ) ) );
 
 
 
 
 
 
 
 
 
 
104
 
105
+ $licenses = get_option( 'wpec_license_active_products', array() );
106
+
107
+ if ( 'activated' === $response->status) {
108
+
109
+ $licenses[] = array(
110
+ 'tag' => $response->fileid,
111
+ 'name' => $response->product,
112
+ 'license' => $response->license,
113
+ 'expires' => $response->valid
114
+ );
115
+
116
+ update_option( 'wpec_license_active_products', $licenses );
117
+ echo '<div class="updated"><p>'.esc_html( $response->message ).'</p></div>';
118
 
119
+ } elseif ( 'deactivated' === $response->status ) {
120
+
121
+ foreach ( $licenses as $key => $license ) {
122
+ if ( in_array( $response->fileid, $license ) ) {
123
+ unset( $licenses[$key] );
124
+ array_values($licenses);
125
+ }
126
+ }
127
+
128
+ update_option( 'wpec_license_active_products', $licenses );
129
+ echo '<div class="updated"><p>'.esc_html( $response->message ).'</p></div>';
130
+
131
+ } else {
132
+ echo '<div class="error"><p>'.esc_html( $response->message ).'</p></div>';
133
+ }
134
+ }
135
+ }
136
  }
137
+ add_action( 'wpsc_upgrades_license_activation', 'wpsc_licenses_action_stuff' );
wpsc-admin/includes/coupon-list-table-class.php CHANGED
@@ -61,9 +61,9 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
61
  ) );
62
 
63
  $this->statuses = array(
64
- 'active' => _x( 'Active', 'coupon status', 'wpsc' ),
65
- 'inactive' => _x( 'Inactive', 'coupon status', 'wpsc' ),
66
- 'unknown' => _x( 'Unknown', 'coupon status', 'wpsc' ),
67
  );
68
 
69
  $this->process_single_actions();
@@ -88,9 +88,9 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
88
  $inactive_count = '&nbsp;<span class="count">(' . $this->inactive_count . ')</span>';
89
 
90
  $views = array(
91
- 'all' => sprintf( '<a href="%s"%s>%s</a>', esc_url( remove_query_arg( 'status', $base ) ), $current === 'all' || $current == '' ? ' class="current"' : '', __('All', 'wpsc') . $total_count ),
92
- 'active' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( 'status', '1', $base ) ), $current === '1' ? ' class="current"' : '', __('Active', 'wpsc') . $active_count ),
93
- 'inactive' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( 'status', '0', $base ) ), $current === '0' ? ' class="current"' : '', __('Inactive', 'wpsc') . $inactive_count ),
94
  );
95
 
96
  return $views;
@@ -108,11 +108,11 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
108
  public function get_columns() {
109
  $columns = array(
110
  'cb' => '<input type="checkbox" />',
111
- 'coupon' => __( 'Code', 'wpsc' ),
112
- 'discount' => __( 'Discount', 'wpsc' ),
113
- 'start' => __( 'Start Date', 'wpsc' ),
114
- 'expiry' => __( 'Expiration', 'wpsc' ),
115
- 'status' => __( 'Status', 'wpsc' ),
116
  );
117
 
118
  return $columns;
@@ -137,7 +137,7 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
137
  $start_date = strtotime( get_date_from_gmt( $item[ $column_name ] ) );
138
  $value = date_i18n( get_option( 'date_format' ), $start_date );
139
  } else {
140
- $value = __( 'None', 'wpsc' );
141
  }
142
 
143
  return $value;
@@ -148,7 +148,7 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
148
  $expiry_date = strtotime( get_date_from_gmt( $item[ $column_name ] ) );
149
  $value = date_i18n( get_option( 'date_format' ), $expiry_date );
150
  } else {
151
- $value = __( 'None', 'wpsc' );
152
  }
153
 
154
  return $value;
@@ -174,14 +174,14 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
174
 
175
  $row_actions = array();
176
 
177
- $row_actions['edit'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'edit_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Edit', 'wpsc' ) . '</a>';
178
 
179
  if( strtolower( $item['status'] ) == 'active' )
180
- $row_actions['deactivate'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'deactivate_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Deactivate', 'wpsc' ) . '</a>';
181
  else
182
- $row_actions['activate'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'activate_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Activate', 'wpsc' ) . '</a>';
183
 
184
- $row_actions['delete'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'delete_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Delete', 'wpsc' ) . '</a>';
185
 
186
  $row_actions = apply_filters( 'wpsc_coupon_row_actions', $row_actions, $item['ID'] );
187
 
@@ -244,7 +244,7 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
244
  return $item['discount'] . '%';
245
  break;
246
  case 2:
247
- return __( 'Free shipping', 'wpsc' );
248
  break;
249
  }
250
  }
@@ -260,9 +260,9 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
260
 
261
  public function get_bulk_actions() {
262
  $actions = array(
263
- 'activate' => __( 'Activate', 'wpsc' ),
264
- 'deactivate' => __( 'Deactivate', 'wpsc' ),
265
- 'delete' => __( 'Delete', 'wpsc' )
266
  );
267
 
268
  return $actions;
@@ -283,27 +283,31 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
283
 
284
  $ids = isset( $_GET['coupon'] ) ? $_GET['coupon'] : false;
285
 
286
- if ( ! is_array( $ids ) )
287
  $ids = array( $ids );
 
288
 
289
  foreach ( $ids as $id ) {
 
 
 
290
  if ( 'delete' === $this->current_action() ) {
291
 
292
- // delete a discount
293
- $wpdb->query( $wpdb->prepare( "DELETE FROM " . WPSC_TABLE_COUPON_CODES . " WHERE id = %d", $id ) );
294
 
295
  } elseif( 'activate' === $this->current_action() ) {
296
 
297
- // activate a discount
298
- $wpdb->query( $wpdb->prepare( "UPDATE " . WPSC_TABLE_COUPON_CODES . " SET active = 1 WHERE id = %d", $id ) );
299
-
300
 
301
  } elseif( 'deactivate' === $this->current_action() ) {
302
 
303
- // deactivate a discount
304
- $wpdb->query( $wpdb->prepare( "UPDATE " . WPSC_TABLE_COUPON_CODES . " SET active = 0 WHERE id = %d", $id ) );
305
 
306
  }
 
307
  }
308
 
309
  }
@@ -320,49 +324,46 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
320
 
321
  global $wpdb;
322
 
323
- if( ! isset( $_GET['wpsc-action'] ) || ! isset( $_GET['coupon'] ) )
324
  return;
 
325
 
326
- $coupon_id = absint( $_GET['coupon'] );
327
 
328
- switch( $_GET['wpsc-action'] ) {
329
 
330
  case 'activate_coupon':
331
- $updated = $wpdb->update(
332
- WPSC_TABLE_COUPON_CODES,
333
- array( 'active' => 1 ),
334
- array( 'id' => $coupon_id ),
335
- array( '%s' ),
336
- array( '%d' )
337
- );
338
 
339
- if ( $updated )
340
- echo "<div class='updated'><p>" . __( 'The coupon has been activated.', 'wpsc' ) . "</p></div>";
 
 
 
 
341
  break;
 
342
  case 'deactivate_coupon':
343
- $updated = $wpdb->update(
344
- WPSC_TABLE_COUPON_CODES,
345
- array( 'active' => 0 ),
346
- array( 'id' => $coupon_id ),
347
- array( '%s' ),
348
- array( '%d' )
349
- );
350
 
351
- if ( $updated )
352
- echo "<div class='updated'><p>" . __( 'The coupon has been deactivated.', 'wpsc' ) . "</p></div>";
 
 
 
 
353
  break;
 
354
  case 'delete_coupon':
355
- $deleted = $wpdb->delete(
356
- WPSC_TABLE_COUPON_CODES,
357
- array( 'id' => $coupon_id ),
358
- array( '%d' )
359
- );
360
 
361
- if ( $deleted )
362
- echo "<div class='updated'><p>" . __( 'The coupon has been deleted.', 'wpsc' ) . "</p></div>";
 
 
 
363
 
364
  break;
 
365
  }
 
366
  }
367
 
368
 
@@ -410,17 +411,30 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
410
  $coupons = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` {$where} ORDER BY id {$order} {$limit} ", ARRAY_A );
411
 
412
  if ( $coupons ) {
413
- foreach ( $coupons as $coupon ) {
414
-
 
 
 
 
 
 
 
 
 
 
 
 
415
  $coupons_data[] = array(
416
- 'ID' => $coupon['id'],
417
- 'coupon' => $coupon['coupon_code'],
418
- 'discount' => $coupon['value'],
419
- 'type' => $coupon['is-percentage'],
420
- 'start' => $coupon['start'],
421
- 'expiry' => $coupon['expiry'],
422
- 'status' => $coupon['active'] == 1 ? 'active' : 'inactive',
423
  );
 
424
  }
425
  }
426
  return $coupons_data;
@@ -436,25 +450,20 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
436
  */
437
  public function prepare_items() {
438
 
439
- $per_page = $this->per_page;
440
-
441
- $columns = $this->get_columns();
442
-
443
- $hidden = array();
444
-
445
- $sortable = $this->get_sortable_columns();
446
-
447
  $this->_column_headers = array( $columns, $hidden, $sortable );
448
 
449
  $this->process_bulk_action();
450
 
451
  $data = $this->coupons_data();
452
-
453
- $current_page = $this->get_pagenum();
454
 
455
  $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
456
-
457
- switch( $status ) {
458
  case '1':
459
  $total_items = $this->active_count;
460
  break;
@@ -466,8 +475,6 @@ class WPSC_Coupons_List_Table extends WP_List_Table {
466
  break;
467
  }
468
 
469
- $this->items = $data;
470
-
471
  $this->set_pagination_args( array(
472
  'total_items' => $total_items,
473
  'per_page' => $per_page,
61
  ) );
62
 
63
  $this->statuses = array(
64
+ 'active' => _x( 'Active', 'coupon status', 'wp-e-commerce' ),
65
+ 'inactive' => _x( 'Inactive', 'coupon status', 'wp-e-commerce' ),
66
+ 'unknown' => _x( 'Unknown', 'coupon status', 'wp-e-commerce' ),
67
  );
68
 
69
  $this->process_single_actions();
88
  $inactive_count = '&nbsp;<span class="count">(' . $this->inactive_count . ')</span>';
89
 
90
  $views = array(
91
+ 'all' => sprintf( '<a href="%s"%s>%s</a>', esc_url( remove_query_arg( 'status', $base ) ), $current === 'all' || $current == '' ? ' class="current"' : '', __('All', 'wp-e-commerce') . $total_count ),
92
+ 'active' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( 'status', '1', $base ) ), $current === '1' ? ' class="current"' : '', __('Active', 'wp-e-commerce') . $active_count ),
93
+ 'inactive' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( 'status', '0', $base ) ), $current === '0' ? ' class="current"' : '', __('Inactive', 'wp-e-commerce') . $inactive_count ),
94
  );
95
 
96
  return $views;
108
  public function get_columns() {
109
  $columns = array(
110
  'cb' => '<input type="checkbox" />',
111
+ 'coupon' => __( 'Code', 'wp-e-commerce' ),
112
+ 'discount' => __( 'Discount', 'wp-e-commerce' ),
113
+ 'start' => __( 'Start Date', 'wp-e-commerce' ),
114
+ 'expiry' => __( 'Expiration', 'wp-e-commerce' ),
115
+ 'status' => __( 'Status', 'wp-e-commerce' ),
116
  );
117
 
118
  return $columns;
137
  $start_date = strtotime( get_date_from_gmt( $item[ $column_name ] ) );
138
  $value = date_i18n( get_option( 'date_format' ), $start_date );
139
  } else {
140
+ $value = __( 'None', 'wp-e-commerce' );
141
  }
142
 
143
  return $value;
148
  $expiry_date = strtotime( get_date_from_gmt( $item[ $column_name ] ) );
149
  $value = date_i18n( get_option( 'date_format' ), $expiry_date );
150
  } else {
151
+ $value = __( 'None', 'wp-e-commerce' );
152
  }
153
 
154
  return $value;
174
 
175
  $row_actions = array();
176
 
177
+ $row_actions['edit'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'edit_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Edit', 'wp-e-commerce' ) . '</a>';
178
 
179
  if( strtolower( $item['status'] ) == 'active' )
180
+ $row_actions['deactivate'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'deactivate_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Deactivate', 'wp-e-commerce' ) . '</a>';
181
  else
182
+ $row_actions['activate'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'activate_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Activate', 'wp-e-commerce' ) . '</a>';
183
 
184
+ $row_actions['delete'] = '<a href="' . esc_url( add_query_arg( array( 'wpsc-action' => 'delete_coupon', 'coupon' => $item['ID'] ) ) ) . '">' . __( 'Delete', 'wp-e-commerce' ) . '</a>';
185
 
186
  $row_actions = apply_filters( 'wpsc_coupon_row_actions', $row_actions, $item['ID'] );
187
 
244
  return $item['discount'] . '%';
245
  break;
246
  case 2:
247
+ return __( 'Free shipping', 'wp-e-commerce' );
248
  break;
249
  }
250
  }
260
 
261
  public function get_bulk_actions() {
262
  $actions = array(
263
+ 'activate' => __( 'Activate', 'wp-e-commerce' ),
264
+ 'deactivate' => __( 'Deactivate', 'wp-e-commerce' ),
265
+ 'delete' => __( 'Delete', 'wp-e-commerce' )
266
  );
267
 
268
  return $actions;
283
 
284
  $ids = isset( $_GET['coupon'] ) ? $_GET['coupon'] : false;
285
 
286
+ if ( ! is_array( $ids ) ) {
287
  $ids = array( $ids );
288
+ }
289
 
290
  foreach ( $ids as $id ) {
291
+
292
+ $coupon = new WPSC_Coupon( $id );
293
+
294
  if ( 'delete' === $this->current_action() ) {
295
 
296
+ // Delete a discount
297
+ $coupon->delete();
298
 
299
  } elseif( 'activate' === $this->current_action() ) {
300
 
301
+ // Activate a discount
302
+ $coupon->activate();
 
303
 
304
  } elseif( 'deactivate' === $this->current_action() ) {
305
 
306
+ // Deactivate a discount
307
+ $coupon->deactivate();
308
 
309
  }
310
+
311
  }
312
 
313
  }
324
 
325
  global $wpdb;
326
 
327
+ if ( ! isset( $_GET['wpsc-action'] ) || ! isset( $_GET['coupon'] ) ) {
328
  return;
329
+ }
330
 
331
+ $coupon = new WPSC_Coupon( $_GET['coupon'] );
332
 
333
+ switch ( $_GET['wpsc-action'] ) {
334
 
335
  case 'activate_coupon':
 
 
 
 
 
 
 
336
 
337
+ $updated = $coupon->activate();
338
+
339
+ if ( $updated ) {
340
+ printf( '<div class="updated"><p>%s</p></div>', __( 'The coupon has been activated.', 'wp-e-commerce' ) );
341
+ }
342
+
343
  break;
344
+
345
  case 'deactivate_coupon':
 
 
 
 
 
 
 
346
 
347
+ $updated = $coupon->deactivate();
348
+
349
+ if ( $updated ) {
350
+ printf( '<div class="updated"><p>%s</p></div>', __( 'The coupon has been deactivated.', 'wp-e-commerce' ) );
351
+ }
352
+
353
  break;
354
+
355
  case 'delete_coupon':
 
 
 
 
 
356
 
357
+ $deleted = $coupon->delete();
358
+
359
+ if ( $deleted ) {
360
+ printf( '<div class="updated"><p>%s</p></div>', __( 'The coupon has been deleted.', 'wp-e-commerce' ) );
361
+ }
362
 
363
  break;
364
+
365
  }
366
+
367
  }
368
 
369
 
411
  $coupons = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` {$where} ORDER BY id {$order} {$limit} ", ARRAY_A );
412
 
413
  if ( $coupons ) {
414
+ foreach ( $coupons as $data ) {
415
+
416
+ $coupon = new WPSC_Coupon( array(
417
+ 'id' => $data['id'],
418
+ 'coupon_code' => $data['coupon_code'],
419
+ 'value' => $data['value'],
420
+ 'is-percentage' => $data['is-percentage'],
421
+ 'start' => $data['start'],
422
+ 'expiry' => $data['expiry'],
423
+ 'active' => $data['active']
424
+ ) );
425
+
426
+ // Re-map data to array for legacy handling of this method's return data.
427
+ // (would be nicer to return an object?)
428
  $coupons_data[] = array(
429
+ 'ID' => $coupon->get( 'id' ),
430
+ 'coupon' => $coupon->get( 'coupon_code' ),
431
+ 'discount' => $coupon->get( 'value' ),
432
+ 'type' => $coupon->get( 'is-percentage' ),
433
+ 'start' => $coupon->get( 'start' ),
434
+ 'expiry' => $coupon->get( 'expiry' ),
435
+ 'status' => $coupon->get( 'active' ) == 1 ? 'active' : 'inactive'
436
  );
437
+
438
  }
439
  }
440
  return $coupons_data;
450
  */
451
  public function prepare_items() {
452
 
453
+ $hidden = array();
454
+ $total_items = 0;
455
+ $per_page = $this->per_page;
456
+ $columns = $this->get_columns();
457
+ $sortable = $this->get_sortable_columns();
 
 
 
458
  $this->_column_headers = array( $columns, $hidden, $sortable );
459
 
460
  $this->process_bulk_action();
461
 
462
  $data = $this->coupons_data();
463
+ $this->items = $data;
 
464
 
465
  $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
466
+ switch ( $status ) {
 
467
  case '1':
468
  $total_items = $this->active_count;
469
  break;
475
  break;
476
  }
477
 
 
 
478
  $this->set_pagination_args( array(
479
  'total_items' => $total_items,
480
  'per_page' => $per_page,
wpsc-admin/includes/display-items-functions.php CHANGED
@@ -147,7 +147,7 @@ function wpsc_price_control_forms() {
147
  ?>
148
  <em id="wpsc_product_price_metabox_live_title" class="wpsc_metabox_live_title">
149
  <p>&nbsp;<?php echo esc_html( $ct_symb ); ?><span><?php echo esc_html( $sale_price ); ?></span></p>
150
- <del><?php esc_html_e($ct_symb); ?><span><?php esc_html_e($price) ?></span></del>
151
  </em>
152
  <input type="hidden" id="parent_post" name="parent_post" value="<?php echo $post->post_parent; ?>" />
153
  <?php /* Lots of tedious work is avoided with this little line. */ ?>
@@ -156,12 +156,12 @@ function wpsc_price_control_forms() {
156
  <?php /* Check product if a product has variations */ ?>
157
  <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
158
  <?php $price = wpsc_product_variation_price_from( $post->ID ); ?>
159
- <p style="margin-top: 6px;"><?php echo sprintf( __( 'This product has variations. To edit the price, please use the <a href="%s">Variation Controls</a>.' , 'wpsc' ), '#wpsc_product_variation_forms' ); ?></p>
160
- <p><?php printf( __( 'Price: %s and above.' , 'wpsc' ), $price ); ?></p>
161
  <?php else: ?>
162
 
163
  <div class='wpsc_floatleft' style="width:100px;">
164
- <label for="wpsc_price"><?php _e( 'Price', 'wpsc' ); ?></label>
165
  <?php echo esc_html( $ct_symb ); ?> <input id="wpsc_price"
166
  type="text"
167
  style="width: 70px;"
@@ -170,7 +170,7 @@ function wpsc_price_control_forms() {
170
  </div>
171
 
172
  <div class='wpsc_floatleft' style='width:95px; margin-left:30px;'>
173
- <label for='wpsc_sale_price'><?php _e( 'Sale Price', 'wpsc' ); ?></label>
174
  <?php echo esc_html( $ct_symb ); ?> <input id = "wpsc_sale_price"
175
  type="text"
176
  style="width: 70px;"
@@ -182,8 +182,8 @@ function wpsc_price_control_forms() {
182
  <table>
183
  <thead>
184
  <tr>
185
- <th class="type" colspan="2"><?php esc_html_e( 'Alternative Currencies:', 'wpsc' ); ?></th>
186
- <th class="price"><?php esc_html_e( 'Price:', 'wpsc' ); ?></th>
187
  <tr>
188
  </thead>
189
  <tbody>
@@ -225,7 +225,7 @@ function wpsc_price_control_forms() {
225
  </tr>
226
  </tbody>
227
  </table>
228
- <a href="#wpsc_currency_row_template" class="button button-small wpsc_add_new_currency"><?php esc_html_e( 'Add a Currency Option', 'wpsc' ); ?></a>
229
  <?php wp_nonce_field( 'update-options', 'wpsc-update-currency-layers', false ); ?>
230
  </div>
231
 
@@ -233,9 +233,9 @@ function wpsc_price_control_forms() {
233
  <table>
234
  <thead>
235
  <tr>
236
- <th class="qty" colspan="2"><?php esc_html_e( 'Quantity:', 'wpsc' ); ?></th>
237
- <th class="curr"><span class="hidden"><?php esc_html_e( 'Currency:', 'wpsc' ); ?><span></th>
238
- <th class="price"><?php esc_html_e( 'Price:', 'wpsc' ); ?></th>
239
  </tr>
240
  </thead>
241
  <tbody>
@@ -249,7 +249,7 @@ function wpsc_price_control_forms() {
249
  <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
250
  <td class="qty">
251
  <input type="text" size="5" value="<?php echo absint( $quantity ); ?>" name="table_rate_price[quantity][]" />
252
- <?php esc_html_e( '+', 'wpsc' ); ?>
253
  </td>
254
  <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td>
255
  <td><input class="newCurrPrice text" value="<?php echo $table_price; ?>" name="table_rate_price[table_price][]" /></td>
@@ -263,19 +263,19 @@ function wpsc_price_control_forms() {
263
  <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
264
  <td class="qty">
265
  <input size="5" value="0" name="table_rate_price[quantity][]" />
266
- <?php esc_html_e( '+', 'wpsc' ); ?>
267
  </td>
268
  <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td>
269
  <td><input size="10"class="newCurrPrice text" value="0" name="table_rate_price[table_price][]" /></td>
270
  </tr>
271
  </tbody>
272
  </table>
273
- <a href="#wpsc_quantity_discount_row_template" class="add_level button button-small"><?php esc_html_e( 'Add a Quantity Discount', 'wpsc' ); ?></a>
274
  <?php wp_nonce_field( 'update-options', 'wpsc-update-quantity-discounts', false ); ?>
275
  </div>
276
 
277
  <input id="add_form_donation" type="checkbox" name="meta[_wpsc_is_donation]" value="yes" <?php checked( $product_data['meta']['_wpsc_is_donation'], 1 ); ?> />
278
- <label for="add_form_donation"><?php _e( 'Purchase is a donation.', 'wpsc' ) ?></label>
279
  <?php wp_nonce_field( 'update', 'wpsc_product_pricing_nonce' ); ?>
280
 
281
  <?php endif;
@@ -315,7 +315,7 @@ function wpsc_stock_control_forms() {
315
  // Display live title if stock is set
316
  if ( isset( $product_data['meta']['_wpsc_stock'] ) && is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {
317
  $live_title = '<em id="wpsc_product_stock_metabox_live_title" class="wpsc_metabox_live_title">';
318
- $live_title .= sprintf( '<p><span>%s</span> %s</p>', wpsc_format_number( $product_data['meta']['_wpsc_stock'], 0 ), _x( 'left in stock', 'live preview of stock remaining in admin', 'wpsc' ) );
319
  $live_title .= '</em>';
320
 
321
  echo $live_title;
@@ -323,7 +323,7 @@ function wpsc_stock_control_forms() {
323
 
324
  if ( ! empty( $product_meta['unpublish_when_none_left'] ) && ! isset( $product_meta['notify_when_none_left'] ) )
325
  ?>
326
- <label for="wpsc_sku"><abbr title="<?php esc_attr_e( 'Stock Keeping Unit', 'wpsc' ); ?>"><?php esc_html_e( 'SKU:', 'wpsc' ); ?></abbr></label>
327
  <?php
328
  if ( !isset( $product_data['meta']['_wpsc_sku'] ) )
329
  $product_data['meta']['_wpsc_sku'] = $wpsc_product_defaults['meta']['sku']; ?><br />
@@ -333,7 +333,7 @@ function wpsc_stock_control_forms() {
333
  if ( !isset( $product_data['meta']['_wpsc_stock'] ) )
334
  $product_data['meta']['_wpsc_stock'] = ''; ?>
335
  <br /><input class='limited_stock_checkbox' id='add_form_quantity_limited' type='checkbox' value='yes' <?php if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) echo 'checked="checked"'; else echo ''; ?> name='meta[_wpsc_limited_stock]' />
336
- <label for='add_form_quantity_limited' class='small'><?php esc_html_e( 'Product has limited stock', 'wpsc' ); ?></label>
337
  <?php
338
  if ( $post->ID > 0 ) {
339
  if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {?>
@@ -343,11 +343,11 @@ function wpsc_stock_control_forms() {
343
  } ?>
344
  <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
345
  <?php $stock = wpsc_variations_stock_remaining( $post->ID ); ?>
346
- <p><?php echo sprintf( __( 'This product has variations. To edit the quantity, please use the <a href="%s">Variation Controls</a> below.' , 'wpsc' ), '#wpsc_product_variation_forms' ); ?></p>
347
- <p><?php printf( _n( "%s variant item in stock.", "%s variant items in stock.", $stock, 'wpsc' ), $stock ); ?></p>
348
  <?php else: ?>
349
  <div style="margin-bottom:20px;">
350
- <label for="stock_limit_quantity"><?php esc_html_e( 'Quantity in stock', 'wpsc' ); ?></label>
351
  <input type='number' min="0" step="1" style="width:80px; margin-left:50px;"
352
  id="stock_limit_quantity" name='meta[_wpsc_stock]'
353
  size='3' value='<?php echo absint( $product_data['meta']['_wpsc_stock'] ); ?>'
@@ -361,34 +361,34 @@ function wpsc_stock_control_forms() {
361
  echo '<p><em>';
362
  printf( _n('%s of them is reserved for pending or recently completed orders.',
363
  '%s of them are reserved for pending or recently completed orders.',
364
- $reserved_quantity, 'wpsc'), $reserved_quantity );
365
 
366
  echo '</em></p>';
367
  }
368
  ?>
369
  <?php endif; ?>
370
 
371
- <p><?php esc_html_e( 'When stock reduces to zero:', 'wpsc' ); ?></p>
372
  <div class='notify_when_none_left'>
373
  <input type='checkbox' id="notify_when_oos"
374
  name='meta[_wpsc_product_metadata][notify_when_none_left]'
375
  class='notify_when_oos'<?php checked( $product_meta['notify_when_none_left'] ); ?> />
376
- <label for="notify_when_oos"><?php esc_html_e( 'Notify site owner via email', 'wpsc' ); ?></label>
377
  </div>
378
  <div class='unpublish_when_none_left'>
379
  <input type='checkbox' id="unpublish_when_oos"
380
  name='meta[_wpsc_product_metadata][unpublish_when_none_left]'
381
  class='unpublish_when_oos'<?php checked( $product_meta['unpublish_when_none_left'] ); ?> />
382
- <label for="unpublish_when_oos"><?php esc_html_e( 'Unpublish product from website', 'wpsc' ); ?></label>
383
 
384
  </div>
385
  </div> <?php
386
  } else { ?>
387
  <div style='display: none;' class='edit_stock'>
388
- <?php esc_html_e( 'Stock Qty', 'wpsc' ); ?><input type='text' name='meta[_wpsc_stock]' value='0' size='10' />
389
  <div style='font-size:9px; padding:5px;'>
390
- <input type='checkbox' class='notify_when_oos' name='meta[_wpsc_product_metadata][notify_when_none_left]' /> <?php esc_html_e( 'Email site owner if this Product runs out of stock', 'wpsc' ); ?>
391
- <input type='checkbox' class='unpublish_when_oos' name='meta[_wpsc_product_metadata][unpublish_when_none_left]' /> <?php esc_html_e( 'Set status to Unpublished if this Product runs out of stock', 'wpsc' ); ?>
392
  </div>
393
  </div>
394
  <?php
@@ -422,7 +422,7 @@ function wpsc_product_taxes_forms() {
422
  $band_select_settings = array(
423
  'id' => 'wpec_taxes_band',
424
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_band]',
425
- 'label' => __( 'Custom Tax Band', 'wpsc' )
426
  );
427
  $wpec_taxes_band = '';
428
  if ( isset( $product_meta['wpec_taxes_band'] ) ) {
@@ -434,7 +434,7 @@ function wpsc_product_taxes_forms() {
434
  'type' => 'checkbox',
435
  'id' => 'wpec_taxes_taxable',
436
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable]',
437
- 'label' => __( 'Product is exempt from taxation.', 'wpsc' )
438
  );
439
 
440
  if ( isset( $product_meta['wpec_taxes_taxable'] ) && 'on' == $product_meta['wpec_taxes_taxable'] ) {
@@ -446,8 +446,8 @@ function wpsc_product_taxes_forms() {
446
  $taxable_amount_input_settings = array(
447
  'id' => 'wpec_taxes_taxable_amount',
448
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable_amount]',
449
- 'label' => __( 'Taxable Amount', 'wpsc' ),
450
- 'description' => __( 'Taxable amount in your currency, not percentage of price.', 'wpsc' ),
451
  );
452
 
453
  if ( isset( $product_meta['wpec_taxes_taxable_amount'] ) ) {
@@ -468,7 +468,7 @@ function wpsc_product_taxes_forms() {
468
  $output .= '</p>';
469
 
470
  if ( ! $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_enabled() ) {
471
- $output = '<p>' . sprintf( __( 'Taxes are not enabled. See <a href="%s">Settings &gt; Taxes</a>', 'wpsc' ), admin_url( 'options-general.php?page=wpsc-settings&tab=taxes' ) ) . '</p>';
472
  }
473
 
474
  echo $output;
@@ -504,9 +504,9 @@ function wpsc_product_shipping_forms_metabox() {
504
  */
505
  function wpsc_dimension_units() {
506
  return array(
507
- 'in' => __( 'inches', 'wpsc' ),
508
- 'cm' => __( 'cm', 'wpsc' ),
509
- 'meter' => __( 'meters', 'wpsc' )
510
  );
511
  }
512
 
@@ -519,10 +519,10 @@ function wpsc_dimension_units() {
519
  */
520
  function wpsc_weight_units() {
521
  return array(
522
- 'pound' => __( 'pounds', 'wpsc' ),
523
- 'ounce' => __( 'ounces', 'wpsc' ),
524
- 'gram' => __( 'grams', 'wpsc' ),
525
- 'kilogram' => __( 'kilograms', 'wpsc' )
526
  );
527
  }
528
 
@@ -539,14 +539,14 @@ function wpsc_weight_units() {
539
  function wpsc_weight_unit_display( $unit ) {
540
  switch ( $unit ) {
541
  case 'pound' :
542
- return __( ' lbs.', 'wpsc' );
543
  case 'ounce' :
544
- return __( ' oz.', 'wpsc' );
545
  case 'gram' :
546
- return __( ' g', 'wpsc' );
547
  case 'kilograms' :
548
  case 'kilogram' :
549
- return __( ' kgs.', 'wpsc' );
550
  }
551
  return '';
552
  }
@@ -660,18 +660,18 @@ function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'me
660
  <div class="wpsc-stock-editor<?php if ( $bulk ) echo ' wpsc-bulk-edit' ?>">
661
  <p class="wpsc-form-field">
662
  <input type="checkbox" id="wpsc-product-no-shipping" name="<?php echo esc_attr( $field_name_prefix ); ?>[no_shipping]" value="1" <?php checked( $no_shipping && ! $bulk ); ?>>
663
- <label for="wpsc-product-no-shipping"><?php _e( 'Product will <em>not</em> be shipped to customer', 'wpsc' ); ?></label>
664
  </p>
665
 
666
  <div class="wpsc-product-shipping-section wpsc-product-shipping-weight-dimensions">
667
- <p><strong><?php esc_html_e( 'Calculate Shipping Costs based on measurements', 'wpsc' ); ?></strong></p>
668
 
669
  <!-- WEIGHT INPUT -->
670
  <p class="wpsc-form-field">
671
  <?php if ( $bulk ) : ?>
672
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][weight]" value="1" />
673
  <?php endif; ?>
674
- <label for="wpsc-product-shipping-weight"><?php echo esc_html_e( 'Weight', 'wpsc' ); ?></label>
675
  <span class="wpsc-product-shipping-input">
676
  <input type="text" id="wpsc-product-shipping-weight" name="<?php echo esc_attr( $field_name_prefix ); ?>[weight]" value="<?php if ( ! $bulk ) echo esc_attr( wpsc_format_number( $weight ) ); ?>" />
677
  <select id="wpsc-product-shipping-weight-unit" name="<?php echo $field_name_prefix; ?>[weight_unit]">
@@ -688,7 +688,7 @@ function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'me
688
  <?php if ( $bulk ) : ?>
689
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][dimensions]" value="1" />
690
  <?php endif; ?>
691
- <label for="wpsc-product-shipping-weight"><?php echo esc_html_e( 'Dimensions', 'wpsc' ); ?></label>
692
  <span class="wpsc-product-shipping-input">
693
  <input placeholder="L" type="text" id="wpsc-product-shipping-length" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][length]" value="<?php if ( !$bulk && $dimensions['length']>0 ) echo esc_attr( wpsc_format_number( $dimensions['length'] ) ); ?>" />&nbsp;&times;&nbsp;
694
  <input placeholder="W" type="text" id="wpsc-product-shipping-width" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][width]" value="<?php if ( !$bulk && $dimensions['width']>0 ) echo esc_attr( wpsc_format_number( $dimensions['width'] ) ); ?>" />&nbsp;&times;&nbsp;
@@ -712,12 +712,12 @@ function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'me
712
  ?>
713
 
714
  <div class="wpsc-product-shipping-section wpsc-product-shipping-flat-rate">
715
- <p><strong><?php esc_html_e( 'Flat Rate Settings', 'wpsc' ); ?></strong></p>
716
  <p class="wpsc-form-field">
717
  <?php if ( $bulk ): ?>
718
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][local]" value="1" />
719
  <?php endif; ?>
720
- <label for="wpsc-product-shipping-flatrate-local"><?php esc_html_e( 'Local Shipping Fee', 'wpsc' ); ?></label>
721
  <span>
722
  <?php echo esc_html( $ct_symb ); ?>
723
  <input type="text" id="wpsc-product-shipping-flatrate-local" name="<?php echo esc_html( $field_name_prefix ); ?>[shipping][local]" value="<?php if ( ! $bulk ) echo $shipping['local']; ?>" />
@@ -727,7 +727,7 @@ function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'me
727
  <?php if ( $bulk ): ?>
728
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][international]" value="1" />
729
  <?php endif; ?>
730
- <label for="wpsc-product-shipping-flatrate-international"><?php esc_html_e( 'International Shipping Fee', 'wpsc' ); ?></label>
731
  <span>
732
  <?php echo esc_html( $ct_symb ); ?>
733
  <input type="text" id="wpsc-product-shipping-flatrate-international" name="<?php echo esc_html( $field_name_prefix ); ?>[shipping][international]" value="<?php if ( ! $bulk ) echo $shipping['international']; ?>" />
@@ -769,23 +769,23 @@ function wpsc_product_advanced_forms() {
769
  $output = '<table id="wpsc_product_meta_table" class="wp-list-table widefat posts">';
770
  $output .= '<thead>';
771
  $output .= '<tr>';
772
- $output .= '<th id="wpsc_custom_meta_name_th">' . _x( 'Name', 'Product meta UI', 'wpsc' ) . '</th>';
773
- $output .= '<th id="wpsc_custom_meta_value_th">' . _x( 'Value', 'Product meta UI', 'wpsc' ) . '</th>';
774
- $output .= '<th id="wpsc_custom_meta_action_th">' . _x( 'Action', 'Product meta UI', 'wpsc' ) . '</th>';
775
  $output .= '</tr>';
776
  $output .= '</thead>';
777
  $output .= '<tfoot>';
778
  $output .= '<tr>';
779
- $output .= '<th>' . _x( 'Name', 'Product meta UI', 'wpsc' ) . '</th>';
780
- $output .= '<th>' . _x( 'Value', 'Product meta UI', 'wpsc' ) . '</th>';
781
- $output .= '<th>' . _x( 'Action', 'Product meta UI', 'wpsc' ) . '</th>';
782
  $output .= '</tr>';
783
  $output .= '</tfood>';
784
 
785
  $output .= '<tbody>';
786
 
787
  if ( empty( $custom_fields ) ) {
788
- $output .= '<tr class="no-meta"><td colspan="3"><p>' . sprintf( __( 'You have no custom metadata. You can set any arbitrary meta you like and access it programatically via the <a href="">Post Meta API</a>.', 'wpsc' ), esc_url( 'https://codex.wordpress.org/Function_Reference/get_post_meta' ) ) . '</p></td></tr>';
789
  } else {
790
  // Display all available metadata
791
  $alternate = false;
@@ -796,7 +796,7 @@ function wpsc_product_advanced_forms() {
796
  $output .= '<tr'. ($alternate ? ' class="alternate"' : '') .'>';
797
  $output .= '<td><input type="text" value="'.esc_attr( $custom_field['meta_key'] ).'" name="custom_meta['.$i.'][name]" id="custom_meta_name_'.$i.'"></input></td>';
798
  $output .= '<td><input type="text" value="'.esc_attr( $custom_field['meta_value'] ).'" name="custom_meta['.$i.'][value]" id="custom_meta_value_'.$i.'"></input></td>';
799
- $output .= '<td><a href="#" data-nonce="'.esc_attr( $delete_nonce ).'" class="wpsc_remove_meta" onclick="wpsc_remove_custom_meta(this,'.$i.')">'.esc_html( 'Delete', 'wpsc' ).'</a></td>';
800
  $output .= '</tr>';
801
  }
802
  }
@@ -805,13 +805,13 @@ function wpsc_product_advanced_forms() {
805
  $output .= '<tr id="wpsc_new_meta_template">';
806
  $output .= '<td><input type="text" name="new_custom_meta[name][]" value=""></input></td>';
807
  $output .= '<td><input type="text" name="new_custom_meta[value][]" value=""></input></td>';
808
- $output .= '<td><a href="#" class="wpsc_remove_meta" onclick="wpsc_remove_empty_meta(this)">'.esc_html( 'Delete', 'wpsc' ).'</a></td>';
809
  $output .= '</tr>';
810
 
811
  $output .= '</tbody>';
812
  $output .= '</table>';
813
 
814
- $output .= '<a href="#" class="add_more_meta button button-small" id="wpsc_add_custom_meta">'.esc_html( '+ Add Custom Meta', 'wpsc' ).'</a>';
815
 
816
  echo $output;
817
 
@@ -838,37 +838,37 @@ function wpsc_product_external_link_forms() {
838
  <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
839
  <tbody>
840
  <tr class="form-field">
841
- <th valign="top" scope="row"><label for="external_link"><?php esc_html_e( 'URL', 'wpsc' ); ?></label></th>
842
  <td><input type="text" name="meta[_wpsc_product_metadata][external_link]" id="external_link" value="<?php echo esc_url( $product_meta['external_link'] ); ?>" size="50" style="width: 95%" placeholder="http://" /></td>
843
  </tr>
844
  <tr class="form-field">
845
- <th valign="top" scope="row"><label for="external_link_text"><?php esc_html_e( 'Label', 'wpsc' ); ?></label></th>
846
- <td><input type="text" name="meta[_wpsc_product_metadata][external_link_text]" id="external_link_text" value="<?php echo esc_attr( $product_meta['external_link_text'] ); ?>" size="50" style="width: 95%" placeholder="<?php _e( 'Buy Now', 'wpsc' ); ?>" /></td>
847
  </tr>
848
  <tr class="form-field">
849
- <th valign="top" scope="row"><label for="external_link_target"><?php esc_html_e( 'Target', 'wpsc' ); ?></label></th>
850
  <td id="external_link_target">
851
 
852
  <label>
853
  <input type="radio" name="meta[_wpsc_product_metadata][external_link_target]" value=""<?php checked( '', $product_meta['external_link_target'] ); ?> />
854
- <?php _ex( 'Default (set by theme)', 'External product link target', 'wpsc' ); ?>
855
  </label>
856
 
857
  <label>
858
  <input type="radio" name="meta[_wpsc_product_metadata][external_link_target]" value="_self"<?php checked( '_self', $product_meta['external_link_target'] ); ?> />
859
- <?php esc_html_e( 'Force open in same window', 'wpsc' ); ?>
860
  </label>
861
 
862
  <label>
863
  <input type="radio" name="meta[_wpsc_product_metadata][external_link_target]" value="_blank"<?php checked( '_blank', $product_meta['external_link_target'] ); ?> />
864
- <?php esc_html_e( 'Force open in new window', 'wpsc' ); ?>
865
  </label>
866
 
867
  </td>
868
  </tr>
869
  </tbody>
870
  </table>
871
- <em><?php esc_html_e( 'This option overrides the "Buy Now" and "Add to Cart" buttons, replacing them with the link you describe here.', 'wpsc' ); ?></em>
872
  <?php
873
 
874
  wp_nonce_field( 'update', 'wpsc_product_external_link_nonce' );
@@ -878,7 +878,7 @@ function wpsc_product_external_link_forms() {
878
  function wpsc_additional_desc() {
879
  ?>
880
  <textarea name='additional_description' id='additional_description' cols='40' rows='5' ><?php echo esc_textarea( get_post_field( 'post_excerpt', get_the_ID() ) ); ?></textarea>
881
- <em><?php _e( 'Short Descriptions are optional hand-crafted summaries of your content that can be used in your theme.', 'wpsc' ); ?></em>
882
  <?php
883
 
884
  }
@@ -905,19 +905,27 @@ function wpsc_product_gallery( $post ) {
905
  // get the thumbnail URL
906
  $thumb_url = wp_get_attachment_thumb_url( absint( $image_id ) );
907
  // output each item
908
- $output .= '<li>';
909
- $output .= '<img src="' . esc_url( $thumb_url ) . '">';
910
- $output .= '<input type="hidden" name="wpsc-product-gallery-imgs[]" value="' . absint( $image_id ) . '">';
 
 
 
 
911
  $output .= '</li>';
912
  }
913
  }
914
  $output .= '</ul>';
915
  $output .= '<div class="clear"></div>';
916
  $output .= '</div>';
 
 
 
 
917
  // button for old iframe for non JS people
918
  $output .= '<p class="hide-if-no-js">';
919
- $output .= '<a class="button button-small thickbox" title="' . esc_attr__( 'Manage Product Image Gallery...', 'wpsc' ).'" href="' . $upload_iframe_src . '" id="wpsc-manage-product-gallery">';
920
- $output .= esc_html__( 'Manage Product Image Gallery...', 'wpsc' );
921
  $output .= '</a>';
922
  $output .= '</p>';
923
 
@@ -942,10 +950,10 @@ function wpsc_product_download_forms() {
942
  ?>
943
  <?php echo wpsc_select_product_file( $post->ID ); ?>
944
 
945
- <a href="admin.php?wpsc_admin_action=product_files_existing&amp;product_id=<?php echo absint( $post->ID ); ?>" class="thickbox button button-small" title="<?php echo esc_attr( sprintf( __( 'Select all downloadable files for %s', 'wpsc' ), $post->post_title ) ); ?>"><?php esc_html_e( 'Add existing files...', 'wpsc' ); ?></a>
946
 
947
  <div class="wpsc_fileUpload button button-small">
948
- <span><?php esc_html_e('Upload new file...','wpsc'); ?></span>
949
  <input type='file' name='file' class="button button-small" value='' onchange="wpsc_push_v2t(this, '#wpsc_fileupload_path')" />
950
  </div>
951
  <em id="wpsc_fileupload_path"></em>
@@ -954,10 +962,10 @@ function wpsc_product_download_forms() {
954
  if ( function_exists( "make_mp3_preview" ) || function_exists( "wpsc_media_player" ) ) {
955
  ?>
956
  <br />
957
- <h4><?php esc_html_e( 'Select an MP3 file to upload as a preview', 'wpsc' ) ?></h4>
958
  <input type='file' name='preview_file' value='' /><br />
959
 
960
- <h4><?php esc_html_e( 'Your preview for this product', 'wpsc' ) ?>:</h4>
961
 
962
  <?php
963
  $args = array(
@@ -1000,15 +1008,15 @@ function wpsc_product_personalization_forms() {
1000
  <ul id="wpsc_product_personalization_option">
1001
  <li>
1002
  <input type="checkbox" name="meta[_wpsc_product_metadata][engraved]" <?php checked( $product_meta['engraved'], '1' ); ?> id="add_engrave_text" />
1003
- <label for="add_engrave_text"><?php esc_html_e( 'Users can personalize this product by leaving a message on single product page', 'wpsc' ); ?></label>
1004
  </li>
1005
  <li>
1006
  <input type="checkbox" name="meta[_wpsc_product_metadata][can_have_uploaded_image]" <?php checked( $product_meta['can_have_uploaded_image'], '1' ); ?> id="can_have_uploaded_image" />
1007
- <label for="can_have_uploaded_image"> <?php esc_html_e( 'Users can upload images on single product page to purchase logs.', 'wpsc' ); ?></label>
1008
  </li>
1009
  <?php do_action( 'wpsc_add_advanced_options', $post->ID ); ?>
1010
  </ul>
1011
- <em><?php _e( "Form fields for the customer to personalize this product will be shown on it's single product page.", 'wpsc' ); ?></em>
1012
  <?php
1013
 
1014
  wp_nonce_field( 'update', 'wpsc_product_personalization_nonce' );
@@ -1026,9 +1034,9 @@ function wpsc_product_delivery_forms(){
1026
 
1027
  <div id="wpsc_product_delivery_forms" class="categorydiv wpsc-categorydiv">
1028
  <ul id="wpsc_product_delivery_tabs" class="category-tabs">
1029
- <li class="tabs"><a href="#wpsc_product_delivery-shipping"><?php _e( 'Shipping', 'wpsc' ); ?></a></li>
1030
- <li><a href="#wpsc_product_delivery-download"><?php _e( 'Download', 'wpsc' ); ?></a></li>
1031
- <li><a href="#wpsc_product_delivery-external_link"><?php _e( 'External Link', 'wpsc' ); ?></a></li>
1032
  </ul>
1033
 
1034
  <div id="wpsc_product_delivery-shipping" class="tabs-panel" style="display:block;">
@@ -1036,7 +1044,7 @@ function wpsc_product_delivery_forms(){
1036
  if ( ! $has_variations ) {
1037
  wpsc_product_shipping_forms();
1038
  } else {
1039
- echo '<p>' . sprintf( __( 'This product has variations. To edit the shipping, please use the <a href="%s">Variation Controls</a>.', 'wpsc' ), '#wpsc_product_variation_forms' ) . '</p>';
1040
  }
1041
  ?>
1042
  </div>
@@ -1060,10 +1068,10 @@ function wpsc_product_details_forms(){
1060
 
1061
  <div id="wpsc_product_details_forms" class="categorydiv wpsc-categorydiv">
1062
  <ul id="wpsc_product_details_tabs" class="category-tabs">
1063
- <li class="tabs"><a href="#wpsc_product_details-image"><?php _e( 'Image Gallery', 'wpsc' ); ?></a></li>
1064
- <li><a href="#wpsc_product_details-desc"><?php _e( 'Short Description', 'wpsc' ); ?></a></li>
1065
- <li><a href="#wpsc_product_details-personalization"><?php _e( 'Personalization', 'wpsc' ); ?></a></li>
1066
- <li><a href="#wpsc_product_details-meta"><?php _e( 'Metadata', 'wpsc' ); ?></a></li>
1067
  </ul>
1068
 
1069
  <div id="wpsc_product_details-image" class="tabs-panel" style="display: block;">
@@ -1112,9 +1120,9 @@ function wpsc_filter_gettex_with_context( $translation, $text, $context, $domain
1112
 
1113
  if ( 'Taxonomy Parent' == $context && 'Parent' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ) {
1114
  $translations = get_translations_for_domain( $domain );
1115
- return $translations->translate( 'Variation Set', 'wpsc' );
1116
  //this will never happen, this is here only for gettext to pick up the translation
1117
- return __( 'Variation Set', 'wpsc' );
1118
  }
1119
  return $translation;
1120
  }
@@ -1139,15 +1147,15 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1139
 
1140
  jQuery("a.wp-post-thumbnail").each(function(){
1141
  var product_image = jQuery(this).text();
1142
- if (product_image == "' . esc_js( __( 'Use as featured image' ) ) . '") {
1143
- jQuery(this).text("' . esc_js( __('Use as Product Thumbnail', 'wpsc') ) . '");
1144
  }
1145
  });
1146
 
1147
  var trash = jQuery("#media-upload a.del-link").text();
1148
 
1149
- if (trash == "' . esc_js( __( 'Delete' ) ) . '") {
1150
- jQuery("#media-upload a.del-link").text("' . esc_js( __( 'Trash' ) ) . '");
1151
  }
1152
 
1153
 
@@ -1156,7 +1164,7 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1156
  </script>';
1157
  $out .= ob_get_clean();
1158
 
1159
- $size_names = array( 'small-product-thumbnail' => __( 'Default Product Thumbnail Size', 'wpsc' ), 'medium-single-product' => __( 'Single Product Image Size', 'wpsc' ), 'full' => __( 'Full Size', 'wpsc' ) );
1160
 
1161
  $check = get_post_meta( $post->ID, '_wpsc_selected_image_size', true );
1162
  if ( !$check )
@@ -1184,7 +1192,7 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1184
  $html .= "<label for='{$css_id}'>$name</label>";
1185
  // only show the dimensions if that choice is available
1186
  if ( $enabled )
1187
- $html .= " <label for='{$css_id}' class='help'>" . sprintf( __( "(%d&nbsp;&times;&nbsp;%d)", 'wpsc' ), $downsize[1], $downsize[2] ). "</label>";
1188
 
1189
  $html .= '</div>';
1190
 
@@ -1192,13 +1200,13 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1192
  }
1193
 
1194
  unset( $form_fields['post_excerpt'], $form_fields['image_url'], $form_fields['post_content'], $form_fields['post_title'], $form_fields['url'], $form_fields['align'], $form_fields['image_alt']['helps'], $form_fields["image-size"] );
1195
- $form_fields['image_alt']['helps'] = __( 'Alt text for the product image, e.g. &#8220;Rockstar T-Shirt&#8221;', 'wpsc' );
1196
 
1197
  $form_fields["wpsc_image_size"] = array(
1198
- 'label' => __( 'Single Product Page Thumbnail:', 'wpsc' ),
1199
  'input' => 'html',
1200
  'html' => $out,
1201
- 'helps' => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'This is the Thumbnail size that will be displayed on the Single Product page. You can change the default sizes under your store settings', 'wpsc' ) . "</span>"
1202
  );
1203
 
1204
  //This is for the custom thumbnail size.
@@ -1211,9 +1219,9 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1211
 
1212
  ";
1213
  $form_fields["wpsc_custom_thumb"] = array(
1214
- "label" => __( 'Products Page Thumbnail Size:', 'wpsc' ),
1215
  "input" => "html", // this is default if "input" is omitted
1216
- "helps" => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'Custom thumbnail size for this image on the main Product Page', 'wpsc') . "</span>",
1217
  "html" => $custom_thumb_html
1218
  );
1219
  }
@@ -1328,7 +1336,7 @@ function wpsc_save_quickedit_box( $post_id ) {
1328
  break;
1329
 
1330
  case 'sku':
1331
- if ( $value == __( 'N/A', 'wpsc' ) ) {
1332
  $value = '';
1333
  } else {
1334
  $value = sanitize_text_field( $value );
@@ -1371,9 +1379,9 @@ function wpsc_quick_edit_boxes( $col_name, $_screen_post_type = null ) {
1371
  case 'SKU' :
1372
  ?>
1373
  <label style="max-width: 85%" class="alignleft">
1374
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'SKU:', 'wpsc' ); ?> </span>
1375
  <input type="text" name="sku" class="wpsc_ie_sku" />
1376
- <input type="checkbox" name="sku_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1377
 
1378
  </label>
1379
  <?php
@@ -1381,36 +1389,36 @@ function wpsc_quick_edit_boxes( $col_name, $_screen_post_type = null ) {
1381
  case 'weight' :
1382
  ?>
1383
  <label style="max-width: 85%" class="alignleft">
1384
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Weight:', 'wpsc' ); ?> </span>
1385
  <input type="text" name="weight" class="wpsc_ie_weight" />
1386
- <input type="checkbox" name="weight_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1387
  </label>
1388
  <?php
1389
  break;
1390
  case 'stock' :
1391
  ?>
1392
  <label style="max-width: 85%" class="alignleft">
1393
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Stock:', 'wpsc' ); ?> </span>
1394
  <input type="text" name="stock" class="wpsc_ie_stock" />
1395
- <input type="checkbox" name="stock_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1396
  </label>
1397
  <?php
1398
  break;
1399
  case 'price' :
1400
  ?>
1401
  <label style="max-width: 85%" class="alignleft">
1402
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Price:', 'wpsc' ); ?> </span>
1403
  <input type="text" name="price" class="wpsc_ie_price" />
1404
- <input type="checkbox" name="price_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1405
  </label>
1406
  <?php
1407
  break;
1408
  case 'sale_price' :
1409
  ?>
1410
  <label style="max-width: 85%" class="alignleft">
1411
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Sale Price:', 'wpsc' ); ?> </span>
1412
  <input type="text" name="sale_price" class="wpsc_ie_sale_price" />
1413
- <input type="checkbox" name="sale_price_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1414
  </label>
1415
  <?php
1416
  break;
@@ -1457,9 +1465,9 @@ function variation_price_field( $variation ) {
1457
  if( !isset( $_GET['action'] ) ) {
1458
  ?>
1459
  <div class="form-field">
1460
- <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wpsc' ); ?></label>
1461
  <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1462
- <span class="description"><?php esc_html_e( 'You can list a default price here for this variation. You can list a regular price (18.99), differential price (+1.99 / -2) or even a percentage-based price (+50% / -25%).', 'wpsc' ); ?></span>
1463
  </div>
1464
  <script type="text/javascript">
1465
  jQuery('#parent option:contains("   ")').remove();
@@ -1472,11 +1480,11 @@ function variation_price_field( $variation ) {
1472
  ?>
1473
  <tr class="form-field">
1474
  <th scope="row" valign="top">
1475
- <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wpsc' ); ?></label>
1476
  </th>
1477
  <td>
1478
  <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1479
- <span class="description"><?php esc_html_e( 'You can list a default price here for this variation. You can list a regular price (18.99), differential price (+1.99 / -2) or even a percentage-based price (+50% / -25%).', 'wpsc' ); ?></span>
1480
  </td>
1481
  </tr>
1482
  <?php
@@ -1526,9 +1534,9 @@ function variation_price_field_check( $variation ) {
1526
  $checked = ''; ?>
1527
 
1528
  <tr class="form-field">
1529
- <th scope="row" valign="top"><label for="apply_to_current"><?php esc_html_e( 'Apply to current variations?', 'wpsc' ) ?></label></th>
1530
  <td>
1531
- <span class="description"><input type="checkbox" name="apply_to_current" id="apply_to_current" style="width:2%;" <?php echo $checked; ?> /><?php _e( 'By checking this box, the price rule you implement above will be applied to all variations that currently exist. If you leave it unchecked, it will only apply to products that use this variation created or edited from now on. Take note, this will apply this rule to <strong>every</strong> product using this variation. If you need to override it for any reason on a specific product, simply go to that product and change the price.', 'wpsc' ); ?></span>
1532
  </td>
1533
  </tr>
1534
  <?php
@@ -1650,7 +1658,7 @@ function wpsc_get_admin_product_gallery( $product_id = 0 ) {
1650
  // in their galleries
1651
  foreach( $gallery as $key => $image_id ) {
1652
  if ( get_post_type( $image_id ) !== 'attachment' ) {
1653
- unset( $gallery[$key] );
1654
  }
1655
  }
1656
 
@@ -1705,4 +1713,5 @@ function wpsc_new_gallery_save( $product_id = 0 ) {
1705
  do_action( 'wpsc_after_gallery_save', $product_id, $image_ids );
1706
 
1707
  }
1708
- add_action( 'wpsc_edit_product', 'wpsc_new_gallery_save' );
 
147
  ?>
148
  <em id="wpsc_product_price_metabox_live_title" class="wpsc_metabox_live_title">
149
  <p>&nbsp;<?php echo esc_html( $ct_symb ); ?><span><?php echo esc_html( $sale_price ); ?></span></p>
150
+ <del><?php echo esc_html( $ct_symb ); ?><span><?php echo esc_html( $price ) ?></span></del>
151
  </em>
152
  <input type="hidden" id="parent_post" name="parent_post" value="<?php echo $post->post_parent; ?>" />
153
  <?php /* Lots of tedious work is avoided with this little line. */ ?>
156
  <?php /* Check product if a product has variations */ ?>
157
  <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
158
  <?php $price = wpsc_product_variation_price_from( $post->ID ); ?>
159
+ <p style="margin-top: 6px;"><?php echo sprintf( __( 'This product has variations. To edit the price, please use the <a href="%s">Variation Controls</a>.' , 'wp-e-commerce' ), '#wpsc_product_variation_forms' ); ?></p>
160
+ <p><?php printf( __( 'Price: %s and above.' , 'wp-e-commerce' ), $price ); ?></p>
161
  <?php else: ?>
162
 
163
  <div class='wpsc_floatleft' style="width:100px;">
164
+ <label for="wpsc_price"><?php _e( 'Price', 'wp-e-commerce' ); ?></label>
165
  <?php echo esc_html( $ct_symb ); ?> <input id="wpsc_price"
166
  type="text"
167
  style="width: 70px;"
170
  </div>
171
 
172
  <div class='wpsc_floatleft' style='width:95px; margin-left:30px;'>
173
+ <label for='wpsc_sale_price'><?php _e( 'Sale Price', 'wp-e-commerce' ); ?></label>
174
  <?php echo esc_html( $ct_symb ); ?> <input id = "wpsc_sale_price"
175
  type="text"
176
  style="width: 70px;"
182
  <table>
183
  <thead>
184
  <tr>
185
+ <th class="type" colspan="2"><?php esc_html_e( 'Alternative Currencies:', 'wp-e-commerce' ); ?></th>
186
+ <th class="price"><?php esc_html_e( 'Price:', 'wp-e-commerce' ); ?></th>
187
  <tr>
188
  </thead>
189
  <tbody>
225
  </tr>
226
  </tbody>
227
  </table>
228
+ <a href="#wpsc_currency_row_template" class="button button-small wpsc_add_new_currency"><?php esc_html_e( 'Add a Currency Option', 'wp-e-commerce' ); ?></a>
229
  <?php wp_nonce_field( 'update-options', 'wpsc-update-currency-layers', false ); ?>
230
  </div>
231
 
233
  <table>
234
  <thead>
235
  <tr>
236
+ <th class="qty" colspan="2"><?php esc_html_e( 'Quantity:', 'wp-e-commerce' ); ?></th>
237
+ <th class="curr"><span class="hidden"><?php esc_html_e( 'Currency:', 'wp-e-commerce' ); ?><span></th>
238
+ <th class="price"><?php esc_html_e( 'Price:', 'wp-e-commerce' ); ?></th>
239
  </tr>
240
  </thead>
241
  <tbody>
249
  <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
250
  <td class="qty">
251
  <input type="text" size="5" value="<?php echo absint( $quantity ); ?>" name="table_rate_price[quantity][]" />
252
+ <?php esc_html_e( '+', 'wp-e-commerce' ); ?>
253
  </td>
254
  <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td>
255
  <td><input class="newCurrPrice text" value="<?php echo $table_price; ?>" name="table_rate_price[table_price][]" /></td>
263
  <td class="remove"><a href="#" class="remove_line<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
264
  <td class="qty">
265
  <input size="5" value="0" name="table_rate_price[quantity][]" />
266
+ <?php esc_html_e( '+', 'wp-e-commerce' ); ?>
267
  </td>
268
  <td class="curr"><?php echo $ct_code . ' ' . $ct_symb; ?></td>
269
  <td><input size="10"class="newCurrPrice text" value="0" name="table_rate_price[table_price][]" /></td>
270
  </tr>
271
  </tbody>
272
  </table>
273
+ <a href="#wpsc_quantity_discount_row_template" class="add_level button button-small"><?php esc_html_e( 'Add a Quantity Discount', 'wp-e-commerce' ); ?></a>
274
  <?php wp_nonce_field( 'update-options', 'wpsc-update-quantity-discounts', false ); ?>
275
  </div>
276
 
277
  <input id="add_form_donation" type="checkbox" name="meta[_wpsc_is_donation]" value="yes" <?php checked( $product_data['meta']['_wpsc_is_donation'], 1 ); ?> />
278
+ <label for="add_form_donation"><?php _e( 'Purchase is a donation.', 'wp-e-commerce' ) ?></label>
279
  <?php wp_nonce_field( 'update', 'wpsc_product_pricing_nonce' ); ?>
280
 
281
  <?php endif;
315
  // Display live title if stock is set
316
  if ( isset( $product_data['meta']['_wpsc_stock'] ) && is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {
317
  $live_title = '<em id="wpsc_product_stock_metabox_live_title" class="wpsc_metabox_live_title">';
318
+ $live_title .= sprintf( '<p><span>%s</span> %s</p>', wpsc_format_number( $product_data['meta']['_wpsc_stock'], 0 ), _x( 'left in stock', 'live preview of stock remaining in admin', 'wp-e-commerce' ) );
319
  $live_title .= '</em>';
320
 
321
  echo $live_title;
323
 
324
  if ( ! empty( $product_meta['unpublish_when_none_left'] ) && ! isset( $product_meta['notify_when_none_left'] ) )
325
  ?>
326
+ <label for="wpsc_sku"><abbr title="<?php esc_attr_e( 'Stock Keeping Unit', 'wp-e-commerce' ); ?>"><?php esc_html_e( 'SKU:', 'wp-e-commerce' ); ?></abbr></label>
327
  <?php
328
  if ( !isset( $product_data['meta']['_wpsc_sku'] ) )
329
  $product_data['meta']['_wpsc_sku'] = $wpsc_product_defaults['meta']['sku']; ?><br />
333
  if ( !isset( $product_data['meta']['_wpsc_stock'] ) )
334
  $product_data['meta']['_wpsc_stock'] = ''; ?>
335
  <br /><input class='limited_stock_checkbox' id='add_form_quantity_limited' type='checkbox' value='yes' <?php if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) echo 'checked="checked"'; else echo ''; ?> name='meta[_wpsc_limited_stock]' />
336
+ <label for='add_form_quantity_limited' class='small'><?php esc_html_e( 'Product has limited stock', 'wp-e-commerce' ); ?></label>
337
  <?php
338
  if ( $post->ID > 0 ) {
339
  if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {?>
343
  } ?>
344
  <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
345
  <?php $stock = wpsc_variations_stock_remaining( $post->ID ); ?>
346
+ <p><?php echo sprintf( __( 'This product has variations. To edit the quantity, please use the <a href="%s">Variation Controls</a> below.' , 'wp-e-commerce' ), '#wpsc_product_variation_forms' ); ?></p>
347
+ <p><?php printf( _n( "%s variant item in stock.", "%s variant items in stock.", $stock, 'wp-e-commerce' ), $stock ); ?></p>
348
  <?php else: ?>
349
  <div style="margin-bottom:20px;">
350
+ <label for="stock_limit_quantity"><?php esc_html_e( 'Quantity in stock', 'wp-e-commerce' ); ?></label>
351
  <input type='number' min="0" step="1" style="width:80px; margin-left:50px;"
352
  id="stock_limit_quantity" name='meta[_wpsc_stock]'
353
  size='3' value='<?php echo absint( $product_data['meta']['_wpsc_stock'] ); ?>'
361
  echo '<p><em>';
362
  printf( _n('%s of them is reserved for pending or recently completed orders.',
363
  '%s of them are reserved for pending or recently completed orders.',
364
+ $reserved_quantity, 'wp-e-commerce'), $reserved_quantity );
365
 
366
  echo '</em></p>';
367
  }
368
  ?>
369
  <?php endif; ?>
370
 
371
+ <p><?php esc_html_e( 'When stock reduces to zero:', 'wp-e-commerce' ); ?></p>
372
  <div class='notify_when_none_left'>
373
  <input type='checkbox' id="notify_when_oos"
374
  name='meta[_wpsc_product_metadata][notify_when_none_left]'
375
  class='notify_when_oos'<?php checked( $product_meta['notify_when_none_left'] ); ?> />
376
+ <label for="notify_when_oos"><?php esc_html_e( 'Notify site owner via email', 'wp-e-commerce' ); ?></label>
377
  </div>
378
  <div class='unpublish_when_none_left'>
379
  <input type='checkbox' id="unpublish_when_oos"
380
  name='meta[_wpsc_product_metadata][unpublish_when_none_left]'
381
  class='unpublish_when_oos'<?php checked( $product_meta['unpublish_when_none_left'] ); ?> />
382
+ <label for="unpublish_when_oos"><?php esc_html_e( 'Unpublish product from website', 'wp-e-commerce' ); ?></label>
383
 
384
  </div>
385
  </div> <?php
386
  } else { ?>
387
  <div style='display: none;' class='edit_stock'>
388
+ <?php esc_html_e( 'Stock Qty', 'wp-e-commerce' ); ?><input type='text' name='meta[_wpsc_stock]' value='0' size='10' />
389
  <div style='font-size:9px; padding:5px;'>
390
+ <input type='checkbox' class='notify_when_oos' name='meta[_wpsc_product_metadata][notify_when_none_left]' /> <?php esc_html_e( 'Email site owner if this Product runs out of stock', 'wp-e-commerce' ); ?>
391
+ <input type='checkbox' class='unpublish_when_oos' name='meta[_wpsc_product_metadata][unpublish_when_none_left]' /> <?php esc_html_e( 'Set status to Unpublished if this Product runs out of stock', 'wp-e-commerce' ); ?>
392
  </div>
393
  </div>
394
  <?php
422
  $band_select_settings = array(
423
  'id' => 'wpec_taxes_band',
424
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_band]',
425
+ 'label' => __( 'Custom Tax Band', 'wp-e-commerce' )
426
  );
427
  $wpec_taxes_band = '';
428
  if ( isset( $product_meta['wpec_taxes_band'] ) ) {
434
  'type' => 'checkbox',
435
  'id' => 'wpec_taxes_taxable',
436
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable]',
437
+ 'label' => __( 'Product is exempt from taxation.', 'wp-e-commerce' )
438
  );
439
 
440
  if ( isset( $product_meta['wpec_taxes_taxable'] ) && 'on' == $product_meta['wpec_taxes_taxable'] ) {
446
  $taxable_amount_input_settings = array(
447
  'id' => 'wpec_taxes_taxable_amount',
448
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable_amount]',
449
+ 'label' => __( 'Taxable Amount', 'wp-e-commerce' ),
450
+ 'description' => __( 'Taxable amount in your currency, not percentage of price.', 'wp-e-commerce' ),
451
  );
452
 
453
  if ( isset( $product_meta['wpec_taxes_taxable_amount'] ) ) {
468
  $output .= '</p>';
469
 
470
  if ( ! $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_enabled() ) {
471
+ $output = '<p>' . sprintf( __( 'Taxes are not enabled. See <a href="%s">Settings &gt; Taxes</a>', 'wp-e-commerce' ), admin_url( 'options-general.php?page=wpsc-settings&tab=taxes' ) ) . '</p>';
472
  }
473
 
474
  echo $output;
504
  */
505
  function wpsc_dimension_units() {
506
  return array(
507
+ 'in' => __( 'inches', 'wp-e-commerce' ),
508
+ 'cm' => __( 'cm', 'wp-e-commerce' ),
509
+ 'meter' => __( 'meters', 'wp-e-commerce' )
510
  );
511
  }
512
 
519
  */
520
  function wpsc_weight_units() {
521
  return array(
522
+ 'pound' => __( 'pounds', 'wp-e-commerce' ),
523
+ 'ounce' => __( 'ounces', 'wp-e-commerce' ),
524
+ 'gram' => __( 'grams', 'wp-e-commerce' ),
525
+ 'kilogram' => __( 'kilograms', 'wp-e-commerce' )
526
  );
527
  }
528
 
539
  function wpsc_weight_unit_display( $unit ) {
540
  switch ( $unit ) {
541
  case 'pound' :
542
+ return __( ' lbs.', 'wp-e-commerce' );
543
  case 'ounce' :
544
+ return __( ' oz.', 'wp-e-commerce' );
545
  case 'gram' :
546
+ return __( ' g', 'wp-e-commerce' );
547
  case 'kilograms' :
548
  case 'kilogram' :
549
+ return __( ' kgs.', 'wp-e-commerce' );
550
  }
551
  return '';
552
  }
660
  <div class="wpsc-stock-editor<?php if ( $bulk ) echo ' wpsc-bulk-edit' ?>">
661
  <p class="wpsc-form-field">
662
  <input type="checkbox" id="wpsc-product-no-shipping" name="<?php echo esc_attr( $field_name_prefix ); ?>[no_shipping]" value="1" <?php checked( $no_shipping && ! $bulk ); ?>>
663
+ <label for="wpsc-product-no-shipping"><?php _e( 'Product will <em>not</em> be shipped to customer', 'wp-e-commerce' ); ?></label>
664
  </p>
665
 
666
  <div class="wpsc-product-shipping-section wpsc-product-shipping-weight-dimensions">
667
+ <p><strong><?php esc_html_e( 'Calculate Shipping Costs based on measurements', 'wp-e-commerce' ); ?></strong></p>
668
 
669
  <!-- WEIGHT INPUT -->
670
  <p class="wpsc-form-field">
671
  <?php if ( $bulk ) : ?>
672
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][weight]" value="1" />
673
  <?php endif; ?>
674
+ <label for="wpsc-product-shipping-weight"><?php echo esc_html_e( 'Weight', 'wp-e-commerce' ); ?></label>
675
  <span class="wpsc-product-shipping-input">
676
  <input type="text" id="wpsc-product-shipping-weight" name="<?php echo esc_attr( $field_name_prefix ); ?>[weight]" value="<?php if ( ! $bulk ) echo esc_attr( wpsc_format_number( $weight ) ); ?>" />
677
  <select id="wpsc-product-shipping-weight-unit" name="<?php echo $field_name_prefix; ?>[weight_unit]">
688
  <?php if ( $bulk ) : ?>
689
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][dimensions]" value="1" />
690
  <?php endif; ?>
691
+ <label for="wpsc-product-shipping-weight"><?php echo esc_html_e( 'Dimensions', 'wp-e-commerce' ); ?></label>
692
  <span class="wpsc-product-shipping-input">
693
  <input placeholder="L" type="text" id="wpsc-product-shipping-length" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][length]" value="<?php if ( !$bulk && $dimensions['length']>0 ) echo esc_attr( wpsc_format_number( $dimensions['length'] ) ); ?>" />&nbsp;&times;&nbsp;
694
  <input placeholder="W" type="text" id="wpsc-product-shipping-width" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][width]" value="<?php if ( !$bulk && $dimensions['width']>0 ) echo esc_attr( wpsc_format_number( $dimensions['width'] ) ); ?>" />&nbsp;&times;&nbsp;
712
  ?>
713
 
714
  <div class="wpsc-product-shipping-section wpsc-product-shipping-flat-rate">
715
+ <p><strong><?php esc_html_e( 'Flat Rate Settings', 'wp-e-commerce' ); ?></strong></p>
716
  <p class="wpsc-form-field">
717
  <?php if ( $bulk ): ?>
718
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][local]" value="1" />
719
  <?php endif; ?>
720
+ <label for="wpsc-product-shipping-flatrate-local"><?php esc_html_e( 'Local Shipping Fee', 'wp-e-commerce' ); ?></label>
721
  <span>
722
  <?php echo esc_html( $ct_symb ); ?>
723
  <input type="text" id="wpsc-product-shipping-flatrate-local" name="<?php echo esc_html( $field_name_prefix ); ?>[shipping][local]" value="<?php if ( ! $bulk ) echo $shipping['local']; ?>" />
727
  <?php if ( $bulk ): ?>
728
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][international]" value="1" />
729
  <?php endif; ?>
730
+ <label for="wpsc-product-shipping-flatrate-international"><?php esc_html_e( 'International Shipping Fee', 'wp-e-commerce' ); ?></label>
731
  <span>
732
  <?php echo esc_html( $ct_symb ); ?>
733
  <input type="text" id="wpsc-product-shipping-flatrate-international" name="<?php echo esc_html( $field_name_prefix ); ?>[shipping][international]" value="<?php if ( ! $bulk ) echo $shipping['international']; ?>" />
769
  $output = '<table id="wpsc_product_meta_table" class="wp-list-table widefat posts">';
770
  $output .= '<thead>';
771
  $output .= '<tr>';
772
+ $output .= '<th id="wpsc_custom_meta_name_th">' . _x( 'Name', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
773
+ $output .= '<th id="wpsc_custom_meta_value_th">' . _x( 'Value', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
774
+ $output .= '<th id="wpsc_custom_meta_action_th">' . _x( 'Action', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
775
  $output .= '</tr>';
776
  $output .= '</thead>';
777
  $output .= '<tfoot>';
778
  $output .= '<tr>';
779
+ $output .= '<th>' . _x( 'Name', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
780
+ $output .= '<th>' . _x( 'Value', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
781
+ $output .= '<th>' . _x( 'Action', 'Product meta UI', 'wp-e-commerce' ) . '</th>';
782
  $output .= '</tr>';
783
  $output .= '</tfood>';
784
 
785
  $output .= '<tbody>';
786
 
787
  if ( empty( $custom_fields ) ) {
788
+ $output .= '<tr class="no-meta"><td colspan="3"><p>' . sprintf( __( 'You have no custom metadata. You can set any arbitrary meta you like and access it programatically via the <a href="">Post Meta API</a>.', 'wp-e-commerce' ), esc_url( 'https://codex.wordpress.org/Function_Reference/get_post_meta' ) ) . '</p></td></tr>';
789
  } else {
790
  // Display all available metadata
791
  $alternate = false;
796
  $output .= '<tr'. ($alternate ? ' class="alternate"' : '') .'>';
797
  $output .= '<td><input type="text" value="'.esc_attr( $custom_field['meta_key'] ).'" name="custom_meta['.$i.'][name]" id="custom_meta_name_'.$i.'"></input></td>';
798
  $output .= '<td><input type="text" value="'.esc_attr( $custom_field['meta_value'] ).'" name="custom_meta['.$i.'][value]" id="custom_meta_value_'.$i.'"></input></td>';
799
+ $output .= '<td><a href="#" data-nonce="'.esc_attr( $delete_nonce ).'" class="wpsc_remove_meta" onclick="wpsc_remove_custom_meta(this,'.$i.')">'.esc_html( 'Delete', 'wp-e-commerce' ).'</a></td>';
800
  $output .= '</tr>';
801
  }
802
  }
805
  $output .= '<tr id="wpsc_new_meta_template">';
806
  $output .= '<td><input type="text" name="new_custom_meta[name][]" value=""></input></td>';
807
  $output .= '<td><input type="text" name="new_custom_meta[value][]" value=""></input></td>';
808
+ $output .= '<td><a href="#" class="wpsc_remove_meta" onclick="wpsc_remove_empty_meta(this)">'.esc_html( 'Delete', 'wp-e-commerce' ).'</a></td>';
809
  $output .= '</tr>';
810
 
811
  $output .= '</tbody>';
812
  $output .= '</table>';
813
 
814
+ $output .= '<a href="#" class="add_more_meta button button-small" id="wpsc_add_custom_meta">'.esc_html( '+ Add Custom Meta', 'wp-e-commerce' ).'</a>';
815
 
816
  echo $output;
817
 
838
  <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
839
  <tbody>
840
  <tr class="form-field">
841
+ <th valign="top" scope="row"><label for="external_link"><?php esc_html_e( 'URL', 'wp-e-commerce' ); ?></label></th>
842
  <td><input type="text" name="meta[_wpsc_product_metadata][external_link]" id="external_link" value="<?php echo esc_url( $product_meta['external_link'] ); ?>" size="50" style="width: 95%" placeholder="http://" /></td>
843
  </tr>
844
  <tr class="form-field">
845
+ <th valign="top" scope="row"><label for="external_link_text"><?php esc_html_e( 'Label', 'wp-e-commerce' ); ?></label></th>
846
+ <td><input type="text" name="meta[_wpsc_product_metadata][external_link_text]" id="external_link_text" value="<?php echo esc_attr( $product_meta['external_link_text'] ); ?>" size="50" style="width: 95%" placeholder="<?php _e( 'Buy Now', 'wp-e-commerce' ); ?>" /></td>
847
  </tr>
848
  <tr class="form-field">
849
+ <th valign="top" scope="row"><label for="external_link_target"><?php esc_html_e( 'Target', 'wp-e-commerce' ); ?></label></th>
850
  <td id="external_link_target">
851
 
852
  <label>
853
  <input type="radio" name="meta[_wpsc_product_metadata][external_link_target]" value=""<?php checked( '', $product_meta['external_link_target'] ); ?> />
854
+ <?php _ex( 'Default (set by theme)', 'External product link target', 'wp-e-commerce' ); ?>
855
  </label>
856
 
857
  <label>
858
  <input type="radio" name="meta[_wpsc_product_metadata][external_link_target]" value="_self"<?php checked( '_self', $product_meta['external_link_target'] ); ?> />
859
+ <?php esc_html_e( 'Force open in same window', 'wp-e-commerce' ); ?>
860
  </label>
861
 
862
  <label>
863
  <input type="radio" name="meta[_wpsc_product_metadata][external_link_target]" value="_blank"<?php checked( '_blank', $product_meta['external_link_target'] ); ?> />
864
+ <?php esc_html_e( 'Force open in new window', 'wp-e-commerce' ); ?>
865
  </label>
866
 
867
  </td>
868
  </tr>
869
  </tbody>
870
  </table>
871
+ <em><?php esc_html_e( 'This option overrides the "Buy Now" and "Add to Cart" buttons, replacing them with the link you describe here.', 'wp-e-commerce' ); ?></em>
872
  <?php
873
 
874
  wp_nonce_field( 'update', 'wpsc_product_external_link_nonce' );
878
  function wpsc_additional_desc() {
879
  ?>
880
  <textarea name='additional_description' id='additional_description' cols='40' rows='5' ><?php echo esc_textarea( get_post_field( 'post_excerpt', get_the_ID() ) ); ?></textarea>
881
+ <em><?php _e( 'Short Descriptions are optional hand-crafted summaries of your content that can be used in your theme.', 'wp-e-commerce' ); ?></em>
882
  <?php
883
 
884
  }
905
  // get the thumbnail URL
906
  $thumb_url = wp_get_attachment_thumb_url( absint( $image_id ) );
907
  // output each item
908
+ $output .= '<li><div class="list_gallery_image">';
909
+ $output .= '<img src="' . esc_url( $thumb_url ) . '">';
910
+ $output .= '<input type="hidden" name="wpsc-product-gallery-imgs[]" value="' . absint( $image_id ) . '">';
911
+
912
+ $output .= '<span class="product_gallery_image_delete_button dashicons dashicons-no-alt"></span></div>';
913
+ $output .= '<input type="hidden" class="product_gallery_image_id" value="'.$image_id.'">';
914
+ $output .= '<input type="hidden" class="product_gallery_post_id" value="'.$post->ID.'">';
915
  $output .= '</li>';
916
  }
917
  }
918
  $output .= '</ul>';
919
  $output .= '<div class="clear"></div>';
920
  $output .= '</div>';
921
+ $nonce_var = wp_create_nonce( 'wpsc_gallery_nonce' );
922
+ ?>
923
+ <input type="hidden" class="nonce_class" value="<?php echo $nonce_var; ?>">
924
+ <?php
925
  // button for old iframe for non JS people
926
  $output .= '<p class="hide-if-no-js">';
927
+ $output .= '<a class="button button-small thickbox" title="' . esc_attr__( 'Manage Product Image Gallery...', 'wp-e-commerce' ).'" href="' . $upload_iframe_src . '" id="wpsc-manage-product-gallery">';
928
+ $output .= esc_html__( 'Manage Product Image Gallery...', 'wp-e-commerce' );
929
  $output .= '</a>';
930
  $output .= '</p>';
931
 
950
  ?>
951
  <?php echo wpsc_select_product_file( $post->ID ); ?>
952
 
953
+ <a href="admin.php?wpsc_admin_action=product_files_existing&amp;product_id=<?php echo absint( $post->ID ); ?>" class="thickbox button button-small" title="<?php echo esc_attr( sprintf( __( 'Select all downloadable files for %s', 'wp-e-commerce' ), $post->post_title ) ); ?>"><?php esc_html_e( 'Add existing files...', 'wp-e-commerce' ); ?></a>
954
 
955
  <div class="wpsc_fileUpload button button-small">
956
+ <span><?php esc_html_e('Upload new file...','wp-e-commerce'); ?></span>
957
  <input type='file' name='file' class="button button-small" value='' onchange="wpsc_push_v2t(this, '#wpsc_fileupload_path')" />
958
  </div>
959
  <em id="wpsc_fileupload_path"></em>
962
  if ( function_exists( "make_mp3_preview" ) || function_exists( "wpsc_media_player" ) ) {
963
  ?>
964
  <br />
965
+ <h4><?php esc_html_e( 'Select an MP3 file to upload as a preview', 'wp-e-commerce' ) ?></h4>
966
  <input type='file' name='preview_file' value='' /><br />
967
 
968
+ <h4><?php esc_html_e( 'Your preview for this product', 'wp-e-commerce' ) ?>:</h4>
969
 
970
  <?php
971
  $args = array(
1008
  <ul id="wpsc_product_personalization_option">
1009
  <li>
1010
  <input type="checkbox" name="meta[_wpsc_product_metadata][engraved]" <?php checked( $product_meta['engraved'], '1' ); ?> id="add_engrave_text" />
1011
+ <label for="add_engrave_text"><?php esc_html_e( 'Users can personalize this product by leaving a message on single product page', 'wp-e-commerce' ); ?></label>
1012
  </li>
1013
  <li>
1014
  <input type="checkbox" name="meta[_wpsc_product_metadata][can_have_uploaded_image]" <?php checked( $product_meta['can_have_uploaded_image'], '1' ); ?> id="can_have_uploaded_image" />
1015
+ <label for="can_have_uploaded_image"> <?php esc_html_e( 'Users can upload images on single product page to purchase logs.', 'wp-e-commerce' ); ?></label>
1016
  </li>
1017
  <?php do_action( 'wpsc_add_advanced_options', $post->ID ); ?>
1018
  </ul>
1019
+ <em><?php _e( "Form fields for the customer to personalize this product will be shown on it's single product page.", 'wp-e-commerce' ); ?></em>
1020
  <?php
1021
 
1022
  wp_nonce_field( 'update', 'wpsc_product_personalization_nonce' );
1034
 
1035
  <div id="wpsc_product_delivery_forms" class="categorydiv wpsc-categorydiv">
1036
  <ul id="wpsc_product_delivery_tabs" class="category-tabs">
1037
+ <li class="tabs"><a href="#wpsc_product_delivery-shipping"><?php _e( 'Shipping', 'wp-e-commerce' ); ?></a></li>
1038
+ <li><a href="#wpsc_product_delivery-download"><?php _e( 'Download', 'wp-e-commerce' ); ?></a></li>
1039
+ <li><a href="#wpsc_product_delivery-external_link"><?php _e( 'External Link', 'wp-e-commerce' ); ?></a></li>
1040
  </ul>
1041
 
1042
  <div id="wpsc_product_delivery-shipping" class="tabs-panel" style="display:block;">
1044
  if ( ! $has_variations ) {
1045
  wpsc_product_shipping_forms();
1046
  } else {
1047
+ echo '<p>' . sprintf( __( 'This product has variations. To edit the shipping, please use the <a href="%s">Variation Controls</a>.', 'wp-e-commerce' ), '#wpsc_product_variation_forms' ) . '</p>';
1048
  }
1049
  ?>
1050
  </div>
1068
 
1069
  <div id="wpsc_product_details_forms" class="categorydiv wpsc-categorydiv">
1070
  <ul id="wpsc_product_details_tabs" class="category-tabs">
1071
+ <li class="tabs"><a href="#wpsc_product_details-image"><?php _e( 'Image Gallery', 'wp-e-commerce' ); ?></a></li>
1072
+ <li><a href="#wpsc_product_details-desc"><?php _e( 'Short Description', 'wp-e-commerce' ); ?></a></li>
1073
+ <li><a href="#wpsc_product_details-personalization"><?php _e( 'Personalization', 'wp-e-commerce' ); ?></a></li>
1074
+ <li><a href="#wpsc_product_details-meta"><?php _e( 'Metadata', 'wp-e-commerce' ); ?></a></li>
1075
  </ul>
1076
 
1077
  <div id="wpsc_product_details-image" class="tabs-panel" style="display: block;">
1120
 
1121
  if ( 'Taxonomy Parent' == $context && 'Parent' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ) {
1122
  $translations = get_translations_for_domain( $domain );
1123
+ return $translations->translate( 'Variation Set', 'wp-e-commerce' );
1124
  //this will never happen, this is here only for gettext to pick up the translation
1125
+ return __( 'Variation Set', 'wp-e-commerce' );
1126
  }
1127
  return $translation;
1128
  }
1147
 
1148
  jQuery("a.wp-post-thumbnail").each(function(){
1149
  var product_image = jQuery(this).text();
1150
+ if (product_image == "' . esc_js( __( 'Use as featured image', 'wp-e-commerce' ) ) . '") {
1151
+ jQuery(this).text("' . esc_js( __('Use as Product Thumbnail', 'wp-e-commerce' ) ) . '");
1152
  }
1153
  });
1154
 
1155
  var trash = jQuery("#media-upload a.del-link").text();
1156
 
1157
+ if (trash == "' . esc_js( __( 'Delete', 'wp-e-commerce' ) ) . '") {
1158
+ jQuery("#media-upload a.del-link").text("' . esc_js( __( 'Trash', 'wp-e-commerce' ) ) . '");
1159
  }
1160
 
1161
 
1164
  </script>';
1165
  $out .= ob_get_clean();
1166
 
1167
+ $size_names = array( 'small-product-thumbnail' => __( 'Default Product Thumbnail Size', 'wp-e-commerce' ), 'medium-single-product' => __( 'Single Product Image Size', 'wp-e-commerce' ), 'full' => __( 'Full Size', 'wp-e-commerce' ) );
1168
 
1169
  $check = get_post_meta( $post->ID, '_wpsc_selected_image_size', true );
1170
  if ( !$check )
1192
  $html .= "<label for='{$css_id}'>$name</label>";
1193
  // only show the dimensions if that choice is available
1194
  if ( $enabled )
1195
+ $html .= " <label for='{$css_id}' class='help'>" . sprintf( __( "(%d&nbsp;&times;&nbsp;%d)", 'wp-e-commerce' ), $downsize[1], $downsize[2] ). "</label>";
1196
 
1197
  $html .= '</div>';
1198
 
1200
  }
1201
 
1202
  unset( $form_fields['post_excerpt'], $form_fields['image_url'], $form_fields['post_content'], $form_fields['post_title'], $form_fields['url'], $form_fields['align'], $form_fields['image_alt']['helps'], $form_fields["image-size"] );
1203
+ $form_fields['image_alt']['helps'] = __( 'Alt text for the product image, e.g. &#8220;Rockstar T-Shirt&#8221;', 'wp-e-commerce' );
1204
 
1205
  $form_fields["wpsc_image_size"] = array(
1206
+ 'label' => __( 'Single Product Page Thumbnail:', 'wp-e-commerce' ),
1207
  'input' => 'html',
1208
  'html' => $out,
1209
+ 'helps' => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'This is the Thumbnail size that will be displayed on the Single Product page. You can change the default sizes under your store settings', 'wp-e-commerce' ) . "</span>"
1210
  );
1211
 
1212
  //This is for the custom thumbnail size.
1219
 
1220
  ";
1221
  $form_fields["wpsc_custom_thumb"] = array(
1222
+ "label" => __( 'Products Page Thumbnail Size:', 'wp-e-commerce' ),
1223
  "input" => "html", // this is default if "input" is omitted
1224
+ "helps" => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'Custom thumbnail size for this image on the main Product Page', 'wp-e-commerce') . "</span>",
1225
  "html" => $custom_thumb_html
1226
  );
1227
  }
1336
  break;
1337
 
1338
  case 'sku':
1339
+ if ( $value == __( 'N/A', 'wp-e-commerce' ) ) {
1340
  $value = '';
1341
  } else {
1342
  $value = sanitize_text_field( $value );
1379
  case 'SKU' :
1380
  ?>
1381
  <label style="max-width: 85%" class="alignleft">
1382
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'SKU:', 'wp-e-commerce' ); ?> </span>
1383
  <input type="text" name="sku" class="wpsc_ie_sku" />
1384
+ <input type="checkbox" name="sku_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1385
 
1386
  </label>
1387
  <?php
1389
  case 'weight' :
1390
  ?>
1391
  <label style="max-width: 85%" class="alignleft">
1392
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Weight:', 'wp-e-commerce' ); ?> </span>
1393
  <input type="text" name="weight" class="wpsc_ie_weight" />
1394
+ <input type="checkbox" name="weight_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1395
  </label>
1396
  <?php
1397
  break;
1398
  case 'stock' :
1399
  ?>
1400
  <label style="max-width: 85%" class="alignleft">
1401
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Stock:', 'wp-e-commerce' ); ?> </span>
1402
  <input type="text" name="stock" class="wpsc_ie_stock" />
1403
+ <input type="checkbox" name="stock_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1404
  </label>
1405
  <?php
1406
  break;
1407
  case 'price' :
1408
  ?>
1409
  <label style="max-width: 85%" class="alignleft">
1410
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Price:', 'wp-e-commerce' ); ?> </span>
1411
  <input type="text" name="price" class="wpsc_ie_price" />
1412
+ <input type="checkbox" name="price_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1413
  </label>
1414
  <?php
1415
  break;
1416
  case 'sale_price' :
1417
  ?>
1418
  <label style="max-width: 85%" class="alignleft">
1419
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Sale Price:', 'wp-e-commerce' ); ?> </span>
1420
  <input type="text" name="sale_price" class="wpsc_ie_sale_price" />
1421
+ <input type="checkbox" name="sale_price_variant"> <span><?php esc_html_e( 'Update Variants', 'wp-e-commerce');?></span>
1422
  </label>
1423
  <?php
1424
  break;
1465
  if( !isset( $_GET['action'] ) ) {
1466
  ?>
1467
  <div class="form-field">
1468
+ <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wp-e-commerce' ); ?></label>
1469
  <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1470
+ <span class="description"><?php esc_html_e( 'You can list a default price here for this variation. You can list a regular price (18.99), differential price (+1.99 / -2) or even a percentage-based price (+50% / -25%).', 'wp-e-commerce' ); ?></span>
1471
  </div>
1472
  <script type="text/javascript">
1473
  jQuery('#parent option:contains("   ")').remove();
1480
  ?>
1481
  <tr class="form-field">
1482
  <th scope="row" valign="top">
1483
+ <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wp-e-commerce' ); ?></label>
1484
  </th>
1485
  <td>
1486
  <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1487
+ <span class="description"><?php esc_html_e( 'You can list a default price here for this variation. You can list a regular price (18.99), differential price (+1.99 / -2) or even a percentage-based price (+50% / -25%).', 'wp-e-commerce' ); ?></span>
1488
  </td>
1489
  </tr>
1490
  <?php
1534
  $checked = ''; ?>
1535
 
1536
  <tr class="form-field">
1537
+ <th scope="row" valign="top"><label for="apply_to_current"><?php esc_html_e( 'Apply to current variations?', 'wp-e-commerce' ) ?></label></th>
1538
  <td>
1539
+ <span class="description"><input type="checkbox" name="apply_to_current" id="apply_to_current" style="width:2%;" <?php echo $checked; ?> /><?php _e( 'By checking this box, the price rule you implement above will be applied to all variations that currently exist. If you leave it unchecked, it will only apply to products that use this variation created or edited from now on. Take note, this will apply this rule to <strong>every</strong> product using this variation. If you need to override it for any reason on a specific product, simply go to that product and change the price.', 'wp-e-commerce' ); ?></span>
1540
  </td>
1541
  </tr>
1542
  <?php
1658
  // in their galleries
1659
  foreach( $gallery as $key => $image_id ) {
1660
  if ( get_post_type( $image_id ) !== 'attachment' ) {
1661
+ unset( $gallery[ $key ] );
1662
  }
1663
  }
1664
 
1713
  do_action( 'wpsc_after_gallery_save', $product_id, $image_ids );
1714
 
1715
  }
1716
+
1717
+ add_action( 'wpsc_edit_product', 'wpsc_new_gallery_save' );
wpsc-admin/includes/duplicate-product-class.php ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Duplicate Product Class
5
+ *
6
+ * @package WP eCommerce
7
+ * @subpackage Duplicate Product Class
8
+ * @since 4.0
9
+ */
10
+
11
+ /**
12
+ * WPSC Duplicate Product Class
13
+ *
14
+ * Used to duplicate products.
15
+ *
16
+ * @since 4.0
17
+ */
18
+ class WPSC_Duplicate_Product {
19
+
20
+ private $post_id = null;
21
+ private $new_post_id = null;
22
+ private $new_parent_id = false;
23
+
24
+ /**
25
+ * Create new duplicate product
26
+ *
27
+ * @since 4.0
28
+ *
29
+ * @param int $post_id Post ID.
30
+ * @param int|false $new_parent_id Optional. New post parent ID.
31
+ * @param int|null $new_post_id Optional. New post ID if copying to exisiting post.
32
+ */
33
+ public function __construct( $post_id, $new_parent_id = false, $new_post_id = null ) {
34
+
35
+ $this->post_id = absint( $post_id );
36
+ $this->new_parent_id = is_numeric( $new_parent_id ) ? absint( $new_parent_id ) : false;
37
+ $this->new_post_id = is_numeric( $new_post_id ) ? absint( $new_post_id ) : null;
38
+ }
39
+
40
+ /**
41
+ * Duplicates a product
42
+ *
43
+ * @since 4.0
44
+ *
45
+ * @uses wp_insert_post() Inserts a new post to the database.
46
+ *
47
+ * @return int|WP_Error New post ID or error.
48
+ */
49
+ public function duplicate_product_process() {
50
+
51
+ $post = get_post( $this->get_post_id() );
52
+
53
+ // If no new post ID yet, duplicate the product post
54
+ if ( ! $this->get_new_post_id() ) {
55
+
56
+ $new_parent_id = $this->get_new_parent_id( $post->post_parent );
57
+
58
+ $new_post_date = $post->post_date;
59
+ $new_post_date_gmt = get_gmt_from_date( $new_post_date );
60
+
61
+ $new_post_type = $post->post_type;
62
+ $post_content = $post->post_content;
63
+ $post_content_filtered = $post->post_content_filtered;
64
+ $post_excerpt = $post->post_excerpt;
65
+ $post_title = sprintf( __( '%s (Duplicate)', 'wp-e-commerce' ), $post->post_title );
66
+ $post_name = $post->post_name;
67
+ $comment_status = $post->comment_status;
68
+ $ping_status = $post->ping_status;
69
+
70
+ $defaults = array(
71
+ 'post_status' => $post->post_status,
72
+ 'post_type' => $new_post_type,
73
+ 'ping_status' => $ping_status,
74
+ 'post_parent' => $new_parent_id,
75
+ 'menu_order' => $post->menu_order,
76
+ 'to_ping' => $post->to_ping,
77
+ 'pinged' => $post->pinged,
78
+ 'post_excerpt' => $post_excerpt,
79
+ 'post_title' => $post_title,
80
+ 'post_content' => $post_content,
81
+ 'post_content_filtered' => $post_content_filtered,
82
+ 'post_mime_type' => $post->post_mime_type,
83
+ 'import_id' => 0
84
+ );
85
+
86
+ if ( 'attachment' == $post->post_type ) {
87
+ $defaults['guid'] = $post->guid;
88
+ }
89
+
90
+ $defaults = stripslashes_deep( $defaults );
91
+
92
+ // Insert the new template in the post table
93
+ $this->new_post_id = wp_insert_post( $defaults );
94
+
95
+ }
96
+
97
+ // Copy the taxonomies
98
+ $this->duplicate_taxonomies();
99
+
100
+ // Copy the meta information
101
+ $this->duplicate_product_meta();
102
+
103
+ do_action( 'wpsc_duplicate_product', $post, $this->get_new_post_id() );
104
+
105
+ // Finds children (which includes product files AND product images), their meta values, and duplicates them.
106
+ $duplicated_children = $this->duplicate_children();
107
+
108
+ // Update product gallery meta (resetting duplicated meta value IDs)
109
+ $this->update_duplicate_product_gallery_meta( $duplicated_children );
110
+
111
+ // Copy product thumbnail (resetting duplicated meta value)
112
+ $this->duplicate_product_thumbnail();
113
+
114
+ return $this->get_new_post_id();
115
+ }
116
+
117
+ /**
118
+ * Copy the taxonomies of a post to another post
119
+ *
120
+ * @since 4.0
121
+ *
122
+ * @uses get_object_taxonomies() Gets taxonomies for the given object.
123
+ * @uses wpsc_get_product_terms() Gets terms for the product taxonomies.
124
+ * @uses wp_set_object_terms() Sets the terms for a post object.
125
+ */
126
+ public function duplicate_taxonomies() {
127
+
128
+ $new_post_id = $this->get_new_post_id();
129
+
130
+ if ( $new_post_id ) {
131
+
132
+ $id = $this->get_post_id();
133
+ $post_type = get_post_type( $id );
134
+ $taxonomies = get_object_taxonomies( $post_type );
135
+
136
+ foreach ( $taxonomies as $taxonomy ) {
137
+ $post_terms = wpsc_get_product_terms( $id, $taxonomy );
138
+ foreach ( $post_terms as $post_term ) {
139
+ wp_set_object_terms( $new_post_id, $post_term->slug, $taxonomy, true );
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Copy the meta information of a post to another post
147
+ *
148
+ * @since 4.0
149
+ *
150
+ * @uses $wpdb WordPress database object for queries.
151
+ * @uses get_results() Gets generic multirow results from the database.
152
+ * @uses prepare() Prepares a database query making it safe.
153
+ * @uses query() Runs an SQL query.
154
+ */
155
+ public function duplicate_product_meta() {
156
+
157
+ global $wpdb;
158
+
159
+ $new_post_id = $this->get_new_post_id();
160
+
161
+ if ( $new_post_id ) {
162
+
163
+ $post_meta_infos = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $this->get_post_id() ) );
164
+
165
+ if ( count( $post_meta_infos ) ) {
166
+
167
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
168
+ $values = array();
169
+ $sql_query_sel = array();
170
+
171
+ foreach ( $post_meta_infos as $meta_info ) {
172
+ $meta_key = $meta_info->meta_key;
173
+ $meta_value = addslashes( $meta_info->meta_value );
174
+
175
+ $sql_query_sel[] = "( $new_post_id, '$meta_key', '$meta_value' )";
176
+ $values[] = $new_post_id;
177
+ $values[] = $meta_key;
178
+ $values[] = $meta_value;
179
+ $values += array( $new_post_id, $meta_key, $meta_value );
180
+ }
181
+
182
+ $sql_query .= implode( ",", $sql_query_sel );
183
+ $sql_query = $wpdb->prepare( $sql_query, $values );
184
+ $wpdb->query( $sql_query );
185
+ clean_post_cache( $new_post_id );
186
+ }
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Update Duplicate Product Gallery Meta
192
+ *
193
+ * When a product is duplicated its meta values are copied, too
194
+ * including the gallery meta array of IDs.
195
+ *
196
+ * After the product's children (including attachments) have been
197
+ * duplicated this function is used to update the gallery meta to
198
+ * refer to the IDs of any duplicated media.
199
+ *
200
+ * @since 4.0
201
+ *
202
+ * @param array $duplicated_children Associative array mapping original child IDs to duplicated child IDs.
203
+ */
204
+ private function update_duplicate_product_gallery_meta( $duplicated_children ) {
205
+
206
+ $new_post_id = $this->get_new_post_id();
207
+
208
+ if ( $new_post_id ) {
209
+
210
+ $gallery = get_post_meta( $new_post_id, '_wpsc_product_gallery', true );
211
+ $new_gallery = array();
212
+
213
+ // Loop through duplicated gallery IDs.
214
+ if ( is_array( $gallery ) ) {
215
+ foreach ( $gallery as $gallery_id ) {
216
+
217
+ // If product image should be duplicated
218
+ if ( apply_filters( 'wpsc_duplicate_product_attachment', true, $gallery_id, $new_post_id ) ) {
219
+
220
+ // Update attached image IDs and copy non-attached image IDs
221
+ if ( array_key_exists( $gallery_id, $duplicated_children ) ) {
222
+ $new_gallery[] = $duplicated_children[ $gallery_id ];
223
+ } else {
224
+ $new_gallery[] = $gallery_id;
225
+ }
226
+ }
227
+ }
228
+
229
+ update_post_meta( $new_post_id, '_wpsc_product_gallery', $new_gallery );
230
+ }
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Duplicate Featured Image
236
+ *
237
+ * When a product is duplicated, the featured image ID is copied when the post
238
+ * meta is duplicated.
239
+ *
240
+ * When the featured image is attached to the duplicated product, if the image
241
+ * is duplicated the featured image ID is updated to the duplicated image ID
242
+ * otherwise the featured image ID is removed.
243
+ *
244
+ * If the featured image is not attached to the product the featured image ID
245
+ * remains the same as the original product.
246
+ *
247
+ * This function will remove the featured image if the image is not attached to
248
+ * the duplicated product and offers the opportunity to change the featured image
249
+ * of the duplicated product via the 'wpsc_duplicate_product_thumbnail' filter.
250
+ *
251
+ * @since 4.0
252
+ */
253
+ private function duplicate_product_thumbnail() {
254
+
255
+ $new_post_id = $this->get_new_post_id();
256
+
257
+ if ( $new_post_id ) {
258
+
259
+ $thumbnail_id = $original_thumbnail_id = has_post_thumbnail( $new_post_id ) ? get_post_thumbnail_id( $new_post_id ) : 0;
260
+
261
+ // If not duplicating product attachments, ensure featured image ID is zero
262
+ if ( ! apply_filters( 'wpsc_duplicate_product_attachment', true, $thumbnail_id, $new_post_id ) ) {
263
+ $thumbnail_id = 0;
264
+ }
265
+
266
+ // Filter featured product image ID
267
+ $thumbnail_id = absint( apply_filters( 'wpsc_duplicate_product_thumbnail', $thumbnail_id, $original_thumbnail_id, $this->get_post_id(), $new_post_id ) );
268
+
269
+ if ( $thumbnail_id > 0 ) {
270
+ set_post_thumbnail( $new_post_id, $thumbnail_id );
271
+ } else {
272
+ delete_post_thumbnail( $new_post_id );
273
+ }
274
+ }
275
+ }
276
+
277
+ /**
278
+ * Duplicates product children and meta
279
+ *
280
+ * @since 4.0
281
+ *
282
+ * @uses get_posts() Gets an array of posts given array of arguments.
283
+ *
284
+ * @return array Array mapping old child IDs to duplicated child IDs.
285
+ */
286
+ private function duplicate_children() {
287
+
288
+ $new_parent_id = $this->get_new_post_id();
289
+
290
+ // Map duplicate child IDs
291
+ $converted_child_ids = array();
292
+
293
+ if ( $new_parent_id ) {
294
+
295
+ // Get children products and duplicate them
296
+ $child_posts = get_posts( array(
297
+ 'post_parent' => $this->get_post_id(),
298
+ 'post_type' => 'any',
299
+ 'post_status' => 'any',
300
+ 'numberposts' => -1,
301
+ 'order' => 'ASC'
302
+ ) );
303
+
304
+ // Duplicate product images and child posts
305
+ foreach ( $child_posts as $child_post ) {
306
+
307
+ $duplicate_child = new WPSC_Duplicate_Product( $child_post->ID, $new_parent_id );
308
+
309
+ // Duplicate image or post
310
+ if ( 'attachment' == get_post_type( $child_post ) ) {
311
+ $new_child_id = $duplicate_child->duplicate_product_image_process();
312
+ } else {
313
+ $new_child_id = $duplicate_child->duplicate_product_process();
314
+ }
315
+
316
+ // Map child ID to new child ID
317
+ if ( $new_child_id && ! is_wp_error( $new_child_id ) ) {
318
+ $converted_child_ids[ $child_post->ID ] = $new_child_id;
319
+ }
320
+
321
+ do_action( 'wpsc_duplicate_product_child', $child_post, $new_parent_id, $new_child_id );
322
+ }
323
+ }
324
+
325
+ return $converted_child_ids;
326
+ }
327
+
328
+ /**
329
+ * Duplicates a product image.
330
+ *
331
+ * Uses a portion of code from media_sideload_image() in `wp-admin/includes/media.php`
332
+ * to check file before downloading from URL.
333
+ *
334
+ * @since 4.0
335
+ *
336
+ * @uses get_post_type() Gets post type.
337
+ * @uses wp_get_attachment_url() Gets attachment URL.
338
+ * @uses download_url() Download file from URl to temp location.
339
+ * @uses is_wp_error() Is WP error?
340
+ * @uses media_handle_sideload() Handle creation of new attachment and attach to post.
341
+ *
342
+ * @return int|bool Attachment ID or false.
343
+ */
344
+ public function duplicate_product_image_process() {
345
+
346
+ $child_post = get_post( $this->get_post_id() );
347
+ $new_parent_id = $this->get_new_parent_id( $child_post->post_parent );
348
+
349
+ if ( 'attachment' == get_post_type( $child_post ) && apply_filters( 'wpsc_duplicate_product_attachment', true, $child_post->ID, $new_parent_id ) ) {
350
+
351
+ $file = wp_get_attachment_url( $child_post->ID );
352
+
353
+ if ( ! empty( $file ) ) {
354
+
355
+ // Set variables for storage, fix file filename for query strings.
356
+ preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
357
+ $file_array = array();
358
+ $file_array['name'] = basename( $matches[0] );
359
+
360
+ // Download file to temp location.
361
+ $file_array['tmp_name'] = download_url( $file );
362
+
363
+ // If error storing temporarily, return the error.
364
+ if ( is_wp_error( $file_array['tmp_name'] ) ) {
365
+ return $file_array['tmp_name'];
366
+ }
367
+
368
+ // Do the validation and storage stuff.
369
+ $new_post_id = media_handle_sideload( $file_array, $new_parent_id );
370
+
371
+ // If error storing permanently, unlink.
372
+ if ( is_wp_error( $new_post_id ) ) {
373
+ @ unlink( $file_array['tmp_name'] );
374
+ }
375
+
376
+ // Re-attribute featured image
377
+ if ( has_post_thumbnail( $new_parent_id ) && $child_post->ID == get_post_thumbnail_id( $new_parent_id ) ) {
378
+ set_post_thumbnail( $new_parent_id, $new_post_id );
379
+ }
380
+
381
+ // Copy attachment data
382
+ $post_data = array(
383
+ 'ID' => $new_post_id,
384
+ 'post_content' => $child_post->post_content,
385
+ 'post_title' => $child_post->post_title,
386
+ 'post_excerpt' => $child_post->post_excerpt,
387
+ 'post_status' => $child_post->post_status,
388
+ 'comment_status' => $child_post->comment_status,
389
+ 'ping_status' => $child_post->ping_status,
390
+ 'post_password' => $child_post->post_password,
391
+ 'post_content_filtered' => $child_post->post_content_filtered,
392
+ 'menu_order' => $child_post->menu_order
393
+ );
394
+
395
+ wp_update_post( $post_data );
396
+
397
+ // Copy alt text
398
+ update_post_meta( $new_post_id, '_wp_attachment_image_alt', get_post_meta( $child_post->ID, '_wp_attachment_image_alt', true ) );
399
+
400
+ return $new_post_id;
401
+ }
402
+
403
+ } elseif ( has_post_thumbnail( $new_parent_id ) && $child_post->ID == get_post_thumbnail_id( $new_parent_id ) ) {
404
+
405
+ delete_post_meta( $new_parent_id, '_thumbnail_id' );
406
+ }
407
+
408
+ return false;
409
+ }
410
+
411
+ /**
412
+ * Get Post ID
413
+ *
414
+ * @since 4.0
415
+ *
416
+ * @return int Post ID.
417
+ */
418
+ public function get_post_id() {
419
+
420
+ return $this->post_id;
421
+ }
422
+
423
+ /**
424
+ * Get New Post ID
425
+ *
426
+ * @since 4.0
427
+ *
428
+ * @return int Post ID.
429
+ */
430
+ public function get_new_post_id() {
431
+
432
+ return $this->new_post_id;
433
+ }
434
+
435
+ /**
436
+ * Get New Parent ID
437
+ *
438
+ * @since 4.0
439
+ *
440
+ * @param int $default Default parent ID.
441
+ * @return int Post ID.
442
+ */
443
+ public function get_new_parent_id( $default = 0 ) {
444
+
445
+ return false === $this->new_parent_id ? $default : $this->new_parent_id;
446
+ }
447
+ }
wpsc-admin/includes/product-functions.php CHANGED
@@ -40,7 +40,7 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
40
  if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
41
  $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
42
 
43
- if ( isset( $post_data['meta']['_wpsc_sku'] ) && $post_data['meta']['_wpsc_sku'] == __('N/A', 'wpsc') ) {
44
  $post_data['meta']['_wpsc_sku'] = '';
45
  }
46
 
@@ -458,12 +458,6 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
458
  );
459
  $product_post_values["comment_status"] = "open";
460
 
461
- if(isset($sku) && ($sku != '')) {
462
- $product_post_array['guid'] = $sku;
463
- }
464
-
465
-
466
-
467
  $product_id = wp_insert_post($product_post_values);
468
  if ( isset ( $post_data["sticky"] ) ) {
469
  stick_post($product_id);
@@ -713,6 +707,7 @@ function wpsc_edit_product_variations($product_id, $post_data) {
713
  //Get currently associated terms
714
  $currently_associated_var = $product_terms;
715
 
 
716
  foreach ($currently_associated_var as $current) {
717
  $currently_associated_vars[] = $current->term_id;
718
  }
@@ -762,11 +757,12 @@ function wpsc_edit_product_variations($product_id, $post_data) {
762
  'numberposts' => -1
763
  ));
764
 
 
765
  foreach((array)$current_children as $child_prod){
766
- $childs[] = $child_prod->ID;
767
  }
768
- if(!empty($childs)){
769
- $old_ids_to_delete = array_diff($childs, $product_children);
770
  $old_ids_to_delete = apply_filters('wpsc_edit_product_variations_deletion', $old_ids_to_delete);
771
  if(is_array($old_ids_to_delete) && !empty($old_ids_to_delete)) {
772
  foreach($old_ids_to_delete as $object_ids) {
40
  if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
41
  $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
42
 
43
+ if ( isset( $post_data['meta']['_wpsc_sku'] ) && $post_data['meta']['_wpsc_sku'] == __('N/A', 'wp-e-commerce') ) {
44
  $post_data['meta']['_wpsc_sku'] = '';
45
  }
46
 
458
  );
459
  $product_post_values["comment_status"] = "open";
460
 
 
 
 
 
 
 
461
  $product_id = wp_insert_post($product_post_values);
462
  if ( isset ( $post_data["sticky"] ) ) {
463
  stick_post($product_id);
707
  //Get currently associated terms
708
  $currently_associated_var = $product_terms;
709
 
710
+ $currently_associated_vars = array();
711
  foreach ($currently_associated_var as $current) {
712
  $currently_associated_vars[] = $current->term_id;
713
  }
757
  'numberposts' => -1
758
  ));
759
 
760
+ $children = array();
761
  foreach((array)$current_children as $child_prod){
762
+ $children[] = $child_prod->ID;
763
  }
764
+ if(!empty($children)){
765
+ $old_ids_to_delete = array_diff($children, $product_children);
766
  $old_ids_to_delete = apply_filters('wpsc_edit_product_variations_deletion', $old_ids_to_delete);
767
  if(is_array($old_ids_to_delete) && !empty($old_ids_to_delete)) {
768
  foreach($old_ids_to_delete as $object_ids) {
wpsc-admin/includes/product-variation-list-table.class.php CHANGED
@@ -129,15 +129,16 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
129
  public function get_columns() {
130
  $columns = array(
131
  'cb' => '<input type="checkbox" />',
132
- 'title' => __( 'Title', 'wpsc' ),
133
- 'sku' => __( 'SKU', 'wpsc' ),
134
- 'price' => __( 'Price', 'wpsc' ),
135
- 'sale_price' => __( 'Sale Price', 'wpsc' ),
136
- 'stock' => __( 'Stock', 'wpsc' ),
137
  );
138
 
139
- if ( get_option( 'wpec_taxes_enabled' ) )
140
- $columns['tax'] = __( 'Taxable Amount', 'wpsc' );
 
141
 
142
  return apply_filters( 'wpsc_variation_column_headers', $columns );
143
  }
@@ -158,13 +159,15 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
158
 
159
  private function get_row_actions( $item ) {
160
  $post_type_object = get_post_type_object( 'wpsc-product' );
161
- $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $item->ID );
162
 
163
  $actions = array();
164
- if ( apply_filters( 'wpsc_show_product_variations_edit_action', true, $item ) && $can_edit_post && 'trash' != $item->post_status )
165
- $actions['edit'] = '<a target="_blank" href="' . get_edit_post_link( $item->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ), 'wpsc' ) . '">' . __( 'Edit' ) . '</a>';
166
 
167
- $actions['stock hide-if-no-js'] = '<a class="wpsc-variation-stock-editor-link" href="#" title="' . __( 'Show shipping editor', 'wpsc' ) . '">' . __( 'Edit Shipping', 'wpsc' ) . '</a>';
 
 
 
 
168
 
169
  if ( $item->post_status == 'draft' ) {
170
  $show_url = add_query_arg( array(
@@ -172,14 +175,14 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
172
  'post' => $item->ID,
173
  'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
174
  ) );
175
- $actions['show'] = '<a class="wpsc-variation-show-link" href="' . esc_url( $show_url ) . '" title="' . __( 'Show this variation on the front-end', 'wpsc' ) . '">' . __( 'Publish', 'wpsc' ) . '</a>';
176
  } elseif ( in_array( $item->post_status, array( 'publish', 'inherit' ) ) ) {
177
  $hide_url = add_query_arg( array(
178
  'bulk_action' => 'hide',
179
  'post' => $item->ID,
180
  'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
181
  ) );
182
- $actions['hide'] = '<a class="wpsc-variation-hide-link" href="' . esc_url( $hide_url ) . '" title="' . __( 'Mark this variation as draft to hide from the front-end', 'wpsc' ) . '">' . __( 'Mark as Draft', 'wpsc' ) . '</a>';
183
  }
184
 
185
  if ( current_user_can( $post_type_object->cap->delete_post, $item->ID ) ) {
@@ -197,13 +200,13 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
197
  $restore_url
198
  );
199
  $restore_url = wp_nonce_url( $restore_url, 'untrash-post_' . $item->ID );
200
- $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . esc_url( $restore_url ) . "'>" . __( 'Restore' ) . "</a>";
201
  } elseif ( EMPTY_TRASH_DAYS ) {
202
- $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Trash' ) . "</a>";
203
  }
204
 
205
  if ( $force_delete )
206
- $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Delete Permanently' ) . "</a>";
207
  }
208
 
209
  return $actions;
@@ -239,7 +242,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
239
  <div class="wpsc-product-variation-title">
240
  <strong class="row-title">
241
  <?php if ( $show_edit_link ): ?>
242
- <a target="_blank" href="<?php echo esc_url( get_edit_post_link( $item->ID, true ) ); ?>" title="<?php esc_attr_e( __( 'Edit this item' ), 'wpsc' ); ?>">
243
  <?php endif; ?>
244
  <?php echo esc_html( apply_filters( 'wpsc_variation_name', $title, $item ) ); ?>
245
  <?php if ( $show_edit_link ): ?>
@@ -336,7 +339,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
336
  <tr class="wpsc-stock-editor-row inline-edit-row<?php echo $row_class; ?>"<?php echo $style; ?> id="wpsc-stock-editor-row-<?php echo $item->ID; ?>">
337
  <td></td>
338
  <td colspan="<?php echo $colspan; ?>" class="colspanchange">
339
- <h4><?php esc_html_e( 'Variation Stock Editor', 'wpsc' ); ?></h4>
340
  <?php wpsc_product_shipping_forms( $item, $field_name, $bulk ); ?>
341
  </td>
342
  </tr>
@@ -385,7 +388,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
385
  return;
386
 
387
  if ( isset($_REQUEST['updated']) && (int) $_REQUEST['updated'] ) {
388
- $messages[] = sprintf( _n( '%s post updated.', '%s posts updated.', $_REQUEST['updated'] ), number_format_i18n( $_REQUEST['updated'] ) );
389
  unset($_REQUEST['updated']);
390
  }
391
 
@@ -393,25 +396,25 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
393
  unset($_REQUEST['skipped']);
394
 
395
  if ( isset($_REQUEST['locked']) && (int) $_REQUEST['locked'] ) {
396
- $messages[] = sprintf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_REQUEST['locked'] ), number_format_i18n( $_REQUEST['locked'] ) );
397
  unset($_REQUEST['locked']);
398
  }
399
 
400
  if ( isset($_REQUEST['deleted']) && (int) $_REQUEST['deleted'] ) {
401
- $messages[] = sprintf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_REQUEST['deleted'] ), number_format_i18n( $_REQUEST['deleted'] ) );
402
  unset($_REQUEST['deleted']);
403
  }
404
 
405
  if ( isset($_REQUEST['trashed']) && (int) $_REQUEST['trashed'] ) {
406
- $messages[] = sprintf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $_REQUEST['trashed'] ), number_format_i18n( $_REQUEST['trashed'] ) );
407
  $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
408
  $undo_url = wp_nonce_url( add_query_arg( array( 'doaction' => 'undo', 'action' => 'untrash', 'ids' => $ids ) ), 'bulk-posts' );
409
- $messages[] = '<a href="' . esc_url( $undo_url ) . '">' . __('Undo') . '</a>';
410
  unset($_REQUEST['trashed']);
411
  }
412
 
413
  if ( isset($_REQUEST['untrashed']) && (int) $_REQUEST['untrashed'] ) {
414
- $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_REQUEST['untrashed'] ), number_format_i18n( $_REQUEST['untrashed'] ) );
415
  unset($_REQUEST['undeleted']);
416
  }
417
  ?>
@@ -426,19 +429,19 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
426
  $actions = array();
427
 
428
  if ( $this->is_trash )
429
- $actions['untrash'] = __( 'Restore' );
430
 
431
  if ( $this->is_draft )
432
- $actions['show'] = __( 'Publish', 'wpsc' );
433
  elseif ( $this->is_all || $this->is_publish )
434
- $actions['hide'] = __( 'Mark as Draft', 'wpsc' );
435
 
436
- $actions['edit'] = __( 'Edit', 'wpsc' );
437
 
438
  if ( $this->is_trash || !EMPTY_TRASH_DAYS )
439
- $actions['delete'] = __( 'Delete Permanently' );
440
  else
441
- $actions['trash'] = __( 'Move to Trash' );
442
 
443
  return $actions;
444
  }
@@ -461,7 +464,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
461
 
462
  echo '<input type="hidden" name="bulk_action_nonce" value="' . wp_create_nonce( 'wpsc_product_variations_bulk_action' ) .'" />';
463
  echo "<select name='bulk_action$two'>\n";
464
- echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
465
 
466
  foreach ( $this->_actions as $name => $title ) {
467
  $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
@@ -471,7 +474,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
471
 
472
  echo "</select>\n";
473
 
474
- submit_button( __( 'Apply' ), 'action', false, false, array( 'id' => "doaction$two" ) );
475
  echo "\n";
476
  }
477
 
@@ -540,7 +543,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
540
  }
541
 
542
  $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
543
- $status_links['all'] = "<a href='{$url_base}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
544
 
545
  foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
546
  $class = '';
@@ -620,7 +623,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
620
  <input type="checkbox" name="wpsc_bulk_edit[post][]" checked="checked" value="<?php echo $item->ID; ?>" />
621
  </span>
622
  <strong>
623
- <a class="row-title" href="<?php echo get_edit_post_link( $item->ID ); ?>" title="<?php esc_attr_e( 'Edit this variation', 'wpsc' ) ?>"><?php echo esc_html( $title ); ?></a>
624
  </strong>
625
  </div>
626
  <?php endforeach; ?>
@@ -668,7 +671,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
668
  $post_type_object = get_post_type_object( 'wpsc-product' );
669
  ?><div class="alignleft actions"><?php
670
  if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
671
- submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false );
672
  }
673
  ?></div><?php
674
  }
129
  public function get_columns() {
130
  $columns = array(
131
  'cb' => '<input type="checkbox" />',
132
+ 'title' => __( 'Title' , 'wp-e-commerce' ),
133
+ 'sku' => __( 'SKU' , 'wp-e-commerce' ),
134
+ 'price' => __( 'Price' , 'wp-e-commerce' ),
135
+ 'sale_price' => __( 'Sale Price', 'wp-e-commerce' ),
136
+ 'stock' => __( 'Stock' , 'wp-e-commerce' ),
137
  );
138
 
139
+ if ( get_option( 'wpec_taxes_enabled' ) ) {
140
+ $columns['tax'] = __( 'Taxable Amount', 'wp-e-commerce' );
141
+ }
142
 
143
  return apply_filters( 'wpsc_variation_column_headers', $columns );
144
  }
159
 
160
  private function get_row_actions( $item ) {
161
  $post_type_object = get_post_type_object( 'wpsc-product' );
162
+ $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $item->ID );
163
 
164
  $actions = array();
 
 
165
 
166
+ if ( apply_filters( 'wpsc_show_product_variations_edit_action', true, $item ) && $can_edit_post && 'trash' != $item->post_status ) {
167
+ $actions['edit'] = '<a target="_blank" href="' . get_edit_post_link( $item->ID, true ) . '" title="' . esc_attr__( 'Edit this item', 'wp-e-commerce' ) . '">' . __( 'Edit', 'wp-e-commerce' ) . '</a>';
168
+ }
169
+
170
+ $actions['stock hide-if-no-js'] = '<a class="wpsc-variation-stock-editor-link" href="#" title="' . __( 'Show shipping editor', 'wp-e-commerce' ) . '">' . __( 'Edit Shipping', 'wp-e-commerce' ) . '</a>';
171
 
172
  if ( $item->post_status == 'draft' ) {
173
  $show_url = add_query_arg( array(
175
  'post' => $item->ID,
176
  'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
177
  ) );
178
+ $actions['show'] = '<a class="wpsc-variation-show-link" href="' . esc_url( $show_url ) . '" title="' . __( 'Show this variation on the front-end', 'wp-e-commerce' ) . '">' . __( 'Publish', 'wp-e-commerce' ) . '</a>';
179
  } elseif ( in_array( $item->post_status, array( 'publish', 'inherit' ) ) ) {
180
  $hide_url = add_query_arg( array(
181
  'bulk_action' => 'hide',
182
  'post' => $item->ID,
183
  'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
184
  ) );
185
+ $actions['hide'] = '<a class="wpsc-variation-hide-link" href="' . esc_url( $hide_url ) . '" title="' . __( 'Mark this variation as draft to hide it from the front-end.', 'wp-e-commerce' ) . '">' . __( 'Mark as Draft', 'wp-e-commerce' ) . '</a>';
186
  }
187
 
188
  if ( current_user_can( $post_type_object->cap->delete_post, $item->ID ) ) {
200
  $restore_url
201
  );
202
  $restore_url = wp_nonce_url( $restore_url, 'untrash-post_' . $item->ID );
203
+ $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'wp-e-commerce' ) . "' href='" . esc_url( $restore_url ) . "'>" . __( 'Restore', 'wp-e-commerce' ) . "</a>";
204
  } elseif ( EMPTY_TRASH_DAYS ) {
205
+ $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'wp-e-commerce' ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Trash', 'wp-e-commerce' ) . "</a>";
206
  }
207
 
208
  if ( $force_delete )
209
+ $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'wp-e-commerce' ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Delete Permanently', 'wp-e-commerce' ) . "</a>";
210
  }
211
 
212
  return $actions;
242
  <div class="wpsc-product-variation-title">
243
  <strong class="row-title">
244
  <?php if ( $show_edit_link ): ?>
245
+ <a target="_blank" href="<?php echo esc_url( get_edit_post_link( $item->ID, true ) ); ?>" title="<?php esc_attr_e( 'Edit this item', 'wp-e-commerce' ); ?>">
246
  <?php endif; ?>
247
  <?php echo esc_html( apply_filters( 'wpsc_variation_name', $title, $item ) ); ?>
248
  <?php if ( $show_edit_link ): ?>
339
  <tr class="wpsc-stock-editor-row inline-edit-row<?php echo $row_class; ?>"<?php echo $style; ?> id="wpsc-stock-editor-row-<?php echo $item->ID; ?>">
340
  <td></td>
341
  <td colspan="<?php echo $colspan; ?>" class="colspanchange">
342
+ <h4><?php esc_html_e( 'Variation Shipping Editor', 'wp-e-commerce' ); ?></h4>
343
  <?php wpsc_product_shipping_forms( $item, $field_name, $bulk ); ?>
344
  </td>
345
  </tr>
388
  return;
389
 
390
  if ( isset($_REQUEST['updated']) && (int) $_REQUEST['updated'] ) {
391
+ $messages[] = sprintf( _n( '%s post updated.', '%s posts updated.', $_REQUEST['updated'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['updated'] ) );
392
  unset($_REQUEST['updated']);
393
  }
394
 
396
  unset($_REQUEST['skipped']);
397
 
398
  if ( isset($_REQUEST['locked']) && (int) $_REQUEST['locked'] ) {
399
+ $messages[] = sprintf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_REQUEST['locked'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['locked'] ) );
400
  unset($_REQUEST['locked']);
401
  }
402
 
403
  if ( isset($_REQUEST['deleted']) && (int) $_REQUEST['deleted'] ) {
404
+ $messages[] = sprintf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_REQUEST['deleted'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['deleted'] ) );
405
  unset($_REQUEST['deleted']);
406
  }
407
 
408
  if ( isset($_REQUEST['trashed']) && (int) $_REQUEST['trashed'] ) {
409
+ $messages[] = sprintf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $_REQUEST['trashed'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['trashed'] ) );
410
  $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
411
  $undo_url = wp_nonce_url( add_query_arg( array( 'doaction' => 'undo', 'action' => 'untrash', 'ids' => $ids ) ), 'bulk-posts' );
412
+ $messages[] = '<a href="' . esc_url( $undo_url ) . '">' . __( 'Undo', 'wp-e-commerce' ) . '</a>';
413
  unset($_REQUEST['trashed']);
414
  }
415
 
416
  if ( isset($_REQUEST['untrashed']) && (int) $_REQUEST['untrashed'] ) {
417
+ $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_REQUEST['untrashed'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['untrashed'] ) );
418
  unset($_REQUEST['undeleted']);
419
  }
420
  ?>
429
  $actions = array();
430
 
431
  if ( $this->is_trash )
432
+ $actions['untrash'] = __( 'Restore', 'wp-e-commerce' );
433
 
434
  if ( $this->is_draft )
435
+ $actions['show'] = __( 'Publish', 'wp-e-commerce' );
436
  elseif ( $this->is_all || $this->is_publish )
437
+ $actions['hide'] = __( 'Mark as Draft', 'wp-e-commerce' );
438
 
439
+ $actions['edit'] = __( 'Edit', 'wp-e-commerce' );
440
 
441
  if ( $this->is_trash || !EMPTY_TRASH_DAYS )
442
+ $actions['delete'] = __( 'Delete Permanently', 'wp-e-commerce' );
443
  else
444
+ $actions['trash'] = __( 'Move to Trash', 'wp-e-commerce' );
445
 
446
  return $actions;
447
  }
464
 
465
  echo '<input type="hidden" name="bulk_action_nonce" value="' . wp_create_nonce( 'wpsc_product_variations_bulk_action' ) .'" />';
466
  echo "<select name='bulk_action$two'>\n";
467
+ echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions', 'wp-e-commerce' ) . "</option>\n";
468
 
469
  foreach ( $this->_actions as $name => $title ) {
470
  $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
474
 
475
  echo "</select>\n";
476
 
477
+ submit_button( __( 'Apply', 'wp-e-commerce' ), 'action', false, false, array( 'id' => "doaction$two" ) );
478
  echo "\n";
479
  }
480
 
543
  }
544
 
545
  $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
546
+ $status_links['all'] = "<a href='{$url_base}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts', 'wp-e-commerce' ), number_format_i18n( $total_posts ) ) . '</a>';
547
 
548
  foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
549
  $class = '';
623
  <input type="checkbox" name="wpsc_bulk_edit[post][]" checked="checked" value="<?php echo $item->ID; ?>" />
624
  </span>
625
  <strong>
626
+ <a class="row-title" href="<?php echo get_edit_post_link( $item->ID ); ?>" title="<?php esc_attr_e( 'Edit this variation', 'wp-e-commerce' ) ?>"><?php echo esc_html( $title ); ?></a>
627
  </strong>
628
  </div>
629
  <?php endforeach; ?>
671
  $post_type_object = get_post_type_object( 'wpsc-product' );
672
  ?><div class="alignleft actions"><?php
673
  if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
674
+ submit_button( __( 'Empty Trash', 'wp-e-commerce' ), 'button-secondary apply', 'delete_all', false );
675
  }
676
  ?></div><?php
677
  }
wpsc-admin/includes/product-variations-manage.page.php CHANGED
@@ -2,12 +2,12 @@
2
  <form action="" method="post">
3
  <?php $this->list_table->views(); ?>
4
  <div class="alignright actions wpsc-save-product-variations top">
5
- <?php submit_button( __( 'Save Variations', 'wpsc' ) ); ?>
6
  </div>
7
  <input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
8
  <?php wp_nonce_field( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' ); ?>
9
  <?php $this->list_table->display(); ?>
10
  <div class="alignright actions wpsc-save-product-variations bottom">
11
- <?php submit_button( __( 'Save Variations', 'wpsc' ) ); ?>
12
  </div>
13
  </form>
2
  <form action="" method="post">
3
  <?php $this->list_table->views(); ?>
4
  <div class="alignright actions wpsc-save-product-variations top">
5
+ <?php submit_button( __( 'Save Variations', 'wp-e-commerce' ) ); ?>
6
  </div>
7
  <input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
8
  <?php wp_nonce_field( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' ); ?>
9
  <?php $this->list_table->display(); ?>
10
  <div class="alignright actions wpsc-save-product-variations bottom">
11
+ <?php submit_button( __( 'Save Variations', 'wp-e-commerce' ) ); ?>
12
  </div>
13
  </form>
wpsc-admin/includes/product-variations-page.class.php CHANGED
@@ -105,7 +105,7 @@ class WPSC_Product_Variations_Page {
105
  check_admin_referer( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' );
106
  $post_type_object = get_post_type_object( 'wpsc-product' );
107
  if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
108
- wp_die( __( 'Cheatin&#8217; uh?' ) );
109
 
110
  /* Long-term, we should have a better saving routine here. Can't unset these currently. *
111
  /* That said, the only thing that fails hard if we can't unset it is the checkbox. */
@@ -149,8 +149,8 @@ class WPSC_Product_Variations_Page {
149
 
150
  private function display_tabs() {
151
  $tabs = array(
152
- 'manage' => _x( 'Manage', 'manage product variations', 'wpsc' ),
153
- 'setup' => __( 'Setup', 'wpsc' ),
154
  );
155
 
156
  echo '<ul id="wpsc-product-variations-tabs" class="category-tabs">';
@@ -210,10 +210,10 @@ class WPSC_Product_Variations_Page {
210
  $trashed = 0;
211
  foreach( (array) $post_ids as $post_id ) {
212
  if ( !current_user_can( $post_type_object->cap->delete_post, $post_id ) )
213
- wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
214
 
215
  if ( !wp_trash_post( $post_id ) )
216
- wp_die( __( 'Error in moving to Trash.' ) );
217
 
218
  $trashed++;
219
  }
@@ -225,10 +225,10 @@ class WPSC_Product_Variations_Page {
225
  $untrashed = 0;
226
  foreach( (array) $post_ids as $post_id ) {
227
  if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
228
- wp_die( __( 'You are not allowed to restore this item from the Trash.' ) );
229
 
230
  if ( !wp_untrash_post( $post_id ) )
231
- wp_die( __( 'Error in restoring from Trash.' ) );
232
 
233
  $untrashed++;
234
  }
@@ -242,14 +242,14 @@ class WPSC_Product_Variations_Page {
242
  $post_del = & get_post( $post_id );
243
 
244
  if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
245
- wp_die( __( 'You are not allowed to delete this item.' ) );
246
 
247
  if ( $post_del->post_type == 'attachment' ) {
248
  if ( ! wp_delete_attachment( $post_id ) )
249
- wp_die( __( 'Error in deleting...' ) );
250
  } else {
251
  if ( ! wp_delete_post( $post_id ) )
252
- wp_die( __( 'Error in deleting...' ) );
253
  }
254
  $deleted++;
255
  }
105
  check_admin_referer( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' );
106
  $post_type_object = get_post_type_object( 'wpsc-product' );
107
  if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
108
+ wp_die( __( 'Cheatin&#8217; uh?', 'wp-e-commerce' ) );
109
 
110
  /* Long-term, we should have a better saving routine here. Can't unset these currently. *
111
  /* That said, the only thing that fails hard if we can't unset it is the checkbox. */
149
 
150
  private function display_tabs() {
151
  $tabs = array(
152
+ 'manage' => _x( 'Manage', 'manage product variations', 'wp-e-commerce' ),
153
+ 'setup' => __( 'Setup', 'wp-e-commerce' ),
154
  );
155
 
156
  echo '<ul id="wpsc-product-variations-tabs" class="category-tabs">';
210
  $trashed = 0;
211
  foreach( (array) $post_ids as $post_id ) {
212
  if ( !current_user_can( $post_type_object->cap->delete_post, $post_id ) )
213
+ wp_die( __( 'You are not allowed to move this item to the Trash.', 'wp-e-commerce' ) );
214
 
215
  if ( !wp_trash_post( $post_id ) )
216
+ wp_die( __( 'Error in moving to Trash.', 'wp-e-commerce' ) );
217
 
218
  $trashed++;
219
  }
225
  $untrashed = 0;
226
  foreach( (array) $post_ids as $post_id ) {
227
  if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
228
+ wp_die( __( 'You are not allowed to restore this item from the Trash.', 'wp-e-commerce' ) );
229
 
230
  if ( !wp_untrash_post( $post_id ) )
231
+ wp_die( __( 'Error in restoring from Trash.', 'wp-e-commerce' ) );
232
 
233
  $untrashed++;
234
  }
242
  $post_del = & get_post( $post_id );
243
 
244
  if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
245
+ wp_die( __( 'You are not allowed to delete this item.', 'wp-e-commerce' ) );
246
 
247
  if ( $post_del->post_type == 'attachment' ) {
248
  if ( ! wp_delete_attachment( $post_id ) )
249
+ wp_die( __( 'Error in deleting...', 'wp-e-commerce' ) );
250
  } else {
251
  if ( ! wp_delete_post( $post_id ) )
252
+ wp_die( __( 'Error in deleting...', 'wp-e-commerce' ) );
253
  }
254
  $deleted++;
255
  }
wpsc-admin/includes/product-variations-setup.page.php CHANGED
@@ -1,24 +1,24 @@
1
  <div id="product_variations">
2
- <h4><a href="#wpsc_variation_metabox" class="add_variation_set_action"><?php esc_html_e( '+ Add New Variants', 'wpsc' ) ?></a></h4>
3
 
4
  <div id="add-new-variation-set">
5
  <p>
6
- <label for="new-variation-set-name"><?php esc_html_e( "Enter variation set's name", 'wpsc' ); ?></label>
7
  <input type="text" class="text-field" id="new-variation-set-name" /><br />
8
  </p>
9
- <p class="howto"><?php esc_html_e( "Example: Color. If you want to add variants to an existing set, you can enter the name of that set here.", 'wpsc' ); ?></p>
10
  <p>
11
- <label for="new-variants"><?php esc_html_e( "Enter new variants", 'wpsc' ); ?></label>
12
  <input type="text" class="text-field" id="new-variants" /><br />
13
  </p>
14
- <p class="howto"><?php esc_html_e( "Example: Red, Green, Blue. Separate variants with commas.", 'wpsc' ); ?></p>
15
  <p>
16
- <a class="button" href="#"><?php esc_html_e( 'Add New Variants', 'wpsc' ); ?></a>
17
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
18
  </p>
19
  </div>
20
 
21
- <p><a name='variation_control'>&nbsp;</a><?php _e( 'Select the Variation sets and then the corresponding Variants you want to add to this product.', 'wpsc' ) ?></p>
22
 
23
  <form action="" method="post">
24
  <ul class="variation_checkboxes">
@@ -33,7 +33,7 @@
33
  <input type="hidden" name="action2" value="generate" />
34
  <input type="hidden" name="product_id" value="<?php echo $this->parent_id; ?>" />
35
  <?php wp_nonce_field( 'wpsc_generate_product_variations', '_wpsc_generate_product_variations_nonce' ); ?>
36
- <?php submit_button( __( 'Generate Variations', 'wpsc' ) ); ?>
37
  </form>
38
 
39
  <div class="clear"></div>
1
  <div id="product_variations">
2
+ <h4><a href="#wpsc_variation_metabox" class="add_variation_set_action"><?php esc_html_e( '+ Add New Variants', 'wp-e-commerce' ) ?></a></h4>
3
 
4
  <div id="add-new-variation-set">
5
  <p>
6
+ <label for="new-variation-set-name"><?php esc_html_e( "Enter variation set's name", 'wp-e-commerce' ); ?></label>
7
  <input type="text" class="text-field" id="new-variation-set-name" /><br />
8
  </p>
9
+ <p class="howto"><?php esc_html_e( "Example: Color. If you want to add variants to an existing set, you can enter the name of that set here.", 'wp-e-commerce' ); ?></p>
10
  <p>
11
+ <label for="new-variants"><?php esc_html_e( "Enter new variants", 'wp-e-commerce' ); ?></label>
12
  <input type="text" class="text-field" id="new-variants" /><br />
13
  </p>
14
+ <p class="howto"><?php esc_html_e( "Example: Red, Green, Blue. Separate variants with commas.", 'wp-e-commerce' ); ?></p>
15
  <p>
16
+ <a class="button" href="#"><?php esc_html_e( 'Add New Variants', 'wp-e-commerce' ); ?></a>
17
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
18
  </p>
19
  </div>
20
 
21
+ <p><a name='variation_control'>&nbsp;</a><?php _e( 'Select the Variation sets and then the corresponding Variants you want to add to this product.', 'wp-e-commerce' ) ?></p>
22
 
23
  <form action="" method="post">
24
  <ul class="variation_checkboxes">
33
  <input type="hidden" name="action2" value="generate" />
34
  <input type="hidden" name="product_id" value="<?php echo $this->parent_id; ?>" />
35
  <?php wp_nonce_field( 'wpsc_generate_product_variations', '_wpsc_generate_product_variations_nonce' ); ?>
36
+ <?php submit_button( __( 'Generate Variations', 'wp-e-commerce' ) ); ?>
37
  </form>
38
 
39
  <div class="clear"></div>
wpsc-admin/includes/product-variations.page.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php _wpsc_admin_html_begin(); ?>
2
- <title><?php esc_html_e( 'Manage Product Variations', 'wpsc' ); ?></title>
3
  <script type="text/javascript">
4
  addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
5
  var userSettings = {
1
  <?php _wpsc_admin_html_begin(); ?>
2
+ <title><?php esc_html_e( 'Manage Product Variations', 'wp-e-commerce' ); ?></title>
3
  <script type="text/javascript">
4
  addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
5
  var userSettings = {
wpsc-admin/includes/purchase-log-action-links.php CHANGED
@@ -140,7 +140,7 @@ class WPSC_Purchase_Log_Action_Links {
140
  */
141
  private function get_packing_slip_link() {
142
 
143
- return new WPSC_Purchase_Log_Action_Link( 'packing_slip', __( 'View Packing Slip', 'wpsc' ), $this->log_id, array(
144
  'url' => esc_url( add_query_arg( array(
145
  'c' => 'packing_slip',
146
  'id' => $this->log_id
@@ -163,7 +163,7 @@ class WPSC_Purchase_Log_Action_Links {
163
  */
164
  private function get_email_receipt_link() {
165
 
166
- return new WPSC_Purchase_Log_Action_Link( 'email_receipt', __( 'Resend Receipt to Buyer', 'wpsc' ), $this->log_id, array(
167
  'ajax' => true,
168
  'dashicon' => 'dashicons-migrate dashicons-email-alt'
169
  ) );
@@ -180,10 +180,10 @@ class WPSC_Purchase_Log_Action_Links {
180
  */
181
  private function _get_delete_link() {
182
 
183
- return new WPSC_Purchase_Log_Action_Link( 'delete', _x( 'Remove this record', 'purchase log action link', 'wpsc' ), $this->log_id, array(
184
  'dashicon' => 'dashicons-dismiss',
185
  'attributes' => array(
186
- 'onclick' => "if ( confirm('" . esc_js( sprintf( __( "You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.", 'wpsc' ), wpsc_purchaselog_details_date() ) ) . "') ) { return true; } return false;"
187
  )
188
  ) );
189
 
@@ -199,7 +199,7 @@ class WPSC_Purchase_Log_Action_Links {
199
  */
200
  private function _get_back_link() {
201
 
202
- return new WPSC_Purchase_Log_Action_Link( 'back', _x( 'Go Back', 'purchase log action link', 'wpsc' ), $this->log_id, array(
203
  'url' => wp_get_referer(),
204
  'dashicon' => 'dashicons-arrow-left-alt'
205
  ) );
140
  */
141
  private function get_packing_slip_link() {
142
 
143
+ return new WPSC_Purchase_Log_Action_Link( 'packing_slip', __( 'View Packing Slip', 'wp-e-commerce' ), $this->log_id, array(
144
  'url' => esc_url( add_query_arg( array(
145
  'c' => 'packing_slip',
146
  'id' => $this->log_id
163
  */
164
  private function get_email_receipt_link() {
165
 
166
+ return new WPSC_Purchase_Log_Action_Link( 'email_receipt', __( 'Resend Receipt to Buyer', 'wp-e-commerce' ), $this->log_id, array(
167
  'ajax' => true,
168
  'dashicon' => 'dashicons-migrate dashicons-email-alt'
169
  ) );
180
  */
181
  private function _get_delete_link() {
182
 
183
+ return new WPSC_Purchase_Log_Action_Link( 'delete', _x( 'Remove this record', 'purchase log action link', 'wp-e-commerce' ), $this->log_id, array(
184
  'dashicon' => 'dashicons-dismiss',
185
  'attributes' => array(
186
+ 'onclick' => "if ( confirm('" . esc_js( sprintf( __( "You are about to delete this log '%s'\n 'Cancel' to stop, 'OK' to delete.", 'wp-e-commerce' ), wpsc_purchaselog_details_date() ) ) . "') ) { return true; } return false;"
187
  )
188
  ) );
189
 
199
  */
200
  private function _get_back_link() {
201
 
202
+ return new WPSC_Purchase_Log_Action_Link( 'back', _x( 'Go Back', 'purchase log action link', 'wp-e-commerce' ), $this->log_id, array(
203
  'url' => wp_get_referer(),
204
  'dashicon' => 'dashicons-arrow-left-alt'
205
  ) );
wpsc-admin/includes/purchase-log-list-table-class.php CHANGED
@@ -77,7 +77,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
77
 
78
  if ( isset( $_REQUEST['post'] ) ) {
79
  $posts = array_map( 'absint', $_REQUEST['post'] );
80
- $where[] = 'p.id IN (' . implode( ', ', $posts ) . ')';
81
  }
82
 
83
  $i = 1;
@@ -126,28 +126,42 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
126
  $search_sql = implode( ' AND ', array_values( $search_sql ) );
127
 
128
  if ( $search_sql ) {
129
- $where[] = $search_sql;
130
  }
131
 
132
  // filter by status
133
  if ( ! empty( $_REQUEST['status'] ) && $_REQUEST['status'] != 'all' ) {
134
  $this->status = absint( $_REQUEST['status'] );
135
- $where[] = 'processed = ' . $this->status;
136
  }
137
 
138
- $this->where_no_filter = implode( ' AND ', $where );
139
 
140
  // filter by month
141
  if ( ! empty( $_REQUEST['m'] ) ) {
142
- $year = (int) substr( $_REQUEST['m'], 0, 4);
143
- $month = (int) substr( $_REQUEST['m'], -2 );
144
- $where[] = "YEAR(FROM_UNIXTIME(date)) = " . esc_sql( $year );
145
- $where[] = "MONTH(FROM_UNIXTIME(date)) = " . esc_sql( $month );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  }
147
 
148
  $selects = apply_filters( 'wpsc_manage_purchase_logs_selects', implode( ', ', $selects ) );
149
  $this->joins = apply_filters( 'wpsc_manage_purchase_logs_joins' , implode( ' ', $joins ) );
150
- $this->where = apply_filters( 'wpsc_manage_purchase_logs_where' , implode( ' AND ', $where ) );
151
 
152
  $limit = ( $this->per_page !== 0 ) ? "LIMIT {$offset}, {$this->per_page}" : '';
153
 
@@ -157,7 +171,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
157
  $orderby = esc_sql( apply_filters( 'wpsc_manage_purchase_logs_orderby', $orderby ) );
158
  $order = esc_sql( $order );
159
 
160
- $submitted_data_log = WPSC_TABLE_SUBMITTED_FORM_DATA;
161
  $purchase_log_sql = apply_filters( 'wpsc_manage_purchase_logs_sql', "
162
  SELECT SQL_CALC_FOUND_ROWS {$selects}
163
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
@@ -180,7 +193,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
180
  $total_where = apply_filters( 'wpsc_manage_purchase_logs_total_where', $this->where );
181
 
182
  if ( $this->status == 'all' ) {
183
- $total_where .= ' AND p.processed IN (2, 3, 4) ';
184
  }
185
 
186
  $total_sql = "
@@ -193,6 +206,170 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
193
  $this->total_amount = $wpdb->get_var( $total_sql );
194
  }
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  public function is_pagination_enabled() {
197
  return $this->per_page !== 0;
198
  }
@@ -219,12 +396,12 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
219
  public function get_columns() {
220
  return array(
221
  'cb' => '<input type="checkbox" />',
222
- 'id' => __( 'Order ID', 'wpsc' ),
223
- 'customer' => __( 'Customer', 'wpsc' ),
224
- 'amount' => __( 'Amount', 'wpsc' ),
225
- 'status' => _x( 'Status', 'sales log list table column', 'wpsc' ),
226
- 'date' => __( 'Date', 'wpsc' ),
227
- 'tracking' => _x( 'Tracking ID', 'purchase log', 'wpsc' ),
228
  ) ;
229
  }
230
 
@@ -269,34 +446,74 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
269
  return $months;
270
  }
271
 
272
- public function get_views() {
273
- global $wpdb;
 
 
 
 
274
 
275
- $view_labels = array(
276
- 1 => _nx_noop( 'Incomplete <span class="count">(%s)</span>', 'Incomplete <span class="count">(%s)</span>', 'purchase logs' ),
277
- 2 => _nx_noop( 'Received <span class="count">(%s)</span>' , 'Received <span class="count">(%s)</span>' , 'purchase logs' ),
278
- 3 => _nx_noop( 'Accepted <span class="count">(%s)</span>' , 'Accepted <span class="count">(%s)</span>' , 'purchase logs' ),
279
- 4 => _nx_noop( 'Dispatched <span class="count">(%s)</span>', 'Dispatched <span class="count">(%s)</span>', 'purchase logs' ),
280
- 5 => _nx_noop( 'Closed <span class="count">(%s)</span>' , 'Closed <span class="count">(%s)</span>' , 'purchase logs' ),
281
- 6 => _nx_noop( 'Declined <span class="count">(%s)</span>' , 'Declined <span class="count">(%s)</span>' , 'purchase logs' ),
282
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
 
284
- $sql = "SELECT DISTINCT processed, COUNT(*) AS count FROM " . WPSC_TABLE_PURCHASE_LOGS . " GROUP BY processed ORDER BY processed";
285
  $results = $wpdb->get_results( $sql );
286
- $statuses = array();
287
- $total_count = 0;
 
288
 
289
  if ( ! empty( $results ) ) {
290
  foreach ( $results as $status ) {
291
  $statuses[$status->processed] = $status->count;
 
292
  }
293
-
294
- $total_count = array_sum( $statuses );
295
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
  $all_text = sprintf(
298
- _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_count, 'purchase logs', 'wpsc' ),
299
- number_format_i18n( $total_count )
300
  );
301
 
302
  $all_href = remove_query_arg( array(
@@ -321,12 +538,23 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
321
  );
322
 
323
  foreach ( $statuses as $status => $count ) {
324
- if ( ! isset( $view_labels[$status] ) )
325
  continue;
326
- $text = sprintf(
327
- translate_nooped_plural( $view_labels[$status], $count, 'wpsc' ),
328
- number_format_i18n( $count )
329
- );
 
 
 
 
 
 
 
 
 
 
 
330
  $href = add_query_arg( 'status', $status );
331
  $href = remove_query_arg( array(
332
  'deleted',
@@ -365,8 +593,11 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
365
  if ( ! empty( $months ) ) {
366
  ?>
367
  <select name="m">
368
- <option <?php selected( 0, $m ); ?> value="0"><?php _e( 'Show all dates' ); ?></option>
369
  <?php
 
 
 
370
  foreach ( $months as $arc_row ) {
371
  $month = zeroise( $arc_row->month, 2 );
372
  $year = $arc_row->year;
@@ -380,8 +611,54 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
380
  ?>
381
  </select>
382
  <?php
383
- submit_button( _x( 'Filter', 'extra navigation in purchase log page', 'wpsc' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  }
 
 
385
  }
386
 
387
  public function extra_tablenav( $which ) {
@@ -398,9 +675,9 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
398
  parent::pagination( $which );
399
  $output = ob_get_clean();
400
  if ( $this->status == 'all' )
401
- $string = _x( 'Total (excluding Incomplete and Declined): %s', 'sales log page total', 'wpsc' );
402
  else
403
- $string = _x( 'Total: %s', 'sales log page total', 'wpsc' );
404
  $total_amount = ' - ' . sprintf( $string, wpsc_currency_display( $this->total_amount ) );
405
  $total_amount = str_replace( '$', '\$', $total_amount );
406
  $output = preg_replace( '/(<span class="displaying-num">)([^<]+)(<\/span>)/', '${1}${2}' . ' ' . $total_amount . '${3}', $output );
@@ -448,13 +725,13 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
448
  $name = trim( $name );
449
 
450
  if ( empty( $name ) ) {
451
- $name = apply_filters( 'wpsc_purchase_log_list_no_name', __( 'No name provided', 'wpsc' ), $item );
452
  }
453
 
454
 
455
  ?>
456
  <strong>
457
- <a class="row-title" href="<?php echo esc_url( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wpsc' ) ?>"><?php echo esc_html( $name ); ?></a>
458
  </strong><br />
459
 
460
  <?php if ( isset( $item->email ) ) : ?>
@@ -480,31 +757,31 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
480
 
481
  public function column_id( $item ) {
482
  ?>
483
- <a href="<?php echo esc_url( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wpsc' ) ?>"><?php echo esc_html( $item->id ); ?></a>
484
  <?php if ( ! $this->current_action() == 'delete' ): ?>
485
  <br />
486
- <small><a class="delete" href="<?php echo esc_url( $this->delete_url( $item ) ); ?>"><?php echo esc_html_x( 'Delete', 'Sales log page', 'wpsc' ); ?></a></small>
487
  <?php endif ?>
488
  <?php
489
  }
490
 
491
  public function column_date( $item ) {
492
- $format = __( 'Y/m/d g:i:s A' );
493
  $timestamp = (int) $item->date;
494
  $full_time = date( $format, $timestamp );
495
  $time_diff = time() - $timestamp;
496
  if ( $time_diff > 0 && $time_diff < 24 * 60 * 60 )
497
- $h_time = $h_time = sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
498
  else
499
- $h_time = date( __( get_option( 'date_format', 'Y/m/d' ) ), $timestamp );
500
 
501
- echo '<abbr title="' . $full_time . '">' . $h_time . '</abbr>';
502
  }
503
 
504
  public function column_amount( $item ) {
505
- echo '<a href="' . esc_attr( $this->item_url( $item ) ) . '" title="' . esc_attr__( 'View order details', 'wpsc' ) . '">';
506
  echo wpsc_currency_display( $item->amount ) . "<br />";
507
- echo '<small>' . sprintf( _n( '1 item', '%s items', $item->item_count, 'wpsc' ), number_format_i18n( $item->item_count ) ) . '</small>';
508
  echo '</a>';
509
  }
510
 
@@ -539,34 +816,56 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
539
  $empty = empty( $item->track_id );
540
  ?>
541
  <div data-log-id="<?php echo esc_attr( $item->id ); ?>" <?php echo $empty ? ' class="empty"' : ''; ?>>
542
- <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wpsc' ); ?></a>
543
  <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
544
- <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wpsc' ); ?></a>
545
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
546
- <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wpsc' ); ?></a></small>
547
  </div>
548
  <?php
549
  }
550
 
 
 
 
 
 
 
 
 
 
551
  public function get_bulk_actions() {
552
- if ( ! $this->bulk_actions )
 
 
 
553
  return array();
 
554
 
 
555
  $actions = array(
556
- 'delete' => _x( 'Delete', 'bulk action', 'wpsc' ),
557
- '1' => __( 'Incomplete Sale', 'wpsc' ),
558
- '2' => __( 'Order Received', 'wpsc' ),
559
- '3' => __( 'Accepted Payment', 'wpsc' ),
560
- '4' => __( 'Job Dispatched', 'wpsc' ),
561
- '5' => __( 'Closed Order', 'wpsc' ),
562
- '6' => __( 'Payment Declined', 'wpsc' ),
563
  );
564
- return $actions;
 
 
 
 
 
 
 
 
 
 
 
 
 
565
  }
566
 
567
  public function search_box( $text, $input_id ) {
568
- if ( ! $this->search_box )
569
  return '';
 
570
 
571
  parent::search_box( $text, $input_id );
572
  }
77
 
78
  if ( isset( $_REQUEST['post'] ) ) {
79
  $posts = array_map( 'absint', $_REQUEST['post'] );
80
+ $where[] = ' and (p.id IN (' . implode( ', ', $posts ) . '))';
81
  }
82
 
83
  $i = 1;
126
  $search_sql = implode( ' AND ', array_values( $search_sql ) );
127
 
128
  if ( $search_sql ) {
129
+ $where[] = " AND ({$search_sql})";
130
  }
131
 
132
  // filter by status
133
  if ( ! empty( $_REQUEST['status'] ) && $_REQUEST['status'] != 'all' ) {
134
  $this->status = absint( $_REQUEST['status'] );
135
+ $where[] = ' AND (processed = ' . $this->status .')';
136
  }
137
 
138
+ $this->where_no_filter = implode( ' ', $where );
139
 
140
  // filter by month
141
  if ( ! empty( $_REQUEST['m'] ) ) {
142
+
143
+ // so we can tell WP_Date_Query we're legit
144
+ add_filter( 'date_query_valid_columns', array( $this, 'set_date_column_to_date') );
145
+
146
+ if ( strlen( $_REQUEST['m'] ) < 4 ) {
147
+ $query_args = $this->assemble_predefined_periods_query( $_REQUEST['m'] );
148
+ } else {
149
+ $query_args = array(
150
+ 'year' => (int) substr( $_REQUEST['m'], 0, 4),
151
+ 'monthnum' => (int) substr( $_REQUEST['m'], -2 ),
152
+ );
153
+ }
154
+
155
+ $date_query = new WP_Date_Query( $query_args , $column = '__date__' );
156
+ /* this is a subtle hack since the FROM_UNIXTIME doesn't survive WP_Date_Query
157
+ * so we use __date__ as a proxy
158
+ */
159
+ $where[] = str_replace( '__date__', 'FROM_UNIXTIME(p.date)', $date_query->get_sql() );
160
  }
161
 
162
  $selects = apply_filters( 'wpsc_manage_purchase_logs_selects', implode( ', ', $selects ) );
163
  $this->joins = apply_filters( 'wpsc_manage_purchase_logs_joins' , implode( ' ', $joins ) );
164
+ $this->where = apply_filters( 'wpsc_manage_purchase_logs_where' , implode( ' ', $where ) );
165
 
166
  $limit = ( $this->per_page !== 0 ) ? "LIMIT {$offset}, {$this->per_page}" : '';
167
 
171
  $orderby = esc_sql( apply_filters( 'wpsc_manage_purchase_logs_orderby', $orderby ) );
172
  $order = esc_sql( $order );
173
 
 
174
  $purchase_log_sql = apply_filters( 'wpsc_manage_purchase_logs_sql', "
175
  SELECT SQL_CALC_FOUND_ROWS {$selects}
176
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
193
  $total_where = apply_filters( 'wpsc_manage_purchase_logs_total_where', $this->where );
194
 
195
  if ( $this->status == 'all' ) {
196
+ $total_where .= ' AND p.processed IN (3, 4, 5) ';
197
  }
198
 
199
  $total_sql = "
206
  $this->total_amount = $wpdb->get_var( $total_sql );
207
  }
208
 
209
+ /**
210
+ * Construct the date queries for pre-defined periods in the Sales Log.
211
+ *
212
+ * Supports pre-defined periods for the purchase log, including today, yesterday, this week,
213
+ * last week, this month, last month, last two months + month to date (this quarter),
214
+ * prior 3 months, this year, last year. You can insert your own custom periods by filtering
215
+ * either based on the $period_flag or just filter the final query setup.
216
+ *
217
+ * @since 4.0
218
+ *
219
+ * @param array $period_flag The period requested from $_REQUEST['m'].
220
+ *
221
+ * @return array formatted to pass to WP_Date_Query.
222
+ */
223
+
224
+ private function assemble_predefined_periods_query( $period_flag ){
225
+ // warning: period flag is unsanitized user input directly from $_REQUEST - only compare against actual values
226
+
227
+ /**
228
+ * date functions
229
+ */
230
+ $now_string = current_time( 'mysql' );
231
+ $week_start_end = get_weekstartend( $now_string ); // returns array with start/end
232
+ $blog_time_zone = get_option( 'timezone_string' );
233
+
234
+ if ( empty( $blog_time_zone ) ) {
235
+ $blog_time_zone = date_default_timezone_get();
236
+ }
237
+
238
+ $timezone = new DateTimeZone( $blog_time_zone );
239
+ $now = new DateTime( 'now', $timezone );
240
+
241
+ // Based on $_REQUEST['m']
242
+ switch ( $period_flag ) {
243
+ // Today
244
+ case 1:
245
+ $date_query = array(
246
+ 'year' => $now->format( 'Y' ),
247
+ 'monthnum' => $now->format( 'n' ),
248
+ 'day' => $now->format( 'd' )
249
+ );
250
+ break;
251
+
252
+ // Yesterday
253
+ case 2:
254
+ $yesterday = new DateTime( date( 'Y-m-d', strtotime( 'yesterday' ) ), $timezone );
255
+ $date_query = array(
256
+ 'year' => $yesterday->format( 'Y' ),
257
+ 'monthnum' => $yesterday->format( 'n' ),
258
+ 'day' => $yesterday->format( 'd' )
259
+ );
260
+ break;
261
+
262
+ // This Week-to-date
263
+ case 3:
264
+ $start_of_this_week = new DateTime( date( 'Y-m-d 00:00:00', $week_start_end['start'] ), $timezone );
265
+ $date_query = array( 'date_query' => array(
266
+ 'after' => $start_of_this_week->format('Y-m-d 00:00:00'),
267
+ 'compare' => '>',
268
+ 'inclusive' => true
269
+ ));
270
+ break;
271
+
272
+ // Last Week
273
+ case 4:
274
+ $start_of_last_week = new DateTime( date('Y-m-d 00:00:00', $week_start_end['start'] - ( DAY_IN_SECONDS * 7 ) ), $timezone );
275
+ $start = $start_of_last_week->format( 'Y-m-d 00:00:00' );
276
+ $start_of_last_week->modify( '+7 days' );
277
+ $date_query = array( 'date_query' => array(
278
+ 'after' => $start,
279
+ 'before' => $start_of_last_week->format( 'Y-m-d 00:00:00' ),
280
+ 'inclusive' => false,
281
+ ));
282
+ break;
283
+
284
+ // This Month-to-Date (Same as choosing the explicit month on selector)
285
+ case 5:
286
+ $date_query = array(
287
+ 'year' => $now->format('Y'),
288
+ 'monthnum' => $now->format('n'),
289
+ );
290
+ break;
291
+
292
+ // Last Month (Same as choosing the explicit month on selector)
293
+ case 6:
294
+ $now->modify('-1 month');
295
+ $date_query = array(
296
+ 'year' => $now->format('Y'),
297
+ 'monthnum' => $now->format('n'),
298
+ );
299
+ break;
300
+
301
+ // This Quarter (last three months inclusive)
302
+ case 7:
303
+ $date_query = array('date_query' => array(
304
+ 'after' => 'first day of -2 months' ),
305
+ 'compare' => '>',
306
+ 'inclusive' => true,
307
+ );
308
+
309
+ break;
310
+
311
+ // Prior Three Months
312
+ case 8:
313
+ $date_query = array( 'date_query' => array(
314
+ 'after' => 'first day of -2 months',
315
+ 'before' => 'last day of -1 month',
316
+ 'inclusive' => true,
317
+ ));
318
+ break;
319
+
320
+ // This Year
321
+ case 9:
322
+ $date_query = array( 'date_query' => array(
323
+ 'after' => '1/1 this year',
324
+ 'compare' => '>',
325
+ 'inclusive' => true,
326
+ ));
327
+ break;
328
+
329
+ // Last year
330
+ case 10:
331
+ $date_query = array( 'date_query' => array(
332
+ 'after' => '1/1 last year',
333
+ 'before' => '12/31 last year',
334
+ 'inclusive' => true,
335
+ ));
336
+ break;
337
+
338
+ // default - return empty where clause
339
+ default:
340
+ /**
341
+ * Return a custom date query for custom period_flag's.
342
+ *
343
+ * This filter extends the functionality allowing for custom periods if a new value
344
+ * is passed via $_REQUEST['m']. {@see 'purchase_log_special_periods'}.
345
+ *
346
+ * @since 4.1.0
347
+ *
348
+ * @param array Empty array to be filled with a valid query {@see WP_Date_Query}.
349
+ */
350
+ $date_query = apply_filters( 'wpsc_purchase_log_predefined_periods_' . $period_flag, array() );
351
+ }
352
+
353
+ /**
354
+ * Filter the parsed date query.
355
+ *
356
+ * This filter can be used to override the constructed date_query.
357
+ *
358
+ * @since 4.1.0
359
+ *
360
+ * @param array $date_query Empty array to be filled with a valid date query {@see WP_Date_Query}
361
+ * @param string $period_flag Value passed from $_REQUEST['m'].
362
+ */
363
+ return apply_filters( 'wpsc_purchase_log_predefined_periods', $date_query, $period_flag );
364
+ }
365
+
366
+ public function set_date_column_to_date( $columns ){
367
+
368
+ $columns[] = '__date__';
369
+ return $columns;
370
+
371
+ }
372
+
373
  public function is_pagination_enabled() {
374
  return $this->per_page !== 0;
375
  }
396
  public function get_columns() {
397
  return array(
398
  'cb' => '<input type="checkbox" />',
399
+ 'id' => __( 'Order ID', 'wp-e-commerce' ),
400
+ 'customer' => __( 'Customer', 'wp-e-commerce' ),
401
+ 'amount' => __( 'Amount', 'wp-e-commerce' ),
402
+ 'status' => _x( 'Status', 'sales log list table column', 'wp-e-commerce' ),
403
+ 'date' => __( 'Date', 'wp-e-commerce' ),
404
+ 'tracking' => _x( 'Tracking ID', 'purchase log', 'wp-e-commerce' ),
405
  ) ;
406
  }
407
 
446
  return $months;
447
  }
448
 
449
+ /**
450
+ * Get an array of the untranslated, base view labels for the purchase log statuses.
451
+ *
452
+ * @return array The untranslated, base view label for each status.
453
+ */
454
+ private function get_status_view_labels() {
455
 
456
+ global $wpsc_purchlog_statuses;
457
+
458
+ $view_labels = array();
459
+ foreach ( $wpsc_purchlog_statuses as $status ) {
460
+ if ( ! empty( $status['view_label'] ) ) {
461
+ // The status provides a view label i18n _nx_noop-able object.
462
+ $view_labels[$status['order']]['view_label'] = $status['view_label'];
463
+ } else {
464
+ // The status doesn't provide a view label i18n string. Use a generic one.
465
+ $view_labels[$status['order']]['view_label'] = _nx_noop(
466
+ '%s <span class="count">(%d)</span>',
467
+ '%s <span class="count">(%d)</span>',
468
+ 'Purchase log view links for custom status with no explicit translation.',
469
+ 'wp-e-commerce'
470
+ );
471
+ $view_labels[$status['order']]['label'] = $status['label'];
472
+ }
473
+ }
474
+ return $view_labels;
475
+ }
476
+
477
+ /**
478
+ * Returns a list of the purchase logs indexed on status number. Also includes a grand total
479
+ * indexed as 'all'.
480
+ *
481
+ * @return array An array indexed on status number giving the count of purchase logs in that status.
482
+ */
483
+ private function get_per_status_counts() {
484
+
485
+ global $wpdb;
486
 
487
+ $sql = 'SELECT DISTINCT processed, COUNT(*) AS count FROM ' . WPSC_TABLE_PURCHASE_LOGS . ' GROUP BY processed ORDER BY processed';
488
  $results = $wpdb->get_results( $sql );
489
+ $statuses = array(
490
+ 'all' => 0,
491
+ );
492
 
493
  if ( ! empty( $results ) ) {
494
  foreach ( $results as $status ) {
495
  $statuses[$status->processed] = $status->count;
496
+ $statuses['all'] += $status->count;
497
  }
 
 
498
  }
499
+ return $statuses;
500
+ }
501
+
502
+ /**
503
+ * Get the sub-views of the list table.
504
+ *
505
+ * Allows user to limit the list to orders in a particular status.
506
+ *
507
+ * @return array The available view links.
508
+ */
509
+ public function get_views() {
510
+
511
+ $view_labels = $this->get_status_view_labels();
512
+ $statuses = $this->get_per_status_counts();
513
 
514
  $all_text = sprintf(
515
+ _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $statuses['all'], 'purchase logs', 'wp-e-commerce' ),
516
+ number_format_i18n( $statuses['all'] )
517
  );
518
 
519
  $all_href = remove_query_arg( array(
538
  );
539
 
540
  foreach ( $statuses as $status => $count ) {
541
+ if ( ! isset( $view_labels[$status] ) ) {
542
  continue;
543
+ }
544
+ if ( empty( $view_labels[$status]['label'] ) ) {
545
+ // This translation needs only the quantity dropping in.
546
+ $text = sprintf(
547
+ translate_nooped_plural( $view_labels[$status]['view_label'], $count, 'wp-e-commerce' ),
548
+ number_format_i18n( $count )
549
+ );
550
+ } else {
551
+ // This translation needs the status label, and quantity dropping in.
552
+ $text = sprintf(
553
+ translate_nooped_plural( $view_labels[$status]['view_label'], $count, 'wp-e-commerce' ),
554
+ $view_labels[$status]['label'],
555
+ number_format_i18n( $count )
556
+ );
557
+ }
558
  $href = add_query_arg( 'status', $status );
559
  $href = remove_query_arg( array(
560
  'deleted',
593
  if ( ! empty( $months ) ) {
594
  ?>
595
  <select name="m">
596
+ <option <?php selected( 0, $m ); ?> value="0"><?php _e( 'Show all dates', 'wp-e-commerce' ); ?></option>
597
  <?php
598
+
599
+ $this->special_periods( $m );
600
+
601
  foreach ( $months as $arc_row ) {
602
  $month = zeroise( $arc_row->month, 2 );
603
  $year = $arc_row->year;
611
  ?>
612
  </select>
613
  <?php
614
+ submit_button( _x( 'Filter', 'extra navigation in purchase log page', 'wp-e-commerce' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
615
+
616
+ }
617
+ }
618
+
619
+ /**
620
+ * Outputs the pre-defined selectable periods.
621
+ *
622
+ * Inserts new predefined periods into the period filter select on sales log screen.
623
+ *
624
+ * @since 4.1.0
625
+ *
626
+ * @param string $selected The value of $_REQUEST['m'] - unsanitized.
627
+ */
628
+ private function special_periods( $selected ){
629
+
630
+ /**
631
+ * Filter the available special periods on the purchase log listing screen.
632
+ *
633
+ * Can Used to remove periods or add new period definitions {@see wpsc_purchase_log_predefined_periods_}
634
+ *
635
+ * @since 4.1.0
636
+ *
637
+ * @param array array() The periods currently defined.
638
+ */
639
+ $periods = apply_filters( 'wpsc_purchase_log_special_periods', array(
640
+ 1 => _x('Today', 'time period for the current day', 'wp-e-commerce'),
641
+ 2 => _x('Yesterday', 'time period for the previous day', 'wp-e-commerce'),
642
+ 3 => _x('This Week', 'time period for the current week', 'wp-e-commerce'),
643
+ 4 => _x('Last Week', 'time period for the prior week', 'wp-e-commerce'),
644
+ 5 => _x('This Month', 'time period for the current month to date', 'wp-e-commerce'),
645
+ 6 => _x('Last Month', 'time period for the prior month', 'wp-e-commerce'),
646
+ 7 => _x('This Quarter', 'time period for the prior two months plus this month-to-date', 'wp-e-commerce'),
647
+ 8 => _x('Prior 3 Months', 'time period for the three months prior to the current month', 'wp-e-commerce'),
648
+ 9 => _x('This Year', 'time period for the current year to date', 'wp-e-commerce'),
649
+ 10 => _x('Last Year', 'time period for the prior year', 'wp-e-commerce'),
650
+ ) );
651
+
652
+ echo '<option disabled="disabled">---------</option>';
653
+ foreach( $periods as $value => $label ){
654
+ printf( "<option %s value='%s'>%s</option>\n",
655
+ selected( $value, $selected, false ),
656
+ esc_attr( $value ),
657
+ esc_html( $label )
658
+ );
659
  }
660
+ echo '<option disabled="disabled">---------</option>';
661
+
662
  }
663
 
664
  public function extra_tablenav( $which ) {
675
  parent::pagination( $which );
676
  $output = ob_get_clean();
677
  if ( $this->status == 'all' )
678
+ $string = _x( 'Total (excluding Incomplete and Declined): %s', 'sales log page total', 'wp-e-commerce' );
679
  else
680
+ $string = _x( 'Total: %s', 'sales log page total', 'wp-e-commerce' );
681
  $total_amount = ' - ' . sprintf( $string, wpsc_currency_display( $this->total_amount ) );
682
  $total_amount = str_replace( '$', '\$', $total_amount );
683
  $output = preg_replace( '/(<span class="displaying-num">)([^<]+)(<\/span>)/', '${1}${2}' . ' ' . $total_amount . '${3}', $output );
725
  $name = trim( $name );
726
 
727
  if ( empty( $name ) ) {
728
+ $name = apply_filters( 'wpsc_purchase_log_list_no_name', __( 'No name provided', 'wp-e-commerce' ), $item );
729
  }
730
 
731
 
732
  ?>
733
  <strong>
734
+ <a class="row-title" href="<?php echo esc_url( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wp-e-commerce' ) ?>"><?php echo esc_html( $name ); ?></a>
735
  </strong><br />
736
 
737
  <?php if ( isset( $item->email ) ) : ?>
757
 
758
  public function column_id( $item ) {
759
  ?>
760
+ <a href="<?php echo esc_url( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wp-e-commerce' ) ?>"><?php echo esc_html( $item->id ); ?></a>
761
  <?php if ( ! $this->current_action() == 'delete' ): ?>
762
  <br />
763
+ <small><a class="delete" href="<?php echo esc_url( $this->delete_url( $item ) ); ?>"><?php echo esc_html_x( 'Delete', 'Sales log page', 'wp-e-commerce' ); ?></a></small>
764
  <?php endif ?>
765
  <?php
766
  }
767
 
768
  public function column_date( $item ) {
769
+ $format = _x( 'Y/m/d g:i:s A', 'default date format for purchase log columns', 'wp-e-commerce' );
770
  $timestamp = (int) $item->date;
771
  $full_time = date( $format, $timestamp );
772
  $time_diff = time() - $timestamp;
773
  if ( $time_diff > 0 && $time_diff < 24 * 60 * 60 )
774
+ $h_time = $h_time = sprintf( __( '%s ago', 'wp-e-commerce' ), human_time_diff( $timestamp ) );
775
  else
776
+ $h_time = date( get_option( 'date_format', 'Y/m/d' ), $timestamp );
777
 
778
+ echo '<abbr title="' . esc_attr( $full_time ) . '">' . esc_html( $h_time ) . '</abbr>';
779
  }
780
 
781
  public function column_amount( $item ) {
782
+ echo '<a href="' . esc_attr( $this->item_url( $item ) ) . '" title="' . esc_attr__( 'View order details', 'wp-e-commerce' ) . '">';
783
  echo wpsc_currency_display( $item->amount ) . "<br />";
784
+ echo '<small>' . sprintf( _n( '1 item', '%s items', $item->item_count, 'wp-e-commerce' ), number_format_i18n( $item->item_count ) ) . '</small>';
785
  echo '</a>';
786
  }
787
 
816
  $empty = empty( $item->track_id );
817
  ?>
818
  <div data-log-id="<?php echo esc_attr( $item->id ); ?>" <?php echo $empty ? ' class="empty"' : ''; ?>>
819
+ <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wp-e-commerce' ); ?></a>
820
  <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
821
+ <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wp-e-commerce' ); ?></a>
822
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
823
+ <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wp-e-commerce' ); ?></a></small>
824
  </div>
825
  <?php
826
  }
827
 
828
+ /**
829
+ * Provide bulk actions for sales logs.
830
+ *
831
+ * Generates bulk actions for standard order statuses. Also generates a "delete" bulk action,
832
+ * and actions for any additional statuses that have been registered via the
833
+ * wpsc_set_purchlog_statuses filter.
834
+ *
835
+ * @return array Array of bulk actions available.
836
+ */
837
  public function get_bulk_actions() {
838
+
839
+ global $wpsc_purchlog_statuses;
840
+
841
+ if ( ! $this->bulk_actions ) {
842
  return array();
843
+ }
844
 
845
+ // Standard actions.
846
  $actions = array(
847
+ 'delete' => _x( 'Delete', 'bulk action', 'wp-e-commerce' ),
 
 
 
 
 
 
848
  );
849
+
850
+ // Loop through all statuses and register bulk actions for them.
851
+ foreach ( $wpsc_purchlog_statuses as $status ) {
852
+ $actions[$status['order']] = $status['label'];
853
+ }
854
+
855
+ /**
856
+ * Filter the available bulk actions on the purchase log listing screen.
857
+ *
858
+ * @since 4.0
859
+ *
860
+ * @param array $actions The bulk actions currently defined.
861
+ */
862
+ return apply_filters( 'wpsc_manage_purchase_logs_bulk_actions', $actions );
863
  }
864
 
865
  public function search_box( $text, $input_id ) {
866
+ if ( ! $this->search_box ) {
867
  return '';
868
+ }
869
 
870
  parent::search_box( $text, $input_id );
871
  }
wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php CHANGED
@@ -1,9 +1,9 @@
1
  <h3>
2
- <?php esc_html_e( 'Are you sure you want to delete these purchase logs?', 'wpsc' ); ?><br />
3
  </h3>
4
  <div>
5
- <a href="<?php echo esc_url( wp_get_referer() ); ?>" class="button"><?php esc_html_e( 'Go Back', 'wpsc' ); ?></a>
6
- <input class="button-primary" type="submit" value="<?php esc_attr_e( 'Delete', 'wpsc' ); ?>" />
7
  <input type="hidden" name="confirm" value="1" />
8
  <input type="hidden" name="action" value="delete" />
9
  </div>
1
  <h3>
2
+ <?php esc_html_e( 'Are you sure you want to delete these purchase logs?', 'wp-e-commerce' ); ?><br />
3
  </h3>
4
  <div>
5
+ <a href="<?php echo esc_url( wp_get_referer() ); ?>" class="button"><?php esc_html_e( 'Go Back', 'wp-e-commerce' ); ?></a>
6
+ <input class="button-primary" type="submit" value="<?php esc_attr_e( 'Delete', 'wp-e-commerce' ); ?>" />
7
  <input type="hidden" name="confirm" value="1" />
8
  <input type="hidden" name="action" value="delete" />
9
  </div>
wpsc-admin/includes/purchase-logs-page/item-details.php CHANGED
@@ -1,17 +1,17 @@
1
  <div class="wrap">
2
  <div id="icon-users" class="icon32"><br/></div>
3
  <h2>
4
- <?php esc_html_e( 'Sales Log Details', 'wpsc' ); ?>
5
  <span class="subtitle">#<?php echo $this->log_id; ?> – <?php echo wpsc_purchaselog_details_date_time(); ?></span>
6
  <?php $this->purchase_logs_pagination() ?>
7
  </h2>
8
  <?php if ( $receipt_sent ): ?>
9
  <div class="updated">
10
- <p><?php esc_html_e( 'Receipt has been resent successfully.', 'wpsc' ); ?></p>
11
  </div>
12
  <?php elseif ( $receipt_not_sent ) : ?>
13
  <div class="error">
14
- <p><?php esc_html_e( 'Receipt could not be sent to buyer. Please contact your hosting service and make sure your server can send emails.', 'wpsc' ); ?></p>
15
  </div>
16
  <?php endif; ?>
17
 
@@ -19,35 +19,35 @@
19
  <?php if ( wpsc_has_purchlog_shipping() ): ?>
20
  <?php do_action( 'wpsc_shipping_details_top', $this->log_id ); ?>
21
  <div id='wpsc_shipping_details_box'>
22
- <h3><?php esc_html_e( 'Shipping Address', 'wpsc' ); ?></h3>
23
  <blockquote>
24
  <strong>
25
- <?php echo ( wpsc_display_purchlog_shipping_name() != "" ) ? wpsc_display_purchlog_shipping_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wpsc' ) . '</span>' ; ?>
26
  </strong>
27
  <?php echo ( wpsc_display_purchlog_shipping_address() != "" ) ? wpsc_display_purchlog_shipping_address() . "<br />" : '' ; ?>
28
- <?php echo ( wpsc_display_purchlog_shipping_city() != "" ) ? wpsc_display_purchlog_shipping_city() . "<br />" : '' ; ?>
29
  <?php echo ( wpsc_display_purchlog_shipping_state_and_postcode() != "" ) ? wpsc_display_purchlog_shipping_state_and_postcode() . "<br />" : '' ; ?>
30
- <?php echo ( wpsc_display_purchlog_shipping_country() != "" ) ? wpsc_display_purchlog_shipping_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wpsc' ) . '</span>' ; ?>
31
  </blockquote>
32
- <h4><?php esc_html_e( 'Shipping Details', 'wpsc' ); ?></h4>
33
  <blockquote>
34
- <strong><?php esc_html_e( 'Shipping Method:', 'wpsc' ); ?></strong> <?php echo wpsc_display_purchlog_shipping_method(); ?><br />
35
- <strong><?php esc_html_e( 'Shipping Option:', 'wpsc' ); ?></strong> <?php echo wpsc_display_purchlog_shipping_option(); ?><br />
36
  <?php $purchase_weight = wpsc_purchlogs_get_weight_text(); ?>
37
  <?php if ( ! empty( $purchase_weight ) ) { ?>
38
- <strong><?php esc_html_e( 'Purchase Weight:', 'wpsc' ); ?></strong> <?php echo $purchase_weight; ?><br />
39
  <?php } ?>
40
  <?php if ( wpsc_purchlogs_has_tracking() ) { ?>
41
- <strong><?php echo esc_html_x( 'Tracking ID:', 'purchase log', 'wpsc' ); ?></strong> <?php echo wpsc_purchlogitem_trackid(); ?><br />
42
 
43
  <?php $tracking_status = wpsc_purchlogitem_trackstatus(); ?>
44
  <?php if ( ! empty ( $tracking_status ) ) { ?>
45
- <strong><?php esc_html_e( 'Shipping Status:', 'wpsc' ); ?></strong> <?php echo $tracking_status ?><br />
46
  <?php } ?>
47
 
48
  <?php $tracking_history = wpsc_purchlogitem_trackhistory(); ?>
49
  <?php if ( ! empty ( $tracking_history ) ) { ?>
50
- <strong><?php esc_html_e( 'Track History:', 'wpsc' ); ?></strong> <?php echo $tracking_history; ?><br />
51
  <?php } ?>
52
 
53
  <?php } ?>
@@ -58,38 +58,40 @@
58
 
59
  <div id='wpsc_billing_details_box'>
60
  <?php do_action( 'wpsc_billing_details_top', $this->log_id ); ?>
61
- <h3><?php esc_html_e( 'Billing Details', 'wpsc' ); ?></h3>
62
  <blockquote>
63
  <strong>
64
- <?php echo ( wpsc_display_purchlog_buyers_name() != "" ) ? wpsc_display_purchlog_buyers_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wpsc' ) . '</span>' ; ?>
65
  </strong>
66
  <?php echo ( wpsc_display_purchlog_buyers_address() != "" ) ? wpsc_display_purchlog_buyers_address() . "<br />" : '' ; ?>
67
  <?php echo ( wpsc_display_purchlog_buyers_city() != "" ) ? wpsc_display_purchlog_buyers_city() . "<br />" : '' ; ?>
68
  <?php echo ( wpsc_display_purchlog_buyers_state_and_postcode() != "" ) ? wpsc_display_purchlog_buyers_state_and_postcode() . "<br />" : '' ; ?>
69
- <?php echo ( wpsc_display_purchlog_buyers_country() != "" ) ? wpsc_display_purchlog_buyers_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wpsc' ) . '</span>' ; ?>
70
  </blockquote>
71
- <h4><?php esc_html_e( 'Payment Details', 'wpsc' ); ?></h4>
72
  <blockquote>
73
- <strong><?php esc_html_e( 'Phone:', 'wpsc' ); ?> </strong><?php echo ( wpsc_display_purchlog_buyers_phone() != "" ) ? wpsc_display_purchlog_buyers_phone() : __( '<em class="field-blank">not provided</em>', 'wpsc' ); ?><br />
74
- <strong><?php esc_html_e( 'Email:', 'wpsc' ); ?> </strong>
75
- <a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=<?php echo rawurlencode( sprintf( __( 'Message from %s', 'wpsc' ), site_url() ) ); ?>">
76
- <?php echo ( wpsc_display_purchlog_buyers_email() != "" ) ? wpsc_display_purchlog_buyers_email() : __( '<em class="field-blank">not provided</em>', 'wpsc' ); ?>
77
  </a>
78
  <br />
79
- <strong><?php esc_html_e( 'Payment Method:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?><br />
80
  <?php if ( wpsc_display_purchlog_display_howtheyfoundus() ) : ?>
81
- <strong><?php esc_html_e( 'How User Found Us:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?><br />
82
  <?php endif; ?>
83
  </blockquote>
84
  <?php do_action( 'wpsc_billing_details_bottom', $this->log_id ); ?>
85
  </div>
86
 
87
  <div id='wpsc_items_ordered'>
88
- <h3><?php esc_html_e( 'Items Ordered', 'wpsc' ); ?></h3>
89
  <table class="widefat" cellspacing="0">
90
  <thead>
91
  <tr>
92
- <?php print_column_headers( 'wpsc_purchase_log_item_details' ); ?>
 
 
93
  </tr>
94
  </thead>
95
 
@@ -99,46 +101,46 @@
99
  <tr class="wpsc_purchaselog_start_totals">
100
  <td colspan="<?php echo $cols; ?>">
101
  <?php if ( wpsc_purchlog_has_discount_data() ): ?>
102
- <?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
103
  <?php endif; ?>
104
  </td>
105
- <th class='right-col'><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
106
  <td><?php echo wpsc_display_purchlog_discount(); ?></td>
107
  </tr>
108
 
109
  <?php if( ! wpec_display_product_tax() ): ?>
110
  <tr>
111
  <td colspan='<?php echo $cols; ?>'></td>
112
- <th class='right-col'><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
113
  <td><?php echo wpsc_display_purchlog_taxes(); ?></td>
114
  </tr>
115
  <?php endif; ?>
116
 
117
  <tr>
118
  <td colspan='<?php echo $cols; ?>'></td>
119
- <th class='right-col'><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
120
  <td><?php echo wpsc_display_purchlog_shipping(); ?></td>
121
  </tr>
122
  <tr>
123
  <td colspan='<?php echo $cols; ?>'></td>
124
- <th class='right-col'><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
125
  <td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
126
  </tr>
127
  </tbody>
128
  </table>
129
 
130
- <?php $this->purchase_log_custom_fields(); ?>
131
 
132
  <div class="metabox-holder">
133
  <div id="purchlogs_notes" class="postbox">
134
- <h3 class='hndle'><?php _e( 'Order Notes' , 'wpsc' ); ?></h3>
135
  <div class='inside'>
136
  <form method="post" action="">
137
  <input type='hidden' name='wpsc_admin_action' value='purchlogs_update_notes' />
138
  <input type="hidden" name="wpsc_purchlogs_update_notes_nonce" id="wpsc_purchlogs_update_notes_nonce" value="<?php echo wp_create_nonce( 'wpsc_purchlogs_update_notes' ); ?>" />
139
  <input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
140
  <p><textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php echo esc_textarea( wpsc_display_purchlog_notes() ); ?></textarea></p>
141
- <div><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></div>
142
  </form>
143
  </div>
144
  </div>
@@ -151,7 +153,7 @@
151
  </div>
152
 
153
  <div id="wpsc_purchlogitems_links">
154
- <h3><?php esc_html_e( 'Actions', 'wpsc' ); ?></h3>
155
  <?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
156
  <ul>
157
  <?php
1
  <div class="wrap">
2
  <div id="icon-users" class="icon32"><br/></div>
3
  <h2>
4
+ <?php esc_html_e( 'Sales Log Details', 'wp-e-commerce' ); ?>
5
  <span class="subtitle">#<?php echo $this->log_id; ?> – <?php echo wpsc_purchaselog_details_date_time(); ?></span>
6
  <?php $this->purchase_logs_pagination() ?>
7
  </h2>
8
  <?php if ( $receipt_sent ): ?>
9
  <div class="updated">
10
+ <p><?php esc_html_e( 'Receipt has been resent successfully.', 'wp-e-commerce' ); ?></p>
11
  </div>
12
  <?php elseif ( $receipt_not_sent ) : ?>
13
  <div class="error">
14
+ <p><?php esc_html_e( 'Receipt could not be sent to buyer. Please contact your hosting service and make sure your server can send emails.', 'wp-e-commerce' ); ?></p>
15
  </div>
16
  <?php endif; ?>
17
 
19
  <?php if ( wpsc_has_purchlog_shipping() ): ?>
20
  <?php do_action( 'wpsc_shipping_details_top', $this->log_id ); ?>
21
  <div id='wpsc_shipping_details_box'>
22
+ <h3><?php esc_html_e( 'Shipping Address', 'wp-e-commerce' ); ?></h3>
23
  <blockquote>
24
  <strong>
25
+ <?php echo ( wpsc_display_purchlog_shipping_name() != "" ) ? wpsc_display_purchlog_shipping_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wp-e-commerce' ) . '</span>' ; ?>
26
  </strong>
27
  <?php echo ( wpsc_display_purchlog_shipping_address() != "" ) ? wpsc_display_purchlog_shipping_address() . "<br />" : '' ; ?>
28
+ <?php echo ( wpsc_display_purchlog_shipping_city() != "" ) ? wpsc_display_purchlog_shipping_city() . ", " : '' ; ?>
29
  <?php echo ( wpsc_display_purchlog_shipping_state_and_postcode() != "" ) ? wpsc_display_purchlog_shipping_state_and_postcode() . "<br />" : '' ; ?>
30
+ <?php echo ( wpsc_display_purchlog_shipping_country() != "" ) ? wpsc_display_purchlog_shipping_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wp-e-commerce' ) . '</span>' ; ?>
31
  </blockquote>
32
+ <h4><?php esc_html_e( 'Shipping Details', 'wp-e-commerce' ); ?></h4>
33
  <blockquote>
34
+ <strong><?php esc_html_e( 'Shipping Method:', 'wp-e-commerce' ); ?></strong> <?php echo wpsc_display_purchlog_shipping_method(); ?><br />
35
+ <strong><?php esc_html_e( 'Shipping Option:', 'wp-e-commerce' ); ?></strong> <?php echo wpsc_display_purchlog_shipping_option(); ?><br />
36
  <?php $purchase_weight = wpsc_purchlogs_get_weight_text(); ?>
37
  <?php if ( ! empty( $purchase_weight ) ) { ?>
38
+ <strong><?php esc_html_e( 'Purchase Weight:', 'wp-e-commerce' ); ?></strong> <?php echo $purchase_weight; ?><br />
39
  <?php } ?>
40
  <?php if ( wpsc_purchlogs_has_tracking() ) { ?>
41
+ <strong><?php echo esc_html_x( 'Tracking ID:', 'purchase log', 'wp-e-commerce' ); ?></strong> <?php echo wpsc_purchlogitem_trackid(); ?><br />
42
 
43
  <?php $tracking_status = wpsc_purchlogitem_trackstatus(); ?>
44
  <?php if ( ! empty ( $tracking_status ) ) { ?>
45
+ <strong><?php esc_html_e( 'Shipping Status:', 'wp-e-commerce' ); ?></strong> <?php echo $tracking_status ?><br />
46
  <?php } ?>
47
 
48
  <?php $tracking_history = wpsc_purchlogitem_trackhistory(); ?>
49
  <?php if ( ! empty ( $tracking_history ) ) { ?>
50
+ <strong><?php esc_html_e( 'Track History:', 'wp-e-commerce' ); ?></strong> <?php echo $tracking_history; ?><br />
51
  <?php } ?>
52
 
53
  <?php } ?>
58
 
59
  <div id='wpsc_billing_details_box'>
60
  <?php do_action( 'wpsc_billing_details_top', $this->log_id ); ?>
61
+ <h3><?php esc_html_e( 'Billing Details', 'wp-e-commerce' ); ?></h3>
62
  <blockquote>
63
  <strong>
64
+ <?php echo ( wpsc_display_purchlog_buyers_name() != "" ) ? wpsc_display_purchlog_buyers_name() . "<br />" : '<span class="field-blank">' . __( 'Anonymous', 'wp-e-commerce' ) . '</span>' ; ?>
65
  </strong>
66
  <?php echo ( wpsc_display_purchlog_buyers_address() != "" ) ? wpsc_display_purchlog_buyers_address() . "<br />" : '' ; ?>
67
  <?php echo ( wpsc_display_purchlog_buyers_city() != "" ) ? wpsc_display_purchlog_buyers_city() . "<br />" : '' ; ?>
68
  <?php echo ( wpsc_display_purchlog_buyers_state_and_postcode() != "" ) ? wpsc_display_purchlog_buyers_state_and_postcode() . "<br />" : '' ; ?>
69
+ <?php echo ( wpsc_display_purchlog_buyers_country() != "" ) ? wpsc_display_purchlog_buyers_country() . "<br />" : '<span class="field-blank">' . __( 'Country not specified', 'wp-e-commerce' ) . '</span>' ; ?>
70
  </blockquote>
71
+ <h4><?php esc_html_e( 'Payment Details', 'wp-e-commerce' ); ?></h4>
72
  <blockquote>
73
+ <strong><?php esc_html_e( 'Phone:', 'wp-e-commerce' ); ?> </strong><?php echo ( wpsc_display_purchlog_buyers_phone() != "" ) ? wpsc_display_purchlog_buyers_phone() : __( '<em class="field-blank">not provided</em>', 'wp-e-commerce' ); ?><br />
74
+ <strong><?php esc_html_e( 'Email:', 'wp-e-commerce' ); ?> </strong>
75
+ <a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=<?php echo rawurlencode( sprintf( __( 'Message from %s', 'wp-e-commerce' ), site_url() ) ); ?>">
76
+ <?php echo ( wpsc_display_purchlog_buyers_email() != "" ) ? wpsc_display_purchlog_buyers_email() : __( '<em class="field-blank">not provided</em>', 'wp-e-commerce' ); ?>
77
  </a>
78
  <br />
79
+ <strong><?php esc_html_e( 'Payment Method:', 'wp-e-commerce' ); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?><br />
80
  <?php if ( wpsc_display_purchlog_display_howtheyfoundus() ) : ?>
81
+ <strong><?php esc_html_e( 'How User Found Us:', 'wp-e-commerce' ); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?><br />
82
  <?php endif; ?>
83
  </blockquote>
84
  <?php do_action( 'wpsc_billing_details_bottom', $this->log_id ); ?>
85
  </div>
86
 
87
  <div id='wpsc_items_ordered'>
88
+ <h3><?php esc_html_e( 'Items Ordered', 'wp-e-commerce' ); ?></h3>
89
  <table class="widefat" cellspacing="0">
90
  <thead>
91
  <tr>
92
+ <?php
93
+ print_column_headers( 'wpsc_purchase_log_item_details' );
94
+ ?>
95
  </tr>
96
  </thead>
97
 
101
  <tr class="wpsc_purchaselog_start_totals">
102
  <td colspan="<?php echo $cols; ?>">
103
  <?php if ( wpsc_purchlog_has_discount_data() ): ?>
104
+ <?php esc_html_e( 'Coupon Code', 'wp-e-commerce' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
105
  <?php endif; ?>
106
  </td>
107
+ <th class='right-col'><?php esc_html_e( 'Discount', 'wp-e-commerce' ); ?> </th>
108
  <td><?php echo wpsc_display_purchlog_discount(); ?></td>
109
  </tr>
110
 
111
  <?php if( ! wpec_display_product_tax() ): ?>
112
  <tr>
113
  <td colspan='<?php echo $cols; ?>'></td>
114
+ <th class='right-col'><?php esc_html_e( 'Taxes', 'wp-e-commerce' ); ?> </th>
115
  <td><?php echo wpsc_display_purchlog_taxes(); ?></td>
116
  </tr>
117
  <?php endif; ?>
118
 
119
  <tr>
120
  <td colspan='<?php echo $cols; ?>'></td>
121
+ <th class='right-col'><?php esc_html_e( 'Shipping', 'wp-e-commerce' ); ?> </th>
122
  <td><?php echo wpsc_display_purchlog_shipping(); ?></td>
123
  </tr>
124
  <tr>
125
  <td colspan='<?php echo $cols; ?>'></td>
126
+ <th class='right-col'><?php esc_html_e( 'Total', 'wp-e-commerce' ); ?> </th>
127
  <td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
128
  </tr>
129
  </tbody>
130
  </table>
131
 
132
+ <?php do_action( 'wpsc_purchlogitem_metabox_start', $this->log_id ); ?>
133
 
134
  <div class="metabox-holder">
135
  <div id="purchlogs_notes" class="postbox">
136
+ <h3 class='hndle'><?php _e( 'Order Notes' , 'wp-e-commerce' ); ?></h3>
137
  <div class='inside'>
138
  <form method="post" action="">
139
  <input type='hidden' name='wpsc_admin_action' value='purchlogs_update_notes' />
140
  <input type="hidden" name="wpsc_purchlogs_update_notes_nonce" id="wpsc_purchlogs_update_notes_nonce" value="<?php echo wp_create_nonce( 'wpsc_purchlogs_update_notes' ); ?>" />
141
  <input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
142
  <p><textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php echo esc_textarea( wpsc_display_purchlog_notes() ); ?></textarea></p>
143
+ <div><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wp-e-commerce' ); ?>" /></div>
144
  </form>
145
  </div>
146
  </div>
153
  </div>
154
 
155
  <div id="wpsc_purchlogitems_links">
156
+ <h3><?php esc_html_e( 'Actions', 'wp-e-commerce' ); ?></h3>
157
  <?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
158
  <ul>
159
  <?php
wpsc-admin/includes/purchase-logs-page/list-table.php CHANGED
@@ -1,11 +1,11 @@
1
  <div class="wrap">
2
  <div id="icon-users" class="icon32"><br/></div>
3
  <h2>
4
- <?php esc_html_e( 'Sales Log', 'wpsc' ); ?>
5
 
6
  <?php
7
  if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
8
- printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( stripslashes( $_REQUEST['s'] ) ) ); ?>
9
  </h2>
10
 
11
  <?php if ( ! empty( $_REQUEST['updated'] ) || ! empty( $_REQUEST['deleted'] ) ): ?>
@@ -13,27 +13,27 @@
13
  <p>
14
  <?php
15
  if ( ! empty( $_REQUEST['updated'] ) )
16
- printf( _n( '%s item updated.', '%s items updated.', $_REQUEST['updated'] ), number_format_i18n( $_REQUEST['updated'] ) );
17
  ?>
18
  <?php
19
  if ( ! empty( $_REQUEST['deleted'] ) )
20
- printf( _n( '%s item deleted.', '%s items deleted.', $_REQUEST['deleted'] ), number_format_i18n( $_REQUEST['deleted'] ) );
21
  ?>
22
  </p>
23
  </div>
24
  <?php endif ?>
25
 
26
  <?php if( get_option( 'wpsc_purchaselogs_fixed' ) == false || ( wpsc_check_uniquenames() ) ): ?>
27
- <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __( 'When upgrading the WP eCommerce Plugin from 3.6.* to 3.7, it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">click here</a>', 'wpsc' ), esc_url( add_query_arg( 'c', 'upgrade_purchase_logs_3_7' ) ) ); ?></span></div>
28
  <?php endif; ?>
29
 
30
  <?php if ( $this->needs_update() ): ?>
31
- <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __( 'It has been detected that some of your purchase logs were not updated properly when you upgrade to WP eCommerce %s. Please <a href="%s">click here</a> to fix this problem.', 'wpsc' ), WPSC_VERSION, esc_url( add_query_arg( 'c', 'upgrade_purchase_logs_3_8' ) ) ); ?></span></div>
32
  <?php endif; ?>
33
 
34
  <form id="purchase-logs-search" method-"get" action="">
35
  <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
36
- <?php $this->list_table->search_box( __( 'Search Sales Logs', 'wpsc' ), 'post' ); ?>
37
  <?php if ( ! empty( $_REQUEST['status'] ) ): ?>
38
  <input type="hidden" name="status" value="<?php echo esc_attr( $_REQUEST['status'] ); ?>" />
39
  <?php endif ?>
@@ -77,7 +77,7 @@
77
  <p>
78
  <a class='admin_download' href='<?php echo esc_url( add_query_arg( 'action', 'download_csv' ) ); ?>' >
79
  <img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/download.gif' alt='' title='' />
80
- <span><?php _e( 'Download CSV', 'wpsc' ); ?></span>
81
  </a>
82
  </p>
83
  </div>
1
  <div class="wrap">
2
  <div id="icon-users" class="icon32"><br/></div>
3
  <h2>
4
+ <?php esc_html_e( 'Sales Log', 'wp-e-commerce' ); ?>
5
 
6
  <?php
7
  if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
8
+ printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', 'wp-e-commerce' ) . '</span>', esc_html( stripslashes( $_REQUEST['s'] ) ) ); ?>
9
  </h2>
10
 
11
  <?php if ( ! empty( $_REQUEST['updated'] ) || ! empty( $_REQUEST['deleted'] ) ): ?>
13
  <p>
14
  <?php
15
  if ( ! empty( $_REQUEST['updated'] ) )
16
+ printf( _n( '%s item updated.', '%s items updated.', $_REQUEST['updated'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['updated'] ) );
17
  ?>
18
  <?php
19
  if ( ! empty( $_REQUEST['deleted'] ) )
20
+ printf( _n( '%s item deleted.', '%s items deleted.', $_REQUEST['deleted'], 'wp-e-commerce' ), number_format_i18n( $_REQUEST['deleted'] ) );
21
  ?>
22
  </p>
23
  </div>
24
  <?php endif ?>
25
 
26
  <?php if( get_option( 'wpsc_purchaselogs_fixed' ) == false || ( wpsc_check_uniquenames() ) ): ?>
27
+ <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __( 'When upgrading the WP eCommerce Plugin from 3.6.* to 3.7, it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">click here</a>', 'wp-e-commerce' ), esc_url( add_query_arg( 'c', 'upgrade_purchase_logs_3_7' ) ) ); ?></span></div>
28
  <?php endif; ?>
29
 
30
  <?php if ( $this->needs_update() ): ?>
31
+ <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __( 'It has been detected that some of your purchase logs were not updated properly when you upgrade to WP eCommerce %s. Please <a href="%s">click here</a> to fix this problem.', 'wp-e-commerce' ), WPSC_VERSION, esc_url( add_query_arg( 'c', 'upgrade_purchase_logs_3_8' ) ) ); ?></span></div>
32
  <?php endif; ?>
33
 
34
  <form id="purchase-logs-search" method-"get" action="">
35
  <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
36
+ <?php $this->list_table->search_box( __( 'Search Sales Logs', 'wp-e-commerce' ), 'post' ); ?>
37
  <?php if ( ! empty( $_REQUEST['status'] ) ): ?>
38
  <input type="hidden" name="status" value="<?php echo esc_attr( $_REQUEST['status'] ); ?>" />
39
  <?php endif ?>
77
  <p>
78
  <a class='admin_download' href='<?php echo esc_url( add_query_arg( 'action', 'download_csv' ) ); ?>' >
79
  <img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/download.gif' alt='' title='' />
80
+ <span><?php _e( 'Download CSV', 'wp-e-commerce' ); ?></span>
81
  </a>
82
  </p>
83
  </div>
wpsc-admin/includes/purchase-logs-page/packing-slip.php CHANGED
@@ -1,7 +1,7 @@
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
  <head>
4
- <title><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wpsc' ), $this->log_id ); ?></title>
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
  <style type="text/css">
7
  body {
@@ -76,12 +76,12 @@
76
  <div id="header">
77
  <h1>
78
  <?php bloginfo( 'name' ); ?><br />
79
- <span><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wpsc' ), $this->log_id ); ?></span>
80
  </h1>
81
  </div>
82
  <div id="customer">
83
  <div class="shipping">
84
- <h2><?php echo esc_html_x( 'Ship To:', 'packing slip', 'wpsc' ); ?></h2>
85
  <strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong><br />
86
  <?php echo wpsc_display_purchlog_shipping_address(); ?><br />
87
  <?php echo wpsc_display_purchlog_shipping_city(); ?><br />
@@ -89,7 +89,7 @@
89
  <?php echo wpsc_display_purchlog_shipping_country(); ?><br />
90
  </div>
91
  <div class="billing">
92
- <h2><?php echo esc_html_x( 'Bill To:', 'packing slip', 'wpsc' ); ?></h2>
93
  <strong><?php echo wpsc_display_purchlog_buyers_name(); ?></strong><br />
94
  <?php echo wpsc_display_purchlog_buyers_address(); ?><br />
95
  <?php echo wpsc_display_purchlog_buyers_city(); ?><br />
@@ -100,10 +100,10 @@
100
  <table id="order">
101
  <thead>
102
  <tr>
103
- <th><?php echo esc_html_x( 'Order Date', 'packing slip', 'wpsc' ); ?></th>
104
- <th><?php echo esc_html_x( 'Order ID', 'packing slip', 'wpsc' ); ?></th>
105
- <th><?php echo esc_html_x( 'Shipping Method', 'packing slip', 'wpsc' ); ?></th>
106
- <th><?php echo esc_html_x( 'Payment Method', 'packing slip', 'wpsc' ); ?></th>
107
  <?php wpsc_purchaselog_order_summary_headers(); ?>
108
  </tr>
109
  </thead>
@@ -130,29 +130,29 @@
130
  <tr class="wpsc_purchaselog_start_totals">
131
  <td colspan="<?php echo $cols; ?>">
132
  <?php if ( wpsc_purchlog_has_discount_data() ): ?>
133
- <?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
134
  <?php endif; ?>
135
  </td>
136
- <th><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
137
  <td class="amount"><?php echo wpsc_display_purchlog_discount(); ?></td>
138
  </tr>
139
 
140
  <?php if( ! wpec_display_product_tax() ): ?>
141
  <tr>
142
  <td colspan='<?php echo $cols; ?>'></td>
143
- <th><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
144
  <td class="amount"><?php echo wpsc_display_purchlog_taxes(); ?></td>
145
  </tr>
146
  <?php endif; ?>
147
 
148
  <tr>
149
  <td colspan='<?php echo $cols; ?>'></td>
150
- <th><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
151
  <td class="amount"><?php echo wpsc_display_purchlog_shipping(); ?></td>
152
  </tr>
153
  <tr>
154
  <td colspan='<?php echo $cols; ?>'></td>
155
- <th><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
156
  <td class="amount"><?php echo wpsc_display_purchlog_totalprice(); ?></td>
157
  </tr>
158
  </tbody>
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
  <head>
4
+ <title><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wp-e-commerce' ), $this->log_id ); ?></title>
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
  <style type="text/css">
7
  body {
76
  <div id="header">
77
  <h1>
78
  <?php bloginfo( 'name' ); ?><br />
79
+ <span><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wp-e-commerce' ), $this->log_id ); ?></span>
80
  </h1>
81
  </div>
82
  <div id="customer">
83
  <div class="shipping">
84
+ <h2><?php echo esc_html_x( 'Ship To:', 'packing slip', 'wp-e-commerce' ); ?></h2>
85
  <strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong><br />
86
  <?php echo wpsc_display_purchlog_shipping_address(); ?><br />
87
  <?php echo wpsc_display_purchlog_shipping_city(); ?><br />
89
  <?php echo wpsc_display_purchlog_shipping_country(); ?><br />
90
  </div>
91
  <div class="billing">
92
+ <h2><?php echo esc_html_x( 'Bill To:', 'packing slip', 'wp-e-commerce' ); ?></h2>
93
  <strong><?php echo wpsc_display_purchlog_buyers_name(); ?></strong><br />
94
  <?php echo wpsc_display_purchlog_buyers_address(); ?><br />
95
  <?php echo wpsc_display_purchlog_buyers_city(); ?><br />
100
  <table id="order">
101
  <thead>
102
  <tr>
103
+ <th><?php echo esc_html_x( 'Order Date', 'packing slip', 'wp-e-commerce' ); ?></th>
104
+ <th><?php echo esc_html_x( 'Order ID', 'packing slip', 'wp-e-commerce' ); ?></th>
105
+ <th><?php echo esc_html_x( 'Shipping Method', 'packing slip', 'wp-e-commerce' ); ?></th>
106
+ <th><?php echo esc_html_x( 'Payment Method', 'packing slip', 'wp-e-commerce' ); ?></th>
107
  <?php wpsc_purchaselog_order_summary_headers(); ?>
108
  </tr>
109
  </thead>
130
  <tr class="wpsc_purchaselog_start_totals">
131
  <td colspan="<?php echo $cols; ?>">
132
  <?php if ( wpsc_purchlog_has_discount_data() ): ?>
133
+ <?php esc_html_e( 'Coupon Code', 'wp-e-commerce' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
134
  <?php endif; ?>
135
  </td>
136
+ <th><?php esc_html_e( 'Discount', 'wp-e-commerce' ); ?> </th>
137
  <td class="amount"><?php echo wpsc_display_purchlog_discount(); ?></td>
138
  </tr>
139
 
140
  <?php if( ! wpec_display_product_tax() ): ?>
141
  <tr>
142
  <td colspan='<?php echo $cols; ?>'></td>
143
+ <th><?php esc_html_e( 'Taxes', 'wp-e-commerce' ); ?> </th>
144
  <td class="amount"><?php echo wpsc_display_purchlog_taxes(); ?></td>
145
  </tr>
146
  <?php endif; ?>
147
 
148
  <tr>
149
  <td colspan='<?php echo $cols; ?>'></td>
150
+ <th><?php esc_html_e( 'Shipping', 'wp-e-commerce' ); ?> </th>
151
  <td class="amount"><?php echo wpsc_display_purchlog_shipping(); ?></td>
152
  </tr>
153
  <tr>
154
  <td colspan='<?php echo $cols; ?>'></td>
155
+ <th><?php esc_html_e( 'Total', 'wp-e-commerce' ); ?> </th>
156
  <td class="amount"><?php echo wpsc_display_purchlog_totalprice(); ?></td>
157
  </tr>
158
  </tbody>
wpsc-admin/includes/purchase-logs-page/upgrade.php CHANGED
@@ -1,13 +1,13 @@
1
  <div class='wrap'>
2
 
3
- <h2><?php esc_html_e( 'Sales Upgrade Fix', 'wpsc' ); ?> </h2>
4
 
5
  <?php if ( $numChanged != 0 && $numQueries != 0 ): ?>
6
  <div class="updated">
7
- <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wpsc' ), esc_url( remove_query_arg( 'c' ) ) ); ?></p>
8
  </div>
9
  <?php else: ?>
10
- <p><?php _e( 'Upgrading to WP eCommerce 3.7 and later requires you to run this fix once. The following boxes correspond to the form fields in your current checkout page. All you have to do is select from the drop-down menu box what each of the following fields represent. Sorry for any inconvenience caused, but we\'re sure you\'ll agree that the new purchase logs are worth this minor hassle.', 'wpsc' ); ?> </p>
11
 
12
  <div class="metabox-holder" style="width:700px">
13
  <form action='' method='post'>
@@ -38,7 +38,7 @@
38
 
39
  }
40
  ?>
41
- <input type='submit' value='<?php _e( 'Apply', 'wpsc' ); ?>' class='button-secondary action' />
42
  </form>
43
  </div>
44
  <?php endif; ?>
1
  <div class='wrap'>
2
 
3
+ <h2><?php esc_html_e( 'Sales Upgrade Fix', 'wp-e-commerce' ); ?> </h2>
4
 
5
  <?php if ( $numChanged != 0 && $numQueries != 0 ): ?>
6
  <div class="updated">
7
+ <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wp-e-commerce' ), esc_url( remove_query_arg( 'c' ) ) ); ?></p>
8
  </div>
9
  <?php else: ?>
10
+ <p><?php _e( 'Upgrading to WP eCommerce 3.7 and later requires you to run this fix once. The following boxes correspond to the form fields in your current checkout page. All you have to do is select from the drop-down menu box what each of the following fields represent. Sorry for any inconvenience caused, but we\'re sure you\'ll agree that the new purchase logs are worth this minor hassle.', 'wp-e-commerce' ); ?> </p>
11
 
12
  <div class="metabox-holder" style="width:700px">
13
  <form action='' method='post'>
38
 
39
  }
40
  ?>
41
+ <input type='submit' value='<?php _e( 'Apply', 'wp-e-commerce' ); ?>' class='button-secondary action' />
42
  </form>
43
  </div>
44
  <?php endif; ?>
wpsc-admin/includes/save-data.functions.php CHANGED
@@ -73,7 +73,7 @@ function wpsc_custom_category_columns( $columns ) {
73
 
74
  $custom_array = array(
75
  'cb' => '<input type="checkbox" />',
76
- 'image' => __( 'Image', 'wpsc' )
77
  );
78
 
79
  $columns = array_merge( $custom_array, $columns );
@@ -99,7 +99,7 @@ function wpsc_custom_category_column_data( $string, $column_name, $term_id ) {
99
 
100
  $format = '<img src="%s" title="%s" alt="%2$s" width="30" height="30" />';
101
  if ( ! empty( $image ) ) {
102
- $string = sprintf( $format, WPSC_CORE_IMAGES_URL . $image, esc_attr( $term->name ) );
103
  } else {
104
  $string = sprintf( $format, $noimage, esc_attr( $term->name ) );
105
  }
@@ -155,29 +155,29 @@ function wpsc_admin_category_forms_add() {
155
  $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
156
  ?>
157
 
158
- <h3><?php esc_html_e('Advanced Store Settings', 'wpsc'); ?></h3>
159
- <h4><?php esc_html_e('Presentation Settings', 'wpsc'); ?></h4>
160
- <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wpsc' ); ?></p>
161
  <div style="margin: 15px 0 15px 0">
162
- <label for='image'><?php esc_html_e( 'Category Image' , 'wpsc' ); ?></label>
163
  <input type='file' name='image' value='' />
164
  </div>
165
  <div class="form-field">
166
- <label for='display_type'><?php esc_html_e( 'Product Display', 'wpsc' ); ?></label>
167
  <select name='display_type'>
168
- <option value='default'<?php checked( $display_type, 'default' ); ?>><?php esc_html_e('Default View', 'wpsc'); ?></option>
169
- <option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php checked( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wpsc'); ?></option>
170
- <option value='grid'<?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php checked( $display_type, 'grid' ); ?>><?php esc_html_e('Grid View', 'wpsc'); ?></option>
171
  </select>
172
  </div>
173
  <?php if ( function_exists( "getimagesize" ) ) : ?>
174
  <div class="form-field">
175
- <?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?>
176
  <fieldset class="wpsc-width-height-fields">
177
- <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?></span></legend>
178
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
179
  <input name="image_width" type="number" step="1" min="0" id="image_width" value="<?php if ( isset( $category['image_width'] ) ) echo esc_attr( $category['image_width'] ); ?>" class="small-text" style="width: 70px">
180
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
181
  <input name="image_height" type="number" step="1" min="0" id="image_height" value="<?php if ( isset( $category['image_height'] ) ) echo esc_attr( $category['image_height'] ); ?>" class="small-text" style="width: 70px">
182
  </fieldset>
183
  </div>
@@ -195,40 +195,40 @@ function wpsc_admin_category_forms_add() {
195
  $countrylist = WPSC_Countries::get_countries_array( true, true );
196
  $selectedCountries = wpsc_get_meta( $category_id, 'target_market', 'wpsc_category' );
197
  ?>
198
- <h4><?php esc_html_e( 'Restrict to Target Markets', 'wpsc' )?></h4>
199
  <div class='form-field'>
200
  <?php if ( wpsc_is_suhosin_enabled() ) : ?>
201
- <em><?php esc_html_e( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature then disable the suhosin extension, if you can not do this, you will need to contact your hosting provider.", 'wpsc' ); ?></em>
202
  <?php else: ?>
203
  <div class='multiple-select-container'>
204
- <span><?php esc_html_e( 'Select', 'wpsc' ); ?> <a href='' class='wpsc_select_all'><?php esc_html_e( 'All', 'wpsc' ); ?></a>&nbsp; <a href='' class='wpsc_select_none'><?php esc_html_e( 'None', 'wpsc' ); ?></a></span><br />
205
  <div id='resizeable' class='ui-widget-content multiple-select'>
206
  <?php foreach( $countrylist as $country ): ?>
207
  <?php if ( in_array( $country['id'], (array)$selectedCountries ) ): ?>
208
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
209
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
210
  <?php else: ?>
211
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
212
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
213
  <?php endif; ?>
214
  <?php endforeach; ?>
215
  </div>
216
  </div>
217
- <span class='wpscsmall description'><?php esc_html_e( 'Select the markets you are selling this category to.', 'wpsc' ); ?><span>
218
  <?php endif; ?>
219
  </div>
220
 
221
  <!-- Checkout settings -->
222
- <h4><?php esc_html_e( 'Checkout Settings', 'wpsc' ); ?></h4>
223
 
224
  <?php
225
  if ( ! isset( $category['term_id'] ) ) $category['term_id'] = '';
226
  $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
227
  ?>
228
  <div class='form-field'>
229
- <label for="use_additional_form_set"><?php esc_html_e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
230
  <select name='use_additional_form_set'>
231
- <option value=''><?php esc_html_e( 'None', 'wpsc' ); ?></option>
232
  <?php
233
  $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
234
  unset( $checkout_sets[0] );
@@ -247,10 +247,10 @@ function wpsc_admin_category_forms_add() {
247
 
248
  <?php $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' ); ?>
249
  <div>
250
- <label><?php esc_html_e( 'Address to calculate shipping with', 'wpsc' ); ?></label>
251
- <label><input type="radio" value="0" name="uses_billing_address" <?php checked( $uses_billing_address, 0 ); ?> /> <?php esc_html_e( 'Shipping Address (default)', 'wpsc' ); ?></label>
252
- <label><input type="radio" value="1" name="uses_billing_address" <?php checked( $uses_billing_address, 1 ); ?> /> <?php esc_html_e( 'Billing Address', 'wpsc' ); ?></label>
253
- <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wpsc' ); ?></p>
254
  </div>
255
 
256
  <table class="category_forms">
@@ -298,31 +298,31 @@ function wpsc_admin_category_forms_edit() {
298
 
299
  <tr>
300
  <td colspan="2">
301
- <h3><?php esc_html_e( 'Advanced Store Settings', 'wpsc' ); ?></h3>
302
- <h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h4>
303
- <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wpsc' ); ?></p>
304
  </td>
305
  </tr>
306
 
307
 
308
  <tr class="form-field">
309
  <th scope="row" valign="top">
310
- <label for="display_type"><?php esc_html_e( 'Catalog View', 'wpsc' ); ?></label>
311
  </th>
312
  <td>
313
  <?php
314
  $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
315
  ?>
316
  <select name='display_type'>
317
- <option value='default'<?php selected( $display_type, 'default' ); ?>><?php esc_html_e( 'Default View', 'wpsc' ); ?></option>
318
- <option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php selected( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wpsc'); ?></option>
319
- <option value='grid' <?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php selected( $display_type, 'grid' ); ?>><?php esc_html_e( 'Grid View', 'wpsc' ); ?></option>
320
  </select><br />
321
  </td>
322
  </tr>
323
  <tr class="form-field">
324
  <th scope="row" valign="top">
325
- <label for="image"><?php esc_html_e( 'Category Image', 'wpsc' ); ?></label>
326
  </th>
327
  <td>
328
  <?php
@@ -331,21 +331,21 @@ function wpsc_admin_category_forms_edit() {
331
  echo '<p><img src=' . esc_url( $category_image ) . ' alt="' . esc_attr( $category['name'] ) . '" title="' . esc_attr( $category['name'] ) . '" class="wpsc_category_image" /></p>';
332
  ?>
333
  <input type='file' name='image' value='' /><br />
334
- <label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php esc_html_e( 'Delete Image', 'wpsc' ); ?></label><br/>
335
- <span class="description"><?php esc_html_e( 'You can set an image for the category here. If one exists, check the box to delete.', 'wpsc' ); ?></span>
336
  </td>
337
  </tr>
338
  <?php if ( function_exists( "getimagesize" ) ) : ?>
339
  <tr class="form-field">
340
  <th scope="row" valign="top">
341
- <label for="image"><?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?></label>
342
  </th>
343
  <td>
344
  <fieldset class="wpsc-width-height-fields">
345
- <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?></span></legend>
346
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
347
  <input name="image_width" type="number" step="1" min="0" id="image_width" value="<?php if ( isset( $category['image_width'] ) ) echo esc_attr( $category['image_width'] ); ?>" class="small-text">
348
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
349
  <input name="image_height" type="number" step="1" min="0" id="image_height" value="<?php if ( isset( $category['image_height'] ) ) echo esc_attr( $category['image_height'] ); ?>" class="small-text">
350
  </fieldset>
351
  </td>
@@ -354,25 +354,25 @@ function wpsc_admin_category_forms_edit() {
354
 
355
 
356
  <tr>
357
- <td colspan="2"><h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h4></td>
358
  </tr>
359
 
360
  <tr class="form-field">
361
  <th scope="row" valign="top">
362
- <label for="image"><?php esc_html_e( 'Display Category Shortcode', 'wpsc' ); ?></label>
363
  </th>
364
  <td>
365
  <code>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</code><br />
366
- <span class="description"><?php esc_html_e( 'Shortcodes are used to display a particular category or group within any WordPress page or post.', 'wpsc' ); ?></span>
367
  </td>
368
  </tr>
369
  <tr class="form-field">
370
  <th scope="row" valign="top">
371
- <label for="image"><?php esc_html_e( 'Display Category Template Tag', 'wpsc' ); ?></label>
372
  </th>
373
  <td>
374
  <code>&lt;?php echo wpsc_display_products_page( array( 'category_url_name' => '<?php echo $category["slug"]; ?>' ) ); ?&gt;</code><br />
375
- <span class="description"><?php esc_html_e( 'Template tags are used to display a particular category or group within your theme / template.', 'wpsc' ); ?></span>
376
  </td>
377
  </tr>
378
 
@@ -380,7 +380,7 @@ function wpsc_admin_category_forms_edit() {
380
 
381
  <tr>
382
  <td colspan="2">
383
- <h4><?php esc_html_e( 'Target Market Restrictions', 'wpsc' ); ?></h4>
384
  </td>
385
  </tr>
386
  <?php
@@ -389,30 +389,30 @@ function wpsc_admin_category_forms_edit() {
389
  ?>
390
  <tr>
391
  <th scope="row" valign="top">
392
- <label for="image"><?php esc_html_e( 'Target Markets', 'wpsc' ); ?></label>
393
  </th>
394
  <td>
395
  <?php if ( wpsc_is_suhosin_enabled() ) : ?>
396
- <em><?php esc_html_e( 'The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.','wpsc' ); ?></em>
397
  <?php else : ?>
398
- <span><?php esc_html_e( 'Select', 'wpsc' ); ?>: <a href='' class='wpsc_select_all'><?php esc_html_e( 'All', 'wpsc' ); ?></a>&nbsp; <a href='' class='wpsc_select_none'><?php esc_html_e( 'None', 'wpsc' ); ?></a></span><br />
399
  <div id='resizeable' class='ui-widget-content multiple-select'>
400
  <?php foreach( $countrylist as $country ) {
401
  if ( in_array( $country['id'], (array)$selectedCountries ) ) {
402
  ?>
403
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
404
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
405
  <?php
406
  } else {
407
  ?>
408
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
409
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
410
  <?php
411
  }
412
  } ?>
413
  </div>
414
  <?php endif; ?><br />
415
- <span class="description"><?php esc_html_e( 'Select the markets you are selling this category to.', 'wpsc' ); ?></span>
416
  </td>
417
  </tr>
418
 
@@ -420,7 +420,7 @@ function wpsc_admin_category_forms_edit() {
420
 
421
  <tr>
422
  <td colspan="2">
423
- <h4><?php esc_html_e( 'Checkout Settings', 'wpsc' ); ?></h4>
424
  </td>
425
  </tr>
426
  <?php
@@ -434,11 +434,11 @@ function wpsc_admin_category_forms_edit() {
434
  ?>
435
  <tr class="form-field">
436
  <th scope="row" valign="top">
437
- <label for="image"><?php esc_html_e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
438
  </th>
439
  <td>
440
  <select name='use_additional_form_set'>
441
- <option value=''><?php esc_html_e( 'None', 'wpsc' ); ?></option>
442
  <?php
443
  foreach( (array) $checkout_sets as $key => $value ) {
444
  $selected_state = "";
@@ -455,12 +455,12 @@ function wpsc_admin_category_forms_edit() {
455
 
456
  <tr class="form-field">
457
  <th scope="row" valign="top">
458
- <label><?php esc_html_e( 'Address to calculate shipping with', 'wpsc' ); ?></label>
459
  </th>
460
  <td>
461
- <label><input type="radio" class="wpsc_cat_box" value="0" name="uses_billing_address" <?php echo ( ( $uses_billing_address != true ) ? 'checked="checked"' : '' ); ?> /> <?php esc_html_e( 'Shipping Address (default)', 'wpsc' ); ?></label><br />
462
- <label><input type="radio" class="wpsc_cat_box" value="1" name="uses_billing_address" <?php echo ( ( $uses_billing_address == true ) ? 'checked="checked"' : '' ); ?> /> <?php esc_html_e( 'Billing Address', 'wpsc' ); ?></label>
463
- <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wpsc' ); ?></p>
464
  </td>
465
  </tr>
466
 
73
 
74
  $custom_array = array(
75
  'cb' => '<input type="checkbox" />',
76
+ 'image' => __( 'Image', 'wp-e-commerce' )
77
  );
78
 
79
  $columns = array_merge( $custom_array, $columns );
99
 
100
  $format = '<img src="%s" title="%s" alt="%2$s" width="30" height="30" />';
101
  if ( ! empty( $image ) ) {
102
+ $string = sprintf( $format, WPSC_CATEGORY_URL . $image, esc_attr( $term->name ) );
103
  } else {
104
  $string = sprintf( $format, $noimage, esc_attr( $term->name ) );
105
  }
155
  $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
156
  ?>
157
 
158
+ <h3><?php esc_html_e('Advanced Store Settings', 'wp-e-commerce'); ?></h3>
159
+ <h4><?php esc_html_e('Presentation Settings', 'wp-e-commerce'); ?></h4>
160
+ <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wp-e-commerce' ); ?></p>
161
  <div style="margin: 15px 0 15px 0">
162
+ <label for='image'><?php esc_html_e( 'Category Image' , 'wp-e-commerce' ); ?></label>
163
  <input type='file' name='image' value='' />
164
  </div>
165
  <div class="form-field">
166
+ <label for='display_type'><?php esc_html_e( 'Product Display', 'wp-e-commerce' ); ?></label>
167
  <select name='display_type'>
168
+ <option value='default'<?php checked( $display_type, 'default' ); ?>><?php esc_html_e('Default View', 'wp-e-commerce'); ?></option>
169
+ <option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php checked( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wp-e-commerce'); ?></option>
170
+ <option value='grid'<?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php checked( $display_type, 'grid' ); ?>><?php esc_html_e('Grid View', 'wp-e-commerce'); ?></option>
171
  </select>
172
  </div>
173
  <?php if ( function_exists( "getimagesize" ) ) : ?>
174
  <div class="form-field">
175
+ <?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?>
176
  <fieldset class="wpsc-width-height-fields">
177
+ <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?></span></legend>
178
+ <label for="image_width"><?php esc_html_e( 'Width', 'wp-e-commerce' ); ?></label>
179
  <input name="image_width" type="number" step="1" min="0" id="image_width" value="<?php if ( isset( $category['image_width'] ) ) echo esc_attr( $category['image_width'] ); ?>" class="small-text" style="width: 70px">
180
+ <label for="large_size_h"><?php esc_html_e( 'Height', 'wp-e-commerce' ); ?></label>
181
  <input name="image_height" type="number" step="1" min="0" id="image_height" value="<?php if ( isset( $category['image_height'] ) ) echo esc_attr( $category['image_height'] ); ?>" class="small-text" style="width: 70px">
182
  </fieldset>
183
  </div>
195
  $countrylist = WPSC_Countries::get_countries_array( true, true );
196
  $selectedCountries = wpsc_get_meta( $category_id, 'target_market', 'wpsc_category' );
197
  ?>
198
+ <h4><?php esc_html_e( 'Restrict to Target Markets', 'wp-e-commerce' )?></h4>
199
  <div class='form-field'>
200
  <?php if ( wpsc_is_suhosin_enabled() ) : ?>
201
+ <em><?php esc_html_e( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.", 'wp-e-commerce' ); ?></em>
202
  <?php else: ?>
203
  <div class='multiple-select-container'>
204
+ <span><?php esc_html_e( 'Select', 'wp-e-commerce' ); ?> <a href='' class='wpsc_select_all'><?php esc_html_e( 'All', 'wp-e-commerce' ); ?></a>&nbsp; <a href='' class='wpsc_select_none'><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></a></span><br />
205
  <div id='resizeable' class='ui-widget-content multiple-select'>
206
  <?php foreach( $countrylist as $country ): ?>
207
  <?php if ( in_array( $country['id'], (array)$selectedCountries ) ): ?>
208
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
209
+ <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
210
  <?php else: ?>
211
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
212
+ <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
213
  <?php endif; ?>
214
  <?php endforeach; ?>
215
  </div>
216
  </div>
217
+ <span class='wpscsmall description'><?php esc_html_e( 'Select the markets you are selling this category to.', 'wp-e-commerce' ); ?><span>
218
  <?php endif; ?>
219
  </div>
220
 
221
  <!-- Checkout settings -->
222
+ <h4><?php esc_html_e( 'Checkout Settings', 'wp-e-commerce' ); ?></h4>
223
 
224
  <?php
225
  if ( ! isset( $category['term_id'] ) ) $category['term_id'] = '';
226
  $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
227
  ?>
228
  <div class='form-field'>
229
+ <label for="use_additional_form_set"><?php esc_html_e( 'Category requires additional checkout form fields', 'wp-e-commerce' ); ?></label>
230
  <select name='use_additional_form_set'>
231
+ <option value=''><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></option>
232
  <?php
233
  $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
234
  unset( $checkout_sets[0] );
247
 
248
  <?php $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' ); ?>
249
  <div>
250
+ <label><?php esc_html_e( 'Address to calculate shipping with', 'wp-e-commerce' ); ?></label>
251
+ <label><input type="radio" value="0" name="uses_billing_address" <?php checked( $uses_billing_address, 0 ); ?> /> <?php esc_html_e( 'Shipping Address (default)', 'wp-e-commerce' ); ?></label>
252
+ <label><input type="radio" value="1" name="uses_billing_address" <?php checked( $uses_billing_address, 1 ); ?> /> <?php esc_html_e( 'Billing Address', 'wp-e-commerce' ); ?></label>
253
+ <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wp-e-commerce' ); ?></p>
254
  </div>
255
 
256
  <table class="category_forms">
298
 
299
  <tr>
300
  <td colspan="2">
301
+ <h3><?php esc_html_e( 'Advanced Store Settings', 'wp-e-commerce' ); ?></h3>
302
+ <h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wp-e-commerce' ); ?></h4>
303
+ <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wp-e-commerce' ); ?></p>
304
  </td>
305
  </tr>
306
 
307
 
308
  <tr class="form-field">
309
  <th scope="row" valign="top">
310
+ <label for="display_type"><?php esc_html_e( 'Catalog View', 'wp-e-commerce' ); ?></label>
311
  </th>
312
  <td>
313
  <?php
314
  $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
315
  ?>
316
  <select name='display_type'>
317
+ <option value='default'<?php selected( $display_type, 'default' ); ?>><?php esc_html_e( 'Default View', 'wp-e-commerce' ); ?></option>
318
+ <option value='list'<?php disabled( _wpsc_is_display_type_supported( 'list' ), false ); ?><?php selected( $display_type, 'list' ); ?>><?php esc_html_e('List View', 'wp-e-commerce'); ?></option>
319
+ <option value='grid' <?php disabled( _wpsc_is_display_type_supported( 'grid' ), false ); ?><?php selected( $display_type, 'grid' ); ?>><?php esc_html_e( 'Grid View', 'wp-e-commerce' ); ?></option>
320
  </select><br />
321
  </td>
322
  </tr>
323
  <tr class="form-field">
324
  <th scope="row" valign="top">
325
+ <label for="image"><?php esc_html_e( 'Category Image', 'wp-e-commerce' ); ?></label>
326
  </th>
327
  <td>
328
  <?php
331
  echo '<p><img src=' . esc_url( $category_image ) . ' alt="' . esc_attr( $category['name'] ) . '" title="' . esc_attr( $category['name'] ) . '" class="wpsc_category_image" /></p>';
332
  ?>
333
  <input type='file' name='image' value='' /><br />
334
+ <label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php esc_html_e( 'Delete Image', 'wp-e-commerce' ); ?></label><br/>
335
+ <span class="description"><?php esc_html_e( 'You can set an image for the category here. If one exists, check the box to delete.', 'wp-e-commerce' ); ?></span>
336
  </td>
337
  </tr>
338
  <?php if ( function_exists( "getimagesize" ) ) : ?>
339
  <tr class="form-field">
340
  <th scope="row" valign="top">
341
+ <label for="image"><?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?></label>
342
  </th>
343
  <td>
344
  <fieldset class="wpsc-width-height-fields">
345
+ <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wp-e-commerce' ); ?></span></legend>
346
+ <label for="image_width"><?php esc_html_e( 'Width', 'wp-e-commerce' ); ?></label>
347
  <input name="image_width" type="number" step="1" min="0" id="image_width" value="<?php if ( isset( $category['image_width'] ) ) echo esc_attr( $category['image_width'] ); ?>" class="small-text">
348
+ <label for="large_size_h"><?php esc_html_e( 'Height', 'wp-e-commerce' ); ?></label>
349
  <input name="image_height" type="number" step="1" min="0" id="image_height" value="<?php if ( isset( $category['image_height'] ) ) echo esc_attr( $category['image_height'] ); ?>" class="small-text">
350
  </fieldset>
351
  </td>
354
 
355
 
356
  <tr>
357
+ <td colspan="2"><h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wp-e-commerce' ); ?></h4></td>
358
  </tr>
359
 
360
  <tr class="form-field">
361
  <th scope="row" valign="top">
362
+ <label for="image"><?php esc_html_e( 'Display Category Shortcode', 'wp-e-commerce' ); ?></label>
363
  </th>
364
  <td>
365
  <code>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</code><br />
366
+ <span class="description"><?php esc_html_e( 'Shortcodes are used to display a particular category or group within any WordPress page or post.', 'wp-e-commerce' ); ?></span>
367
  </td>
368
  </tr>
369
  <tr class="form-field">
370
  <th scope="row" valign="top">
371
+ <label for="image"><?php esc_html_e( 'Display Category Template Tag', 'wp-e-commerce' ); ?></label>
372
  </th>
373
  <td>
374
  <code>&lt;?php echo wpsc_display_products_page( array( 'category_url_name' => '<?php echo $category["slug"]; ?>' ) ); ?&gt;</code><br />
375
+ <span class="description"><?php esc_html_e( 'Template tags are used to display a particular category or group within your theme / template.', 'wp-e-commerce' ); ?></span>
376
  </td>
377
  </tr>
378
 
380
 
381
  <tr>
382
  <td colspan="2">
383
+ <h4><?php esc_html_e( 'Target Market Restrictions', 'wp-e-commerce' ); ?></h4>
384
  </td>
385
  </tr>
386
  <?php
389
  ?>
390
  <tr>
391
  <th scope="row" valign="top">
392
+ <label for="image"><?php esc_html_e( 'Target Markets', 'wp-e-commerce' ); ?></label>
393
  </th>
394
  <td>
395
  <?php if ( wpsc_is_suhosin_enabled() ) : ?>
396
+ <em><?php esc_html_e( 'The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.','wp-e-commerce' ); ?></em>
397
  <?php else : ?>
398
+ <span><?php esc_html_e( 'Select', 'wp-e-commerce' ); ?>: <a href='' class='wpsc_select_all'><?php esc_html_e( 'All', 'wp-e-commerce' ); ?></a>&nbsp; <a href='' class='wpsc_select_none'><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></a></span><br />
399
  <div id='resizeable' class='ui-widget-content multiple-select'>
400
  <?php foreach( $countrylist as $country ) {
401
  if ( in_array( $country['id'], (array)$selectedCountries ) ) {
402
  ?>
403
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
404
+ <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
405
  <?php
406
  } else {
407
  ?>
408
  <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
409
+ <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
410
  <?php
411
  }
412
  } ?>
413
  </div>
414
  <?php endif; ?><br />
415
+ <span class="description"><?php esc_html_e( 'Select the markets you are selling this category to.', 'wp-e-commerce' ); ?></span>
416
  </td>
417
  </tr>
418
 
420
 
421
  <tr>
422
  <td colspan="2">
423
+ <h4><?php esc_html_e( 'Checkout Settings', 'wp-e-commerce' ); ?></h4>
424
  </td>
425
  </tr>
426
  <?php
434
  ?>
435
  <tr class="form-field">
436
  <th scope="row" valign="top">
437
+ <label for="image"><?php esc_html_e( 'Category requires additional checkout form fields', 'wp-e-commerce' ); ?></label>
438
  </th>
439
  <td>
440
  <select name='use_additional_form_set'>
441
+ <option value=''><?php esc_html_e( 'None', 'wp-e-commerce' ); ?></option>
442
  <?php
443
  foreach( (array) $checkout_sets as $key => $value ) {
444
  $selected_state = "";
455
 
456
  <tr class="form-field">
457
  <th scope="row" valign="top">
458
+ <label><?php esc_html_e( 'Address to calculate shipping with', 'wp-e-commerce' ); ?></label>
459
  </th>
460
  <td>
461
+ <label><input type="radio" class="wpsc_cat_box" value="0" name="uses_billing_address" <?php echo ( ( $uses_billing_address != true ) ? 'checked="checked"' : '' ); ?> /> <?php esc_html_e( 'Shipping Address (default)', 'wp-e-commerce' ); ?></label><br />
462
+ <label><input type="radio" class="wpsc_cat_box" value="1" name="uses_billing_address" <?php echo ( ( $uses_billing_address == true ) ? 'checked="checked"' : '' ); ?> /> <?php esc_html_e( 'Billing Address', 'wp-e-commerce' ); ?></label>
463
+ <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wp-e-commerce' ); ?></p>
464
  </td>
465
  </tr>
466
 
wpsc-admin/includes/settings-tabs/admin.php CHANGED
@@ -2,17 +2,17 @@
2
 
3
  /**
4
  * The Admin Settings Tab class
5
- *
6
  * @package wp-e-commerce
7
- */
8
 
9
  class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
10
  public function display() {
11
  ?>
12
- <h3><?php esc_html_e( 'Admin Settings', 'wpsc' ); ?></h3>
13
  <table class='wpsc_options form-table'>
14
  <tr>
15
- <th scope="row"><?php esc_html_e( 'Max downloads per file', 'wpsc' ); ?>: </th>
16
  <td>
17
  <input type="number" min="0" size="10" value="<?php echo esc_attr( get_option('max_downloads') ); ?>" name="wpsc_options[max_downloads]" />
18
  </td>
@@ -34,11 +34,11 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
34
  ?>
35
  <tr>
36
  <th scope="row">
37
- <?php esc_html_e( 'Lock downloads to IP address', 'wpsc' ); ?>:
38
  </th>
39
  <td>
40
- <input type='radio' value='1' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads2' <?php echo $wpsc_ip_lock_downloads1; ?> /> <label for='wpsc_ip_lock_downloads2'><?php _e('Yes', 'wpsc');?></label>&nbsp;
41
- <input type='radio' value='0' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads1' <?php echo $wpsc_ip_lock_downloads2; ?> /> <label for='wpsc_ip_lock_downloads1'><?php _e('No', 'wpsc');?></label><br />
42
  </td>
43
  </tr>
44
 
@@ -60,14 +60,14 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
60
  ?>
61
  <tr>
62
  <th scope="row">
63
- <?php esc_html_e( 'Check MIME types on file uploads', 'wpsc' ); ?>:
64
  </th>
65
  <td>
66
- <input type='radio' value='0' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types2' <?php echo $wpsc_check_mime_types1; ?> /> <label for='wpsc_check_mime_types2'><?php _e('Yes', 'wpsc');?></label>&nbsp;
67
- <input type='radio' value='1' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types1' <?php echo $wpsc_check_mime_types2; ?> /> <label for='wpsc_check_mime_types1'><?php _e('No', 'wpsc');?></label><br />
68
 
69
  <span class="wpscsmall description">
70
- <?php esc_html_e( 'Warning: Disabling this exposes your site to greater possibility of malicious files being uploaded, we recommend installing the Fileinfo extension for PHP rather than disabling this.', 'wpsc' ); ?>
71
  </span>
72
  </td>
73
  </tr>
@@ -75,17 +75,17 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
75
 
76
  <tr>
77
  <th scope="row">
78
- <?php esc_html_e( 'Store Admin Email', 'wpsc' );?>:
79
  </th>
80
  <td>
81
  <input class='text' name='wpsc_options[purch_log_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'purch_log_email' ) ); ?>' />
82
- <p class="howto"><?php esc_html_e( 'Admin notifications will be sent here.' ); ?></p>
83
  </td>
84
  </tr>
85
 
86
  <tr>
87
  <th scope="row">
88
- <?php esc_html_e( 'Terms and Conditions', 'wpsc' );?>:
89
  </th>
90
  <td>
91
  <textarea name='wpsc_options[terms_and_conditions]' cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'terms_and_conditions' ) ); ?></textarea>
@@ -93,23 +93,23 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
93
  </tr>
94
 
95
  </table>
96
- <h3 class="form_group"><?php esc_html_e( 'Customer Purchase Receipt', 'wpsc' );?>:</h3>
97
  <table class='wpsc_options form-table'>
98
  <tr>
99
- <th colspan="2"><?php esc_html_e( 'Tags can be used', 'wpsc' );?>: <?php echo esc_html( '%purchase_id%, %shop_name%, %product_list%, %total_price%, %total_shipping%, %find_us%, %total_tax%' ); ?></th>
100
  </tr>
101
  <tr>
102
  <td class='wpsc_td_note' colspan='2'>
103
  <span class="wpscsmall description">
104
- <?php esc_html_e( 'Note: The purchase receipt is the message e-mailed to users after purchasing products from your shop.' , 'wpsc' ); ?>
105
  <br />
106
- <?php esc_html_e( 'Note: You need to have the %product_list% in your purchase receipt in order for digital download links to be emailed to your buyers.' , 'wpsc' ); ?>
107
  </span>
108
  </td>
109
  </tr>
110
  <tr>
111
  <th scope="row">
112
- <?php echo esc_html_x( 'From Address', 'purchase receipt', 'wpsc' );?>:
113
  </th>
114
  <td>
115
  <input class='text' name='wpsc_options[return_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_email' ) ); ?>' />
@@ -118,33 +118,33 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
118
 
119
  <tr>
120
  <th scope="row">
121
- <?php esc_html_e( 'Sender Name', 'wpsc' );?>:
122
  </th>
123
  <td>
124
  <input class='text' name='wpsc_options[return_name]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_name' ) ); ?>' />
125
  </td>
126
  </tr>
127
  <tr>
128
- <th><?php esc_html_e( 'Message Body', 'wpsc' ); ?></th>
129
  <td><textarea name="wpsc_options[wpsc_email_receipt]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_email_receipt' ) );?></textarea></td>
130
  </tr>
131
  </table>
132
 
133
- <h3 class="form_group"><?php esc_html_e( 'Track and Trace settings', 'wpsc' ); ?>:</h3>
134
  <table class='wpsc_options form-table'>
135
  <tr>
136
  <td class='wpsc_td_note' colspan='2'>
137
  <span class="wpscsmall description">
138
- <?php esc_html_e( 'Note: The Tracking Subject, is the subject for The Tracking Message email. The Tracking Message is the message e-mailed to users when you click \'Email buyer\' on the sales log. This option is only available for purchases with the status of \'Job Dispatched\'. Tags you can use in the email message section are %trackid% and %shop_name%' , 'wpsc' ); ?>
139
  </span>
140
  </td>
141
  </tr>
142
  <tr>
143
- <th><strong><?php esc_html_e( 'Tracking Email Subject', 'wpsc' );?></strong></th>
144
  <td><input name="wpsc_options[wpsc_trackingid_subject]" type='text' value='<?php echo esc_attr( get_option( 'wpsc_trackingid_subject' ) );?>' /></td>
145
  </tr>
146
  <tr>
147
- <th><strong><?php esc_html_e( 'Tracking Email Message', 'wpsc' );?></strong></th>
148
  <td><textarea name="wpsc_options[wpsc_trackingid_message]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_trackingid_message' ) );?></textarea></td>
149
  </tr>
150
  </table>
2
 
3
  /**
4
  * The Admin Settings Tab class
5
+ *
6
  * @package wp-e-commerce
7
+ */
8
 
9
  class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
10
  public function display() {
11
  ?>
12
+ <h3><?php esc_html_e( 'Admin Settings', 'wp-e-commerce' ); ?></h3>
13
  <table class='wpsc_options form-table'>
14
  <tr>
15
+ <th scope="row"><?php esc_html_e( 'Max downloads per file', 'wp-e-commerce' ); ?>: </th>
16
  <td>
17
  <input type="number" min="0" size="10" value="<?php echo esc_attr( get_option('max_downloads') ); ?>" name="wpsc_options[max_downloads]" />
18
  </td>
34
  ?>
35
  <tr>
36
  <th scope="row">
37
+ <?php esc_html_e( 'Lock downloads to IP address', 'wp-e-commerce' ); ?>:
38
  </th>
39
  <td>
40
+ <input type='radio' value='1' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads2' <?php echo $wpsc_ip_lock_downloads1; ?> /> <label for='wpsc_ip_lock_downloads2'><?php _e('Yes', 'wp-e-commerce');?></label>&nbsp;
41
+ <input type='radio' value='0' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads1' <?php echo $wpsc_ip_lock_downloads2; ?> /> <label for='wpsc_ip_lock_downloads1'><?php _e('No', 'wp-e-commerce');?></label><br />
42
  </td>
43
  </tr>
44
 
60
  ?>
61
  <tr>
62
  <th scope="row">
63
+ <?php esc_html_e( 'Check MIME types on file uploads', 'wp-e-commerce' ); ?>:
64
  </th>
65
  <td>
66
+ <input type='radio' value='0' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types2' <?php echo $wpsc_check_mime_types1; ?> /> <label for='wpsc_check_mime_types2'><?php _e('Yes', 'wp-e-commerce');?></label>&nbsp;
67
+ <input type='radio' value='1' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types1' <?php echo $wpsc_check_mime_types2; ?> /> <label for='wpsc_check_mime_types1'><?php _e('No', 'wp-e-commerce');?></label><br />
68
 
69
  <span class="wpscsmall description">
70
+ <?php esc_html_e( 'Warning: Disabling this exposes your site to greater possibility of malicious files being uploaded, we recommend installing the Fileinfo extension for PHP rather than disabling this.', 'wp-e-commerce' ); ?>
71
  </span>
72
  </td>
73
  </tr>
75
 
76
  <tr>
77
  <th scope="row">
78
+ <?php esc_html_e( 'Store Admin Email', 'wp-e-commerce' );?>:
79
  </th>
80
  <td>
81
  <input class='text' name='wpsc_options[purch_log_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'purch_log_email' ) ); ?>' />
82
+ <p class="howto"><?php esc_html_e( 'Admin notifications will be sent here.', 'wp-e-commerce' ); ?></p>
83
  </td>
84
  </tr>
85
 
86
  <tr>
87
  <th scope="row">
88
+ <?php esc_html_e( 'Terms and Conditions', 'wp-e-commerce' );?>:
89
  </th>
90
  <td>
91
  <textarea name='wpsc_options[terms_and_conditions]' cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'terms_and_conditions' ) ); ?></textarea>
93
  </tr>
94
 
95
  </table>
96
+ <h3 class="form_group"><?php esc_html_e( 'Customer Purchase Receipt', 'wp-e-commerce' );?>:</h3>
97
  <table class='wpsc_options form-table'>
98
  <tr>
99
+ <th colspan="2"><?php esc_html_e( 'Tags can be used', 'wp-e-commerce' );?>: <?php echo esc_html( '%purchase_id%, %shop_name%, %product_list%, %total_price%, %total_shipping%, %find_us%, %total_tax%' ); ?></th>
100
  </tr>
101
  <tr>
102
  <td class='wpsc_td_note' colspan='2'>
103
  <span class="wpscsmall description">
104
+ <?php esc_html_e( 'Note: The purchase receipt is the message e-mailed to users after purchasing products from your shop.' , 'wp-e-commerce' ); ?>
105
  <br />
106
+ <?php esc_html_e( 'Note: You need to have the %product_list% in your purchase receipt in order for digital download links to be emailed to your buyers.' , 'wp-e-commerce' ); ?>
107
  </span>
108
  </td>
109
  </tr>
110
  <tr>
111
  <th scope="row">
112
+ <?php echo esc_html_x( 'From Address', 'purchase receipt', 'wp-e-commerce' );?>:
113
  </th>
114
  <td>
115
  <input class='text' name='wpsc_options[return_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_email' ) ); ?>' />
118
 
119
  <tr>
120
  <th scope="row">
121
+ <?php esc_html_e( 'Sender Name', 'wp-e-commerce' );?>:
122
  </th>
123
  <td>
124
  <input class='text' name='wpsc_options[return_name]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_name' ) ); ?>' />
125
  </td>
126
  </tr>
127
  <tr>
128
+ <th><?php esc_html_e( 'Message Body', 'wp-e-commerce' ); ?></th>
129
  <td><textarea name="wpsc_options[wpsc_email_receipt]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_email_receipt' ) );?></textarea></td>
130
  </tr>
131
  </table>
132
 
133
+ <h3 class="form_group"><?php esc_html_e( 'Track and Trace settings', 'wp-e-commerce' ); ?>:</h3>
134
  <table class='wpsc_options form-table'>
135
  <tr>
136
  <td class='wpsc_td_note' colspan='2'>
137
  <span class="wpscsmall description">
138
+ <?php esc_html_e( 'Note: The Tracking Subject, is the subject for The Tracking Message email. The Tracking Message is the message e-mailed to users when you click \'Email buyer\' on the sales log. This option is only available for purchases with the status of \'Job Dispatched\'. Tags you can use in the email message section are %trackid% and %shop_name%' , 'wp-e-commerce' ); ?>
139
  </span>
140
  </td>
141
  </tr>
142
  <tr>
143
+ <th><strong><?php esc_html_e( 'Tracking Email Subject', 'wp-e-commerce' );?></strong></th>
144
  <td><input name="wpsc_options[wpsc_trackingid_subject]" type='text' value='<?php echo esc_attr( get_option( 'wpsc_trackingid_subject' ) );?>' /></td>
145
  </tr>
146
  <tr>
147
+ <th><strong><?php esc_html_e( 'Tracking Email Message', 'wp-e-commerce' );?></strong></th>
148
  <td><textarea name="wpsc_options[wpsc_trackingid_message]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_trackingid_message' ) );?></textarea></td>
149
  </tr>
150
  </table>
wpsc-admin/includes/settings-tabs/checkout.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
  class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
 
4
  private $require_register;
5
  private $shipping_same_as_billing;
6
  private $force_ssl;
@@ -8,6 +9,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
8
  private $current_checkout_set;
9
  private $field_types;
10
  private $user_field_types;
 
11
 
12
  public function __construct() {
13
  global $wpdb;
@@ -31,15 +33,16 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
31
  WHERE checkout_set = %s
32
  ORDER BY checkout_order
33
  ", $this->current_checkout_set );
 
34
  $this->form_fields = $wpdb->get_results( $form_sql );
35
 
36
  $columns = array(
37
- 'drag' => __( 'Drag', 'wpsc' ),
38
- 'name' => __( 'Title', 'wpsc' ),
39
- 'type' => __( 'Type', 'wpsc' ),
40
  'unique_name' => '&nbsp;',
41
- 'display' => __( 'Display', 'wpsc' ),
42
- 'mandatory' => __( 'Mandatory', 'wpsc' ),
43
  'actions' => '&nbsp;',
44
  );
45
  register_column_headers( 'display-checkout-list', $columns );
@@ -73,7 +76,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
73
  $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
74
  $checkout_sets[] = sanitize_text_field( $_POST['new_form_set'] );
75
  update_option( 'wpsc_checkout_form_sets', $checkout_sets );
76
- add_settings_error( 'wpsc-settings', 'wpsc_form_set_added', __( 'New form set successfully created.', 'wpsc' ), 'updated' );
77
  }
78
 
79
  if ( isset( $_POST['checkout_set'] ) ) {
@@ -210,42 +213,40 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
210
  * As a result, to determine whether a field is default or not, we have to rely on the field's
211
  * unique name and "active" status.
212
  *
213
- * @param {Object} $field Field object
214
- * @return {Boolean} True if the field is default.
215
  */
216
  private function is_field_default( $field ) {
217
  global $wpdb;
218
 
219
- if ( $field->default == 1 )
220
  return true;
 
221
 
222
- if ( empty( $field->unique_name) || $this->current_checkout_set !== 0 || empty( $field->active ) )
223
  return false;
 
224
 
225
  $default_fields = array(
226
- 'billingfirstname',
227
- 'billinglastname',
228
- 'billingaddress',
229
- 'billingcity',
230
- 'billingstate',
231
- 'billingcountry',
232
- 'billingpostcode',
233
- 'billingemail',
234
- 'billingphone',
235
- 'shippingfirstname',
236
- 'shippinglastname',
237
- 'shippingaddress',
238
- 'shippingcity',
239
- 'shippingstate',
240
- 'shippingcountry',
241
- 'shippingpostcode',
242
- 'shippingemail',
243
- );
244
-
245
- if ( in_array( $field->unique_name, $default_fields ) )
246
- return true;
247
-
248
- return false;
249
  }
250
 
251
  private function prototype_field( $mode = 'hidden' ) {
@@ -266,7 +267,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
266
  <tr id="<?php echo $row_id; ?>" class="<?php echo $row_class; ?>" <?php echo $data; ?> <?php echo $style; ?>>
267
  <td class="drag">
268
  <div class="cell-wrapper">
269
- <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
270
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
271
  </a>
272
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
@@ -289,7 +290,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
289
  </div>
290
  </td>
291
  <td class="uniquenamecol">
292
- <a class="edit-options" href="#"><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
293
  </td>
294
  <td class="displaycol">
295
  <div class="cell-wrapper">
@@ -303,8 +304,8 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
303
  </td>
304
  <td class="actionscol">
305
  <div class="cell-wrapper">
306
- <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wpsc' ); ?></a>
307
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wpsc' ); ?></a>
308
  </div>
309
  </td>
310
  </tr>
@@ -315,8 +316,8 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
315
  <h4></h4>
316
  <table class="wpsc-field-options-table">
317
  <thead>
318
- <th class="column-labels"><?php echo esc_html_x( 'Label', "checkout field's options", 'wpsc' ); ?></th>
319
- <th class="column-values"><?php echo esc_html_x( 'Value', "checkout field's options", 'wpsc' ); ?></th>
320
  <th class="column-actions">&nbsp;</th>
321
  </thead>
322
  <tbody>
@@ -333,8 +334,8 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
333
  </td>
334
  <td class="column-actions">
335
  <div class="field-option-cell-wrapper">
336
- <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wpsc' ); ?></a>
337
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wpsc' ); ?></a>
338
  </div>
339
  </td>
340
  </tr>
@@ -358,62 +359,62 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
358
  ?>
359
 
360
  <input type='hidden' name='checkout_submits' value='true' />
361
- <h3><?php esc_html_e( 'Checkout Settings' , 'wpsc' ); ?></h3>
362
  <table class='form-table'>
363
  <tr>
364
- <th scope="row"><?php esc_html_e('Force User Registration', 'wpsc'); ?></th>
365
  <td>
366
  <input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php checked( $this->require_register, 0 ); ?> />
367
- <label for='require_register2'><?php _e( 'Users can checkout without a user account', 'wpsc' );?></label><br />
368
  <input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php checked( $this->require_register, 1 ); ?> />
369
- <label for='require_register1'><?php _e( 'Users must register before checking out', 'wpsc' );?></label>
370
- <p class='description'><?php esc_attr_e( 'Enabling this will also turn on "Membership: Anyone can register" from within WordPress Settings > General if it\'s not already enabled', 'wpsc' ); ?></p>
371
  </td>
372
  </tr>
373
 
374
  <tr>
375
- <th scope="row"><?php esc_html_e('Shipping Same as Billing', 'wpsc' ); ?></th>
376
  <td>
377
  <input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php checked( $this->shipping_same_as_billing, 1 ); ?> />
378
- <label for='shippingsameasbilling1'><?php _e( 'Enable "Same as billing address" checkbox with Shipping Address fields', 'wpsc' );?></label><br />
379
  <input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php checked( $this->shipping_same_as_billing, 0 ); ?> />
380
- <label for='shippingsameasbilling2'><?php _e( 'Users must re-enter Shipping Address', 'wpsc' );?></label>
381
  </td>
382
  </tr>
383
  <tr>
384
- <th scope="row"><?php _e('Security and Encryption', 'wpsc'); ?></th>
385
  <td>
386
  <input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php checked( $this->force_ssl, 1 ); ?> />
387
- <label for='wpsc_force_ssl1'><?php _e( 'Force users to use SSL Encryption', 'wpsc' );?></label><br />
388
  <input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php checked( $this->force_ssl, 0 ); ?> />
389
- <label for='wpsc_force_ssl2'><?php _e( 'Allow site to be used insecurely and unencrypted', 'wpsc' );?></label>
390
- <p class='description'><?php esc_html_e( 'This can cause warnings for your users if you do not have a properly configured SSL certificate', 'wpsc' );?></p>
391
  </td>
392
  </tr>
393
  </table>
394
 
395
 
396
- <h3><?php esc_html_e( 'Checkout Form Fields', 'wpsc' ); ?></h3>
397
- <p><?php esc_html_e( 'Here you can customise the forms to be displayed in your checkout page. The checkout page is where you collect important user information that will show up in your purchase logs i.e. the buyer\'s address, and name...', 'wpsc' );?></p>
398
 
399
  <p>
400
- <label for='wpsc_form_set'><?php esc_html_e( 'Select a Form Set' , 'wpsc' ); ?>:</label>
401
  <select id='wpsc_form_set' name='checkout_set'>
402
  <?php foreach ( $this->checkout_sets as $key => $value ): ?>
403
  <option <?php selected( $this->current_checkout_set, $key ); ?> value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
404
  <?php endforeach; ?>
405
  </select>
406
 
407
- <input type='submit' value='<?php esc_attr_e( 'Filter', 'wpsc' ); ?>' name='wpsc_checkout_set_filter' class='button-secondary' />
408
- <input <?php if (! $this->current_checkout_set) echo 'style="display:none;"'; ?> id="wpsc-delete-checkout-set" type='submit' value='<?php esc_attr_e( 'Delete', 'wpsc' ); ?>' name='wpsc_checkout_set_delete' class='button-secondary' />
409
  </p>
410
 
411
- <p><a class="add_new_form_set button-secondary" href='#'><?php esc_html_e("Add New Form Set", 'wpsc'); ?></a></p>
412
 
413
  <p class='add_new_form_set_forms'>
414
- <label><?php esc_html_e( "Add new Form Set", 'wpsc' ); ?>:
415
  <input type="text" value="" name="new_form_set" /></label>
416
- <input type="submit" value="<?php esc_attr_e( 'Add', 'wpsc' ); ?>" class="button-primary" id="formset-add-sumbit"/>
417
  </p>
418
 
419
  <input type="hidden" name="selected_form_set" value="<?php echo esc_attr( $this->current_checkout_set ); ?>" />
@@ -440,7 +441,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
440
  <tr data-field-id="<?php echo esc_attr( $form_field->id ); ?>" data-field-type="<?php echo $form_field->type; ?>" id="checkout_<?php echo esc_attr( $form_field->id ); ?>" class="checkout_form_field field_type_<?php echo $form_field->type; ?>">
441
  <td class="drag">
442
  <div class="cell-wrapper">
443
- <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
444
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
445
  </a>
446
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
@@ -488,7 +489,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
488
  $style = 'style="display: inline;"';
489
  }
490
  ?>
491
- <a class="edit-options" href="#" <?php echo $style; ?> ><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
492
  </div>
493
  </td>
494
  <td class="displaycol">
@@ -506,11 +507,11 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
506
  <td class="actionscol">
507
  <div class="cell-wrapper">
508
  <?php if ( ! $this->is_field_default( $form_field ) ): ?>
509
- <a tabindex="-1" title="<?php esc_attr_e( 'Delete Field', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wpsc' ); ?></a>
510
  <?php else: ?>
511
- <span title="<?php _e( 'Cannot Delete Default Fields', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus"><?php echo _x( '&ndash;', 'delete item', 'wpsc' ); ?></span>
512
  <?php endif; ?>
513
- <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wpsc' ); ?></a>
514
  </div>
515
  </td>
516
  </tr>
1
  <?php
2
 
3
  class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
4
+
5
  private $require_register;
6
  private $shipping_same_as_billing;
7
  private $force_ssl;
9
  private $current_checkout_set;
10
  private $field_types;
11
  private $user_field_types;
12
+ private $form_fields;
13
 
14
  public function __construct() {
15
  global $wpdb;
33
  WHERE checkout_set = %s
34
  ORDER BY checkout_order
35
  ", $this->current_checkout_set );
36
+
37
  $this->form_fields = $wpdb->get_results( $form_sql );
38
 
39
  $columns = array(
40
+ 'drag' => __( 'Drag', 'wp-e-commerce' ),
41
+ 'name' => __( 'Title', 'wp-e-commerce' ),
42
+ 'type' => __( 'Type', 'wp-e-commerce' ),
43
  'unique_name' => '&nbsp;',
44
+ 'display' => __( 'Display', 'wp-e-commerce' ),
45
+ 'mandatory' => __( 'Mandatory', 'wp-e-commerce' ),
46
  'actions' => '&nbsp;',
47
  );
48
  register_column_headers( 'display-checkout-list', $columns );
76
  $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
77
  $checkout_sets[] = sanitize_text_field( $_POST['new_form_set'] );
78
  update_option( 'wpsc_checkout_form_sets', $checkout_sets );
79
+ add_settings_error( 'wpsc-settings', 'wpsc_form_set_added', __( 'New form set successfully created.', 'wp-e-commerce' ), 'updated' );
80
  }
81
 
82
  if ( isset( $_POST['checkout_set'] ) ) {
213
  * As a result, to determine whether a field is default or not, we have to rely on the field's
214
  * unique name and "active" status.
215
  *
216
+ * @param object $field Field object
217
+ * @return boolean True if the field is default.
218
  */
219
  private function is_field_default( $field ) {
220
  global $wpdb;
221
 
222
+ if ( $field->default == 1 ) {
223
  return true;
224
+ }
225
 
226
+ if ( empty( $field->unique_name) || $this->current_checkout_set !== 0 || empty( $field->active ) ) {
227
  return false;
228
+ }
229
 
230
  $default_fields = array(
231
+ 'billingfirstname',
232
+ 'billinglastname',
233
+ 'billingaddress',
234
+ 'billingcity',
235
+ 'billingstate',
236
+ 'billingcountry',
237
+ 'billingpostcode',
238
+ 'billingemail',
239
+ 'billingphone',
240
+ 'shippingfirstname',
241
+ 'shippinglastname',
242
+ 'shippingaddress',
243
+ 'shippingcity',
244
+ 'shippingstate',
245
+ 'shippingcountry',
246
+ 'shippingpostcode',
247
+ 'shippingemail',
248
+ );
249
+ return in_array( $field->unique_name, $default_fields );
 
 
 
 
250
  }
251
 
252
  private function prototype_field( $mode = 'hidden' ) {
267
  <tr id="<?php echo $row_id; ?>" class="<?php echo $row_class; ?>" <?php echo $data; ?> <?php echo $style; ?>>
268
  <td class="drag">
269
  <div class="cell-wrapper">
270
+ <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wp-e-commerce' ); ?>">
271
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
272
  </a>
273
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
290
  </div>
291
  </td>
292
  <td class="uniquenamecol">
293
+ <a class="edit-options" href="#"><?php esc_html_e( 'Edit Options', 'wp-e-commerce' ); ?></a>
294
  </td>
295
  <td class="displaycol">
296
  <div class="cell-wrapper">
304
  </td>
305
  <td class="actionscol">
306
  <div class="cell-wrapper">
307
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
308
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
309
  </div>
310
  </td>
311
  </tr>
316
  <h4></h4>
317
  <table class="wpsc-field-options-table">
318
  <thead>
319
+ <th class="column-labels"><?php echo esc_html_x( 'Label', "checkout field's options", 'wp-e-commerce' ); ?></th>
320
+ <th class="column-values"><?php echo esc_html_x( 'Value', "checkout field's options", 'wp-e-commerce' ); ?></th>
321
  <th class="column-actions">&nbsp;</th>
322
  </thead>
323
  <tbody>
334
  </td>
335
  <td class="column-actions">
336
  <div class="field-option-cell-wrapper">
337
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
338
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
339
  </div>
340
  </td>
341
  </tr>
359
  ?>
360
 
361
  <input type='hidden' name='checkout_submits' value='true' />
362
+ <h3><?php esc_html_e( 'Checkout Settings' , 'wp-e-commerce' ); ?></h3>
363
  <table class='form-table'>
364
  <tr>
365
+ <th scope="row"><?php esc_html_e('Force User Registration', 'wp-e-commerce'); ?></th>
366
  <td>
367
  <input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php checked( $this->require_register, 0 ); ?> />
368
+ <label for='require_register2'><?php _e( 'Users can checkout without a user account', 'wp-e-commerce' );?></label><br />
369
  <input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php checked( $this->require_register, 1 ); ?> />
370
+ <label for='require_register1'><?php _e( 'Users must register before checking out', 'wp-e-commerce' );?></label>
371
+ <p class='description'><?php esc_attr_e( 'Enabling this will also turn on "Membership: Anyone can register" from within WordPress Settings > General if it\'s not already enabled', 'wp-e-commerce' ); ?></p>
372
  </td>
373
  </tr>
374
 
375
  <tr>
376
+ <th scope="row"><?php esc_html_e('Shipping Same as Billing', 'wp-e-commerce' ); ?></th>
377
  <td>
378
  <input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php checked( $this->shipping_same_as_billing, 1 ); ?> />
379
+ <label for='shippingsameasbilling1'><?php _e( 'Enable "Same as billing address" checkbox with Shipping Address fields', 'wp-e-commerce' );?></label><br />
380
  <input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php checked( $this->shipping_same_as_billing, 0 ); ?> />
381
+ <label for='shippingsameasbilling2'><?php _e( 'Users must re-enter Shipping Address', 'wp-e-commerce' );?></label>
382
  </td>
383
  </tr>
384
  <tr>
385
+ <th scope="row"><?php _e('Security and Encryption', 'wp-e-commerce'); ?></th>
386
  <td>
387
  <input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php checked( $this->force_ssl, 1 ); ?> />
388
+ <label for='wpsc_force_ssl1'><?php _e( 'Force users to use SSL Encryption', 'wp-e-commerce' );?></label><br />
389
  <input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php checked( $this->force_ssl, 0 ); ?> />
390
+ <label for='wpsc_force_ssl2'><?php _e( 'Allow site to be used insecurely and unencrypted', 'wp-e-commerce' );?></label>
391
+ <p class='description'><?php esc_html_e( 'This can cause warnings for your users if you do not have a properly configured SSL certificate', 'wp-e-commerce' );?></p>
392
  </td>
393
  </tr>
394
  </table>
395
 
396
 
397
+ <h3><?php esc_html_e( 'Checkout Form Fields', 'wp-e-commerce' ); ?></h3>
398
+ <p><?php esc_html_e( 'Here you can customise the forms to be displayed in your checkout page. The checkout page is where you collect important user information that will show up in your purchase logs i.e. the buyer\'s address, and name...', 'wp-e-commerce' );?></p>
399
 
400
  <p>
401
+ <label for='wpsc_form_set'><?php esc_html_e( 'Select a Form Set' , 'wp-e-commerce' ); ?>:</label>
402
  <select id='wpsc_form_set' name='checkout_set'>
403
  <?php foreach ( $this->checkout_sets as $key => $value ): ?>
404
  <option <?php selected( $this->current_checkout_set, $key ); ?> value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
405
  <?php endforeach; ?>
406
  </select>
407
 
408
+ <input type='submit' value='<?php esc_attr_e( 'Filter', 'wp-e-commerce' ); ?>' name='wpsc_checkout_set_filter' class='button-secondary' />
409
+ <input <?php if (! $this->current_checkout_set) echo 'style="display:none;"'; ?> id="wpsc-delete-checkout-set" type='submit' value='<?php esc_attr_e( 'Delete', 'wp-e-commerce' ); ?>' name='wpsc_checkout_set_delete' class='button-secondary' />
410
  </p>
411
 
412
+ <p><a class="add_new_form_set button-secondary" href='#'><?php esc_html_e("Add New Form Set", 'wp-e-commerce'); ?></a></p>
413
 
414
  <p class='add_new_form_set_forms'>
415
+ <label><?php esc_html_e( "Add new Form Set", 'wp-e-commerce' ); ?>:
416
  <input type="text" value="" name="new_form_set" /></label>
417
+ <input type="submit" value="<?php esc_attr_e( 'Add', 'wp-e-commerce' ); ?>" class="button-primary" id="formset-add-sumbit"/>
418
  </p>
419
 
420
  <input type="hidden" name="selected_form_set" value="<?php echo esc_attr( $this->current_checkout_set ); ?>" />
441
  <tr data-field-id="<?php echo esc_attr( $form_field->id ); ?>" data-field-type="<?php echo $form_field->type; ?>" id="checkout_<?php echo esc_attr( $form_field->id ); ?>" class="checkout_form_field field_type_<?php echo $form_field->type; ?>">
442
  <td class="drag">
443
  <div class="cell-wrapper">
444
+ <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wp-e-commerce' ); ?>">
445
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
446
  </a>
447
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
489
  $style = 'style="display: inline;"';
490
  }
491
  ?>
492
+ <a class="edit-options" href="#" <?php echo $style; ?> ><?php esc_html_e( 'Edit Options', 'wp-e-commerce' ); ?></a>
493
  </div>
494
  </td>
495
  <td class="displaycol">
507
  <td class="actionscol">
508
  <div class="cell-wrapper">
509
  <?php if ( ! $this->is_field_default( $form_field ) ): ?>
510
+ <a tabindex="-1" title="<?php esc_attr_e( 'Delete Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus" href="#"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></a>
511
  <?php else: ?>
512
+ <span title="<?php _e( 'Cannot Delete Default Fields', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-minus"><?php echo _x( '&ndash;', 'delete item', 'wp-e-commerce' ); ?></span>
513
  <?php endif; ?>
514
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wp-e-commerce' ); ?>" class="button-secondary wpsc-button-round wpsc-button-plus" href="#"><?php echo _x( '+', 'add item', 'wp-e-commerce' ); ?></a>
515
  </div>
516
  </td>
517
  </tr>
wpsc-admin/includes/settings-tabs/gateway.php CHANGED
@@ -10,8 +10,9 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
10
  } else {
11
  update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', '' );
12
  }
 
13
  $this->active_gateways = get_option( 'custom_gateway_options' );
14
- $this->gateway_names = get_option( 'payment_gateway_names' );
15
 
16
  $this->hide_submit_button();
17
  }
@@ -38,8 +39,8 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
38
  $payment_data = $this->get_gateway_form( $selected_gateway );
39
  if ( ! $payment_data ) {
40
  $payment_data = array(
41
- 'name' => __( 'Edit Gateway Settings', 'wpsc' ),
42
- 'form_fields' => __( 'Modify a payment gateway settings by clicking "Edit" link on the left.', 'wpsc' ),
43
  'has_submit_button' => 1,
44
  );
45
  }
@@ -53,8 +54,8 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
53
  <?php // hidden because most gateways provide their own update button. ?>
54
  <?php if ( $payment_data['has_submit_button'] !== 1 ) { ?>
55
  <p class="submit inline-edit-save">
56
- <a class="button edit-payment-module-cancel" title="<?php esc_attr_e( "Cancel editing this Payment Gateway's settings", 'wpsc' ) ?>"><?php esc_html_e( "Cancel", 'wpsc' ); ?></a>
57
- <input type="submit" name="submit" class="button button-primary edit-payment-module-update" value='<?php _e( "Update &raquo;", 'wpsc' ); ?>'>
58
  </p>
59
  <?php } ?>
60
  </td></tr>
@@ -68,32 +69,29 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
68
  global $wpdb, $nzshpcrt_gateways;
69
  ?>
70
 
71
- <h3><?php _e( 'Select Payment Gateways', 'wpsc' ); ?></h3>
72
- <p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wpsc' ); ?></p>
73
 
74
  <table id='wpsc-payment-gateway-settings' class='wpsc-edit-module-options wp-list-table widefat plugins'>
75
  <thead>
76
  <tr>
77
  <th scope="col" id="wpsc-gateway-active" class="manage-column"></th>
78
- <th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wpsc' ); ?></th>
79
- <th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wpsc' ); ?></th>
80
  </tr>
81
  </thead>
82
  <tfoot>
83
  <tr>
84
  <th scope="col" id="wpsc-gateway-active" class="manage-column"></th>
85
- <th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wpsc' ); ?></th>
86
- <th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wpsc' ); ?></th>
87
  </tr>
88
  </tfoot>
89
  <tbody>
90
  <?php $this->gateway_list(); ?>
91
  </tbody>
92
  </table>
93
- <?php submit_button( __( 'Save Changes' ) ); ?>
94
- <h4><?php _e( 'WP eCommerce Recommends', 'wpsc' ); ?></h4>
95
- <a style="border-bottom:none;" href="https://www.paypal.com/nz/mrb/pal=LENKCHY6CU2VY" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/paypal-referal.gif" border="0" alt="<?php esc_attr_e( 'Sign up for PayPal and start accepting credit card payments instantly.', 'wpsc' ); ?>" /></a>
96
- <?php
97
  }
98
 
99
  private function gateway_list_item( $gateway, $force ) {
@@ -110,14 +108,14 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
110
  ?>
111
  <tr class="wpsc-select-gateway <?php echo $active; ?>" data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" id="gateway_list_item_<?php echo $gateway['id'];?>">
112
  <th scope="row" class="check-column">
113
- <label class="screen-reader-text" for="<?php echo esc_attr( $gateway['id'] ); ?>_id"><?php _e( "Select", "wpsc" ); ?> <?php echo esc_html( $gateway['name'] ); ?></label>
114
  <input name='wpsc_options[custom_gateway_options][]' <?php checked( $checked ); ?> type='checkbox' value='<?php echo esc_attr( $gateway['id'] ); ?>' id='<?php echo esc_attr( $gateway['id'] ); ?>_id' />
115
  </th>
116
  <td class="plugin-title">
117
  <label for='<?php echo esc_attr( $gateway['id'] ); ?>_id'><strong><?php echo esc_html( $gateway['name'] ); ?></strong></label>
118
  <div class="row-actions-visible">
119
  <span class="edit">
120
- <a class='edit-payment-module' title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wpsc' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['id'] ) ); ?>'><?php esc_html_e( 'Settings', 'wpsc' ); ?></a>
121
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
122
  </span>
123
  </div>
@@ -167,4 +165,4 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
167
  public function callback_submit_options() {
168
  do_action( 'wpsc_submit_gateway_options' );
169
  }
170
- }
10
  } else {
11
  update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', '' );
12
  }
13
+
14
  $this->active_gateways = get_option( 'custom_gateway_options' );
15
+ $this->gateway_names = get_option( 'payment_gateway_names' );
16
 
17
  $this->hide_submit_button();
18
  }
39
  $payment_data = $this->get_gateway_form( $selected_gateway );
40
  if ( ! $payment_data ) {
41
  $payment_data = array(
42
+ 'name' => __( 'Edit Gateway Settings', 'wp-e-commerce' ),
43
+ 'form_fields' => __( 'Modify the settings of a payment gateway by clicking the "Edit" link on the left.', 'wp-e-commerce' ),
44
  'has_submit_button' => 1,
45
  );
46
  }
54
  <?php // hidden because most gateways provide their own update button. ?>
55
  <?php if ( $payment_data['has_submit_button'] !== 1 ) { ?>
56
  <p class="submit inline-edit-save">
57
+ <a class="button edit-payment-module-cancel" title="<?php esc_attr_e( "Cancel editing this Payment Gateway's settings", 'wp-e-commerce' ) ?>"><?php esc_html_e( "Cancel", 'wp-e-commerce' ); ?></a>
58
+ <input type="submit" name="submit" class="button button-primary edit-payment-module-update" value='<?php _e( "Update &raquo;", 'wp-e-commerce' ); ?>'>
59
  </p>
60
  <?php } ?>
61
  </td></tr>
69
  global $wpdb, $nzshpcrt_gateways;
70
  ?>
71
 
72
+ <h3><?php _e( 'Select Payment Gateways', 'wp-e-commerce' ); ?></h3>
73
+ <p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wp-e-commerce' ); ?></p>
74
 
75
  <table id='wpsc-payment-gateway-settings' class='wpsc-edit-module-options wp-list-table widefat plugins'>
76
  <thead>
77
  <tr>
78
  <th scope="col" id="wpsc-gateway-active" class="manage-column"></th>
79
+ <th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wp-e-commerce' ); ?></th>
80
+ <th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wp-e-commerce' ); ?></th>
81
  </tr>
82
  </thead>
83
  <tfoot>
84
  <tr>
85
  <th scope="col" id="wpsc-gateway-active" class="manage-column"></th>
86
+ <th scope="col" id="wpsc-gateway-name" class="manage-column column-name"><?php _e( 'Payment Gateway', 'wp-e-commerce' ); ?></th>
87
+ <th scope="col" id="wpsc-gateway-display-name" class="manage-column column-description"><?php _e( 'Display Name', 'wp-e-commerce' ); ?></th>
88
  </tr>
89
  </tfoot>
90
  <tbody>
91
  <?php $this->gateway_list(); ?>
92
  </tbody>
93
  </table>
94
+ <?php submit_button( __( 'Save Changes', 'wp-e-commerce' ) );
 
 
 
95
  }
96
 
97
  private function gateway_list_item( $gateway, $force ) {
108
  ?>
109
  <tr class="wpsc-select-gateway <?php echo $active; ?>" data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" id="gateway_list_item_<?php echo $gateway['id'];?>">
110
  <th scope="row" class="check-column">
111
+ <label class="screen-reader-text" for="<?php echo esc_attr( $gateway['id'] ); ?>_id"><?php _e( "Select", 'wp-e-commerce' ); ?> <?php echo esc_html( $gateway['name'] ); ?></label>
112
  <input name='wpsc_options[custom_gateway_options][]' <?php checked( $checked ); ?> type='checkbox' value='<?php echo esc_attr( $gateway['id'] ); ?>' id='<?php echo esc_attr( $gateway['id'] ); ?>_id' />
113
  </th>
114
  <td class="plugin-title">
115
  <label for='<?php echo esc_attr( $gateway['id'] ); ?>_id'><strong><?php echo esc_html( $gateway['name'] ); ?></strong></label>
116
  <div class="row-actions-visible">
117
  <span class="edit">
118
+ <a class='edit-payment-module' title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wp-e-commerce' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['id'] ) ); ?>'><?php esc_html_e( 'Settings', 'wp-e-commerce' ); ?></a>
119
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
120
  </span>
121
  </div>
165
  public function callback_submit_options() {
166
  do_action( 'wpsc_submit_gateway_options' );
167
  }
168
+ }
wpsc-admin/includes/settings-tabs/general.php CHANGED
@@ -4,6 +4,20 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
4
 
5
  public function __construct() {
6
  $this->get_regions();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  }
8
 
9
  private function get_regions() {
@@ -38,10 +52,10 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
38
  public function display() {
39
  global $wpdb;
40
  ?>
41
- <h3><?php echo esc_html_e( 'General Settings', 'wpsc' ); ?></h3>
42
  <table class='wpsc_options form-table'>
43
  <tr>
44
- <th scope="row"><label for="wpsc-base-country-drop-down"><?php esc_html_e( 'Base Country/Region', 'wpsc' ); ?></label></th>
45
  <td>
46
  <?php
47
  wpsc_country_dropdown( array(
@@ -55,7 +69,7 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
55
  <?php $this->display_region_drop_down(); ?>
56
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
57
  </span>
58
- <p class='description'><?php esc_html_e( 'Select your primary business location.', 'wpsc' ); ?></p>
59
  </td>
60
  </tr>
61
 
@@ -65,31 +79,31 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
65
  ?>
66
  <tr>
67
  <th scope="row">
68
- <?php esc_html_e( 'Target Markets', 'wpsc' ); ?>
69
  </th>
70
  <td>
71
  <?php
72
  // check for the suhosin module
73
  if ( wpsc_is_suhosin_enabled() ) {
74
- echo "<em>" . __( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature then disable the suhosin extension, if you can not do this, you will need to contact your hosting provider.", 'wpsc' ) . "</em>";
75
  } else {
76
  ?>
77
  <span>
78
- <?php printf( __( 'Select: <a href="%1$s" class="wpsc-select-all" title="All">All</a> <a href="%2$s" class="wpsc-select-none" title="None">None</a>' , 'wpsc') , esc_url( add_query_arg( array( 'selected_all' => 'all' ) ) ), esc_url( add_query_arg( array( 'selected_all' => 'none' ) ) ) ); ?>
79
  </span><br />
80
  <div id='wpsc-target-markets' class='ui-widget-content multiple-select'>
81
  <?php foreach ( (array)$countrylist as $country ) : ?>
82
  <?php if ( $country['visible'] == 1 ) : ?>
83
  <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' checked='checked' />
84
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
85
  <?php else : ?>
86
  <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' />
87
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
88
  <?php endif; ?>
89
  <?php endforeach; ?>
90
  </div>
91
 
92
- <p class='description'><?php esc_html_e( 'Select the markets you are selling products to.' , 'wpsc'); ?></p>
93
  <?php
94
  }
95
  ?>
@@ -102,16 +116,16 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
102
  ?>
103
  <tr>
104
  <th scope="row">
105
- <label for="wpsc-stock-keeping-time"><?php esc_html_e( 'Keep stock in cart for', 'wpsc' ); ?></label>
106
  </th>
107
  <td>
108
  <input type="text" name="wpsc_options[wpsc_stock_keeping_time]" id="wpsc-stock-keeping-time" size="2" value="<?php echo esc_attr( $stock_keeping_time ); ?>" />
109
  <select name="wpsc_options[wpsc_stock_keeping_interval]">
110
- <option value="hour" <?php selected( 'hour', $stock_keeping_interval ); ?>><?php echo _n( 'hour', 'hours', $stock_keeping_time, 'wpsc' ); ?></option>
111
- <option value="day" <?php selected( 'day', $stock_keeping_interval ); ?>><?php echo _n( 'day', 'days', $stock_keeping_time, 'wpsc' ) ?></option>
112
- <option value="week" <?php selected( 'week', $stock_keeping_interval ); ?>><?php echo _n( 'week', 'weeks', $stock_keeping_time, 'wpsc' ) ?></option>
113
  </select>
114
- <p class='description'><?php esc_html_e( "Set the amount of time items in a customer's cart are reserved. You can also specify decimal amounts such as '0.5 days' or '1.25 weeks'. Note that the minimum interval you can enter is 1 hour, i.e. you can't schedule it to run every 0.5 hour.", 'wpsc' ) ?></p>
115
  </td>
116
  </tr>
117
 
@@ -120,28 +134,28 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
120
  ?>
121
  <tr>
122
  <th scope="row">
123
- <?php _e( 'Use Hierarchical Product Category URL', 'wpsc' ); ?>
124
  </th>
125
  <td>
126
- <label><input type="radio" <?php checked( $hierarchical_category, 1 ); ?> name="wpsc_options[product_category_hierarchical_url]" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;
127
- <label><input type="radio" <?php checked( $hierarchical_category, 0 ); ?>name="wpsc_options[product_category_hierarchical_url]" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label><br />
128
- <p class='description'><?php _e( 'When Hierarchical Product Category URL is enabled, parent product categories are also included in the product URL.<br />For example: <code>http://example.com/products-page/parent-cat/sub-cat/product-name</code>', 'wpsc' ); ?></p>
129
  </td>
130
  </tr>
131
  </table>
132
 
133
- <h3 class="form_group"><?php esc_html_e( 'Currency Settings', 'wpsc' ); ?></h3>
134
  <table class='wpsc_options form-table'>
135
  <?php
136
  $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
137
  $currency_type = esc_attr( get_option( 'currency_type' ) );
138
  ?>
139
  <tr>
140
- <th scope="row"><label for="wpsc_options_currency_type"><?php esc_html_e( 'Currency Type', 'wpsc' ); ?></label></th>
141
  <td>
142
  <select id="wpsc_options_currency_type" name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
143
  <?php foreach ( $currency_data as $currency ) : ?>
144
- <option value='<?php echo $currency['id']; ?>' <?php selected( $currency['id'], $currency_type ); ?>><?php esc_html_e( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)</option>
145
  <?php endforeach; ?>
146
  </select>
147
  </td>
@@ -180,24 +194,24 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
180
  }
181
  ?>
182
  <tr>
183
- <th scope="row"><?php esc_html_e( 'Currency Sign Location', 'wpsc' ); ?></th>
184
  <td>
185
  <input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
186
- <label for='csl1'><?php _ex( '100', 'Currency sign location - option 1', 'wpsc' ); ?><span id='cslchar1'><?php echo $currency_sign; ?></span></label> &nbsp;
187
  <input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
188
- <label for='csl2'><?php _ex( '100', 'Currency sign location - option 2', 'wpsc' ); ?> <span id='cslchar2'><?php echo $currency_sign; ?></span></label> &nbsp;
189
  <input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
190
- <label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span><?php _ex( '100', 'Currency sign location - option 3', 'wpsc' ); ?></label> &nbsp;
191
  <input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
192
- <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> <?php _ex( '100', 'Currency sign location - option 4', 'wpsc' ); ?></label>
193
  </td>
194
  </tr>
195
  <tr>
196
- <th scope="row"><?php esc_html_e( 'Thousands and decimal separators', 'wpsc' ); ?></th>
197
  <td>
198
- <label for="wpsc_options_wpsc_thousands_separator"><?php esc_html_e( 'Thousands separator', 'wpsc' ); ?></label>: <input name="wpsc_options[wpsc_thousands_separator]" id="wpsc_options_wpsc_thousands_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>" /><br />
199
- <label for="wpsc_options_wpsc_decimal_separator"><?php esc_html_e( 'Decimal separator', 'wpsc' ); ?></label>: <input name="wpsc_options[wpsc_decimal_separator]" id="wpsc_options_wpsc_decimal_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>" /><br />
200
- <?php esc_html_e( 'Preview:', 'wpsc' ); ?> 10<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>000<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>00
201
  </td>
202
  </tr>
203
  </table>
4
 
5
  public function __construct() {
6
  $this->get_regions();
7
+ add_action( 'admin_notices', array( $this, 'no_target_markets' ) );
8
+ }
9
+
10
+ public function no_target_markets() {
11
+
12
+ $countries = WPSC_Countries::get_countries();
13
+
14
+ if ( empty( $countries ) ) {
15
+ ?>
16
+ <div class="notice error is-dismissible below-h2">
17
+ <p><?php _e( '<strong>You have not enabled any target markets.</strong> To sell tangible goods, you will need to set at least one target market.', 'wp-e-commerce' ); ?></p>
18
+ </div>
19
+ <?php
20
+ }
21
  }
22
 
23
  private function get_regions() {
52
  public function display() {
53
  global $wpdb;
54
  ?>
55
+ <h3><?php echo esc_html_e( 'General Settings', 'wp-e-commerce' ); ?></h3>
56
  <table class='wpsc_options form-table'>
57
  <tr>
58
+ <th scope="row"><label for="wpsc-base-country-drop-down"><?php esc_html_e( 'Base Country/Region', 'wp-e-commerce' ); ?></label></th>
59
  <td>
60
  <?php
61
  wpsc_country_dropdown( array(
69
  <?php $this->display_region_drop_down(); ?>
70
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
71
  </span>
72
+ <p class='description'><?php esc_html_e( 'Select your primary business location.', 'wp-e-commerce' ); ?></p>
73
  </td>
74
  </tr>
75
 
79
  ?>
80
  <tr>
81
  <th scope="row">
82
+ <?php esc_html_e( 'Target Markets', 'wp-e-commerce' ); ?>
83
  </th>
84
  <td>
85
  <?php
86
  // check for the suhosin module
87
  if ( wpsc_is_suhosin_enabled() ) {
88
+ echo "<em>" . __( "The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature, then disable the suhosin extension. If you can not do this, you will need to contact your hosting provider.", 'wp-e-commerce' ) . "</em>";
89
  } else {
90
  ?>
91
  <span>
92
+ <?php printf( __( 'Select: <a href="%1$s" class="wpsc-select-all" title="All">All</a> <a href="%2$s" class="wpsc-select-none" title="None">None</a>' , 'wp-e-commerce') , esc_url( add_query_arg( array( 'selected_all' => 'all' ) ) ), esc_url( add_query_arg( array( 'selected_all' => 'none' ) ) ) ); ?>
93
  </span><br />
94
  <div id='wpsc-target-markets' class='ui-widget-content multiple-select'>
95
  <?php foreach ( (array)$countrylist as $country ) : ?>
96
  <?php if ( $country['visible'] == 1 ) : ?>
97
  <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' checked='checked' />
98
+ <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
99
  <?php else : ?>
100
  <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' />
101
+ <label for="countrylist2-<?php echo $country['id']; ?>"><?php echo esc_html( $country['country'] ); ?></label><br />
102
  <?php endif; ?>
103
  <?php endforeach; ?>
104
  </div>
105
 
106
+ <p class='description'><?php esc_html_e( 'Select the markets you are selling products to.' , 'wp-e-commerce'); ?></p>
107
  <?php
108
  }
109
  ?>
116
  ?>
117
  <tr>
118
  <th scope="row">
119
+ <label for="wpsc-stock-keeping-time"><?php esc_html_e( 'Keep stock in cart for', 'wp-e-commerce' ); ?></label>
120
  </th>
121
  <td>
122
  <input type="text" name="wpsc_options[wpsc_stock_keeping_time]" id="wpsc-stock-keeping-time" size="2" value="<?php echo esc_attr( $stock_keeping_time ); ?>" />
123
  <select name="wpsc_options[wpsc_stock_keeping_interval]">
124
+ <option value="hour" <?php selected( 'hour', $stock_keeping_interval ); ?>><?php echo _n( 'hour', 'hours', $stock_keeping_time, 'wp-e-commerce' ); ?></option>
125
+ <option value="day" <?php selected( 'day', $stock_keeping_interval ); ?>><?php echo _n( 'day', 'days', $stock_keeping_time, 'wp-e-commerce' ) ?></option>
126
+ <option value="week" <?php selected( 'week', $stock_keeping_interval ); ?>><?php echo _n( 'week', 'weeks', $stock_keeping_time, 'wp-e-commerce' ) ?></option>
127
  </select>
128
+ <p class='description'><?php esc_html_e( "Set the amount of time items in a customer's cart are reserved. You can also specify decimal amounts such as '0.5 days' or '1.25 weeks'. Note that the minimum interval you can enter is 1 hour, i.e. you can't schedule it to run every 0.5 hour.", 'wp-e-commerce' ) ?></p>
129
  </td>
130
  </tr>
131
 
134
  ?>
135
  <tr>
136
  <th scope="row">
137
+ <?php _e( 'Use Hierarchical Product Category URL', 'wp-e-commerce' ); ?>
138
  </th>
139
  <td>
140
+ <label><input type="radio" <?php checked( $hierarchical_category, 1 ); ?> name="wpsc_options[product_category_hierarchical_url]" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;
141
+ <label><input type="radio" <?php checked( $hierarchical_category, 0 ); ?>name="wpsc_options[product_category_hierarchical_url]" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
142
+ <p class='description'><?php _e( 'When Hierarchical Product Category URL is enabled, parent product categories are also included in the product URL.<br />For example: <code>http://example.com/products-page/parent-cat/sub-cat/product-name</code>', 'wp-e-commerce' ); ?></p>
143
  </td>
144
  </tr>
145
  </table>
146
 
147
+ <h3 class="form_group"><?php esc_html_e( 'Currency Settings', 'wp-e-commerce' ); ?></h3>
148
  <table class='wpsc_options form-table'>
149
  <?php
150
  $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
151
  $currency_type = esc_attr( get_option( 'currency_type' ) );
152
  ?>
153
  <tr>
154
+ <th scope="row"><label for="wpsc_options_currency_type"><?php esc_html_e( 'Currency Type', 'wp-e-commerce' ); ?></label></th>
155
  <td>
156
  <select id="wpsc_options_currency_type" name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
157
  <?php foreach ( $currency_data as $currency ) : ?>
158
+ <option value='<?php echo $currency['id']; ?>' <?php selected( $currency['id'], $currency_type ); ?>><?php echo esc_html( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)</option>
159
  <?php endforeach; ?>
160
  </select>
161
  </td>
194
  }
195
  ?>
196
  <tr>
197
+ <th scope="row"><?php esc_html_e( 'Currency Sign Location', 'wp-e-commerce' ); ?></th>
198
  <td>
199
  <input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
200
+ <label for='csl1'><?php _ex( '100', 'Currency sign location - option 1', 'wp-e-commerce' ); ?><span id='cslchar1'><?php echo $currency_sign; ?></span></label> &nbsp;
201
  <input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
202
+ <label for='csl2'><?php _ex( '100', 'Currency sign location - option 2', 'wp-e-commerce' ); ?> <span id='cslchar2'><?php echo $currency_sign; ?></span></label> &nbsp;
203
  <input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
204
+ <label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span><?php _ex( '100', 'Currency sign location - option 3', 'wp-e-commerce' ); ?></label> &nbsp;
205
  <input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
206
+ <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> <?php _ex( '100', 'Currency sign location - option 4', 'wp-e-commerce' ); ?></label>
207
  </td>
208
  </tr>
209
  <tr>
210
+ <th scope="row"><?php esc_html_e( 'Thousands and decimal separators', 'wp-e-commerce' ); ?></th>
211
  <td>
212
+ <label for="wpsc_options_wpsc_thousands_separator"><?php esc_html_e( 'Thousands separator', 'wp-e-commerce' ); ?></label>: <input name="wpsc_options[wpsc_thousands_separator]" id="wpsc_options_wpsc_thousands_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>" /><br />
213
+ <label for="wpsc_options_wpsc_decimal_separator"><?php esc_html_e( 'Decimal separator', 'wp-e-commerce' ); ?></label>: <input name="wpsc_options[wpsc_decimal_separator]" id="wpsc_options_wpsc_decimal_separator" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>" /><br />
214
+ <?php esc_html_e( 'Preview:', 'wp-e-commerce' ); ?> 10<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>000<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>00
215
  </td>
216
  </tr>
217
  </table>
wpsc-admin/includes/settings-tabs/import.php CHANGED
@@ -25,15 +25,15 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
25
  }
26
 
27
  $this->default_fields = apply_filters( 'wpsc_product_import_default_fields', array(
28
- 'column_name' => __( 'Product Name' , 'wpsc' ),
29
- 'column_description' => __( 'Description' , 'wpsc' ),
30
- 'column_additional_description' => __( 'Additional Description', 'wpsc' ),
31
- 'column_price' => __( 'Price' , 'wpsc' ),
32
- 'column_sku' => __( 'SKU' , 'wpsc' ),
33
- 'column_weight' => __( 'Weight' , 'wpsc' ),
34
- 'column_weight_unit' => __( 'Weight Unit' , 'wpsc' ),
35
- 'column_quantity' => __( 'Stock Quantity' , 'wpsc' ),
36
- 'column_quantity_limited' => __( 'Stock Quantity Limit' , 'wpsc' )
37
  ) );
38
 
39
  switch ( $this->step ) {
@@ -170,7 +170,7 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
170
 
171
  $this->reset_state();
172
  $this->completed = true;
173
- add_settings_error( 'wpsc-settings', 'settings_updated', sprintf( __( 'CSV file successfully processed. %s record(s) imported.', 'wpsc' ), $record_count ), 'updated' );
174
  }
175
 
176
  public function callback_submit_options() {
@@ -195,22 +195,22 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
195
  private function display_imported_columns() {
196
  extract( $this->display_data );
197
  ?>
198
- <h3 class='hndle'><?php esc_html_e( 'Assign CSV Columns to Product Fields', 'wpsc'); ?></h3>
199
- <p><?php esc_html_e( 'For each column, select the field it corresponds to in \'Product Field\'.', 'wpsc' ); ?></p>
200
- <p><?php esc_html_e( 'Note: In this view we only show sample data from the first 5 records. All records in the uploaded import file will actually be imported.', 'wpsc' ); ?></p>
201
  <table class='wp-list-table widefat plugins' id="wpsc_imported_columns">
202
  <thead>
203
  <tr>
204
- <th scope="col" class="manage-column"><?php _e( 'Column', 'wpsc' ); ?></th>
205
- <th scope="col" class="manage-column"><?php _e( 'Sample Data from Column', 'wpsc' ); ?></th>
206
- <th scope="col" class="manage-column"><?php _e( 'Product Field', 'wpsc' ); ?></th>
207
  </tr>
208
  </thead>
209
  <tbody>
210
  <?php foreach ( $sample_row_data as $key => $sample_data ) : ?>
211
  <tr>
212
  <td>
213
- <p><?php printf( __('Column %s', 'wpsc' ), $this->num_to_alphacolumn( $key ) ); ?></p>
214
  </td>
215
  <td>
216
  <ol>
@@ -219,7 +219,7 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
219
  <?php if ( $datum != "" ): ?>
220
  <code><?php echo esc_html( $datum ); ?></code>
221
  <?php else: ?>
222
- <?php _e( '<em class="empty">empty</em>', 'wpsc' ); ?>
223
  <?php endif; ?>
224
  </li>
225
  <?php endforeach; ?>
@@ -244,39 +244,39 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
244
  <?php endforeach; ?>
245
  </tbody>
246
  </table>
247
- <h3><?php esc_html_e( 'Import Options', 'wpsc' ); ?></h3>
248
  <table class='form-table'>
249
  <tr>
250
  <th>
251
- <label for='post_status'><?php esc_html_e( 'Product Status' , 'wpsc' ); ?>
252
  </th>
253
  <td>
254
  <select name='post_status' id='post_status'>
255
- <option value='publish'><?php esc_html_e( 'Publish', 'wpsc' ); ?></option>
256
- <option value='draft' ><?php esc_html_e( 'Draft' , 'wpsc' ); ?></option>
257
  </select>
258
  <p class="description">
259
- <?php esc_html_e( 'Set your imported products as drafts, or publish them right away.' , 'wpsc' ); ?>
260
  </p>
261
  </td>
262
  </tr>
263
  <tr>
264
- <th><label for="category"><?php esc_html_e( 'Import to Category', 'wpsc' ); ?></label></th>
265
  <td>
266
  <select id='category' name='category'>
267
- <option value=""><?php esc_html_e( "No Category", 'wpsc' ); ?></option>
268
  <?php foreach ( $categories as $category ): ?>
269
  <option value="<?php echo $category->term_id; ?>"><?php echo esc_html( $category->name ); ?></option>
270
  <?php endforeach; ?>
271
  </select>
272
  <p class="description">
273
- <?php esc_html_e( 'Products imported from this CSV file will be placed in the selected category.', 'wpsc' ); ?></p>
274
  </p>
275
  </td>
276
  </tr>
277
  </table>
278
  <input type="hidden" name="step" value="3" />
279
- <input type='submit' value='<?php echo esc_html_x( 'Import Products', 'import csv', 'wpsc' ); ?>' class='button-primary'>
280
  <?php
281
  }
282
 
@@ -293,56 +293,56 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
293
  private function display_default() {
294
  extract( $this->display_data );
295
  ?>
296
- <h3><?php _e( 'Import Products', 'wpsc' ); ?></h3>
297
- <p><?php _e( 'You can import your products from a <a href="http://en.wikipedia.org/wiki/Comma-separated_values"><abbr title="Comma-separated values">CSV</abbr> (Comma-separated values) file</a>, exportable from most spread-sheet programs or other software.</p>', 'wpsc' ); ?></p>
298
 
299
- <h4><?php _e( 'Import New Products from CSV', 'wpsc' ); ?></h4>
300
  <table class='form-table'>
301
  <tr>
302
- <th><label for='wpsc_csv_file'><?php _e( 'CSV File', 'wpsc' ); ?><label></th>
303
  <td>
304
  <input type='file' name='csv_file' id='wpsc_csv_file' />
305
  </td>
306
  </tr>
307
  </table>
308
 
309
- <?php submit_button( esc_html_x( 'Upload', 'import csv', 'wpsc' ) ); ?>
310
 
311
- <h4><?php _e( 'Useful Information', 'wpsc' ); ?></h4>
312
  <table class='form-table'>
313
  <tr>
314
- <th><?php echo _e( 'Supported Fields', 'wpsc' ); ?></th>
315
  <td>
316
- <?php _e( 'Columns supported are, in their default order:', 'wpsc'); ?><br />
317
  <code>
318
  <?php echo implode( ', ', $this->default_fields ); ?>
319
  </code>
320
  </td>
321
  </tr>
322
  <tr>
323
- <th><?php _e( 'Understood Weight Units', 'wpsc' ); ?></th>
324
  <td>
325
- <?php _e( 'Metric', 'wpsc' ); ?>: <code>kilogram</code>,<code>kilograms</code>,<code>kg</code>,<code>kgs</code>,<code>gram</code>,<code>grams</code>,<code>g</code>,<code>gs</code><br />
326
- <?php _e( 'Imperial', 'wpsc' ); ?>: <code>ounce</code>,<code>ounces</code>,<code>oz</code>,<code>pound</code>,<code>pounds</code>,<code>lb</code>,<code>lbs</code>
327
  </td>
328
  </tr>
329
  <tr>
330
- <th><?php _e( 'Stock Fields', 'wpsc' ); ?></th>
331
  <td>
332
- <?php _e( '<code>Stock Quantity</code> values are used only when <code>Stock Quantity Limited</code> is blank or <code>""</code>.', 'wpsc' ); ?>
333
  </td>
334
  </tr>
335
  <tr>
336
- <th><?php _e( 'HTML', 'wpsc' ); ?></th>
337
  <td>
338
- <?php _e( 'Supported in <code>Description</code> and <code>Additional Description</code>. Be sure you "quote" the whole description, and slash-escape \"quotes\" inside the description itself.', 'wpsc' ); ?>
339
  </tr>
340
  <tr>
341
- <th><?php _e( 'Example CSV File'); ?></th>
342
  <td>
343
  <ol>
344
- <li><code><?php esc_html_e( 'Banana, The Yellow Fruit, Contains Potassium, 0.67, "BANANA", 150, "g", 0, ""', 'wpsc' ); ?></code></li>
345
- <li><code><?php esc_html_e( '"Apple, red", "Red, round, juicy. Isn\'t an <a href=\"http://example.com\">orange</a>.", "Red Delicious", 0.25, "RED_DELICIOUS", 5, "oz", 10, true', 'wpsc' ); ?></code></li>
346
  </ol>
347
  </td>
348
  </tr>
25
  }
26
 
27
  $this->default_fields = apply_filters( 'wpsc_product_import_default_fields', array(
28
+ 'column_name' => __( 'Product Name' , 'wp-e-commerce' ),
29
+ 'column_description' => __( 'Description' , 'wp-e-commerce' ),
30
+ 'column_additional_description' => __( 'Additional Description', 'wp-e-commerce' ),
31
+ 'column_price' => __( 'Price' , 'wp-e-commerce' ),
32
+ 'column_sku' => __( 'SKU' , 'wp-e-commerce' ),
33
+ 'column_weight' => __( 'Weight' , 'wp-e-commerce' ),
34
+ 'column_weight_unit' => __( 'Weight Unit' , 'wp-e-commerce' ),
35
+ 'column_quantity' => __( 'Stock Quantity' , 'wp-e-commerce' ),
36
+ 'column_quantity_limited' => __( 'Stock Quantity Limit' , 'wp-e-commerce' )
37
  ) );
38
 
39
  switch ( $this->step ) {
170
 
171
  $this->reset_state();
172
  $this->completed = true;
173
+ add_settings_error( 'wpsc-settings', 'settings_updated', sprintf( __( 'CSV file successfully processed. %s record(s) imported.', 'wp-e-commerce' ), $record_count ), 'updated' );
174
  }
175
 
176
  public function callback_submit_options() {
195
  private function display_imported_columns() {
196
  extract( $this->display_data );
197
  ?>
198
+ <h3 class='hndle'><?php esc_html_e( 'Assign CSV Columns to Product Fields', 'wp-e-commerce'); ?></h3>
199
+ <p><?php esc_html_e( 'For each column, select the field it corresponds to in \'Product Field\'.', 'wp-e-commerce' ); ?></p>
200
+ <p><?php esc_html_e( 'Note: In this view we only show sample data from the first 5 records. All records in the uploaded import file will actually be imported.', 'wp-e-commerce' ); ?></p>
201
  <table class='wp-list-table widefat plugins' id="wpsc_imported_columns">
202
  <thead>
203
  <tr>
204
+ <th scope="col" class="manage-column"><?php _e( 'Column', 'wp-e-commerce' ); ?></th>
205
+ <th scope="col" class="manage-column"><?php _e( 'Sample Data from Column', 'wp-e-commerce' ); ?></th>
206
+ <th scope="col" class="manage-column"><?php _e( 'Product Field', 'wp-e-commerce' ); ?></th>
207
  </tr>
208
  </thead>
209
  <tbody>
210
  <?php foreach ( $sample_row_data as $key => $sample_data ) : ?>
211
  <tr>
212
  <td>
213
+ <p><?php printf( __('Column %s', 'wp-e-commerce' ), $this->num_to_alphacolumn( $key ) ); ?></p>
214
  </td>
215
  <td>
216
  <ol>
219
  <?php if ( $datum != "" ): ?>
220
  <code><?php echo esc_html( $datum ); ?></code>
221
  <?php else: ?>
222
+ <?php _e( '<em class="empty">empty</em>', 'wp-e-commerce' ); ?>
223
  <?php endif; ?>
224
  </li>
225
  <?php endforeach; ?>
244
  <?php endforeach; ?>
245
  </tbody>
246
  </table>
247
+ <h3><?php esc_html_e( 'Import Options', 'wp-e-commerce' ); ?></h3>
248
  <table class='form-table'>
249
  <tr>
250
  <th>
251
+ <label for='post_status'><?php esc_html_e( 'Product Status' , 'wp-e-commerce' ); ?>
252
  </th>
253
  <td>
254
  <select name='post_status' id='post_status'>
255
+ <option value='publish'><?php esc_html_e( 'Publish', 'wp-e-commerce' ); ?></option>
256
+ <option value='draft' ><?php esc_html_e( 'Draft' , 'wp-e-commerce' ); ?></option>
257
  </select>
258
  <p class="description">
259
+ <?php esc_html_e( 'Set your imported products as drafts, or publish them right away.' , 'wp-e-commerce' ); ?>
260
  </p>
261
  </td>
262
  </tr>
263
  <tr>
264
+ <th><label for="category"><?php esc_html_e( 'Import to Category', 'wp-e-commerce' ); ?></label></th>
265
  <td>
266
  <select id='category' name='category'>
267
+ <option value=""><?php esc_html_e( "No Category", 'wp-e-commerce' ); ?></option>
268
  <?php foreach ( $categories as $category ): ?>
269
  <option value="<?php echo $category->term_id; ?>"><?php echo esc_html( $category->name ); ?></option>
270
  <?php endforeach; ?>
271
  </select>
272
  <p class="description">
273
+ <?php esc_html_e( 'Products imported from this CSV file will be placed in the selected category.', 'wp-e-commerce' ); ?></p>
274
  </p>
275
  </td>
276
  </tr>
277
  </table>
278
  <input type="hidden" name="step" value="3" />
279
+ <input type='submit' value='<?php echo esc_html_x( 'Import Products', 'import csv', 'wp-e-commerce' ); ?>' class='button-primary'>
280
  <?php
281
  }
282
 
293
  private function display_default() {
294
  extract( $this->display_data );
295
  ?>
296
+ <h3><?php _e( 'Import Products', 'wp-e-commerce' ); ?></h3>
297
+ <p><?php _e( 'You can import your products from a <a href="http://en.wikipedia.org/wiki/Comma-separated_values"><abbr title="Comma-separated values">CSV</abbr> (Comma-separated values) file</a>, exportable from most spread-sheet programs or other software.</p>', 'wp-e-commerce' ); ?></p>
298
 
299
+ <h4><?php _e( 'Import New Products from CSV', 'wp-e-commerce' ); ?></h4>
300
  <table class='form-table'>
301
  <tr>
302
+ <th><label for='wpsc_csv_file'><?php _e( 'CSV File', 'wp-e-commerce' ); ?><label></th>
303
  <td>
304
  <input type='file' name='csv_file' id='wpsc_csv_file' />
305
  </td>
306
  </tr>
307
  </table>
308
 
309
+ <?php submit_button( esc_html_x( 'Upload', 'import csv', 'wp-e-commerce' ) ); ?>
310
 
311
+ <h4><?php _e( 'Useful Information', 'wp-e-commerce' ); ?></h4>
312
  <table class='form-table'>
313
  <tr>
314
+ <th><?php echo _e( 'Supported Fields', 'wp-e-commerce' ); ?></th>
315
  <td>
316
+ <?php _e( 'Columns supported are, in their default order:', 'wp-e-commerce'); ?><br />
317
  <code>
318
  <?php echo implode( ', ', $this->default_fields ); ?>
319
  </code>
320
  </td>
321
  </tr>
322
  <tr>
323
+ <th><?php _e( 'Understood Weight Units', 'wp-e-commerce' ); ?></th>
324
  <td>
325
+ <?php _e( 'Metric', 'wp-e-commerce' ); ?>: <code>kilogram</code>,<code>kilograms</code>,<code>kg</code>,<code>kgs</code>,<code>gram</code>,<code>grams</code>,<code>g</code>,<code>gs</code><br />
326
+ <?php _e( 'Imperial', 'wp-e-commerce' ); ?>: <code>ounce</code>,<code>ounces</code>,<code>oz</code>,<code>pound</code>,<code>pounds</code>,<code>lb</code>,<code>lbs</code>
327
  </td>
328
  </tr>
329
  <tr>
330
+ <th><?php _e( 'Stock Fields', 'wp-e-commerce' ); ?></th>
331
  <td>
332
+ <?php _e( '<code>Stock Quantity</code> values are used only when <code>Stock Quantity Limited</code> is blank or <code>""</code>.', 'wp-e-commerce' ); ?>
333
  </td>
334
  </tr>
335
  <tr>
336
+ <th><?php _e( 'HTML', 'wp-e-commerce' ); ?></th>
337
  <td>
338
+ <?php _e( 'Supported in <code>Description</code> and <code>Additional Description</code>. Be sure you "quote" the whole description, and slash-escape \"quotes\" inside the description itself.', 'wp-e-commerce' ); ?>
339
  </tr>
340
  <tr>
341
+ <th><?php _e( 'Example CSV File', 'wp-e-commerce' ); ?></th>
342
  <td>
343
  <ol>
344
+ <li><code><?php esc_html_e( 'Banana, The Yellow Fruit, Contains Potassium, 0.67, "BANANA", 150, "g", 0, ""', 'wp-e-commerce' ); ?></code></li>
345
+ <li><code><?php esc_html_e( '"Apple, red", "Red, round, juicy. Isn\'t an <a href=\"http://example.com\">orange</a>.", "Red Delicious", 0.25, "RED_DELICIOUS", 5, "oz", 10, true', 'wp-e-commerce' ); ?></code></li>
346
  </ol>
347
  </td>
348
  </tr>
wpsc-admin/includes/settings-tabs/marketing.php CHANGED
@@ -13,7 +13,7 @@ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
13
  if ( $wpec_tracking ) {
14
  ?>
15
  <div class="error">
16
- <p><?php _e( '<strong>You appear to have Google Analytics for WordPress installed.</strong>. <br /> This is not a problem, however, you also appear to have the WPeC tracking enabled. We highly recommend disabling that setting and using the settings on this page.', 'wpsc' ); ?></p>
17
  </div>
18
  <?php
19
  }
@@ -53,49 +53,49 @@ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
53
 
54
  ?>
55
 
56
- <h3><?php esc_html_e( 'Marketing Settings', 'wpsc'); ?></h3>
57
  <table class='form-table'>
58
  <tr>
59
  <th>
60
- <?php esc_html_e( "'Users who bought this also bought'", 'wpsc' ); ?>
61
  </th>
62
  <td>
63
  <label>
64
  <input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
65
- <?php esc_html_e( "Add 'Users who bought this also bought' item to the single products page.", 'wpsc' ); ?>
66
  </label>
67
  </td>
68
  </tr>
69
  <tr>
70
  <th>
71
- <?php esc_html_e( "'Share This' Social Bookmarks", 'wpsc' ); ?>
72
  </th>
73
  <td>
74
  <label>
75
  <input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
76
- <?php esc_html_e( 'Add the \'Share this link\' item to the single products page.', 'wpsc' ); ?>
77
  </label>
78
  </td>
79
  </tr>
80
  <tr>
81
  <th>
82
- <?php esc_html_e( "'How Customer Found Us' Survey", 'wpsc' ) ?>
83
  </th>
84
  <td>
85
  <label>
86
  <input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
87
- <?php esc_html_e( 'Add the \'How did you find out about us\' drop-down option at checkout.', 'wpsc' ); ?>
88
  </label>
89
  </td>
90
  </tr>
91
  <tr>
92
  <th>
93
- <?php esc_html_e( "Facebook 'Like' Button", 'wpsc' ) ?>
94
  </th>
95
  <td>
96
  <input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
97
  <input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
98
- <?php esc_html_e( 'Add the Facebook Like button on your single products page.', 'wpsc' ); ?>
99
  </td>
100
  </tr>
101
  </table>
@@ -104,13 +104,13 @@ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
104
 
105
  public function rss_address_settings_form() {
106
  ?>
107
- <h3><?php esc_html_e( 'Product RSS Address', 'wpsc'); ?></h3>
108
- <p><?php esc_html_e( 'People can use this RSS feed to keep up to date with your product list.', 'wpsc' ); ?></p>
109
 
110
  <table class='form-table'>
111
  <tr>
112
  <th>
113
- <?php esc_html_e( 'RSS Feed Address', 'wpsc' ); ?>
114
  </th>
115
  <td>
116
  <?php $rss_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list' ), home_url( '/' ) ); ?>
@@ -123,13 +123,13 @@ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
123
 
124
  public function google_merch_center_settings_form() {
125
  ?>
126
- <h3><?php esc_html_e( 'Google Merchant Centre / Google Product Search', 'wpsc'); ?></h3>
127
- <p><?php printf( __( 'To import your products into <a href="%s" target="_blank">Google Merchant Centre</a> so that they appear within Google Product Search results, sign up for a Google Merchant Centre account and add a scheduled data feed with the following URL:', 'wpsc' ), 'http://www.google.com/merchants/' ); ?></p>
128
 
129
  <table class='form-table'>
130
  <tr>
131
  <th>
132
- <?php esc_html_e( 'Google Product Feed', 'wpsc' ); ?>
133
  </th>
134
  <td>
135
  <?php $google_feed_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list', 'xmlformat' => 'google' ), home_url( '/' ) ); ?>
@@ -142,69 +142,69 @@ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
142
 
143
  public function google_analytics_integration_settings_form() {
144
  ?>
145
- <h3><?php esc_html_e( 'Google Analytics E-Commerce Tracking', 'wpsc' ); ?></h3>
146
- <p><?php printf( __( 'Track successful transactions and items purchased in <a href="%s">Google Analytics</a>.', 'wpsc' ), 'http://www.google.com/analytics/' ); ?></p>
147
  <input type='hidden' name='change-settings' value='true' />
148
  <table class='form-table'>
149
  <tr>
150
  <th>
151
- <?php _e( 'Enable', 'wpsc' ); ?>
152
  </th>
153
  <td>
154
  <label>
155
  <input value='1' type='hidden' name='wpsc_ga_disable_tracking' />
156
  <input value='0' <?php checked( '0', get_option( 'wpsc_ga_disable_tracking' ) ); ?> type='checkbox' name='wpsc_ga_disable_tracking' />
157
- <?php _e( 'Enable Google Analytics tracking', 'wpsc' ); ?>
158
  </label>
159
- <p class='description'><?php _e( 'If, for whatever reason, you decide you do not want any tracking, disable it.', 'wpsc' ); ?></p>
160
  </td>
161
  </tr>
162
  <tr>
163
  <th>
164
- <?php _ex( 'Google Analytics Tracking ID', 'google analytics', 'wpsc' ); ?>
165
  </th>
166
  <td>
167
  <input value="<?php echo esc_attr( get_option( 'wpsc_ga_tracking_id' ) ); ?>" type='text' name='wpsc_ga_tracking_id' />
168
- <span class='description'><?php _e( 'e.g. <code>UA-XXXXX-Y</code>', 'wpsc' ); ?></span>
169
  </td>
170
  </tr>
171
  <tr>
172
  <th>
173
- <?php _e( 'Universal Analytics', 'wpsc' ); ?>
174
  </th>
175
  <td>
176
  <label>
177
  <input value="1" <?php checked( '1', get_option( 'wpsc_ga_use_universal' ) ); ?> type="checkbox" name="wpsc_ga_use_universal" />
178
- <?php printf( __( 'Use <a%s>Universal Analytics</a> tracking code', 'wpsc' ), ' href="https://support.google.com/analytics/answer/2790010?hl=en-GB&ref_topic=6010376" target="universal_analytics"' ); ?>
179
  </label>
180
  </td>
181
  </tr>
182
  <tr>
183
  <th>
184
- <?php _e( 'Tracking Code Present', 'wpsc' ); ?>
185
  </th>
186
  <td>
187
  <label>
188
  <input value='1' <?php checked( '1', get_option( 'wpsc_ga_currently_tracking' ) ); ?> type='checkbox' name='wpsc_ga_currently_tracking' />
189
- <?php _e( 'Google Analytics is tracking my site', 'wpsc' ); ?>
190
  </label>
191
- <p class='description'><?php printf( __( 'Enable this if the Google Analytics tracking code is already present on your site, e.g. manually placed your in your theme, or managed by another plugin. We will only insert the <a href="%s">E-Commerce tracking events</a> on the transaction results page.', 'wpsc' ), 'https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce'); ?></p>
192
  </td>
193
  </tr>
194
  <tr>
195
  <th>
196
- <?php _e( 'Advanced Mode', 'wpsc' ); ?>
197
  </th>
198
  <td>
199
  <label>
200
  <input value='1' <?php checked( '1', get_option( 'wpsc_ga_advanced' ) ); ?> type='checkbox' name='wpsc_ga_advanced' />
201
- <?php _e( 'Enable Advanced Mode', 'wpsc' ); ?>
202
  </label>
203
- <p class='description'><?php _e( 'By default, we insert the multiple-domain asynchronous tracking code. This should be fine for 99% of users. If you need to fine-tune it, select the Advanced option. Then, instead of simply entering your tracking ID, you will enter the enter tracking code from Google Analytics into the header.php file of your theme.', 'wpsc' ); ?></p>
204
  </td>
205
  </tr>
206
  </table>
207
  <?php
208
  }
209
 
210
- }
13
  if ( $wpec_tracking ) {
14
  ?>
15
  <div class="error">
16
+ <p><?php _e( '<strong>You appear to have Google Analytics for WordPress installed.</strong>. <br /> This is not a problem, however, you also appear to have the WPeC tracking enabled. We highly recommend disabling that setting and using the settings on this page.', 'wp-e-commerce' ); ?></p>
17
  </div>
18
  <?php
19
  }
53
 
54
  ?>
55
 
56
+ <h3><?php esc_html_e( 'Marketing Settings', 'wp-e-commerce'); ?></h3>
57
  <table class='form-table'>
58
  <tr>
59
  <th>
60
+ <?php esc_html_e( "'Users who bought this also bought'", 'wp-e-commerce' ); ?>
61
  </th>
62
  <td>
63
  <label>
64
  <input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
65
+ <?php esc_html_e( "Add 'Users who bought this also bought' item to the single products page.", 'wp-e-commerce' ); ?>
66
  </label>
67
  </td>
68
  </tr>
69
  <tr>
70
  <th>
71
+ <?php esc_html_e( "'Share This' Social Bookmarks", 'wp-e-commerce' ); ?>
72
  </th>
73
  <td>
74
  <label>
75
  <input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
76
+ <?php esc_html_e( 'Add the \'Share this link\' item to the single products page.', 'wp-e-commerce' ); ?>
77
  </label>
78
  </td>
79
  </tr>
80
  <tr>
81
  <th>
82
+ <?php esc_html_e( "'How Customer Found Us' Survey", 'wp-e-commerce' ) ?>
83
  </th>
84
  <td>
85
  <label>
86
  <input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
87
+ <?php esc_html_e( 'Add the \'How did you find out about us\' drop-down option at checkout.', 'wp-e-commerce' ); ?>
88
  </label>
89
  </td>
90
  </tr>
91
  <tr>
92
  <th>
93
+ <?php esc_html_e( "Facebook 'Like' Button", 'wp-e-commerce' ) ?>
94
  </th>
95
  <td>
96
  <input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
97
  <input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
98
+ <?php esc_html_e( 'Add the Facebook Like button on your single products page.', 'wp-e-commerce' ); ?>
99
  </td>
100
  </tr>
101
  </table>
104
 
105
  public function rss_address_settings_form() {
106
  ?>
107
+ <h3><?php esc_html_e( 'Product RSS Address', 'wp-e-commerce'); ?></h3>
108
+ <p><?php esc_html_e( 'People can use this RSS feed to keep up to date with your product list.', 'wp-e-commerce' ); ?></p>
109
 
110
  <table class='form-table'>
111
  <tr>
112
  <th>
113
+ <?php esc_html_e( 'RSS Feed Address', 'wp-e-commerce' ); ?>
114
  </th>
115
  <td>
116
  <?php $rss_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list' ), home_url( '/' ) ); ?>
123
 
124
  public function google_merch_center_settings_form() {
125
  ?>
126
+ <h3><?php esc_html_e( 'Google Merchant Centre / Google Product Search', 'wp-e-commerce'); ?></h3>
127
+ <p><?php printf( __( 'To import your products into <a href="%s" target="_blank">Google Merchant Centre</a> so that they appear within Google Product Search results, sign up for a Google Merchant Centre account and add a scheduled data feed with the following URL:', 'wp-e-commerce' ), 'http://www.google.com/merchants/' ); ?></p>
128
 
129
  <table class='form-table'>
130
  <tr>
131
  <th>
132
+ <?php esc_html_e( 'Google Product Feed', 'wp-e-commerce' ); ?>
133
  </th>
134
  <td>
135
  <?php $google_feed_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list', 'xmlformat' => 'google' ), home_url( '/' ) ); ?>
142
 
143
  public function google_analytics_integration_settings_form() {
144
  ?>
145
+ <h3><?php esc_html_e( 'Google Analytics E-Commerce Tracking', 'wp-e-commerce' ); ?></h3>
146
+ <p><?php printf( __( 'Track successful transactions and items purchased in <a href="%s">Google Analytics</a>.', 'wp-e-commerce' ), 'http://www.google.com/analytics/' ); ?></p>
147
  <input type='hidden' name='change-settings' value='true' />
148
  <table class='form-table'>
149
  <tr>
150
  <th>
151
+ <?php _e( 'Enable', 'wp-e-commerce' ); ?>
152
  </th>
153
  <td>
154
  <label>
155
  <input value='1' type='hidden' name='wpsc_ga_disable_tracking' />
156
  <input value='0' <?php checked( '0', get_option( 'wpsc_ga_disable_tracking' ) ); ?> type='checkbox' name='wpsc_ga_disable_tracking' />
157
+ <?php _e( 'Enable Google Analytics tracking', 'wp-e-commerce' ); ?>
158
  </label>
159
+ <p class='description'><?php _e( 'If, for whatever reason, you decide you do not want any tracking, disable it.', 'wp-e-commerce' ); ?></p>
160
  </td>
161
  </tr>
162
  <tr>
163
  <th>
164
+ <?php _ex( 'Google Analytics Tracking ID', 'google analytics', 'wp-e-commerce' ); ?>
165
  </th>
166
  <td>
167
  <input value="<?php echo esc_attr( get_option( 'wpsc_ga_tracking_id' ) ); ?>" type='text' name='wpsc_ga_tracking_id' />
168
+ <span class='description'><?php _e( 'e.g. <code>UA-XXXXX-Y</code>', 'wp-e-commerce' ); ?></span>
169
  </td>
170
  </tr>
171
  <tr>
172
  <th>
173
+ <?php _e( 'Universal Analytics', 'wp-e-commerce' ); ?>
174
  </th>
175
  <td>
176
  <label>
177
  <input value="1" <?php checked( '1', get_option( 'wpsc_ga_use_universal' ) ); ?> type="checkbox" name="wpsc_ga_use_universal" />
178
+ <?php printf( __( 'Use <a%s>Universal Analytics</a> tracking code', 'wp-e-commerce' ), ' href="https://support.google.com/analytics/answer/2790010?hl=en-GB&ref_topic=6010376" target="universal_analytics"' ); ?>
179
  </label>
180
  </td>
181
  </tr>
182
  <tr>
183
  <th>
184
+ <?php _e( 'Tracking Code Present', 'wp-e-commerce' ); ?>
185
  </th>
186
  <td>
187
  <label>
188
  <input value='1' <?php checked( '1', get_option( 'wpsc_ga_currently_tracking' ) ); ?> type='checkbox' name='wpsc_ga_currently_tracking' />
189
+ <?php _e( 'Google Analytics is tracking my site', 'wp-e-commerce' ); ?>
190
  </label>
191
+ <p class='description'><?php printf( __( 'Enable this if the Google Analytics tracking code is already present on your site, e.g. manually placed in your theme, or managed by another plugin. We will only insert the <a href="%s">E-Commerce tracking events</a> on the transaction results page.', 'wp-e-commerce' ), 'https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce'); ?></p>
192
  </td>
193
  </tr>
194
  <tr>
195
  <th>
196
+ <?php _e( 'Advanced Mode', 'wp-e-commerce' ); ?>
197
  </th>
198
  <td>
199
  <label>
200
  <input value='1' <?php checked( '1', get_option( 'wpsc_ga_advanced' ) ); ?> type='checkbox' name='wpsc_ga_advanced' />
201
+ <?php _e( 'Enable Advanced Mode', 'wp-e-commerce' ); ?>
202
  </label>
203
+ <p class='description'><?php _e( 'By default, we insert the multiple-domain asynchronous tracking code. This should be fine for 99% of users. If you need to fine-tune it, select the Advanced option. Then, instead of simply entering your tracking ID, you will enter the tracking code from Google Analytics into the header.php file of your theme.', 'wp-e-commerce' ); ?></p>
204
  </td>
205
  </tr>
206
  </table>
207
  <?php
208
  }
209
 
210
+ }
wpsc-admin/includes/settings-tabs/shipping.php CHANGED
@@ -18,11 +18,9 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
18
  public function no_shipping_notice() {
19
  if ( ! empty( $_GET['shipping_disabled'] ) ) {
20
  ?>
21
-
22
- <div class="error fade">
23
- <p><?php _e( '<strong>Shipping has been disabled.</strong> You enabled shipping but none of the shipping methods were selected. Please re-enable shipping, select and configure a shipping method, and then update your settings.', 'wpsc' ); ?></p>
24
  </div>
25
-
26
  <?php
27
  }
28
  }
@@ -78,20 +76,20 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
78
  $title = $selected_module->getName();
79
  $content = apply_filters( 'wpsc_shipping_module_settings_form', $selected_module->getForm(), $selected_module );
80
  } else {
81
- $title = __( 'Edit Shipping Module Settings', 'wpsc' );
82
- $content = __( 'To configure a shipping module select one on the left.', 'wpsc' );
83
  }
84
 
85
  ?>
86
- <div id='wpsc_shipping_settings_<?php esc_attr_e( $selected_module_id ); ?>_form' class='shipping-module-settings-form'>
87
  <table class='form-table'>
88
  <?php echo $content; ?>
89
  </table>
90
  <table class='form-table'>
91
  <tr><td colspan='2'>
92
  <p class="submit inline-edit-save">
93
- <a class="button edit-shipping-module-cancel" title="<?php esc_attr_e( "Cancel editing this shipping calculator's settings", 'wpsc' ) ?>"><?php esc_html_e( "Cancel", 'wpsc' ); ?></a>
94
- <input type="submit" name="submit" class="button button-primary edit-shipping-module-update" value='<?php _e( "Update &raquo;", 'wpsc' ); ?>'>
95
  </p>
96
  </td></tr>
97
  </table>
@@ -127,7 +125,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
127
 
128
  ?>
129
 
130
- <h3><?php esc_html_e( 'Shipping Settings', 'wpsc'); ?></h3>
131
  <input type='hidden' name='shipping_submits' value='true' />
132
  <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
133
  <input type='hidden' name='wpsc_admin_action' value='submit_options' />
@@ -137,38 +135,38 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
137
  wpsc_settings_page_update_notification();
138
  ?>
139
  <tr>
140
- <th scope="row"><?php _e( 'Use Shipping', 'wpsc' ); ?></th>
141
  <td>
142
  <input type='hidden' value='1' name='wpsc_options[do_not_use_shipping]' />
143
- <input type='checkbox' value='0' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping' <?php checked( '0', get_option( 'do_not_use_shipping' ) ); ?> /> <label for='do_not_use_shipping'><?php _e( 'Enable Shipping settings', 'wpsc' ); ?></label>
144
- <p class='description'><?php esc_html_e( 'If you are only selling digital downloads, you should turn this off.', 'wpsc' ); ?></p>
145
  </td>
146
  </tr>
147
 
148
  <tr>
149
- <th><?php esc_html_e( 'Shipping Origin City', 'wpsc' ); ?></th>
150
  <td>
151
- <input type='text' name='wpsc_options[base_city]' value='<?php esc_attr_e( get_option( 'base_city' ) ); ?>' />
152
- <p class='description'><?php esc_html_e( 'The name of the city where you fulfill and ship orders from. This enables us to give your customers more accurate shipping pricing.', 'wpsc' ); ?></p>
153
  </td>
154
  </tr>
155
  <tr>
156
- <th><?php esc_html_e( 'Shipping Origin Zipcode/Postcode', 'wpsc' ); ?></th>
157
  <td>
158
- <input type='text' name='wpsc_options[base_zipcode]' value='<?php esc_attr_e( get_option( 'base_zipcode' ) ); ?>' />
159
  <p class='description'>
160
- <?php esc_html_e( 'The zipcode/postcode for where you fulfill and ship orders from.', 'wpsc' ); ?><br />
161
- <?php esc_html_e( 'If you are based in the United States then this field is required in order for the UPS and USPS Shipping Calculators to work.', 'wpsc' ); ?>
162
  </p>
163
  </td>
164
  </tr>
165
  <tr>
166
- <th scope="row"><?php _e( 'Shipwire', 'wpsc' ); ?><span style='color: red;'></span></th>
167
  <td>
168
  <input type='hidden' value='0' name='wpsc_options[shipwire]' />
169
  <input type='checkbox' onclick='jQuery("#wpsc_shipwire_setting").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipwire]' id='shipwire' <?php checked( '1', get_option( 'shipwire' ) ); ?> />
170
- <label for='shipwire'><?php _e( 'Enable Shipwire Integration', 'wpsc' ); ?></label>
171
- <p class='description'><?php printf( __( '<a href="%1$s" target="_blank">Shipwire</a> provide e-commerce fulfillment warehouses. WP eCommerce can integrate stock inventory and shipping tracking with their service.', 'wpsc' ), 'http://www.shipwire.com/' ); ?></p>
172
  </td>
173
  </tr>
174
  <?php
@@ -188,21 +186,21 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
188
  <td>
189
  <table>
190
  <tr>
191
- <th><?php esc_html_e( 'Shipwire Email', 'wpsc' ); ?></th>
192
- <td><input type="text" name='wpsc_options[shipwireemail]' value="<?php esc_attr_e( get_option( 'shipwireemail' ) ); ?>" /></td>
193
  </tr>
194
  <tr>
195
- <th><?php esc_html_e( 'Shipwire Password', 'wpsc' ); ?></th>
196
- <td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php esc_attr_e( get_option( 'shipwirepassword' ) ); ?>" /></td>
197
  </tr>
198
  <tr>
199
- <th><?php esc_html_e( 'Use Test Server?', 'wpsc' ); ?></th>
200
  <td><input type="checkbox" name='wpsc_options[shipwire_test_server]' value="0" <?php checked( '1', get_option( 'shipwire_test_server', '0' ) ); ?> /></td>
201
  </tr>
202
  <tr>
203
- <th><?php esc_html_e( 'Force Sync with Shipwire', 'wpsc' ); ?></th>
204
  <td>
205
- <a class="shipwire_sync button"><?php esc_html_e( 'Update Tracking and Inventory', 'wpsc' ); ?></a>
206
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
207
  </td>
208
  </tr>
@@ -218,7 +216,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
218
  }
219
  ?>
220
  <tr>
221
- <th><?php _e( 'Free Shipping Discount', 'wpsc' ); ?></th>
222
  <td>
223
  <?php
224
  if ( get_option( 'shipping_discount' ) == 1 ) {
@@ -229,7 +227,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
229
  ?>
230
  <input type='hidden' value='0' name='wpsc_options[shipping_discount]' />
231
  <input type='checkbox' onclick='jQuery("#shipping_discount_value").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipping_discount]' id='shipping_discount' <?php checked( '1', get_option( 'shipping_discount' ) ); ?> />
232
- <label for='shipping_discount'><?php _e( 'Enable Free Shipping Discount', 'wpsc' ); ?></label>
233
 
234
  </td>
235
  </tr>
@@ -241,33 +239,33 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
241
  ?>
242
  <div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
243
 
244
- <?php printf( __( 'Sales over or equal to %1$s<input type="text" size="6" name="wpsc_options[shipping_discount_value]" value="%2$s" id="shipping_discount_value" /> will receive free shipping.', 'wpsc' ), $currency_sign, esc_attr( $value ) ); ?>
245
  </div>
246
  </td>
247
  </tr>
248
  </table>
249
 
250
- <?php submit_button( __( 'Save Changes' ) ); ?>
251
 
252
- <h3><?php _e( 'Shipping Modules', 'wpsc' ) ?></h3>
253
- <p class='description'><?php _e( 'To enable shipping in WP eCommerce you must select which shipping methods you want to enable on your site.', 'wpsc' ); ?></p>
254
  <p class='description'>
255
- <strong><?php _e( 'Tip', 'wpsc' ); ?></strong>:
256
- <?php printf( __( 'For fixed-price shipping options such as "Pickup - $0, Overnight - $10, Same day - $20, etc.", install our free <a href="%1$s">Fixed Rate Shipping</a> plugin.', 'wpsc' ), 'http://wordpress.org/extend/plugins/wp-e-commerce-fixed-rate-shipping/' ); ?>
257
  </p>
258
 
259
- <h4><?php _e( 'Internal Shipping Calculators', 'wpsc' ); ?></h4>
260
  <table id='wpsc-shipping-options-internal' class='wpsc-edit-module-options wp-list-table widefat plugins'>
261
  <thead>
262
  <tr>
263
- <th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php _e( 'Active', 'wpsc' ); ?></th>
264
- <th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wpsc' ); ?></th>
265
  </tr>
266
  </thead>
267
  <tfoot>
268
  <tr>
269
- <th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php _e( 'Active', 'wpsc' ); ?></th>
270
- <th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wpsc' ); ?></th>
271
  </tr>
272
  </tfoot>
273
  <tbody>
@@ -279,25 +277,25 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
279
  ?>
280
  </tbody>
281
  </table>
282
- <?php submit_button( __( 'Save Changes' ) ); ?>
283
 
284
- <h4><?php _e( 'External Shipping Calculators', 'wpsc' ); ?></h4>
285
  <?php if ( ! function_exists( 'curl_init' ) ) : ?>
286
  <p style='color: red; font-size:8pt; line-height:10pt;'>
287
- <?php _e( 'The following shipping modules all need cURL which is not installed on this server, you may need to contact your web hosting provider to get it set up. ', 'wpsc' ); ?>
288
  </p>
289
  <?php endif; ?>
290
  <table id='wpsc-shipping-options-external' class='wpsc-edit-module-options wp-list-table widefat plugins'>
291
  <thead>
292
  <tr>
293
- <th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php _e( 'Active', 'wpsc' ); ?></th>
294
- <th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wpsc' ); ?></th>
295
  </tr>
296
  </thead>
297
  <tfoot>
298
  <tr>
299
- <th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php _e( 'Active', 'wpsc' ); ?></th>
300
- <th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wpsc' ); ?></th>
301
  </tr>
302
  </tfoot>
303
  <tbody>
@@ -330,7 +328,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
330
  <label for='<?php echo $shipping->getInternalName(); ?>_id'><strong><?php echo $shipping->getName(); ?></strong></label>
331
  <div class="row-actions-visible">
332
  <span class="edit">
333
- <a class='edit-shipping-module' data-module-id="<?php echo $shipping->getInternalName(); ?>" title="<?php esc_attr_e( 'Edit this Shipping Module', 'wpsc' ); ?>" href='<?php echo esc_url( $this->get_shipping_module_url( $shipping ) ); ?>'><?php _ex( 'Settings', 'Shipping modules link to individual settings', 'wpsc' ); ?>
334
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
335
  </span>
336
  </div>
18
  public function no_shipping_notice() {
19
  if ( ! empty( $_GET['shipping_disabled'] ) ) {
20
  ?>
21
+ <div class="notice error is-dismissible below-h2">
22
+ <p><?php _e( '<strong>Shipping has been disabled.</strong> You enabled shipping but none of the shipping methods were selected. Please re-enable shipping, select and configure a shipping method, and then update your settings.', 'wp-e-commerce' ); ?></p>
 
23
  </div>
 
24
  <?php
25
  }
26
  }
76
  $title = $selected_module->getName();
77
  $content = apply_filters( 'wpsc_shipping_module_settings_form', $selected_module->getForm(), $selected_module );
78
  } else {
79
+ $title = __( 'Edit Shipping Module Settings', 'wp-e-commerce' );
80
+ $content = __( 'To configure a shipping module select one on the left.', 'wp-e-commerce' );
81
  }
82
 
83
  ?>
84
+ <div id='wpsc_shipping_settings_<?php echo esc_attr( $selected_module_id ); ?>_form' class='shipping-module-settings-form'>
85
  <table class='form-table'>
86
  <?php echo $content; ?>
87
  </table>
88
  <table class='form-table'>
89
  <tr><td colspan='2'>
90
  <p class="submit inline-edit-save">
91
+ <a class="button edit-shipping-module-cancel" title="<?php esc_attr_e( "Cancel editing this shipping calculator's settings", 'wp-e-commerce' ) ?>"><?php esc_html_e( "Cancel", 'wp-e-commerce' ); ?></a>
92
+ <input type="submit" name="submit" class="button button-primary edit-shipping-module-update" value='<?php _e( "Update &raquo;", 'wp-e-commerce' ); ?>'>
93
  </p>
94
  </td></tr>
95
  </table>
125
 
126
  ?>
127
 
128
+ <h3><?php esc_html_e( 'Shipping Settings', 'wp-e-commerce'); ?></h3>
129
  <input type='hidden' name='shipping_submits' value='true' />
130
  <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
131
  <input type='hidden' name='wpsc_admin_action' value='submit_options' />
135
  wpsc_settings_page_update_notification();
136
  ?>
137
  <tr>
138
+ <th scope="row"><?php _e( 'Use Shipping', 'wp-e-commerce' ); ?></th>
139
  <td>
140
  <input type='hidden' value='1' name='wpsc_options[do_not_use_shipping]' />
141
+ <input type='checkbox' value='0' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping' <?php checked( '0', get_option( 'do_not_use_shipping' ) ); ?> /> <label for='do_not_use_shipping'><?php _e( 'Enable Shipping settings', 'wp-e-commerce' ); ?></label>
142
+ <p class='description'><?php esc_html_e( 'If you are only selling digital downloads, you should turn this off.', 'wp-e-commerce' ); ?></p>
143
  </td>
144
  </tr>
145
 
146
  <tr>
147
+ <th><?php esc_html_e( 'Shipping Origin City', 'wp-e-commerce' ); ?></th>
148
  <td>
149
+ <input type='text' name='wpsc_options[base_city]' value='<?php echo esc_attr( get_option( 'base_city' ) ); ?>' />
150
+ <p class='description'><?php esc_html_e( 'The name of the city where you fulfill and ship orders from. This enables us to give your customers more accurate shipping pricing.', 'wp-e-commerce' ); ?></p>
151
  </td>
152
  </tr>
153
  <tr>
154
+ <th><?php esc_html_e( 'Shipping Origin Zipcode/Postcode', 'wp-e-commerce' ); ?></th>
155
  <td>
156
+ <input type='text' name='wpsc_options[base_zipcode]' value='<?php echo esc_attr( get_option( 'base_zipcode' ) ); ?>' />
157
  <p class='description'>
158
+ <?php esc_html_e( 'The ZIP code / Postal code from where you fulfill and ship orders.', 'wp-e-commerce' ); ?><br />
159
+ <?php esc_html_e( 'If you are based in the United States, then this field is required in order for the UPS and USPS Shipping Calculators to work.', 'wp-e-commerce' ); ?>
160
  </p>
161
  </td>
162
  </tr>
163
  <tr>
164
+ <th scope="row"><?php _e( 'Shipwire', 'wp-e-commerce' ); ?><span style='color: red;'></span></th>
165
  <td>
166
  <input type='hidden' value='0' name='wpsc_options[shipwire]' />
167
  <input type='checkbox' onclick='jQuery("#wpsc_shipwire_setting").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipwire]' id='shipwire' <?php checked( '1', get_option( 'shipwire' ) ); ?> />
168
+ <label for='shipwire'><?php _e( 'Enable Shipwire Integration', 'wp-e-commerce' ); ?></label>
169
+ <p class='description'><?php printf( __( '<a href="%1$s" target="_blank">Shipwire</a> provide e-commerce fulfillment warehouses. WP eCommerce can integrate stock inventory and shipping tracking with their service.', 'wp-e-commerce' ), 'http://www.shipwire.com/pp/o.php?id=11922' ); ?></p>
170
  </td>
171
  </tr>
172
  <?php
186
  <td>
187
  <table>
188
  <tr>
189
+ <th><?php esc_html_e( 'Shipwire Email', 'wp-e-commerce' ); ?></th>
190
+ <td><input type="text" name='wpsc_options[shipwireemail]' value="<?php echo esc_attr( get_option( 'shipwireemail' ) ); ?>" /></td>
191
  </tr>
192
  <tr>
193
+ <th><?php esc_html_e( 'Shipwire Password', 'wp-e-commerce' ); ?></th>
194
+ <td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php echo esc_attr( get_option( 'shipwirepassword' ) ); ?>" /></td>
195
  </tr>
196
  <tr>
197
+ <th><?php esc_html_e( 'Use Test Server?', 'wp-e-commerce' ); ?></th>
198
  <td><input type="checkbox" name='wpsc_options[shipwire_test_server]' value="0" <?php checked( '1', get_option( 'shipwire_test_server', '0' ) ); ?> /></td>
199
  </tr>
200
  <tr>
201
+ <th><?php esc_html_e( 'Force Sync with Shipwire', 'wp-e-commerce' ); ?></th>
202
  <td>
203
+ <a class="shipwire_sync button"><?php esc_html_e( 'Update Tracking and Inventory', 'wp-e-commerce' ); ?></a>
204
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
205
  </td>
206
  </tr>
216
  }
217
  ?>
218
  <tr>
219
+ <th><?php _e( 'Free Shipping Discount', 'wp-e-commerce' ); ?></th>
220
  <td>
221
  <?php
222
  if ( get_option( 'shipping_discount' ) == 1 ) {
227
  ?>
228
  <input type='hidden' value='0' name='wpsc_options[shipping_discount]' />
229
  <input type='checkbox' onclick='jQuery("#shipping_discount_value").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipping_discount]' id='shipping_discount' <?php checked( '1', get_option( 'shipping_discount' ) ); ?> />
230
+ <label for='shipping_discount'><?php _e( 'Enable Free Shipping Discount', 'wp-e-commerce' ); ?></label>
231
 
232
  </td>
233
  </tr>
239
  ?>
240
  <div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
241
 
242
+ <?php printf( __( 'Sales over or equal to %1$s<input type="text" size="6" name="wpsc_options[shipping_discount_value]" value="%2$s" id="shipping_discount_value" /> will receive free shipping.', 'wp-e-commerce' ), $currency_sign, esc_attr( $value ) ); ?>
243
  </div>
244
  </td>
245
  </tr>
246
  </table>
247
 
248
+ <?php submit_button( __( 'Save Changes', 'wp-e-commerce' ) ); ?>
249
 
250
+ <h3><?php _e( 'Shipping Modules', 'wp-e-commerce' ) ?></h3>
251
+ <p class='description'><?php _e( 'To enable shipping in WP eCommerce you must select which shipping methods you want to enable on your site.', 'wp-e-commerce' ); ?></p>
252
  <p class='description'>
253
+ <strong><?php _e( 'Tip', 'wp-e-commerce' ); ?></strong>:
254
+ <?php printf( __( 'For fixed-price shipping options such as "Pickup - $0, Overnight - $10, Same day - $20, etc.", install our free <a href="%1$s">Fixed Rate Shipping</a> plugin.', 'wp-e-commerce' ), 'http://wordpress.org/extend/plugins/wp-e-commerce-fixed-rate-shipping/' ); ?>
255
  </p>
256
 
257
+ <h4><?php _e( 'Internal Shipping Calculators', 'wp-e-commerce' ); ?></h4>
258
  <table id='wpsc-shipping-options-internal' class='wpsc-edit-module-options wp-list-table widefat plugins'>
259
  <thead>
260
  <tr>
261
+ <th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
262
+ <th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
263
  </tr>
264
  </thead>
265
  <tfoot>
266
  <tr>
267
+ <th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
268
+ <th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
269
  </tr>
270
  </tfoot>
271
  <tbody>
277
  ?>
278
  </tbody>
279
  </table>
280
+ <?php submit_button( __( 'Save Changes', 'wp-e-commerce' ) ); ?>
281
 
282
+ <h4><?php _e( 'External Shipping Calculators', 'wp-e-commerce' ); ?></h4>
283
  <?php if ( ! function_exists( 'curl_init' ) ) : ?>
284
  <p style='color: red; font-size:8pt; line-height:10pt;'>
285
+ <?php _e( 'The following shipping modules all need cURL which is not installed on this server. You may need to contact your web hosting provider to get it set up. ', 'wp-e-commerce' ); ?>
286
  </p>
287
  <?php endif; ?>
288
  <table id='wpsc-shipping-options-external' class='wpsc-edit-module-options wp-list-table widefat plugins'>
289
  <thead>
290
  <tr>
291
+ <th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
292
+ <th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
293
  </tr>
294
  </thead>
295
  <tfoot>
296
  <tr>
297
+ <th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php _e( 'Active', 'wp-e-commerce' ); ?></th>
298
+ <th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php _e( 'Shipping Calculator', 'wp-e-commerce' ); ?></th>
299
  </tr>
300
  </tfoot>
301
  <tbody>
328
  <label for='<?php echo $shipping->getInternalName(); ?>_id'><strong><?php echo $shipping->getName(); ?></strong></label>
329
  <div class="row-actions-visible">
330
  <span class="edit">
331
+ <a class='edit-shipping-module' data-module-id="<?php echo $shipping->getInternalName(); ?>" title="<?php esc_attr_e( 'Edit this Shipping Module', 'wp-e-commerce' ); ?>" href='<?php echo esc_url( $this->get_shipping_module_url( $shipping ) ); ?>'><?php _ex( 'Settings', 'Shipping modules link to individual settings', 'wp-e-commerce' ); ?>
332
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
333
  </span>
334
  </div>
wpsc-admin/includes/settings-tabs/taxes.php CHANGED
@@ -75,49 +75,49 @@ class WPSC_Settings_Tab_Taxes extends WPSC_Settings_Tab {
75
  $wpec_taxes_options = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_options();
76
 
77
  ?>
78
- <h3><?php esc_html_e( 'Tax Settings', 'wpsc' ); ?></h3>
79
  <table class='form-table'>
80
  <tr>
81
- <th><?php esc_html_e( "Enable Tax", 'wpsc' ); ?></th>
82
  <td>
83
  <input <?php if ( $wpec_taxes_options['wpec_taxes_enabled'] ) echo 'checked="checked"'; ?> type="checkbox" id='wpec_taxes_enabled' name='wpsc_options[wpec_taxes_enabled]' />
84
  <label for='wpec_taxes_enabled'>
85
- <?php esc_html_e( 'Turn tax on', 'wpsc' ); ?>
86
  </label>
87
  </td>
88
  </tr>
89
  <tr>
90
- <th><?php esc_html_e( "Product Prices", 'wpsc' ); ?></th>
91
  <td>
92
  <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'exclusive' ) echo 'checked="checked"'; ?> type="radio" value='exclusive' id='wpec_taxes_inprice1' name='wpsc_options[wpec_taxes_inprice]' />
93
  <label for='wpec_taxes_inprice1'>
94
- <?php esc_html_e( 'Product prices are tax exclusive - add tax to the price during checkout', 'wpsc' ); ?>
95
  </label><br />
96
  <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'inclusive' ) echo 'checked="checked"'; ?> type="radio" value='inclusive' id='wpec_taxes_inprice2' name='wpsc_options[wpec_taxes_inprice]' />
97
  <label for='wpec_taxes_inprice2'>
98
- <?php esc_html_e( "Product prices are tax inclusive - during checkout the total price doesn't increase but tax is shown as a line item", 'wpsc' ); ?>
99
  </label>
100
  </td>
101
  </tr>
102
  <tr>
103
- <th><?php esc_html_e( 'Product Specific Tax', 'wpsc' ); ?></th>
104
  <td>
105
  <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'add' ) echo 'checked="checked"'; ?> type="radio" value='add' id='wpec_taxes_product_1' name='wpsc_options[wpec_taxes_product]' />
106
  <label for='wpec_taxes_product_1'>
107
- <?php esc_html_e( 'Add per product tax to tax percentage if product has a specific tax rate', 'wpsc' ); ?>
108
  </label><br />
109
  <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'replace' ) echo 'checked="checked"'; ?> type="radio" value='replace' id='wpec_taxes_product_2' name='wpsc_options[wpec_taxes_product]' />
110
  <label for='wpec_taxes_product_2'>
111
- <?php esc_html_e( 'Replace tax percentage with product specific tax rate', 'wpsc' ); ?>
112
  </label>
113
  </td>
114
  </tr>
115
  <tr>
116
- <th><?php _e( 'Tax Logic', 'wpsc' ); ?></th>
117
  <td>
118
  <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' ) echo 'checked="checked"'; ?> type="radio" value='billing_shipping' id='wpec_taxes_logic_1' name='wpsc_options[wpec_taxes_logic]' />
119
  <label for='wpec_taxes_logic_1'>
120
- <?php esc_html_e( 'Apply tax when Billing and Shipping Region is the same as Tax Rate', 'wpsc' ); ?>
121
  </label>
122
  <div id='billing_shipping_preference_container' style='margin-left: 20px;'>
123
  <?php
@@ -125,37 +125,37 @@ class WPSC_Settings_Tab_Taxes extends WPSC_Settings_Tab {
125
  ?>
126
  <input <?php echo $checked;?> type="radio" value='billing_address' id='wpec_billing_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
127
  <label for='wpec_billing_preference'>
128
- <?php esc_html_e( 'Apply tax to Billing Address', 'wpsc' ); ?>
129
  </label><br />
130
  <?php
131
  $checked = ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'shipping_address' ? 'checked="checked"' : '' );
132
  ?>
133
  <input <?php echo $checked; ?>type="radio" value='shipping_address' id='wpec_shipping_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
134
  <label for='wpec_shipping_preference'>
135
- <?php esc_html_e( 'Apply tax to Shipping Address', 'wpsc' ); ?>
136
  </label>
137
  </div>
138
  <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing' ) echo 'checked="checked"'; ?> type="radio" value='billing' id='wpec_taxes_logic_2' name='wpsc_options[wpec_taxes_logic]' />
139
  <label for='wpec_taxes_logic_2'>
140
- <?php esc_html_e( 'Apply tax when Billing Region is the same as Tax Rate', 'wpsc' ); ?>
141
  </label><br />
142
  <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'shipping' ) echo 'checked="checked"'; ?> type="radio" value='shipping' id='wpec_taxes_logic_3' name='wpsc_options[wpec_taxes_logic]' />
143
  <label for='wpec_taxes_logic_3'>
144
- <?php esc_html_e( 'Apply tax when Shipping Region is the same as Tax Rate', 'wpsc' ); ?>
145
  </label>
146
  </td>
147
  </tr>
148
  </table>
149
 
150
- <h3><?php esc_html_e( 'Tax Rates', 'wpsc' ); ?></h3>
151
  <div id='wpec-taxes-rates'>
152
  <!--Start Taxes Output-->
153
  <table class='widefat page fixed ui-sortable'>
154
  <thead>
155
- <th scope='col' width='60%'><?php _e( 'Market', 'wpsc' ); ?></th>
156
- <th scope='col' width='10%'><?php _e( 'Tax Rate', 'wpsc' ); ?></th>
157
- <th scope='col'><?php _e( 'Tax Shipping?', 'wpsc' ); ?></th>
158
- <th scope='col' style='width: 60px'><?php _e( 'Actions', 'wpsc' ); ?></th>
159
  </thead>
160
  <tbody>
161
  <?php
@@ -178,22 +178,22 @@ class WPSC_Settings_Tab_Taxes extends WPSC_Settings_Tab {
178
  <!--End Taxes Output-->
179
  </div>
180
  <div id='wpec-taxes-bands-container'>
181
- <h3><?php esc_html_e( 'Tax Bands', 'wpsc' ); ?></h3>
182
  <div id='wpec-taxes-bands'>
183
  <div class="updated inline">
184
- <p><?php _e( 'Note: Tax Bands are special tax rules you can create and apply on a per-product basis. Please visit the product page to apply your Tax Band.', 'wpsc' ); ?></p>
185
  </div>
186
  <?php if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) : ?>
187
  <div class="error inline">
188
- <p><?php _e( 'Warning: Tax Bands do not take effect when product prices are tax exclusive.', 'wpsc' ); ?></p>
189
  </div>
190
  <?php endif; ?>
191
  <table class='widefat page fixed ui-sortable'>
192
  <thead>
193
- <th scope='col'><?php _e( 'Band Name', 'wpsc' ); ?></th>
194
- <th scope='col' width="50%"><?php _e( 'Market', 'wpsc' ); ?></th>
195
- <th scope='col' width='20%'><?php _e( 'Tax Rate', 'wpsc' ); ?></th>
196
- <th scope='col' style='width: 60px'><?php _e( 'Actions', 'wpsc' ); ?></th>
197
  </thead>
198
  <tbody>
199
  <?php
75
  $wpec_taxes_options = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_options();
76
 
77
  ?>
78
+ <h3><?php esc_html_e( 'Tax Settings', 'wp-e-commerce' ); ?></h3>
79
  <table class='form-table'>
80
  <tr>
81
+ <th><?php esc_html_e( "Enable Tax", 'wp-e-commerce' ); ?></th>
82
  <td>
83
  <input <?php if ( $wpec_taxes_options['wpec_taxes_enabled'] ) echo 'checked="checked"'; ?> type="checkbox" id='wpec_taxes_enabled' name='wpsc_options[wpec_taxes_enabled]' />
84
  <label for='wpec_taxes_enabled'>
85
+ <?php esc_html_e( 'Turn tax on', 'wp-e-commerce' ); ?>
86
  </label>
87
  </td>
88
  </tr>
89
  <tr>
90
+ <th><?php esc_html_e( "Product Prices", 'wp-e-commerce' ); ?></th>
91
  <td>
92
  <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'exclusive' ) echo 'checked="checked"'; ?> type="radio" value='exclusive' id='wpec_taxes_inprice1' name='wpsc_options[wpec_taxes_inprice]' />
93
  <label for='wpec_taxes_inprice1'>
94
+ <?php esc_html_e( 'Product prices are tax exclusive - add tax to the price during checkout', 'wp-e-commerce' ); ?>
95
  </label><br />
96
  <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'inclusive' ) echo 'checked="checked"'; ?> type="radio" value='inclusive' id='wpec_taxes_inprice2' name='wpsc_options[wpec_taxes_inprice]' />
97
  <label for='wpec_taxes_inprice2'>
98
+ <?php esc_html_e( "Product prices are tax inclusive - during checkout the total price doesn't increase but tax is shown as a line item", 'wp-e-commerce' ); ?>
99
  </label>
100
  </td>
101
  </tr>
102
  <tr>
103
+ <th><?php esc_html_e( 'Product Specific Tax', 'wp-e-commerce' ); ?></th>
104
  <td>
105
  <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'add' ) echo 'checked="checked"'; ?> type="radio" value='add' id='wpec_taxes_product_1' name='wpsc_options[wpec_taxes_product]' />
106
  <label for='wpec_taxes_product_1'>
107
+ <?php esc_html_e( 'Add per product tax to tax percentage if product has a specific tax rate', 'wp-e-commerce' ); ?>
108
  </label><br />
109
  <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'replace' ) echo 'checked="checked"'; ?> type="radio" value='replace' id='wpec_taxes_product_2' name='wpsc_options[wpec_taxes_product]' />
110
  <label for='wpec_taxes_product_2'>
111
+ <?php esc_html_e( 'Replace tax percentage with product specific tax rate', 'wp-e-commerce' ); ?>
112
  </label>
113
  </td>
114
  </tr>
115
  <tr>
116
+ <th><?php _e( 'Tax Logic', 'wp-e-commerce' ); ?></th>
117
  <td>
118
  <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' ) echo 'checked="checked"'; ?> type="radio" value='billing_shipping' id='wpec_taxes_logic_1' name='wpsc_options[wpec_taxes_logic]' />
119
  <label for='wpec_taxes_logic_1'>
120
+ <?php esc_html_e( 'Apply tax when Billing and Shipping Region is the same as Tax Rate', 'wp-e-commerce' ); ?>
121
  </label>
122
  <div id='billing_shipping_preference_container' style='margin-left: 20px;'>
123
  <?php
125
  ?>
126
  <input <?php echo $checked;?> type="radio" value='billing_address' id='wpec_billing_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
127
  <label for='wpec_billing_preference'>
128
+ <?php esc_html_e( 'Apply tax to Billing Address', 'wp-e-commerce' ); ?>
129
  </label><br />
130
  <?php
131
  $checked = ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'shipping_address' ? 'checked="checked"' : '' );
132
  ?>
133
  <input <?php echo $checked; ?>type="radio" value='shipping_address' id='wpec_shipping_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
134
  <label for='wpec_shipping_preference'>
135
+ <?php esc_html_e( 'Apply tax to Shipping Address', 'wp-e-commerce' ); ?>
136
  </label>
137
  </div>
138
  <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing' ) echo 'checked="checked"'; ?> type="radio" value='billing' id='wpec_taxes_logic_2' name='wpsc_options[wpec_taxes_logic]' />
139
  <label for='wpec_taxes_logic_2'>
140
+ <?php esc_html_e( 'Apply tax when Billing Region is the same as Tax Rate', 'wp-e-commerce' ); ?>
141
  </label><br />
142
  <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'shipping' ) echo 'checked="checked"'; ?> type="radio" value='shipping' id='wpec_taxes_logic_3' name='wpsc_options[wpec_taxes_logic]' />
143
  <label for='wpec_taxes_logic_3'>
144
+ <?php esc_html_e( 'Apply tax when Shipping Region is the same as Tax Rate', 'wp-e-commerce' ); ?>
145
  </label>
146
  </td>
147
  </tr>
148
  </table>
149
 
150
+ <h3><?php esc_html_e( 'Tax Rates', 'wp-e-commerce' ); ?></h3>
151
  <div id='wpec-taxes-rates'>
152
  <!--Start Taxes Output-->
153
  <table class='widefat page fixed ui-sortable'>
154
  <thead>
155
+ <th scope='col' width='60%'><?php _e( 'Market', 'wp-e-commerce' ); ?></th>
156
+ <th scope='col' width='10%'><?php _e( 'Tax Rate', 'wp-e-commerce' ); ?></th>
157
+ <th scope='col'><?php _e( 'Tax Shipping?', 'wp-e-commerce' ); ?></th>
158
+ <th scope='col' style='width: 60px'><?php _e( 'Actions', 'wp-e-commerce' ); ?></th>
159
  </thead>
160
  <tbody>
161
  <?php
178
  <!--End Taxes Output-->
179
  </div>
180
  <div id='wpec-taxes-bands-container'>
181
+ <h3><?php esc_html_e( 'Tax Bands', 'wp-e-commerce' ); ?></h3>
182
  <div id='wpec-taxes-bands'>
183
  <div class="updated inline">
184
+ <p><?php _e( 'Note: Tax Bands are special tax rules you can create and apply on a per-product basis. Please visit the product page to apply your Tax Band.', 'wp-e-commerce' ); ?></p>
185
  </div>
186
  <?php if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) : ?>
187
  <div class="error inline">
188
+ <p><?php _e( 'Warning: Tax Bands do not take effect when product prices are tax exclusive.', 'wp-e-commerce' ); ?></p>
189
  </div>
190
  <?php endif; ?>
191
  <table class='widefat page fixed ui-sortable'>
192
  <thead>
193
+ <th scope='col'><?php _e( 'Band Name', 'wp-e-commerce' ); ?></th>
194
+ <th scope='col' width="50%"><?php _e( 'Market', 'wp-e-commerce' ); ?></th>
195
+ <th scope='col' width='20%'><?php _e( 'Tax Rate', 'wp-e-commerce' ); ?></th>
196
+ <th scope='col' style='width: 60px'><?php _e( 'Actions', 'wp-e-commerce' ); ?></th>
197
  </thead>
198
  <tbody>
199
  <?php
wpsc-admin/includes/tax_and_shipping.php CHANGED
@@ -1,21 +1,22 @@
1
  <?php
2
-
3
  /**
4
  * The HTML outputting the tax and shipping form
5
- *
6
  * @package wp-e-commerce
7
- */
 
 
8
  global $wpdb;
9
  $changes_made = false;
10
  $country_isocode = preg_match( "/[a-zA-Z]{2,4}/", $_GET['isocode'] ) ? $_GET['isocode'] : get_option( 'base_country' );
11
  $base_region = get_option('base_region');
12
  ?>
13
  <div class="wrap">
14
- <h2><?php esc_html_e( 'GST/Tax Rate', 'wpsc' );?></h2>
15
  <?php
16
  if($changes_made === true)
17
  {
18
- echo esc_html__( 'Thanks, your changes have been made', 'wpsc' ) . "<br />";
19
  }
20
  ?>
21
  <form action='' method='post' name='regional_tax' class='wpsc_form_track'>
@@ -25,7 +26,7 @@ $base_region = get_option('base_region');
25
  {
26
  $region_data = $wpdb->get_results("SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."` WHERE `".WPSC_TABLE_REGION_TAX."`.`country_id` IN('".$country_data['id']."') ",ARRAY_A) ;
27
  $region_data = array_chunk($region_data, 14);
28
-
29
  echo "<table>\n\r";
30
  echo " <tr>\n\r";
31
  foreach($region_data as $region_col)
@@ -46,7 +47,7 @@ $base_region = get_option('base_region');
46
  }
47
  echo " <td><input type='text' id='region_tax_".$region['id']."' name='region_tax[".$region['id']."]' value='".$tax_percentage."' class='tax_forms' size='2'/>%</td>\n\r";
48
  echo " </tr>\n\r";
49
- }
50
  echo "</table>\n\r";
51
  echo " </td>\n\r";
52
  }
@@ -56,11 +57,11 @@ $base_region = get_option('base_region');
56
  else
57
  {
58
  $tax_percentage = $country_data['tax'];
59
- echo "<label for='country_tax'>" . esc_html__( 'Tax Rate', 'wpsc' ) .":</label> ";
60
  echo "<input type='text' id='country_tax' name='country_tax' value='".$tax_percentage."' class='tax_forms' maxlength='3' size='3'/>%";
61
  }
62
  ?>
63
  <input type='hidden' name='wpsc_admin_action' value='change_region_tax' />
64
- <input class='button-secondary' type='submit' name='submit' value='<?php esc_attr_e( 'Save Changes', 'wpsc' );?>' />
65
  </form>
66
  </div>
1
  <?php
 
2
  /**
3
  * The HTML outputting the tax and shipping form
4
+ *
5
  * @package wp-e-commerce
6
+ * @since 3.8
7
+ */
8
+
9
  global $wpdb;
10
  $changes_made = false;
11
  $country_isocode = preg_match( "/[a-zA-Z]{2,4}/", $_GET['isocode'] ) ? $_GET['isocode'] : get_option( 'base_country' );
12
  $base_region = get_option('base_region');
13
  ?>
14
  <div class="wrap">
15
+ <h2><?php esc_html_e( 'GST/Tax Rate', 'wp-e-commerce' );?></h2>
16
  <?php
17
  if($changes_made === true)
18
  {
19
+ echo esc_html__( 'Thanks, your changes have been made', 'wp-e-commerce' ) . "<br />";
20
  }
21
  ?>
22
  <form action='' method='post' name='regional_tax' class='wpsc_form_track'>
26
  {
27
  $region_data = $wpdb->get_results("SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."` WHERE `".WPSC_TABLE_REGION_TAX."`.`country_id` IN('".$country_data['id']."') ",ARRAY_A) ;
28
  $region_data = array_chunk($region_data, 14);
29
+
30
  echo "<table>\n\r";
31
  echo " <tr>\n\r";
32
  foreach($region_data as $region_col)
47
  }
48
  echo " <td><input type='text' id='region_tax_".$region['id']."' name='region_tax[".$region['id']."]' value='".$tax_percentage."' class='tax_forms' size='2'/>%</td>\n\r";
49
  echo " </tr>\n\r";
50
+ }
51
  echo "</table>\n\r";
52
  echo " </td>\n\r";
53
  }
57
  else
58
  {
59
  $tax_percentage = $country_data['tax'];
60
+ echo "<label for='country_tax'>" . esc_html__( 'Tax Rate', 'wp-e-commerce' ) .":</label> ";
61
  echo "<input type='text' id='country_tax' name='country_tax' value='".$tax_percentage."' class='tax_forms' maxlength='3' size='3'/>%";
62
  }
63
  ?>
64
  <input type='hidden' name='wpsc_admin_action' value='change_region_tax' />
65
+ <input class='button-secondary' type='submit' name='submit' value='<?php esc_attr_e( 'Save Changes', 'wp-e-commerce' );?>' />
66
  </form>
67
  </div>
wpsc-admin/includes/updating-functions.php CHANGED
@@ -46,11 +46,11 @@ class WPSC_Update {
46
  do_action( 'wpsc_update_timeout_terminate' );
47
  $location = remove_query_arg( array( 'start_over', 'eta', 'current_percent' ) );
48
  $location = add_query_arg( 'run_updates', 1, $location );
49
- $location = esc_url( apply_filters( 'wpsc_update_terminate_location', $location ) );
50
  ?>
51
- <script type="text/javascript">
52
- location.href = "<?php echo $location; ?>"
53
- </script>
54
  <?php
55
  exit;
56
  }
@@ -113,17 +113,17 @@ class WPSC_Update_Progress {
113
  $location = add_query_arg( 'eta', $this->eta, $location );
114
  else
115
  $location = remove_query_arg( 'eta', $location );
116
- return esc_url( $location );
117
  }
118
 
119
  private function print_eta() {
120
  echo '<div class="eta">';
121
- _e( 'Estimated time left:', 'wpsc' );
122
  echo ' ';
123
  if ( $this->eta == 0 )
124
- _e( 'Under a minute', 'wpsc' );
125
  else
126
- printf( _n( '%d minute', '%d minutes', $this->eta, 'wpsc' ), $this->eta );
127
  echo '</div>';
128
  }
129
 
@@ -151,7 +151,7 @@ class WPSC_Update_Progress {
151
 
152
  if ( $percent == 100 ) {
153
  remove_filter( 'wpsc_update_terminate_location', array( $this, 'filter_terminate_location' ) );
154
- echo '<div class="eta">' . _x( 'Done!', 'Update routine completed', 'wpsc' ) . '</div>';
155
  echo '</div>';
156
  }
157
  }
@@ -183,12 +183,12 @@ function wpsc_update_step( $i, $total ) {
183
  $processed = $i - $count + 1;
184
  $eta = floor( ( $total - $i ) * ( $now - $start ) / ( $processed * 60 ) );
185
  echo '<div class="eta">';
186
- _e( 'Estimated time left:', 'wpsc' );
187
  echo ' ';
188
  if ( $eta == 0 )
189
- _e( 'Under a minute', 'wpsc' );
190
  else
191
- printf( _n( '%d minute', '%d minutes', $eta, 'wpsc' ), $eta );
192
  echo '</div>';
193
  $milestone = $now;
194
  }
@@ -423,7 +423,7 @@ function wpsc_convert_products_to_posts() {
423
  );
424
 
425
  $product['order'] = $wpdb->get_var( $wpdb->prepare( "
426
- SELECT order FROM " . WPSC_TABLE_PRODUCT_ORDER . "
427
  WHERE product_id = %d
428
  ", $product['id'] ) );
429
 
@@ -774,9 +774,9 @@ function wpsc_convert_variation_combinations() {
774
 
775
  }
776
  delete_option("wpsc-variation_children");
777
- _get_term_hierarchy('wpsc-variation');
778
- delete_option("wpsc_product_category_children");
779
- _get_term_hierarchy('wpsc_product_category');
780
  }
781
 
782
  function wpsc_update_files() {
@@ -895,4 +895,4 @@ function old_get_product_meta($product_id, $key, $single = false) {
895
  return $meta_values;
896
  }
897
  }
898
- ?>
46
  do_action( 'wpsc_update_timeout_terminate' );
47
  $location = remove_query_arg( array( 'start_over', 'eta', 'current_percent' ) );
48
  $location = add_query_arg( 'run_updates', 1, $location );
49
+ $location = esc_url_raw( apply_filters( 'wpsc_update_terminate_location', $location ) );
50
  ?>
51
+ <script type="text/javascript">
52
+ location.href = "<?php echo $location; ?>"
53
+ </script>
54
  <?php
55
  exit;
56
  }
113
  $location = add_query_arg( 'eta', $this->eta, $location );
114
  else
115
  $location = remove_query_arg( 'eta', $location );
116
+ return esc_url_raw( $location );
117
  }
118
 
119
  private function print_eta() {
120
  echo '<div class="eta">';
121
+ _e( 'Estimated time left:', 'wp-e-commerce' );
122
  echo ' ';
123
  if ( $this->eta == 0 )
124
+ _e( 'Under a minute', 'wp-e-commerce' );
125
  else
126
+ printf( _n( '%d minute', '%d minutes', $this->eta, 'wp-e-commerce' ), $this->eta );
127
  echo '</div>';
128
  }
129
 
151
 
152
  if ( $percent == 100 ) {
153
  remove_filter( 'wpsc_update_terminate_location', array( $this, 'filter_terminate_location' ) );
154
+ echo '<div class="eta">' . _x( 'Done!', 'Update routine completed', 'wp-e-commerce' ) . '</div>';
155
  echo '</div>';
156
  }
157
  }
183
  $processed = $i - $count + 1;
184
  $eta = floor( ( $total - $i ) * ( $now - $start ) / ( $processed * 60 ) );
185
  echo '<div class="eta">';
186
+ _e( 'Estimated time left:', 'wp-e-commerce' );
187
  echo ' ';
188
  if ( $eta == 0 )
189
+ _e( 'Under a minute', 'wp-e-commerce' );
190
  else
191
+ printf( _n( '%d minute', '%d minutes', $eta, 'wp-e-commerce' ), $eta );
192
  echo '</div>';
193
  $milestone = $now;
194
  }
423
  );
424
 
425
  $product['order'] = $wpdb->get_var( $wpdb->prepare( "
426
+ SELECT `order` FROM " . WPSC_TABLE_PRODUCT_ORDER . "
427
  WHERE product_id = %d
428
  ", $product['id'] ) );
429
 
774
 
775
  }
776
  delete_option("wpsc-variation_children");
777
+ _get_term_hierarchy('wpsc-variation');
778
+ delete_option("wpsc_product_category_children");
779
+ _get_term_hierarchy('wpsc_product_category');
780
  }
781
 
782
  function wpsc_update_files() {
895
  return $meta_values;
896
  }
897
  }
898
+ ?>
wpsc-admin/includes/walker-variation-checklist.php CHANGED
@@ -36,7 +36,7 @@ class WPSC_Walker_Variation_Checklist extends Walker_Category_Checklist {
36
  ?>
37
  <li id="<?php echo esc_attr( $taxonomy ); ?>-<?php echo $category->term_id; ?>" class="<?php echo implode( ' ', $li_classes ); ?>">
38
  <?php if ( $depth == 0 ): ?>
39
- <a href="#" class="expand"><?php echo esc_html_x( 'Expand', 'product variation set', 'wpsc' ); ?></a>
40
  <?php endif ?>
41
 
42
  <label class="selectit">
36
  ?>
37
  <li id="<?php echo esc_attr( $taxonomy ); ?>-<?php echo $category->term_id; ?>" class="<?php echo implode( ' ', $li_classes ); ?>">
38
  <?php if ( $depth == 0 ): ?>
39
+ <a href="#" class="expand"><?php echo esc_html_x( 'Expand', 'product variation set', 'wp-e-commerce' ); ?></a>
40
  <?php endif ?>
41
 
42
  <label class="selectit">
wpsc-admin/init.php CHANGED
@@ -80,7 +80,9 @@ function wpsc_duplicate_product() {
80
 
81
  // Copy the post and insert it
82
  if ( isset( $post ) && $post != null ) {
83
- $new_id = wpsc_duplicate_product_process( $post );
 
 
84
 
85
  $duplicated = true;
86
  $sendback = wp_get_referer();
@@ -89,7 +91,7 @@ function wpsc_duplicate_product() {
89
  wp_redirect( esc_url_raw( $sendback ) );
90
  exit();
91
  } else {
92
- wp_die( __( 'Sorry, for some reason, we couldn\'t duplicate this product because it could not be found in the database, check there for this ID: ', 'wpsc' ) . $id );
93
  }
94
  }
95
 
@@ -114,7 +116,7 @@ function wpsc_purchase_log_csv() {
114
  $start_end_sql = apply_filters( 'wpsc_purchase_log_start_end_csv', $start_end_sql );
115
  $data = $wpdb->get_results( $wpdb->prepare( $start_end_sql, $start_timestamp, $end_timestamp ), ARRAY_A );
116
  /* translators: %1$s is "start" date, %2$s is "to" date */
117
- $csv_name = _x( 'Purchase Log %1$s to %2$s.csv', 'exported purchase log csv file name', 'wpsc' );
118
  $csv_name = sprintf( $csv_name, date( "M-d-Y", $start_timestamp ), date( "M-d-Y", $end_timestamp ) );
119
  } elseif ( isset( $_REQUEST['m'] ) ) {
120
  $year = (int) substr( $_REQUEST['m'], 0, 4);
@@ -128,25 +130,25 @@ function wpsc_purchase_log_csv() {
128
  $month_year_sql = apply_filters( 'wpsc_purchase_log_month_year_csv', $month_year_sql );
129
  $data = $wpdb->get_results( $wpdb->prepare( $month_year_sql, $year, $month ), ARRAY_A );
130
  /* translators: %1$s is month, %2$s is year */
131
- $csv_name = _x( 'Purchase Log %1$s/%2$s.csv', 'exported purchase log csv file name', 'wpsc' );
132
  $csv_name = sprintf( $csv_name, $month, $year );
133
  } else {
134
  $sql = apply_filters( 'wpsc_purchase_log_month_year_csv', "SELECT * FROM " . WPSC_TABLE_PURCHASE_LOGS . " ORDER BY `id` DESC" );
135
  $data = $wpdb->get_results( $sql, ARRAY_A );
136
- $csv_name = _x( "All Purchase Logs.csv", 'exported purchase log csv file name', 'wpsc' );
137
  }
138
 
139
  $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `type` != 'heading' ORDER BY `checkout_order` DESC;";
140
  $form_data = $wpdb->get_results( $form_sql, ARRAY_A );
141
 
142
  $headers_array = array(
143
- _x( 'Purchase ID' , 'purchase log csv headers', 'wpsc' ),
144
- _x( 'Purchase Total', 'purchase log csv headers', 'wpsc' ),
145
  );
146
  $headers2_array = array(
147
- _x( 'Payment Gateway', 'purchase log csv headers', 'wpsc' ),
148
- _x( 'Payment Status' , 'purchase log csv headers', 'wpsc' ),
149
- _x( 'Purchase Date' , 'purchase log csv headers', 'wpsc' ),
150
  );
151
  $form_headers_array = array();
152
 
@@ -156,7 +158,7 @@ function wpsc_purchase_log_csv() {
156
  if ( empty ( $form_field['unique_name'] ) ) {
157
  $form_headers_array[] = $form_field['name'];
158
  } else {
159
- $prefix = false === strstr( $form_field['unique_name'], 'billing' ) ? _x( 'Shipping ', 'purchase log csv header field prefix', 'wpsc' ) : _x( 'Billing ', 'purchase log csv header field prefix', 'wpsc' );
160
  $form_headers_array[] = $prefix . $form_field['name'];
161
  }
162
  }
@@ -200,7 +202,7 @@ function wpsc_purchase_log_csv() {
200
  foreach ( (array) $cart as $item ) {
201
  $skuvalue = get_product_meta( $item['prodid'], 'sku', true );
202
  if( empty( $skuvalue ) )
203
- $skuvalue = __( 'N/A', 'wpsc' );
204
  $output .= "\"" . $item['quantity'] . "\",";
205
  $output .= "\"" . str_replace( '"', '\"', $item['name'] ) . "\",";
206
 
@@ -219,9 +221,9 @@ function wpsc_purchase_log_csv() {
219
  // Get the most number of products and create a header for them
220
  $headers3 = array();
221
  for( $i = 0; $i < $count; $i++ ){
222
- $headers3[] = _x( 'Quantity', 'purchase log csv headers', 'wpsc' );
223
- $headers3[] = _x( 'Product Name', 'purchase log csv headers', 'wpsc' );
224
- $headers3[] = _x( 'SKU', 'purchase log csv headers', 'wpsc' );
225
  }
226
 
227
  $headers = '"' . implode( '","', $headers_array ) . '",';
@@ -232,6 +234,9 @@ function wpsc_purchase_log_csv() {
232
  $headers = apply_filters( 'wpsc_purchase_log_csv_headers', $headers . $form_headers . $headers2 . $headers3, $data, $form_data );
233
  $output = apply_filters( 'wpsc_purchase_log_csv_output' , $output, $data, $form_data );
234
 
 
 
 
235
  do_action( 'wpsc_purchase_log_csv' );
236
 
237
  header( 'Content-Type: text/csv' );
@@ -264,19 +269,19 @@ function wpsc_admin_sale_rss() {
264
  $output .= "<?xml version='1.0'?>\n\r";
265
  $output .= "<rss version='2.0'>\n\r";
266
  $output .= " <channel>\n\r";
267
- $output .= " <title>" . _x( 'WP eCommerce Product Log', 'admin rss product feed', 'wpsc' ) . "</title>\n\r";
268
  $output .= " <link>" . admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "</link>\n\r";
269
- $output .= " <description>" . _x( 'This is the WP eCommerce Product Log RSS feed', 'admin rss product feed', 'wpsc' ) . "</description>\n\r";
270
- $output .= " <generator>" . _x( 'WP eCommerce Plugin', 'admin rss product feed', 'wpsc' ) . "</generator>\n\r";
271
 
272
  foreach ( (array)$purchase_log as $purchase ) {
273
  $purchase_link = admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "&amp;purchaseid=" . $purchase['id'];
274
- $purchase_title = _x( 'Purchase # %d', 'admin rss product feed', 'wpsc' );
275
  $purchase_title = sprintf( $purchase_title, $purchase['id'] );
276
  $output .= " <item>\n\r";
277
  $output .= " <title>{$purchase_title}</title>\n\r";
278
  $output .= " <link>$purchase_link</link>\n\r";
279
- $output .= " <description>" . _x( 'This is an entry in the purchase log', 'admin rss product feed', 'wpsc' ) . ".</description>\n\r";
280
  $output .= " <pubDate>" . date( "r", $purchase['date'] ) . "</pubDate>\n\r";
281
  $output .= " <guid>$purchase_link</guid>\n\r";
282
  $output .= " </item>\n\r";
@@ -406,7 +411,7 @@ function wpsc_purchlog_resend_email( $log_id = '' ) {
406
 
407
  // Deprecate empty purchase log ID parameter.
408
  if ( $log_id == '' ) {
409
- _wpsc_doing_it_wrong( 'wpsc_purchlog_resend_email', __( '$log_id parameter requires a numeric purchase log ID.', 'wpsc' ), '3.9.0' );
410
 
411
  // Support redirect for legacy purposes for the moment
412
  $sendback = esc_url_raw( add_query_arg( 'sent', 0, wp_get_referer() ) );
@@ -434,7 +439,7 @@ function wpsc_purchlog_resend_email( $log_id = '' ) {
434
 
435
  // Deprecate resending purchase log email receipt via URL query
436
  if ( isset( $_REQUEST['email_buyer_id'] ) && is_numeric( $_REQUEST['email_buyer_id'] ) ) {
437
- _wpsc_doing_it_wrong( 'wpsc_purchlog_resend_email', __( 'Do not trigger resend purchase log email action via email_buyer_id URL query. Instead use the Purchase Log Action Links API.', 'wpsc' ), '3.9.0' );
438
  }
439
 
440
  /**
@@ -453,7 +458,7 @@ function wpsc_purchlog_clear_download_items( $log_id = '' ) {
453
 
454
  // Deprecate empty purchase log ID parameter.
455
  if ( $log_id == '' ) {
456
- _wpsc_doing_it_wrong( 'wpsc_purchlog_clear_download_items', __( '$log_id parameter requires a numeric purchase log ID.', 'wpsc' ), '3.9.0' );
457
  return false;
458
  }
459
 
@@ -472,7 +477,7 @@ function wpsc_purchlog_clear_download_items( $log_id = '' ) {
472
  $download_links .= add_query_arg( 'downloadid', $downloadable_item['uniqueid'], home_url() ) . "\n";
473
  }
474
 
475
- wp_mail( $email_address, __( 'The administrator has unlocked your file', 'wpsc' ), str_replace( "[download_links]", $download_links, __( 'Dear CustomerWe are pleased to advise you that your order has been updated and your downloads are now active.Please download your purchase using the links provided below.[download_links]Thank you for your custom.', 'wpsc' ) ), "From: " . get_option( 'return_email' ) );
476
 
477
  return true;
478
 
@@ -484,7 +489,7 @@ function wpsc_purchlog_clear_download_items( $log_id = '' ) {
484
 
485
  // Deprecate clearing purchase log download locks via URL query
486
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clear_locks') ) {
487
- _wpsc_doing_it_wrong( 'wpsc_purchlog_clear_download_items', __( 'Do not trigger clear purchase log download locks action via wpsc_admin_action = clear_locks URL query. Instead use the Purchase Log Action Links API.', 'wpsc' ), '3.9.0' );
488
  }
489
 
490
  //bulk actions for purchase log
@@ -571,7 +576,7 @@ function wpsc_delete_purchlog( $purchlog_id = '' ) {
571
 
572
  // Deprecate empty purchase log ID parameter.
573
  if ( $purchlog_id == '' ) {
574
- _wpsc_doing_it_wrong( 'wpsc_delete_purchlog', __( '$purchlog_id parameter requires a numeric purchase log ID.', 'wpsc' ), '3.9.0' );
575
  return false;
576
  }
577
 
@@ -583,19 +588,23 @@ function wpsc_delete_purchlog( $purchlog_id = '' ) {
583
 
584
  // Deprecate deleting purchase log via URL query
585
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'delete_purchlog' ) ) {
586
- _wpsc_doing_it_wrong( 'wpsc_delete_purchlog', __( 'Do not trigger delete purchase log action via wpsc_admin_action = delete_purchlog URL query. Instead use the Purchase Log Action Links API.', 'wpsc' ), '3.9.0' );
587
  }
588
 
589
- function wpsc_update_option_product_category_hierarchical_url() {
590
  flush_rewrite_rules( false );
591
  }
592
 
 
 
 
 
593
  add_action( 'update_option_product_category_hierarchical_url', 'wpsc_update_option_product_category_hierarchical_url' );
594
 
595
  function _wpsc_action_sanitize_option_grid_number_per_row( $value, $option ) {
596
  $value = (int) $value;
597
  if ( $value === 0 ) {
598
- add_settings_error( $option, 'invalid_grid_number_per_row', __( 'You just set the number of item per row for the grid view to 0. This means the column width will fall back to using whatever CSS you have for it. This could break your theme layout, so please make sure you have adjusted your theme\'s CSS accordingly.', 'wpsc' ) );
599
  }
600
 
601
  return $value;
@@ -613,7 +622,7 @@ add_filter( 'sanitize_option_grid_number_per_row', '_wpsc_action_sanitize_option
613
  function _wpsc_action_update_option_require_register( $old_value, $new_value ) {
614
  if ( $new_value == 1 && ! get_option( 'users_can_register' ) ) {
615
  update_option( 'users_can_register', 1 );
616
- $message = __( 'You wanted to require your customers to log in before checking out. However, the WordPress setting <a href="%s">"Anyone can register"</a> was disabled. WP eCommerce has enabled that setting for you automatically.', 'wpsc' );
617
  $message = sprintf( $message, admin_url( 'options-general.php' ) );
618
  add_settings_error( 'require_register', 'users_can_register_turned_on', $message, 'updated' );
619
  }
@@ -631,7 +640,7 @@ add_action( 'update_option_require_register', '_wpsc_action_update_option_requir
631
  function _wpsc_action_update_option_users_can_register( $old_value, $new_value ) {
632
  if ( ! $new_value && get_option( 'require_register' ) ) {
633
  update_option( 'require_register', 0 );
634
- $message = __( 'You just disabled the "Anyone can register" setting. As a result, the <a href="%s">"Require registration before checking out"</a> setting has been disabled.', 'wpsc' );
635
  $message = sprintf( $message, admin_url( 'options-general.php?page=wpsc-settings&tab=checkout' ) );
636
  add_settings_error( 'users_can_register', 'require_register_turned_off', $message, 'updated' );
637
  }
@@ -724,11 +733,12 @@ function wpsc_product_files_existing() {
724
  );
725
  $attached_files = (array)get_posts( $args );
726
 
 
727
  foreach ( $attached_files as $key => $attached_file ) {
728
  $attached_files_by_file[$attached_file->post_title] = & $attached_files[$key];
729
  }
730
 
731
- $output = "<span class='admin_product_notes select_product_note '>" . esc_html__( 'Choose a downloadable file for this product:', 'wpsc' ) . "</span><br>";
732
  $output .= "<form method='post' class='product_upload'>";
733
  $output .= '<div class="ui-widget-content multiple-select select_product_file" style="width:100%">';
734
  $num = 0;
@@ -747,7 +757,7 @@ function wpsc_product_files_existing() {
747
 
748
  $output .= "</div>";
749
  $output .= "<input type='hidden' id='hidden_id' value='$product_id' />";
750
- $output .= "<input data-nonce='" . _wpsc_create_ajax_nonce( 'upload_product_file' ) . "' type='submit' name='save' name='product_files_submit' class='button-primary prdfil' value='" . esc_html__( 'Save Product Files', 'wpsc' ) . "' />";
751
  $output .= "</form>";
752
  $output .= "<div class='" . ((is_numeric( $product_id )) ? "edit_" : "") . "select_product_handle'><div></div></div>";
753
  $output .= "<script type='text/javascript'>\n\r";
@@ -835,29 +845,41 @@ function wpsc_backup_theme() {
835
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'backup_themes' ) )
836
  add_action( 'admin_init', 'wpsc_backup_theme' );
837
 
 
 
 
 
 
838
  function wpsc_delete_coupon(){
 
839
  global $wpdb;
840
 
841
  check_admin_referer( 'delete-coupon' );
842
- $coupon_id = (int)$_GET['delete_id'];
843
 
844
- if(isset($coupon_id)) {
845
- $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPSC_TABLE_COUPON_CODES."` WHERE `id` = %d LIMIT 1", $coupon_id ) );
846
- $deleted = 1;
 
 
 
847
  }
 
848
  $sendback = wp_get_referer();
849
 
850
- if ( isset( $deleted ) )
851
  $sendback = add_query_arg( 'deleted', $deleted, $sendback );
 
852
 
853
  $sendback = remove_query_arg( array( 'deleteid', 'wpsc_admin_action' ), $sendback );
854
  wp_redirect( esc_url_raw( $sendback ) );
855
  exit();
 
856
  }
857
 
858
- //Delete Coupon
859
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-coupon' == $_REQUEST['wpsc_admin_action'] ) )
860
  add_action( 'admin_init', 'wpsc_delete_coupon' );
 
861
 
862
  function _wpsc_action_update_option_base_country( $old_value, $new_value ) {
863
  global $wpdb;
80
 
81
  // Copy the post and insert it
82
  if ( isset( $post ) && $post != null ) {
83
+
84
+ $duplicate = new WPSC_Duplicate_Product( $post->ID );
85
+ $new_id = $duplicate->duplicate_product_process();
86
 
87
  $duplicated = true;
88
  $sendback = wp_get_referer();
91
  wp_redirect( esc_url_raw( $sendback ) );
92
  exit();
93
  } else {
94
+ wp_die( __( 'Sorry, for some reason, we couldn\'t duplicate this product because it could not be found in the database, check there for this ID: ', 'wp-e-commerce' ) . $id );
95
  }
96
  }
97
 
116
  $start_end_sql = apply_filters( 'wpsc_purchase_log_start_end_csv', $start_end_sql );
117
  $data = $wpdb->get_results( $wpdb->prepare( $start_end_sql, $start_timestamp, $end_timestamp ), ARRAY_A );
118
  /* translators: %1$s is "start" date, %2$s is "to" date */
119
+ $csv_name = _x( 'Purchase Log %1$s to %2$s.csv', 'exported purchase log csv file name', 'wp-e-commerce' );
120
  $csv_name = sprintf( $csv_name, date( "M-d-Y", $start_timestamp ), date( "M-d-Y", $end_timestamp ) );
121
  } elseif ( isset( $_REQUEST['m'] ) ) {
122
  $year = (int) substr( $_REQUEST['m'], 0, 4);
130
  $month_year_sql = apply_filters( 'wpsc_purchase_log_month_year_csv', $month_year_sql );
131
  $data = $wpdb->get_results( $wpdb->prepare( $month_year_sql, $year, $month ), ARRAY_A );
132
  /* translators: %1$s is month, %2$s is year */
133
+ $csv_name = _x( 'Purchase Log %1$s/%2$s.csv', 'exported purchase log csv file name', 'wp-e-commerce' );
134
  $csv_name = sprintf( $csv_name, $month, $year );
135
  } else {
136
  $sql = apply_filters( 'wpsc_purchase_log_month_year_csv', "SELECT * FROM " . WPSC_TABLE_PURCHASE_LOGS . " ORDER BY `id` DESC" );
137
  $data = $wpdb->get_results( $sql, ARRAY_A );
138
+ $csv_name = _x( "All Purchase Logs.csv", 'exported purchase log csv file name', 'wp-e-commerce' );
139
  }
140
 
141
  $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `type` != 'heading' ORDER BY `checkout_order` DESC;";
142
  $form_data = $wpdb->get_results( $form_sql, ARRAY_A );
143
 
144
  $headers_array = array(
145
+ _x( 'Purchase ID' , 'purchase log csv headers', 'wp-e-commerce' ),
146
+ _x( 'Purchase Total', 'purchase log csv headers', 'wp-e-commerce' ),
147
  );
148
  $headers2_array = array(
149
+ _x( 'Payment Gateway', 'purchase log csv headers', 'wp-e-commerce' ),
150
+ _x( 'Payment Status' , 'purchase log csv headers', 'wp-e-commerce' ),
151
+ _x( 'Purchase Date' , 'purchase log csv headers', 'wp-e-commerce' ),
152
  );
153
  $form_headers_array = array();
154
 
158
  if ( empty ( $form_field['unique_name'] ) ) {
159
  $form_headers_array[] = $form_field['name'];
160
  } else {
161
+ $prefix = false === strstr( $form_field['unique_name'], 'billing' ) ? _x( 'Shipping ', 'purchase log csv header field prefix', 'wp-e-commerce' ) : _x( 'Billing ', 'purchase log csv header field prefix', 'wp-e-commerce' );
162
  $form_headers_array[] = $prefix . $form_field['name'];
163
  }
164
  }
202
  foreach ( (array) $cart as $item ) {
203
  $skuvalue = get_product_meta( $item['prodid'], 'sku', true );
204
  if( empty( $skuvalue ) )
205
+ $skuvalue = __( 'N/A', 'wp-e-commerce' );
206
  $output .= "\"" . $item['quantity'] . "\",";
207
  $output .= "\"" . str_replace( '"', '\"', $item['name'] ) . "\",";
208
 
221
  // Get the most number of products and create a header for them
222
  $headers3 = array();
223
  for( $i = 0; $i < $count; $i++ ){
224
+ $headers3[] = _x( 'Quantity', 'purchase log csv headers', 'wp-e-commerce' );
225
+ $headers3[] = _x( 'Product Name', 'purchase log csv headers', 'wp-e-commerce' );
226
+ $headers3[] = _x( 'SKU', 'purchase log csv headers', 'wp-e-commerce' );
227
  }
228
 
229
  $headers = '"' . implode( '","', $headers_array ) . '",';
234
  $headers = apply_filters( 'wpsc_purchase_log_csv_headers', $headers . $form_headers . $headers2 . $headers3, $data, $form_data );
235
  $output = apply_filters( 'wpsc_purchase_log_csv_output' , $output, $data, $form_data );
236
 
237
+ /**
238
+ * Fires when the WPSC purchase log is exported as a CSV
239
+ */
240
  do_action( 'wpsc_purchase_log_csv' );
241
 
242
  header( 'Content-Type: text/csv' );
269
  $output .= "<?xml version='1.0'?>\n\r";
270
  $output .= "<rss version='2.0'>\n\r";
271
  $output .= " <channel>\n\r";
272
+ $output .= " <title>" . _x( 'WP eCommerce Product Log', 'admin rss product feed', 'wp-e-commerce' ) . "</title>\n\r";
273
  $output .= " <link>" . admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "</link>\n\r";
274
+ $output .= " <description>" . _x( 'This is the WP eCommerce Product Log RSS feed', 'admin rss product feed', 'wp-e-commerce' ) . "</description>\n\r";
275
+ $output .= " <generator>" . _x( 'WP eCommerce Plugin', 'admin rss product feed', 'wp-e-commerce' ) . "</generator>\n\r";
276
 
277
  foreach ( (array)$purchase_log as $purchase ) {
278
  $purchase_link = admin_url( 'admin.php?page=' . WPSC_DIR_NAME . '/display-log.php' ) . "&amp;purchaseid=" . $purchase['id'];
279
+ $purchase_title = _x( 'Purchase # %d', 'admin rss product feed', 'wp-e-commerce' );
280
  $purchase_title = sprintf( $purchase_title, $purchase['id'] );
281
  $output .= " <item>\n\r";
282
  $output .= " <title>{$purchase_title}</title>\n\r";
283
  $output .= " <link>$purchase_link</link>\n\r";
284
+ $output .= " <description>" . _x( 'This is an entry in the purchase log', 'admin rss product feed', 'wp-e-commerce' ) . ".</description>\n\r";
285
  $output .= " <pubDate>" . date( "r", $purchase['date'] ) . "</pubDate>\n\r";
286
  $output .= " <guid>$purchase_link</guid>\n\r";
287
  $output .= " </item>\n\r";
411
 
412
  // Deprecate empty purchase log ID parameter.
413
  if ( $log_id == '' ) {
414
+ _wpsc_doing_it_wrong( 'wpsc_purchlog_resend_email', __( '$log_id parameter requires a numeric purchase log ID.', 'wp-e-commerce' ), '3.9.0' );
415
 
416
  // Support redirect for legacy purposes for the moment
417
  $sendback = esc_url_raw( add_query_arg( 'sent', 0, wp_get_referer() ) );
439
 
440
  // Deprecate resending purchase log email receipt via URL query
441
  if ( isset( $_REQUEST['email_buyer_id'] ) && is_numeric( $_REQUEST['email_buyer_id'] ) ) {
442
+ _wpsc_doing_it_wrong( 'wpsc_purchlog_resend_email', __( 'Do not trigger resend purchase log email action via email_buyer_id URL query. Instead use the Purchase Log Action Links API.', 'wp-e-commerce' ), '3.9.0' );
443
  }
444
 
445
  /**
458
 
459
  // Deprecate empty purchase log ID parameter.
460
  if ( $log_id == '' ) {
461
+ _wpsc_doing_it_wrong( 'wpsc_purchlog_clear_download_items', __( '$log_id parameter requires a numeric purchase log ID.', 'wp-e-commerce' ), '3.9.0' );
462
  return false;
463
  }
464
 
477
  $download_links .= add_query_arg( 'downloadid', $downloadable_item['uniqueid'], home_url() ) . "\n";
478
  }
479
 
480
+ wp_mail( $email_address, __( 'The administrator has unlocked your file', 'wp-e-commerce' ), str_replace( "[download_links]", $download_links, __( 'Dear Customer, We are pleased to advise you that your order has been updated and your downloads are now active. Please download your purchase using the links provided below. [download_links] Thank you for your order.', 'wp-e-commerce' ) ), "From: " . get_option( 'return_email' ) );
481
 
482
  return true;
483
 
489
 
490
  // Deprecate clearing purchase log download locks via URL query
491
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clear_locks') ) {
492
+ _wpsc_doing_it_wrong( 'wpsc_purchlog_clear_download_items', __( 'Do not trigger clear purchase log download locks action via wpsc_admin_action = clear_locks URL query. Instead use the Purchase Log Action Links API.', 'wp-e-commerce' ), '3.9.0' );
493
  }
494
 
495
  //bulk actions for purchase log
576
 
577
  // Deprecate empty purchase log ID parameter.
578
  if ( $purchlog_id == '' ) {
579
+ _wpsc_doing_it_wrong( 'wpsc_delete_purchlog', __( '$purchlog_id parameter requires a numeric purchase log ID.', 'wp-e-commerce' ), '3.9.0' );
580
  return false;
581
  }
582
 
588
 
589
  // Deprecate deleting purchase log via URL query
590
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'delete_purchlog' ) ) {
591
+ _wpsc_doing_it_wrong( 'wpsc_delete_purchlog', __( 'Do not trigger delete purchase log action via wpsc_admin_action = delete_purchlog URL query. Instead use the Purchase Log Action Links API.', 'wp-e-commerce' ), '3.9.0' );
592
  }
593
 
594
+ function _wpsc_action_flush_rewrite_rules() {
595
  flush_rewrite_rules( false );
596
  }
597
 
598
+ function wpsc_update_option_product_category_hierarchical_url() {
599
+ _wpsc_action_flush_rewrite_rules();
600
+ }
601
+
602
  add_action( 'update_option_product_category_hierarchical_url', 'wpsc_update_option_product_category_hierarchical_url' );
603
 
604
  function _wpsc_action_sanitize_option_grid_number_per_row( $value, $option ) {
605
  $value = (int) $value;
606
  if ( $value === 0 ) {
607
+ add_settings_error( $option, 'invalid_grid_number_per_row', __( 'You just set the number of item per row for the grid view to 0. This means the column width will fall back to using whatever CSS you have for it. This could break your theme layout, so please make sure you have adjusted your theme\'s CSS accordingly.', 'wp-e-commerce' ) );
608
  }
609
 
610
  return $value;
622
  function _wpsc_action_update_option_require_register( $old_value, $new_value ) {
623
  if ( $new_value == 1 && ! get_option( 'users_can_register' ) ) {
624
  update_option( 'users_can_register', 1 );
625
+ $message = __( 'You wanted to require your customers to log in before checking out. However, the WordPress setting <a href="%s">"Anyone can register"</a> was disabled. WP eCommerce has enabled that setting for you automatically.', 'wp-e-commerce' );
626
  $message = sprintf( $message, admin_url( 'options-general.php' ) );
627
  add_settings_error( 'require_register', 'users_can_register_turned_on', $message, 'updated' );
628
  }
640
  function _wpsc_action_update_option_users_can_register( $old_value, $new_value ) {
641
  if ( ! $new_value && get_option( 'require_register' ) ) {
642
  update_option( 'require_register', 0 );
643
+ $message = __( 'You just disabled the "Anyone can register" setting. As a result, the <a href="%s">"Require registration before checking out"</a> setting has been disabled.', 'wp-e-commerce' );
644
  $message = sprintf( $message, admin_url( 'options-general.php?page=wpsc-settings&tab=checkout' ) );
645
  add_settings_error( 'users_can_register', 'require_register_turned_off', $message, 'updated' );
646
  }
733
  );
734
  $attached_files = (array)get_posts( $args );
735
 
736
+ $attached_files_by_file = array();
737
  foreach ( $attached_files as $key => $attached_file ) {
738
  $attached_files_by_file[$attached_file->post_title] = & $attached_files[$key];
739
  }
740
 
741
+ $output = "<span class='admin_product_notes select_product_note '>" . esc_html__( 'Choose a downloadable file for this product:', 'wp-e-commerce' ) . "</span><br>";
742
  $output .= "<form method='post' class='product_upload'>";
743
  $output .= '<div class="ui-widget-content multiple-select select_product_file" style="width:100%">';
744
  $num = 0;
757
 
758
  $output .= "</div>";
759
  $output .= "<input type='hidden' id='hidden_id' value='$product_id' />";
760
+ $output .= "<input data-nonce='" . _wpsc_create_ajax_nonce( 'upload_product_file' ) . "' type='submit' name='save' name='product_files_submit' class='button-primary prdfil' value='" . esc_html__( 'Save Product Files', 'wp-e-commerce' ) . "' />";
761
  $output .= "</form>";
762
  $output .= "<div class='" . ((is_numeric( $product_id )) ? "edit_" : "") . "select_product_handle'><div></div></div>";
763
  $output .= "<script type='text/javascript'>\n\r";
845
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'backup_themes' ) )
846
  add_action( 'admin_init', 'wpsc_backup_theme' );
847
 
848
+ /**
849
+ * Delete a coupon
850
+ *
851
+ * @since 3.8
852
+ */
853
  function wpsc_delete_coupon(){
854
+
855
  global $wpdb;
856
 
857
  check_admin_referer( 'delete-coupon' );
 
858
 
859
+ $deleted = 0;
860
+
861
+ if ( isset( $_GET['delete_id'] ) ) {
862
+ $coupon = new WPSC_Coupon( $_GET['delete_id'] );
863
+ $coupon->delete();
864
+ $deleted = 1;
865
  }
866
+
867
  $sendback = wp_get_referer();
868
 
869
+ if ( $deleted ) {
870
  $sendback = add_query_arg( 'deleted', $deleted, $sendback );
871
+ }
872
 
873
  $sendback = remove_query_arg( array( 'deleteid', 'wpsc_admin_action' ), $sendback );
874
  wp_redirect( esc_url_raw( $sendback ) );
875
  exit();
876
+
877
  }
878
 
879
+ // Delete Coupon
880
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-coupon' == $_REQUEST['wpsc_admin_action'] ) ) {
881
  add_action( 'admin_init', 'wpsc_delete_coupon' );
882
+ }
883
 
884
  function _wpsc_action_update_option_base_country( $old_value, $new_value ) {
885
  global $wpdb;
wpsc-admin/js/admin-legacy.js CHANGED
@@ -130,43 +130,6 @@ var getresults=function(results) {
130
  jQuery("#loadingindicator_span").css('visibility','hidden');
131
  enablebuttons();
132
 
133
- jQuery('.meta-box-sortables').sortable( {
134
- placeholder: 'sortable-placeholder',
135
- connectWith: [ '.meta-box-sortables' ],
136
- items: '> .postbox',
137
- handle: '.hndle',
138
- distance: 2,
139
- tolerance: 'pointer',
140
- sort: function(e,ui) {
141
- if ( jQuery(document).width() - e.clientX < 300 ) {
142
- if ( ! jQuery('#post-body').hasClass('has-sidebar') ) {
143
- var pos = jQuery('#side-sortables').offset();
144
-
145
- jQuery('#side-sortables').append(ui.item)
146
- jQuery(ui.placeholder).css({
147
- 'top':pos.top,
148
- 'left':pos.left
149
- }).width(jQuery(ui.item).width())
150
- postboxes.expandSidebar(1);
151
- }
152
- }
153
- },
154
- stop: function() {
155
- var postVars = {
156
- action: 'product-page-order',
157
- ajax: 'true'
158
- }
159
- //jQuery(this).css("border","1px solid red");
160
- jQuery(this).each( function() {
161
- postVars["order[" + this.id.split('-')[0] + "]"] = jQuery(this).sortable( 'toArray' ).join(',');
162
- } );
163
- jQuery.post( 'index.php?admin=true&ajax=true', postVars, function() {
164
- postboxes.expandSidebar();
165
- } );
166
- }
167
- } );
168
-
169
-
170
  jQuery("#gallery_list").sortable({
171
  revert: false,
172
  placeholder: "ui-selected",
130
  jQuery("#loadingindicator_span").css('visibility','hidden');
131
  enablebuttons();
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  jQuery("#gallery_list").sortable({
134
  revert: false,
135
  placeholder: "ui-selected",
wpsc-admin/js/admin.js CHANGED
@@ -160,6 +160,26 @@
160
  }(jQuery));
161
 
162
  jQuery(document).ready(function($){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  $( '#wpsc_price' ).on( 'change', wpsc_update_price_live_preview );
164
  $( '#wpsc_sale_price' ).on( 'change', wpsc_update_price_live_preview );
165
 
160
  }(jQuery));
161
 
162
  jQuery(document).ready(function($){
163
+
164
+ $('.ui-sortable li .list_gallery_image').mouseover(function(){
165
+ $('.product_gallery_image_delete_button', $(this).parent()).show();
166
+ }).mouseout(function(){
167
+ $('.product_gallery_image_delete_button', $(this).parent()).hide();
168
+ });
169
+
170
+ $('.product_gallery_image_delete_button').click(function(){
171
+ var product_gallery_image_data = {
172
+ action: 'product_gallery_image_delete',
173
+ product_gallery_image_id: $(this).parent().parent().find('.product_gallery_image_id').val(),
174
+ product_gallery_post_id: $(this).parent().parent().find('.product_gallery_post_id').val(),
175
+ wpsc_gallery_nonce_check: $('.nonce_class').val()
176
+ };
177
+ $.post(ajaxurl, product_gallery_image_data, function(response){});
178
+ $(this).parent().parent().fadeOut( 'slow' );
179
+ });
180
+
181
+
182
+
183
  $( '#wpsc_price' ).on( 'change', wpsc_update_price_live_preview );
184
  $( '#wpsc_sale_price' ).on( 'change', wpsc_update_price_live_preview );
185
 
wpsc-admin/js/product-variations.js CHANGED
@@ -1,3 +1,4 @@
 
1
  (function($){
2
  var resize_iframe = function() {
3
  if (typeof window.parent.wpsc_resize_iframe != 'undefined') {
@@ -14,8 +15,8 @@
14
 
15
  event.preventDefault();
16
 
17
- target_row.show();
18
- parent.addClass('active');
19
  resize_iframe();
20
 
21
  return false;
@@ -235,9 +236,8 @@
235
  */
236
  var event_toggle_parent = function() {
237
  var t = $(this),
238
- parent = t.closest('.children').parent();
239
- parent_checkbox = parent.find('.variation-set'),
240
- checked = this.checked;
241
 
242
  if (this.checked) {
243
  parent_checkbox[0].checked = true;
1
+ /* global WPSC_Product_Variations, alert */
2
  (function($){
3
  var resize_iframe = function() {
4
  if (typeof window.parent.wpsc_resize_iframe != 'undefined') {
15
 
16
  event.preventDefault();
17
 
18
+ target_row.toggle( 100 );
19
+ parent.toggleClass('active');
20
  resize_iframe();
21
 
22
  return false;
236
  */
237
  var event_toggle_parent = function() {
238
  var t = $(this),
239
+ parent = t.closest('.children').parent(),
240
+ parent_checkbox = parent.find('.variation-set');
 
241
 
242
  if (this.checked) {
243
  parent_checkbox[0].checked = true;
wpsc-admin/js/purchase-log-action-links.js CHANGED
@@ -1,4 +1,4 @@
1
-
2
  ( function( $ ) {
3
 
4
  /**
@@ -66,12 +66,13 @@
66
  * @since 3.9.0
67
  */
68
  ajax_callback : function( response ) {
 
69
 
70
  // If AJAX successful and purchase log action successful.
71
  if ( response.is_successful && response.obj.success ) {
72
 
73
- var dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link-' + response.obj.purchase_log_action_link + ' .dashicons' );
74
- var dashicon_class = dashicon.attr( 'class' );
75
 
76
  // Successful notification.
77
  dashicon.removeClass().addClass( 'dashicons dashicons-yes' );
@@ -87,11 +88,12 @@
87
  // Ideally we'd always like to know which link was clicked, but we don't
88
  // so just clear all spinners and only clear specific spinner if AJAX response was processed.
89
 
90
- var dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link.doing .dashicons' );
 
91
  if ( response.is_successful ) {
92
  dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link-' + response.obj.purchase_log_action_link + ' .dashicons' );
93
  }
94
- var dashicon_class = dashicon.attr( 'class' );
95
 
96
  if ( response.obj.success != null ) {
97
 
1
+ /* global WPSC_Purchase_Log_Action_Links, alert */
2
  ( function( $ ) {
3
 
4
  /**
66
  * @since 3.9.0
67
  */
68
  ajax_callback : function( response ) {
69
+ var dashicon, dashicon_class;
70
 
71
  // If AJAX successful and purchase log action successful.
72
  if ( response.is_successful && response.obj.success ) {
73
 
74
+ dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link-' + response.obj.purchase_log_action_link + ' .dashicons' );
75
+ dashicon_class = dashicon.attr( 'class' );
76
 
77
  // Successful notification.
78
  dashicon.removeClass().addClass( 'dashicons dashicons-yes' );
88
  // Ideally we'd always like to know which link was clicked, but we don't
89
  // so just clear all spinners and only clear specific spinner if AJAX response was processed.
90
 
91
+ dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link.doing .dashicons' );
92
+
93
  if ( response.is_successful ) {
94
  dashicon = $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link-' + response.obj.purchase_log_action_link + ' .dashicons' );
95
  }
96
+ dashicon_class = dashicon.attr( 'class' );
97
 
98
  if ( response.obj.success != null ) {
99
 
wpsc-admin/js/purchase-logs.js CHANGED
@@ -1,3 +1,4 @@
 
1
  (function($){
2
  $.extend(WPSC_Purchase_Logs_Admin, {
3
  blur_timeout : null,
1
+ /*global WPSC_Purchase_Logs_Admin, alert*/
2
  (function($){
3
  $.extend(WPSC_Purchase_Logs_Admin, {
4
  blur_timeout : null,
wpsc-admin/js/set-post-thumbnail.js CHANGED
@@ -1,3 +1,4 @@
 
1
  function WPSetAsThumbnail(id, nonce){
2
  var $link = jQuery('a#wp-post-thumbnail-' + id);
3
 
1
+ /*global WPSC_Set_Post_Thumbnail, post_id, alert */
2
  function WPSetAsThumbnail(id, nonce){
3
  var $link = jQuery('a#wp-post-thumbnail-' + id);
4
 
wpsc-admin/js/settings-page.js CHANGED
@@ -13,6 +13,7 @@
13
  * @requires jQuery.query
14
  */
15
 
 
16
  (function($){
17
 
18
  $.extend(WPSC_Settings_Page, /** @lends WPSC_Settings_Page */ {
@@ -277,13 +278,17 @@
277
  */
278
  event_show_images_only_clicked : function() {
279
  var i;
280
- if ($(this).is(':checked')) {
281
- for (i in WPSC_Settings_Page.Presentation.grid_view_boxes) {
282
- document.getElementById(WPSC_Settings_Page.Presentation.grid_view_boxes[i]).checked = false;
 
 
 
283
  }
284
  }
285
  }
286
  };
 
287
  $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_presentation', WPSC_Settings_Page.Presentation.event_init);
288
 
289
  /**
@@ -501,7 +506,9 @@
501
  event_form_submit : function() {
502
  var sort_order = $('#wpsc_checkout_list').sortable('toArray');
503
  for (var index in sort_order) {
504
- $(this).append('<input type="hidden" name="sort_order[]" value="' + sort_order[index] + '" />');
 
 
505
  }
506
  return true;
507
  },
@@ -596,8 +603,8 @@
596
  */
597
  fix_sortable_helper : function(e, tr) {
598
  var row = tr.clone().width(tr.width());
599
- row.find('td').each(function(index){
600
- var td_class = $(this).attr('class'), original = tr.find('.' + td_class), old_html = $(this).html();
601
  $(this).width(original.width());
602
  });
603
  return row;
@@ -629,7 +636,7 @@
629
  ui.placeholder.html('<td colspan="7">&nbsp;</td>');
630
  },
631
 
632
- event_sort_stop : function(e,ui) {
633
  $('.form-field-options').each(function(){
634
  var options_row = $(this),
635
  id = $(this).data('field-id'),
@@ -1041,9 +1048,9 @@
1041
  history.pushState({'url' : new_url}, '', new_url);
1042
  }
1043
  spinner.toggleClass('ajax-feedback-active');
1044
- $('#gateway_settings_' + payment_gateway_id + '_form').remove();
1045
- $('#wpsc_gateway_settings_'+ payment_gateway_id).show( 400 );
1046
- $('#wpsc_gateway_settings_'+ payment_gateway_id + '_container').append(response.obj.content);
1047
  };
1048
 
1049
  if ( $( '#gateway_settings_' + payment_gateway_id + '_form' ).is( ':visible' ) ) {
@@ -1082,7 +1089,7 @@
1082
 
1083
  var checkbox = $( 'div#wpsc_google_analytics_integration input[type="checkbox"]' );
1084
 
1085
- $.each( checkbox, function( i, e ) {
1086
  if ( $(this).is( ':checked' ) )
1087
  $(this).parent('p').nextAll('p').hide();
1088
  });
13
  * @requires jQuery.query
14
  */
15
 
16
+ /*global jQuery, WPSC_Settings_Page, confirm, ajaxurl, alert */
17
  (function($){
18
 
19
  $.extend(WPSC_Settings_Page, /** @lends WPSC_Settings_Page */ {
278
  */
279
  event_show_images_only_clicked : function() {
280
  var i;
281
+
282
+ if ( $( this ).is( ':checked' ) ) {
283
+ for ( i in WPSC_Settings_Page.Presentation.grid_view_boxes ) {
284
+ if ( WPSC_Settings_Page.Presentation.grid_view_boxes.hasOwnProperty( i ) ) {
285
+ document.getElementById( WPSC_Settings_Page.Presentation.grid_view_boxes[ i ] ).checked = false;
286
+ }
287
  }
288
  }
289
  }
290
  };
291
+
292
  $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_presentation', WPSC_Settings_Page.Presentation.event_init);
293
 
294
  /**
506
  event_form_submit : function() {
507
  var sort_order = $('#wpsc_checkout_list').sortable('toArray');
508
  for (var index in sort_order) {
509
+ if ( sort_order.hasOwnProperty( index ) ) {
510
+ $(this).append('<input type="hidden" name="sort_order[]" value="' + sort_order[index] + '" />');
511
+ }
512
  }
513
  return true;
514
  },
603
  */
604
  fix_sortable_helper : function(e, tr) {
605
  var row = tr.clone().width(tr.width());
606
+ row.find('td').each(function(){
607
+ var td_class = $(this).attr('class'), original = tr.find('.' + td_class);
608
  $(this).width(original.width());
609
  });
610
  return row;
636
  ui.placeholder.html('<td colspan="7">&nbsp;</td>');
637
  },
638
 
639
+ event_sort_stop : function() {
640
  $('.form-field-options').each(function(){
641
  var options_row = $(this),
642
  id = $(this).data('field-id'),
1048
  history.pushState({'url' : new_url}, '', new_url);
1049
  }
1050
  spinner.toggleClass('ajax-feedback-active');
1051
+ $( '#gateway_settings_' + payment_gateway_id + '_form' ).remove();
1052
+ $( '#wpsc_gateway_settings_'+ payment_gateway_id ).show( 400 );
1053
+ $( '#wpsc_gateway_settings_'+ payment_gateway_id + '_container' ).append(response.obj.content);
1054
  };
1055
 
1056
  if ( $( '#gateway_settings_' + payment_gateway_id + '_form' ).is( ':visible' ) ) {
1089
 
1090
  var checkbox = $( 'div#wpsc_google_analytics_integration input[type="checkbox"]' );
1091
 
1092
+ $.each( checkbox, function() {
1093
  if ( $(this).is( ':checked' ) )
1094
  $(this).parent('p').nextAll('p').hide();
1095
  });
wpsc-admin/js/variations.js CHANGED
@@ -54,7 +54,9 @@ var wpsc_set_variation_product_thumbnail = function(id, src, thumbId) {
54
  };
55
 
56
  var wpsc_refresh_variation_iframe = function() {
57
- jQuery('#wpsc_product_variation_forms iframe')[0].contentWindow.location.reload();
 
 
58
  };
59
 
60
  (function($) {
54
  };
55
 
56
  var wpsc_refresh_variation_iframe = function() {
57
+ if ( jQuery( '#wpsc_product_variation_forms iframe' ).length > 0 ) {
58
+ jQuery('#wpsc_product_variation_forms iframe')[0].contentWindow.location.reload();
59
+ }
60
  };
61
 
62
  (function($) {
wpsc-admin/media.php CHANGED
@@ -18,8 +18,8 @@ function _wpsc_action_enqueue_media_scripts() {
18
  wp_enqueue_script( 'wpsc-media', WPSC_URL . '/wpsc-admin/js/media.js', array( 'media-editor', 'wp-e-commerce-admin', 'jquery-ui-sortable', 'post' ), WPSC_VERSION );
19
  wp_localize_script( 'wpsc-media', 'WPSC_Media', array(
20
  'l10n' => array(
21
- 'productMediaTitle' => __( 'Add Images to Product Gallery', 'wpsc' ),
22
- 'saveGallery' => __( 'Set Product Images', 'wpsc' ),
23
  ),
24
  'gallery' => $gallery,
25
  'updateGalleryNonce' => wp_create_nonce( 'wpsc_ajax_update_gallery_' . $id ),
@@ -39,8 +39,8 @@ function _wpsc_action_print_media_templates() {
39
  ?>
40
  <script type="text/html" id="tmpl-wpsc-featured-image">
41
  <div class="wpsc-media-featured-image">
42
- <span class="title"><?php _e( 'Featured image', 'wpsc' ); ?></span>
43
- <a class="edit-selection" href="#"><?php _ex( 'Edit', 'edit featured image', 'wpsc' ); ?></a>
44
  </div>
45
  <div class="wpsc-selection-view"></div>
46
  </script>
@@ -62,6 +62,11 @@ function _wpsc_ajax_get_variation_gallery() {
62
  );
63
  }
64
 
 
 
 
 
 
65
  function _wpsc_ajax_verify_save_product_gallery() {
66
  return _wpsc_ajax_verify_nonce( 'update_gallery_' . absint( $_REQUEST['postId'] ) );
67
  }
@@ -92,4 +97,4 @@ function _wpsc_ajax_get_product_gallery() {
92
  function _wpsc_get_product_gallery_json( $id ) {
93
  $attachments = wpsc_get_product_gallery( $id );
94
  return array_map( 'wp_prepare_attachment_for_js', $attachments );
95
- }
18
  wp_enqueue_script( 'wpsc-media', WPSC_URL . '/wpsc-admin/js/media.js', array( 'media-editor', 'wp-e-commerce-admin', 'jquery-ui-sortable', 'post' ), WPSC_VERSION );
19
  wp_localize_script( 'wpsc-media', 'WPSC_Media', array(
20
  'l10n' => array(
21
+ 'productMediaTitle' => __( 'Add Images to Product Gallery', 'wp-e-commerce' ),
22
+ 'saveGallery' => __( 'Set Product Images', 'wp-e-commerce' ),
23
  ),
24
  'gallery' => $gallery,
25
  'updateGalleryNonce' => wp_create_nonce( 'wpsc_ajax_update_gallery_' . $id ),
39
  ?>
40
  <script type="text/html" id="tmpl-wpsc-featured-image">
41
  <div class="wpsc-media-featured-image">
42
+ <span class="title"><?php _e( 'Featured image', 'wp-e-commerce' ); ?></span>
43
+ <a class="edit-selection" href="#"><?php _ex( 'Edit', 'edit featured image', 'wp-e-commerce' ); ?></a>
44
  </div>
45
  <div class="wpsc-selection-view"></div>
46
  </script>
62
  );
63
  }
64
 
65
+ /**
66
+ * Verifies the save product gallery AJAX nonce.
67
+ *
68
+ * @return WP_Error|boolean True if nonce is valid. WP_Error if otherwise.
69
+ */
70
  function _wpsc_ajax_verify_save_product_gallery() {
71
  return _wpsc_ajax_verify_nonce( 'update_gallery_' . absint( $_REQUEST['postId'] ) );
72
  }
97
  function _wpsc_get_product_gallery_json( $id ) {
98
  $attachments = wpsc_get_product_gallery( $id );
99
  return array_map( 'wp_prepare_attachment_for_js', $attachments );
100
+ }
wpsc-admin/settings-page.php CHANGED
@@ -202,14 +202,14 @@ final class WPSC_Settings_Page {
202
  */
203
  public static function init() {
204
  self::$default_tabs = array(
205
- 'general' => _x( 'General' , 'General settings tab in Settings->Store page' , 'wpsc' ),
206
- 'admin' => _x( 'Admin' , 'Admin settings tab in Settings->Store page' , 'wpsc' ),
207
- 'taxes' => _x( 'Taxes' , 'Taxes settings tab in Settings->Store page' , 'wpsc' ),
208
- 'shipping' => _x( 'Shipping' , 'Shipping settings tab in Settings->Store page' , 'wpsc' ),
209
- 'gateway' => _x( 'Payments' , 'Payments settings tab in Settings->Store page' , 'wpsc' ),
210
- 'checkout' => _x( 'Checkout' , 'Checkout settings tab in Settings->Store page' , 'wpsc' ),
211
- 'marketing' => _x( 'Marketing' , 'Marketing settings tab in Settings->Store page' , 'wpsc' ),
212
- 'import' => _x( 'Import' , 'Import settings tab in Settings->Store page' , 'wpsc' )
213
  );
214
 
215
  add_action( 'wpsc_register_settings_tabs' , array( 'WPSC_Settings_Page', 'register_default_tabs' ), 1 );
@@ -392,7 +392,7 @@ final class WPSC_Settings_Page {
392
  }
393
  if ( $this->current_tab->is_update_message_displayed() ) {
394
  if ( ! count( get_settings_errors() ) )
395
- add_settings_error( 'wpsc-settings', 'settings_updated', __( 'Settings saved.' ), 'updated' );
396
  set_transient( 'settings_errors', get_settings_errors(), 30 );
397
  $query_args['settings-updated'] = true;
398
  }
@@ -488,7 +488,7 @@ final class WPSC_Settings_Page {
488
  <?php do_action( 'wpsc_' . $this->current_tab_id . '_settings_page' ); ?>
489
  <div class="submit">
490
  <?php if ( $this->current_tab->is_submit_button_displayed() ): ?>
491
- <?php submit_button( __( 'Save Changes' ) ); ?>
492
  <?php endif ?>
493
  </div>
494
  </div>
@@ -510,7 +510,7 @@ final class WPSC_Settings_Page {
510
  <div id="wpsc_options" class="wrap">
511
  <div id="icon_card" class="icon32"></div>
512
  <h2 id="wpsc-settings-page-title">
513
- <?php esc_html_e( 'Store Settings', 'wpsc' ); ?>
514
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
515
  </h2>
516
  <?php $this->output_tabs(); ?>
202
  */
203
  public static function init() {
204
  self::$default_tabs = array(
205
+ 'general' => _x( 'General' , 'General settings tab in Settings->Store page' , 'wp-e-commerce' ),
206
+ 'admin' => _x( 'Admin' , 'Admin settings tab in Settings->Store page' , 'wp-e-commerce' ),
207
+ 'taxes' => _x( 'Taxes' , 'Taxes settings tab in Settings->Store page' , 'wp-e-commerce' ),
208
+ 'shipping' => _x( 'Shipping' , 'Shipping settings tab in Settings->Store page' , 'wp-e-commerce' ),
209
+ 'gateway' => _x( 'Payments' , 'Payments settings tab in Settings->Store page' , 'wp-e-commerce' ),
210
+ 'checkout' => _x( 'Checkout' , 'Checkout settings tab in Settings->Store page' , 'wp-e-commerce' ),
211
+ 'marketing' => _x( 'Marketing' , 'Marketing settings tab in Settings->Store page' , 'wp-e-commerce' ),
212
+ 'import' => _x( 'Import' , 'Import settings tab in Settings->Store page' , 'wp-e-commerce' )
213
  );
214
 
215
  add_action( 'wpsc_register_settings_tabs' , array( 'WPSC_Settings_Page', 'register_default_tabs' ), 1 );
392
  }
393
  if ( $this->current_tab->is_update_message_displayed() ) {
394
  if ( ! count( get_settings_errors() ) )
395
+ add_settings_error( 'wpsc-settings', 'settings_updated', __( 'Settings saved.', 'wp-e-commerce' ), 'updated' );
396
  set_transient( 'settings_errors', get_settings_errors(), 30 );
397
  $query_args['settings-updated'] = true;
398
  }
488
  <?php do_action( 'wpsc_' . $this->current_tab_id . '_settings_page' ); ?>
489
  <div class="submit">
490
  <?php if ( $this->current_tab->is_submit_button_displayed() ): ?>
491
+ <?php submit_button( __( 'Save Changes', 'wp-e-commerce' ) ); ?>
492
  <?php endif ?>
493
  </div>
494
  </div>
510
  <div id="wpsc_options" class="wrap">
511
  <div id="icon_card" class="icon32"></div>
512
  <h2 id="wpsc-settings-page-title">
513
+ <?php esc_html_e( 'Store Settings', 'wp-e-commerce' ); ?>
514
  <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
515
  </h2>
516
  <?php $this->output_tabs(); ?>
wpsc-admin/users.php CHANGED
@@ -3,5 +3,5 @@ _wpsc_deprecated_file(
3
  __FILE__,
4
  '3.9',
5
  '',
6
- __( 'The sole function that existed in users.php has now been deprecated.', 'wpsc' )
7
  );
3
  __FILE__,
4
  '3.9',
5
  '',
6
+ __( 'The sole function that existed in users.php has now been deprecated.', 'wp-e-commerce' )
7
  );
wpsc-components/marketplace-core-v1/library/Sputnik.php CHANGED
@@ -299,7 +299,7 @@ class Sputnik {
299
 
300
  $id = absint( $purchase_log->get( 'id' ) );
301
 
302
- //Also checking is_order_received, as that's what Manual Payments do.
303
  if ( $purchase_log->is_transaction_completed() || $purchase_log->is_order_received() ) {
304
 
305
  $pushed_to_sass = wpsc_get_meta( $id, '_pushed_to_wpeconomy', 'purchase_log' );
@@ -309,8 +309,8 @@ class Sputnik {
309
  $data = $purchase_log->get_data();
310
  $cart_contents = $purchase_log->get_cart_contents();
311
 
312
- //We want to push sales data - but naturally, IDs will differ, even names could potentially.
313
- //So we add the slug to the object we POST
314
  foreach ( $cart_contents as $key => $cart_item ) {
315
  $slug = get_post_field( 'post_name', $cart_item->prodid );
316
  $cart_contents[ $key ]->slug = $slug;
@@ -320,7 +320,7 @@ class Sputnik {
320
  'body' => array( 'data' => json_encode( $data ), 'cart_contents' => json_encode( $cart_contents ) )
321
  );
322
 
323
- $request = wp_remote_post( 'http://www.wpeconomy.org/?sales_data=true', $args );
324
  $response = wp_remote_retrieve_response_code( $request );
325
 
326
  //For some reason, if the site is down, we want the ability to ensure we can grab the sale later.
299
 
300
  $id = absint( $purchase_log->get( 'id' ) );
301
 
302
+ // Also checking is_order_received, as that's what Manual Payments do.
303
  if ( $purchase_log->is_transaction_completed() || $purchase_log->is_order_received() ) {
304
 
305
  $pushed_to_sass = wpsc_get_meta( $id, '_pushed_to_wpeconomy', 'purchase_log' );
309
  $data = $purchase_log->get_data();
310
  $cart_contents = $purchase_log->get_cart_contents();
311
 
312
+ // We want to push sales data - but naturally, IDs will differ, even names could potentially.
313
+ // So we add the slug to the object we POST
314
  foreach ( $cart_contents as $key => $cart_item ) {
315
  $slug = get_post_field( 'post_name', $cart_item->prodid );
316
  $cart_contents[ $key ]->slug = $slug;
320
  'body' => array( 'data' => json_encode( $data ), 'cart_contents' => json_encode( $cart_contents ) )
321
  );
322
 
323
+ $request = wp_safe_remote_post( 'http://www.wpeconomy.org/?sales_data=true', $args );
324
  $response = wp_remote_retrieve_response_code( $request );
325
 
326
  //For some reason, if the site is down, we want the ability to ensure we can grab the sale later.
wpsc-components/marketplace-core-v1/library/Sputnik/API.php CHANGED
@@ -121,7 +121,7 @@ class Sputnik_API {
121
  // Close the authentication popup ?>
122
  <!DOCTYPE html><html>
123
  <head>
124
- <title><?php _e( 'Redirecting ...', 'wpsc' ); ?></title>
125
  <script type="text/javascript">
126
  parent.location = '<?php echo wp_validate_redirect( $return_url ); ?>';
127
  window.close();
@@ -210,7 +210,7 @@ class Sputnik_API {
210
  $args['headers']['user-agent'] = 'WP eCommerce Marketplace: ' . WPSC_VERSION;
211
  $args['headers']['X-WP-Domain'] = self::domain();
212
 
213
- $request = wp_remote_request( esc_url_raw( $url ), $args );
214
 
215
  if ( is_wp_error( $request ) ) {
216
  throw new Exception( $request->get_error_message() );
@@ -243,4 +243,4 @@ class Sputnik_API {
243
 
244
  return $wp_install;
245
  }
246
- }
121
  // Close the authentication popup ?>
122
  <!DOCTYPE html><html>
123
  <head>
124
+ <title><?php _e( 'Redirecting...', 'wp-e-commerce' ); ?></title>
125
  <script type="text/javascript">
126
  parent.location = '<?php echo wp_validate_redirect( $return_url ); ?>';
127
  window.close();
210
  $args['headers']['user-agent'] = 'WP eCommerce Marketplace: ' . WPSC_VERSION;
211
  $args['headers']['X-WP-Domain'] = self::domain();
212
 
213
+ $request = wp_safe_remote_request( esc_url_raw( $url ), $args );
214
 
215
  if ( is_wp_error( $request ) ) {
216
  throw new Exception( $request->get_error_message() );
243
 
244
  return $wp_install;
245
  }
246
+ }
wpsc-components/marketplace-core-v1/library/Sputnik/API/Auth.php CHANGED
@@ -123,7 +123,7 @@ class Sputnik_API_Auth {
123
 
124
  $args['headers'] = array( 'X-WP-Domain' => Sputnik_API::domain() );
125
 
126
- $response = wp_remote_request($url, $args);
127
 
128
  if (is_wp_error($response)) {
129
  throw new Exception($response->get_error_message());
123
 
124
  $args['headers'] = array( 'X-WP-Domain' => Sputnik_API::domain() );
125
 
126
+ $response = wp_safe_remote_request($url, $args);
127
 
128
  if (is_wp_error($response)) {
129
  throw new Exception($response->get_error_message());
wpsc-components/marketplace-core-v1/library/Sputnik/Admin.php CHANGED
@@ -95,7 +95,7 @@ class Sputnik_Admin {
95
  return;
96
  }
97
  ?>
98
- <div class="error"><p><?php _e('The following plugins are disabled:', 'wpsc') ?></p>
99
  <ul>
100
  <?php
101
  foreach ($invalid as $plugin) {
@@ -104,10 +104,10 @@ class Sputnik_Admin {
104
  }
105
  switch ($plugin['sputnik_error']) {
106
  case 'not_purchased':
107
- $error = __('Not purchased', 'wpsc');
108
  break;
109
  default:
110
- $error = __('Unknown error', 'wpsc');
111
  break;
112
  }
113
  ?>
@@ -127,7 +127,7 @@ class Sputnik_Admin {
127
  if (empty($data['Sputnik ID'])) {
128
  return $meta;
129
  }
130
- echo '<a class="sputnik-plugin-row-note" href="' . self::build_url() . '"><span class="powered">' . __( 'Powered by WPEConomy', 'wpsc' ) . '</span><span class="corner"></span></a>';
131
  return $meta;
132
  }
133
 
@@ -190,17 +190,17 @@ class Sputnik_Admin {
190
  ?>
191
  <div class="sputnik-message updated">
192
  <p>
193
- <?php _e( '<strong>WPEConomy is now installed!</strong> &#8211; Get started by linking with your account!', 'wpsc' ); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
194
- <?php _e( "If you haven't created an account yet, don't worry, you will be prompted to do so.", 'wpsc') ?>
195
  </p>
196
- <a href="<?php echo esc_html( $oauth_url ); ?>" class="thickbox button button-primary thickbox`"><?php _e( 'Link your account now', 'wpsc' ); ?></a>
197
  </div>
198
  <?php
199
  }
200
 
201
  public static function admin_notices() {
202
  if ( isset( $_GET['payment_cancelled'] ) ) {
203
- self::print_message( __( 'Payment cancelled.', 'wpsc' ) );
204
  }
205
  }
206
 
@@ -227,7 +227,7 @@ class Sputnik_Admin {
227
  }
228
 
229
  public static function menu() {
230
- $hooks[] = add_submenu_page( 'edit.php?post_type=wpsc-product', _x( 'Extensions', 'page title', 'wpsc' ), _x( '<span id="wpsc-extensions-menu-link">Extensions</span>', 'menu title', 'wpsc' ), 'install_plugins', 'sputnik', array( __CLASS__, 'page' ) );
231
  $hooks[] = 'plugin-install.php';
232
 
233
  foreach ( $hooks as $hook ) {
@@ -242,7 +242,7 @@ class Sputnik_Admin {
242
  if (!empty($args)) {
243
  $url = add_query_arg( $args, $url );
244
  }
245
- return esc_url( $url );
246
  }
247
 
248
  public static function build_account_url($args = array()) {
@@ -250,7 +250,7 @@ class Sputnik_Admin {
250
  if (!empty($args)) {
251
  $url = add_query_arg( $args, $url );
252
  }
253
- return esc_url( $url );
254
  }
255
 
256
  public static function page_styles() {
@@ -282,8 +282,8 @@ class Sputnik_Admin {
282
  wp_enqueue_script( 'wpsc-marketplace-js', plugins_url( 'static/admin.js', Sputnik::$path . '/wpsc-marketplace' ), array( 'jquery', 'jquery-masonry', 'thickbox', 'paypal' ), '20141109' );
283
 
284
  $l10n = array(
285
- 'plugin_information' => __( 'Plugin Information:', 'wpsc' ),
286
- 'ays' => __( 'Are you sure you want to install this plugin?', 'wpsc' )
287
  );
288
 
289
  if ( ! empty( $_REQUEST['oauth_buy'] ) ) {
@@ -344,7 +344,7 @@ class Sputnik_Admin {
344
  }
345
  } catch (Exception $e) {
346
  status_header(500);
347
- iframe_header( __('Plugin Install', 'wpsc') );
348
  echo $e->getMessage();
349
  iframe_footer();
350
  die();
@@ -358,12 +358,12 @@ class Sputnik_Admin {
358
  'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
359
 
360
  $plugins_section_titles = array(
361
- 'description' => _x('Description', 'Plugin installer section title', 'wpsc'),
362
- 'installation' => _x('Installation', 'Plugin installer section title', 'wpsc'),
363
- 'faq' => _x('FAQ', 'Plugin installer section title', 'wpsc'),
364
- 'screenshots' => _x('Screenshots', 'Plugin installer section title', 'wpsc'),
365
- 'changelog' => _x('Changelog', 'Plugin installer section title', 'wpsc'),
366
- 'other_notes' => _x('Other Notes', 'Plugin installer section title', 'wpsc')
367
  );
368
 
369
  //Sanitize HTML
@@ -394,33 +394,34 @@ class Sputnik_Admin {
394
 
395
  global $body_id;
396
  $body_id = 'sputnik-plugin-information';
397
- iframe_header( __('Plugin Install', 'wpsc') );
398
  ?>
399
  <div class="alignleft fyi">
400
  <h1><?php echo $api->name ?></h1>
401
  <?php if ( ! empty($api->download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?>
402
  <p class="action-button">
403
  <?php
404
- $status = self::install_status($api);
 
405
  switch ( $status['status'] ) {
406
  case 'purchase':
407
  default:
408
  if ( $status['url'] )
409
- echo '<a href="' . $status['url'] . '" target="_parent" id="' . $plugin . '" class="button-primary buy">' . sprintf(__('<span>$%.2f</span> Buy &amp; Install', 'wpsc'), $api->price) . '</a>';
410
  break;
411
  case 'install':
412
  if ( $status['url'] )
413
- echo '<a href="' . $status['url'] . '" class="button-primary install" title="' . __('You have already purchased, install now', 'wpsc') . '">' . __('Install Now', 'wpsc') . '</a>';
414
  break;
415
  case 'update_available':
416
  if ( $status['url'] )
417
- echo '<a href="' . $status['url'] . '" class="button-primary install">' . __('Install Update Now', 'wpsc') .'</a>';
418
  break;
419
  case 'newer_installed':
420
- echo '<a>' . sprintf(__('Newer Version (%s) Installed', 'wpsc'), $status['version']) . '</a>';
421
  break;
422
  case 'latest_installed':
423
- echo '<a>' . __('Latest Version Installed', 'wpsc') . '</a>';
424
  break;
425
  }
426
  ?>
@@ -452,43 +453,43 @@ class Sputnik_Admin {
452
  echo "</ul>\n";
453
  echo "</div>\n";
454
  ?>
455
- <h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI', 'wpsc') ?></h2>
456
  <ul>
457
  <?php if ( ! empty($api->version) ) : ?>
458
- <li><strong><?php _e('Version:', 'wpsc') ?></strong> <?php echo $api->version ?></li>
459
  <?php endif; if ( ! empty($api->author) ) : ?>
460
- <li><strong><?php _e('Author:', 'wpsc') ?></strong> <?php echo $api->author ?></li>
461
  <?php endif; if ( ! empty($api->last_updated) ) : ?>
462
- <li><strong><?php _e('Last Updated:', 'wpsc') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
463
- printf( __('%s ago', 'wpsc'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
464
  <?php endif; if ( ! empty($api->requires) ) : ?>
465
- <li><strong><?php _e('Requires WordPress Version:', 'wpsc') ?></strong> <?php printf(__('%s or higher', 'wpsc'), $api->requires) ?></li>
466
  <?php endif; if ( ! empty($api->tested) ) : ?>
467
- <li><strong><?php _e('Compatible up to:', 'wpsc') ?></strong> <?php echo $api->tested ?></li>
468
  <?php endif; if ( ! empty($api->requires_wpec) ) : ?>
469
- <li><strong><?php _e('Requires WPeC Version:', 'wpsc') ?></strong> <?php printf(__('%s or higher', 'wpsc'), $api->requires_wpec) ?></li>
470
  <?php endif; if ( ! empty($api->tested_wpec) ) : ?>
471
- <li><strong><?php _e('Compatible up to WPEC Version:', 'wpsc') ?></strong> <?php echo $api->tested_wpec ?></li>
472
  <?php endif; if ( ! empty($api->downloaded) ) : ?>
473
- <li><strong><?php _e('Downloaded:', 'wpsc') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded, 'wpsc'), number_format_i18n($api->downloaded)) ?></li>
474
  <?php endif; if ( ! empty($api->homepage) ) : ?>
475
- <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage &#187;', 'wpsc') ?></a></li>
476
  <?php endif; ?>
477
  </ul>
478
  </div>
479
  <div id="section-holder" class="wrap">
480
  <?php
481
  if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )
482
- echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.', 'wpsc') . '</p></div>';
483
 
484
  else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )
485
- echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.', 'wpsc') . '</p></div>';
486
 
487
  else if ( !empty($api->requires_wpec) && version_compare( substr( WPSC_VERSION, 0, strlen($api->requires_wpec)), $api->requires_wpec, '<') )
488
- echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WP eCommerce.', 'wpsc') . '</p></div>';
489
 
490
  else if ( !empty($api->tested_wpec) && version_compare( substr( WPSC_VERSION, 0, strlen($api->tested_wpec)), $api->tested_wpec, '<') )
491
- echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your version of WP eCommerce.', 'wpsc') . '</p></div>';
492
 
493
  foreach ( $api->sections as $section_name => $content ) {
494
  if ( isset( $plugins_section_titles[ $section_name ] ) )
@@ -573,8 +574,9 @@ class Sputnik_Admin {
573
  if ('install' == $status) {
574
  $installed = get_plugins();
575
  $real = false;
576
- foreach ($installed as $plugin) {
577
- if (!empty($plugin['Sputnik ID']) && $plugin['Sputnik ID'] === $api->slug) {
 
578
  $real = $plugin;
579
  break;
580
  }
@@ -624,8 +626,8 @@ class Sputnik_Admin {
624
  protected static function header( $account ) {
625
  if ($account !== false) {
626
  $tabs = array(
627
- 'dash' => __('Store', 'wpsc'),
628
- 'account' => __('Your Account', 'wpsc'),
629
  );
630
  $hrefs = array(
631
  'dash' => self::build_url(),
@@ -636,7 +638,7 @@ class Sputnik_Admin {
636
  }
637
  ?>
638
  <div class="wrap" id="sputnik-page">
639
- <h2><?php _e( 'Marketplace', 'wpsc' ); ?></h2>
640
  <?php
641
  do_action('sputnik_messages');
642
  }
@@ -654,7 +656,7 @@ class Sputnik_Admin {
654
  delete_option('sputnik_oauth_request');
655
  }
656
  elseif ( $e->getCode() !== 1 ) {
657
- echo '<p>' . sprintf(__('Problem: %s', 'wpsc'), $e->getMessage() ). '</p>';
658
  }
659
  }
660
 
@@ -668,14 +670,14 @@ class Sputnik_Admin {
668
  <?php echo get_avatar($account->email) ?>
669
  <p class="lead-in">Logged in as</p>
670
  <h3><?php echo esc_html($account->name) ?></h3>
671
- <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wpsc'), self::build_url(array('oauth' => 'reset'))) ?></p>
672
  </div>
673
  <div class="block">
674
  <p>Email: <code><?php echo $account->email ?></code></p>
675
  <?php if ( $tab != 'purchased' ): ?>
676
- <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wpsc'), count( self::$list_table->items )) ?></p>
677
  <?php endif; ?>
678
- <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wpsc'), count( $account->purchased ) ) ?></p>
679
  </div>
680
  </div>
681
  <?php
@@ -688,14 +690,14 @@ class Sputnik_Admin {
688
  * Output the main landing page for the Sputnik administration screen.
689
  */
690
  protected static function dashboard() { ?>
691
- <p><?php _e('Some text about WPEconomy goes here! This will eventually be replaced with a dashboard-like interface, including latest news, etc.', 'wpsc'); ?></p>
692
 
693
- <h4><?php _e('Search', 'wpsc') ?></h4>
694
- <p class="install-help"><?php _e('Search for plugins by keyword.', 'wpsc') ?></p>
695
  <?php Sputnik_Admin::search_form(); ?>
696
 
697
- <h4><?php _e('Popular tags') ?></h4>
698
- <p class="install-help"><?php _e('You may also browse based on the most popular tags on the store:', 'wpsc') ?></p>
699
  <?php
700
  echo '<p class="popular-tags">';
701
 
@@ -712,7 +714,7 @@ class Sputnik_Admin {
712
  'count' => $tag->count
713
  );
714
  }
715
- echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%s plugin', 'wpsc'), 'multiple_text' => __('%s plugins', 'wpsc') ) );
716
  }
717
  catch (Exception $e) {
718
  echo $e->getMessage();
@@ -740,7 +742,7 @@ class Sputnik_Admin {
740
  }
741
  else {
742
  self::header('Account', $account);
743
- echo '<p>' . sprintf(__('Problem: %s', 'wpsc'), $e->getMessage()) . '</p>';
744
 
745
  return;
746
  }
@@ -753,12 +755,12 @@ class Sputnik_Admin {
753
  <?php echo get_avatar($account->email) ?>
754
  <p class="lead-in">Logged in as</p>
755
  <h3><?php echo esc_html($account->name) ?></h3>
756
- <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wpsc'), self::build_url(array('oauth' => 'reset'))) ?></p>
757
  </div>
758
  <div class="block">
759
  <p>Email: <code><?php echo $account->email ?></code></p>
760
- <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wpsc'), count($account->purchased)) ?></p>
761
- <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wpsc'), count(self::$list_table->items)) ?></p>
762
  </div>
763
  </div>
764
 
@@ -771,7 +773,7 @@ class Sputnik_Admin {
771
  $oauth_url = self::build_url(array('oauth' => 'request', 'TB_iframe' => true));
772
 
773
  if ( isset( $_GET['auth'] ) && $_GET['auth'] == 'denied' ) {
774
- self::print_message( __( 'Authorization cancelled.', 'wpsc' ) );
775
  }
776
  }
777
 
@@ -811,11 +813,11 @@ class Sputnik_Admin {
811
  // Update Sputnik account to include newly purchased plugin
812
  Sputnik::update_account();
813
 
814
- $install_url = self::build_url(array('install' => $product_slug));
815
  $install_url = add_query_arg('_wpnonce', wp_create_nonce('sputnik_install-plugin_' . $product_slug), $install_url);
816
- $install_url = esc_url( add_query_arg(array('TB_iframe' => true), $install_url) );
817
 
818
- self::iframe_closer( self::build_url( array('run-installer' => urlencode( $install_url ) ) ), __( 'Installing ... ', 'wpsc' ) );
819
  }
820
 
821
  /**
@@ -828,7 +830,7 @@ class Sputnik_Admin {
828
 
829
  $cancelled_url = self::build_url( array( 'payment_cancelled' => true ) );
830
 
831
- self::iframe_closer( $cancelled_url, __( 'Payment Cancelled', 'wpsc' ) );
832
  }
833
 
834
  protected static function install($id) {
@@ -840,7 +842,7 @@ class Sputnik_Admin {
840
  }
841
  catch (Exception $e) {
842
  status_header(500);
843
- iframe_header( __('Plugin Install', 'wpsc') );
844
  echo $e->getMessage();
845
  iframe_footer();
846
  die();
@@ -852,7 +854,7 @@ class Sputnik_Admin {
852
  }
853
 
854
  if ( ! current_user_can('install_plugins') )
855
- wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'wpsc'));
856
 
857
  include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
858
 
@@ -860,9 +862,9 @@ class Sputnik_Admin {
860
 
861
  global $body_id;
862
  $body_id = 'sputnik-install';
863
- iframe_header( __('Plugin Install', 'wpsc') );
864
 
865
- $title = sprintf( __('Installing Plugin: %s', 'wpsc'), $api->name . ' ' . $api->version );
866
  $nonce = 'sputnik_install-plugin_' . $id;
867
  $url = 'update.php?action=install-plugin&plugin=' . $id;
868
  if ( isset($_GET['from']) )
@@ -888,14 +890,14 @@ class Sputnik_Admin {
888
  try {
889
  $data = Sputnik::get_from_file($file);
890
  if ($data === null) {
891
- throw new Exception(__('Plugin not found', 'wpsc'));
892
  }
893
  $id = $data['Sputnik ID'];
894
  $api = Sputnik::get_plugin($id);
895
  }
896
  catch (Exception $e) {
897
  status_header(500);
898
- iframe_header( __('Update Plugin', 'wpsc') );
899
  echo $e->getMessage();
900
  iframe_footer();
901
  die();
@@ -907,7 +909,7 @@ class Sputnik_Admin {
907
  }
908
 
909
  if ( ! current_user_can('install_plugins') )
910
- wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'wpsc'));
911
 
912
  include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
913
 
@@ -915,9 +917,9 @@ class Sputnik_Admin {
915
 
916
  global $body_id;
917
  $body_id = 'sputnik-upgrade';
918
- iframe_header( __('Update Plugin', 'wpsc') );
919
 
920
- $title = sprintf( __('Updating Plugin: %s', 'wpsc'), $api->name . ' ' . $api->version );
921
  $nonce = 'sputnik_upgrade-plugin_' . $id;
922
  $url = 'update.php?action=upgrade-plugin&plugin=' . $id;
923
  if ( isset($_GET['from']) )
@@ -946,7 +948,7 @@ class Sputnik_Admin {
946
  <input type="hidden" name="post_type" value="wpsc-product" />
947
  <input type="hidden" name="tab" value="search" />
948
  <input type="text" name="s" value="<?php echo esc_attr($term) ?>" />
949
- <?php submit_button( __( 'Search Plugins' ), 'button', '', false ); ?>
950
  </form><?php
951
  }
952
 
@@ -959,7 +961,7 @@ class Sputnik_Admin {
959
  */
960
  public static function iframe_closer( $redirect_url, $title = null ) {
961
  if (empty($title)) {
962
- $title = __('Redirecting...', 'wpsc');
963
  }
964
  ?>
965
  <!DOCTYPE html><html>
95
  return;
96
  }
97
  ?>
98
+ <div class="error"><p><?php _e('The following plugins are disabled:', 'wp-e-commerce') ?></p>
99
  <ul>
100
  <?php
101
  foreach ($invalid as $plugin) {
104
  }
105
  switch ($plugin['sputnik_error']) {
106
  case 'not_purchased':
107
+ $error = __('Not purchased', 'wp-e-commerce');
108
  break;
109
  default:
110
+ $error = __('Unknown error', 'wp-e-commerce');
111
  break;
112
  }
113
  ?>
127
  if (empty($data['Sputnik ID'])) {
128
  return $meta;
129
  }
130
+ echo '<a class="sputnik-plugin-row-note" href="' . self::build_url() . '"><span class="powered">' . __( 'Powered by WPEConomy', 'wp-e-commerce' ) . '</span><span class="corner"></span></a>';
131
  return $meta;
132
  }
133
 
190
  ?>
191
  <div class="sputnik-message updated">
192
  <p>
193
+ <?php _e( '<strong>WPEConomy is now installed!</strong> &#8211; Get started by linking with your account!', 'wp-e-commerce' ); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
194
+ <?php _e( "If you haven't created an account yet, don't worry, you will be prompted to do so.", 'wp-e-commerce') ?>
195
  </p>
196
+ <a href="<?php echo esc_html( $oauth_url ); ?>" class="thickbox button button-primary thickbox`"><?php _e( 'Link your account now', 'wp-e-commerce' ); ?></a>
197
  </div>
198
  <?php
199
  }
200
 
201
  public static function admin_notices() {
202
  if ( isset( $_GET['payment_cancelled'] ) ) {
203
+ self::print_message( __( 'Payment cancelled.', 'wp-e-commerce' ) );
204
  }
205
  }
206
 
227
  }
228
 
229
  public static function menu() {
230
+ $hooks[] = add_submenu_page( 'edit.php?post_type=wpsc-product', _x( 'Extensions', 'page title', 'wp-e-commerce' ), _x( '<span id="wpsc-extensions-menu-link">Extensions</span>', 'menu title', 'wp-e-commerce' ), 'install_plugins', 'sputnik', array( __CLASS__, 'page' ) );
231
  $hooks[] = 'plugin-install.php';
232
 
233
  foreach ( $hooks as $hook ) {
242
  if (!empty($args)) {
243
  $url = add_query_arg( $args, $url );
244
  }
245
+ return esc_url_raw( $url );
246
  }
247
 
248
  public static function build_account_url($args = array()) {
250
  if (!empty($args)) {
251
  $url = add_query_arg( $args, $url );
252
  }
253
+ return esc_url_raw( $url );
254
  }
255
 
256
  public static function page_styles() {
282
  wp_enqueue_script( 'wpsc-marketplace-js', plugins_url( 'static/admin.js', Sputnik::$path . '/wpsc-marketplace' ), array( 'jquery', 'jquery-masonry', 'thickbox', 'paypal' ), '20141109' );
283
 
284
  $l10n = array(
285
+ 'plugin_information' => __( 'Plugin Information:', 'wp-e-commerce' ),
286
+ 'ays' => __( 'Are you sure you want to install this plugin?', 'wp-e-commerce' )
287
  );
288
 
289
  if ( ! empty( $_REQUEST['oauth_buy'] ) ) {
344
  }
345
  } catch (Exception $e) {
346
  status_header(500);
347
+ iframe_header( __('Plugin Install', 'wp-e-commerce') );
348
  echo $e->getMessage();
349
  iframe_footer();
350
  die();
358
  'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
359
 
360
  $plugins_section_titles = array(
361
+ 'description' => _x('Description', 'Plugin installer section title', 'wp-e-commerce'),
362
+ 'installation' => _x('Installation', 'Plugin installer section title', 'wp-e-commerce'),
363
+ 'faq' => _x('FAQ', 'Plugin installer section title', 'wp-e-commerce'),
364
+ 'screenshots' => _x('Screenshots', 'Plugin installer section title', 'wp-e-commerce'),
365
+ 'changelog' => _x('Changelog', 'Plugin installer section title', 'wp-e-commerce'),
366
+ 'other_notes' => _x('Other Notes', 'Plugin installer section title', 'wp-e-commerce')
367
  );
368
 
369
  //Sanitize HTML
394
 
395
  global $body_id;
396
  $body_id = 'sputnik-plugin-information';
397
+ iframe_header( __('Plugin Install', 'wp-e-commerce') );
398
  ?>
399
  <div class="alignleft fyi">
400
  <h1><?php echo $api->name ?></h1>
401
  <?php if ( ! empty($api->download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?>
402
  <p class="action-button">
403
  <?php
404
+ $status = self::install_status( $api );
405
+
406
  switch ( $status['status'] ) {
407
  case 'purchase':
408
  default:
409
  if ( $status['url'] )
410
+ echo '<a href="' . $status['url'] . '" target="_parent" id="' . $plugin . '" class="button-primary buy">' . sprintf(__('<span>$%.2f</span> Buy &amp; Install', 'wp-e-commerce'), $api->price) . '</a>';
411
  break;
412
  case 'install':
413
  if ( $status['url'] )
414
+ echo '<a href="' . $status['url'] . '" class="button-primary install" title="' . __('You have already purchased, install now', 'wp-e-commerce') . '">' . __('Install Now', 'wp-e-commerce') . '</a>';
415
  break;
416
  case 'update_available':
417
  if ( $status['url'] )
418
+ echo '<a href="' . $status['url'] . '" class="button-primary install">' . __('Install Update Now', 'wp-e-commerce') .'</a>';
419
  break;
420
  case 'newer_installed':
421
+ echo '<a>' . sprintf(__('Newer Version (%s) Installed', 'wp-e-commerce'), $status['version']) . '</a>';
422
  break;
423
  case 'latest_installed':
424
+ echo '<a>' . __('Latest Version Installed', 'wp-e-commerce') . '</a>';
425
  break;
426
  }
427
  ?>
453
  echo "</ul>\n";
454
  echo "</div>\n";
455
  ?>
456
+ <h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI', 'wp-e-commerce') ?></h2>
457
  <ul>
458
  <?php if ( ! empty($api->version) ) : ?>
459
+ <li><strong><?php _e('Version:', 'wp-e-commerce') ?></strong> <?php echo $api->version ?></li>
460
  <?php endif; if ( ! empty($api->author) ) : ?>
461
+ <li><strong><?php _e('Author:', 'wp-e-commerce') ?></strong> <?php echo $api->author ?></li>
462
  <?php endif; if ( ! empty($api->last_updated) ) : ?>
463
+ <li><strong><?php _e('Last Updated:', 'wp-e-commerce') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
464
+ printf( __('%s ago', 'wp-e-commerce'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
465
  <?php endif; if ( ! empty($api->requires) ) : ?>
466
+ <li><strong><?php _e('Requires WordPress Version:', 'wp-e-commerce') ?></strong> <?php printf(__('%s or higher', 'wp-e-commerce'), $api->requires) ?></li>
467
  <?php endif; if ( ! empty($api->tested) ) : ?>
468
+ <li><strong><?php _e('Compatible up to:', 'wp-e-commerce') ?></strong> <?php echo $api->tested ?></li>
469
  <?php endif; if ( ! empty($api->requires_wpec) ) : ?>
470
+ <li><strong><?php _e('Requires WPeC Version:', 'wp-e-commerce') ?></strong> <?php printf(__('%s or higher', 'wp-e-commerce'), $api->requires_wpec) ?></li>
471
  <?php endif; if ( ! empty($api->tested_wpec) ) : ?>
472
+ <li><strong><?php _e('Compatible up to WPEC Version:', 'wp-e-commerce') ?></strong> <?php echo $api->tested_wpec ?></li>
473
  <?php endif; if ( ! empty($api->downloaded) ) : ?>
474
+ <li><strong><?php _e('Downloaded:', 'wp-e-commerce') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded, 'wp-e-commerce'), number_format_i18n($api->downloaded)) ?></li>
475
  <?php endif; if ( ! empty($api->homepage) ) : ?>
476
+ <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage &#187;', 'wp-e-commerce') ?></a></li>
477
  <?php endif; ?>
478
  </ul>
479
  </div>
480
  <div id="section-holder" class="wrap">
481
  <?php
482
  if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )
483
+ echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.', 'wp-e-commerce') . '</p></div>';
484
 
485
  else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )
486
+ echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.', 'wp-e-commerce') . '</p></div>';
487
 
488
  else if ( !empty($api->requires_wpec) && version_compare( substr( WPSC_VERSION, 0, strlen($api->requires_wpec)), $api->requires_wpec, '<') )
489
+ echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WP eCommerce.', 'wp-e-commerce') . '</p></div>';
490
 
491
  else if ( !empty($api->tested_wpec) && version_compare( substr( WPSC_VERSION, 0, strlen($api->tested_wpec)), $api->tested_wpec, '<') )
492
+ echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your version of WP eCommerce.', 'wp-e-commerce') . '</p></div>';
493
 
494
  foreach ( $api->sections as $section_name => $content ) {
495
  if ( isset( $plugins_section_titles[ $section_name ] ) )
574
  if ('install' == $status) {
575
  $installed = get_plugins();
576
  $real = false;
577
+
578
+ foreach ( $installed as $plugin ) {
579
+ if ( ! empty( $plugin['Sputnik ID'] ) && $plugin['Sputnik ID'] === $api->slug ) {
580
  $real = $plugin;
581
  break;
582
  }
626
  protected static function header( $account ) {
627
  if ($account !== false) {
628
  $tabs = array(
629
+ 'dash' => __('Store', 'wp-e-commerce'),
630
+ 'account' => __('Your Account', 'wp-e-commerce'),
631
  );
632
  $hrefs = array(
633
  'dash' => self::build_url(),
638
  }
639
  ?>
640
  <div class="wrap" id="sputnik-page">
641
+ <h2><?php _e( 'Marketplace', 'wp-e-commerce' ); ?></h2>
642
  <?php
643
  do_action('sputnik_messages');
644
  }
656
  delete_option('sputnik_oauth_request');
657
  }
658
  elseif ( $e->getCode() !== 1 ) {
659
+ echo '<p>' . sprintf(__('Problem: %s', 'wp-e-commerce'), $e->getMessage() ). '</p>';
660
  }
661
  }
662
 
670
  <?php echo get_avatar($account->email) ?>
671
  <p class="lead-in">Logged in as</p>
672
  <h3><?php echo esc_html($account->name) ?></h3>
673
+ <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wp-e-commerce'), self::build_url(array('oauth' => 'reset'))) ?></p>
674
  </div>
675
  <div class="block">
676
  <p>Email: <code><?php echo $account->email ?></code></p>
677
  <?php if ( $tab != 'purchased' ): ?>
678
+ <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wp-e-commerce'), count( self::$list_table->items )) ?></p>
679
  <?php endif; ?>
680
+ <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wp-e-commerce'), count( $account->purchased ) ) ?></p>
681
  </div>
682
  </div>
683
  <?php
690
  * Output the main landing page for the Sputnik administration screen.
691
  */
692
  protected static function dashboard() { ?>
693
+ <p><?php _e('Some text about WPEconomy goes here! This will eventually be replaced with a dashboard-like interface, including latest news, etc.', 'wp-e-commerce'); ?></p>
694
 
695
+ <h4><?php _e( 'Search', 'wp-e-commerce' ) ?></h4>
696
+ <p class="install-help"><?php _e('Search for plugins by keyword.', 'wp-e-commerce') ?></p>
697
  <?php Sputnik_Admin::search_form(); ?>
698
 
699
+ <h4><?php _e( 'Popular tags', 'wp-e-commerce' ) ?></h4>
700
+ <p class="install-help"><?php _e('You may also browse based on the most popular tags on the store:', 'wp-e-commerce') ?></p>
701
  <?php
702
  echo '<p class="popular-tags">';
703
 
714
  'count' => $tag->count
715
  );
716
  }
717
+ echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%s plugin', 'wp-e-commerce'), 'multiple_text' => __('%s plugins', 'wp-e-commerce') ) );
718
  }
719
  catch (Exception $e) {
720
  echo $e->getMessage();
742
  }
743
  else {
744
  self::header('Account', $account);
745
+ echo '<p>' . sprintf(__('Problem: %s', 'wp-e-commerce'), $e->getMessage()) . '</p>';
746
 
747
  return;
748
  }
755
  <?php echo get_avatar($account->email) ?>
756
  <p class="lead-in">Logged in as</p>
757
  <h3><?php echo esc_html($account->name) ?></h3>
758
+ <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wp-e-commerce'), self::build_url(array('oauth' => 'reset'))) ?></p>
759
  </div>
760
  <div class="block">
761
  <p>Email: <code><?php echo $account->email ?></code></p>
762
+ <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wp-e-commerce'), count($account->purchased)) ?></p>
763
+ <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wp-e-commerce'), count(self::$list_table->items)) ?></p>
764
  </div>
765
  </div>
766
 
773
  $oauth_url = self::build_url(array('oauth' => 'request', 'TB_iframe' => true));
774
 
775
  if ( isset( $_GET['auth'] ) && $_GET['auth'] == 'denied' ) {
776
+ self::print_message( __( 'Authorization cancelled.', 'wp-e-commerce' ) );
777
  }
778
  }
779
 
813
  // Update Sputnik account to include newly purchased plugin
814
  Sputnik::update_account();
815
 
816
+ $install_url = self::build_url( array( 'install' => $product_slug ) );
817
  $install_url = add_query_arg('_wpnonce', wp_create_nonce('sputnik_install-plugin_' . $product_slug), $install_url);
818
+ $install_url = add_query_arg( array( 'TB_iframe' => true ), $install_url );
819
 
820
+ self::iframe_closer( self::build_url( array('run-installer' => urlencode( $install_url ) ) ), __( 'Installing ... ', 'wp-e-commerce' ) );
821
  }
822
 
823
  /**
830
 
831
  $cancelled_url = self::build_url( array( 'payment_cancelled' => true ) );
832
 
833
+ self::iframe_closer( $cancelled_url, __( 'Payment Cancelled', 'wp-e-commerce' ) );
834
  }
835
 
836
  protected static function install($id) {
842
  }
843
  catch (Exception $e) {
844
  status_header(500);
845
+ iframe_header( __('Plugin Install', 'wp-e-commerce') );
846
  echo $e->getMessage();
847
  iframe_footer();
848
  die();
854
  }
855
 
856
  if ( ! current_user_can('install_plugins') )
857
+ wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'wp-e-commerce'));
858
 
859
  include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
860
 
862
 
863
  global $body_id;
864
  $body_id = 'sputnik-install';
865
+ iframe_header( __('Plugin Install', 'wp-e-commerce') );
866
 
867
+ $title = sprintf( __('Installing Plugin: %s', 'wp-e-commerce'), $api->name . ' ' . $api->version );
868
  $nonce = 'sputnik_install-plugin_' . $id;
869
  $url = 'update.php?action=install-plugin&plugin=' . $id;
870
  if ( isset($_GET['from']) )
890
  try {
891
  $data = Sputnik::get_from_file($file);
892
  if ($data === null) {
893
+ throw new Exception(__('Plugin not found', 'wp-e-commerce'));
894
  }
895
  $id = $data['Sputnik ID'];
896
  $api = Sputnik::get_plugin($id);
897
  }
898
  catch (Exception $e) {
899
  status_header(500);
900
+ iframe_header( __('Update Plugin', 'wp-e-commerce') );
901
  echo $e->getMessage();
902
  iframe_footer();
903
  die();
909
  }
910
 
911
  if ( ! current_user_can('install_plugins') )
912
+ wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'wp-e-commerce'));
913
 
914
  include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
915
 
917
 
918
  global $body_id;
919
  $body_id = 'sputnik-upgrade';
920
+ iframe_header( __('Update Plugin', 'wp-e-commerce') );
921
 
922
+ $title = sprintf( __('Updating Plugin: %s', 'wp-e-commerce'), $api->name . ' ' . $api->version );
923
  $nonce = 'sputnik_upgrade-plugin_' . $id;
924
  $url = 'update.php?action=upgrade-plugin&plugin=' . $id;
925
  if ( isset($_GET['from']) )
948
  <input type="hidden" name="post_type" value="wpsc-product" />
949
  <input type="hidden" name="tab" value="search" />
950
  <input type="text" name="s" value="<?php echo esc_attr($term) ?>" />
951
+ <?php submit_button( __( 'Search Plugins', 'wp-e-commerce' ), 'button', '', false ); ?>
952
  </form><?php
953
  }
954
 
961
  */
962
  public static function iframe_closer( $redirect_url, $title = null ) {
963
  if (empty($title)) {
964
+ $title = __('Redirecting...', 'wp-e-commerce');
965
  }
966
  ?>
967
  <!DOCTYPE html><html>
wpsc-components/marketplace-core-v1/library/Sputnik/Library/TwitterOAuth.php CHANGED
@@ -36,7 +36,7 @@ class Sputnik_Library_TwitterOAuth extends Sputnik_Library_TwitterOAuth_Internal
36
  $parameters = array();
37
  if (!empty($oauth_callback)) {
38
  $parameters['oauth_callback'] = $oauth_callback;
39
- }
40
  $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
41
  $token = Sputnik_OAuth_Util::parse_parameters($request);
42
  $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
@@ -73,7 +73,7 @@ class Sputnik_Library_TwitterOAuth extends Sputnik_Library_TwitterOAuth_Internal
73
  * "user_id" => "9436992",
74
  * "screen_name" => "abraham",
75
  * "x_auth_expires" => "0")
76
- */
77
  function getXAuthToken($username, $password) {
78
  $parameters = array();
79
  $parameters['x_auth_username'] = $username;
@@ -131,7 +131,7 @@ class Sputnik_Library_TwitterOAuth extends Sputnik_Library_TwitterOAuth_Internal
131
  }
132
  }
133
 
134
- $response = wp_remote_request($url, $options);
135
 
136
  if (is_wp_error($response)) {
137
  $this->http_code = null;
36
  $parameters = array();
37
  if (!empty($oauth_callback)) {
38
  $parameters['oauth_callback'] = $oauth_callback;
39
+ }
40
  $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
41
  $token = Sputnik_OAuth_Util::parse_parameters($request);
42
  $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
73
  * "user_id" => "9436992",
74
  * "screen_name" => "abraham",
75
  * "x_auth_expires" => "0")
76
+ */
77
  function getXAuthToken($username, $password) {
78
  $parameters = array();
79
  $parameters['x_auth_username'] = $username;
131
  }
132
  }
133
 
134
+ $response = wp_safe_remote_request($url, $options);
135
 
136
  if (is_wp_error($response)) {
137
  $this->http_code = null;
wpsc-components/marketplace-core-v1/library/Sputnik/List/Account.php CHANGED
@@ -15,8 +15,8 @@ class Sputnik_List_Account extends Sputnik_List_Install {
15
 
16
  // These are the tabs which are shown on the page
17
  $tabs = array();
18
- $tabs['purchased'] = __( 'Purchased Plugins', 'wpsc' );
19
- $tabs['yours'] = __( 'Your Plugins', 'wpsc' );
20
 
21
  $nonmenu_tabs = array( ); //Valid actions to perform which do not have a Menu item.
22
 
@@ -76,10 +76,10 @@ class Sputnik_List_Account extends Sputnik_List_Install {
76
  global $tab;
77
  echo '<p>';
78
  if ($tab === 'yours') {
79
- _e( "You haven't created any plugins yet. Check out our <a href='http://developer.renku.me/'>developer documentation</a> to find out how!", 'wpsc' );
80
  }
81
  else {
82
- printf(__( "You haven't purchased any plugins yet. Why not <a href='%s'>buy some</a>?", 'wpsc' ), Sputnik_Admin::build_url());
83
  }
84
  echo '</p>';
85
  }
@@ -129,11 +129,11 @@ class Sputnik_List_Account extends Sputnik_List_Install {
129
  switch ($this->view) {
130
  case 'list':
131
  $view = 'grid';
132
- $name = __('Grid', 'wpsc' );
133
  break;
134
  case 'grid':
135
  $view = 'list';
136
- $name = __('List', 'wpsc' );
137
  break;
138
  }
139
  ?>
@@ -156,7 +156,7 @@ class Sputnik_List_Account extends Sputnik_List_Install {
156
  }
157
 
158
  public static function mangle_action_for_own($actions, $plugin) {
159
- $actions[] = sprintf('<a href="%s" class="button edit">%s</a>', sprintf(Sputnik::SITE_BASE . '/your-products/edit/%d', $plugin->product_id), _x('Edit', 'edit own product', 'wpsc' ));
160
  return $actions;
161
  }
162
  }
15
 
16
  // These are the tabs which are shown on the page
17
  $tabs = array();
18
+ $tabs['purchased'] = __( 'Purchased Plugins', 'wp-e-commerce' );
19
+ $tabs['yours'] = __( 'Your Plugins', 'wp-e-commerce' );
20
 
21
  $nonmenu_tabs = array( ); //Valid actions to perform which do not have a Menu item.
22
 
76
  global $tab;
77
  echo '<p>';
78
  if ($tab === 'yours') {
79
+ _e( "You haven't created any plugins yet. Check out our <a href='http://developer.renku.me/'>developer documentation</a> to find out how!", 'wp-e-commerce' );
80
  }
81
  else {
82
+ printf(__( "You haven't purchased any plugins yet. Why not <a href='%s'>buy some</a>?", 'wp-e-commerce' ), Sputnik_Admin::build_url());
83
  }
84
  echo '</p>';
85
  }
129
  switch ($this->view) {
130
  case 'list':
131
  $view = 'grid';
132
+ $name = __('Grid', 'wp-e-commerce' );
133
  break;
134
  case 'grid':
135
  $view = 'list';
136
+ $name = __('List', 'wp-e-commerce' );
137
  break;
138
  }
139
  ?>
156
  }
157
 
158
  public static function mangle_action_for_own($actions, $plugin) {
159
+ $actions[] = sprintf('<a href="%s" class="button edit">%s</a>', sprintf(Sputnik::SITE_BASE . '/your-products/edit/%d', $plugin->product_id), _x('Edit', 'edit own product', 'wp-e-commerce' ));
160
  return $actions;
161
  }
162
  }
wpsc-components/marketplace-core-v1/library/Sputnik/List/Install.php CHANGED
@@ -19,22 +19,22 @@ class Sputnik_List_Install extends WP_List_Table {
19
 
20
  // These are the tabs which are shown on the page
21
  $tabs = array();
22
- $tabs['dashboard'] = __( 'Search', 'wpsc' );
23
 
24
  if ( Sputnik::account_is_linked() ) {
25
- $tabs['purchased'] = __( 'Purchased Plugins', 'wpsc' );
26
  } elseif ( $tab == 'purchased' ) {
27
  wp_redirect( Sputnik_Admin::build_url() );
28
  exit;
29
  }
30
 
31
  if ( 'search' == $tab )
32
- $tabs['search'] = __( 'Search Results', 'wpsc' );
33
- $tabs['featured'] = _x( 'Featured', 'Plugin Installer', 'wpsc' );
34
- $tabs['popular'] = _x( 'Popular', 'Plugin Installer', 'wpsc' );
35
- $tabs['new'] = _x( 'Newest', 'Plugin Installer', 'wpsc' );
36
- $tabs['updated'] = _x( 'Recently Updated', 'Plugin Installer', 'wpsc' );
37
- $tabs['price'] = _x( 'Lowest Priced', 'Plugin Installer', 'wpsc' );
38
 
39
  $nonmenu_tabs = array( 'account' ); //Valid actions to perform which do not have a Menu item.
40
 
@@ -106,9 +106,9 @@ class Sputnik_List_Install extends WP_List_Table {
106
 
107
  echo '<p>';
108
  if ( $tab == 'purchased' )
109
- printf( __( "You haven't purchased any extensions yet. <a href='%s'>Browse our extensions marketplace.</a>", 'wpsc' ), Sputnik_Admin::build_url() );
110
  else
111
- _e( 'No plugins match your request.', 'wpsc' );
112
  echo '</p>';
113
  }
114
 
@@ -186,11 +186,11 @@ class Sputnik_List_Install extends WP_List_Table {
186
  switch ($this->view) {
187
  case 'list':
188
  $view = 'grid';
189
- $name = __('Grid', 'wpsc' );
190
  break;
191
  case 'grid':
192
  $view = 'list';
193
- $name = __('List', 'wpsc' );
194
  break;
195
  }
196
  ?>
@@ -220,11 +220,11 @@ class Sputnik_List_Install extends WP_List_Table {
220
 
221
  public function get_columns() {
222
  return array(
223
- 'name' => _x( 'Name', 'plugin name', 'wpsc' ),
224
- 'version' => __( 'Version', 'wpsc' ),
225
- 'price' => __( 'Action', 'wpsc' ),
226
- 'rating' => __( 'Rating', 'wpsc' ),
227
- 'description' => __( 'Description', 'wpsc' ),
228
  );
229
  }
230
 
@@ -263,11 +263,11 @@ class Sputnik_List_Install extends WP_List_Table {
263
  $plugin->version = wp_kses( $plugin->version, $plugins_allowedtags );
264
  $plugin->price = sprintf('$%.2f', $plugin->price);
265
  if ($plugin->price === '$0.00') {
266
- $plugin->price = _x( 'Free', 'plugin price', 'wpsc' );
267
  }
268
 
269
  if ( ! empty( $plugin->author ) ) {
270
- $plugin->author = ' <cite>' . sprintf( __( 'By %s', 'wpsc' ), $plugin->author ) . '.</cite>';
271
  }
272
 
273
  $plugin->author = wp_kses( $plugin->author, $plugins_allowedtags );
@@ -288,7 +288,7 @@ class Sputnik_List_Install extends WP_List_Table {
288
  $action_links = array();
289
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
290
  . '" class="thickbox info" title="' .
291
- esc_attr( sprintf( __( 'More information about %s', 'wpsc' ), $name ) ) . '">' . __( 'Details' ) . '</a>';
292
 
293
  $purchase_link = $plugin->price;
294
 
@@ -299,35 +299,35 @@ class Sputnik_List_Install extends WP_List_Table {
299
  case 'purchase':
300
  if ( $status['url'] ) {
301
  $purchase_link = '<a id="' . $plugin->slug . '" class="button-primary buy" href="' . esc_url( $status['url'] ) . '" title="'
302
- . esc_attr(sprintf(__( 'Buy %s', 'wpsc' ), $name)) . '">' . sprintf(__('<span>%s</span> Buy Now</a>', 'wpsc' ), $plugin->price);
303
  }
304
  break;
305
  case 'install':
306
  if ( $status['url'] ) {
307
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
308
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
309
- . esc_attr(sprintf(__( 'Install %s', 'wpsc' ), $name)) . '">' . __('Install', 'wpsc' ) . '</a>';
310
  }
311
  else {
312
- $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc' ) . '">'
313
- . __('Install', 'wpsc' ) . '</span>';
314
  }
315
  break;
316
  case 'update_available':
317
  if ( $status['url'] ) {
318
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
319
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
320
- . esc_attr(sprintf(__( 'Update to version %s', 'wpsc' ), $status['version'])) . '">' . __('Update', 'wpsc' ) . '</a>';
321
  }
322
  else {
323
- $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc' ) . '">'
324
- . __('Update', 'wpsc' ) . '</span>';
325
  }
326
  break;
327
  case 'latest_installed':
328
  case 'newer_installed':
329
- $purchase_link = '<span title="' . esc_attr__('This plugin is already installed and is up to date', 'wpsc' ) . ' ">'
330
- . __('Installed', 'wpsc' ) . '</span>';
331
  break;
332
  }
333
  }
@@ -341,7 +341,7 @@ class Sputnik_List_Install extends WP_List_Table {
341
  <td class="vers column-version"<?php echo $style['version']; ?>><?php echo $plugin->version; ?></td>
342
  <td class="vers column-price"<?php echo $style['price']; ?>><?php echo $purchase_link; ?></td>
343
  <td style="display:none" class="vers column-rating"<?php echo $style['rating']; ?>>
344
- <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wpsc' ), number_format_i18n( $plugin->rating->count ) ) ?>">
345
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
346
  <?php
347
  $color = get_user_option('admin_color');
@@ -368,7 +368,7 @@ class Sputnik_List_Install extends WP_List_Table {
368
  $action_links = array();
369
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
370
  . '" class="thickbox button info" title="' .
371
- esc_attr( sprintf( __( 'More information about %s', 'wpsc' ), $name ) ) . '">' . __( 'Details', 'wpsc' ) . '</a>';
372
 
373
  $purchase_link = $plugin->price;
374
 
@@ -379,35 +379,35 @@ class Sputnik_List_Install extends WP_List_Table {
379
  case 'purchase':
380
  if ( $status['url'] ) {
381
  $purchase_link = '<a id="' . $plugin->slug . '" class="button-primary buy status" href="' . esc_url( $status['url'] ) . '" title="'
382
- . esc_attr(sprintf(__( 'Buy %s', 'wpsc' ), $name)) . '">' . __('Buy Now', 'wpsc' ) . '</a>';
383
  }
384
  break;
385
  case 'install':
386
  if ( $status['url'] ) {
387
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
388
  $purchase_link = '<a class="button install status" href="' . esc_url( $status['url'] ) . '" title="'
389
- . esc_attr(sprintf(__( 'Install %s', 'wpsc' ), $name)) . '">' . __('Install', 'wpsc' ) . '</a>';
390
  }
391
  else {
392
- $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc' ) . '">'
393
- . __('Install', 'wpsc' ) . '</span>';
394
  }
395
  break;
396
  case 'update_available':
397
  if ( $status['url'] ) {
398
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
399
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
400
- . esc_attr(sprintf(__( 'Update to version %s', 'wpsc' ), $status['version'])) . '">' . __('Update', 'wpsc' ) . '</a>';
401
  }
402
  else {
403
- $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc' ) . '">'
404
- . __('Update', 'wpsc' ) . '</span>';
405
  }
406
  break;
407
  case 'latest_installed':
408
  case 'newer_installed':
409
- $purchase_link = '<span class="status" title="' . esc_attr__('This plugin is already installed and is up to date', 'wpsc' ) . ' ">'
410
- . __('Installed', 'wpsc' ) . '</span>';
411
  break;
412
  }
413
  }
@@ -440,7 +440,7 @@ class Sputnik_List_Install extends WP_List_Table {
440
  <p><?php echo $plugin->description; ?></p>
441
  <?php if ( isset( $plugin->rating ) && isset( $plugin->rating->count ) ): ?>
442
  <div class="footer" style="display:none">
443
- <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wpsc' ), number_format_i18n( $plugin->rating->count ) ) ?>">
444
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
445
  <?php
446
  $color = get_user_option('admin_color');
19
 
20
  // These are the tabs which are shown on the page
21
  $tabs = array();
22
+ $tabs['dashboard'] = __( 'Search', 'wp-e-commerce' );
23
 
24
  if ( Sputnik::account_is_linked() ) {
25
+ $tabs['purchased'] = __( 'Purchased Plugins', 'wp-e-commerce' );
26
  } elseif ( $tab == 'purchased' ) {
27
  wp_redirect( Sputnik_Admin::build_url() );
28
  exit;
29
  }
30
 
31
  if ( 'search' == $tab )
32
+ $tabs['search'] = __( 'Search Results', 'wp-e-commerce' );
33
+ $tabs['featured'] = _x( 'Featured', 'Plugin Installer', 'wp-e-commerce' );
34
+ $tabs['popular'] = _x( 'Popular', 'Plugin Installer', 'wp-e-commerce' );
35
+ $tabs['new'] = _x( 'Newest', 'Plugin Installer', 'wp-e-commerce' );
36
+ $tabs['updated'] = _x( 'Recently Updated', 'Plugin Installer', 'wp-e-commerce' );
37
+ $tabs['price'] = _x( 'Lowest Priced', 'Plugin Installer', 'wp-e-commerce' );
38
 
39
  $nonmenu_tabs = array( 'account' ); //Valid actions to perform which do not have a Menu item.
40
 
106
 
107
  echo '<p>';
108
  if ( $tab == 'purchased' )
109
+ printf( __( "You haven't purchased any extensions yet. <a href='%s'>Browse our extensions marketplace.</a>", 'wp-e-commerce' ), Sputnik_Admin::build_url() );
110
  else
111
+ _e( 'No plugins match your request.', 'wp-e-commerce' );
112
  echo '</p>';
113
  }
114
 
186
  switch ($this->view) {
187
  case 'list':
188
  $view = 'grid';
189
+ $name = __('Grid', 'wp-e-commerce' );
190
  break;
191
  case 'grid':
192
  $view = 'list';
193
+ $name = __('List', 'wp-e-commerce' );
194
  break;
195
  }
196
  ?>
220
 
221
  public function get_columns() {
222
  return array(
223
+ 'name' => _x( 'Name', 'plugin name', 'wp-e-commerce' ),
224
+ 'version' => __( 'Version', 'wp-e-commerce' ),
225
+ 'price' => __( 'Action', 'wp-e-commerce' ),
226
+ 'rating' => __( 'Rating', 'wp-e-commerce' ),
227
+ 'description' => __( 'Description', 'wp-e-commerce' ),
228
  );
229
  }
230
 
263
  $plugin->version = wp_kses( $plugin->version, $plugins_allowedtags );
264
  $plugin->price = sprintf('$%.2f', $plugin->price);
265
  if ($plugin->price === '$0.00') {
266
+ $plugin->price = _x( 'Free', 'plugin price', 'wp-e-commerce' );
267
  }
268
 
269
  if ( ! empty( $plugin->author ) ) {
270
+ $plugin->author = ' <cite>' . sprintf( __( 'By %s', 'wp-e-commerce' ), $plugin->author ) . '.</cite>';
271
  }
272
 
273
  $plugin->author = wp_kses( $plugin->author, $plugins_allowedtags );
288
  $action_links = array();
289
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
290
  . '" class="thickbox info" title="' .
291
+ esc_attr( sprintf( __( 'More information about %s', 'wp-e-commerce' ), $name ) ) . '">' . __( 'Details', 'wp-e-commerce' ) . '</a>';
292
 
293
  $purchase_link = $plugin->price;
294
 
299
  case 'purchase':
300
  if ( $status['url'] ) {
301
  $purchase_link = '<a id="' . $plugin->slug . '" class="button-primary buy" href="' . esc_url( $status['url'] ) . '" title="'
302
+ . esc_attr(sprintf(__( 'Buy %s', 'wp-e-commerce' ), $name)) . '">' . sprintf(__('<span>%s</span> Buy Now</a>', 'wp-e-commerce' ), $plugin->price);
303
  }
304
  break;
305
  case 'install':
306
  if ( $status['url'] ) {
307
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
308
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
309
+ . esc_attr(sprintf(__( 'Install %s', 'wp-e-commerce' ), $name)) . '">' . __('Install', 'wp-e-commerce' ) . '</a>';
310
  }
311
  else {
312
+ $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce' ) . '">'
313
+ . __('Install', 'wp-e-commerce' ) . '</span>';
314
  }
315
  break;
316
  case 'update_available':
317
  if ( $status['url'] ) {
318
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
319
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
320
+ . esc_attr(sprintf(__( 'Update to version %s', 'wp-e-commerce' ), $status['version'])) . '">' . __('Update', 'wp-e-commerce' ) . '</a>';
321
  }
322
  else {
323
+ $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce' ) . '">'
324
+ . __('Update', 'wp-e-commerce' ) . '</span>';
325
  }
326
  break;
327
  case 'latest_installed':
328
  case 'newer_installed':
329
+ $purchase_link = '<span title="' . esc_attr__('This plugin is already installed and is up to date', 'wp-e-commerce' ) . ' ">'
330
+ . __('Installed', 'wp-e-commerce' ) . '</span>';
331
  break;
332
  }
333
  }
341
  <td class="vers column-version"<?php echo $style['version']; ?>><?php echo $plugin->version; ?></td>
342
  <td class="vers column-price"<?php echo $style['price']; ?>><?php echo $purchase_link; ?></td>
343
  <td style="display:none" class="vers column-rating"<?php echo $style['rating']; ?>>
344
+ <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wp-e-commerce' ), number_format_i18n( $plugin->rating->count ) ) ?>">
345
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
346
  <?php
347
  $color = get_user_option('admin_color');
368
  $action_links = array();
369
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
370
  . '" class="thickbox button info" title="' .
371
+ esc_attr( sprintf( __( 'More information about %s', 'wp-e-commerce' ), $name ) ) . '">' . __( 'Details', 'wp-e-commerce' ) . '</a>';
372
 
373
  $purchase_link = $plugin->price;
374
 
379
  case 'purchase':
380
  if ( $status['url'] ) {
381
  $purchase_link = '<a id="' . $plugin->slug . '" class="button-primary buy status" href="' . esc_url( $status['url'] ) . '" title="'
382
+ . esc_attr(sprintf(__( 'Buy %s', 'wp-e-commerce' ), $name)) . '">' . __('Buy Now', 'wp-e-commerce' ) . '</a>';
383
  }
384
  break;
385
  case 'install':
386
  if ( $status['url'] ) {
387
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
388
  $purchase_link = '<a class="button install status" href="' . esc_url( $status['url'] ) . '" title="'
389
+ . esc_attr(sprintf(__( 'Install %s', 'wp-e-commerce' ), $name)) . '">' . __('Install', 'wp-e-commerce' ) . '</a>';
390
  }
391
  else {
392
+ $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce' ) . '">'
393
+ . __('Install', 'wp-e-commerce' ) . '</span>';
394
  }
395
  break;
396
  case 'update_available':
397
  if ( $status['url'] ) {
398
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
399
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
400
+ . esc_attr(sprintf(__( 'Update to version %s', 'wp-e-commerce' ), $status['version'])) . '">' . __('Update', 'wp-e-commerce' ) . '</a>';
401
  }
402
  else {
403
+ $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce' ) . '">'
404
+ . __('Update', 'wp-e-commerce' ) . '</span>';
405
  }
406
  break;
407
  case 'latest_installed':
408
  case 'newer_installed':
409
+ $purchase_link = '<span class="status" title="' . esc_attr__('This plugin is already installed and is up to date', 'wp-e-commerce' ) . ' ">'
410
+ . __('Installed', 'wp-e-commerce' ) . '</span>';
411
  break;
412
  }
413
  }
440
  <p><?php echo $plugin->description; ?></p>
441
  <?php if ( isset( $plugin->rating ) && isset( $plugin->rating->count ) ): ?>
442
  <div class="footer" style="display:none">
443
+ <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wp-e-commerce' ), number_format_i18n( $plugin->rating->count ) ) ?>">
444
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
445
  <?php
446
  $color = get_user_option('admin_color');
wpsc-components/marketplace-core-v1/library/Sputnik/Pointers.php CHANGED
@@ -25,9 +25,9 @@ class Sputnik_Pointers {
25
  }
26
 
27
  public static function print_footer_scripts() {
28
- $content = '<h3>' . __( 'New Feature: WPeC Extensions' ) . '</h3>';
29
- $content .= '<p>' . __( 'Ever wanted to be able to find an extension for your WP eCommerce store and purchase, install and activate it right from WordPress? Now you can!', 'wpsc' ) . '</p>';
30
- $content .= '<p>' . __( 'Find the latest and greatest free and premium plugins from the WP eCommerce community in our <a href="' . Sputnik_Admin::build_url() . '">Extensions Marketplace</a>.', 'wpsc' ) . '</p>';
31
  ?>
32
  <script type="text/javascript">// <![CDATA[
33
  jQuery(document).ready(function($) {
25
  }
26
 
27
  public static function print_footer_scripts() {
28
+ $content = '<h3>' . __( 'New Feature: WPeC Extensions', 'wp-e-commerce' ) . '</h3>';
29
+ $content .= '<p>' . __( 'Ever wanted to be able to find an extension for your WP eCommerce store and purchase, install and activate it right from WordPress? Now you can!', 'wp-e-commerce' ) . '</p>';
30
+ $content .= '<p>' . __( 'Find the latest and greatest free and premium plugins from the WP eCommerce community in our <a href="' . Sputnik_Admin::build_url() . '">Extensions Marketplace</a>.', 'wp-e-commerce' ) . '</p>';
31
  ?>
32
  <script type="text/javascript">// <![CDATA[
33
  jQuery(document).ready(function($) {
wpsc-components/marketplace-core-v1/library/Sputnik/ThemeUpgrader.php CHANGED
@@ -23,11 +23,11 @@ class Sputnik_ThemeUpgrader extends Theme_Upgrader {
23
  protected static function download( $url, $timeout = 300 ) {
24
  //WARNING: The file is not automatically deleted, The script must unlink() the file.
25
  if ( ! $url )
26
- return new WP_Error('http_no_url', __('Invalid URL Provided.'));
27
 
28
  $tmpfname = wp_tempnam($url);
29
  if ( ! $tmpfname )
30
- return new WP_Error('http_no_file', __('Could not create Temporary file.'));
31
 
32
  $args = array(
33
  'timeout' => $timeout,
@@ -39,7 +39,7 @@ class Sputnik_ThemeUpgrader extends Theme_Upgrader {
39
 
40
  Sputnik_API::sign_download($url, $args);
41
 
42
- $response = wp_remote_get($url, $args);
43
 
44
  if ( is_wp_error( $response ) ) {
45
  unlink( $tmpfname );
23
  protected static function download( $url, $timeout = 300 ) {
24
  //WARNING: The file is not automatically deleted, The script must unlink() the file.
25
  if ( ! $url )
26
+ return new WP_Error('http_no_url', __('Invalid URL Provided.', 'wp-e-commerce' ));
27
 
28
  $tmpfname = wp_tempnam($url);
29
  if ( ! $tmpfname )
30
+ return new WP_Error('http_no_file', __('Could not create Temporary file.', 'wp-e-commerce' ));
31
 
32
  $args = array(
33
  'timeout' => $timeout,
39
 
40
  Sputnik_API::sign_download($url, $args);
41
 
42
+ $response = wp_safe_remote_get($url, $args);
43
 
44
  if ( is_wp_error( $response ) ) {
45
  unlink( $tmpfname );
wpsc-components/marketplace-core-v1/library/Sputnik/Theme_Upgrader.php CHANGED
@@ -23,11 +23,11 @@ class Sputnik_ThemeUpgrader extends Theme_Upgrader {
23
  protected static function download( $url, $timeout = 300 ) {
24
  //WARNING: The file is not automatically deleted, The script must unlink() the file.
25
  if ( ! $url )
26
- return new WP_Error('http_no_url', __('Invalid URL Provided.'));
27
 
28
  $tmpfname = wp_tempnam($url);
29
  if ( ! $tmpfname )
30
- return new WP_Error('http_no_file', __('Could not create Temporary file.'));
31
 
32
  $args = array(
33
  'timeout' => $timeout,
@@ -39,7 +39,7 @@ class Sputnik_ThemeUpgrader extends Theme_Upgrader {
39
 
40
  Sputnik_API::sign_download($url, $args);
41
 
42
- $response = wp_remote_get($url, $args);
43
 
44
  if ( is_wp_error( $response ) ) {
45
  unlink( $tmpfname );
23
  protected static function download( $url, $timeout = 300 ) {
24
  //WARNING: The file is not automatically deleted, The script must unlink() the file.
25
  if ( ! $url )
26
+ return new WP_Error('http_no_url', __('Invalid URL Provided.', 'wp-e-commerce' ));
27
 
28
  $tmpfname = wp_tempnam($url);
29
  if ( ! $tmpfname )
30
+ return new WP_Error('http_no_file', __('Could not create Temporary file.', 'wp-e-commerce' ));
31
 
32
  $args = array(
33
  'timeout' => $timeout,
39
 
40
  Sputnik_API::sign_download($url, $args);
41
 
42
+ $response = wp_safe_remote_get($url, $args);
43
 
44
  if ( is_wp_error( $response ) ) {
45
  unlink( $tmpfname );
wpsc-components/marketplace-core-v1/library/Sputnik/Updater.php CHANGED
@@ -45,7 +45,7 @@ class Sputnik_Updater {
45
  'user-agent' => 'WP eCommerce Marketplace: ' . WPSC_VERSION
46
  );
47
  $url = esc_url_raw( add_query_arg('plugins', urlencode(json_encode($data)), $url) );
48
- $req = wp_remote_get($url, $options);
49
  if (is_wp_error($req) || $req['response']['code'] !== 200) {
50
  return $plugins;
51
  }
@@ -119,7 +119,7 @@ class Sputnik_Updater {
119
  'user-agent' => 'WP eCommerce Marketplace: ' . WPSC_VERSION
120
  );
121
  $url = esc_url_raw( add_query_arg( 'themes', urlencode( json_encode( $data ) ), $url ) );
122
- $req = wp_remote_get( $url, $options );
123
  if (is_wp_error($req) || $req['response']['code'] !== 200) {
124
  return $themes;
125
  }
45
  'user-agent' => 'WP eCommerce Marketplace: ' . WPSC_VERSION
46
  );
47
  $url = esc_url_raw( add_query_arg('plugins', urlencode(json_encode($data)), $url) );
48
+ $req = wp_safe_remote_get($url, $options);
49
  if (is_wp_error($req) || $req['response']['code'] !== 200) {
50
  return $plugins;
51
  }
119
  'user-agent' => 'WP eCommerce Marketplace: ' . WPSC_VERSION
120
  );
121
  $url = esc_url_raw( add_query_arg( 'themes', urlencode( json_encode( $data ) ), $url ) );
122
+ $req = wp_safe_remote_get( $url, $options );
123
  if (is_wp_error($req) || $req['response']['code'] !== 200) {
124
  return $themes;
125
  }
wpsc-components/marketplace-core-v1/library/Sputnik/Upgrader.php CHANGED
@@ -23,11 +23,11 @@ class Sputnik_Upgrader extends Plugin_Upgrader {
23
  protected static function download( $url, $timeout = 300 ) {
24
  //WARNING: The file is not automatically deleted, The script must unlink() the file.
25
  if ( ! $url )
26
- return new WP_Error('http_no_url', __('Invalid URL Provided.'));
27
 
28
  $tmpfname = wp_tempnam($url);
29
  if ( ! $tmpfname )
30
- return new WP_Error('http_no_file', __('Could not create Temporary file.'));
31
 
32
  $args = array(
33
  'timeout' => $timeout,
@@ -39,7 +39,7 @@ class Sputnik_Upgrader extends Plugin_Upgrader {
39
 
40
  Sputnik_API::sign_download($url, $args);
41
 
42
- $response = wp_remote_get($url, $args);
43
 
44
  if ( is_wp_error( $response ) ) {
45
  unlink( $tmpfname );
23
  protected static function download( $url, $timeout = 300 ) {
24
  //WARNING: The file is not automatically deleted, The script must unlink() the file.
25
  if ( ! $url )
26
+ return new WP_Error('http_no_url', __('Invalid URL Provided.', 'wp-e-commerce' ));
27
 
28
  $tmpfname = wp_tempnam($url);
29
  if ( ! $tmpfname )
30
+ return new WP_Error('http_no_file', __('Could not create Temporary file.', 'wp-e-commerce' ));
31
 
32
  $args = array(
33
  'timeout' => $timeout,
39
 
40
  Sputnik_API::sign_download($url, $args);
41
 
42
+ $response = wp_safe_remote_get($url, $args);
43
 
44
  if ( is_wp_error( $response ) ) {
45
  unlink( $tmpfname );
wpsc-components/marketplace-core-v1/library/Sputnik/Upgrader/Skin.php CHANGED
@@ -18,7 +18,7 @@ class Sputnik_Upgrader_Skin extends WP_Upgrader_Skin {
18
 
19
  if ( ! empty( $this->api ) ) {
20
  $asset_type = in_array( 'theme', $this->api->categories ) ? 'theme' : 'plugin';
21
- $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the %s <strong>%s %s</strong>.'), $asset_type, $this->api->name, $this->api->version);
22
  }
23
 
24
  echo '<script>if (window.parent.tb_showIframe) { window.parent.tb_showIframe(); }</script>';
@@ -35,23 +35,23 @@ class Sputnik_Upgrader_Skin extends WP_Upgrader_Skin {
35
  // One-Click flow
36
  if (!empty($_GET['also']) && $_GET['also'] == 'activate') {
37
  if (!$this->result || is_wp_error($this->result)) {
38
- show_message(__('Cannot activate plugin.', 'wpsc' ));
39
  }
40
  else {
41
- show_message(__('Activating the plugin&#8230;', 'wpsc' ));
42
  echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=0&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) .'"></iframe>';
43
  }
44
  }
45
  else {
46
- $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin', 'wpsc' ) . '" target="_parent">' . __('Activate Plugin', 'wpsc' ) . '</a>';
47
 
48
  if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
49
- $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network', 'wpsc' ) . '" target="_parent">' . __('Network Activate', 'wpsc' ) . '</a>';
50
  unset( $install_actions['activate_plugin'] );
51
  }
52
  }
53
 
54
- $install_actions['store'] = '<a href="' . Sputnik_Admin::build_url() . '" title="' . esc_attr__('Return to Store', 'wpsc' ) . '" target="_parent" class="close">' . __('Return to Store', 'wpsc' ) . '</a>';
55
 
56
 
57
  if (!$this->result || is_wp_error($this->result)) {
18
 
19
  if ( ! empty( $this->api ) ) {
20
  $asset_type = in_array( 'theme', $this->api->categories ) ? 'theme' : 'plugin';
21
+ $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the %s <strong>%s %s</strong>.', 'wp-e-commerce' ), $asset_type, $this->api->name, $this->api->version);
22
  }
23
 
24
  echo '<script>if (window.parent.tb_showIframe) { window.parent.tb_showIframe(); }</script>';
35
  // One-Click flow
36
  if (!empty($_GET['also']) && $_GET['also'] == 'activate') {
37
  if (!$this->result || is_wp_error($this->result)) {
38
+ show_message(__('Cannot activate plugin.', 'wp-e-commerce' ));
39
  }
40
  else {
41
+ show_message(__('Activating the plugin&#8230;', 'wp-e-commerce' ));
42
  echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=0&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) .'"></iframe>';
43
  }
44
  }
45
  else {
46
+ $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin', 'wp-e-commerce' ) . '" target="_parent">' . __('Activate Plugin', 'wp-e-commerce' ) . '</a>';
47
 
48
  if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
49
+ $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network', 'wp-e-commerce' ) . '" target="_parent">' . __('Network Activate', 'wp-e-commerce' ) . '</a>';
50
  unset( $install_actions['activate_plugin'] );
51
  }
52
  }
53
 
54
+ $install_actions['store'] = '<a href="' . Sputnik_Admin::build_url() . '" title="' . esc_attr__('Return to Store', 'wp-e-commerce' ) . '" target="_parent" class="close">' . __('Return to Store', 'wp-e-commerce' ) . '</a>';
55
 
56
 
57
  if (!$this->result || is_wp_error($this->result)) {
wpsc-components/marketplace-core-v1/library/Sputnik/View.php CHANGED
@@ -30,8 +30,8 @@ abstract class Sputnik_View {
30
  }
31
  if ($account !== false) {
32
  $tabs = array(
33
- 'dash' => __('Store', 'wpsc'),
34
- 'account' => __('Your Account', 'wpsc'),
35
  );
36
  $hrefs = array(
37
  'dash' => Sputnik_Admin::build_url(),
@@ -72,7 +72,7 @@ abstract class Sputnik_View {
72
  protected function footer() {?>
73
  <div id="sputnik-footer">
74
  <p class="logo-holder"><a href="http://wpeconomy.org/" class="renku-logo">WPEconomy</a></p>
75
- <nav><p><a href="http://www.wpeconomy.org/documentation/developers/"><?php _e('Developer Tools', 'wpsc') ?></a> | <a href="http://twitter.com/WPEconomy">@WPEconomy</a> | <a href="http://www.wpeconomy.org/documentation/marketplace/faqs/"><?php _e('FAQ', 'wpsc') ?></a></p></nav>
76
  </div>
77
  </div>
78
  <?php
30
  }
31
  if ($account !== false) {
32
  $tabs = array(
33
+ 'dash' => __('Store', 'wp-e-commerce'),
34
+ 'account' => __('Your Account', 'wp-e-commerce'),
35
  );
36
  $hrefs = array(
37
  'dash' => Sputnik_Admin::build_url(),
72
  protected function footer() {?>
73
  <div id="sputnik-footer">
74
  <p class="logo-holder"><a href="http://wpeconomy.org/" class="renku-logo">WPEconomy</a></p>
75
+ <nav><p><a href="http://www.wpeconomy.org/documentation/developers/"><?php _e('Developer Tools', 'wp-e-commerce') ?></a> | <a href="http://twitter.com/WPEconomy">@WPEconomy</a> | <a href="http://www.wpeconomy.org/documentation/marketplace/faqs/"><?php _e('FAQ', 'wp-e-commerce') ?></a></p></nav>
76
  </div>
77
  </div>
78
  <?php
wpsc-components/marketplace-core-v1/library/Sputnik/View/Account.php CHANGED
@@ -22,14 +22,14 @@ class Sputnik_View_Account extends Sputnik_View_Browser {
22
  <div class="account-card">
23
  <div class="block">
24
  <?php echo get_avatar($account->email) ?>
25
- <p class="lead-in"><?php _e('Logged in as', 'wpsc') ?></p>
26
  <h3><?php echo esc_html($account->name) ?></h3>
27
- <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wpsc'), Sputnik_Admin::build_url(array('oauth' => 'reset'))) ?></p>
28
  </div>
29
  <div class="block">
30
- <p><?php printf(__('Email: %s', 'wpsc'), '<code>' . $account->email . '</code>') ?></p>
31
- <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wpsc'), count($account->purchased)) ?></p>
32
- <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wpsc'), $this->count) ?></p>
33
  </div>
34
  </div>
35
 
@@ -46,8 +46,8 @@ class Sputnik_View_Account extends Sputnik_View_Browser {
46
 
47
  public function get_tabs() {
48
  $tabs = array();
49
- $tabs['purchased'] = __( 'Purchased Plugins', 'wpsc' );
50
- $tabs['yours'] = __( 'Your Plugins', 'wpsc' );
51
  return $tabs;
52
  }
53
 
@@ -76,8 +76,8 @@ class Sputnik_View_Account extends Sputnik_View_Browser {
76
  if ($tab === 'yours') {
77
  $api['body'][] = (object) array(
78
  'slug' => '__add_new',
79
- 'name' => __('Add Your Plugin', 'wpsc'),
80
- 'description' => __('List your plugin on the WPEconomy store. Read our developer documentation and get started!', 'wpsc'),
81
  'rating' => (object) array('average' => 0, 'count' => 0),
82
  'price' => 0,
83
  'version' => '',
@@ -116,10 +116,10 @@ class Sputnik_View_Account extends Sputnik_View_Browser {
116
  global $tab;
117
  echo '<p>';
118
  if ($tab === 'yours') {
119
- _e( "You haven't created any plugins yet. Check out our <a href='http://developer.renku.me/'>developer documentation</a> to find out how!", 'wpsc' );
120
  }
121
  else {
122
- printf(__( "You haven't purchased any plugins yet. Why not <a href='%s'>buy some</a>?", 'wpsc' ), Sputnik_Admin::build_url());
123
  }
124
  echo '</p>';
125
  }
@@ -132,8 +132,8 @@ class Sputnik_View_Account extends Sputnik_View_Browser {
132
  $actions[] = sprintf(
133
  '<a href="%s" class="button edit" title="%s">%s</a>',
134
  sprintf(Sputnik::SITE_BASE . '/plugins/%d/edit/', $plugin->product_id),
135
- esc_attr(sprintf(_x('Edit %s', 'Edit button title', 'wpsc'), $plugin->name)),
136
- _x('Edit', 'Edit button text', 'wpsc')
137
  );
138
  return $actions;
139
  }
22
  <div class="account-card">
23
  <div class="block">
24
  <?php echo get_avatar($account->email) ?>
25
+ <p class="lead-in"><?php _e('Logged in as', 'wp-e-commerce') ?></p>
26
  <h3><?php echo esc_html($account->name) ?></h3>
27
+ <p><?php printf(__('<a href="%s">Log out</a> of your account', 'wp-e-commerce'), Sputnik_Admin::build_url(array('oauth' => 'reset'))) ?></p>
28
  </div>
29
  <div class="block">
30
+ <p><?php printf(__('Email: %s', 'wp-e-commerce'), '<code>' . $account->email . '</code>') ?></p>
31
+ <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you can install right now">Available</abbr>', 'wp-e-commerce'), count($account->purchased)) ?></p>
32
+ <p class="stat"><?php printf(__('<strong>%d</strong> <abbr title="Plugins you have bought from the store">Purchased</abbr>', 'wp-e-commerce'), $this->count) ?></p>
33
  </div>
34
  </div>
35
 
46
 
47
  public function get_tabs() {
48
  $tabs = array();
49
+ $tabs['purchased'] = __( 'Purchased Plugins', 'wp-e-commerce' );
50
+ $tabs['yours'] = __( 'Your Plugins', 'wp-e-commerce' );
51
  return $tabs;
52
  }
53
 
76
  if ($tab === 'yours') {
77
  $api['body'][] = (object) array(
78
  'slug' => '__add_new',
79
+ 'name' => __('Add Your Plugin', 'wp-e-commerce'),
80
+ 'description' => __('List your plugin on the WPEconomy store. Read our developer documentation and get started!', 'wp-e-commerce'),
81
  'rating' => (object) array('average' => 0, 'count' => 0),
82
  'price' => 0,
83
  'version' => '',
116
  global $tab;
117
  echo '<p>';
118
  if ($tab === 'yours') {
119
+ _e( "You haven't created any plugins yet. Check out our <a href='http://developer.renku.me/'>developer documentation</a> to find out how!", 'wp-e-commerce' );
120
  }
121
  else {
122
+ printf(__( "You haven't purchased any plugins yet. Why not <a href='%s'>buy some</a>?", 'wp-e-commerce' ), Sputnik_Admin::build_url());
123
  }
124
  echo '</p>';
125
  }
132
  $actions[] = sprintf(
133
  '<a href="%s" class="button edit" title="%s">%s</a>',
134
  sprintf(Sputnik::SITE_BASE . '/plugins/%d/edit/', $plugin->product_id),
135
+ esc_attr(sprintf(_x('Edit %s', 'Edit button title', 'wp-e-commerce'), $plugin->name)),
136
+ _x('Edit', 'Edit button text', 'wp-e-commerce')
137
  );
138
  return $actions;
139
  }
wpsc-components/marketplace-core-v1/library/Sputnik/View/Auth.php CHANGED
@@ -18,7 +18,7 @@ class Sputnik_View_Auth extends Sputnik_View {
18
  }
19
  public function render() {
20
  if ( isset( $_GET['auth'] ) && $_GET['auth'] == 'denied' ) {
21
- Sputnik_Admin::add_message( __( 'Account linking cancelled. Please note that you need to link your account in order to access the store.', 'wpsc' ) );
22
  }
23
 
24
  $this->header();
18
  }
19
  public function render() {
20
  if ( isset( $_GET['auth'] ) && $_GET['auth'] == 'denied' ) {
21
+ Sputnik_Admin::add_message( __( 'Account linking cancelled. Please note that you need to link your account in order to access the store.', 'wp-e-commerce' ) );
22
  }
23
 
24
  $this->header();
wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser.php CHANGED
@@ -56,14 +56,14 @@ class Sputnik_View_Browser extends Sputnik_View {
56
 
57
  global $tab;
58
  $tabs = array();
59
- $tabs['dashboard'] = __( 'Search', 'wpsc' );
60
  if ( 'search' == $tab )
61
- $tabs['search'] = __( 'Search Results', 'wpsc' );
62
- $tabs['featured'] = _x( 'Featured', 'Plugin Installer', 'wpsc' );
63
- $tabs['popular'] = _x( 'Popular', 'Plugin Installer', 'wpsc' );
64
- $tabs['new'] = _x( 'Newest', 'Plugin Installer', 'wpsc' );
65
- $tabs['updated'] = _x( 'Recently Updated', 'Plugin Installer', 'wpsc' );
66
- $tabs['price'] = _x( 'Lowest Priced', 'Plugin Installer', 'wpsc' );
67
  return $tabs;
68
  }
69
 
@@ -99,7 +99,7 @@ class Sputnik_View_Browser extends Sputnik_View {
99
  }
100
 
101
  public function no_items() {
102
- echo '<p>' . __( 'No plugins match your request.', 'wpsc' ) . '</p>';
103
  }
104
 
105
  public function footer() {
@@ -107,7 +107,7 @@ class Sputnik_View_Browser extends Sputnik_View {
107
  <script type="text/html" id="tmpl-sputnik-modal">
108
  <div class="sputnik-modal">
109
  <h3 class="sputnik-modal-title">{{ title }}</h3>
110
- <a class="sputnik-modal-close" href="" title="<?php esc_attr_e('Close'); ?>">&times;</a>
111
  </div>
112
  <div class="sputnik-modal-backdrop">
113
  <div></div>
56
 
57
  global $tab;
58
  $tabs = array();
59
+ $tabs['dashboard'] = __( 'Search', 'wp-e-commerce' );
60
  if ( 'search' == $tab )
61
+ $tabs['search'] = __( 'Search Results', 'wp-e-commerce' );
62
+ $tabs['featured'] = _x( 'Featured', 'Plugin Installer', 'wp-e-commerce' );
63
+ $tabs['popular'] = _x( 'Popular', 'Plugin Installer', 'wp-e-commerce' );
64
+ $tabs['new'] = _x( 'Newest', 'Plugin Installer', 'wp-e-commerce' );
65
+ $tabs['updated'] = _x( 'Recently Updated', 'Plugin Installer', 'wp-e-commerce' );
66
+ $tabs['price'] = _x( 'Lowest Priced', 'Plugin Installer', 'wp-e-commerce' );
67
  return $tabs;
68
  }
69
 
99
  }
100
 
101
  public function no_items() {
102
+ echo '<p>' . __( 'No plugins match your request.', 'wp-e-commerce' ) . '</p>';
103
  }
104
 
105
  public function footer() {
107
  <script type="text/html" id="tmpl-sputnik-modal">
108
  <div class="sputnik-modal">
109
  <h3 class="sputnik-modal-title">{{ title }}</h3>
110
+ <a class="sputnik-modal-close" href="" title="<?php esc_attr_e('Close', 'wp-e-commerce' ); ?>">&times;</a>
111
  </div>
112
  <div class="sputnik-modal-backdrop">
113
  <div></div>
wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser/Grid.php CHANGED
@@ -70,8 +70,8 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
70
 
71
  public function view_switcher() {
72
  $modes = array(
73
- 'list' => __('List View', 'wpsc'),
74
- 'grid' => __('Grid View', 'wpsc')
75
  );
76
  $current_mode = $this->parent->view_type;
77
  ?>
@@ -135,7 +135,7 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
135
  if ( 'top' == $which ) { ?>
136
  <div class="tablenav top">
137
  <div class="alignright account">
138
- <?php printf(__('Logged in as %s', 'wpsc'), '<a href="' . menu_page_url( 'sputnik-account', false ) . '" class="account-link">' . $account->name . '</a>') ?>
139
  <?php
140
  if ($tab === 'search') {
141
  ?>
@@ -168,11 +168,11 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
168
 
169
  public function get_columns() {
170
  return array(
171
- 'name' => _x( 'Name', 'plugin name', 'wpsc' ),
172
- 'version' => __( 'Version', 'wpsc' ),
173
- 'price' => __( 'Action', 'wpsc' ),
174
- 'rating' => __( 'Rating', 'wpsc' ),
175
- 'description' => __( 'Description', 'wpsc' ),
176
  );
177
  }
178
 
@@ -208,11 +208,11 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
208
  $plugin->version = wp_kses( $plugin->version, $plugins_allowedtags );
209
  $plugin->price = sprintf('$%.2f', $plugin->price);
210
  if ($plugin->price === '$0.00') {
211
- $plugin->price = _x('Free', 'plugin price', 'wpsc');
212
  }
213
 
214
  if (!empty($plugin->author))
215
- $plugin->author = ' <cite>' . sprintf( __( 'By %s', 'wpsc' ), $plugin->author ) . '.</cite>';
216
 
217
  $plugin->author = wp_kses( $plugin->author, $plugins_allowedtags );
218
 
@@ -225,7 +225,7 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
225
  $action_links = array();
226
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
227
  . '" class="thickbox button info" title="' .
228
- esc_attr( sprintf( __( 'More information about %s', 'wpsc' ), $name ) ) . '">' . __( 'Details', 'wpsc' ) . '</a>';
229
 
230
  $purchase_link = $plugin->price;
231
 
@@ -233,8 +233,8 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
233
  $status = 'addown';
234
  $name = $plugin->name;
235
  $action_links = array();
236
- $action_links[] = '<a href="http://developer.renku.me/" class="thickbox button info">' . __( 'Documentation', 'wpsc' ) . '</a>';
237
- $purchase_link = '<a class="button-primary addown status" href="' . Sputnik::SITE_BASE . '/plugins/add/">' . esc_html__('Add Now', 'wpsc') . '</a>';
238
  }
239
  elseif ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
240
  $status = Sputnik_Admin::install_status( $plugin );
@@ -243,35 +243,35 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
243
  case 'purchase':
244
  if ( $status['url'] ) {
245
  $purchase_link = '<a id="' . $plugin->slug .'" class="button-primary buy status" href="' . esc_url( $status['url'] ) . '" title="'
246
- . esc_attr(sprintf(__( 'Buy %s', 'wpsc'), $name)) . '">' . __('Buy Now', 'wpsc') . '</a>';
247
  }
248
  break;
249
  case 'install':
250
  if ( $status['url'] ) {
251
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600 ), $status['url']);
252
  $purchase_link = '<a class="button install status" href="' . esc_url( $status['url'] ) . '" title="'
253
- . esc_attr(sprintf(__( 'Install %s', 'wpsc'), $name)) . '">' . __('Install', 'wpsc') . '</a>';
254
  }
255
  else {
256
- $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc') . '">'
257
- . __('Install', 'wpsc') . '</span>';
258
  }
259
  break;
260
  case 'update_available':
261
  if ( $status['url'] ) {
262
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
263
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
264
- . esc_attr(sprintf(__( 'Update to version %s', 'wpsc'), $status['version'])) . '">' . __('Update', 'wpsc') . '</a>';
265
  }
266
  else {
267
- $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc') . '">'
268
- . __('Update', 'wpsc') . '</span>';
269
  }
270
  break;
271
  case 'latest_installed':
272
  case 'newer_installed':
273
- $purchase_link = '<span class="status" title="' . esc_attr__('This plugin is already installed and is up to date', 'wpsc') . ' ">'
274
- . __('Installed', 'wpsc') . '</span>';
275
  break;
276
  }
277
  }
@@ -301,7 +301,7 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
301
  <p><?php echo $plugin->description; ?></p>
302
  <?php if ( isset( $plugin->rating ) && isset( $plugin->rating->count ) ): ?>
303
  <div class="footer" style="display:none">
304
- <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wpsc' ), number_format_i18n( $plugin->rating->count ) ) ?>">
305
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
306
  <?php
307
  $star_url = admin_url( 'images/stars.png?v=20110615' );
70
 
71
  public function view_switcher() {
72
  $modes = array(
73
+ 'list' => __('List View', 'wp-e-commerce'),
74
+ 'grid' => __('Grid View', 'wp-e-commerce')
75
  );
76
  $current_mode = $this->parent->view_type;
77
  ?>
135
  if ( 'top' == $which ) { ?>
136
  <div class="tablenav top">
137
  <div class="alignright account">
138
+ <?php printf(__('Logged in as %s', 'wp-e-commerce'), '<a href="' . menu_page_url( 'sputnik-account', false ) . '" class="account-link">' . $account->name . '</a>') ?>
139
  <?php
140
  if ($tab === 'search') {
141
  ?>
168
 
169
  public function get_columns() {
170
  return array(
171
+ 'name' => _x( 'Name', 'plugin name', 'wp-e-commerce' ),
172
+ 'version' => __( 'Version', 'wp-e-commerce' ),
173
+ 'price' => __( 'Action', 'wp-e-commerce' ),
174
+ 'rating' => __( 'Rating', 'wp-e-commerce' ),
175
+ 'description' => __( 'Description', 'wp-e-commerce' ),
176
  );
177
  }
178
 
208
  $plugin->version = wp_kses( $plugin->version, $plugins_allowedtags );
209
  $plugin->price = sprintf('$%.2f', $plugin->price);
210
  if ($plugin->price === '$0.00') {
211
+ $plugin->price = _x('Free', 'plugin price', 'wp-e-commerce');
212
  }
213
 
214
  if (!empty($plugin->author))
215
+ $plugin->author = ' <cite>' . sprintf( __( 'By %s', 'wp-e-commerce' ), $plugin->author ) . '.</cite>';
216
 
217
  $plugin->author = wp_kses( $plugin->author, $plugins_allowedtags );
218
 
225
  $action_links = array();
226
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
227
  . '" class="thickbox button info" title="' .
228
+ esc_attr( sprintf( __( 'More information about %s', 'wp-e-commerce' ), $name ) ) . '">' . __( 'Details', 'wp-e-commerce' ) . '</a>';
229
 
230
  $purchase_link = $plugin->price;
231
 
233
  $status = 'addown';
234
  $name = $plugin->name;
235
  $action_links = array();
236
+ $action_links[] = '<a href="http://developer.renku.me/" class="thickbox button info">' . __( 'Documentation', 'wp-e-commerce' ) . '</a>';
237
+ $purchase_link = '<a class="button-primary addown status" href="' . Sputnik::SITE_BASE . '/plugins/add/">' . esc_html__('Add Now', 'wp-e-commerce') . '</a>';
238
  }
239
  elseif ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
240
  $status = Sputnik_Admin::install_status( $plugin );
243
  case 'purchase':
244
  if ( $status['url'] ) {
245
  $purchase_link = '<a id="' . $plugin->slug .'" class="button-primary buy status" href="' . esc_url( $status['url'] ) . '" title="'
246
+ . esc_attr(sprintf(__( 'Buy %s', 'wp-e-commerce'), $name)) . '">' . __('Buy Now', 'wp-e-commerce') . '</a>';
247
  }
248
  break;
249
  case 'install':
250
  if ( $status['url'] ) {
251
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600 ), $status['url']);
252
  $purchase_link = '<a class="button install status" href="' . esc_url( $status['url'] ) . '" title="'
253
+ . esc_attr(sprintf(__( 'Install %s', 'wp-e-commerce'), $name)) . '">' . __('Install', 'wp-e-commerce') . '</a>';
254
  }
255
  else {
256
+ $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce') . '">'
257
+ . __('Install', 'wp-e-commerce') . '</span>';
258
  }
259
  break;
260
  case 'update_available':
261
  if ( $status['url'] ) {
262
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600), $status['url']);
263
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
264
+ . esc_attr(sprintf(__( 'Update to version %s', 'wp-e-commerce'), $status['version'])) . '">' . __('Update', 'wp-e-commerce') . '</a>';
265
  }
266
  else {
267
+ $purchase_link = '<span class="status" title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce') . '">'
268
+ . __('Update', 'wp-e-commerce') . '</span>';
269
  }
270
  break;
271
  case 'latest_installed':
272
  case 'newer_installed':
273
+ $purchase_link = '<span class="status" title="' . esc_attr__('This plugin is already installed and is up to date', 'wp-e-commerce') . ' ">'
274
+ . __('Installed', 'wp-e-commerce') . '</span>';
275
  break;
276
  }
277
  }
301
  <p><?php echo $plugin->description; ?></p>
302
  <?php if ( isset( $plugin->rating ) && isset( $plugin->rating->count ) ): ?>
303
  <div class="footer" style="display:none">
304
+ <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wp-e-commerce' ), number_format_i18n( $plugin->rating->count ) ) ?>">
305
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
306
  <?php
307
  $star_url = admin_url( 'images/stars.png?v=20110615' );
wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser/List.php CHANGED
@@ -11,7 +11,7 @@ class Sputnik_View_Browser_List extends Sputnik_View_Browser_Grid {
11
  $action_links = array();
12
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
13
  . '" class="button thickbox info" title="' .
14
- esc_attr( sprintf( __( 'More information about %s', 'wpsc' ), $name ) ) . '">' . __( 'Details' ) . '</a>';
15
 
16
  $purchase_link = $plugin->price;
17
 
@@ -19,8 +19,8 @@ class Sputnik_View_Browser_List extends Sputnik_View_Browser_Grid {
19
  $status = 'addown';
20
  $style['name'] .= ' class="addown"';
21
  $action_links = array();
22
- $action_links[] = '<a href="http://developer.renku.me/" class="thickbox button info">' . __( 'Documentation', 'wpsc' ) . '</a>';
23
- $purchase_link = '<a class="button-primary addown" href="' . Sputnik::SITE_BASE . '/plugins/add/" title="Add New Plugin">' . esc_html__('Add Now', 'wpsc') . '</a>';
24
  }
25
  elseif ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
26
  $status = Sputnik_Admin::install_status( $plugin );
@@ -29,35 +29,35 @@ class Sputnik_View_Browser_List extends Sputnik_View_Browser_Grid {
29
  case 'purchase':
30
  if ( $status['url'] ) {
31
  $purchase_link = '<a id="' . $plugin->slug . '" class="button-primary buy" href="' . esc_url( $status['url'] ) . '" title="'
32
- . esc_attr(sprintf(__( 'Buy %s', 'wpsc'), $name)) . '">' . sprintf(__('<span>%s</span> Buy Now</a>', 'wpsc'), $plugin->price);
33
  }
34
  break;
35
  case 'install':
36
  if ( $status['url'] ) {
37
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600 ), $status['url']);
38
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
39
- . esc_attr(sprintf(__( 'Install %s', 'wpsc'), $name)) . '">' . __('Install', 'wpsc') . '</a>';
40
  }
41
  else {
42
- $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc') . '">'
43
- . __('Install', 'wpsc') . '</span>';
44
  }
45
  break;
46
  case 'update_available':
47
  if ( $status['url'] ) {
48
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600 ), $status['url']);
49
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
50
- . esc_attr(sprintf(__( 'Update to version %s', 'wpsc'), $status['version'])) . '">' . __('Update', 'wpsc') . '</a>';
51
  }
52
  else {
53
- $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wpsc') . '">'
54
- . __('Update', 'wpsc') . '</span>';
55
  }
56
  break;
57
  case 'latest_installed':
58
  case 'newer_installed':
59
- $purchase_link = '<span title="' . esc_attr__('This plugin is already installed and is up to date', 'wpsc') . ' ">'
60
- . __('Installed', 'wpsc') . '</span>';
61
  break;
62
  }
63
  }
@@ -71,7 +71,7 @@ class Sputnik_View_Browser_List extends Sputnik_View_Browser_Grid {
71
  <td class="vers column-version"<?php echo $style['version']; ?>><?php echo $plugin->version; ?></td>
72
  <td class="vers column-price"<?php echo $style['price']; ?>><?php echo $purchase_link; ?></td>
73
  <td class="vers column-rating"<?php echo $style['rating']; ?>>
74
- <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wpsc' ), number_format_i18n( $plugin->rating->count ) ) ?>">
75
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
76
  </div>
77
  </td>
11
  $action_links = array();
12
  $action_links[] = '<a href="' . Sputnik_Admin::build_url(array('info' => $plugin->slug, 'TB_iframe' => true))
13
  . '" class="button thickbox info" title="' .
14
+ esc_attr( sprintf( __( 'More information about %s', 'wp-e-commerce' ), $name ) ) . '">' . __( 'Details', 'wp-e-commerce' ) . '</a>';
15
 
16
  $purchase_link = $plugin->price;
17
 
19
  $status = 'addown';
20
  $style['name'] .= ' class="addown"';
21
  $action_links = array();
22
+ $action_links[] = '<a href="http://developer.renku.me/" class="thickbox button info">' . __( 'Documentation', 'wp-e-commerce' ) . '</a>';
23
+ $purchase_link = '<a class="button-primary addown" href="' . Sputnik::SITE_BASE . '/plugins/add/" title="Add New Plugin">' . esc_html__('Add Now', 'wp-e-commerce') . '</a>';
24
  }
25
  elseif ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
26
  $status = Sputnik_Admin::install_status( $plugin );
29
  case 'purchase':
30
  if ( $status['url'] ) {
31
  $purchase_link = '<a id="' . $plugin->slug . '" class="button-primary buy" href="' . esc_url( $status['url'] ) . '" title="'
32
+ . esc_attr(sprintf(__( 'Buy %s', 'wp-e-commerce'), $name)) . '">' . sprintf(__('<span>%s</span> Buy Now</a>', 'wp-e-commerce'), $plugin->price);
33
  }
34
  break;
35
  case 'install':
36
  if ( $status['url'] ) {
37
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600 ), $status['url']);
38
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
39
+ . esc_attr(sprintf(__( 'Install %s', 'wp-e-commerce'), $name)) . '">' . __('Install', 'wp-e-commerce') . '</a>';
40
  }
41
  else {
42
+ $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce') . '">'
43
+ . __('Install', 'wp-e-commerce') . '</span>';
44
  }
45
  break;
46
  case 'update_available':
47
  if ( $status['url'] ) {
48
  $status['url'] = add_query_arg(array('TB_iframe' => true, 'width' => 800, 'height' => 600 ), $status['url']);
49
  $purchase_link = '<a class="button install" href="' . esc_url( $status['url'] ) . '" title="'
50
+ . esc_attr(sprintf(__( 'Update to version %s', 'wp-e-commerce'), $status['version'])) . '">' . __('Update', 'wp-e-commerce') . '</a>';
51
  }
52
  else {
53
+ $purchase_link = '<span title="' . esc_attr__('Cannot auto-install, report this as a bug', 'wp-e-commerce') . '">'
54
+ . __('Update', 'wp-e-commerce') . '</span>';
55
  }
56
  break;
57
  case 'latest_installed':
58
  case 'newer_installed':
59
+ $purchase_link = '<span title="' . esc_attr__('This plugin is already installed and is up to date', 'wp-e-commerce') . ' ">'
60
+ . __('Installed', 'wp-e-commerce') . '</span>';
61
  break;
62
  }
63
  }
71
  <td class="vers column-version"<?php echo $style['version']; ?>><?php echo $plugin->version; ?></td>
72
  <td class="vers column-price"<?php echo $style['price']; ?>><?php echo $purchase_link; ?></td>
73
  <td class="vers column-rating"<?php echo $style['rating']; ?>>
74
+ <div class="star-holder" title="<?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $plugin->rating->count, 'wp-e-commerce' ), number_format_i18n( $plugin->rating->count ) ) ?>">
75
  <div class="star star-rating" style="width: <?php echo (int) (20 * $plugin->rating->average) ?>px"></div>
76
  </div>
77
  </td>
wpsc-components/marketplace-core-v1/library/Sputnik/View/Info.php CHANGED
@@ -19,7 +19,7 @@ class Sputnik_View_Info extends Sputnik_View_Mini {
19
  protected $api;
20
 
21
  public function __construct() {
22
- parent::__construct( __('Plugin Information', 'wpsc') );
23
  $this->plugin = $_GET['info'];
24
 
25
  try {
@@ -28,7 +28,7 @@ class Sputnik_View_Info extends Sputnik_View_Mini {
28
  }
29
  catch (Exception $e) {
30
  status_header(500);
31
- iframe_header( __('', 'wpsc') );
32
  echo $e->getMessage();
33
  iframe_footer();
34
  die();
@@ -48,12 +48,12 @@ class Sputnik_View_Info extends Sputnik_View_Mini {
48
  'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
49
 
50
  $plugins_section_titles = array(
51
- 'description' => _x('Description', 'Plugin installer section title', 'wpsc'),
52
- 'installation' => _x('Installation', 'Plugin installer section title', 'wpsc'),
53
- 'faq' => _x('FAQ', 'Plugin installer section title', 'wpsc'),
54
- 'screenshots' => _x('Screenshots', 'Plugin installer section title', 'wpsc'),
55
- 'changelog' => _x('Changelog', 'Plugin installer section title', 'wpsc'),
56
- 'other_notes' => _x('Other Notes', 'Plugin installer section title', 'wpsc')
57
  );
58
  //Sanitize HTML
59
  $api->sections = (array) $api->sections;
@@ -92,21 +92,21 @@ class Sputnik_View_Info extends Sputnik_View_Mini {
92
  case 'purchase':
93
  default:
94
  if ( $status['url'] )
95
- echo '<a href="' . $status['url'] . '" target="_parent" class="button-primary buy">' . sprintf(__('<span>$%.2f</span> Buy &amp; Install', 'wpsc'), $api->price) . '</a>';
96
  break;
97
  case 'install':
98
  if ( $status['url'] )
99
- echo '<a href="' . $status['url'] . '" class="button-primary install" title="' . __('You have already purchased, install now', 'wpsc') . '">' . __('Install Now', 'wpsc') . '</a>';
100
  break;
101
  case 'update_available':
102
  if ( $status['url'] )
103
- echo '<a href="' . $status['url'] . '" class="button-primary install">' . __('Install Update Now', 'wpsc') .'</a>';
104
  break;
105
  case 'newer_installed':
106
- echo '<a>' . sprintf(__('Newer Version (%s) Installed', 'wpsc'), $status['version']) . '</a>';
107
  break;
108
  case 'latest_installed':
109
- echo '<a>' . __('Latest Version Installed', 'wpsc') . '</a>';
110
  break;
111
  }
112
  ?>
@@ -137,23 +137,23 @@ class Sputnik_View_Info extends Sputnik_View_Mini {
137
  echo "</ul>\n";
138
  echo "</div>\n";
139
  ?>
140
- <h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI', 'wpsc') ?></h2>
141
  <ul>
142
  <?php if ( ! empty($api->version) ) : ?>
143
- <li><strong><?php _e('Version:', 'wpsc') ?></strong> <?php echo $api->version ?></li>
144
  <?php endif; if ( ! empty($api->author) ) : ?>
145
- <li><strong><?php _e('Author:', 'wpsc') ?></strong> <?php echo $api->author ?></li>
146
  <?php endif; if ( ! empty($api->last_updated) ) : ?>
147
- <li><strong><?php _e('Last Updated:', 'wpsc') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
148
- printf( __('%s ago', 'wpsc'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
149
  <?php endif; if ( ! empty($api->requires) ) : ?>
150
- <li><strong><?php _e('Requires WordPress Version:', 'wpsc') ?></strong> <?php printf(__('%s or higher', 'wpsc'), $api->requires) ?></li>
151
  <?php endif; if ( ! empty($api->tested) ) : ?>
152
- <li><strong><?php _e('Compatible up to:', 'wpsc') ?></strong> <?php echo $api->tested ?></li>
153
  <?php endif; if ( ! empty($api->downloaded) ) : ?>
154
- <li><strong><?php _e('Downloaded:', 'wpsc') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded, 'wpsc'), number_format_i18n($api->downloaded)) ?></li>
155
  <?php endif; if ( ! empty($api->homepage) ) : ?>
156
- <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage &#187;', 'wpsc') ?></a></li>
157
  <?php endif; ?>
158
  </ul>
159
 
@@ -161,10 +161,10 @@ class Sputnik_View_Info extends Sputnik_View_Mini {
161
  <div id="section-holder" class="wrap">
162
  <?php
163
  if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )
164
- echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.', 'wpsc') . '</p></div>';
165
 
166
  else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )
167
- echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.', 'wpsc') . '</p></div>';
168
 
169
  foreach ( $api->sections as $section_name => $content ) {
170
  if ( isset( $plugins_section_titles[ $section_name ] ) )
19
  protected $api;
20
 
21
  public function __construct() {
22
+ parent::__construct( __('Plugin Information', 'wp-e-commerce') );
23
  $this->plugin = $_GET['info'];
24
 
25
  try {
28
  }
29
  catch (Exception $e) {
30
  status_header(500);
31
+ iframe_header( __('', 'wp-e-commerce') );
32
  echo $e->getMessage();
33
  iframe_footer();
34
  die();
48
  'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
49
 
50
  $plugins_section_titles = array(
51
+ 'description' => _x('Description', 'Plugin installer section title', 'wp-e-commerce'),
52
+ 'installation' => _x('Installation', 'Plugin installer section title', 'wp-e-commerce'),
53
+ 'faq' => _x('FAQ', 'Plugin installer section title', 'wp-e-commerce'),
54
+ 'screenshots' => _x('Screenshots', 'Plugin installer section title', 'wp-e-commerce'),
55
+ 'changelog' => _x('Changelog', 'Plugin installer section title', 'wp-e-commerce'),
56
+ 'other_notes' => _x('Other Notes', 'Plugin installer section title', 'wp-e-commerce')
57
  );
58
  //Sanitize HTML
59
  $api->sections = (array) $api->sections;
92
  case 'purchase':
93
  default:
94
  if ( $status['url'] )
95
+ echo '<a href="' . $status['url'] . '" target="_parent" class="button-primary buy">' . sprintf(__('<span>$%.2f</span> Buy &amp; Install', 'wp-e-commerce'), $api->price) . '</a>';
96
  break;
97
  case 'install':
98
  if ( $status['url'] )
99
+ echo '<a href="' . $status['url'] . '" class="button-primary install" title="' . __('You have already purchased, install now', 'wp-e-commerce') . '">' . __('Install Now', 'wp-e-commerce') . '</a>';
100
  break;
101
  case 'update_available':
102
  if ( $status['url'] )
103
+ echo '<a href="' . $status['url'] . '" class="button-primary install">' . __('Install Update Now', 'wp-e-commerce') .'</a>';
104
  break;
105
  case 'newer_installed':
106
+ echo '<a>' . sprintf(__('Newer Version (%s) Installed', 'wp-e-commerce'), $status['version']) . '</a>';
107
  break;
108
  case 'latest_installed':
109
+ echo '<a>' . __('Latest Version Installed', 'wp-e-commerce') . '</a>';
110
  break;
111
  }
112
  ?>
137
  echo "</ul>\n";
138
  echo "</div>\n";
139
  ?>
140
+ <h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI', 'wp-e-commerce') ?></h2>
141
  <ul>
142
  <?php if ( ! empty($api->version) ) : ?>
143
+ <li><strong><?php _e('Version:', 'wp-e-commerce') ?></strong> <?php echo $api->version ?></li>
144
  <?php endif; if ( ! empty($api->author) ) : ?>
145
+ <li><strong><?php _e('Author:', 'wp-e-commerce') ?></strong> <?php echo $api->author ?></li>
146
  <?php endif; if ( ! empty($api->last_updated) ) : ?>
147
+ <li><strong><?php _e('Last Updated:', 'wp-e-commerce') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
148
+ printf( __('%s ago', 'wp-e-commerce'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
149
  <?php endif; if ( ! empty($api->requires) ) : ?>
150
+ <li><strong><?php _e('Requires WordPress Version:', 'wp-e-commerce') ?></strong> <?php printf(__('%s or higher', 'wp-e-commerce'), $api->requires) ?></li>
151
  <?php endif; if ( ! empty($api->tested) ) : ?>
152
+ <li><strong><?php _e('Compatible up to:', 'wp-e-commerce') ?></strong> <?php echo $api->tested ?></li>
153
  <?php endif; if ( ! empty($api->downloaded) ) : ?>
154
+ <li><strong><?php _e('Downloaded:', 'wp-e-commerce') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded, 'wp-e-commerce'), number_format_i18n($api->downloaded)) ?></li>
155
  <?php endif; if ( ! empty($api->homepage) ) : ?>
156
+ <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage &#187;', 'wp-e-commerce') ?></a></li>
157
  <?php endif; ?>
158
  </ul>
159
 
161
  <div id="section-holder" class="wrap">
162
  <?php
163
  if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )
164
+ echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.', 'wp-e-commerce') . '</p></div>';
165
 
166
  else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )
167
+ echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.', 'wp-e-commerce') . '</p></div>';
168
 
169
  foreach ( $api->sections as $section_name => $content ) {
170
  if ( isset( $plugins_section_titles[ $section_name ] ) )
wpsc-components/marketplace-core-v1/library/Sputnik/View/Install.php CHANGED
@@ -22,9 +22,9 @@ class Sputnik_View_Install extends Sputnik_View_Mini {
22
  protected $api = null;
23
 
24
  public function __construct() {
25
- parent::__construct(__('Plugin Install', 'wpsc'));
26
  $this->id = $_GET['install'];
27
- $this->title = __('Installing Plugin: %s', 'wpsc');
28
  }
29
 
30
  protected function prepare() {
@@ -48,7 +48,7 @@ class Sputnik_View_Install extends Sputnik_View_Mini {
48
  }
49
 
50
  if ( ! current_user_can('install_plugins') )
51
- wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'wpsc'));
52
 
53
  check_admin_referer($this->nonce_prefix . $this->api->slug);
54
 
22
  protected $api = null;
23
 
24
  public function __construct() {
25
+ parent::__construct(__('Plugin Install', 'wp-e-commerce'));
26
  $this->id = $_GET['install'];
27
+ $this->title = __('Installing Plugin: %s', 'wp-e-commerce');
28
  }
29
 
30
  protected function prepare() {
48
  }
49
 
50
  if ( ! current_user_can('install_plugins') )
51
+ wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'wp-e-commerce'));
52
 
53
  check_admin_referer($this->nonce_prefix . $this->api->slug);
54
 
wpsc-components/marketplace-core-v1/library/Sputnik/View/Install/Skin.php CHANGED
@@ -17,7 +17,7 @@ class Sputnik_View_Install_Skin extends WP_Upgrader_Skin {
17
  function before() {
18
  if ( ! empty( $this->api ) ) {
19
  $asset_type = $this->api->is_theme ? 'theme' : 'plugin';
20
- $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the %s <strong>%s %s</strong>.'), $asset_type, $this->api->name, $this->api->version);
21
  }
22
 
23
  echo '<script>if (window.parent.tb_showIframe) { window.parent.tb_showIframe(); }</script>';
@@ -34,23 +34,23 @@ class Sputnik_View_Install_Skin extends WP_Upgrader_Skin {
34
  // One-Click flow
35
  if (!empty($_GET['also']) && $_GET['also'] == 'activate') {
36
  if (!$this->result || is_wp_error($this->result)) {
37
- show_message(__('Cannot activate plugin.', 'wpsc'));
38
  }
39
  else {
40
- show_message(__('Activating the plugin&#8230;', 'wpsc'));
41
  echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=0&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) .'"></iframe>';
42
  }
43
  }
44
  else {
45
- $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin', 'wpsc') . '" target="_parent">' . __('Activate Plugin', 'wpsc') . '</a>';
46
 
47
  if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
48
- $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network', 'wpsc') . '" target="_parent">' . __('Network Activate', 'wpsc') . '</a>';
49
  unset( $install_actions['activate_plugin'] );
50
  }
51
  }
52
 
53
- $install_actions['store'] = '<a href="' . Sputnik_Admin::build_url() . '" title="' . esc_attr__('Return to Store', 'wpsc') . '" target="_parent" class="close">' . __('Return to Store', 'wpsc') . '</a>';
54
 
55
 
56
  if (!$this->result || is_wp_error($this->result)) {
17
  function before() {
18
  if ( ! empty( $this->api ) ) {
19
  $asset_type = $this->api->is_theme ? 'theme' : 'plugin';
20
+ $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the %s <strong>%s %s</strong>.', 'wp-e-commerce' ), $asset_type, $this->api->name, $this->api->version);
21
  }
22
 
23
  echo '<script>if (window.parent.tb_showIframe) { window.parent.tb_showIframe(); }</script>';
34
  // One-Click flow
35
  if (!empty($_GET['also']) && $_GET['also'] == 'activate') {
36
  if (!$this->result || is_wp_error($this->result)) {
37
+ show_message(__('Cannot activate plugin.', 'wp-e-commerce'));
38
  }
39
  else {
40
+ show_message(__('Activating the plugin&#8230;', 'wp-e-commerce'));
41
  echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=0&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) .'"></iframe>';
42
  }
43
  }
44
  else {
45
+ $install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin', 'wp-e-commerce') . '" target="_parent">' . __('Activate Plugin', 'wp-e-commerce') . '</a>';
46
 
47
  if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
48
+ $install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network', 'wp-e-commerce') . '" target="_parent">' . __('Network Activate', 'wp-e-commerce') . '</a>';
49
  unset( $install_actions['activate_plugin'] );
50
  }
51
  }
52
 
53
+ $install_actions['store'] = '<a href="' . Sputnik_Admin::build_url() . '" title="' . esc_attr__('Return to Store', 'wp-e-commerce') . '" target="_parent" class="close">' . __('Return to Store', 'wp-e-commerce') . '</a>';
54
 
55
 
56
  if (!$this->result || is_wp_error($this->result)) {
wpsc-components/marketplace-core-v1/library/Sputnik/View/Upgrade.php CHANGED
@@ -17,11 +17,11 @@ class Sputnik_View_Upgrade extends Sputnik_View_Install {
17
 
18
  public function __construct() {
19
  parent::__construct();
20
- $this->title = __('Update Plugin', 'wpsc');
21
 
22
  $this->body_id = 'sputnik-upgrade';
23
  $this->nonce_prefix = 'sputnik_upgrade-plugin_';
24
- $this->title_format = __('Updating Plugin: %s', 'wpsc');
25
  }
26
 
27
  protected function prepare() {
@@ -29,13 +29,13 @@ class Sputnik_View_Upgrade extends Sputnik_View_Install {
29
  $this->file = $_GET['upgrade'];
30
  $data = Sputnik::get_from_file($file);
31
  if ($data === null) {
32
- throw new Exception(__('Plugin not found', 'wpsc'));
33
  }
34
  $this->id = $data['Sputnik ID'];
35
  }
36
  catch (Exception $e) {
37
  status_header(500);
38
- iframe_header( __('Update Plugin', 'wpsc') );
39
  echo $e->getMessage();
40
  iframe_footer();
41
  die();
17
 
18
  public function __construct() {
19
  parent::__construct();
20
+ $this->title = __('Update Plugin', 'wp-e-commerce');
21
 
22
  $this->body_id = 'sputnik-upgrade';
23
  $this->nonce_prefix = 'sputnik_upgrade-plugin_';
24
+ $this->title_format = __('Updating Plugin: %s', 'wp-e-commerce');
25
  }
26
 
27
  protected function prepare() {
29
  $this->file = $_GET['upgrade'];
30
  $data = Sputnik::get_from_file($file);
31
  if ($data === null) {
32
+ throw new Exception(__('Plugin not found', 'wp-e-commerce'));
33
  }
34
  $this->id = $data['Sputnik ID'];
35
  }
36
  catch (Exception $e) {
37
  status_header(500);
38
+ iframe_header( __('Update Plugin', 'wp-e-commerce') );
39
  echo $e->getMessage();
40
  iframe_footer();
41
  die();
wpsc-components/marketplace-core-v1/static/admin.js CHANGED
@@ -1,3 +1,4 @@
 
1
  jQuery(document).ready(function($) {
2
  var receiveMessage = function() {
3
  if ( event.data == 'tb_close' )
1
+ /* global jQuery, tb_remove, sputnikL10n, PAYPAL, ajaxurl, alert, tb_show, tb_click, self */
2
  jQuery(document).ready(function($) {
3
  var receiveMessage = function() {
4
  if ( event.data == 'tb_close' )
wpsc-components/marketplace-core-v1/static/modal.js CHANGED
@@ -1,3 +1,4 @@
 
1
  window.sputnik = window.sputnik || {};
2
 
3
  (function($){
@@ -33,7 +34,7 @@ window.sputnik = window.sputnik || {};
33
  compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options );
34
  return compiled( data );
35
  };
36
- }),
37
  });
38
 
39
  sputnik.controller.Region = function( options ) {
@@ -119,7 +120,7 @@ window.sputnik = window.sputnik || {};
119
  tested: '',
120
  requires: '',
121
  rating: 0,
122
- user_rating: 0,
123
  }
124
  })
125
 
1
+ /* global sputnik */
2
  window.sputnik = window.sputnik || {};
3
 
4
  (function($){
34
  compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options );
35
  return compiled( data );
36
  };
37
+ })
38
  });
39
 
40
  sputnik.controller.Region = function( options ) {
120
  tested: '',
121
  requires: '',
122
  rating: 0,
123
+ user_rating: 0
124
  }
125
  })
126
 
wpsc-components/merchant-core-v2/helpers/admin.php CHANGED
@@ -83,20 +83,20 @@ function _wpsc_filter_merchant_v2_gateway_form( $form, $selected_gateway ) {
83
  } else {
84
  switch($selected_gateway_data['payment_type']) {
85
  case "paypal";
86
- $display_name = __( 'PayPal', 'wpsc' );
87
  break;
88
 
89
  case "manual_payment":
90
- $display_name = __( 'Manual Payment', 'wpsc' );
91
  break;
92
 
93
  case "google_checkout":
94
- $display_name = __( 'Google Checkout', 'wpsc' );
95
  break;
96
 
97
  case "credit_card":
98
  default:
99
- $display_name = __( 'Credit Card', 'wpsc' );
100
  break;
101
  }
102
  }
@@ -104,10 +104,10 @@ function _wpsc_filter_merchant_v2_gateway_form( $form, $selected_gateway ) {
104
  ob_start();
105
  ?>
106
  <tr>
107
- <td width="150"><?php esc_html_e( 'Display Name', 'wpsc' ); ?></td>
108
  <td>
109
  <input type="text" name="user_defined_name[<?php echo esc_attr( $selected_gateway ); ?>]" value="<?php echo esc_html( $display_name ); ?>" />
110
- <p class="description"><?php esc_html_e( 'The text that people see when making a purchase.', 'wpsc' ); ?></p>
111
  </td>
112
  </tr>
113
  <?php
83
  } else {
84
  switch($selected_gateway_data['payment_type']) {
85
  case "paypal";
86
+ $display_name = __( 'PayPal', 'wp-e-commerce' );
87
  break;
88
 
89
  case "manual_payment":
90
+ $display_name = __( 'Manual Payment', 'wp-e-commerce' );
91
  break;
92
 
93
  case "google_checkout":
94
+ $display_name = __( 'Google Checkout', 'wp-e-commerce' );
95
  break;
96
 
97
  case "credit_card":
98
  default:
99
+ $display_name = __( 'Credit Card', 'wp-e-commerce' );
100
  break;
101
  }
102
  }
104
  ob_start();
105
  ?>
106
  <tr>
107
+ <td width="150"><?php esc_html_e( 'Display Name', 'wp-e-commerce' ); ?></td>
108
  <td>
109
  <input type="text" name="user_defined_name[<?php echo esc_attr( $selected_gateway ); ?>]" value="<?php echo esc_html( $display_name ); ?>" />
110
+ <p class="description"><?php esc_html_e( 'The text that people see when making a purchase.', 'wp-e-commerce' ); ?></p>
111
  </td>
112
  </tr>
113
  <?php
wpsc-components/merchant-core-v2/helpers/checkout.php CHANGED
@@ -60,6 +60,12 @@ function _wpsc_filter_merchant_v2_payment_method_form_fields( $fields ) {
60
  $selected_value = $purchase_log->get( 'gateway' );
61
  }
62
 
 
 
 
 
 
 
63
  foreach ( _wpsc_merchant_v2_get_active_gateways() as $gateway ) {
64
  $gateway = (object) $gateway;
65
  $title = $gateway->name;
@@ -90,8 +96,15 @@ add_filter(
90
  );
91
 
92
  function _wpsc_filter_merchant_v2_field_after( $output, $field, $r ) {
93
- if ( $field['name'] != 'wpsc_payment_method' )
 
 
 
 
 
 
94
  return $output;
 
95
 
96
  foreach ( _wpsc_merchant_v2_get_active_gateways() as $gateway ) {
97
  if ( $gateway['internalname'] == $field['value'] ) {
@@ -130,9 +143,9 @@ function _wpsc_merchant_v2_hack_gateway_field_names( $extra_form, $gateway ) {
130
 
131
  function _wpsc_merchant_v2_get_active_gateways() {
132
  global $nzshpcrt_gateways;
133
- static $gateways = null;
134
 
135
- if ( is_null( $gateways ) ) {
136
  $active = get_option( 'custom_gateway_options' );
137
  foreach ( $nzshpcrt_gateways as $gateway ) {
138
  if ( in_array( $gateway['internalname'], (array) $active ) )
60
  $selected_value = $purchase_log->get( 'gateway' );
61
  }
62
 
63
+ $gateways = _wpsc_merchant_v2_get_active_gateways();
64
+
65
+ if ( empty( $gateways ) ) {
66
+ return $fields;
67
+ }
68
+
69
  foreach ( _wpsc_merchant_v2_get_active_gateways() as $gateway ) {
70
  $gateway = (object) $gateway;
71
  $title = $gateway->name;
96
  );
97
 
98
  function _wpsc_filter_merchant_v2_field_after( $output, $field, $r ) {
99
+ if ( $field['name'] != 'wpsc_payment_method' ) {
100
+ return $output;
101
+ }
102
+
103
+ $gateways = _wpsc_merchant_v2_get_active_gateways();
104
+
105
+ if ( empty( $gateways ) ) {
106
  return $output;
107
+ }
108
 
109
  foreach ( _wpsc_merchant_v2_get_active_gateways() as $gateway ) {
110
  if ( $gateway['internalname'] == $field['value'] ) {
143
 
144
  function _wpsc_merchant_v2_get_active_gateways() {
145
  global $nzshpcrt_gateways;
146
+ static $gateways = array();
147
 
148
+ if ( empty( $gateways ) ) {
149
  $active = get_option( 'custom_gateway_options' );
150
  foreach ( $nzshpcrt_gateways as $gateway ) {
151
  if ( in_array( $gateway['internalname'], (array) $active ) )
wpsc-components/merchant-core-v2/helpers/gateways.php CHANGED
@@ -67,7 +67,7 @@ function wpsc_gateway_image_url(){
67
 
68
  /**
69
  * Return the current gateway's name.
70
- *
71
  * @return string The current gateway's name.
72
  *
73
  * @uses $wpsc_gateway Global array of gateways.
@@ -89,7 +89,7 @@ function wpsc_gateway_name() {
89
 
90
  // If no display name or image, use default
91
  if ( $display_name == '' && ! wpsc_show_gateway_image() ) {
92
- $display_name = __( 'Credit Card', 'wpsc' );
93
  }
94
 
95
  return $display_name;
@@ -112,16 +112,16 @@ function _wpsc_gateway_name_filter( $display_name, $gateway ) {
112
  case 'paypal':
113
  case 'paypal_pro':
114
  case 'wpsc_merchant_paypal_pro';
115
- $display_name = __( 'PayPal', 'wpsc' );
116
  break;
117
 
118
  case 'manual_payment':
119
- $display_name = __( 'Manual Payment', 'wpsc' );
120
  break;
121
 
122
  case 'credit_card':
123
  default:
124
- $display_name = __( 'Credit Card', 'wpsc' );
125
  break;
126
  }
127
  }
@@ -303,14 +303,14 @@ function _wpsc_action_merchant_v2_validate_payment_method( $valid, $controller )
303
  if ( $card_number_error )
304
  continue;
305
 
306
- $messages['card_number'] = __( 'Please enter a valid credit card number', 'wpsc' );
307
  $card_number_error = true;
308
  break;
309
  case 'card_code':
310
- $messages[$field] = __( 'Please enter a valid CVV', 'wpsc' );
311
  break;
312
  case 'cctype':
313
- $messages[$field] = __( 'Please select a valid credit card type', 'wpsc' );
314
  break;
315
  }
316
  }
@@ -322,7 +322,7 @@ function _wpsc_action_merchant_v2_validate_payment_method( $valid, $controller )
322
  empty( $extra['expiry'][$element] )
323
  || ! is_numeric( $extra['expiry'][$element] )
324
  ) {
325
- $messages['expdate'] = __( 'Please specify a valid expiration date.', 'wpsc' );
326
  break;
327
  }
328
  }
67
 
68
  /**
69
  * Return the current gateway's name.
70
+ *
71
  * @return string The current gateway's name.
72
  *
73
  * @uses $wpsc_gateway Global array of gateways.
89
 
90
  // If no display name or image, use default
91
  if ( $display_name == '' && ! wpsc_show_gateway_image() ) {
92
+ $display_name = __( 'Credit Card', 'wp-e-commerce' );
93
  }
94
 
95
  return $display_name;
112
  case 'paypal':
113
  case 'paypal_pro':
114
  case 'wpsc_merchant_paypal_pro';
115
+ $display_name = __( 'PayPal', 'wp-e-commerce' );
116
  break;
117
 
118
  case 'manual_payment':
119
+ $display_name = __( 'Manual Payment', 'wp-e-commerce' );
120
  break;
121
 
122
  case 'credit_card':
123
  default:
124
+ $display_name = __( 'Credit Card', 'wp-e-commerce' );
125
  break;
126
  }
127
  }
303
  if ( $card_number_error )
304
  continue;
305
 
306
+ $messages['card_number'] = __( 'Please enter a valid credit card number', 'wp-e-commerce' );
307
  $card_number_error = true;
308
  break;
309
  case 'card_code':
310
+ $messages[$field] = __( 'Please enter a valid CVV', 'wp-e-commerce' );
311
  break;
312
  case 'cctype':
313
+ $messages[$field] = __( 'Please select a valid credit card type', 'wp-e-commerce' );
314
  break;
315
  }
316
  }
322
  empty( $extra['expiry'][$element] )
323
  || ! is_numeric( $extra['expiry'][$element] )
324
  ) {
325
+ $messages['expdate'] = __( 'Please specify a valid expiration date.', 'wp-e-commerce' );
326
  break;
327
  }
328
  }
wpsc-components/merchant-core-v3/classes/payment-gateway.php CHANGED
@@ -75,7 +75,7 @@ final class WPSC_Payment_Gateways {
75
  );
76
 
77
  if ( ! class_exists( $class_name ) ) {
78
- $error = new WP_Error( 'wpsc_invalid_payment_gateway', sprintf( __( 'Invalid payment gateway: Class %s does not exist.', 'wpsc' ), $class_name ) );
79
  return $error;
80
  }
81
 
@@ -233,7 +233,7 @@ final class WPSC_Payment_Gateways {
233
 
234
  self::unregister_file( $filename );
235
 
236
- $error = new WP_Error( 'wpsc-payment', __( 'Error' ) );
237
 
238
  return $error;
239
  }
@@ -477,18 +477,18 @@ abstract class WPSC_Payment_Gateway {
477
  */
478
  public function setup_form() {
479
  $checkout_field_types = array(
480
- 'billing' => __( 'Billing Fields' , 'wpsc' ),
481
- 'shipping' => __( 'Shipping Fields', 'wpsc' ),
482
  );
483
 
484
  $fields = array(
485
- 'firstname' => __( 'First Name' , 'wpsc' ),
486
- 'lastname' => __( 'Last Name' , 'wpsc' ),
487
- 'address' => __( 'Address' , 'wpsc' ),
488
- 'city' => __( 'City' , 'wpsc' ),
489
- 'state' => __( 'State' , 'wpsc' ),
490
- 'country' => __( 'Country' , 'wpsc' ),
491
- 'postcode' => __( 'Postal Code', 'wpsc' ),
492
  );
493
 
494
  $checkout_form = WPSC_Checkout_Form::get();
75
  );
76
 
77
  if ( ! class_exists( $class_name ) ) {
78
+ $error = new WP_Error( 'wpsc_invalid_payment_gateway', sprintf( __( 'Invalid payment gateway: Class %s does not exist.', 'wp-e-commerce' ), $class_name ) );
79
  return $error;
80
  }
81
 
233
 
234
  self::unregister_file( $filename );
235
 
236
+ $error = new WP_Error( 'wpsc-payment', __( 'Error', 'wp-e-commerce' ) );
237
 
238
  return $error;
239
  }
477
  */
478
  public function setup_form() {
479
  $checkout_field_types = array(
480
+ 'billing' => __( 'Billing Fields' , 'wp-e-commerce' ),
481
+ 'shipping' => __( 'Shipping Fields', 'wp-e-commerce' ),
482
  );
483
 
484
  $fields = array(
485
+ 'firstname' => __( 'First Name' , 'wp-e-commerce' ),
486
+ 'lastname' => __( 'Last Name' , 'wp-e-commerce' ),
487
+ 'address' => __( 'Address' , 'wp-e-commerce' ),
488
+ 'city' => __( 'City' , 'wp-e-commerce' ),
489
+ 'state' => __( 'State' , 'wp-e-commerce' ),
490
+ 'country' => __( 'Country' , 'wp-e-commerce' ),
491
+ 'postcode' => __( 'Postal Code', 'wp-e-commerce' ),
492
  );
493
 
494
  $checkout_form = WPSC_Checkout_Form::get();
wpsc-components/merchant-core-v3/gateways/amazon-payments.php ADDED
@@ -0,0 +1,1846 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Todos, in a future phase:
4
+ *
5
+ * - Integrate with recurring payments
6
+ * - Integrate with tev1
7
+ */
8
+ class WPSC_Payment_Gateway_Amazon_Payments extends WPSC_Payment_Gateway {
9
+
10
+ private $endpoints = array(
11
+ 'sandbox' => array(
12
+ 'US' => 'https://mws.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01/',
13
+ 'JP' => 'https://mws.amazonservices.jp/OffAmazonPayments_Sandbox/2013-01-01/',
14
+ 'GB' => 'https://mws-eu.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01/',
15
+ 'DE' => 'https://mws-eu.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01/',
16
+ ),
17
+ 'production' => array(
18
+ 'US' => 'https://mws.amazonservices.com/OffAmazonPayments/2013-01-01/',
19
+ 'JP' => 'https://mws.amazonservices.jp/OffAmazonPayments/2013-01-01/',
20
+ 'GB' => 'https://mws-eu.amazonservices.com/OffAmazonPayments/2013-01-01/',
21
+ 'DE' => 'https://mws-eu.amazonservices.com/OffAmazonPayments/2013-01-01/',
22
+ )
23
+ );
24
+
25
+ private $order_handler;
26
+ private $reference_id;
27
+ private $seller_id;
28
+ private $mws_access_key;
29
+ private $secret_key;
30
+ private $sandbox;
31
+ private $client_id;
32
+ private $payment_capture;
33
+ private $endpoint;
34
+ private $user_is_authenticated = false;
35
+
36
+ public function __construct() {
37
+
38
+ parent::__construct();
39
+
40
+ $this->title = __( 'Amazon Payments', 'wp-e-commerce' );
41
+
42
+ $this->reference_id = ! empty( $_REQUEST['amazon_reference_id'] ) ? sanitize_text_field( $_REQUEST['amazon_reference_id'] ) : '';
43
+
44
+ $this->user_is_authenticated = isset( $_GET['amazon_payments_advanced'] ) && 'true' == $_GET['amazon_payments_advanced'] && isset( $_GET['access_token'] );
45
+
46
+ $this->order_handler = WPSC_Amazon_Payments_Order_Handler::get_instance( $this );
47
+
48
+ add_action( 'init', array( $this->order_handler, 'process_ipn' ) );
49
+ // Define user set variables
50
+ $this->seller_id = $this->setting->get( 'seller_id' );
51
+ $this->mws_access_key = $this->setting->get( 'mws_access_key' );
52
+ $this->secret_key = $this->setting->get( 'secret_key' );
53
+ $this->sandbox = $this->setting->get( 'sandbox_mode' ) == '1' ? true : false;
54
+ $this->payment_capture = $this->setting->get( 'payment_capture' ) !== null ? $this->setting->get( 'payment_capture' ) : '';
55
+ $this->client_id = $this->setting->get( 'client_id' );
56
+
57
+ $base_country = new WPSC_Country( wpsc_get_base_country() );
58
+
59
+ // Get endpoint
60
+ $location = in_array( $base_country->get_isocode(), array( 'US', 'GB', 'DE', 'JP' ) ) ? $base_country->get_isocode() : 'US';
61
+ $this->endpoint = $this->sandbox ? $this->endpoints['sandbox'][ $location ] : $this->endpoints['production'][ $location ];
62
+
63
+ $this->define_widget_constants();
64
+
65
+ if ( isset( $_POST['post_data'] ) ) {
66
+ parse_str( $_POST['post_data'], $post_data );
67
+
68
+ if ( isset( $post_data['amazon_reference_id'] ) ) {
69
+ $this->reference_id = sanitize_text_field( $post_data['amazon_reference_id'] );
70
+ }
71
+ }
72
+ }
73
+
74
+ public function get_image_url() {
75
+ return apply_filters( 'wpsc_amazon_pa_logo', WPSC_MERCHANT_V3_SDKS_URL . '/amazon-payments/assets/images/amazon-payments.gif' );
76
+ }
77
+
78
+ public function define_widget_constants() {
79
+ $base_country = new WPSC_Country( wpsc_get_base_country() );
80
+
81
+ switch ( $base_country->get_isocode() ) {
82
+ case 'GB' :
83
+ define( 'WPSC_AMAZON_PA_WIDGETS_URL', 'https://static-eu.payments-amazon.com/OffAmazonPayments/uk/' . ( $this->sandbox ? 'sandbox/' : '' ) . 'lpa/js/Widgets.js?sellerId=' . $this->setting->get( 'seller_id' ) );
84
+ define( 'WPSC_AMAZON_WIDGET_ENDPOINT', 'https://payments' . ( $this->sandbox ? '-sandbox' : '' ) . '.amazon.co.uk' );
85
+ define( 'WPSC_AMAZON_REGISTER_URL', 'https://sellercentral-europe.amazon.com/gp/on-board/workflow/Registration/login.html?passthrough%2Fsource=internal-landing-select&passthrough%2F*entries*=0&passthrough%2FmarketplaceID=A2WQPBGJ59HSXT&passthrough%2FsuperSource=OAR&passthrough%2F*Version*=1&passthrough%2Fld=APRPWPECOMMERCE&passthrough%2Faccount=cba&passthrough%2FwaiveFee=1' );
86
+ break;
87
+ case 'DE' :
88
+ define( 'WPSC_AMAZON_PA_WIDGETS_URL', 'https://static-eu.payments-amazon.com/OffAmazonPayments/de/' . ( $this->sandbox ? 'sandbox/' : '' ) . 'lpa/js/Widgets.js?sellerId=' . $this->setting->get( 'seller_id' ) );
89
+ define( 'WPSC_AMAZON_WIDGET_ENDPOINT', 'https://payments' . ( $this->sandbox ? '-sandbox' : '' ) . '.amazon.de' );
90
+ define( 'WPSC_AMAZON_REGISTER_URL', 'https://sellercentral-europe.amazon.com/gp/on-board/workflow/Registration/login.html?passthrough%2Fsource=internal-landing-select&passthrough%2F*entries*=0&passthrough%2FmarketplaceID=A1OCY9REWJOCW5&passthrough%2FsuperSource=OAR&passthrough%2F*Version*=1&passthrough%2Fld=APRPWPECOMMERCE&passthrough%2Faccount=cba&passthrough%2FwaiveFee=1' );
91
+ break;
92
+ default :
93
+ define( 'WPSC_AMAZON_PA_WIDGETS_URL', 'https://static-na.payments-amazon.com/OffAmazonPayments/us/' . ( $this->sandbox ? 'sandbox/' : '' ) . 'js/Widgets.js?sellerId=' . $this->setting->get( 'seller_id' ) );
94
+ define( 'WPSC_AMAZON_WIDGET_ENDPOINT', 'https://payments' . ( $this->sandbox ? '-sandbox' : '' ) . '.amazon.com' );
95
+ define( 'WPSC_AMAZON_REGISTER_URL', 'https://sellercentral.amazon.com/hz/me/sp/signup?solutionProviderOptions=mws-acc%3B&marketplaceId=AGWSWK15IEJJ7&solutionProviderToken=AAAAAQAAAAEAAAAQ1XU19m0BwtKDkfLZx%2B03RwAAAHBZVsoAgz2yhE7DemKr0y26Mce%2F9Q64kptY6CRih871XhB7neN0zoPX6c1wsW3QThdY6g1Re7CwxJkhvczwVfvZ9BvjG1V%2F%2FHrRgbIf47cTrdo5nNT8jmYSIEJvFbSm85nWxpvHjSC4CMsVL9s%2FPsZt&solutionProviderId=A1BVJDFFHQ7US4' );
96
+ break;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Load gateway only if curl is enabled (SDK requirement), PHP 5.3+ (same) and TEv2.
102
+ *
103
+ * @return bool Whether or not to load gateway.
104
+ */
105
+ public static function load() {
106
+ return version_compare( phpversion(), '5.3', '>=' ) && function_exists( 'curl_init' ) && function_exists( '_wpsc_get_current_controller' );
107
+ }
108
+
109
+ /**
110
+ * Displays the setup form
111
+ *
112
+ * @access public
113
+ *
114
+ * @since 4.0
115
+ *
116
+ * @return void
117
+ */
118
+ public function setup_form() {
119
+ $base_country = wpsc_get_base_country();
120
+
121
+ if ( 'DE' == $base_country ) {
122
+ $url = 'https://payments.amazon.de/preregistration/lpa';
123
+ } elseif ( 'GB' == $base_country ) {
124
+ $url = 'https://payments.amazon.co.uk/preregistration/lpa';
125
+ } else {
126
+ $url = 'https://sellercentral.amazon.com/hz/me/sp/signup?solutionProviderId=A2Z8DY3R4G08IM&amp;marketplaceId=A3BXB0YN3XH17H&amp;solutionProviderToken=AAAAAQAAAAEAAAAQ%2F%2BVV%2BNAyLa44JbR1AcSD5wAAAKDg6Y6tCJq9iWT9OixhUYHJ%2BUqm13HQFprn8h5WPDVL1Or%2FiMaZiZp8LAKpQoaVxEvthiKp6NVelmkTUOnWAGBHd7IufKvcqXcZ1WwXP6CsZW3AQqWZscVh1UhY%2B%2BkQY3ckEJGuCz4TPHYLgucZqq%2FRfsG1IYSEwuATdgLe3M2kYDvcdKG9pFNm3zNx7cOqcLCecOvNTrfzSL4Uh6Iiz84Z&amp;solutionProviderReturnURL=https%3A%2F%2Fpayments.amazon.com%2Fmerchant&amp;solutionProviderOptions=mws-acc%3B';
127
+ }
128
+ ?>
129
+ <!-- Account Credentials -->
130
+ <tr>
131
+ <td colspan="2">
132
+ <h4><?php _e( 'Register with Amazon', 'wp-e-commerce' ); ?></h4>
133
+ </td>
134
+ </tr>
135
+ <tr>
136
+ <td></td>
137
+ <td>
138
+ <a class="button" target="_blank" href="<?php echo esc_url( $url ); ?>"><?php _e( 'Connect WP eCommerce to Amazon', 'wp-e-commerce' ); ?></a><br />
139
+ <small><?php _e( 'Once registration is complete, enter your API credentials below.', 'wp-e-commerce' ); ?></small>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <td>
144
+ <label for="wpsc-amazon-payments-ipn"><?php _e( 'Amazon Merchant IPN URL', 'wp-e-commerce' ); ?></label>
145
+ </td>
146
+ <td>
147
+ <input id="wpsc-amazon-payments-ipn" type="text" disabled value="<?php echo $this->get_amazon_ipn_url(); ?>" /><br />
148
+ <small><?php printf( __( 'The IPN URL to provide in your MWS account. Enter this under your <a href="%s">Integration Settings</a>', 'wp-e-commerce' ), 'https://sellercentral.amazon.com/gp/pyop/seller/account/settings/user-settings-edit.html' ); ?></small>
149
+ </td>
150
+ </tr>
151
+ <tr>
152
+ <td colspan="2">
153
+ <h4><?php _e( 'Account Credentials', 'wp-e-commerce' ); ?></h4>
154
+ </td>
155
+ </tr>
156
+
157
+ <tr>
158
+ <td>
159
+ <label for="wpsc-amazon-payments-seller-id"><?php _e( 'Seller ID', 'wp-e-commerce' ); ?></label>
160
+ </td>
161
+ <td>
162
+ <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'seller_id' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'seller_id' ) ); ?>" id="wpsc-amazon-payments-seller-id" /><br />
163
+ <small><?php _e( 'Obtained from your Amazon account. Also known as the "Merchant ID". Usually found under Settings > Integrations after logging into your merchant account.', 'wp-e-commerce' ); ?></small>
164
+ </td>
165
+ </tr>
166
+ <tr>
167
+ <td>
168
+ <label for="wpsc-amazon-payments-mws-access-key"><?php _e( 'MWS Access Key', 'wp-e-commerce' ); ?></label>
169
+ </td>
170
+ <td>
171
+ <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'mws_access_key' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'mws_access_key' ) ); ?>" id="wpsc-amazon-payments-mws-access-key" /><br />
172
+ </td>
173
+ </tr>
174
+ <tr>
175
+ <td>
176
+ <label for="wpsc-amazon-payments-secret-key"><?php _e( 'MWS Secret Key', 'wp-e-commerce' ); ?></label>
177
+ </td>
178
+ <td>
179
+ <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'secret_key' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'secret_key' ) ); ?>" id="wpsc-amazon-payments-secret-key" /><br />
180
+ <small><?php _e( 'Obtained from your Amazon account. You can get these keys by logging into Seller Central and viewing the MWS Access Key section under the Integration tab.', 'wp-e-commerce' ); ?></small>
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <td>
185
+ <label for="wpsc-amazon-payments-client-id"><?php _e( 'Client ID', 'wp-e-commerce' ); ?></label>
186
+ </td>
187
+ <td>
188
+ <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'client_id' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'client_id' ) ); ?>" id="wpsc-amazon-payments-client_id" /><br />
189
+ <small><?php _e( 'Obtained from your Amazon account, under Web Settings.', 'wp-e-commerce' ); ?></small>
190
+ </td>
191
+ </tr>
192
+ <tr>
193
+ <td>
194
+ <label for="wpsc-amazon-payments-sandbox-mode"><?php _e( 'Sandbox Mode', 'wp-e-commerce' ); ?></label>
195
+ </td>
196
+ <td>
197
+ <label><input <?php checked( $this->setting->get( 'sandbox_mode' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
198
+ <label><input <?php checked( (bool) $this->setting->get( 'sandbox_mode' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
199
+ </td>
200
+ </tr>
201
+ <tr>
202
+ <td>
203
+ <label for="wpsc-amazon-payments-payment-capture"><?php _e( 'Payment Capture', 'wp-e-commerce' ); ?></label>
204
+ </td>
205
+ <td>
206
+ <select id="wpsc-amazon-payments-payment-capture" name="<?php echo esc_attr( $this->setting->get_field_name( 'payment_capture' ) ); ?>">
207
+ <option value='' <?php selected( '', $this->setting->get( 'payment_capture' ) ); ?>><?php _e( 'Authorize and capture the payment when the order is placed.', 'wp-e-commerce' )?></option>
208
+ <option value='authorize' <?php selected( 'authorize', $this->setting->get( 'payment_capture' ) ); ?>><?php _e( 'Authorize the payment when the order is placed.', 'wp-e-commerce' )?></option>
209
+ <option value='manual' <?php selected( 'manual', $this->setting->get( 'payment_capture' ) ); ?>><?php _e( 'Don’t authorize the payment when the order is placed (i.e. for pre-orders).', 'wp-e-commerce' )?></option>
210
+ </select>
211
+ </td>
212
+ </tr>
213
+ <tr>
214
+ <td>
215
+ <label for="wpsc-amazon-payments-cart-button-display"><?php _e( 'Cart login button display', 'wp-e-commerce' ); ?></label>
216
+ </td>
217
+ <td>
218
+ <select id="wpsc-amazon-payments-cart-button-display" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_button_display' ) ); ?>">
219
+ <option value='button' <?php selected( 'button', $this->setting->get( 'cart_button_display' ) ); ?>><?php _e( 'Button', 'wp-e-commerce' )?></option>
220
+ <option value='banner' <?php selected( 'banner', $this->setting->get( 'cart_button_display' ) ); ?>><?php _e( 'Banner', 'wp-e-commerce' )?></option>
221
+ <option value='disabled' <?php selected( 'disabled', $this->setting->get( 'cart_button_display' ) ); ?>><?php _e( 'Disabled', 'wp-e-commerce' )?></option>
222
+ </select><br />
223
+ <small><?php _e( 'How the Login with Amazon button gets displayed on the cart page.', 'wp-e-commerce' ); ?></small>
224
+ </td>
225
+ </tr>
226
+ <tr>
227
+ <td>
228
+ <label for="wpsc-amazon-payments-hide-button-display"><?php _e( 'Hide Standard Checkout Button', 'wp-e-commerce' ); ?></label>
229
+ </td>
230
+ <td>
231
+ <label><input <?php checked( $this->setting->get( 'hide_button_display' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'hide_button_display' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
232
+ <label><input <?php checked( (bool) $this->setting->get( 'hide_button_display' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'hide_button_display' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
233
+ </td>
234
+ </tr>
235
+ <!-- Error Logging -->
236
+ <tr>
237
+ <td colspan="2">
238
+ <h4><?php _e( 'Error Logging', 'wp-e-commerce' ); ?></h4>
239
+ </td>
240
+ </tr>
241
+
242
+ <tr>
243
+ <td>
244
+ <label><?php _e( 'Enable Debugging', 'wp-e-commerce' ); ?></label>
245
+ </td>
246
+ <td>
247
+ <label><input <?php checked( $this->setting->get( 'debugging' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
248
+ <label><input <?php checked( (bool) $this->setting->get( 'debugging' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
249
+ </td>
250
+ </tr>
251
+ <?php
252
+ }
253
+
254
+ public function process() {
255
+
256
+ $order = $this->purchase_log;
257
+
258
+ $status = $this->payment_capture === '' ? WPSC_Purchase_Log::ACCEPTED_PAYMENT : WPSC_Purchase_Log::ORDER_RECEIVED;
259
+
260
+ $order->set( 'processed', $status )->save();
261
+
262
+ $amazon_reference_id = isset( $_REQUEST['amazon_reference_id'] ) ? sanitize_text_field( $_REQUEST['amazon_reference_id'] ) : '';
263
+
264
+ try {
265
+
266
+ if ( ! $amazon_reference_id ) {
267
+ throw new Exception( __( 'An Amazon payment method was not chosen.', 'wp-e-commerce' ) );
268
+ }
269
+
270
+ // Update order reference with amounts
271
+ $response = $this->api_request( array(
272
+ 'Action' => 'SetOrderReferenceDetails',
273
+ 'AmazonOrderReferenceId' => $amazon_reference_id,
274
+ 'OrderReferenceAttributes.OrderTotal.Amount' => $order->get( 'totalprice' ),
275
+ 'OrderReferenceAttributes.OrderTotal.CurrencyCode' => strtoupper( $this->get_currency_code() ),
276
+ 'OrderReferenceAttributes.SellerNote' => sprintf( __( 'Order %s from %s.', 'wp-e-commerce' ), $order->get( 'id' ), remove_accents( wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ) ),
277
+ 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId' => $order->get( 'id' ),
278
+ 'OrderReferenceAttributes.SellerOrderAttributes.StoreName' => remove_accents( wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ),
279
+ 'OrderReferenceAttributes.PlatformId' => 'A2Z8DY3R4G08IM'
280
+ ) );
281
+
282
+ if ( is_wp_error( $response ) ) {
283
+ throw new Exception( $response->get_error_message() );
284
+ }
285
+
286
+ if ( isset( $response['Error']['Message'] ) ) {
287
+ throw new Exception( $response['Error']['Message'] );
288
+ }
289
+
290
+ // Confirm order reference
291
+ $response = $this->api_request( array(
292
+ 'Action' => 'ConfirmOrderReference',
293
+ 'AmazonOrderReferenceId' => $amazon_reference_id
294
+ ) );
295
+
296
+ if ( is_wp_error( $response ) ) {
297
+ throw new Exception( $response->get_error_message() );
298
+ }
299
+
300
+ if ( isset( $response['Error']['Message'] ) ) {
301
+ throw new Exception( $response['Error']['Message'] );
302
+ }
303
+
304
+ // Get address details and save them to the order
305
+ $response = $this->api_request( array(
306
+ 'Action' => 'GetOrderReferenceDetails',
307
+ 'AmazonOrderReferenceId' => $amazon_reference_id
308
+ ) );
309
+
310
+ if ( ! is_wp_error( $response ) && isset( $response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'] ) ) {
311
+
312
+ $buyer = $response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Buyer'];
313
+ $address = $response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'];
314
+
315
+ $this->set_customer_address( $buyer, $address );
316
+ }
317
+
318
+ // Store reference ID in the order
319
+ $order->set( 'amazon_reference_id', $amazon_reference_id )->save();
320
+ $this->order_handler->set_purchase_log( $order->get( 'id' ) );
321
+
322
+ switch ( $this->payment_capture ) {
323
+ case 'manual' :
324
+
325
+ // Mark as on-hold
326
+ $order->set( 'amazon-status', __( 'Amazon order opened. Authorize and/or capture payment below. Authorized payments must be captured within 7 days.', 'wp-e-commerce' ) );
327
+
328
+ break;
329
+ case 'authorize' :
330
+
331
+ // Authorize only
332
+ $result = $this->order_handler->authorize_payment( $amazon_reference_id, false );
333
+
334
+ if ( $result ) {
335
+ // Mark as on-hold
336
+ $order->set( 'amazon-status', __( 'Amazon order opened. Authorize and/or capture payment below. Authorized payments must be captured within 7 days.', 'wp-e-commerce' ) )->save();
337
+
338
+ } else {
339
+ $order->set( 'processed', WPSC_Purchase_Log::PAYMENT_DECLINED )->save();
340
+ $order->set( 'amazon-status', __( 'Could not authorize Amazon payment.', 'wp-e-commerce' ) )->save();
341
+
342
+ $this->handle_declined_transaction( $order );
343
+ }
344
+
345
+ break;
346
+ default :
347
+
348
+ // Capture
349
+ $result = $this->order_handler->authorize_payment( $amazon_reference_id, true );
350
+
351
+ if ( $result ) {
352
+ // Payment complete
353
+ $order->set( 'amazon-status', __( 'Amazon order completed. Funds have been authorized and captured.', 'wp-e-commerce' ) );
354
+ } else {
355
+ $order->set( 'processed', WPSC_Purchase_Log::PAYMENT_DECLINED );
356
+ $order->set( 'amazon-status', __( 'Could not authorize Amazon payment.', 'wp-e-commerce' ) );
357
+
358
+ $this->handle_declined_transaction( $order );
359
+ }
360
+
361
+ break;
362
+ }
363
+
364
+ $order->save();
365
+ $this->go_to_transaction_results();
366
+
367
+ } catch( Exception $e ) {
368
+ WPSC_Message_Collection::get_instance()->add( $e->getMessage(), 'error', 'main', 'flash' );
369
+ return;
370
+ }
371
+
372
+ }
373
+
374
+ /**
375
+ * Handles declined transactions from Amazon.
376
+ *
377
+ * On the front-end, if a transaction is declined due to an invalid payment method, the user needs
378
+ * to be returned to the payment page to select a different method.
379
+ *
380
+ * If it is declined for any other reason, they're basically out of luck.
381
+ *
382
+ * @since 4.0
383
+ *
384
+ * @param WPSC_Purchase_Log $order Current purchase log for transaction.
385
+ * @return void
386
+ */
387
+ private function handle_declined_transaction( $order ) {
388
+ $reason_code = $order->get( 'amazon-reason-code' );
389
+
390
+ if ( 'InvalidPaymentMethod' == $reason_code ) {
391
+ $message = __( 'Selected payment method was not valid. Please select a valid payment method.', 'wp-e-commerce' );
392
+ $url = add_query_arg( $_GET, wpsc_get_checkout_url( 'shipping-and-billing' ) );
393
+ } else {
394
+ $message = __( 'It is not currently possible to complete this transaction with Amazon Payments. Please contact the store administrator or try again later.', 'wp-e-commerce' );
395
+ $url = wpsc_get_cart_url();
396
+ }
397
+
398
+ WPSC_Message_Collection::get_instance()->add( $message, 'error', 'main', 'flash' );
399
+ wp_safe_redirect( $url );
400
+
401
+ exit;
402
+ }
403
+
404
+ /**
405
+ * Sets customer billing and shipping information.
406
+ *
407
+ * Pulls data directly from Amazon API, populating the submitted form data table.
408
+ *
409
+ * @param array $buyer Buyer information
410
+ * @param array $address Shipping information
411
+ *
412
+ * @since 4.0
413
+ */
414
+ private function set_customer_address( $buyer, $address ) {
415
+
416
+ remove_action( 'wpsc_checkout_get_fields', '__return_empty_array' );
417
+ add_action( 'wpsc_checkout_form_active_only', '__return_false' );
418
+
419
+ $billing_name = explode( ' ' , $buyer['Name'] );
420
+ $shipping_name = explode( ' ' , $address['Name'] );
421
+
422
+ // Get first and last names
423
+ $billing_last = array_pop( $billing_name );
424
+ $shipping_last = array_pop( $shipping_name );
425
+ $billing_first = implode( ' ', $billing_name );
426
+ $shipping_first = implode( ' ', $shipping_name );
427
+
428
+ $this->checkout_data->set( 'billingfirstname', $billing_first );
429
+ $this->checkout_data->set( 'billinglastname' , $billing_last );
430
+ $this->checkout_data->set( 'billingemail' , $buyer['Email'] );
431
+
432
+ if ( isset( $buyer['Phone'] ) ) {
433
+ $this->checkout_data->set( 'billingphone', $buyer['Phone'] );
434
+ } else if ( isset( $address['Phone'] ) ) {
435
+ $this->checkout_data->set( 'billingphone', $address['Phone'] );
436
+ }
437
+
438
+ $this->checkout_data->set( 'shippingfirstname', $shipping_first );
439
+ $this->checkout_data->set( 'shippinglastname' , $shipping_last );
440
+
441
+ // Format address
442
+ $address_lines = array();
443
+
444
+ if ( ! empty( $address['AddressLine1'] ) ) {
445
+ $address_lines[] = $address['AddressLine1'];
446
+ }
447
+ if ( ! empty( $address['AddressLine2'] ) ) {
448
+ $address_lines[] = $address['AddressLine2'];
449
+ }
450
+ if ( ! empty( $address['AddressLine3'] ) ) {
451
+ $address_lines[] = $address['AddressLine3'];
452
+ }
453
+
454
+ $street_address = implode( "\n", $address_lines );
455
+
456
+ $this->checkout_data->set( 'shippingaddress', $street_address );
457
+
458
+ if ( isset( $address['City'] ) ) {
459
+ $this->checkout_data->set( 'shippingcity', $address['City'] );
460
+ }
461
+
462
+ if ( isset( $address['PostalCode'] ) ) {
463
+ $this->checkout_data->set( 'shippingpostcode', $address['PostalCode'] );
464
+ }
465
+
466
+ if ( isset( $address['StateOrRegion'] ) ) {
467
+ $this->checkout_data->set( 'shippingstate', $address['StateOrRegion'] );
468
+ }
469
+
470
+ if ( isset( $address['CountryCode'] ) ) {
471
+ $this->checkout_data->set( 'shippingcountry', $address['CountryCode'] );
472
+ }
473
+
474
+ $this->checkout_data->save();
475
+ }
476
+
477
+ /**
478
+ * Maybe hide standard checkout button on the cart, if enabled
479
+ *
480
+ * @since 4.0
481
+ */
482
+ public function maybe_hide_standard_checkout_button() {
483
+ if ( $this->setting->get( 'hide_button_display' ) ) {
484
+ ?>
485
+ <style type="text/css">
486
+ .wpsc-cart-form .wpsc-button-primary {
487
+ display: none ! important;
488
+ }
489
+ </style>
490
+ <?php
491
+ }
492
+ }
493
+
494
+ /**
495
+ * Load handlers for cart and orders after cart is loaded.
496
+ */
497
+ public function init() {
498
+
499
+ // Disable if no seller ID
500
+ if ( empty( $this->seller_id ) ) {
501
+ return;
502
+ }
503
+
504
+ add_action( 'wp_footer' , array( $this, 'maybe_hide_standard_checkout_button' ) );
505
+
506
+ add_action( 'wp_head' , array( $this, 'head_script' ), 0 );
507
+ add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
508
+
509
+ if ( $this->setting->get( 'cart_button_display' ) == 'button' ) {
510
+ add_action( 'wpsc_cart_item_table_form_actions_left' , array( $this, 'checkout_button' ), 12, 2 );
511
+ } elseif ( $this->setting->get( 'cart_button_display' ) == 'banner' ) {
512
+ add_action( 'wpsc_template_before_cart', array( $this, 'checkout_message' ), 5 );
513
+ }
514
+
515
+ add_action( 'wpsc_template_before_checkout-shipping-and-billing', array( $this, 'checkout_message' ), 5 );
516
+
517
+ if ( ! $this->user_is_authenticated ) {
518
+ return;
519
+ }
520
+
521
+ add_action( 'wpsc_router_init', array( $this, 'lazy_load_location_meta' ) );
522
+
523
+ add_filter( 'wpsc_get_checkout_form_args' , array( $this, 'add_widgets_to_method_form' ) );
524
+ add_filter( 'wpsc_get_checkout_shipping_method_form_args', array( $this, 'insert_reference_id_to_form' ) );
525
+ add_action( 'wpsc_checkout_get_fields' , '__return_empty_array' );
526
+
527
+ add_filter( 'wpsc_get_active_gateways', array( $this, 'remove_gateways' ) );
528
+ add_filter( 'wpsc_get_gateway_list' , array( $this, 'remove_gateways' ) );
529
+
530
+ add_filter( 'wpsc_payment_method_form_fields', array( $this, 'remove_gateways_v2' ), 999 );
531
+ }
532
+
533
+ public function lazy_load_location_meta() {
534
+ if ( isset( $_POST['action'] ) && 'submit_checkout_form' == $_POST['action'] ) {
535
+ remove_action( 'wpsc_checkout_get_fields', '__return_empty_array' );
536
+ $this->set_customer_details();
537
+ }
538
+ }
539
+
540
+ public function set_customer_details() {
541
+ $_POST['wpsc_checkout_details'] = array();
542
+
543
+ $_GET['amazon_reference_id'] = sanitize_text_field( $_POST['amazon_reference_id'] );
544
+
545
+ try {
546
+
547
+ if ( ! $this->reference_id ) {
548
+ throw new Exception( __( 'An Amazon payment method was not chosen.', 'wp-e-commerce' ) );
549
+ }
550
+
551
+ if ( is_null( $this->purchase_log ) ) {
552
+ $log = _wpsc_get_current_controller()->get_purchase_log();
553
+ wpsc_update_customer_meta( 'current_purchase_log_id', $log->get( 'id' ) );
554
+ $this->set_purchase_log( $log );
555
+ }
556
+
557
+ global $wpsc_cart;
558
+
559
+ // Update order reference with amounts
560
+ $response = $this->api_request( array(
561
+ 'Action' => 'SetOrderReferenceDetails',
562
+ 'AmazonOrderReferenceId' => $this->reference_id,
563
+ 'OrderReferenceAttributes.OrderTotal.Amount' => $wpsc_cart->calculate_total_price(),
564
+ 'OrderReferenceAttributes.OrderTotal.CurrencyCode' => strtoupper( $this->get_currency_code() ),
565
+ 'OrderReferenceAttributes.SellerNote' => sprintf( __( 'Order %s from %s.', 'wp-e-commerce' ), $this->purchase_log->get( 'id' ), urlencode( remove_accents( wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ) ) ),
566
+ 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId' => $this->purchase_log->get( 'id' ),
567
+ 'OrderReferenceAttributes.SellerOrderAttributes.StoreName' => remove_accents( wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ),
568
+ 'OrderReferenceAttributes.PlatformId' => 'A2Z8DY3R4G08IM'
569
+ ) );
570
+
571
+ if ( is_wp_error( $response ) ) {
572
+ throw new Exception( $response->get_error_message() );
573
+ }
574
+
575
+ if ( isset( $response['Error']['Message'] ) ) {
576
+ throw new Exception( $response['Error']['Message'] );
577
+ }
578
+
579
+ $response = $this->api_request( array(
580
+ 'Action' => 'GetOrderReferenceDetails',
581
+ 'AmazonOrderReferenceId' => $this->reference_id,
582
+ ) );
583
+
584
+ if ( is_wp_error( $response ) ) {
585
+ throw new Exception( $response->get_error_message() );
586
+ }
587
+
588
+ if ( ! isset( $response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'] ) ) {
589
+ return;
590
+ }
591
+
592
+ $address = $response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['Destination']['PhysicalDestination'];
593
+
594
+ remove_action( 'wpsc_checkout_get_fields', '__return_empty_array' );
595
+ add_filter( 'wpsc_validate_form' , '__return_true' );
596
+
597
+ $form = WPSC_Checkout_Form::get();
598
+ $fields = $form->get_fields();
599
+
600
+ foreach ( $fields as $field ) {
601
+ switch ( $field->unique_name ) {
602
+ case 'shippingstate':
603
+ $_POST['wpsc_checkout_details'][ $field->id ] = WPSC_Countries::get_region_id( $address['CountryCode'], $address['StateOrRegion'] );
604
+ break;
605
+ case 'shippingcountry':
606
+ $_POST['wpsc_checkout_details'][ $field->id ] = $address['CountryCode'];
607
+ break;
608
+ case 'shippingpostcode':
609
+ $_POST['wpsc_checkout_details'][ $field->id ] = $address['PostalCode'];
610
+ break;
611
+ case 'shippingcity':
612
+ $_POST['wpsc_checkout_details'][ $field->id ] = $address['City'];
613
+ break;
614
+ }
615
+ }
616
+ } catch( Exception $e ) {
617
+ WPSC_Message_Collection::get_instance()->add( $e->getMessage(), 'error', 'main', 'flash' );
618
+ return;
619
+ }
620
+ }
621
+
622
+ /**
623
+ * Checkout Button
624
+ */
625
+ public function checkout_button( $cart_table, $context ) {
626
+ if ( 'bottom' == $context ) {
627
+ return;
628
+ }
629
+
630
+ ?><div id="pay_with_amazon" class="checkout_button"></div><?php
631
+ }
632
+
633
+ /**
634
+ * Retrieve the IPN URL for Amazon
635
+ *
636
+ * @access public
637
+ * @since 4.0
638
+ * @return string
639
+ */
640
+ private function get_amazon_ipn_url() {
641
+ return esc_url_raw( add_query_arg( array( 'wpsc-listener' => 'amazon' ), home_url( 'index.php' ) ) );
642
+ }
643
+
644
+
645
+ public function add_widgets_to_method_form( $args ) {
646
+
647
+ ob_start();
648
+
649
+ $this->address_widget();
650
+ $this->payment_widget();
651
+
652
+ $widgets = ob_get_clean();
653
+
654
+ if ( isset( $args['before_form_actions'] ) ) {
655
+ $args['before_form_actions'] .= $widgets;
656
+ } else {
657
+ $args['before_form_actions'] = $widgets;
658
+ }
659
+
660
+ return $args;
661
+ }
662
+
663
+ public function insert_reference_id_to_form( $args ) {
664
+ ob_start();
665
+
666
+ $this->insert_reference_id();
667
+
668
+ $id = ob_get_clean();
669
+
670
+ if ( isset( $args['before_form_actions'] ) ) {
671
+ $args['before_form_actions'] .= $id;
672
+ } else {
673
+ $args['before_form_actions'] = $id;
674
+ }
675
+
676
+ return $args;
677
+
678
+ }
679
+
680
+ /**
681
+ * Checkout Message
682
+ */
683
+ public function checkout_message() {
684
+ if ( empty( $this->reference_id ) && ! $this->user_is_authenticated ) {
685
+ echo '<div class="wpsc-alert wpsc-alert-block wpsc-alert-success"><div id="pay_with_amazon"></div><p>' . apply_filters( 'wpsc_amazon_pa_checkout_message', __( 'Have an Amazon account?', 'wp-e-commerce' ) ) . '</p></div>';
686
+ }
687
+ }
688
+
689
+ public function head_script() {
690
+ ?>
691
+ <script type='text/javascript'>
692
+ window.onAmazonLoginReady = function() {
693
+ amazon.Login.setClientId(<?php echo wp_json_encode( $this->client_id ); ?>);
694
+ };
695
+ </script>
696
+ <?php
697
+ }
698
+
699
+ /**
700
+ * Add scripts
701
+ */
702
+ public function scripts() {
703
+
704
+ if ( ! wpsc_is_cart() && ! wpsc_is_checkout() ) {
705
+ return;
706
+ }
707
+
708
+ wp_enqueue_style( 'amazon_payments_advanced', WPSC_MERCHANT_V3_SDKS_URL . '/amazon-payments/assets/css/style.css' );
709
+
710
+ wp_enqueue_script( 'amazon_payments_advanced_widgets', WPSC_AMAZON_PA_WIDGETS_URL, '', WPSC_VERSION );
711
+
712
+ wp_enqueue_script( 'amazon_payments_advanced', WPSC_MERCHANT_V3_SDKS_URL . '/amazon-payments/assets/js/amazon-checkout.js', array( 'amazon_payments_advanced_widgets' ), '1.0', true );
713
+
714
+ $is_pay_page = _wpsc_get_current_controller_name() == 'checkout' || _wpsc_get_current_controller_name() == 'cart';
715
+
716
+ $redirect_page = $is_pay_page ? add_query_arg( 'amazon_payments_advanced', 'true', wpsc_get_checkout_url( 'shipping-and-billing' ) ) : esc_url_raw( add_query_arg( 'amazon_payments_advanced', 'true' ) );
717
+
718
+ wp_localize_script(
719
+ 'amazon_payments_advanced',
720
+ 'amazon_payments_advanced_params',
721
+ apply_filters( 'wpsc_amazon_payments_advanced_params', array(
722
+ 'seller_id' => $this->setting->get( 'seller_id' ),
723
+ 'reference_id' => $this->reference_id,
724
+ 'redirect' => $redirect_page,
725
+ 'pwa_type' => 'PwA',
726
+ 'pwa_color' => 'Gold',
727
+ 'pwa_size' => 'small',
728
+ ) )
729
+ );
730
+ }
731
+
732
+ /**
733
+ * Output the address widget HTML
734
+ */
735
+ public function address_widget() {
736
+ ?>
737
+ <div class="col2-set">
738
+ <div class="col-1">
739
+ <?php
740
+ if ( wpsc_uses_shipping() ) {
741
+ ?><h3><?php _e( 'Shipping Address', 'wp-e-commerce' ); ?></h3><?php
742
+ } else {
743
+ ?><h3><?php _e( 'Your Address', 'wp-e-commerce' ); ?></h3><?php
744
+ }
745
+ ?>
746
+ <div id="amazon_addressbook_widget"></div>
747
+ <?php $this->insert_reference_id(); ?>
748
+ <style type="text/css">
749
+ .wpsc-checkout-review p,
750
+ .wpsc-field-wpsc_payment_method {
751
+ display: none
752
+ }
753
+ </style>
754
+ </div>
755
+ </div>
756
+ <?php
757
+ }
758
+
759
+ public function insert_reference_id() {
760
+ if ( ! empty( $this->reference_id ) || $this->user_is_authenticated ) {
761
+ ?>
762
+ <input type="hidden" name="amazon_reference_id" value="<?php echo $this->reference_id; ?>" />
763
+ <?php
764
+ }
765
+ }
766
+
767
+ /**
768
+ * Output the payment method widget HTML
769
+ */
770
+ public function payment_widget() {
771
+ ?>
772
+ <div class="col-2">
773
+ <h3><?php _e( 'Payment Method', 'wp-e-commerce' ); ?></h3>
774
+ <div id="amazon_wallet_widget"></div>
775
+ <?php $this->insert_reference_id(); ?>
776
+ </div>
777
+ <?php
778
+ }
779
+
780
+ /**
781
+ * Remove all gateways except Amazon Payments.
782
+ *
783
+ * This function primarily effects TEv1
784
+ *
785
+ * @since 4.0
786
+ */
787
+ public function remove_gateways() {
788
+
789
+ return array( 'amazon-payments' );
790
+ }
791
+
792
+ /**
793
+ * Remove all gateways except Amazon Payments.
794
+ *
795
+ * This function effects TEv2.
796
+ *
797
+ * @since 4.0
798
+ */
799
+ public function remove_gateways_v2( $fields ) {
800
+ foreach ( $fields as $i => $field ) {
801
+ if ( 'amazon-payments' == $field['value'] ) {
802
+ $fields[ $i ][ 'checked' ] = true;
803
+ } else {
804
+ unset( $fields[ $i ] );
805
+ }
806
+ }
807
+
808
+ return $fields;
809
+ }
810
+
811
+ /**
812
+ * Make an API request to Amazon.
813
+ *
814
+ * @param args $args
815
+ * @return WP_Error or parsed response array
816
+ */
817
+ public function api_request( $args ) {
818
+
819
+ if ( ! class_exists( 'PayWithAmazon\ResponseParser' ) ) {
820
+ require_once WPSC_MERCHANT_V3_SDKS_PATH . '/amazon-payments/sdk/ResponseParser.php';
821
+ }
822
+
823
+ $defaults = array(
824
+ 'AWSAccessKeyId' => $this->mws_access_key,
825
+ 'SellerId' => $this->seller_id
826
+ );
827
+
828
+ $args = wp_parse_args( $args, $defaults );
829
+
830
+ $response = wp_safe_remote_get(
831
+ $this->get_signed_amazon_url( $this->endpoint . '?' . http_build_query( $args, '', '&' ), $this->secret_key ),
832
+ array(
833
+ 'timeout' => 12
834
+ )
835
+ );
836
+
837
+ $this->log( $args, $response );
838
+
839
+ if ( ! is_wp_error( $response ) ) {
840
+ $response_object = array();
841
+ $response_object['ResponseBody'] = $response['body'];
842
+ $response_object['Status'] = wp_remote_retrieve_response_code( $response );
843
+ $response_parser = new PayWithAmazon\ResponseParser( $response_object );
844
+ $response = $response_parser->toArray();
845
+ }
846
+
847
+ return $response;
848
+ }
849
+
850
+ /**
851
+ * If debugging is enabled on the gateway, this will log API requests/responses.
852
+ *
853
+ * @param array $args Arguments passed to API
854
+ * @param mixed $response Response from API.
855
+ *
856
+ * @return void
857
+ */
858
+ private function log( $args, $response ) {
859
+ if ( $this->setting->get( 'debugging' ) ) {
860
+
861
+ add_filter( 'wpsc_logging_post_type_args', 'WPSC_Logging::force_ui' );
862
+ add_filter( 'wpsc_logging_taxonomy_args ', 'WPSC_Logging::force_ui' );
863
+
864
+ $log_data = array(
865
+ 'post_title' => 'Amazon API Operation Failure',
866
+ 'post_content' => 'There was an error processing the payment. Find details in the log entry meta fields.' . var_export( $response, true ),
867
+ 'log_type' => 'error'
868
+ );
869
+
870
+ $log_meta = $args;
871
+
872
+ WPSC_Logging::insert_log( $log_data, $log_meta );
873
+ }
874
+ }
875
+
876
+ /**
877
+ * Sign a URL for Amazon
878
+ *
879
+ * @param string $url
880
+ * @return string
881
+ */
882
+ public function get_signed_amazon_url( $url, $secret_key ) {
883
+
884
+ $urlparts = parse_url( $url );
885
+
886
+ // Build $params with each name/value pair
887
+
888
+ $params = array();
889
+
890
+ foreach ( explode( '&', $urlparts['query'] ) as $part ) {
891
+ if ( strpos( $part, '=' ) ) {
892
+ list( $name, $value ) = explode( '=', $part, 2 );
893
+ } else {
894
+ $name = $part;
895
+ $value = '';
896
+ }
897
+ $params[ $name ] = $value;
898
+ }
899
+
900
+ // Include a timestamp if none was provided
901
+ if ( empty( $params['Timestamp'] ) ) {
902
+ $params['Timestamp'] = gmdate( 'Y-m-d\TH:i:s\Z' );
903
+ }
904
+
905
+ $params['SignatureVersion'] = '2';
906
+ $params['SignatureMethod'] = 'HmacSHA256';
907
+
908
+ // Sort the array by key
909
+ ksort( $params );
910
+
911
+ // Build the canonical query string
912
+ $canonical = '';
913
+
914
+ // Don't encode here - http_build_query already did it.
915
+ foreach ( $params as $key => $val ) {
916
+ $canonical .= $key . "=" . rawurlencode( utf8_decode( urldecode( $val ) ) ) . "&";
917
+ }
918
+
919
+ // Remove the trailing ampersand
920
+ $canonical = preg_replace( "/&$/", '', $canonical );
921
+
922
+ // Some common replacements and ones that Amazon specifically mentions
923
+ $canonical = str_replace( array( ' ', '+', ',', ';' ), array( '%20', '%20', urlencode(','), urlencode(':') ), $canonical );
924
+
925
+ // Build the sign
926
+ $string_to_sign = "GET\n{$urlparts['host']}\n{$urlparts['path']}\n$canonical";
927
+
928
+ // Calculate our actual signature and base64 encode it
929
+ $signature = base64_encode( hash_hmac( 'sha256', $string_to_sign, $secret_key, true ) );
930
+
931
+ // Finally re-build the URL with the proper string and include the Signature
932
+ $url = "{$urlparts['scheme']}://{$urlparts['host']}{$urlparts['path']}?$canonical&Signature=" . rawurlencode( $signature );
933
+
934
+ return $url;
935
+ }
936
+ }
937
+
938
+ class WPSC_Amazon_Payments_Order_Handler {
939
+
940
+ private static $instance;
941
+ private $log;
942
+ private $gateway;
943
+ private $doing_ipn = false;
944
+
945
+ public function __construct( &$gateway ) {
946
+
947
+ $this->log = $gateway->purchase_log;
948
+ $this->gateway = $gateway;
949
+
950
+ $this->init();
951
+
952
+ return $this;
953
+ }
954
+
955
+ /**
956
+ * Constructor
957
+ */
958
+ public function init() {
959
+ add_action( 'wpsc_purchlogitem_metabox_start', array( $this, 'meta_box' ), 8 );
960
+ add_action( 'wp_ajax_amazon_order_action' , array( $this, 'order_actions' ) );
961
+
962
+ }
963
+
964
+ public static function get_instance( $gateway ) {
965
+ if ( is_null( self::$instance ) ) {
966
+ self::$instance = new WPSC_Amazon_Payments_Order_Handler( $gateway );
967
+ }
968
+
969
+ return self::$instance;
970
+ }
971
+
972
+ public function set_purchase_log( $id ) {
973
+ $this->log = new WPSC_Purchase_Log( $id );
974
+ }
975
+
976
+ /**
977
+ * Perform order actions for amazon
978
+ */
979
+ public function order_actions() {
980
+ check_ajax_referer( 'amazon_order_action', 'security' );
981
+
982
+ $order_id = absint( $_POST['order_id'] );
983
+ $id = isset( $_POST['amazon_id'] ) ? sanitize_text_field( $_POST['amazon_id'] ) : '';
984
+ $action = sanitize_title( $_POST['amazon_action'] );
985
+
986
+ $this->set_purchase_log( $order_id );
987
+
988
+ switch ( $action ) {
989
+ case 'refresh' :
990
+ $this->clear_stored_states( $order_id );
991
+ break;
992
+ case 'authorize' :
993
+ // Delete old
994
+ wpsc_delete_purchase_meta( $order_id, 'amazon_authorization_id' );
995
+ wpsc_delete_purchase_meta( $order_id, 'amazon_capture_id' );
996
+
997
+ $this->authorize_payment( $id, false );
998
+ $this->clear_stored_states( $order_id );
999
+ break;
1000
+ case 'authorize_capture' :
1001
+ // Delete old
1002
+ wpsc_delete_purchase_meta( $order_id, 'amazon_authorization_id' );
1003
+ wpsc_delete_purchase_meta( $order_id, 'amazon_capture_id' );
1004
+
1005
+ $this->authorize_payment( $id, true );
1006
+ $this->clear_stored_states( $order_id );
1007
+ break;
1008
+ case 'close_authorization' :
1009
+ $this->close_authorization( $id );
1010
+ $this->clear_stored_states( $order_id );
1011
+ break;
1012
+ case 'capture' :
1013
+ $this->capture_payment( $id );
1014
+ $this->clear_stored_states( $order_id );
1015
+ break;
1016
+ case 'refund' :
1017
+ $amazon_refund_amount = floatval( sanitize_text_field( $_POST['amazon_refund_amount'] ) );
1018
+ $amazon_refund_note = sanitize_text_field( $_POST['amazon_refund_note'] );
1019
+
1020
+ $this->refund_payment( $id, $amazon_refund_amount, $amazon_refund_note );
1021
+ $this->clear_stored_states( $order_id );
1022
+ break;
1023
+ }
1024
+
1025
+ echo json_encode( array( 'action' => $action, 'order_id' => $order_id, 'amazon_id' => $id ) );
1026
+
1027
+ die();
1028
+ }
1029
+
1030
+ /**
1031
+ * Wipe states so the value is refreshed
1032
+ */
1033
+ public function clear_stored_states( $order_id ) {
1034
+ wpsc_delete_purchase_meta( $order_id, 'amazon_reference_state' );
1035
+ wpsc_delete_purchase_meta( $order_id, 'amazon_capture_state' );
1036
+ wpsc_delete_purchase_meta( $order_id, 'amazon_authorization_state' );
1037
+ }
1038
+
1039
+ /**
1040
+ * Get auth state from amazon API
1041
+ * @param string $id
1042
+ * @return string
1043
+ */
1044
+ public function get_reference_state( $id ) {
1045
+
1046
+ if ( $state = $this->log->get( 'amazon_reference_state' ) ) {
1047
+ return $state;
1048
+ }
1049
+
1050
+ $response = $this->gateway->api_request( array(
1051
+ 'Action' => 'GetOrderReferenceDetails',
1052
+ 'AmazonOrderReferenceId' => $id,
1053
+ ) );
1054
+
1055
+ if ( is_wp_error( $response ) || isset( $response['Error']['Message'] ) ) {
1056
+ return '';
1057
+ }
1058
+
1059
+ $state = $response['GetOrderReferenceDetailsResult']['OrderReferenceDetails']['OrderReferenceStatus']['State'];
1060
+
1061
+ $this->log->set( 'amazon_reference_state', $state )->save();
1062
+
1063
+ return $state;
1064
+ }
1065
+
1066
+ /**
1067
+ * Get auth state from amazon API
1068
+ *
1069
+ * @param string $id
1070
+ * @return string
1071
+ */
1072
+ public function get_authorization_state( $order_id, $id ) {
1073
+
1074
+ $state = $this->log->get( 'amazon_authorization_state' );
1075
+
1076
+ if ( $state ) {
1077
+ return $state;
1078
+ }
1079
+
1080
+ $response = $this->gateway->api_request( array(
1081
+ 'Action' => 'GetAuthorizationDetails',
1082
+ 'AmazonAuthorizationId' => $id,
1083
+ ) );
1084
+
1085
+ if ( is_wp_error( $response ) || isset( $response['Error']['Message'] ) ) {
1086
+ return '';
1087
+ }
1088
+
1089
+ $state = $response['GetAuthorizationDetailsResult']['AuthorizationDetails']['AuthorizationStatus']['State'];
1090
+
1091
+ $this->log->set( 'amazon_authorization_state', $state )->save();
1092
+
1093
+ $this->maybe_update_billing_details( $response['GetAuthorizationDetailsResult']['AuthorizationDetails'] );
1094
+
1095
+ return $state;
1096
+ }
1097
+
1098
+ /**
1099
+ * VAT registered sellers - Obtaining the Billing Address
1100
+ *
1101
+ * http://docs.developer.amazonservices.com/en_UK/apa_guide/APAGuide_GetAuthorizationStatus.html
1102
+ *
1103
+ * @param array $result
1104
+ */
1105
+ public function maybe_update_billing_details( $result ) {
1106
+
1107
+ if ( ! empty( $result['AuthorizationBillingAddress'] ) ) {
1108
+
1109
+ if ( is_a( $this->gateway->checkout_data, 'WPSC_Checkout_Form_Data' ) ) {
1110
+ $checkout_data = $this->gateway->checkout_data;
1111
+ } else {
1112
+ $checkout_data = new WPSC_Checkout_Form_Data( $this->log->get( 'id' ) );
1113
+ }
1114
+
1115
+ $address = $result['AuthorizationBillingAddress'];
1116
+
1117
+ $address_lines = array();
1118
+
1119
+ if ( ! empty( $address['AddressLine1'] ) ) {
1120
+ $address_lines[] = $address['AddressLine1'];
1121
+ }
1122
+ if ( ! empty( $address['AddressLine2'] ) ) {
1123
+ $address_lines[] = $address['AddressLine2'];
1124
+ }
1125
+ if ( ! empty( $address['AddressLine3'] ) ) {
1126
+ $address_lines[] = $address['AddressLine3'];
1127
+ }
1128
+
1129
+ $street_address = implode( "\n", $address_lines );
1130
+
1131
+ $checkout_data->set( 'billingaddress', $street_address );
1132
+
1133
+ if ( isset( $address['Name'] ) ) {
1134
+ $bits = explode( ' ', $address['Name'] );
1135
+
1136
+ $first_name = array_shift( $bits );
1137
+ $last_name = implode( ' ', $bits );
1138
+
1139
+ $checkout_data->set( 'billingfirstname', $first_name );
1140
+ $checkout_data->set( 'billinglastname' , $last_name );
1141
+ }
1142
+
1143
+ if ( isset( $address['City'] ) ) {
1144
+ $checkout_data->set( 'billingcity', $address['City'] );
1145
+ }
1146
+
1147
+ if ( isset( $address['PostalCode'] ) ) {
1148
+ $checkout_data->set( 'billingpostcode', $address['PostalCode'] );
1149
+ }
1150
+
1151
+ if ( isset( $address['StateOrRegion'] ) ) {
1152
+ $checkout_data->set( 'billingstate', $address['StateOrRegion'] );
1153
+ }
1154
+
1155
+ if ( isset( $address['CountryCode'] ) ) {
1156
+ $checkout_data->set( 'billingcountry', $address['CountryCode'] );
1157
+ }
1158
+
1159
+ $checkout_data->save();
1160
+ }
1161
+ }
1162
+
1163
+ /**
1164
+ * Get capture state from amazon API
1165
+ *
1166
+ * @param string $id
1167
+ * @return string
1168
+ */
1169
+ public function get_capture_state( $id ) {
1170
+ if ( $state = $this->log->get( 'amazon_capture_state' ) ) {
1171
+ return $state;
1172
+ }
1173
+
1174
+ $response = $this->gateway->api_request( array(
1175
+ 'Action' => 'GetCaptureDetails',
1176
+ 'AmazonCaptureId' => $id,
1177
+ ) );
1178
+
1179
+ if ( is_wp_error( $response ) || isset( $response['Error']['Message'] ) ) {
1180
+ return '';
1181
+ }
1182
+
1183
+ $state = $response['GetCaptureDetailsResult']['CaptureDetails']['CaptureStatus']['State'];
1184
+
1185
+ $this->log->set( 'amazon_capture_state', $state )->save();
1186
+
1187
+ return $state;
1188
+ }
1189
+
1190
+ /**
1191
+ * meta_box function.
1192
+ *
1193
+ * @access public
1194
+ * @return void
1195
+ */
1196
+ function meta_box( $log_id ) {
1197
+ $this->set_purchase_log( $log_id );
1198
+
1199
+ $gateway = $this->log->get( 'gateway' );
1200
+
1201
+ if ( $gateway == 'amazon-payments' ) {
1202
+ $this->authorization_box();
1203
+ }
1204
+ }
1205
+
1206
+ /**
1207
+ * pre_auth_box function.
1208
+ *
1209
+ * @access public
1210
+ * @return void
1211
+ */
1212
+ public function authorization_box() {
1213
+
1214
+ $actions = array();
1215
+ $order_id = $this->log->get( 'id' );
1216
+
1217
+ // Get ids
1218
+ $amazon_authorization_id = $this->log->get( 'amazon_authorization_id' );
1219
+ $amazon_reference_id = $this->log->get( 'amazon_reference_id' );
1220
+ $amazon_capture_id = $this->log->get( 'amazon_capture_id' );
1221
+ $amazon_refund_ids = wpsc_get_purchase_meta( $order_id, 'amazon_refund_id' );
1222
+
1223
+ ?>
1224
+
1225
+ <div class="metabox-holder">
1226
+ <div id="wpsc-amazon-payments" class="postbox">
1227
+ <h3 class='hndle'><?php _e( 'Amazon Payments' , 'wp-e-commerce' ); ?></h3>
1228
+ <div class='inside'>
1229
+ <p><?php
1230
+ _e( 'Current status: ', 'wp-e-commerce' );
1231
+ echo wp_kses_data( $this->log->get( 'amazon-status' ) );
1232
+ ?>
1233
+ </p>
1234
+ <?php
1235
+
1236
+ if ( $amazon_capture_id ) {
1237
+
1238
+ $amazon_capture_state = $this->get_capture_state( $amazon_capture_id );
1239
+
1240
+ switch ( $amazon_capture_state ) {
1241
+ case 'Pending' :
1242
+
1243
+ echo wpautop( sprintf( __( 'Capture Reference %s is <strong>%s</strong>.', 'wp-e-commerce' ), $amazon_capture_id, $amazon_capture_state ) . ' <a href="#" data-action="refresh" class="refresh">' . __( 'Refresh', 'wp-e-commerce' ) . '</a>' );
1244
+
1245
+ // Admin will need to re-check this, so clear the stored value
1246
+ $this->clear_stored_states( $order_id );
1247
+ break;
1248
+ case 'Declined' :
1249
+
1250
+ echo wpautop( __( 'The capture was declined.', 'wp-e-commerce' ) );
1251
+
1252
+ $actions['authorize'] = array(
1253
+ 'id' => $amazon_reference_id,
1254
+ 'button' => __( 'Re-authorize?', 'wp-e-commerce' )
1255
+ );
1256
+
1257
+ break;
1258
+ case 'Completed' :
1259
+
1260
+ echo wpautop( sprintf( __( 'Capture Reference %s is <strong>%s</strong>.', 'wp-e-commerce' ), $amazon_capture_id, $amazon_capture_state ) . ' <a href="#" class="toggle_refund">' . __( 'Make a refund?', 'wp-e-commerce' ) . '</a>' );
1261
+
1262
+ // Refund form
1263
+ ?>
1264
+ <p class="refund_form" style="display:none">
1265
+ <input type="number" step="any" style="width:100%" class="amazon_refund_amount" value="<?php echo $this->log->get( 'totalprice' ); ?>" />
1266
+ <input type="text" style="width:100%" class="amazon_refund_note" placeholder="<?php _e( 'Add a note about this refund', 'wp-e-commerce' ); ?>" /><br/>
1267
+ <a href="#" class="button" data-action="refund" data-id="<?php echo esc_attr( $amazon_capture_id ); ?>"><?php _e( 'Refund', 'wp-e-commerce' ); ?></a>
1268
+ </form>
1269
+ <?php
1270
+
1271
+ break;
1272
+ case 'Closed' :
1273
+
1274
+ echo wpautop( sprintf( __( 'Capture Reference %s is <strong>%s</strong>.', 'wp-e-commerce' ), $amazon_capture_id, $amazon_capture_state ) );
1275
+
1276
+ break;
1277
+ }
1278
+
1279
+ // Display refunds
1280
+ if ( $amazon_refund_ids ) {
1281
+
1282
+ $refunds = (array) $this->log->get( 'amazon_refunds' );
1283
+
1284
+ foreach ( $amazon_refund_ids as $amazon_refund_id ) {
1285
+
1286
+ if ( isset( $refunds[ $amazon_refund_id ] ) ) {
1287
+
1288
+ if ( empty( $refunds[ $amazon_refund_id ]['note'] ) ) {
1289
+ $refunds[ $amazon_refund_id ]['note'] = _x( 'no note was entered', 'Amazon refund default note', 'wp-e-commerce' );
1290
+ }
1291
+
1292
+ echo wpautop(
1293
+ sprintf( __( 'Refund %s of %s is <strong>%s</strong> (%s).', 'wp-e-commerce' ),
1294
+ $amazon_refund_id,
1295
+ wpsc_currency_display( $refunds[ $amazon_refund_id ]['amount'] ),
1296
+ $refunds[ $amazon_refund_id ]['state'],
1297
+ $refunds[ $amazon_refund_id ]['note']
1298
+ )
1299
+ );
1300
+ } else {
1301
+
1302
+ $response = $this->gateway->api_request( array(
1303
+ 'Action' => 'GetRefundDetails',
1304
+ 'AmazonRefundId' => $amazon_refund_id,
1305
+ ) );
1306
+
1307
+ if ( ! is_wp_error( $response ) && ! isset( $response['Error']['Message'] ) ) {
1308
+
1309
+ $note = $response['GetRefundDetailsResult']['RefundDetails']['SellerRefundNote'];
1310
+ $state = $response['GetRefundDetailsResult']['RefundDetails']['RefundStatus']['State'];
1311
+ $amount = $response['GetRefundDetailsResult']['RefundDetails']['RefundAmount']['Amount'];
1312
+
1313
+ echo wpautop(
1314
+ sprintf( __( 'Refund %s of %s is <strong>%s</strong> (%s).', 'wp-e-commerce' ),
1315
+ $amazon_refund_id,
1316
+ wpsc_currency_display( $amount ),
1317
+ $state,
1318
+ $note
1319
+ )
1320
+ );
1321
+
1322
+ if ( $state == 'Completed' ) {
1323
+ $refunds[ $amazon_refund_id ] = array(
1324
+ 'state' => $state,
1325
+ 'amount' => $amount,
1326
+ 'note' => $note
1327
+ );
1328
+ }
1329
+ }
1330
+ }
1331
+ }
1332
+
1333
+ $this->log->set( 'amazon_refunds', $refunds )->save();
1334
+ }
1335
+ }
1336
+
1337
+ elseif ( $amazon_authorization_id ) {
1338
+
1339
+ $amazon_authorization_state = $this->get_authorization_state( $order_id, $amazon_authorization_id );
1340
+
1341
+ echo wpautop( sprintf( __( 'Auth Reference %s is <strong>%s</strong>.', 'wp-e-commerce' ), $amazon_reference_id, $amazon_authorization_state ) . ' <a href="#" data-action="refresh" class="refresh">' . __( 'Refresh', 'wp-e-commerce' ) . '</a>' );
1342
+
1343
+ switch ( $amazon_authorization_state ) {
1344
+ case 'Open' :
1345
+
1346
+ $actions['capture'] = array(
1347
+ 'id' => $amazon_authorization_id,
1348
+ 'button' => __( 'Capture funds', 'wp-e-commerce' )
1349
+ );
1350
+
1351
+ $actions['close_authorization'] = array(
1352
+ 'id' => $amazon_authorization_id,
1353
+ 'button' => __( 'Close Authorization', 'wp-e-commerce' )
1354
+ );
1355
+
1356
+ break;
1357
+ case 'Pending' :
1358
+
1359
+ echo wpautop( __( 'You cannot capture funds while the authorization is pending. Try again later.', 'wp-e-commerce' ) );
1360
+
1361
+ // Admin will need to re-check this, so clear the stored value
1362
+ $this->clear_stored_states( $order_id );
1363
+
1364
+ break;
1365
+ case 'Closed' :
1366
+ case 'Declined' :
1367
+ $actions['authorize'] = array(
1368
+ 'id' => $amazon_reference_id,
1369
+ 'button' => __( 'Authorize again', 'wp-e-commerce' )
1370
+ );
1371
+ break;
1372
+ }
1373
+ }
1374
+
1375
+ elseif ( $amazon_reference_id ) {
1376
+
1377
+ $amazon_reference_state = $this->get_reference_state( $amazon_reference_id );
1378
+
1379
+ echo wpautop( sprintf( __( 'Order Reference %s is <strong>%s</strong>.', 'wp-e-commerce' ), $amazon_reference_id, $amazon_reference_state ) . ' <a href="#" data-action="refresh" class="refresh">' . __( 'Refresh', 'wp-e-commerce' ) . '</a>' );
1380
+
1381
+ switch ( $amazon_reference_state ) {
1382
+ case 'Open' :
1383
+
1384
+ $actions['authorize'] = array(
1385
+ 'id' => $amazon_reference_id,
1386
+ 'button' => __( 'Authorize', 'wp-e-commerce' )
1387
+ );
1388
+
1389
+ $actions['authorize_capture'] = array(
1390
+ 'id' => $amazon_reference_id,
1391
+ 'button' => __( 'Authorize &amp; Capture', 'wp-e-commerce' )
1392
+ );
1393
+
1394
+ break;
1395
+ case 'Suspended' :
1396
+
1397
+ echo wpautop( __( 'The reference has been suspended. Another form of payment is required.', 'wp-e-commerce' ) );
1398
+
1399
+ break;
1400
+ case 'Canceled' :
1401
+ case 'Suspended' :
1402
+
1403
+ echo wpautop( __( 'The reference has been cancelled/closed. No authorizations can be made.', 'wp-e-commerce' ) );
1404
+
1405
+ break;
1406
+ }
1407
+ }
1408
+
1409
+ if ( ! empty( $actions ) ) {
1410
+
1411
+ echo '<p class="buttons">';
1412
+
1413
+ foreach ( $actions as $action_name => $action ) {
1414
+ echo '<a href="#" class="button" data-action="' . $action_name . '" data-id="' . $action['id'] . '">' . $action['button'] . '</a> ';
1415
+ }
1416
+
1417
+ echo '</p>';
1418
+
1419
+ }
1420
+ ?>
1421
+ <script type="text/javascript">
1422
+ jQuery( document ).ready( function( $ ) {
1423
+ $('#wpsc-amazon-payments').on( 'click', 'a.button, a.refresh', function( e ) {
1424
+ var $this = $( this );
1425
+ e.preventDefault();
1426
+
1427
+ var data = {
1428
+ action: 'amazon_order_action',
1429
+ security: '<?php echo wp_create_nonce( "amazon_order_action" ); ?>',
1430
+ order_id: '<?php echo $order_id; ?>',
1431
+ amazon_action: $this.data('action'),
1432
+ amazon_id: $this.data('id'),
1433
+ amazon_refund_amount: jQuery('.amazon_refund_amount').val(),
1434
+ amazon_refund_note: jQuery('.amazon_refund_note').val(),
1435
+ };
1436
+
1437
+ // Ajax action
1438
+ $.post( ajaxurl, data, function( result ) {
1439
+ location.reload();
1440
+ }, 'json' );
1441
+
1442
+ return false;
1443
+ });
1444
+
1445
+ $('#wpsc-amazon-payments').on( 'click', 'a.toggle_refund', function(){
1446
+ jQuery('.refund_form').slideToggle();
1447
+ return false;
1448
+ });
1449
+ } );
1450
+
1451
+
1452
+ </script>
1453
+ </div>
1454
+ </div>
1455
+ </div>
1456
+ <?php
1457
+ }
1458
+
1459
+ /**
1460
+ * Authorize payment
1461
+ */
1462
+ public function authorize_payment( $amazon_reference_id, $capture_now = false ) {
1463
+
1464
+ if ( $this->log->get( 'gateway' ) == 'amazon-payments' ) {
1465
+
1466
+ $response = $this->gateway->api_request( array(
1467
+ 'Action' => 'Authorize',
1468
+ 'AmazonOrderReferenceId' => $amazon_reference_id,
1469
+ 'AuthorizationReferenceId' => $this->log->get( 'id' ) . '-' . current_time( 'timestamp', true ),
1470
+ 'AuthorizationAmount.Amount' => $this->log->get( 'totalprice' ),
1471
+ 'AuthorizationAmount.CurrencyCode' => strtoupper( $this->gateway->get_currency_code() ),
1472
+ 'CaptureNow' => $capture_now,
1473
+ 'TransactionTimeout' => 0
1474
+ )
1475
+ );
1476
+
1477
+ if ( is_wp_error( $response ) ) {
1478
+
1479
+ $this->log->set( 'amazon-status', __( 'Unable to authorize funds with amazon:', 'wp-e-commerce' ) . ' ' . $response->get_error_message() )->save();
1480
+
1481
+ return false;
1482
+
1483
+ } elseif ( isset( $response['Error']['Message'] ) ) {
1484
+
1485
+ $this->log->set( 'amazon-status', $response['Error']['Message'] )->save();
1486
+ return false;
1487
+
1488
+ } else {
1489
+
1490
+ if ( isset( $response['AuthorizeResult']['AuthorizationDetails']['AmazonAuthorizationId'] ) ) {
1491
+ $auth_id = $response['AuthorizeResult']['AuthorizationDetails']['AmazonAuthorizationId'];
1492
+ } else {
1493
+ return false;
1494
+ }
1495
+
1496
+ if ( isset( $response['AuthorizeResult']['AuthorizationDetails']['AuthorizationStatus']['State'] ) ) {
1497
+ $state = strtolower( $response['AuthorizeResult']['AuthorizationDetails']['AuthorizationStatus']['State'] );
1498
+ } else {
1499
+ $state = 'pending';
1500
+ }
1501
+
1502
+ $this->log->set( 'amazon_authorization_id', $auth_id )->save();
1503
+
1504
+ $this->maybe_update_billing_details( $response['AuthorizeResult']['AuthorizationDetails'] );
1505
+
1506
+ if ( 'declined' == $state ) {
1507
+ $this->log->set( 'amazon-status', sprintf( __( 'Order Declined with reason code: %s', 'wp-e-commerce' ), $response['AuthorizeResult']['AuthorizationDetails']['AuthorizationStatus']['ReasonCode'] ) )->save();
1508
+ $this->log->set( 'amazon-reason-code', $response['AuthorizeResult']['AuthorizationDetails']['AuthorizationStatus']['ReasonCode'] )->save();
1509
+ // Payment was not authorized
1510
+ return false;
1511
+ }
1512
+
1513
+ if ( $capture_now ) {
1514
+ $this->log->set( 'amazon_capture_id', str_replace( '-A', '-C', $auth_id ) )->save();
1515
+ $this->log->set( 'amazon-status', sprintf( __( 'Captured (Auth ID: %s)', 'wp-e-commerce' ), str_replace( '-A', '-C', $auth_id ) ) )->save();
1516
+ $this->log->set( 'processed', WPSC_Purchase_Log::ACCEPTED_PAYMENT )->save();
1517
+ } else {
1518
+ $this->log->set( 'amazon-status', sprintf( __( 'Authorized (Auth ID: %s)', 'wp-e-commerce' ), $auth_id ) )->save();
1519
+ }
1520
+
1521
+ return true;
1522
+ }
1523
+ }
1524
+
1525
+ return false;
1526
+ }
1527
+
1528
+ /**
1529
+ * Close auth
1530
+ *
1531
+ * @param string $amazon_authorization_id
1532
+ */
1533
+ public function close_authorization( $amazon_authorization_id ) {
1534
+
1535
+ if ( $this->log->get( 'gateway' ) == 'amazon-payments' ) {
1536
+
1537
+ $response = $this->gateway->api_request( array(
1538
+ 'Action' => 'CloseAuthorization',
1539
+ 'AmazonAuthorizationId' => $amazon_authorization_id
1540
+ ) );
1541
+
1542
+ if ( is_wp_error( $response ) ) {
1543
+ return;
1544
+ }
1545
+
1546
+ if ( isset( $response['Error']['Message'] ) ) {
1547
+
1548
+ $this->log->set( 'amazon-status', $response['Error']['Message'] )->save();
1549
+
1550
+ } else {
1551
+ wpsc_delete_purchase_meta( $this->log->get( 'id' ), 'amazon_authorization_id' );
1552
+ $this->log->set( 'amazon-status', sprintf( __( 'Authorization closed (Auth ID: %s)', 'wp-e-commerce' ), $amazon_authorization_id ) )->save();
1553
+ $this->log->set( 'processed', WPSC_Purchase_Log::CLOSED_ORDER )->save();
1554
+
1555
+ }
1556
+ }
1557
+ }
1558
+
1559
+ /**
1560
+ * Process IPN messages from Amazon
1561
+ *
1562
+ * @access public
1563
+ * @since 4.0
1564
+ * @return void
1565
+ */
1566
+ public function process_ipn() {
1567
+
1568
+ if ( ! isset( $_GET['wpsc-listener'] ) || $_GET['wpsc-listener'] !== 'amazon' ) {
1569
+ return;
1570
+ }
1571
+
1572
+ if ( isset( $_GET['state'] ) ) {
1573
+ return;
1574
+ }
1575
+
1576
+ // Get the IPN headers and Message body
1577
+ $headers = getallheaders();
1578
+ $body = file_get_contents( 'php://input' );
1579
+
1580
+ $this->doing_ipn = true;
1581
+
1582
+ if ( ! class_exists( 'PayWithAmazon\IpnHandler' ) ) {
1583
+ require_once WPSC_MERCHANT_V3_SDKS_PATH . '/amazon-payments/sdk/IpnHandler.php';
1584
+ }
1585
+
1586
+ try {
1587
+ $ipn = new PayWithAmazon\IpnHandler( $headers, $body );
1588
+ $data = $ipn->toArray();
1589
+ $seller_id = $data['SellerId'];
1590
+
1591
+ if ( $seller_id != $this->gateway->seller_id ) {
1592
+ wp_die( __( 'Invalid Amazon seller ID', 'wp-e-commerce' ), __( 'IPN Error', 'wp-e-commerce' ), array( 'response' => 401 ) );
1593
+ }
1594
+
1595
+ switch( $data['NotificationType'] ) {
1596
+ case 'OrderReferenceNotification' :
1597
+ break;
1598
+ case 'PaymentAuthorize' :
1599
+ break;
1600
+ case 'PaymentCapture' :
1601
+
1602
+ $status = $data['CaptureDetails']['CaptureStatus']['State'];
1603
+
1604
+ if ( 'Declined' === $status ) {
1605
+
1606
+ $value = $data['CaptureDetails']['CaptureReferenceId'];
1607
+ $reason = $data['CaptureDetails']['CaptureStatus']['ReasonCode'];
1608
+
1609
+ // Get Order ID by reference
1610
+ $order = WPSC_Purchase_Log::get_log_by_meta( 'amazon_capture_id', $value );
1611
+
1612
+ if ( ! $order ) {
1613
+ break;
1614
+ }
1615
+
1616
+ // Update status to declined
1617
+ $order->set( 'processed', WPSC_Purchase_Log::PAYMENT_DECLINED )->save();
1618
+
1619
+ // Update Amazon note
1620
+ $order->set( 'amazon-status', __( 'Could not authorize Amazon payment.', 'wp-e-commerce' ) )->save();
1621
+
1622
+ // Email user
1623
+ $hard = 'InvalidPaymentMethod' == $reason;
1624
+
1625
+ $this->send_decline_email( $hard, $order );
1626
+ }
1627
+
1628
+ break;
1629
+ case 'PaymentRefund' :
1630
+ $refund_id = $data['RefundDetails']['AmazonRefundId'];
1631
+ $status = $data['RefundDetails']['RefundStatus']['State'];
1632
+ $amount = $data['RefundDetails']['RefundAmount'];
1633
+
1634
+ if ( 'Completed' === $status ) {
1635
+ // get payment ID based on refund ID
1636
+ $order = WPSC_Purchase_Log::get_log_by_meta( 'amazon_refund_id', $refund_id );
1637
+
1638
+ // Update status to refunded
1639
+ $order->set( 'processed', WPSC_Purchase_Log::REFUNDED )->save();
1640
+
1641
+ // Add payment note for refund.
1642
+ $order->set( 'amazon-status', sprintf( __( 'Refunded %s', 'wp-e-commerce' ), wpsc_currency_display( $amount ) ) )->save();
1643
+
1644
+ // Update refund ID
1645
+ wpsc_add_purchase_meta( $order->get( 'id' ), 'amazon_refund_id', $refund_id );
1646
+ }
1647
+
1648
+ break;
1649
+ }
1650
+ } catch( Exception $e ) {
1651
+ wp_die( $e->getErrorMessage(), __( 'IPN Error', 'wp-e-commerce' ), array( 'response' => 401 ) );
1652
+ }
1653
+ }
1654
+
1655
+ /**
1656
+ * Send decline email, based on overridable templates in library.
1657
+ *
1658
+ * Templates are named by language and type.
1659
+ *
1660
+ * @since 4.0
1661
+ *
1662
+ * @param boolean $hard Whether it was a hard decline (invalid payment) or soft (systems).
1663
+ * @return boolean $mail Whether or not email was sent.
1664
+ */
1665
+ protected function send_decline_email( $hard = false, $order ) {
1666
+
1667
+ $template = $this->get_declined_email_template( $hard );
1668
+
1669
+ if ( empty( $template ) || ! file_exists( $template['template_part'] ) ) {
1670
+ return false;
1671
+ }
1672
+
1673
+ $base_country = wpsc_get_base_country();
1674
+
1675
+ if ( 'GB' == $base_country ) {
1676
+ $url = 'https://payments.amazon.co.uk/overview';
1677
+ } elseif ( 'DE' == $base_country ) {
1678
+ $url = 'https://payments.amazon.de/overview';
1679
+ } else {
1680
+ $url = 'https://payments.amazon.com/overview';
1681
+ }
1682
+
1683
+ $url = apply_filters( 'wpsc_amazon_declined_email_payment_url', $url, $hard, $base_country );
1684
+
1685
+ ob_start();
1686
+
1687
+ include_once $template['template_part'];
1688
+
1689
+ $message = ob_get_clean();
1690
+ $subject = $template['subject'];
1691
+
1692
+ $content_type = function () { return 'text/html'; };
1693
+
1694
+ add_filter( 'wp_mail_content_type', $content_type );
1695
+
1696
+ $sent = wp_mail( $order->get( 'billingemail' ), $subject, $message );
1697
+
1698
+ remove_filter( 'wp_mail_content_type', $content_type );
1699
+
1700
+ return $sent;
1701
+ }
1702
+
1703
+ /**
1704
+ * Retrieves the email template path (and subject) for declined email notifications.
1705
+ *
1706
+ * @since 4.0
1707
+ * @param boolean $hard Whether or not decline is "hard". Hard declined methods may not be retried.
1708
+ *
1709
+ * @return array<string> Array of template part path and subject line.
1710
+ */
1711
+ protected function get_declined_email_template( $hard = false ) {
1712
+ $language = substr( get_locale(), 0, 2 );
1713
+ $decline = $hard ? 'hard' : 'soft';
1714
+ $whitelist = apply_filters( 'wpsc_amazon_decline_email_locales', array(
1715
+ 'en' => array(
1716
+ 'hard' => __( 'Please contact us about your order' , 'wp-e-commerce' ),
1717
+ 'soft' => __( 'Please update your payment information', 'wp-e-commerce' )
1718
+ ),
1719
+ 'de' => array(
1720
+ 'hard' => __( 'Bitte kontaktieren Sie uns wegen Ihrer Bestellung', 'wp-e-commerce' ),
1721
+ 'soft' => __( 'Bitte aktualisieren Sie Ihre Zahlungsinformationen', 'wp-e-commerce' )
1722
+ ),
1723
+ 'it' => array(
1724
+ 'hard' => __( 'La preghiamo di contattarci per informazioni riguardo al suo ordine', 'wp-e-commerce' ),
1725
+ 'soft' => __( 'Aggiorna i tuoi dati di pagamento', 'wp-e-commerce' )
1726
+ ),
1727
+ 'fr' => array(
1728
+ 'hard' => __( 'Veuillez nous contacter pour votre commande', 'wp-e-commerce' ),
1729
+ 'soft' => __( 'Veuillez mettre à jour vos informations de paiement', 'wp-e-commerce' )
1730
+ ),
1731
+ 'es' => array(
1732
+ 'hard' => __( 'Por favor, contáctanos en referencia a tu pedido', 'wp-e-commerce' ),
1733
+ 'soft' => __( 'Por favor, actualiza tu información de pago.', 'wp-e-commerce' )
1734
+ ),
1735
+ ) );
1736
+
1737
+ if ( ! in_array( $language, array_keys( $whitelist ) ) ) {
1738
+ $language = 'en';
1739
+ }
1740
+
1741
+ $template_part = apply_filters( 'wpsc_amazon_declined_email_template_part', "emails/{$decline}-decline-email-{$language}.php", $decline, $language );
1742
+
1743
+ if ( file_exists( WPSC_MERCHANT_V3_SDKS_PATH . '/amazon-payments/' . $template_part ) ) {
1744
+ $template = WPSC_MERCHANT_V3_SDKS_PATH . '/amazon-payments/' . $template_part;
1745
+ } else {
1746
+ $template = wpsc_locate_template_part( $template_part );
1747
+ }
1748
+
1749
+ if ( ! empty( $template ) ) {
1750
+ return array();
1751
+ }
1752
+
1753
+ $template = apply_filters( 'wpsc_amazon_declined_email_template_path', $template, $decline, $language );
1754
+ $subject = apply_filters( 'wpsc_amazon_declined_email_subject' , $whitelist[ $language ][ $decline ], $decline, $language );
1755
+
1756
+ return array( 'template_part' => $template, 'subject' => $subject );
1757
+ }
1758
+
1759
+ /**
1760
+ * Capture payment
1761
+ *
1762
+ * @param string $amazon_authorization_id
1763
+ */
1764
+ public function capture_payment( $amazon_authorization_id ) {
1765
+
1766
+ if ( $this->log->get( 'gateway' ) == 'amazon-payments' ) {
1767
+
1768
+ $response = $this->gateway->api_request( array(
1769
+ 'Action' => 'Capture',
1770
+ 'AmazonAuthorizationId' => $amazon_authorization_id,
1771
+ 'CaptureReferenceId' => $this->log->get( 'id' ) . '-' . current_time( 'timestamp', true ),
1772
+ 'CaptureAmount.Amount' => $this->log->get( 'totalprice' ),
1773
+ 'CaptureAmount.CurrencyCode' => strtoupper( $this->gateway->get_currency_code() )
1774
+ ) );
1775
+
1776
+ if ( is_wp_error( $response ) ) {
1777
+
1778
+ $this->log->set( 'amazon-status', __( 'Unable to authorize funds with amazon:', 'wp-e-commerce' ) . ' ' . $response->get_error_message() )->save();
1779
+
1780
+ } elseif ( isset( $response['Error']['Message'] ) ) {
1781
+
1782
+ $this->log->set( 'amazon-status', $response['Error']['Message'] )->save();
1783
+
1784
+ } else {
1785
+ $capture_id = $response['CaptureResult']['CaptureDetails']['AmazonCaptureId'];
1786
+
1787
+ $this->log->set( 'amazon-status', sprintf( __( 'Capture Attempted (Capture ID: %s)', 'wp-e-commerce' ), $capture_id ) )->save();
1788
+ $this->log->set( 'amazon_capture_id', $capture_id )->save();
1789
+ $this->log->set( 'processed', WPSC_Purchase_Log::ACCEPTED_PAYMENT )->save();
1790
+ }
1791
+ }
1792
+ }
1793
+
1794
+ /**
1795
+ * Refund a payment
1796
+ *
1797
+ * @param string $capture_id
1798
+ * @param float $amount
1799
+ * @param string $note
1800
+ */
1801
+ public function refund_payment( $capture_id, $amount, $note ) {
1802
+ if ( $this->log->get( 'gateway' ) == 'amazon-payments' ) {
1803
+
1804
+ if ( $this->doing_ipn ) {
1805
+ return;
1806
+ }
1807
+
1808
+ $base_country = new WPSC_Country( wpsc_get_base_country() );
1809
+
1810
+ if ( 'US' == $base_country->get_isocode() && $amount > $this->log->get( 'totalprice' ) ) {
1811
+ $this->log->set( 'amazon-status', __( 'Unable to refund funds via amazon:', 'wp-e-commerce' ) . ' ' . __( 'Refund amount is greater than order total.', 'wp-e-commerce' ) )->save();
1812
+
1813
+ return;
1814
+ } elseif ( $amount > min( ( $this->log->get( 'totalprice' ) * 1.15 ), ( $this->log->get( 'totalprice' ) + 75 ) ) ) {
1815
+ $this->log->set( 'amazon-status', __( 'Unable to refund funds via amazon:', 'wp-e-commerce' ) . ' ' . __( 'Refund amount is greater than the max refund amount.', 'wp-e-commerce' ) )->save();
1816
+
1817
+ return;
1818
+ }
1819
+
1820
+ $response = $this->gateway->api_request( array(
1821
+ 'Action' => 'Refund',
1822
+ 'AmazonCaptureId' => $capture_id,
1823
+ 'RefundReferenceId' => $this->log->get( 'id' ) . '-' . current_time( 'timestamp', true ),
1824
+ 'RefundAmount.Amount' => $amount,
1825
+ 'RefundAmount.CurrencyCode' => strtoupper( $this->gateway->get_currency_code() ),
1826
+ 'SellerRefundNote' => $note
1827
+ ) );
1828
+
1829
+ if ( is_wp_error( $response ) ) {
1830
+
1831
+ $this->log->set( 'amazon-status', __( 'Unable to refund funds via amazon:', 'wp-e-commerce' ) . ' ' . $response->get_error_message() )->save();
1832
+
1833
+ } elseif ( isset( $response['Error']['Message'] ) ) {
1834
+
1835
+ $this->log->set( 'amazon-status', $response['Error']['Message'] )->save();
1836
+
1837
+ } else {
1838
+ $refund_id = $response['RefundResult']['RefundDetails']['AmazonRefundId'];
1839
+
1840
+ $this->log->set( 'amazon-status', sprintf( __( 'Refunded %s (%s)', 'wp-e-commerce' ), wpsc_currency_display( $amount ), $note ) )->save();
1841
+ $this->log->set( 'processed', WPSC_Purchase_Log::REFUNDED )->save();
1842
+ wpsc_add_purchase_meta( $this->log->get( 'id' ), 'amazon_refund_id', $refund_id );
1843
+ }
1844
+ }
1845
+ }
1846
+ }
wpsc-components/merchant-core-v3/gateways/dg.css CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/manual.php CHANGED
@@ -9,7 +9,7 @@ class WPSC_Payment_Gateway_Manual extends WPSC_Payment_Gateway {
9
  */
10
  public function __construct() {
11
  parent::__construct();
12
- $this->title = __( 'Manual Payment Gateway 3.0', 'wpsc' );
13
  }
14
 
15
  /**
@@ -29,10 +29,10 @@ class WPSC_Payment_Gateway_Manual extends WPSC_Payment_Gateway {
29
  <tr>
30
  <td colspan="2">
31
  <p>
32
- <label for="wpsc-manual-gateway-setup"><?php _e( 'Instructions', 'wpsc' ); ?></label><br />
33
  <textarea id="wpsc-manual-gateway-setup" cols='' rows='10' name='<?php echo esc_attr( $this->setting->get_field_name( 'payment_instructions' ) ); ?>'><?php echo esc_textarea( wp_unslash( $this->setting->get( 'payment_instructions' ) ) ); ?></textarea><br />
34
- <small><?php _e('Enter the payment instructions that you wish to display to your customers when they make a purchase.', 'wpsc'); ?></small><br />
35
- <small><?php _e('For example, this is where you the Shop Owner might enter your bank account details or address so that your customer can make their manual payment.', 'wpsc'); ?></small>
36
  </p>
37
  </td>
38
  </tr>
9
  */
10
  public function __construct() {
11
  parent::__construct();
12
+ $this->title = __( 'Manual Payment Gateway 3.0', 'wp-e-commerce' );
13
  }
14
 
15
  /**
29
  <tr>
30
  <td colspan="2">
31
  <p>
32
+ <label for="wpsc-manual-gateway-setup"><?php _e( 'Instructions', 'wp-e-commerce' ); ?></label><br />
33
  <textarea id="wpsc-manual-gateway-setup" cols='' rows='10' name='<?php echo esc_attr( $this->setting->get_field_name( 'payment_instructions' ) ); ?>'><?php echo esc_textarea( wp_unslash( $this->setting->get( 'payment_instructions' ) ) ); ?></textarea><br />
34
+ <small><?php _e('Enter the payment instructions that you wish to display to your customers when they make a purchase.', 'wp-e-commerce'); ?></small><br />
35
+ <small><?php _e('For example, this is where you the Shop Owner might enter your bank account details or address so that your customer can make their manual payment.', 'wp-e-commerce'); ?></small>
36
  </p>
37
  </td>
38
  </tr>
wpsc-components/merchant-core-v3/gateways/paypal-digital-goods.php CHANGED
@@ -23,7 +23,7 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
23
  parent::__construct( $options, true );
24
 
25
  $this->gateway = new PHP_Merchant_Paypal_Digital_Goods( $options );
26
- $this->title = __( 'PayPal Digital Goods for Express Checkout', 'wpsc' );
27
 
28
  $this->gateway->set_options( array(
29
  'api_username' => $this->setting->get( 'api_username' ),
@@ -90,7 +90,7 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
90
 
91
  if ( _wpsc_get_current_controller_name() === 'cart' ) {
92
  $url = $this->get_shortcut_url();
93
- echo '<a id="pp-ecs-dg" href="'. esc_url ( $url ) .'"><img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="' . __( 'Check out with PayPal', 'wpsc' ) . '" /></a>';
94
  }
95
  }
96
 
@@ -153,7 +153,7 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
153
  public static function dg_script() {
154
  $dg_loc = array(
155
  'spinner_url' => wpsc_get_ajax_spinner(),
156
- 'loading' => __( 'Loading...', 'wpsc' ),
157
  );
158
  // Checkout Page
159
  if ( wpsc_is_checkout() ) {
@@ -235,14 +235,14 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
235
  ?>
236
  <html>
237
  <head>
238
- <title><?php _e( 'Processing...', 'wpsc' ); ?></title>
239
  <?php wp_print_styles( 'ppdg-iframe' ); ?>
240
  </head>
241
  <body>
242
  <div id="left_frame">
243
  <div id="right_frame">
244
  <p id="message">
245
- <?php _e( 'Processing Order', 'wpsc'); ?>
246
 
247
  </p>
248
  <img src="https://www.paypal.com/en_US/i/icon/icon_animated_prog_42wx42h.gif" alt="Processing..." />
@@ -324,14 +324,14 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
324
  ?>
325
  <html>
326
  <head>
327
- <title><?php _e( 'Processing...', 'wpsc' ); ?></title>
328
  <?php wp_print_styles( 'ppdg-iframe' ); ?>
329
  </head>
330
  <body>
331
  <div id="left_frame">
332
  <div id="right_frame">
333
  <p id="message">
334
- <?php _e( 'Cancelling Order', 'wpsc' ); ?>
335
  </p>
336
  <img src="https://www.paypal.com/en_US/i/icon/icon_animated_prog_42wx42h.gif" alt="Processing..." />
337
  <div id="right_bottom">
@@ -512,14 +512,14 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
512
  ?>
513
  <html>
514
  <head>
515
- <title><?php __( 'Processing...', 'wpsc' ); ?></title>
516
  <?php wp_print_styles( 'ppdg-iframe' ); ?>
517
  </head>
518
  <body>
519
  <div id="left_frame">
520
  <div id="right_frame">
521
  <p id="message">
522
- <?php _e( 'Processing Order', 'wpsc'); ?>
523
  </p>
524
  <img src="https://www.paypal.com/en_US/i/icon/icon_animated_prog_42wx42h.gif" alt="Processing..." />
525
  <div id="right_bottom">
@@ -557,14 +557,14 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
557
  ob_start();
558
  ?>
559
  <p>
560
- <?php _e( 'Sorry, your transaction could not be processed by PayPal. Please contact the site administrator. The following errors are returned:', 'wpsc' ); ?>
561
  </p>
562
  <ul>
563
  <?php foreach ( $errors as $error ): ?>
564
  <li><?php echo esc_html( $error['details'] ) ?> (<?php echo esc_html( $error['code'] ); ?>)</li>
565
  <?php endforeach; ?>
566
  </ul>
567
- <p><a href="<?php echo esc_url( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wpsc' ) ?></a></p>
568
  <?php
569
  $output = apply_filters( 'wpsc_paypal_express_checkout_gateway_error_message', ob_get_clean(), $errors );
570
  return $output;
@@ -578,8 +578,8 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
578
  public function filter_generic_error_page() {
579
  ob_start();
580
  ?>
581
- <p><?php _e( 'Sorry, but your transaction could not be processed by PayPal for some reason. Please contact the site administrator.', 'wpsc' ); ?></p>
582
- <p><a href="<?php echo esc_attr( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wpsc' ) ?></a></p>
583
  <?php
584
  $output = apply_filters( 'wpsc_paypal_express_checkout_generic_error_message', ob_get_clean() );
585
  return $output;
@@ -596,12 +596,12 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
596
  <!-- Account Credentials -->
597
  <tr>
598
  <td colspan="2">
599
- <h4><?php _e( 'Account Credentials', 'wpsc' ); ?></h4>
600
  </td>
601
  </tr>
602
  <tr>
603
  <td>
604
- <label for="wpsc-paypal-express-api-username"><?php _e( 'API Username', 'wpsc' ); ?></label>
605
  </td>
606
  <td>
607
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_username' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_username' ) ); ?>" id="wpsc-paypal-express-api-username" />
@@ -609,7 +609,7 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
609
  </tr>
610
  <tr>
611
  <td>
612
- <label for="wpsc-paypal-express-api-password"><?php _e( 'API Password', 'wpsc' ); ?></label>
613
  </td>
614
  <td>
615
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_password' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_password' ) ); ?>" id="wpsc-paypal-express-api-password" />
@@ -617,7 +617,7 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
617
  </tr>
618
  <tr>
619
  <td>
620
- <label for="wpsc-paypal-express-api-signature"><?php _e( 'API Signature', 'wpsc' ); ?></label>
621
  </td>
622
  <td>
623
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_signature' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_signature' ) ); ?>" id="wpsc-paypal-express-api-signature" />
@@ -625,40 +625,40 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
625
  </tr>
626
  <tr>
627
  <td>
628
- <label><?php _e( 'Sandbox Mode', 'wpsc' ); ?></label>
629
  </td>
630
  <td>
631
- <label><input <?php checked( $this->setting->get( 'sandbox_mode' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
632
- <label><input <?php checked( (bool) $this->setting->get( 'sandbox_mode' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
633
  </td>
634
  </tr>
635
  <tr>
636
  <td>
637
- <label><?php _e( 'IPN', 'wpsc' ); ?></label>
638
  </td>
639
  <td>
640
- <label><input <?php checked( $this->setting->get( 'ipn' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
641
- <label><input <?php checked( (bool) $this->setting->get( 'ipn' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
642
  </td>
643
  </tr>
644
 
645
  <!-- Cart Customization -->
646
  <tr>
647
  <td colspan="2">
648
- <label><h4><?php _e( 'Cart Customization', 'wpsc'); ?></h4></label>
649
  </td>
650
  </tr>
651
  <tr>
652
  <td>
653
- <label for="wpsc-paypal-express-cart-logo"><?php _e( 'Merchant Logo', 'wpsc' ); ?></label>
654
  </td>
655
  <td>
656
- <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_logo' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_logo' ) ); ?>" id="wpsc-paypal-express-cart-logo" /><br><span class="small description"><?php _e( 'The image must be stored in a HTTPS Server. Limit the image to 190 pixels wide by 60 pixels high.', 'wpsc' ); ?></span>
657
  </td>
658
  </tr>
659
  <tr>
660
  <td>
661
- <label for="wpsc-paypal-express-cart-border"><?php _e( 'Cart Border Color', 'wpsc' ); ?></label>
662
  </td>
663
  <td>
664
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_border' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_border' ) ); ?>" id="wpsc-paypal-express-cart-border" />
@@ -669,17 +669,17 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
669
  <?php if ( ! $this->is_currency_supported() ): ?>
670
  <tr>
671
  <td colspan="2">
672
- <h4><?php _e( 'Currency Conversion', 'wpsc' ); ?></h4>
673
  </td>
674
  </tr>
675
  <tr>
676
  <td colspan="2">
677
- <p><?php _e( 'Your base currency is currently not accepted by PayPal. As a result, before a payment request is sent to Paypal, WP eCommerce has to convert the amounts into one of Paypal supported currencies. Please select your preferred currency below.', 'wpsc' ); ?></p>
678
  </td>
679
  </tr>
680
  <tr>
681
  <td>
682
- <label for "wpsc-paypal-express-currency"><?php _e( 'Paypal Currency', 'wpsc' ); ?></label>
683
  </td>
684
  <td>
685
  <select name="<?php echo esc_attr( $this->setting->get_field_name( 'currency' ) ); ?>" id="wpsc-paypal-express-currency">
@@ -694,32 +694,32 @@ class WPSC_Payment_Gateway_Paypal_Digital_Goods extends WPSC_Payment_Gateway_Pay
694
  <!-- Checkout Shortcut -->
695
  <tr>
696
  <td colspan="2">
697
- <h4><?php _e( 'Express Checkout Shortcut', 'wpsc' ); ?></h4>
698
  </td>
699
  </tr>
700
  <tr>
701
  <td>
702
- <label><?php _e( 'Enable Shortcut', 'wpsc' ); ?></label>
703
  </td>
704
  <td>
705
- <label><input <?php checked( $this->setting->get( 'shortcut' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
706
- <label><input <?php checked( (bool) $this->setting->get( 'shortcut' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
707
  </td>
708
  </tr>
709
 
710
  <!-- Error Logging -->
711
  <tr>
712
  <td colspan="2">
713
- <h4><?php _e( 'Error Logging', 'wpsc' ); ?></h4>
714
  </td>
715
  </tr>
716
  <tr>
717
  <td>
718
- <label><?php _e( 'Enable Debugging', 'wpsc' ); ?></label>
719
  </td>
720
  <td>
721
- <label><input <?php checked( $this->setting->get( 'debugging' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
722
- <label><input <?php checked( (bool) $this->setting->get( 'debugging' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
723
  </td>
724
  </tr>
725
  <?php
23
  parent::__construct( $options, true );
24
 
25
  $this->gateway = new PHP_Merchant_Paypal_Digital_Goods( $options );
26
+ $this->title = __( 'PayPal Digital Goods for Express Checkout', 'wp-e-commerce' );
27
 
28
  $this->gateway->set_options( array(
29
  'api_username' => $this->setting->get( 'api_username' ),
90
 
91
  if ( _wpsc_get_current_controller_name() === 'cart' ) {
92
  $url = $this->get_shortcut_url();
93
+ echo '<a id="pp-ecs-dg" href="'. esc_url ( $url ) .'"><img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="' . __( 'Check out with PayPal', 'wp-e-commerce' ) . '" /></a>';
94
  }
95
  }
96
 
153
  public static function dg_script() {
154
  $dg_loc = array(
155
  'spinner_url' => wpsc_get_ajax_spinner(),
156
+ 'loading' => __( 'Loading...', 'wp-e-commerce' ),
157
  );
158
  // Checkout Page
159
  if ( wpsc_is_checkout() ) {
235
  ?>
236
  <html>
237
  <head>
238
+ <title><?php _e( 'Processing...', 'wp-e-commerce' ); ?></title>
239
  <?php wp_print_styles( 'ppdg-iframe' ); ?>
240
  </head>
241
  <body>
242
  <div id="left_frame">
243
  <div id="right_frame">
244
  <p id="message">
245
+ <?php _e( 'Processing Order', 'wp-e-commerce'); ?>
246
 
247
  </p>
248
  <img src="https://www.paypal.com/en_US/i/icon/icon_animated_prog_42wx42h.gif" alt="Processing..." />
324
  ?>
325
  <html>
326
  <head>
327
+ <title><?php _e( 'Processing...', 'wp-e-commerce' ); ?></title>
328
  <?php wp_print_styles( 'ppdg-iframe' ); ?>
329
  </head>
330
  <body>
331
  <div id="left_frame">
332
  <div id="right_frame">
333
  <p id="message">
334
+ <?php _e( 'Cancelling Order', 'wp-e-commerce' ); ?>
335
  </p>
336
  <img src="https://www.paypal.com/en_US/i/icon/icon_animated_prog_42wx42h.gif" alt="Processing..." />
337
  <div id="right_bottom">
512
  ?>
513
  <html>
514
  <head>
515
+ <title><?php __( 'Processing...', 'wp-e-commerce' ); ?></title>
516
  <?php wp_print_styles( 'ppdg-iframe' ); ?>
517
  </head>
518
  <body>
519
  <div id="left_frame">
520
  <div id="right_frame">
521
  <p id="message">
522
+ <?php _e( 'Processing Order', 'wp-e-commerce'); ?>
523
  </p>
524
  <img src="https://www.paypal.com/en_US/i/icon/icon_animated_prog_42wx42h.gif" alt="Processing..." />
525
  <div id="right_bottom">
557
  ob_start();
558
  ?>
559
  <p>
560
+ <?php _e( 'Sorry, your transaction could not be processed by PayPal. Please contact the site administrator. The following errors are returned:', 'wp-e-commerce' ); ?>
561
  </p>
562
  <ul>
563
  <?php foreach ( $errors as $error ): ?>
564
  <li><?php echo esc_html( $error['details'] ) ?> (<?php echo esc_html( $error['code'] ); ?>)</li>
565
  <?php endforeach; ?>
566
  </ul>
567
+ <p><a href="<?php echo esc_url( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wp-e-commerce' ) ?></a></p>
568
  <?php
569
  $output = apply_filters( 'wpsc_paypal_express_checkout_gateway_error_message', ob_get_clean(), $errors );
570
  return $output;
578
  public function filter_generic_error_page() {
579
  ob_start();
580
  ?>
581
+ <p><?php _e( 'Sorry, but your transaction could not be processed by PayPal for some reason. Please contact the site administrator.', 'wp-e-commerce' ); ?></p>
582
+ <p><a href="<?php echo esc_attr( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wp-e-commerce' ) ?></a></p>
583
  <?php
584
  $output = apply_filters( 'wpsc_paypal_express_checkout_generic_error_message', ob_get_clean() );
585
  return $output;
596
  <!-- Account Credentials -->
597
  <tr>
598
  <td colspan="2">
599
+ <h4><?php _e( 'Account Credentials', 'wp-e-commerce' ); ?></h4>
600
  </td>
601
  </tr>
602
  <tr>
603
  <td>
604
+ <label for="wpsc-paypal-express-api-username"><?php _e( 'API Username', 'wp-e-commerce' ); ?></label>
605
  </td>
606
  <td>
607
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_username' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_username' ) ); ?>" id="wpsc-paypal-express-api-username" />
609
  </tr>
610
  <tr>
611
  <td>
612
+ <label for="wpsc-paypal-express-api-password"><?php _e( 'API Password', 'wp-e-commerce' ); ?></label>
613
  </td>
614
  <td>
615
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_password' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_password' ) ); ?>" id="wpsc-paypal-express-api-password" />
617
  </tr>
618
  <tr>
619
  <td>
620
+ <label for="wpsc-paypal-express-api-signature"><?php _e( 'API Signature', 'wp-e-commerce' ); ?></label>
621
  </td>
622
  <td>
623
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_signature' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_signature' ) ); ?>" id="wpsc-paypal-express-api-signature" />
625
  </tr>
626
  <tr>
627
  <td>
628
+ <label><?php _e( 'Sandbox Mode', 'wp-e-commerce' ); ?></label>
629
  </td>
630
  <td>
631
+ <label><input <?php checked( $this->setting->get( 'sandbox_mode' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
632
+ <label><input <?php checked( (bool) $this->setting->get( 'sandbox_mode' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
633
  </td>
634
  </tr>
635
  <tr>
636
  <td>
637
+ <label><?php _e( 'IPN', 'wp-e-commerce' ); ?></label>
638
  </td>
639
  <td>
640
+ <label><input <?php checked( $this->setting->get( 'ipn' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
641
+ <label><input <?php checked( (bool) $this->setting->get( 'ipn' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
642
  </td>
643
  </tr>
644
 
645
  <!-- Cart Customization -->
646
  <tr>
647
  <td colspan="2">
648
+ <label><h4><?php _e( 'Cart Customization', 'wp-e-commerce'); ?></h4></label>
649
  </td>
650
  </tr>
651
  <tr>
652
  <td>
653
+ <label for="wpsc-paypal-express-cart-logo"><?php _e( 'Merchant Logo', 'wp-e-commerce' ); ?></label>
654
  </td>
655
  <td>
656
+ <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_logo' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_logo' ) ); ?>" id="wpsc-paypal-express-cart-logo" /><br><span class="small description"><?php _e( 'The image must be stored in a HTTPS Server. Limit the image to 190 pixels wide by 60 pixels high.', 'wp-e-commerce' ); ?></span>
657
  </td>
658
  </tr>
659
  <tr>
660
  <td>
661
+ <label for="wpsc-paypal-express-cart-border"><?php _e( 'Cart Border Color', 'wp-e-commerce' ); ?></label>
662
  </td>
663
  <td>
664
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_border' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_border' ) ); ?>" id="wpsc-paypal-express-cart-border" />
669
  <?php if ( ! $this->is_currency_supported() ): ?>
670
  <tr>
671
  <td colspan="2">
672
+ <h4><?php _e( 'Currency Conversion', 'wp-e-commerce' ); ?></h4>
673
  </td>
674
  </tr>
675
  <tr>
676
  <td colspan="2">
677
+ <p><?php _e( "Your base currency is currently not accepted by PayPal. As a result, before a payment request is sent to PayPal, WP eCommerce has to convert the amounts into one of PayPal's supported currencies. Please select your preferred currency below.", 'wp-e-commerce' ); ?></p>
678
  </td>
679
  </tr>
680
  <tr>
681
  <td>
682
+ <label for "wpsc-paypal-express-currency"><?php _e( 'PayPal Currency', 'wp-e-commerce' ); ?></label>
683
  </td>
684
  <td>
685
  <select name="<?php echo esc_attr( $this->setting->get_field_name( 'currency' ) ); ?>" id="wpsc-paypal-express-currency">
694
  <!-- Checkout Shortcut -->
695
  <tr>
696
  <td colspan="2">
697
+ <h4><?php _e( 'Express Checkout Shortcut', 'wp-e-commerce' ); ?></h4>
698
  </td>
699
  </tr>
700
  <tr>
701
  <td>
702
+ <label><?php _e( 'Enable Shortcut', 'wp-e-commerce' ); ?></label>
703
  </td>
704
  <td>
705
+ <label><input <?php checked( $this->setting->get( 'shortcut' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
706
+ <label><input <?php checked( (bool) $this->setting->get( 'shortcut' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
707
  </td>
708
  </tr>
709
 
710
  <!-- Error Logging -->
711
  <tr>
712
  <td colspan="2">
713
+ <h4><?php _e( 'Error Logging', 'wp-e-commerce' ); ?></h4>
714
  </td>
715
  </tr>
716
  <tr>
717
  <td>
718
+ <label><?php _e( 'Enable Debugging', 'wp-e-commerce' ); ?></label>
719
  </td>
720
  <td>
721
+ <label><input <?php checked( $this->setting->get( 'debugging' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
722
+ <label><input <?php checked( (bool) $this->setting->get( 'debugging' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
723
  </td>
724
  </tr>
725
  <?php
wpsc-components/merchant-core-v3/gateways/paypal-express-checkout.php CHANGED
@@ -27,7 +27,7 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
27
  $this->gateway = new PHP_Merchant_Paypal_Express_Checkout( $options );
28
 
29
  if ( ! $child ) {
30
- $this->title = __( 'PayPal Express Checkout 3.0', 'wpsc' );
31
  $this->gateway->set_options( array(
32
  'api_username' => $this->setting->get( 'api_username' ),
33
  'api_password' => $this->setting->get( 'api_password' ),
@@ -63,7 +63,7 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
63
 
64
  if ( _wpsc_get_current_controller_name() === 'cart' ) {
65
  $url = $this->get_shortcut_url();
66
- echo '<a href="'. esc_url( $url ) .'"><img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="' . __( 'Check out with PayPal', 'wpsc' ) . '" /></a>';
67
  }
68
  }
69
 
@@ -495,9 +495,9 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
495
  public function review_order_buyer_details( $output ) {
496
  $payer = $this->paypal_data->get( 'payer' );
497
  $output .= '<ul>';
498
- $output .= '<li><strong>' . __( 'Email:', 'wpsc' ) . ' </strong>' . $payer->email . '</li>';
499
- $output .= '<li><strong>' . __( 'First Name:', 'wpsc' ) . ' </strong>' . $payer->first_name . '</li>';
500
- $output .= '<li><strong>' . __( 'Last Name:', 'wpsc' ) . ' </strong>' . $payer->last_name . '</li>';
501
  $output .= '</ul>';
502
  return $output;
503
  }
@@ -736,7 +736,7 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
736
  ob_start();
737
  ?>
738
  <p>
739
- <?php _e( 'Sorry, your transaction could not be processed by PayPal. Please contact the site administrator. The following errors are returned:' , 'wpsc' ); ?>
740
  </p>
741
  <ul>
742
  <?php foreach ( $errors as $error ): ?>
@@ -757,8 +757,8 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
757
  public function filter_generic_error_page() {
758
  ob_start();
759
  ?>
760
- <p><?php _e( 'Sorry, but your transaction could not be processed by PayPal for some reason. Please contact the site administrator.' , 'wpsc' ); ?></p>
761
- <p><a href="<?php echo esc_attr( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wpsc' ) ?></a></p>
762
  <?php
763
  $output = apply_filters( 'wpsc_paypal_express_checkout_generic_error_message', ob_get_clean() );
764
  return $output;
@@ -776,12 +776,12 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
776
  <!-- Account Credentials -->
777
  <tr>
778
  <td colspan="2">
779
- <h4><?php _e( 'Account Credentials', 'wpsc' ); ?></h4>
780
  </td>
781
  </tr>
782
  <tr>
783
  <td>
784
- <label for="wpsc-paypal-express-api-username"><?php _e( 'API Username', 'wpsc' ); ?></label>
785
  </td>
786
  <td>
787
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_username' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_username' ) ); ?>" id="wpsc-paypal-express-api-username" />
@@ -789,7 +789,7 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
789
  </tr>
790
  <tr>
791
  <td>
792
- <label for="wpsc-paypal-express-api-password"><?php _e( 'API Password', 'wpsc' ); ?></label>
793
  </td>
794
  <td>
795
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_password' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_password' ) ); ?>" id="wpsc-paypal-express-api-password" />
@@ -797,7 +797,7 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
797
  </tr>
798
  <tr>
799
  <td>
800
- <label for="wpsc-paypal-express-api-signature"><?php _e( 'API Signature', 'wpsc' ); ?></label>
801
  </td>
802
  <td>
803
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_signature' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_signature' ) ); ?>" id="wpsc-paypal-express-api-signature" />
@@ -805,40 +805,40 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
805
  </tr>
806
  <tr>
807
  <td>
808
- <label><?php _e( 'Sandbox Mode', 'wpsc' ); ?></label>
809
  </td>
810
  <td>
811
- <label><input <?php checked( $this->setting->get( 'sandbox_mode' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
812
- <label><input <?php checked( (bool) $this->setting->get( 'sandbox_mode' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
813
  </td>
814
  </tr>
815
  <tr>
816
  <td>
817
- <label><?php _e( 'IPN', 'wpsc' ); ?></label>
818
  </td>
819
  <td>
820
- <label><input <?php checked( $this->setting->get( 'ipn' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
821
- <label><input <?php checked( (bool) $this->setting->get( 'ipn' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
822
  </td>
823
  </tr>
824
 
825
  <!-- Cart Customization -->
826
  <tr>
827
  <td colspan="2">
828
- <label><h4><?php _e( 'Cart Customization', 'wpsc'); ?></h4></label>
829
  </td>
830
  </tr>
831
  <tr>
832
  <td>
833
- <label for="wpsc-paypal-express-cart-logo"><?php _e( 'Merchant Logo', 'wpsc' ); ?></label>
834
  </td>
835
  <td>
836
- <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_logo' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_logo' ) ); ?>" id="wpsc-paypal-express-cart-logo" /><br><span class="small description"><?php _e( 'The image must be stored in a HTTPS Server. Limit the image to 190 pixels wide by 60 pixels high.', 'wpsc' ); ?></span>
837
  </td>
838
  </tr>
839
  <tr>
840
  <td>
841
- <label for="wpsc-paypal-express-cart-border"><?php _e( 'Cart Border Color', 'wpsc' ); ?></label>
842
  </td>
843
  <td>
844
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_border' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_border' ) ); ?>" id="wpsc-paypal-express-cart-border" />
@@ -849,17 +849,17 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
849
  <?php if ( ! $this->is_currency_supported() ) : ?>
850
  <tr>
851
  <td colspan="2">
852
- <h4><?php _e( 'Currency Conversion', 'wpsc' ); ?></h4>
853
  </td>
854
  </tr>
855
  <tr>
856
  <td colspan="2">
857
- <p><?php _e( 'Your base currency is currently not accepted by PayPal. As a result, before a payment request is sent to PayPal, WP eCommerce has to convert the amounts into one of PayPal supported currencies. Please select your preferred currency below.', 'wpsc' ); ?></p>
858
  </td>
859
  </tr>
860
  <tr>
861
  <td>
862
- <label for "wpsc-paypal-express-currency"><?php _e( 'PayPal Currency', 'wpsc' ); ?></label>
863
  </td>
864
  <td>
865
  <select name="<?php echo esc_attr( $this->setting->get_field_name( 'currency' ) ); ?>" id="wpsc-paypal-express-currency">
@@ -874,32 +874,32 @@ class WPSC_Payment_Gateway_Paypal_Express_Checkout extends WPSC_Payment_Gateway
874
  <!-- Checkout Shortcut -->
875
  <tr>
876
  <td colspan="2">
877
- <h4><?php _e( 'Express Checkout Shortcut', 'wpsc' ); ?></h4>
878
  </td>
879
  </tr>
880
  <tr>
881
  <td>
882
- <label><?php _e( 'Enable Shortcut', 'wpsc' ); ?></label>
883
  </td>
884
  <td>
885
- <label><input <?php checked( $this->setting->get( 'shortcut' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
886
- <label><input <?php checked( (bool) $this->setting->get( 'shortcut' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
887
  </td>
888
  </tr>
889
 
890
  <!-- Error Logging -->
891
  <tr>
892
  <td colspan="2">
893
- <h4><?php _e( 'Error Logging', 'wpsc' ); ?></h4>
894
  </td>
895
  </tr>
896
  <tr>
897
  <td>
898
- <label><?php _e( 'Enable Debugging', 'wpsc' ); ?></label>
899
  </td>
900
  <td>
901
- <label><input <?php checked( $this->setting->get( 'debugging' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
902
- <label><input <?php checked( (bool) $this->setting->get( 'debugging' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
903
  </td>
904
  </tr>
905
  <?php
27
  $this->gateway = new PHP_Merchant_Paypal_Express_Checkout( $options );
28
 
29
  if ( ! $child ) {
30
+ $this->title = __( 'PayPal Express Checkout 3.0', 'wp-e-commerce' );
31
  $this->gateway->set_options( array(
32
  'api_username' => $this->setting->get( 'api_username' ),
33
  'api_password' => $this->setting->get( 'api_password' ),
63
 
64
  if ( _wpsc_get_current_controller_name() === 'cart' ) {
65
  $url = $this->get_shortcut_url();
66
+ echo '<a href="'. esc_url( $url ) .'"><img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="' . __( 'Check out with PayPal', 'wp-e-commerce' ) . '" /></a>';
67
  }
68
  }
69
 
495
  public function review_order_buyer_details( $output ) {
496
  $payer = $this->paypal_data->get( 'payer' );
497
  $output .= '<ul>';
498
+ $output .= '<li><strong>' . __( 'Email:', 'wp-e-commerce' ) . ' </strong>' . $payer->email . '</li>';
499
+ $output .= '<li><strong>' . __( 'First Name:', 'wp-e-commerce' ) . ' </strong>' . $payer->first_name . '</li>';
500
+ $output .= '<li><strong>' . __( 'Last Name:', 'wp-e-commerce' ) . ' </strong>' . $payer->last_name . '</li>';
501
  $output .= '</ul>';
502
  return $output;
503
  }
736
  ob_start();
737
  ?>
738
  <p>
739
+ <?php _e( 'Sorry, your transaction could not be processed by PayPal. Please contact the site administrator. The following errors are returned:' , 'wp-e-commerce' ); ?>
740
  </p>
741
  <ul>
742
  <?php foreach ( $errors as $error ): ?>
757
  public function filter_generic_error_page() {
758
  ob_start();
759
  ?>
760
+ <p><?php _e( 'Sorry, but your transaction could not be processed by PayPal for some reason. Please contact the site administrator.' , 'wp-e-commerce' ); ?></p>
761
+ <p><a href="<?php echo esc_attr( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wp-e-commerce' ) ?></a></p>
762
  <?php
763
  $output = apply_filters( 'wpsc_paypal_express_checkout_generic_error_message', ob_get_clean() );
764
  return $output;
776
  <!-- Account Credentials -->
777
  <tr>
778
  <td colspan="2">
779
+ <h4><?php _e( 'Account Credentials', 'wp-e-commerce' ); ?></h4>
780
  </td>
781
  </tr>
782
  <tr>
783
  <td>
784
+ <label for="wpsc-paypal-express-api-username"><?php _e( 'API Username', 'wp-e-commerce' ); ?></label>
785
  </td>
786
  <td>
787
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_username' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_username' ) ); ?>" id="wpsc-paypal-express-api-username" />
789
  </tr>
790
  <tr>
791
  <td>
792
+ <label for="wpsc-paypal-express-api-password"><?php _e( 'API Password', 'wp-e-commerce' ); ?></label>
793
  </td>
794
  <td>
795
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_password' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_password' ) ); ?>" id="wpsc-paypal-express-api-password" />
797
  </tr>
798
  <tr>
799
  <td>
800
+ <label for="wpsc-paypal-express-api-signature"><?php _e( 'API Signature', 'wp-e-commerce' ); ?></label>
801
  </td>
802
  <td>
803
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_signature' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_signature' ) ); ?>" id="wpsc-paypal-express-api-signature" />
805
  </tr>
806
  <tr>
807
  <td>
808
+ <label><?php _e( 'Sandbox Mode', 'wp-e-commerce' ); ?></label>
809
  </td>
810
  <td>
811
+ <label><input <?php checked( $this->setting->get( 'sandbox_mode' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
812
+ <label><input <?php checked( (bool) $this->setting->get( 'sandbox_mode' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
813
  </td>
814
  </tr>
815
  <tr>
816
  <td>
817
+ <label><?php _e( 'IPN', 'wp-e-commerce' ); ?></label>
818
  </td>
819
  <td>
820
+ <label><input <?php checked( $this->setting->get( 'ipn' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
821
+ <label><input <?php checked( (bool) $this->setting->get( 'ipn' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
822
  </td>
823
  </tr>
824
 
825
  <!-- Cart Customization -->
826
  <tr>
827
  <td colspan="2">
828
+ <label><h4><?php _e( 'Cart Customization', 'wp-e-commerce'); ?></h4></label>
829
  </td>
830
  </tr>
831
  <tr>
832
  <td>
833
+ <label for="wpsc-paypal-express-cart-logo"><?php _e( 'Merchant Logo', 'wp-e-commerce' ); ?></label>
834
  </td>
835
  <td>
836
+ <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_logo' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_logo' ) ); ?>" id="wpsc-paypal-express-cart-logo" /><br><span class="small description"><?php _e( 'The image must be stored in a HTTPS Server. Limit the image to 190 pixels wide by 60 pixels high.', 'wp-e-commerce' ); ?></span>
837
  </td>
838
  </tr>
839
  <tr>
840
  <td>
841
+ <label for="wpsc-paypal-express-cart-border"><?php _e( 'Cart Border Color', 'wp-e-commerce' ); ?></label>
842
  </td>
843
  <td>
844
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'cart_border' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'cart_border' ) ); ?>" id="wpsc-paypal-express-cart-border" />
849
  <?php if ( ! $this->is_currency_supported() ) : ?>
850
  <tr>
851
  <td colspan="2">
852
+ <h4><?php _e( 'Currency Conversion', 'wp-e-commerce' ); ?></h4>
853
  </td>
854
  </tr>
855
  <tr>
856
  <td colspan="2">
857
+ <p><?php _e( "Your base currency is currently not accepted by PayPal. As a result, before a payment request is sent to PayPal, WP eCommerce has to convert the amounts into one of PayPal's supported currencies. Please select your preferred currency below.", 'wp-e-commerce' ); ?></p>
858
  </td>
859
  </tr>
860
  <tr>
861
  <td>
862
+ <label for "wpsc-paypal-express-currency"><?php _e( 'PayPal Currency', 'wp-e-commerce' ); ?></label>
863
  </td>
864
  <td>
865
  <select name="<?php echo esc_attr( $this->setting->get_field_name( 'currency' ) ); ?>" id="wpsc-paypal-express-currency">
874
  <!-- Checkout Shortcut -->
875
  <tr>
876
  <td colspan="2">
877
+ <h4><?php _e( 'Express Checkout Shortcut', 'wp-e-commerce' ); ?></h4>
878
  </td>
879
  </tr>
880
  <tr>
881
  <td>
882
+ <label><?php _e( 'Enable Shortcut', 'wp-e-commerce' ); ?></label>
883
  </td>
884
  <td>
885
+ <label><input <?php checked( $this->setting->get( 'shortcut' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
886
+ <label><input <?php checked( (bool) $this->setting->get( 'shortcut' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'shortcut' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
887
  </td>
888
  </tr>
889
 
890
  <!-- Error Logging -->
891
  <tr>
892
  <td colspan="2">
893
+ <h4><?php _e( 'Error Logging', 'wp-e-commerce' ); ?></h4>
894
  </td>
895
  </tr>
896
  <tr>
897
  <td>
898
+ <label><?php _e( 'Enable Debugging', 'wp-e-commerce' ); ?></label>
899
  </td>
900
  <td>
901
+ <label><input <?php checked( $this->setting->get( 'debugging' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
902
+ <label><input <?php checked( (bool) $this->setting->get( 'debugging' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
903
  </td>
904
  </tr>
905
  <?php
wpsc-components/merchant-core-v3/gateways/paypal-pro.php CHANGED
@@ -18,7 +18,7 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
18
  public function __construct( $options ) {
19
  parent::__construct();
20
 
21
- $this->title = __( 'PayPal Pro Hosted', 'wpsc' );
22
 
23
  require_once( 'php-merchant/gateways/paypal-pro.php' );
24
 
@@ -82,7 +82,7 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
82
  if ( wpsc_is_checkout() ) {
83
  $pro_loc = array(
84
  'spinner_url' => wpsc_get_ajax_spinner(),
85
- 'loading' => __( 'Loading...', 'wpsc' ),
86
  );
87
  wp_enqueue_script( 'pro-script-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.js', array( 'jquery' ) );
88
  wp_enqueue_style( 'pro-style-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.css' );
@@ -99,7 +99,7 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
99
  * @since 3.9
100
  */
101
  public function get_mark_html() {
102
- $html = '<img src="' . WPSC_URL . '/images/cc.png" border="0" alt="' . esc_attr__( 'Credit Card Icons' ) .'" />';
103
 
104
  return apply_filters( 'wpsc_paypal-pro_mark_html', $html );
105
  }
@@ -342,7 +342,7 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
342
  ob_start();
343
  ?>
344
  <p>
345
- <?php _e( 'Sorry, your transaction could not be processed by PayPal. Please contact the site administrator. The following errors are returned:' , 'wpsc' ); ?>
346
  </p>
347
  <ul>
348
  <?php foreach ( $errors as $error ): ?>
@@ -363,8 +363,8 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
363
  public function filter_generic_error_page() {
364
  ob_start();
365
  ?>
366
- <p><?php _e( 'Sorry, but your transaction could not be processed by PayPal for some reason. Please contact the site administrator.' , 'wpsc' ); ?></p>
367
- <p><a href="<?php echo esc_attr( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wpsc' ) ?></a></p>
368
  <?php
369
  $output = apply_filters( 'wpsc_paypal_pro_generic_error_message', ob_get_clean() );
370
  return $output;
@@ -382,12 +382,12 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
382
  <!-- Account Credentials -->
383
  <tr>
384
  <td colspan="2">
385
- <h4><?php _e( 'Account Credentials', 'wpsc' ); ?></h4>
386
  </td>
387
  </tr>
388
  <tr>
389
  <td>
390
- <label for="wpsc-paypal-pro-vendor-id"><?php _e( 'Vendor ID', 'wpsc' ); ?></label>
391
  </td>
392
  <td>
393
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'vendor_id' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'vendor_id' ) ); ?>" id="wpsc-paypal-pro-vendor-id" />
@@ -395,7 +395,7 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
395
  </tr>
396
  <tr>
397
  <td>
398
- <label for="wpsc-paypal-pro-api-username"><?php _e( 'API Username', 'wpsc' ); ?></label>
399
  </td>
400
  <td>
401
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_username' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_username' ) ); ?>" id="wpsc-paypal-pro-api-username" />
@@ -403,7 +403,7 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
403
  </tr>
404
  <tr>
405
  <td>
406
- <label for="wpsc-paypal-pro-api-password"><?php _e( 'API Password', 'wpsc' ); ?></label>
407
  </td>
408
  <td>
409
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_password' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_password' ) ); ?>" id="wpsc-paypal-pro-api-password" />
@@ -411,7 +411,7 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
411
  </tr>
412
  <tr>
413
  <td>
414
- <label for="wpsc-paypal-pro-api-signature"><?php _e( 'API Signature', 'wpsc' ); ?></label>
415
  </td>
416
  <td>
417
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_signature' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_signature' ) ); ?>" id="wpsc-paypal-pro-api-signature" />
@@ -419,20 +419,20 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
419
  </tr>
420
  <tr>
421
  <td>
422
- <label><?php _e( 'Sandbox Mode', 'wpsc' ); ?></label>
423
  </td>
424
  <td>
425
- <label><input <?php checked( $this->setting->get( 'sandbox_mode' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
426
- <label><input <?php checked( (bool) $this->setting->get( 'sandbox_mode' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
427
  </td>
428
  </tr>
429
  <tr>
430
  <td>
431
- <label><?php _e( 'IPN', 'wpsc' ); ?></label>
432
  </td>
433
  <td>
434
- <label><input <?php checked( $this->setting->get( 'ipn' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
435
- <label><input <?php checked( (bool) $this->setting->get( 'ipn' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
436
  </td>
437
  </tr>
438
 
@@ -440,17 +440,17 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
440
  <?php if ( ! $this->is_currency_supported() ): ?>
441
  <tr>
442
  <td colspan="2">
443
- <h4><?php _e( 'Currency Conversion', 'wpsc' ); ?></h4>
444
  </td>
445
  </tr>
446
  <tr>
447
  <td colspan="2">
448
- <p><?php _e( 'Your base currency is currently not accepted by PayPal. As a result, before a payment request is sent to PayPal, WP eCommerce has to convert the amounts into one of PayPal supported currencies. Please select your preferred currency below.', 'wpsc' ); ?></p>
449
  </td>
450
  </tr>
451
  <tr>
452
  <td>
453
- <label for "wpsc-paypal-pro-currency"><?php _e( 'PayPal Currency', 'wpsc' ); ?></label>
454
  </td>
455
  <td>
456
  <select name="<?php echo esc_attr( $this->setting->get_field_name( 'currency' ) ); ?>" id="wpsc-paypal-pro-currency">
@@ -465,16 +465,16 @@ class WPSC_Payment_Gateway_Paypal_Pro extends WPSC_Payment_Gateway {
465
  <!-- Error Logging -->
466
  <tr>
467
  <td colspan="2">
468
- <h4><?php _e( 'Error Logging', 'wpsc' ); ?></h4>
469
  </td>
470
  </tr>
471
  <tr>
472
  <td>
473
- <label><?php _e( 'Enable Debugging', 'wpsc' ); ?></label>
474
  </td>
475
  <td>
476
- <label><input <?php checked( $this->setting->get( 'debugging' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;&nbsp;&nbsp;
477
- <label><input <?php checked( (bool) $this->setting->get( 'debugging' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label>
478
  </td>
479
  </tr>
480
  <?php
18
  public function __construct( $options ) {
19
  parent::__construct();
20
 
21
+ $this->title = __( 'PayPal Pro Hosted', 'wp-e-commerce' );
22
 
23
  require_once( 'php-merchant/gateways/paypal-pro.php' );
24
 
82
  if ( wpsc_is_checkout() ) {
83
  $pro_loc = array(
84
  'spinner_url' => wpsc_get_ajax_spinner(),
85
+ 'loading' => __( 'Loading...', 'wp-e-commerce' ),
86
  );
87
  wp_enqueue_script( 'pro-script-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.js', array( 'jquery' ) );
88
  wp_enqueue_style( 'pro-style-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.css' );
99
  * @since 3.9
100
  */
101
  public function get_mark_html() {
102
+ $html = '<img src="' . WPSC_URL . '/images/cc.png" border="0" alt="' . esc_attr__( 'Credit Card Icons', 'wp-e-commerce' ) .'" />';
103
 
104
  return apply_filters( 'wpsc_paypal-pro_mark_html', $html );
105
  }
342
  ob_start();
343
  ?>
344
  <p>
345
+ <?php _e( 'Sorry, your transaction could not be processed by PayPal. Please contact the site administrator. The following errors are returned:' , 'wp-e-commerce' ); ?>
346
  </p>
347
  <ul>
348
  <?php foreach ( $errors as $error ): ?>
363
  public function filter_generic_error_page() {
364
  ob_start();
365
  ?>
366
+ <p><?php _e( 'Sorry, but your transaction could not be processed by PayPal for some reason. Please contact the site administrator.' , 'wp-e-commerce' ); ?></p>
367
+ <p><a href="<?php echo esc_attr( $this->get_shopping_cart_payment_url() ); ?>"><?php _e( 'Click here to go back to the checkout page.', 'wp-e-commerce' ) ?></a></p>
368
  <?php
369
  $output = apply_filters( 'wpsc_paypal_pro_generic_error_message', ob_get_clean() );
370
  return $output;
382
  <!-- Account Credentials -->
383
  <tr>
384
  <td colspan="2">
385
+ <h4><?php _e( 'Account Credentials', 'wp-e-commerce' ); ?></h4>
386
  </td>
387
  </tr>
388
  <tr>
389
  <td>
390
+ <label for="wpsc-paypal-pro-vendor-id"><?php _e( 'Vendor ID', 'wp-e-commerce' ); ?></label>
391
  </td>
392
  <td>
393
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'vendor_id' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'vendor_id' ) ); ?>" id="wpsc-paypal-pro-vendor-id" />
395
  </tr>
396
  <tr>
397
  <td>
398
+ <label for="wpsc-paypal-pro-api-username"><?php _e( 'API Username', 'wp-e-commerce' ); ?></label>
399
  </td>
400
  <td>
401
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_username' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_username' ) ); ?>" id="wpsc-paypal-pro-api-username" />
403
  </tr>
404
  <tr>
405
  <td>
406
+ <label for="wpsc-paypal-pro-api-password"><?php _e( 'API Password', 'wp-e-commerce' ); ?></label>
407
  </td>
408
  <td>
409
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_password' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_password' ) ); ?>" id="wpsc-paypal-pro-api-password" />
411
  </tr>
412
  <tr>
413
  <td>
414
+ <label for="wpsc-paypal-pro-api-signature"><?php _e( 'API Signature', 'wp-e-commerce' ); ?></label>
415
  </td>
416
  <td>
417
  <input type="text" name="<?php echo esc_attr( $this->setting->get_field_name( 'api_signature' ) ); ?>" value="<?php echo esc_attr( $this->setting->get( 'api_signature' ) ); ?>" id="wpsc-paypal-pro-api-signature" />
419
  </tr>
420
  <tr>
421
  <td>
422
+ <label><?php _e( 'Sandbox Mode', 'wp-e-commerce' ); ?></label>
423
  </td>
424
  <td>
425
+ <label><input <?php checked( $this->setting->get( 'sandbox_mode' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
426
+ <label><input <?php checked( (bool) $this->setting->get( 'sandbox_mode' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'sandbox_mode' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
427
  </td>
428
  </tr>
429
  <tr>
430
  <td>
431
+ <label><?php _e( 'IPN', 'wp-e-commerce' ); ?></label>
432
  </td>
433
  <td>
434
+ <label><input <?php checked( $this->setting->get( 'ipn' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
435
+ <label><input <?php checked( (bool) $this->setting->get( 'ipn' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'ipn' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
436
  </td>
437
  </tr>
438
 
440
  <?php if ( ! $this->is_currency_supported() ): ?>
441
  <tr>
442
  <td colspan="2">
443
+ <h4><?php _e( 'Currency Conversion', 'wp-e-commerce' ); ?></h4>
444
  </td>
445
  </tr>
446
  <tr>
447
  <td colspan="2">
448
+ <p><?php _e( "Your base currency is currently not accepted by PayPal. As a result, before a payment request is sent to PayPal, WP eCommerce has to convert the amounts into one of PayPal's supported currencies. Please select your preferred currency below.", 'wp-e-commerce' ); ?></p>
449
  </td>
450
  </tr>
451
  <tr>
452
  <td>
453
+ <label for "wpsc-paypal-pro-currency"><?php _e( 'PayPal Currency', 'wp-e-commerce' ); ?></label>
454
  </td>
455
  <td>
456
  <select name="<?php echo esc_attr( $this->setting->get_field_name( 'currency' ) ); ?>" id="wpsc-paypal-pro-currency">
465
  <!-- Error Logging -->
466
  <tr>
467
  <td colspan="2">
468
+ <h4><?php _e( 'Error Logging', 'wp-e-commerce' ); ?></h4>
469
  </td>
470
  </tr>
471
  <tr>
472
  <td>
473
+ <label><?php _e( 'Enable Debugging', 'wp-e-commerce' ); ?></label>
474
  </td>
475
  <td>
476
+ <label><input <?php checked( $this->setting->get( 'debugging' ) ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="1" /> <?php _e( 'Yes', 'wp-e-commerce' ); ?></label>&nbsp;&nbsp;&nbsp;
477
+ <label><input <?php checked( (bool) $this->setting->get( 'debugging' ), false ); ?> type="radio" name="<?php echo esc_attr( $this->setting->get_field_name( 'debugging' ) ); ?>" value="0" /> <?php _e( 'No', 'wp-e-commerce' ); ?></label>
478
  </td>
479
  </tr>
480
  <?php
wpsc-components/merchant-core-v3/gateways/php-merchant/README.md DELETED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/common/exception.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/common/helpers.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/common/http-curl.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/common/http.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/common/php-merchant.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/common/response.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-express-checkout-response.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-express-checkout.php CHANGED
@@ -121,7 +121,7 @@ class PHP_Merchant_Paypal_Express_Checkout extends PHP_Merchant_Paypal {
121
 
122
  // Add the Discount as an Item
123
  $this->options['items'][] = array(
124
- 'name' => __( 'Discount', 'wpsc' ),
125
  'amount' => - $discount,
126
  'quantity' => '1',
127
  );
121
 
122
  // Add the Discount as an Item
123
  $this->options['items'][] = array(
124
+ 'name' => __( 'Discount', 'wp-e-commerce' ),
125
  'amount' => - $discount,
126
  'quantity' => '1',
127
  );
wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-ipn.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-pro-response.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-pro.php CHANGED
@@ -109,7 +109,7 @@ class PHP_Merchant_Paypal_Pro extends PHP_Merchant_Paypal
109
 
110
  // Add the Discount as an Item
111
  $this->options['items'][] = array(
112
- 'name' => __( 'Discount', 'wpsc' ),
113
  'amount' => - $discount,
114
  'quantity' => '1',
115
  );
109
 
110
  // Add the Discount as an Item
111
  $this->options['items'][] = array(
112
+ 'name' => __( 'Discount', 'wp-e-commerce' ),
113
  'amount' => - $discount,
114
  'quantity' => '1',
115
  );
wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal-response.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/gateways/paypal.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/common/http-curl.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/common/php-merchant.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/common/test-accounts.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/gateways/paypal-express-checkout.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/gateways/paypal-ipn.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/gateways/paypal.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/index.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/http-curl.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x1.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x2.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x3.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-dg-cert-x4.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x1.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x2.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x3.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x4.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x5.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-ec-cert-x6.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-express-checkout.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-pro-cert-x1.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/remote/paypal-pro-cert-x2.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/LICENSE CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/README CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/VERSION CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/authentication.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/autorun.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/browser.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/collector.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/compatibility.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/cookies.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/default_reporter.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/detached.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/authentication_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/browser_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/docs.css CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/expectation_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/form_testing_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/group_test_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/index.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/mock_objects_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/overview.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/partial_mocks_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/reporter_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/unit_test_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/en/web_tester_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/authentication_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/browser_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/docs.css CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/expectation_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/form_testing_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/group_test_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/index.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/mock_objects_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/overview.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/partial_mocks_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/reporter_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/unit_test_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/docs/fr/web_tester_documentation.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/dumper.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/eclipse.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/encoding.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/errors.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/exceptions.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/expectation.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/extensions/pear_test_case.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/extensions/testdox.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/extensions/testdox/test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/form.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/frames.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/http.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/invoker.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/mock_objects.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/page.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/php_parser.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/reflection_php4.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/reflection_php5.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/remote.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/reporter.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/scorer.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/selector.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/shell_tester.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/simpletest.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/socket.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/tag.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/acceptance_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/adapter_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/all_tests.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/authentication_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/autorun_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/bad_test_suite.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/browser_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/collector_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/command_line_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/compatibility_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/cookies_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/detached_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/dumper_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/eclipse_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/encoding_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/errors_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/exceptions_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/expectation_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/form_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/frames_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/http_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/interfaces_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/interfaces_test_php5_1.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/live_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/mock_objects_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/page_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/parse_error_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/parsing_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/php_parser_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/reflection_php4_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/reflection_php5_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/remote_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/shell_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/shell_tester_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/simpletest_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/site/file.html CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/socket_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/collector/collectable.1 CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/collector/collectable.2 CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/empty_test_file.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/failing_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/latin1_sample CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/passing_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/spl_examples.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/supplementary_upload_sample.txt CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/test1.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/support/upload_sample.txt CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/tag_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/test_with_parse_error.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/unit_tester_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/unit_tests.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/url_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/user_agent_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/visual_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/web_tester_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test/xml_test.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/test_case.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/tidy_parser.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/unit_tester.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/url.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/user_agent.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/varlog.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/web_tester.php CHANGED
File without changes
wpsc-components/merchant-core-v3/gateways/php-merchant/tests/simpletest/xml.php CHANGED
File without changes
wpsc-components/merchant-core-v3/helpers/admin.php CHANGED
@@ -30,7 +30,7 @@ function _wpsc_filter_merchant_v3_gateway_form( $form, $gateway_id ) {
30
 
31
  $payment_gateway_names = get_option('payment_gateway_names');
32
  $form = array();
33
- $output = array( 'name' => '&nbsp;', 'form_fields' => __( 'To configure a payment module select one on the left.', 'wpsc' ), 'has_submit_button' => 0 );
34
  $gateway = wpsc_get_payment_gateway( $gateway_id );
35
  $display_name = empty( $payment_gateway_names[$gateway_id] ) ? $gateway->get_title() : $payment_gateway_names[$gateway_id];
36
  ob_start();
@@ -38,11 +38,11 @@ function _wpsc_filter_merchant_v3_gateway_form( $form, $gateway_id ) {
38
  ?>
39
  <tr>
40
  <td style='border-top: none;'>
41
- <?php _e( 'Display Name', 'wpsc' ); ?>
42
  </td>
43
  <td style='border-top: none;'>
44
  <input type='text' name='user_defined_name[<?php echo esc_attr( $gateway_id ); ?>]' value='<?php echo esc_attr( $display_name ); ?>' /><br />
45
- <span class='small description'><?php _e('The text that people see when making a purchase', 'wpsc'); ?></span>
46
  </td>
47
  </tr>
48
  <?php
@@ -54,4 +54,4 @@ function _wpsc_filter_merchant_v3_gateway_form( $form, $gateway_id ) {
54
  'has_submit_button' => 0,
55
  );
56
  return $output;
57
- }
30
 
31
  $payment_gateway_names = get_option('payment_gateway_names');
32
  $form = array();
33
+ $output = array( 'name' => '&nbsp;', 'form_fields' => __( 'To configure a payment module select one on the left.', 'wp-e-commerce' ), 'has_submit_button' => 0 );
34
  $gateway = wpsc_get_payment_gateway( $gateway_id );
35
  $display_name = empty( $payment_gateway_names[$gateway_id] ) ? $gateway->get_title() : $payment_gateway_names[$gateway_id];
36
  ob_start();
38
  ?>
39
  <tr>
40
  <td style='border-top: none;'>
41
+ <?php _e( 'Display Name', 'wp-e-commerce' ); ?>
42
  </td>
43
  <td style='border-top: none;'>
44
  <input type='text' name='user_defined_name[<?php echo esc_attr( $gateway_id ); ?>]' value='<?php echo esc_attr( $display_name ); ?>' /><br />
45
+ <span class='small description'><?php _e('The text that people see when making a purchase.', 'wp-e-commerce'); ?></span>
46
  </td>
47
  </tr>
48
  <?php
54
  'has_submit_button' => 0,
55
  );
56
  return $output;
57
+ }
wpsc-components/merchant-core-v3/helpers/payment-gateway.php CHANGED
File without changes
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/css/style.css ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pay_with_amazon {
2
+ display: inline-block;
3
+ border: 0;
4
+ float: left;
5
+ }
6
+
7
+ .wpsc-alert #pay_with_amazon {
8
+ float: right;
9
+ position: relative;
10
+ bottom: 4px;
11
+ }
12
+
13
+ #pay_with_amazon img {
14
+ width: auto !important;
15
+ vertical-align: middle;
16
+ cursor: pointer;
17
+ box-shadow: none;
18
+ border: 0;
19
+ padding:0;
20
+ margin:0;
21
+ display: block;
22
+ }
23
+ #amazon_addressbook_widget, #amazon_wallet_widget {
24
+ height: 228px;
25
+ width: 350px;
26
+ margin: 15px auto;
27
+ }
28
+
29
+ /* Hides entire payment method area, specifically for EU regulations, but not unhelpful for others. */
30
+ div.wpsc-payment-method div:not(.wpsc-form-actions),
31
+ div.wpsc-payment-method p {
32
+ display: none;
33
+ }
34
+
35
+ /* Desktop and tablet */
36
+ @media only screen and (min-width: 768px) {
37
+ #amazon_addressbook_widget, #amazon_wallet_widget {
38
+ width: 100%;
39
+ }
40
+ }
41
+
42
+ .wpsc-controller-payment #amazon_addressbook_widget,
43
+ .wpsc-controller-payment #amazon_wallet_widget {
44
+ height: 150px;
45
+ }
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-de.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "hard" decline, in German.
5
+ *
6
+ * Hard declines indicate the payment method may not be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/hard-decline-email-de.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Sehr geehrter Kunde,
17
+
18
+ Leider wurde die Zahlung zu Ihrer Bestellung in unserem Onlineshop <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ von Amazon Payments zurückgewiesen. Bitte kontaktieren Sie uns.
21
+
22
+ Mit freundlichen Grüßen
23
+
24
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-en.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "hard" decline, in English.
5
+ *
6
+ * Hard declines indicate the payment method may not be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/hard-decline-email-en.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Valued customer,
17
+
18
+ Thank you very much for your order at <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ Amazon Payments was not able to process your payment.
21
+
22
+ Please go to <?php echo esc_url( $url ); ?> and update the payment information for your order.
23
+ Afterwards we will automatically request payment again from Amazon Payments and you will receive a confirmation email.
24
+
25
+ Kind regards,
26
+
27
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-es.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "hard" decline, in Spanish.
5
+ *
6
+ * Hard declines indicate the payment method may not be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/hard-decline-email-es.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Saludos,
17
+
18
+ Desgraciadamente, Amazon Payments ha rechazado el pago de tu pedido en nuestra tienda online <?php echo get_option( 'blogname' ); ?>. Por favor, ponte en contacto con nosotros.
19
+
20
+ Gracias por elegir Pagar con Amazon,
21
+
22
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-fr.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "hard" decline, in French.
5
+ *
6
+ * Hard declines indicate the payment method may not be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/hard-decline-email-fr.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Cher client,
17
+
18
+ Malheureusement Amazon Payments n’a pas pu traier le paiement pour votre commande auprès de <?php echo get_option( 'blogname' ); ?>. Veuillez nous contacter concernant cette commande.
19
+
20
+ Meilleures salutations,
21
+
22
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/hard-decline-email-it.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "hard" decline, in Italian.
5
+ *
6
+ * Hard declines indicate the payment method may not be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/hard-decline-email-it.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Gentile Cliente,
17
+
18
+ Purtroppo Amazon Payments ha rifiutato il pagamento del suo ordine nel nostro negozio on-line <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ Non esiti a contattarci per ulteriori informazioni a riguardo.
21
+
22
+ Cordiali saluti,
23
+
24
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-de.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "soft" decline, in German.
5
+ *
6
+ * Soft declines indicate the payment method may be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/soft-decline-email-de.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Sehr geehrter Kunde,
17
+
18
+ Vielen Dank für Ihre Bestellung bei <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ Leider wurde Ihre Bezahlung von Amazon Payments abgelehnt.
21
+
22
+ Sie können unter <?php echo esc_url( $url ); ?> die Zahlungsinformationen für Ihre Bestellung aktualisieren, indem Sie eine andere Zahlungsweise auswählen oder eine neue Zahlungsweise angeben. Mit der neuen Zahlungsweise wird dann ein erneuter Zahlungsversuch vorgenommen, und Sie erhalten eine Bestätigungsemail.
23
+
24
+ Mit freundlichen Grüßen
25
+
26
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-en.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "soft" decline, in English.
5
+ *
6
+ * Soft declines indicate the payment method may be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/soft-decline-email-en.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Valued customer,
17
+
18
+ Thank you very much for your order at <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ Amazon Payments was not able to process your payment.
21
+
22
+ Please go to <?php echo esc_url( $url ); ?> and update the payment information for your order.
23
+ Afterwards we will automatically request payment again from Amazon Payments and you will receive a confirmation email.
24
+
25
+ Kind regards,
26
+
27
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-es.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "soft" decline, in Spanish.
5
+ *
6
+ * Soft declines indicate the payment method may be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/soft-decline-email-es.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Saludos,
17
+
18
+ Muchas gracias por tu pedido en <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ Desgraciadamente, Amazon Payments ha rechazado tu pago.
21
+
22
+ Por favor, dirígete <?php echo esc_url( $url ); ?> y revisa la información de pago de tu pedido. Una vez hayas actualizado tu información de pago, solicitaremos automáticamente un nuevo pago en Amazon Payments y recibirás un correo electrónico de confirmación.
23
+
24
+ Gracias por elegir Pagar con Amazon,
25
+
26
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-fr.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "soft" decline, in French.
5
+ *
6
+ * Soft declines indicate the payment method may be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/soft-decline-email-fr.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Cher client,
17
+
18
+ Merci pour votre commande auprès de <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ Malheureusement Amazon Payments n’a pas pu traiter le paiement.
21
+
22
+ Veuillez aller sur <?php echo esc_url( $url ); ?> et mettez à jour les informations de paiement pour votre commande. Dans la suite une nouvelle demande de paiement va être demandé à Amazon Payments et vous allez recevoir un email de confirmation.
23
+
24
+ Meilleures salutations,
25
+
26
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/emails/soft-decline-email-it.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template part for the email message for declined transactions in Amazon Payments
4
+ * This message is for the "soft" decline, in Italian.
5
+ *
6
+ * Soft declines indicate the payment method may be retried.
7
+ *
8
+ * Override this template by copying it to theme-folder/wp-e-commerce/emails/soft-decline-email-it.php
9
+ *
10
+ * @author WP eCommerce
11
+ * @package WP-e-Commerce/Templates/Emails
12
+ * @version 4.0
13
+ */
14
+ ?>
15
+
16
+ Gentile Cliente,
17
+
18
+ La ringraziamo molto per il suo ordine a <?php echo get_option( 'blogname' ); ?>.
19
+
20
+ Purtroppo Amazon Payments ha rifiutato il suo pagamento.
21
+
22
+ La preghiamo di andare all'indirizzo <?php echo esc_url( $url ); ?> e aggiornare le informazioni di pagamento per il suo ordine. Automaticamente le verrà nuovamente richiesto da Amazon Payments di procedere col pagamento.
23
+
24
+ Successivamente riceverà una mail di conferma dell'avvenuto pagamento.
25
+
26
+ Cordiali saluti,
27
+
28
+ <?php echo get_option( 'blogname' ); ?>
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/images/amazon-payments.gif ADDED
Binary file
wpsc-components/merchant-core-v3/libraries/amazon-payments/assets/js/amazon-checkout.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function($) {
2
+
3
+ if ( $( '#pay_with_amazon' ).length > 0 ) {
4
+ var authRequest;
5
+ OffAmazonPayments.Button("pay_with_amazon", amazon_payments_advanced_params.seller_id, {
6
+ type: amazon_payments_advanced_params.pwa_type,
7
+ color: amazon_payments_advanced_params.pwa_color,
8
+ size: amazon_payments_advanced_params.pwa_size,
9
+ useAmazonAddressBook: true,
10
+ authorization: function() {
11
+ var loginOptions = { scope: 'profile payments:widget' };
12
+ authRequest = amazon.Login.authorize(loginOptions, amazon_payments_advanced_params.redirect );
13
+ },
14
+ design: {
15
+ designMode: 'responsive'
16
+ },
17
+ onError: function(error) {}
18
+ });
19
+ }
20
+
21
+ var addressBookArgs, walletArgs;
22
+
23
+ addressBookArgs = {
24
+ sellerId: amazon_payments_advanced_params.seller_id,
25
+ design: {
26
+ designMode: 'responsive'
27
+ },
28
+ onOrderReferenceCreate : function( orderReference ) {
29
+ $( '.wpsc-checkout-shipping-and-billing input.wpsc-field-wpsc_submit_checkout' ).prop( 'disabled', true );
30
+ $( 'input[name="amazon_reference_id"]' ).val( orderReference.getAmazonOrderReferenceId() );
31
+ },
32
+ onError: function(error) {
33
+ jQuery( '.wpsc-checkout-form-button' ).prepend( '<div class="errors"><p class="wpsc-alert-error" id="wpsc-alert-error-"' + error.getErrorCode() + '>' + error.getErrorMessage() + '</p></div>' );
34
+ }
35
+ };
36
+
37
+ walletArgs = {
38
+ sellerId: amazon_payments_advanced_params.seller_id,
39
+ design: {
40
+ designMode: 'responsive'
41
+ },
42
+ onPaymentSelect : function( orderReference ) {
43
+ $( '.wpsc-checkout-shipping-and-billing input.wpsc-field-wpsc_submit_checkout' ).prop( 'disabled', false );
44
+ },
45
+ onError: function(error) {
46
+ jQuery( '.wpsc-checkout-form-button' ).prepend( '<div class="errors"><p class="wpsc-alert-error" id="wpsc-alert-error-"' + error.getErrorCode() + '>' + error.getErrorMessage() + '</p></div>' );
47
+ }
48
+ }
49
+
50
+ if ( $( 'body' ).hasClass( 'wpsc-controller-payment' ) ) {
51
+ addressBookArgs.displayMode = walletArgs.displayMode = "Read";
52
+ $( '.wpsc-order-preview' ).before( '<div id="amazon_addressbook_widget"></div><div id="amazon_wallet_widget"></div>' )
53
+ }
54
+
55
+ // Addressbook widget
56
+ new OffAmazonPayments.Widgets.AddressBook( addressBookArgs ).bind( 'amazon_addressbook_widget' );
57
+
58
+ // Wallet widget
59
+ new OffAmazonPayments.Widgets.Wallet( walletArgs ).bind( 'amazon_wallet_widget' );
60
+ });
wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/Client.php ADDED
@@ -0,0 +1,1551 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace PayWithAmazon;
3
+
4
+ /* Class Client
5
+ * Takes configuration information
6
+ * Makes API calls to MWS for Pay With Amazon
7
+ * returns Response Object
8
+ */
9
+
10
+ require_once 'ResponseParser.php';
11
+ require_once 'HttpCurl.php';
12
+ require_once 'Interface.php';
13
+
14
+ class Client implements ClientInterface
15
+ {
16
+ const MWS_CLIENT_VERSION = '1.0.0';
17
+ const SERVICE_VERSION = '2013-01-01';
18
+ const MAX_ERROR_RETRY = 3;
19
+
20
+ // Construct User agent string based off of the application_name, application_version, PHP platform
21
+ private $userAgent = null;
22
+ private $parameters = null;
23
+ private $mwsEndpointPath = null;
24
+ private $mwsEndpointUrl = null;
25
+ private $profileEndpoint = null;
26
+ private $config = array('merchant_id' => null,
27
+ 'secret_key' => null,
28
+ 'access_key' => null,
29
+ 'region' => null,
30
+ 'currency_code' => null,
31
+ 'sandbox' => false,
32
+ 'platform_id' => null,
33
+ 'cabundle_file' => null,
34
+ 'application_name' => null,
35
+ 'application_version' => null,
36
+ 'proxy_host' => null,
37
+ 'proxy_port' => -1,
38
+ 'proxy_username' => null,
39
+ 'proxy_password' => null,
40
+ 'client_id' => null,
41
+ 'handle_throttle' => true
42
+ );
43
+
44
+ private $modePath = null;
45
+
46
+ // Final URL to where the API parameters POST done, based off the config['region'] and respective $mwsServiceUrls
47
+ private $mwsServiceUrl = null;
48
+
49
+ private $mwsServiceUrls = array('eu' => 'mws-eu.amazonservices.com',
50
+ 'na' => 'mws.amazonservices.com',
51
+ 'jp' => 'mws.amazonservices.jp');
52
+
53
+ // Production profile end points to get the user information
54
+ private $liveProfileEndpoint = array('uk' => 'https://api.amazon.co.uk',
55
+ 'us' => 'https://api.amazon.com',
56
+ 'de' => 'https://api.amazon.de',
57
+ 'jp' => 'https://api.amazon.co.jp');
58
+
59
+ // Sandbox profile end points to get the user information
60
+ private $sandboxProfileEndpoint = array('uk' => 'https://api.sandbox.amazon.co.uk',
61
+ 'us' => 'https://api.sandbox.amazon.com',
62
+ 'de' => 'https://api.sandbox.amazon.de',
63
+ 'jp' => 'https://api.sandbox.amazon.co.jp');
64
+
65
+ private $regionMappings = array('de' => 'eu',
66
+ 'uk' => 'eu',
67
+ 'us' => 'na',
68
+ 'jp' => 'jp');
69
+
70
+ // Boolean variable to check if the API call was a success
71
+ public $success = false;
72
+
73
+ /* Takes user configuration array from the user as input
74
+ * Takes JSON file path with configuration information as input
75
+ * Validates the user configuration array against existing config array
76
+ */
77
+
78
+ public function __construct($config = null)
79
+ {
80
+ if (!is_null($config)) {
81
+
82
+ if (is_array($config)) {
83
+ $configArray = $config;
84
+ } elseif (!is_array($config)) {
85
+ $configArray = $this->checkIfFileExists($config);
86
+ }
87
+
88
+ if (is_array($configArray)) {
89
+ $this->checkConfigKeys($configArray);
90
+ } else {
91
+ throw new \Exception('$config is of the incorrect type ' . gettype($configArray) . ' and should be of the type array');
92
+ }
93
+ } else {
94
+ throw new \Exception('$config cannot be null.');
95
+ }
96
+ }
97
+
98
+ /* checkIfFileExists - check if the JSON file exists in the path provided */
99
+
100
+ private function checkIfFileExists($config)
101
+ {
102
+ if(file_exists($config))
103
+ {
104
+ $jsonString = file_get_contents($config);
105
+ $configArray = json_decode($jsonString, true);
106
+
107
+ $jsonError = json_last_error();
108
+
109
+ if ($jsonError != 0) {
110
+ $errorMsg = "Error with message - content is not in json format" . $this->getErrorMessageForJsonError($jsonError) . " " . $configArray;
111
+ throw new \Exception($errorMsg);
112
+ }
113
+ } else {
114
+ $errorMsg ='$config is not a Json File path or the Json File was not found in the path provided';
115
+ throw new \Exception($errorMsg);
116
+ }
117
+ return $configArray;
118
+ }
119
+
120
+ /* Checks if the keys of the input configuration matches the keys in the config array
121
+ * if they match the values are taken else throws exception
122
+ * strict case match is not performed
123
+ */
124
+
125
+ private function checkConfigKeys($config)
126
+ {
127
+ $config = array_change_key_case($config, CASE_LOWER);
128
+
129
+ foreach ($config as $key => $value) {
130
+ if (array_key_exists($key, $this->config)) {
131
+ $this->config[$key] = $value;
132
+ } else {
133
+ throw new \Exception('Key ' . $key . ' is either not part of the configuration or has incorrect Key name.
134
+ check the config array key names to match your key names of your config array', 1);
135
+ }
136
+ }
137
+ }
138
+
139
+ /* Convert a json error code to a descriptive error message
140
+ *
141
+ * @param int $jsonError message code
142
+ *
143
+ * @return string error message
144
+ */
145
+
146
+ private function getErrorMessageForJsonError($jsonError)
147
+ {
148
+ switch ($jsonError) {
149
+ case JSON_ERROR_DEPTH:
150
+ return " - maximum stack depth exceeded.";
151
+ break;
152
+ case JSON_ERROR_STATE_MISMATCH:
153
+ return " - invalid or malformed JSON.";
154
+ break;
155
+ case JSON_ERROR_CTRL_CHAR:
156
+ return " - control character error.";
157
+ break;
158
+ case JSON_ERROR_SYNTAX:
159
+ return " - syntax error.";
160
+ break;
161
+ default:
162
+ return ".";
163
+ break;
164
+ }
165
+ }
166
+
167
+ /* Setter for sandbox
168
+ * Sets the Boolean value for config['sandbox'] variable
169
+ */
170
+
171
+ public function setSandbox($value)
172
+ {
173
+ if (is_bool($value)) {
174
+ $this->config['sandbox'] = $value;
175
+ } else {
176
+ throw new \Exception($value . ' is of type ' . gettype($value) . ' and should be a boolean value');
177
+ }
178
+ }
179
+
180
+ /* Setter for config['client_id']
181
+ * Sets the value for config['client_id'] variable
182
+ */
183
+
184
+ public function setClientId($value)
185
+ {
186
+ if (!empty($value)) {
187
+ $this->config['client_id'] = $value;
188
+ } else {
189
+ throw new \Exception('setter value for client ID provided is empty');
190
+ }
191
+ }
192
+
193
+ /* Setter for Proxy
194
+ * input $proxy [array]
195
+ * @param $proxy['proxy_user_host'] - hostname for the proxy
196
+ * @param $proxy['proxy_user_port'] - hostname for the proxy
197
+ * @param $proxy['proxy_user_name'] - if your proxy required a username
198
+ * @param $proxy['proxy_user_password'] - if your proxy required a password
199
+ */
200
+
201
+ public function setProxy($proxy)
202
+ {
203
+ if (!empty($proxy['proxy_user_host']))
204
+ $this->config['proxy_user_host'] = $proxy['proxy_user_host'];
205
+
206
+ if (!empty($proxy['proxy_user_port']))
207
+ $this->config['proxy_user_port'] = $proxy['proxy_user_port'];
208
+
209
+ if (!empty($proxy['proxy_user_name']))
210
+ $this->config['proxy_user_name'] = $proxy['proxy_user_name'];
211
+
212
+ if (!empty($proxy['proxy_user_password']))
213
+ $this->config['proxy_user_password'] = $proxy['proxy_user_password'];
214
+ }
215
+
216
+ /* Setter for $mwsServiceUrl
217
+ * Set the URL to which the post request has to be made for unit testing
218
+ */
219
+
220
+ public function setMwsServiceUrl($url)
221
+ {
222
+ $this->mwsServiceUrl = $url;
223
+ }
224
+
225
+ /* Getter
226
+ * Gets the value for the key if the key exists in config
227
+ */
228
+
229
+ public function __get($name)
230
+ {
231
+ if (array_key_exists(strtolower($name), $this->config)) {
232
+ return $this->config[strtolower($name)];
233
+ } else {
234
+ throw new \Exception('Key ' . $name . ' is either not a part of the configuration array config or the' . $name . 'does not match the key name in the config array', 1);
235
+ }
236
+ }
237
+
238
+ /* Getter for parameters string
239
+ * Gets the value for the parameters string for unit testing
240
+ */
241
+
242
+ public function getParameters()
243
+ {
244
+ return trim($this->parameters);
245
+ }
246
+
247
+ /* GetUserInfo convenience function - Returns user's profile information from Amazon using the access token returned by the Button widget.
248
+ *
249
+ * @see http://login.amazon.com/website Step 4
250
+ * @param $accessToken [String]
251
+ */
252
+
253
+ public function getUserInfo($accessToken)
254
+ {
255
+ // Get the correct Profile Endpoint URL based off the country/region provided in the config['region']
256
+ $this->profileEndpointUrl();
257
+
258
+ if (empty($accessToken)) {
259
+ throw new \InvalidArgumentException('Access Token is a required parameter and is not set');
260
+ }
261
+
262
+ // To make sure double encoding doesn't occur decode first and encode again.
263
+ $accessToken = urldecode($accessToken);
264
+ $url = $this->profileEndpoint . '/auth/o2/tokeninfo?access_token=' . urlEncode($accessToken);
265
+
266
+ $httpCurlRequest = new HttpCurl();
267
+
268
+ $response = $httpCurlRequest->httpGet($url);
269
+ $data = json_decode($response);
270
+
271
+ if ($data->aud != $this->config['client_id']) {
272
+ // The access token does not belong to us
273
+ throw new \Exception('The Access token entered is incorrect');
274
+ }
275
+
276
+ // Exchange the access token for user profile
277
+ $url = $this->profileEndpoint . '/user/profile';
278
+ $httpCurlRequest = new HttpCurl();
279
+
280
+ $httpCurlRequest->setAccessToken($accessToken);
281
+ $httpCurlRequest->setHttpHeader(true);
282
+ $response = $httpCurlRequest->httpGet($url);
283
+
284
+ $userInfo = json_decode($response, true);
285
+ return $userInfo;
286
+ }
287
+
288
+ /* setParametersAndPost - sets the parameters array with non empty values from the requestParameters array sent to API calls.
289
+ * If Provider Credit Details is present, values are set by setProviderCreditDetails
290
+ * If Provider Credit Reversal Details is present, values are set by setProviderCreditDetails
291
+ */
292
+
293
+ private function setParametersAndPost($parameters, $fieldMappings, $requestParameters)
294
+ {
295
+ /* For loop to take all the non empty parameters in the $requestParameters and add it into the $parameters array,
296
+ * if the keys are matched from $requestParameters array with the $fieldMappings array
297
+ */
298
+ foreach ($requestParameters as $param => $value) {
299
+
300
+ if(!is_array($value)) {
301
+ $value = trim($value);
302
+ }
303
+
304
+ if (array_key_exists($param, $fieldMappings) && $value!='') {
305
+
306
+ if(is_array($value)) {
307
+ // If the parameter is a provider_credit_details or provider_credit_reversal_details, call the respective functions to set the values
308
+ if($param === 'provider_credit_details') {
309
+ $parameters = $this->setProviderCreditDetails($parameters,$value);
310
+ } elseif ($param === 'provider_credit_reversal_details') {
311
+ $parameters = $this->setProviderCreditReversalDetails($parameters,$value);
312
+ }
313
+
314
+ } else{
315
+ // For variables that are boolean values, strtolower them
316
+ if($this->checkIfBool($value))
317
+ {
318
+ $value = strtolower($value);
319
+ }
320
+
321
+ $parameters[$fieldMappings[$param]] = $value;
322
+ }
323
+ }
324
+ }
325
+
326
+ $parameters = $this->setDefaultValues($parameters, $fieldMappings, $requestParameters);
327
+ $responseObject = $this->calculateSignatureAndPost($parameters);
328
+
329
+ return $responseObject;
330
+ }
331
+
332
+ /* checkIfBool - checks if the input is a boolean */
333
+
334
+ private function checkIfBool($string)
335
+ {
336
+ $string = strtolower($string);
337
+ return in_array($string, array('true', 'false'));
338
+ }
339
+
340
+ /* calculateSignatureAndPost - convert the Parameters array to string and curl POST the parameters to MWS */
341
+
342
+ private function calculateSignatureAndPost($parameters)
343
+ {
344
+ // Call the signature and Post function to perform the actions. Returns XML in array format
345
+ $parametersString = $this->calculateSignatureAndParametersToString($parameters);
346
+
347
+ // POST using curl the String converted Parameters
348
+ $response = $this->invokePost($parametersString);
349
+
350
+ // Send this response as args to ResponseParser class which will return the object of the class.
351
+ $responseObject = new ResponseParser($response);
352
+ return $responseObject;
353
+ }
354
+
355
+ /* If merchant_id is not set via the requestParameters array then it's taken from the config array
356
+ *
357
+ * Set the platform_id if set in the config['platform_id'] array
358
+ *
359
+ * If currency_code is set in the $requestParameters and it exists in the $fieldMappings array, strtoupper it
360
+ * else take the value from config array if set
361
+ */
362
+
363
+ private function setDefaultValues($parameters, $fieldMappings, $requestParameters)
364
+ {
365
+ if (empty($requestParameters['merchant_id']))
366
+ $parameters['SellerId'] = $this->config['merchant_id'];
367
+
368
+ if (array_key_exists('platform_id', $fieldMappings)) {
369
+ if (empty($requestParameters['platform_id']) && !empty($this->config['platform_id']))
370
+ $parameters[$fieldMappings['platform_id']] = $this->config['platform_id'];
371
+ }
372
+
373
+ if (array_key_exists('currency_code', $fieldMappings)) {
374
+ if (!empty($requestParameters['currency_code'])) {
375
+ $parameters[$fieldMappings['currency_code']] = strtoupper($requestParameters['currency_code']);
376
+ } else {
377
+ $parameters[$fieldMappings['currency_code']] = strtoupper($this->config['currency_code']);
378
+ }
379
+ }
380
+
381
+ return $parameters;
382
+ }
383
+
384
+ /* setProviderCreditDetails - sets the provider credit details sent via the Capture or Authorize API calls
385
+ * @param provider_id - [String]
386
+ * @param credit_amount - [String]
387
+ * @optional currency_code - [String]
388
+ */
389
+
390
+ private function setProviderCreditDetails($parameters, $providerCreditInfo)
391
+ {
392
+ $providerIndex = 0;
393
+ $providerString = 'ProviderCreditList.member.';
394
+
395
+ $fieldMappings = array(
396
+ 'provider_id' => 'ProviderId',
397
+ 'credit_amount' => 'CreditAmount.Amount',
398
+ 'currency_code' => 'CreditAmount.CurrencyCode'
399
+ );
400
+
401
+ foreach ($providerCreditInfo as $key => $value)
402
+ {
403
+ $value = array_change_key_case($value, CASE_LOWER);
404
+ $providerIndex = $providerIndex + 1;
405
+
406
+ foreach ($value as $param => $val)
407
+ {
408
+ if (array_key_exists($param, $fieldMappings) && trim($val)!='') {
409
+ $parameters[$providerString.$providerIndex. '.' .$fieldMappings[$param]] = $val;
410
+ }
411
+ }
412
+
413
+ // If currency code is not entered take it from the config array
414
+ if(empty($parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']]))
415
+ {
416
+ $parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']] = strtoupper($this->config['currency_code']);
417
+ }
418
+ }
419
+
420
+ return $parameters;
421
+ }
422
+
423
+ /* setProviderCreditReversalDetails - sets the reverse provider credit details sent via the Refund API call.
424
+ * @param provider_id - [String]
425
+ * @param credit_amount - [String]
426
+ * @optional currency_code - [String]
427
+ */
428
+
429
+ private function setProviderCreditReversalDetails($parameters, $providerCreditInfo)
430
+ {
431
+ $providerIndex = 0;
432
+ $providerString = 'ProviderCreditReversalList.member.';
433
+
434
+ $fieldMappings = array(
435
+ 'provider_id' => 'ProviderId',
436
+ 'credit_reversal_amount' => 'CreditReversalAmount.Amount',
437
+ 'currency_code' => 'CreditReversalAmount.CurrencyCode'
438
+ );
439
+
440
+ foreach ($providerCreditInfo as $key => $value)
441
+ {
442
+ $value = array_change_key_case($value, CASE_LOWER);
443
+ $providerIndex = $providerIndex + 1;
444
+
445
+ foreach ($value as $param => $val)
446
+ {
447
+ if (array_key_exists($param, $fieldMappings) && trim($val)!='') {
448
+ $parameters[$providerString.$providerIndex. '.' .$fieldMappings[$param]] = $val;
449
+ }
450
+ }
451
+
452
+ // If currency code is not entered take it from the config array
453
+ if(empty($parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']]))
454
+ {
455
+ $parameters[$providerString.$providerIndex. '.' .$fieldMappings['currency_code']] = strtoupper($this->config['currency_code']);
456
+ }
457
+ }
458
+
459
+ return $parameters;
460
+ }
461
+
462
+ /* GetOrderReferenceDetails API call - Returns details about the Order Reference object and its current state.
463
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetOrderReferenceDetails.html
464
+ *
465
+ * @param requestParameters['merchant_id'] - [String]
466
+ * @param requestParameters['amazon_order_reference_id'] - [String]
467
+ * @optional requestParameters['address_consent_token'] - [String]
468
+ * @optional requestParameters['mws_auth_token'] - [String]
469
+ */
470
+
471
+ public function getOrderReferenceDetails($requestParameters = array())
472
+ {
473
+
474
+ $parameters['Action'] = 'GetOrderReferenceDetails';
475
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
476
+
477
+ $fieldMappings = array(
478
+ 'merchant_id' => 'SellerId',
479
+ 'amazon_order_reference_id' => 'AmazonOrderReferenceId',
480
+ 'address_consent_token' => 'AddressConsentToken',
481
+ 'mws_auth_token' => 'MWSAuthToken'
482
+ );
483
+
484
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
485
+ return ($responseObject);
486
+ }
487
+
488
+ /* SetOrderReferenceDetails API call - Sets order reference details such as the order total and a description for the order.
489
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetOrderReferenceDetails.html
490
+ *
491
+ * @param requestParameters['merchant_id'] - [String]
492
+ * @param requestParameters['amazon_order_reference_id'] - [String]
493
+ * @param requestParameters['amount'] - [String]
494
+ * @param requestParameters['currency_code'] - [String]
495
+ * @optional requestParameters['platform_id'] - [String]
496
+ * @optional requestParameters['seller_note'] - [String]
497
+ * @optional requestParameters['seller_order_id'] - [String]
498
+ * @optional requestParameters['store_name'] - [String]
499
+ * @optional requestParameters['custom_information'] - [String]
500
+ * @optional requestParameters['mws_auth_token'] - [String]
501
+ */
502
+
503
+ public function setOrderReferenceDetails($requestParameters = array())
504
+ {
505
+ $parameters = array();
506
+ $parameters['Action'] = 'SetOrderReferenceDetails';
507
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
508
+
509
+ $fieldMappings = array(
510
+ 'merchant_id' => 'SellerId',
511
+ 'amazon_order_reference_id' => 'AmazonOrderReferenceId',
512
+ 'amount' => 'OrderReferenceAttributes.OrderTotal.Amount',
513
+ 'currency_code' => 'OrderReferenceAttributes.OrderTotal.CurrencyCode',
514
+ 'platform_id' => 'OrderReferenceAttributes.PlatformId',
515
+ 'seller_note' => 'OrderReferenceAttributes.SellerNote',
516
+ 'seller_order_id' => 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId',
517
+ 'store_name' => 'OrderReferenceAttributes.SellerOrderAttributes.StoreName',
518
+ 'custom_information' => 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation',
519
+ 'mws_auth_token' => 'MWSAuthToken'
520
+ );
521
+
522
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
523
+
524
+ return ($responseObject);
525
+ }
526
+
527
+ /* ConfirmOrderReferenceDetails API call - Confirms that the order reference is free of constraints and all required information has been set on the order reference.
528
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmOrderReference.html
529
+
530
+ * @param requestParameters['merchant_id'] - [String]
531
+ * @param requestParameters['amazon_order_reference_id'] - [String]
532
+ * @optional requestParameters['mws_auth_token'] - [String]
533
+ */
534
+
535
+ public function confirmOrderReference($requestParameters = array())
536
+ {
537
+ $parameters = array();
538
+ $parameters['Action'] = 'ConfirmOrderReference';
539
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
540
+
541
+ $fieldMappings = array(
542
+ 'merchant_id' => 'SellerId',
543
+ 'amazon_order_reference_id' => 'AmazonOrderReferenceId',
544
+ 'mws_auth_token' => 'MWSAuthToken'
545
+ );
546
+
547
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
548
+
549
+ return ($responseObject);
550
+ }
551
+
552
+ /* CancelOrderReferenceDetails API call - Cancels a previously confirmed order reference.
553
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CancelOrderReference.html
554
+ *
555
+ * @param requestParameters['merchant_id'] - [String]
556
+ * @param requestParameters['amazon_order_reference_id'] - [String]
557
+ * @optional requestParameters['cancelation_reason'] [String]
558
+ * @optional requestParameters['mws_auth_token'] - [String]
559
+ */
560
+
561
+ public function cancelOrderReference($requestParameters = array())
562
+ {
563
+ $parameters = array();
564
+ $parameters['Action'] = 'CancelOrderReference';
565
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
566
+
567
+ $fieldMappings = array(
568
+ 'merchant_id' => 'SellerId',
569
+ 'amazon_order_reference_id' => 'AmazonOrderReferenceId',
570
+ 'cancelation_reason' => 'CancelationReason',
571
+ 'mws_auth_token' => 'MWSAuthToken'
572
+ );
573
+
574
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
575
+
576
+ return ($responseObject);
577
+ }
578
+
579
+ /* CloseOrderReferenceDetails API call - Confirms that an order reference has been fulfilled (fully or partially)
580
+ * and that you do not expect to create any new authorizations on this order reference.
581
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
582
+ *
583
+ * @param requestParameters['merchant_id'] - [String]
584
+ * @param requestParameters['amazon_order_reference_id'] - [String]
585
+ * @optional requestParameters['closure_reason'] [String]
586
+ * @optional requestParameters['mws_auth_token'] - [String]
587
+ */
588
+
589
+ public function closeOrderReference($requestParameters = array())
590
+ {
591
+ $parameters = array();
592
+ $parameters['Action'] = 'CloseOrderReference';
593
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
594
+
595
+ $fieldMappings = array(
596
+ 'merchant_id' => 'SellerId',
597
+ 'amazon_order_reference_id' => 'AmazonOrderReferenceId',
598
+ 'closure_reason' => 'ClosureReason',
599
+ 'mws_auth_token' => 'MWSAuthToken'
600
+ );
601
+
602
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
603
+
604
+ return ($responseObject);
605
+ }
606
+
607
+ /* CloseAuthorization API call - Closes an authorization.
608
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
609
+ *
610
+ * @param requestParameters['merchant_id'] - [String]
611
+ * @param requestParameters['amazon_authorization_id'] - [String]
612
+ * @optional requestParameters['closure_reason'] [String]
613
+ * @optional requestParameters['mws_auth_token'] - [String]
614
+ */
615
+
616
+ public function closeAuthorization($requestParameters = array())
617
+ {
618
+ $parameters = array();
619
+ $parameters['Action'] = 'CloseAuthorization';
620
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
621
+
622
+ $fieldMappings = array(
623
+ 'merchant_id' => 'SellerId',
624
+ 'amazon_authorization_id' => 'AmazonAuthorizationId',
625
+ 'closure_reason' => 'ClosureReason',
626
+ 'mws_auth_token' => 'MWSAuthToken'
627
+ );
628
+
629
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
630
+
631
+ return ($responseObject);
632
+ }
633
+
634
+ /* Authorize API call - Reserves a specified amount against the payment method(s) stored in the order reference.
635
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
636
+ *
637
+ * @param requestParameters['merchant_id'] - [String]
638
+ * @param requestParameters['amazon_order_reference_id'] - [String]
639
+ * @param requestParameters['authorization_amount'] [String]
640
+ * @param requestParameters['currency_code'] - [String]
641
+ * @param requestParameters['authorization_reference_id'] [String]
642
+ * @optional requestParameters['capture_now'] [String]
643
+ * @optional requestParameters['provider_credit_details'] - [array (array())]
644
+ * @optional requestParameters['seller_authorization_note'] [String]
645
+ * @optional requestParameters['transaction_timeout'] [String] - Defaults to 1440 minutes
646
+ * @optional requestParameters['soft_descriptor'] - [String]
647
+ * @optional requestParameters['mws_auth_token'] - [String]
648
+ */
649
+
650
+ public function authorize($requestParameters = array())
651
+ {
652
+ $parameters = array();
653
+ $parameters['Action'] = 'Authorize';
654
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
655
+
656
+ $fieldMappings = array(
657
+ 'merchant_id' => 'SellerId',
658
+ 'amazon_order_reference_id' => 'AmazonOrderReferenceId',
659
+ 'authorization_amount' => 'AuthorizationAmount.Amount',
660
+ 'currency_code' => 'AuthorizationAmount.CurrencyCode',
661
+ 'authorization_reference_id' => 'AuthorizationReferenceId',
662
+ 'capture_now' => 'CaptureNow',
663
+ 'provider_credit_details' => array(),
664
+ 'seller_authorization_note' => 'SellerAuthorizationNote',
665
+ 'transaction_timeout' => 'TransactionTimeout',
666
+ 'soft_descriptor' => 'SoftDescriptor',
667
+ 'mws_auth_token' => 'MWSAuthToken'
668
+ );
669
+
670
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
671
+
672
+ return ($responseObject);
673
+ }
674
+
675
+ /* GetAuthorizationDetails API call - Returns the status of a particular authorization and the total amount captured on the authorization.
676
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetAuthorizationDetails.html
677
+ *
678
+ * @param requestParameters['merchant_id'] - [String]
679
+ * @param requestParameters['amazon_authorization_id'] [String]
680
+ * @optional requestParameters['mws_auth_token'] - [String]
681
+ */
682
+
683
+ public function getAuthorizationDetails($requestParameters = array())
684
+ {
685
+ $parameters = array();
686
+ $parameters['Action'] = 'GetAuthorizationDetails';
687
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
688
+
689
+ $fieldMappings = array(
690
+ 'merchant_id' => 'SellerId',
691
+ 'amazon_authorization_id' => 'AmazonAuthorizationId',
692
+ 'mws_auth_token' => 'MWSAuthToken'
693
+ );
694
+
695
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
696
+
697
+ return ($responseObject);
698
+ }
699
+
700
+ /* Capture API call - Captures funds from an authorized payment instrument.
701
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Capture.html
702
+ *
703
+ * @param requestParameters['merchant_id'] - [String]
704
+ * @param requestParameters['amazon_authorization_id'] - [String]
705
+ * @param requestParameters['capture_amount'] - [String]
706
+ * @param requestParameters['currency_code'] - [String]
707
+ * @param requestParameters['capture_reference_id'] - [String]
708
+ * @optional requestParameters['provider_credit_details'] - [array (array())]
709
+ * @optional requestParameters['seller_capture_note'] - [String]
710
+ * @optional requestParameters['soft_descriptor'] - [String]
711
+ * @optional requestParameters['mws_auth_token'] - [String]
712
+ */
713
+
714
+ public function capture($requestParameters = array())
715
+ {
716
+ $parameters = array();
717
+ $parameters['Action'] = 'Capture';
718
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
719
+
720
+ $fieldMappings = array(
721
+ 'merchant_id' => 'SellerId',
722
+ 'amazon_authorization_id' => 'AmazonAuthorizationId',
723
+ 'capture_amount' => 'CaptureAmount.Amount',
724
+ 'currency_code' => 'CaptureAmount.CurrencyCode',
725
+ 'capture_reference_id' => 'CaptureReferenceId',
726
+ 'provider_credit_details' => array(),
727
+ 'seller_capture_note' => 'SellerCaptureNote',
728
+ 'soft_descriptor' => 'SoftDescriptor',
729
+ 'mws_auth_token' => 'MWSAuthToken'
730
+ );
731
+
732
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
733
+
734
+ return ($responseObject);
735
+ }
736
+
737
+ /* GetCaptureDetails API call - Returns the status of a particular capture and the total amount refunded on the capture.
738
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetCaptureDetails.html
739
+ *
740
+ * @param requestParameters['merchant_id'] - [String]
741
+ * @param requestParameters['amazon_capture_id'] - [String]
742
+ * @optional requestParameters['mws_auth_token'] - [String]
743
+ */
744
+
745
+ public function getCaptureDetails($requestParameters = array())
746
+ {
747
+ $parameters = array();
748
+ $parameters['Action'] = 'GetCaptureDetails';
749
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
750
+
751
+ $fieldMappings = array(
752
+ 'merchant_id' => 'SellerId',
753
+ 'amazon_capture_id' => 'AmazonCaptureId',
754
+ 'mws_auth_token' => 'MWSAuthToken'
755
+ );
756
+
757
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
758
+
759
+ return ($responseObject);
760
+ }
761
+
762
+ /* Refund API call - Refunds a previously captured amount.
763
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Refund.html
764
+ *
765
+ * @param requestParameters['merchant_id'] - [String]
766
+ * @param requestParameters['amazon_capture_id'] - [String]
767
+ * @param requestParameters['refund_reference_id'] - [String]
768
+ * @param requestParameters['refund_amount'] - [String]
769
+ * @param requestParameters['currency_code'] - [String]
770
+ * @optional requestParameters['provider_credit_reversal_details'] - [array(array())]
771
+ * @optional requestParameters['seller_refund_note'] [String]
772
+ * @optional requestParameters['soft_descriptor'] - [String]
773
+ * @optional requestParameters['mws_auth_token'] - [String]
774
+ */
775
+
776
+ public function refund($requestParameters = array())
777
+ {
778
+ $parameters = array();
779
+ $parameters['Action'] = 'Refund';
780
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
781
+
782
+ $fieldMappings = array(
783
+ 'merchant_id' => 'SellerId',
784
+ 'amazon_capture_id' => 'AmazonCaptureId',
785
+ 'refund_reference_id' => 'RefundReferenceId',
786
+ 'refund_amount' => 'RefundAmount.Amount',
787
+ 'currency_code' => 'RefundAmount.CurrencyCode',
788
+ 'provider_credit_reversal_details' => array(),
789
+ 'seller_refund_note' => 'SellerRefundNote',
790
+ 'soft_descriptor' => 'SoftDescriptor',
791
+ 'mws_auth_token' => 'MWSAuthToken'
792
+ );
793
+
794
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
795
+
796
+ return ($responseObject);
797
+ }
798
+
799
+ /* GetRefundDetails API call - Returns the status of a particular refund.
800
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetRefundDetails.html
801
+ *
802
+ * @param requestParameters['merchant_id'] - [String]
803
+ * @param requestParameters['amazon_refund_id'] - [String]
804
+ * @optional requestParameters['mws_auth_token'] - [String]
805
+ */
806
+
807
+ public function getRefundDetails($requestParameters = array())
808
+ {
809
+ $parameters = array();
810
+ $parameters['Action'] = 'GetRefundDetails';
811
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
812
+
813
+ $fieldMappings = array(
814
+ 'merchant_id' => 'SellerId',
815
+ 'amazon_refund_id' => 'AmazonRefundId',
816
+ 'mws_auth_token' => 'MWSAuthToken'
817
+ );
818
+
819
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
820
+
821
+ return ($responseObject);
822
+ }
823
+
824
+ /* GetServiceStatus API Call - Returns the operational status of the Off-Amazon Payments API section
825
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetServiceStatus.html
826
+ *
827
+ * The GetServiceStatus operation returns the operational status of the Off-Amazon Payments API
828
+ * section of Amazon Marketplace Web Service (Amazon MWS).
829
+ * Status values are GREEN, GREEN_I, YELLOW, and RED.
830
+ *
831
+ * @param requestParameters['merchant_id'] - [String]
832
+ * @optional requestParameters['mws_auth_token'] - [String]
833
+ */
834
+
835
+ public function getServiceStatus($requestParameters = array())
836
+ {
837
+ $parameters = array();
838
+ $parameters['Action'] = 'GetServiceStatus';
839
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
840
+
841
+ $fieldMappings = array(
842
+ 'merchant_id' => 'SellerId',
843
+ 'mws_auth_token' => 'MWSAuthToken'
844
+ );
845
+
846
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
847
+
848
+ return ($responseObject);
849
+ }
850
+
851
+ /* CreateOrderReferenceForId API Call - Creates an order reference for the given object
852
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CreateOrderReferenceForId.html
853
+ *
854
+ * @param requestParameters['merchant_id'] - [String]
855
+ * @param requestParameters['Id'] - [String]
856
+ * @optional requestParameters['inherit_shipping_address'] [Boolean]
857
+ * @optional requestParameters['ConfirmNow'] - [Boolean]
858
+ * @optional Amount (required when confirm_now is set to true) [String]
859
+ * @optional requestParameters['currency_code'] - [String]
860
+ * @optional requestParameters['seller_note'] - [String]
861
+ * @optional requestParameters['seller_order_id'] - [String]
862
+ * @optional requestParameters['store_name'] - [String]
863
+ * @optional requestParameters['custom_information'] - [String]
864
+ * @optional requestParameters['mws_auth_token'] - [String]
865
+ */
866
+
867
+ public function createOrderReferenceForId($requestParameters = array())
868
+ {
869
+ $parameters = array();
870
+ $parameters['Action'] = 'CreateOrderReferenceForId';
871
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
872
+
873
+ $fieldMappings = array(
874
+ 'merchant_id' => 'SellerId',
875
+ 'id' => 'Id',
876
+ 'id_type' => 'IdType',
877
+ 'inherit_shipping_address' => 'InheritShippingAddress',
878
+ 'confirm_now' => 'ConfirmNow',
879
+ 'amount' => 'OrderReferenceAttributes.OrderTotal.Amount',
880
+ 'currency_code' => 'OrderReferenceAttributes.OrderTotal.CurrencyCode',
881
+ 'platform_id' => 'OrderReferenceAttributes.PlatformId',
882
+ 'seller_note' => 'OrderReferenceAttributes.SellerNote',
883
+ 'seller_order_id' => 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId',
884
+ 'store_name' => 'OrderReferenceAttributes.SellerOrderAttributes.StoreName',
885
+ 'custom_information' => 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation',
886
+ 'mws_auth_token' => 'MWSAuthToken'
887
+ );
888
+
889
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
890
+
891
+ return ($responseObject);
892
+ }
893
+
894
+ /* GetBillingAgreementDetails API Call - Returns details about the Billing Agreement object and its current state.
895
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetBillingAgreementDetails.html
896
+ *
897
+ * @param requestParameters['merchant_id'] - [String]
898
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
899
+ * @optional requestParameters['mws_auth_token'] - [String]
900
+ */
901
+
902
+ public function getBillingAgreementDetails($requestParameters = array())
903
+ {
904
+ $parameters = array();
905
+ $parameters['Action'] = 'GetBillingAgreementDetails';
906
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
907
+
908
+ $fieldMappings = array(
909
+ 'merchant_id' => 'SellerId',
910
+ 'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
911
+ 'address_consent_token' => 'AddressConsentToken',
912
+ 'mws_auth_token' => 'MWSAuthToken'
913
+ );
914
+
915
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
916
+
917
+ return ($responseObject);
918
+ }
919
+
920
+ /* SetBillingAgreementDetails API call - Sets Billing Agreement details such as a description of the agreement and other information about the seller.
921
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetBillingAgreementDetails.html
922
+ *
923
+ * @param requestParameters['merchant_id'] - [String]
924
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
925
+ * @param requestParameters['amount'] - [String]
926
+ * @param requestParameters['currency_code'] - [String]
927
+ * @optional requestParameters['platform_id'] - [String]
928
+ * @optional requestParameters['seller_note'] - [String]
929
+ * @optional requestParameters['seller_billing_agreement_id'] - [String]
930
+ * @optional requestParameters['store_name'] - [String]
931
+ * @optional requestParameters['custom_information'] - [String]
932
+ * @optional requestParameters['mws_auth_token'] - [String]
933
+ */
934
+
935
+ public function setBillingAgreementDetails($requestParameters = array())
936
+ {
937
+ $parameters = array();
938
+ $parameters['Action'] = 'SetBillingAgreementDetails';
939
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
940
+
941
+ $fieldMappings = array(
942
+ 'merchant_id' => 'SellerId',
943
+ 'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
944
+ 'platform_id' => 'BillingAgreementAttributes.PlatformId',
945
+ 'seller_note' => 'BillingAgreementAttributes.SellerNote',
946
+ 'seller_billing_agreement_id' => 'BillingAgreementAttributes.SellerBillingAgreementAttributes.SellerBillingAgreementId',
947
+ 'custom_information' => 'BillingAgreementAttributes.SellerBillingAgreementAttributes.CustomInformation',
948
+ 'store_name' => 'BillingAgreementAttributes.SellerBillingAgreementAttributes.StoreName',
949
+ 'mws_auth_token' => 'MWSAuthToken'
950
+ );
951
+
952
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
953
+
954
+ return ($responseObject);
955
+ }
956
+
957
+ /* ConfirmBillingAgreement API Call - Confirms that the Billing Agreement is free of constraints and all required information has been set on the Billing Agreement.
958
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmBillingAgreement.html
959
+ *
960
+ * @param requestParameters['merchant_id'] - [String]
961
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
962
+ * @optional requestParameters['mws_auth_token'] - [String]
963
+ */
964
+
965
+ public function confirmBillingAgreement($requestParameters = array())
966
+ {
967
+ $parameters = array();
968
+ $parameters['Action'] = 'ConfirmBillingAgreement';
969
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
970
+
971
+ $fieldMappings = array(
972
+ 'merchant_id' => 'SellerId',
973
+ 'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
974
+ 'mws_auth_token' => 'MWSAuthToken'
975
+ );
976
+
977
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
978
+
979
+ return ($responseObject);
980
+ }
981
+
982
+ /* ValidateBillignAgreement API Call - Validates the status of the Billing Agreement object and the payment method associated with it.
983
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ValidateBillingAgreement.html
984
+ *
985
+ * @param requestParameters['merchant_id'] - [String]
986
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
987
+ * @optional requestParameters['mws_auth_token'] - [String]
988
+ */
989
+
990
+ public function validateBillingAgreement($requestParameters = array())
991
+ {
992
+ $parameters = array();
993
+ $parameters['Action'] = 'ValidateBillingAgreement';
994
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
995
+
996
+ $fieldMappings = array(
997
+ 'merchant_id' => 'SellerId',
998
+ 'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
999
+ 'mws_auth_token' => 'MWSAuthToken'
1000
+ );
1001
+
1002
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
1003
+
1004
+ return ($responseObject);
1005
+ }
1006
+
1007
+ /* AuthorizeOnBillingAgreement API call - Reserves a specified amount against the payment method(s) stored in the Billing Agreement.
1008
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_AuthorizeOnBillingAgreement.html
1009
+ *
1010
+ * @param requestParameters['merchant_id'] - [String]
1011
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
1012
+ * @param requestParameters['authorization_reference_id'] [String]
1013
+ * @param requestParameters['authorization_amount'] [String]
1014
+ * @param requestParameters['currency_code'] - [String]
1015
+ * @optional requestParameters['seller_authorization_note'] [String]
1016
+ * @optional requestParameters['transaction_timeout'] - Defaults to 1440 minutes
1017
+ * @optional requestParameters['capture_now'] [String]
1018
+ * @optional requestParameters['soft_descriptor'] - - [String]
1019
+ * @optional requestParameters['seller_note'] - [String]
1020
+ * @optional requestParameters['platform_id'] - [String]
1021
+ * @optional requestParameters['custom_information'] - [String]
1022
+ * @optional requestParameters['seller_order_id'] - [String]
1023
+ * @optional requestParameters['store_name'] - [String]
1024
+ * @optional requestParameters['inherit_shipping_address'] [Boolean] - Defaults to true
1025
+ * @optional requestParameters['mws_auth_token'] - [String]
1026
+ */
1027
+
1028
+ public function authorizeOnBillingAgreement($requestParameters = array())
1029
+ {
1030
+ $parameters = array();
1031
+ $parameters['Action'] = 'AuthorizeOnBillingAgreement';
1032
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
1033
+
1034
+ $fieldMappings = array(
1035
+ 'merchant_id' => 'SellerId',
1036
+ 'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
1037
+ 'authorization_reference_id' => 'AuthorizationReferenceId',
1038
+ 'authorization_amount' => 'AuthorizationAmount.Amount',
1039
+ 'currency_code' => 'AuthorizationAmount.CurrencyCode',
1040
+ 'seller_authorization_note' => 'SellerAuthorizationNote',
1041
+ 'transaction_timeout' => 'TransactionTimeout',
1042
+ 'capture_now' => 'CaptureNow',
1043
+ 'soft_descriptor' => 'SoftDescriptor',
1044
+ 'seller_note' => 'SellerNote',
1045
+ 'platform_id' => 'PlatformId',
1046
+ 'custom_information' => 'SellerOrderAttributes.CustomInformation',
1047
+ 'seller_order_id' => 'SellerOrderAttributes.SellerOrderId',
1048
+ 'store_name' => 'SellerOrderAttributes.StoreName',
1049
+ 'inherit_shipping_address' => 'InheritShippingAddress',
1050
+ 'mws_auth_token' => 'MWSAuthToken'
1051
+ );
1052
+
1053
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
1054
+
1055
+ return ($responseObject);
1056
+ }
1057
+
1058
+ /* CloseBillingAgreement API Call - Returns details about the Billing Agreement object and its current state.
1059
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseBillingAgreement.html
1060
+ *
1061
+ * @param requestParameters['merchant_id'] - [String]
1062
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
1063
+ * @optional requestParameters['closure_reason'] [String]
1064
+ * @optional requestParameters['mws_auth_token'] - [String]
1065
+ */
1066
+
1067
+ public function closeBillingAgreement($requestParameters = array())
1068
+ {
1069
+ $parameters = array();
1070
+ $parameters['Action'] = 'CloseBillingAgreement';
1071
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
1072
+
1073
+ $fieldMappings = array(
1074
+ 'merchant_id' => 'SellerId',
1075
+ 'amazon_billing_agreement_id' => 'AmazonBillingAgreementId',
1076
+ 'closure_reason' => 'ClosureReason',
1077
+ 'mws_auth_token' => 'MWSAuthToken'
1078
+ );
1079
+
1080
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
1081
+
1082
+ return ($responseObject);
1083
+ }
1084
+
1085
+ /* charge convenience method
1086
+ * Performs the API calls
1087
+ * 1. SetOrderReferenceDetails / SetBillingAgreementDetails
1088
+ * 2. ConfirmOrderReference / ConfirmBillingAgreement
1089
+ * 3. Authorize (with Capture) / AuthorizeOnBillingAgreeemnt (with Capture)
1090
+ *
1091
+ * @param requestParameters['merchant_id'] - [String]
1092
+ * @param requestParameters['amazon_reference_id'] - [String] : Order Reference ID /Billing Agreement ID
1093
+ * @param $requestParameters['charge_amount'] - [String] : Amount value to be captured
1094
+ * @param requestParameters['currency_code'] - [String] : Currency Code for the Amount
1095
+ * @param requestParameters['authorization_reference_id'] - [String]- Any unique string that needs to be passed
1096
+ * @optional requestParameters['charge_note'] - [String] : Seller Note sent to the buyer
1097
+ * @optional requestParameters['transaction_timeout'] - [String] : Defaults to 1440 minutes
1098
+ * @optional requestParameters['charge_order_id'] - [String] : Custom Order ID provided
1099
+ * @optional requestParameters['mws_auth_token'] - [String]
1100
+ */
1101
+
1102
+ public function charge($requestParameters = array()) {
1103
+
1104
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
1105
+
1106
+ $setParameters = $authorizeParameters = $confirmParameters = $requestParameters;
1107
+
1108
+ $chargeType = '';
1109
+
1110
+ if (!empty($requestParameters['amazon_reference_id'])) {
1111
+ switch (substr(strtoupper($requestParameters['amazon_reference_id']), 0, 1)) {
1112
+ case 'P':
1113
+ case 'S':
1114
+ $chargeType = 'OrderReference';
1115
+ $setParameters['amazon_order_reference_id'] = $requestParameters['amazon_reference_id'];
1116
+ $authorizeParameters['amazon_order_reference_id'] = $requestParameters['amazon_reference_id'];
1117
+ $confirmParameters['amazon_order_reference_id'] = $requestParameters['amazon_reference_id'];
1118
+ break;
1119
+ case 'B':
1120
+ case 'C':
1121
+ $chargeType = 'BillingAgreement';
1122
+ $setParameters['amazon_billing_agreement_id'] = $requestParameters['amazon_reference_id'];
1123
+ $authorizeParameters['amazon_billing_agreement_id'] = $requestParameters['amazon_reference_id'];
1124
+ $confirmParameters['amazon_billing_agreement_id'] = $requestParameters['amazon_reference_id'];
1125
+ break;
1126
+ default:
1127
+ throw new \Exception('Invalid Amazon Reference ID');
1128
+ }
1129
+ } else {
1130
+ throw new \Exception('key amazon_reference_id is null and is a required parameter');
1131
+ }
1132
+
1133
+ // Set the other parameters if the values are present
1134
+ $setParameters['amount'] = !empty($requestParameters['charge_amount']) ? $requestParameters['charge_amount'] : '';
1135
+ $authorizeParameters['authorization_amount'] = !empty($requestParameters['charge_amount']) ? $requestParameters['charge_amount'] : '';
1136
+
1137
+ $setParameters['seller_note'] = !empty($requestParameters['charge_note']) ? $requestParameters['charge_note'] : '';
1138
+ $authorizeParameters['seller_authorization_note'] = !empty($requestParameters['charge_note']) ? $requestParameters['charge_note'] : '';
1139
+ $authorizeParameters['seller_note'] = !empty($requestParameters['charge_note']) ? $requestParameters['charge_note'] : '';
1140
+
1141
+ $setParameters['seller_order_id'] = !empty($requestParameters['charge_order_id']) ? $requestParameters['charge_order_id'] : '';
1142
+ $setParameters['seller_billing_agreement_id'] = !empty($requestParameters['charge_order_id']) ? $requestParameters['charge_order_id'] : '';
1143
+ $authorizeParameters['seller_order_id'] = !empty($requestParameters['charge_order_id']) ? $requestParameters['charge_order_id'] : '';
1144
+
1145
+ $authorizeParameters['capture_now'] = 'true';
1146
+
1147
+ $response = $this->makeChargeCalls($chargeType, $setParameters, $confirmParameters, $authorizeParameters);
1148
+ return $response;
1149
+ }
1150
+
1151
+ /* makeChargeCalls - makes API calls based off the charge type (OrderReference or BillingAgreement) */
1152
+
1153
+ private function makeChargeCalls($chargeType, $setParameters, $confirmParameters, $authorizeParameters)
1154
+ {
1155
+ switch ($chargeType) {
1156
+ case 'OrderReference':
1157
+ $response = $this->setOrderReferenceDetails($setParameters);
1158
+ if ($this->success) {
1159
+ $this->confirmOrderReference($confirmParameters);
1160
+ }
1161
+ if ($this->success) {
1162
+ $response = $this->Authorize($authorizeParameters);
1163
+ }
1164
+ return $response;
1165
+ case 'BillingAgreement':
1166
+ // Get the Billing Agreement details and feed the response object to the ResponseParser
1167
+ $responseObj = $this->getBillingAgreementDetails($setParameters);
1168
+ // Call the function GetBillingAgreementDetailsStatus in ResponseParser.php providing it the XML response
1169
+ // $baStatus is an aray containing the State of the Billing Agreement
1170
+ $baStatus = $responseObj->getBillingAgreementDetailsStatus($responseObj->toXml());
1171
+ if ($baStatus['State'] != 'Open') {
1172
+ $response = $this->SetBillingAgreementDetails($setParameters);
1173
+ if ($this->success) {
1174
+ $response = $this->ConfirmBillingAgreement($confirmParameters);
1175
+ }
1176
+ }
1177
+ // Check the Billing Agreement status again before making the Authorization.
1178
+ $responseObj = $this->getBillingAgreementDetails($setParameters);
1179
+ $baStatus = $responseObj->GetBillingAgreementDetailsStatus($responseObj->toXml());
1180
+ if ($this->success && $baStatus['State'] === 'Open') {
1181
+ $response = $this->AuthorizeOnBillingAgreement($authorizeParameters);
1182
+ }
1183
+ return $response;
1184
+ }
1185
+ }
1186
+
1187
+ /* GetProviderCreditDetails API Call - Get the details of the Provider Credit.
1188
+ *
1189
+ * @param requestParameters['merchant_id'] - [String]
1190
+ * @param requestParameters['amazon_provider_credit_id'] - [String]
1191
+ * @optional requestParameters['mws_auth_token'] - [String]
1192
+ */
1193
+
1194
+ public function getProviderCreditDetails($requestParameters = array())
1195
+ {
1196
+ $parameters = array();
1197
+ $parameters['Action'] = 'GetProviderCreditDetails';
1198
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
1199
+
1200
+ $fieldMappings = array(
1201
+ 'merchant_id' => 'SellerId',
1202
+ 'amazon_provider_credit_id' => 'AmazonProviderCreditId',
1203
+ 'mws_auth_token' => 'MWSAuthToken'
1204
+ );
1205
+
1206
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
1207
+
1208
+ return ($responseObject);
1209
+ }
1210
+
1211
+ /* GetProviderCreditReversalDetails API Call - Get details of the Provider Credit Reversal.
1212
+ *
1213
+ * @param requestParameters['merchant_id'] - [String]
1214
+ * @param requestParameters['amazon_provider_credit_reversal_id'] - [String]
1215
+ * @optional requestParameters['mws_auth_token'] - [String]
1216
+ */
1217
+
1218
+ public function getProviderCreditReversalDetails($requestParameters = array())
1219
+ {
1220
+ $parameters = array();
1221
+ $parameters['Action'] = 'GetProviderCreditReversalDetails';
1222
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
1223
+
1224
+ $fieldMappings = array(
1225
+ 'merchant_id' => 'SellerId',
1226
+ 'amazon_provider_credit_reversal_id' => 'AmazonProviderCreditReversalId',
1227
+ 'mws_auth_token' => 'MWSAuthToken'
1228
+ );
1229
+
1230
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
1231
+
1232
+ return ($responseObject);
1233
+ }
1234
+
1235
+ /* ReverseProviderCredit API Call - Reverse the Provider Credit.
1236
+ *
1237
+ * @param requestParameters['merchant_id'] - [String]
1238
+ * @param requestParameters['amazon_provider_credit_id'] - [String]
1239
+ * @optional requestParameters['credit_reversal_reference_id'] - [String]
1240
+ * @param requestParameters['credit_reversal_amount'] - [String]
1241
+ * @optional requestParameters['currency_code'] - [String]
1242
+ * @optional requestParameters['credit_reversal_note'] - [String]
1243
+ * @optional requestParameters['mws_auth_token'] - [String]
1244
+ */
1245
+
1246
+ public function reverseProviderCredit($requestParameters = array())
1247
+ {
1248
+ $parameters = array();
1249
+ $parameters['Action'] = 'ReverseProviderCredit';
1250
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
1251
+
1252
+ $fieldMappings = array(
1253
+ 'merchant_id' => 'SellerId',
1254
+ 'amazon_provider_credit_id' => 'AmazonProviderCreditId',
1255
+ 'credit_reversal_reference_id' => 'CreditReversalReferenceId',
1256
+ 'credit_reversal_amount' => 'CreditReversalAmount.Amount',
1257
+ 'currency_code' => 'CreditReversalAmount.CurrencyCode',
1258
+ 'credit_reversal_note' => 'CreditReversalNote',
1259
+ 'mws_auth_token' => 'MWSAuthToken'
1260
+ );
1261
+
1262
+ $responseObject = $this->setParametersAndPost($parameters, $fieldMappings, $requestParameters);
1263
+
1264
+ return ($responseObject);
1265
+ }
1266
+
1267
+ /* Create an Array of required parameters, sort them
1268
+ * Calculate signature and invoke the POST to the MWS Service URL
1269
+ *
1270
+ * @param AWSAccessKeyId [String]
1271
+ * @param Version [String]
1272
+ * @param SignatureMethod [String]
1273
+ * @param Timestamp [String]
1274
+ * @param Signature [String]
1275
+ */
1276
+
1277
+ private function calculateSignatureAndParametersToString($parameters = array())
1278
+ {
1279
+ $parameters['AWSAccessKeyId'] = $this->config['access_key'];
1280
+ $parameters['Version'] = self::SERVICE_VERSION;
1281
+ $parameters['SignatureMethod'] = 'HmacSHA256';
1282
+ $parameters['SignatureVersion'] = 2;
1283
+ $parameters['Timestamp'] = $this->getFormattedTimestamp();
1284
+ uksort($parameters, 'strcmp');
1285
+
1286
+ $this->createServiceUrl();
1287
+
1288
+ $parameters['Signature'] = $this->signParameters($parameters);
1289
+ $parameters = $this->getParametersAsString($parameters);
1290
+
1291
+ // Save these parameters in the parameters variable so that it can be returned for unit testing.
1292
+ $this->parameters = $parameters;
1293
+ return $parameters;
1294
+ }
1295
+
1296
+ /* Computes RFC 2104-compliant HMAC signature for request parameters
1297
+ * Implements AWS Signature, as per following spec:
1298
+ *
1299
+ * If Signature Version is 0, it signs concatenated Action and Timestamp
1300
+ *
1301
+ * If Signature Version is 1, it performs the following:
1302
+ *
1303
+ * Sorts all parameters (including SignatureVersion and excluding Signature,
1304
+ * the value of which is being created), ignoring case.
1305
+ *
1306
+ * Iterate over the sorted list and append the parameter name (in original case)
1307
+ * and then its value. It will not URL-encode the parameter values before
1308
+ * constructing this string. There are no separators.
1309
+ *
1310
+ * If Signature Version is 2, string to sign is based on following:
1311
+ *
1312
+ * 1. The HTTP Request Method followed by an ASCII newline (%0A)
1313
+ * 2. The HTTP Host header in the form of lowercase host, followed by an ASCII newline.
1314
+ * 3. The URL encoded HTTP absolute path component of the URI
1315
+ * (up to but not including the query string parameters);
1316
+ * if this is empty use a forward '/'. This parameter is followed by an ASCII newline.
1317
+ * 4. The concatenation of all query string components (names and values)
1318
+ * as UTF-8 characters which are URL encoded as per RFC 3986
1319
+ * (hex characters MUST be uppercase), sorted using lexicographic byte ordering.
1320
+ * Parameter names are separated from their values by the '=' character
1321
+ * (ASCII character 61), even if the value is empty.
1322
+ * Pairs of parameter and values are separated by the '&' character (ASCII code 38).
1323
+ *
1324
+ */
1325
+
1326
+ private function signParameters(array $parameters)
1327
+ {
1328
+ $signatureVersion = $parameters['SignatureVersion'];
1329
+ $algorithm = "HmacSHA1";
1330
+ $stringToSign = null;
1331
+ if (2 === $signatureVersion) {
1332
+ $algorithm = "HmacSHA256";
1333
+ $parameters['SignatureMethod'] = $algorithm;
1334
+ $stringToSign = $this->calculateStringToSignV2($parameters);
1335
+ } else {
1336
+ throw new \Exception("Invalid Signature Version specified");
1337
+ }
1338
+
1339
+ return $this->sign($stringToSign, $algorithm);
1340
+ }
1341
+
1342
+ /* Calculate String to Sign for SignatureVersion 2
1343
+ * @param array $parameters request parameters
1344
+ * @return String to Sign
1345
+ */
1346
+
1347
+ private function calculateStringToSignV2(array $parameters)
1348
+ {
1349
+ $data = 'POST';
1350
+ $data .= "\n";
1351
+ $data .= $this->mwsEndpointUrl;
1352
+ $data .= "\n";
1353
+ $data .= $this->mwsEndpointPath;
1354
+ $data .= "\n";
1355
+ $data .= $this->getParametersAsString($parameters);
1356
+ return $data;
1357
+ }
1358
+
1359
+ /* Convert paremeters to Url encoded query string */
1360
+
1361
+ private function getParametersAsString(array $parameters)
1362
+ {
1363
+ $queryParameters = array();
1364
+ foreach ($parameters as $key => $value) {
1365
+ $queryParameters[] = $key . '=' . $this->urlEncode($value);
1366
+ }
1367
+
1368
+ return implode('&', $queryParameters);
1369
+ }
1370
+
1371
+ private function urlEncode($value)
1372
+ {
1373
+ return str_replace('%7E', '~', rawurlencode($value));
1374
+ }
1375
+
1376
+ /* Computes RFC 2104-compliant HMAC signature */
1377
+
1378
+ private function sign($data, $algorithm)
1379
+ {
1380
+ if ($algorithm === 'HmacSHA1') {
1381
+ $hash = 'sha1';
1382
+ } else if ($algorithm === 'HmacSHA256') {
1383
+ $hash = 'sha256';
1384
+ } else {
1385
+ throw new \Exception("Non-supported signing method specified");
1386
+ }
1387
+
1388
+ return base64_encode(hash_hmac($hash, $data, $this->config['secret_key'], true));
1389
+ }
1390
+
1391
+ /* Formats date as ISO 8601 timestamp */
1392
+
1393
+ private function getFormattedTimestamp()
1394
+ {
1395
+ return gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time());
1396
+ }
1397
+
1398
+ /* invokePost takes the parameters and invokes the httpPost function to POST the parameters
1399
+ * Exponential retries on error 500 and 503
1400
+ * The response from the POST is an XML which is converted to Array
1401
+ */
1402
+
1403
+ private function invokePost($parameters)
1404
+ {
1405
+ $response = array();
1406
+ $statusCode = 200;
1407
+ $this->success = false;
1408
+
1409
+ // Submit the request and read response body
1410
+ try {
1411
+ $shouldRetry = true;
1412
+ $retries = 0;
1413
+ do {
1414
+ try {
1415
+ $this->constructUserAgentHeader();
1416
+
1417
+ $httpCurlRequest = new HttpCurl($this->config);
1418
+ $response = $httpCurlRequest->httpPost($this->mwsServiceUrl, $this->userAgent, $parameters);
1419
+
1420
+ // Split the API response into Response Body and the other parts of the response into other
1421
+ list($other, $responseBody) = explode("\r\n\r\n", $response, 2);
1422
+ $other = preg_split("/\r\n|\n|\r/", $other);
1423
+
1424
+ list($protocol, $code, $text) = explode(' ', trim(array_shift($other)), 3);
1425
+ $response = array(
1426
+ 'Status' => (int) $code,
1427
+ 'ResponseBody' => $responseBody
1428
+ );
1429
+
1430
+ $statusCode = $response['Status'];
1431
+
1432
+ if ($statusCode == 200) {
1433
+ $shouldRetry = false;
1434
+ $this->success = true;
1435
+ } elseif ($statusCode == 500 || $statusCode == 503) {
1436
+
1437
+ $shouldRetry = true;
1438
+ if ($shouldRetry && strtolower($this->config['handle_throttle'])) {
1439
+ $this->pauseOnRetry(++$retries, $statusCode);
1440
+ }
1441
+ } else {
1442
+ $shouldRetry = false;
1443
+ }
1444
+ } catch (\Exception $e) {
1445
+ throw $e;
1446
+ }
1447
+ } while ($shouldRetry);
1448
+ } catch (\Exception $se) {
1449
+ throw $se;
1450
+ }
1451
+
1452
+ return $response;
1453
+ }
1454
+
1455
+ /* Exponential sleep on failed request
1456
+ * @param retries current retry
1457
+ * @throws Exception if maximum number of retries has been reached
1458
+ */
1459
+
1460
+ private function pauseOnRetry($retries, $status)
1461
+ {
1462
+ if ($retries <= self::MAX_ERROR_RETRY) {
1463
+ $delay = (int) (pow(4, $retries) * 100000);
1464
+ usleep($delay);
1465
+ } else {
1466
+ throw new \Exception('Error Code: '. $status.PHP_EOL.'Maximum number of retry attempts - '. $retries .' reached');
1467
+ }
1468
+ }
1469
+
1470
+ /* Create MWS service URL and the Endpoint path */
1471
+
1472
+ private function createServiceUrl()
1473
+ {
1474
+ $this->modePath = strtolower($this->config['sandbox']) ? 'OffAmazonPayments_Sandbox' : 'OffAmazonPayments';
1475
+
1476
+ if (!empty($this->config['region'])) {
1477
+ $region = strtolower($this->config['region']);
1478
+ if (array_key_exists($region, $this->regionMappings)) {
1479
+ $this->mwsEndpointUrl = $this->mwsServiceUrls[$this->regionMappings[$region]];
1480
+ $this->mwsServiceUrl = 'https://' . $this->mwsEndpointUrl . '/' . $this->modePath . '/' . self::SERVICE_VERSION;
1481
+ $this->mwsEndpointPath = '/' . $this->modePath . '/' . self::SERVICE_VERSION;
1482
+ } else {
1483
+ throw new \Exception($region . ' is not a valid region');
1484
+ }
1485
+ } else {
1486
+ throw new \Exception("config['region'] is a required parameter and is not set");
1487
+ }
1488
+ }
1489
+
1490
+ /* Based on the config['region'] and config['sandbox'] values get the user profile URL */
1491
+
1492
+ private function profileEndpointUrl()
1493
+ {
1494
+ if (!empty($this->config['region'])) {
1495
+ $region = strtolower($this->config['region']);
1496
+
1497
+ if (array_key_exists($region, $this->sandboxProfileEndpoint) && $this->config['sandbox'] ) {
1498
+ $this->profileEndpoint = $this->sandboxProfileEndpoint[$region];
1499
+ } elseif (array_key_exists($region, $this->liveProfileEndpoint)) {
1500
+ $this->profileEndpoint = $this->liveProfileEndpoint[$region];
1501
+ } else{
1502
+ throw new \Exception($region . ' is not a valid region');
1503
+ }
1504
+ } else {
1505
+ throw new \Exception("config['region'] is a required parameter and is not set");
1506
+ }
1507
+ }
1508
+
1509
+ /* Create the User Agent Header sent with the POST request */
1510
+
1511
+ private function constructUserAgentHeader()
1512
+ {
1513
+ $this->userAgent = $this->quoteApplicationName($this->config['application_name']) . '/' . $this->quoteApplicationVersion($this->config['application_version']);
1514
+ $this->userAgent .= ' (';
1515
+ $this->userAgent .= 'Language=PHP/' . phpversion();
1516
+ $this->userAgent .= '; ';
1517
+ $this->userAgent .= 'Platform=' . php_uname('s') . '/' . php_uname('m') . '/' . php_uname('r');
1518
+ $this->userAgent .= '; ';
1519
+ $this->userAgent .= 'MWSClientVersion=' . self::MWS_CLIENT_VERSION;
1520
+ $this->userAgent .= ')';
1521
+ }
1522
+
1523
+ /* Collapse multiple whitespace characters into a single ' ' and backslash escape '\',
1524
+ * and '/' characters from a string.
1525
+ * @param $s
1526
+ * @return string
1527
+ */
1528
+
1529
+ private function quoteApplicationName($s)
1530
+ {
1531
+ $quotedString = preg_replace('/ {2,}|\s/', ' ', $s);
1532
+ $quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
1533
+ $quotedString = preg_replace('/\//', '\\/', $quotedString);
1534
+ return $quotedString;
1535
+ }
1536
+
1537
+ /* Collapse multiple whitespace characters into a single ' ' and backslash escape '\',
1538
+ * and '(' characters from a string.
1539
+ *
1540
+ * @param $s
1541
+ * @return string
1542
+ */
1543
+
1544
+ private function quoteApplicationVersion($s)
1545
+ {
1546
+ $quotedString = preg_replace('/ {2,}|\s/', ' ', $s);
1547
+ $quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
1548
+ $quotedString = preg_replace('/\\(/', '\\(', $quotedString);
1549
+ return $quotedString;
1550
+ }
1551
+ }
wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/HttpCurl.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace PayWithAmazon;
3
+
4
+ /* Class HttpCurl
5
+ * Handles Curl POST function for all requests
6
+ */
7
+
8
+ require_once 'Interface.php';
9
+
10
+ class HttpCurl implements HttpCurlInterface
11
+ {
12
+ private $config = array();
13
+ private $header = false;
14
+ private $accessToken = null;
15
+
16
+ /* Takes user configuration array as input
17
+ * Takes configuration for API call or IPN config
18
+ */
19
+
20
+ public function __construct($config = null)
21
+ {
22
+ $this->config = $config;
23
+ }
24
+
25
+ /* Setter for boolean header to get the user info */
26
+
27
+ public function setHttpHeader()
28
+ {
29
+ $this->header = true;
30
+ }
31
+
32
+ /* Setter for Access token to get the user info */
33
+
34
+ public function setAccessToken($accesstoken)
35
+ {
36
+ $this->accessToken = $accesstoken;
37
+ }
38
+
39
+ /* Add the common Curl Parameters to the curl handler $ch
40
+ * Also checks for optional parameters if provided in the config
41
+ * config['cabundle_file']
42
+ * config['proxy_port']
43
+ * config['proxy_host']
44
+ * config['proxy_username']
45
+ * config['proxy_password']
46
+ */
47
+
48
+ private function commonCurlParams($url,$userAgent)
49
+ {
50
+ $ch = curl_init();
51
+ curl_setopt($ch, CURLOPT_URL, $url);
52
+ curl_setopt($ch, CURLOPT_PORT, 443);
53
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
54
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
55
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
56
+
57
+ if (!is_null($this->config['cabundle_file'])) {
58
+ curl_setopt($ch, CURLOPT_CAINFO, $this->config['cabundle_file']);
59
+ }
60
+
61
+ if (!empty($userAgent))
62
+ curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
63
+
64
+ if ($this->config['proxy_host'] != null && $this->config['proxy_port'] != -1) {
65
+ curl_setopt($ch, CURLOPT_PROXY, $this->config['proxy_host'] . ':' . $this->config['proxy_port']);
66
+ }
67
+
68
+ if ($this->config['proxy_username'] != null && $this->config['proxy_password'] != null) {
69
+ curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->config['proxy_username'] . ':' . $this->config['proxy_password']);
70
+ }
71
+
72
+ return $ch;
73
+ }
74
+
75
+ /* POST using curl for the following situations
76
+ * 1. API calls
77
+ * 2. IPN certificate retrieval
78
+ * 3. Get User Info
79
+ */
80
+
81
+ public function httpPost($url, $userAgent = null, $parameters = null)
82
+ {
83
+ $ch = $this->commonCurlParams($url,$userAgent);
84
+
85
+ curl_setopt($ch, CURLOPT_POST, true);
86
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
87
+ curl_setopt($ch, CURLOPT_HEADER, true);
88
+
89
+ $response = $this->execute($ch);
90
+ return $response;
91
+ }
92
+
93
+ /* GET using curl for the following situations
94
+ * 1. IPN certificate retrieval
95
+ * 2. Get User Info
96
+ */
97
+
98
+ public function httpGet($url, $userAgent = null)
99
+ {
100
+ $ch = $this->commonCurlParams($url,$userAgent);
101
+
102
+ // Setting the HTTP header with the Access Token only for Getting user info
103
+ if ($this->header) {
104
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
105
+ 'Authorization: bearer ' . $this->accessToken
106
+ ));
107
+ }
108
+
109
+ $response = $this->execute($ch);
110
+ return $response;
111
+ }
112
+
113
+ /* Execute Curl request */
114
+
115
+ private function execute($ch)
116
+ {
117
+ $response = '';
118
+ if (!$response = curl_exec($ch)) {
119
+ $error_msg = "Unable to post request, underlying exception of " . curl_error($ch);
120
+ curl_close($ch);
121
+ throw new \Exception($error_msg);
122
+ }
123
+ curl_close($ch);
124
+ return $response;
125
+ }
126
+ }
wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/Interface.php ADDED
@@ -0,0 +1,473 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace PayWithAmazon;
3
+
4
+ /* Interface class to showcase the public API methods for Pay With Amazon */
5
+
6
+ interface ClientInterface
7
+ {
8
+ /* Takes user configuration array from the user as input
9
+ * Takes JSON file path with configuration information as input
10
+ * Validates the user configuation array against existing config array
11
+ */
12
+
13
+ public function __construct($config = null);
14
+
15
+ /* Setter for sandbox
16
+ * Sets the boolean value for config['sandbox'] variable
17
+ */
18
+
19
+ public function setSandbox($value);
20
+
21
+ /* Setter for config['client_id']
22
+ * Sets the value for config['client_id'] variable
23
+ */
24
+
25
+ public function setClientId($value);
26
+
27
+ /* Setter for Proxy
28
+ * input $proxy [array]
29
+ * @param $proxy['proxy_user_host'] - hostname for the proxy
30
+ * @param $proxy['proxy_user_port'] - hostname for the proxy
31
+ * @param $proxy['proxy_user_name'] - if your proxy required a username
32
+ * @param $proxy['proxy_user_password'] - if your proxy required a passowrd
33
+ */
34
+
35
+ public function setProxy($proxy);
36
+
37
+ /* Setter for $_mwsServiceUrl
38
+ * Set the URL to which the post request has to be made for unit testing
39
+ */
40
+
41
+ public function setMwsServiceUrl($url);
42
+
43
+ /* Getter
44
+ * Gets the value for the key if the key exists in config
45
+ */
46
+
47
+ public function __get($name);
48
+
49
+ /* Getter for parameters string
50
+ * Gets the value for the parameters string for unit testing
51
+ */
52
+
53
+ public function getParameters();
54
+
55
+ /* GetUserInfo convenience funtion - Returns user's profile information from Amazon using the access token returned by the Button widget.
56
+ *
57
+ * @see http://docs.developer.amazonservices.com/en_US/apa_guide/APAGuide_ObtainProfile.html
58
+ * @param $access_token [String]
59
+ */
60
+
61
+ public function getUserInfo($access_token);
62
+
63
+ /* GetOrderReferenceDetails API call - Returns details about the Order Reference object and its current state.
64
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetOrderReferenceDetails.html
65
+ *
66
+ * @param requestParameters['merchant_id'] - [String]
67
+ * @param requestParameters['amazon_order_reference_id'] - [String]
68
+ * @optional requestParameters['address_consent_token'] - [String]
69
+ * @optional requestParameters['mws_auth_token'] - [String]
70
+ */
71
+
72
+ public function getOrderReferenceDetails($requestParameters = array());
73
+
74
+ /* SetOrderReferenceDetails API call - Sets order reference details such as the order total and a description for the order.
75
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetOrderReferenceDetails.html
76
+ *
77
+ * @param requestParameters['merchant_id'] - [String]
78
+ * @param requestParameters['amazon_order_reference_id'] - [String]
79
+ * @param requestParameters['amount'] - [String]
80
+ * @param requestParameters['currency_code'] - [String]
81
+ * @optional requestParameters['platform_id'] - [String]
82
+ * @optional requestParameters['seller_note'] - [String]
83
+ * @optional requestParameters['seller_order_id'] - [String]
84
+ * @optional requestParameters['store_name'] - [String]
85
+ * @optional requestParameters['custom_information'] - [String]
86
+ * @optional requestParameters['mws_auth_token'] - [String]
87
+ */
88
+
89
+ public function setOrderReferenceDetails($requestParameters = array());
90
+
91
+ /* ConfirmOrderReferenceDetails API call - Confirms that the order reference is free of constraints and all required information has been set on the order reference.
92
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmOrderReference.html
93
+
94
+ * @param requestParameters['merchant_id'] - [String]
95
+ * @param requestParameters['amazon_order_reference_id'] - [String]
96
+ * @optional requestParameters['mws_auth_token'] - [String]
97
+ */
98
+
99
+ public function confirmOrderReference($requestParameters = array());
100
+
101
+ /* CancelOrderReferenceDetails API call - Cancels a previously confirmed order reference.
102
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CancelOrderReference.html
103
+ *
104
+ * @param requestParameters['merchant_id'] - [String]
105
+ * @param requestParameters['amazon_order_reference_id'] - [String]
106
+ * @optional requestParameters['cancelation_reason'] [String]
107
+ * @optional requestParameters['mws_auth_token'] - [String]
108
+ */
109
+
110
+ public function cancelOrderReference($requestParameters = array());
111
+
112
+ /* CloseOrderReferenceDetails API call - Confirms that an order reference has been fulfilled (fully or partially)
113
+ * and that you do not expect to create any new authorizations on this order reference.
114
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
115
+ *
116
+ * @param requestParameters['merchant_id'] - [String]
117
+ * @param requestParameters['amazon_order_reference_id'] - [String]
118
+ * @optional requestParameters['closure_reason'] [String]
119
+ * @optional requestParameters['mws_auth_token'] - [String]
120
+ */
121
+
122
+ public function closeOrderReference($requestParameters = array());
123
+
124
+ /* CloseAuthorization API call - Closes an authorization.
125
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
126
+ *
127
+ * @param requestParameters['merchant_id'] - [String]
128
+ * @param requestParameters['amazon_authorization_id'] - [String]
129
+ * @optional requestParameters['closure_reason'] [String]
130
+ * @optional requestParameters['mws_auth_token'] - [String]
131
+ */
132
+
133
+ public function closeAuthorization($requestParameters = array());
134
+
135
+ /* Authorize API call - Reserves a specified amount against the payment method(s) stored in the order reference.
136
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
137
+ *
138
+ * @param requestParameters['merchant_id'] - [String]
139
+ * @param requestParameters['amazon_order_reference_id'] - [String]
140
+ * @param requestParameters['authorization_amount'] [String]
141
+ * @param requestParameters['currency_code'] - [String]
142
+ * @param requestParameters['authorization_reference_id'] [String]
143
+ * @optional requestParameters['capture_now'] [String]
144
+ * @optional requestParameters['provider_credit_details'] - [array (array())]
145
+ * @optional requestParameters['seller_authorization_note'] [String]
146
+ * @optional requestParameters['transaction_timeout'] [String] - Defaults to 1440 minutes
147
+ * @optional requestParameters['soft_descriptor'] - [String]
148
+ * @optional requestParameters['mws_auth_token'] - [String]
149
+ */
150
+
151
+ public function authorize($requestParameters = array());
152
+
153
+ /* GetAuthorizationDetails API call - Returns the status of a particular authorization and the total amount captured on the authorization.
154
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetAuthorizationDetails.html
155
+ *
156
+ * @param requestParameters['merchant_id'] - [String]
157
+ * @param requestParameters['amazon_authorization_id'] [String]
158
+ * @optional requestParameters['mws_auth_token'] - [String]
159
+ */
160
+
161
+ public function getAuthorizationDetails($requestParameters = array());
162
+
163
+ /* Capture API call - Captures funds from an authorized payment instrument.
164
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Capture.html
165
+ *
166
+ * @param requestParameters['merchant_id'] - [String]
167
+ * @param requestParameters['amazon_authorization_id'] - [String]
168
+ * @param requestParameters['capture_amount'] - [String]
169
+ * @param requestParameters['currency_code'] - [String]
170
+ * @param requestParameters['capture_reference_id'] - [String]
171
+ * @param requestParameters['provider_credit_details'] - [array (array())]
172
+ * @optional requestParameters['seller_capture_note'] - [String]
173
+ * @optional requestParameters['soft_descriptor'] - [String]
174
+ * @optional requestParameters['mws_auth_token'] - [String]
175
+ */
176
+
177
+ public function capture($requestParameters = array());
178
+
179
+ /* GetCaptureDetails API call - Returns the status of a particular capture and the total amount refunded on the capture.
180
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetCaptureDetails.html
181
+ *
182
+ * @param requestParameters['merchant_id'] - [String]
183
+ * @param requestParameters['amazon_capture_id'] - [String]
184
+ * @optional requestParameters['mws_auth_token'] - [String]
185
+ */
186
+
187
+ public function getCaptureDetails($requestParameters = array());
188
+
189
+ /* Refund API call - Refunds a previously captured amount.
190
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Refund.html
191
+ *
192
+ * @param requestParameters['merchant_id'] - [String]
193
+ * @param requestParameters['amazon_capture_id'] - [String]
194
+ * @param requestParameters['refund_reference_id'] - [String]
195
+ * @param requestParameters['refund_amount'] - [String]
196
+ * @param requestParameters['currency_code'] - [String]
197
+ * @param requestParameters['provider_credit_reversal_details'] - [array(array())]
198
+ * @optional requestParameters['seller_refund_note'] [String]
199
+ * @optional requestParameters['soft_descriptor'] - [String]
200
+ * @optional requestParameters['mws_auth_token'] - [String]
201
+ */
202
+
203
+ public function refund($requestParameters = array());
204
+
205
+ /* GetRefundDetails API call - Returns the status of a particular refund.
206
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetRefundDetails.html
207
+ *
208
+ * @param requestParameters['merchant_id'] - [String]
209
+ * @param requestParameters['amazon_refund_id'] - [String]
210
+ * @optional requestParameters['mws_auth_token'] - [String]
211
+ */
212
+
213
+ public function getRefundDetails($requestParameters = array());
214
+
215
+ /* GetServiceStatus API Call - Returns the operational status of the Off-Amazon Payments API section
216
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetServiceStatus.html
217
+ *
218
+ * The GetServiceStatus operation returns the operational status of the Off-Amazon Payments API
219
+ * section of Amazon Marketplace Web Service (Amazon MWS).
220
+ * Status values are GREEN, GREEN_I, YELLOW, and RED.
221
+ *
222
+ * @param requestParameters['merchant_id'] - [String]
223
+ * @optional requestParameters['mws_auth_token'] - [String]
224
+ */
225
+
226
+ public function getServiceStatus($requestParameters = array());
227
+
228
+ /* CreateOrderReferenceForId API Call - Creates an order reference for the given object
229
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CreateOrderReferenceForId.html
230
+ *
231
+ * @param requestParameters['merchant_id'] - [String]
232
+ * @param requestParameters['Id'] - [String]
233
+ * @optional requestParameters['inherit_shipping_address'] [Boolean]
234
+ * @optional requestParameters['ConfirmNow'] - [Boolean]
235
+ * @optional Amount (required when confirm_now is set to true) [String]
236
+ * @optional requestParameters['currency_code'] - [String]
237
+ * @optional requestParameters['seller_note'] - [String]
238
+ * @optional requestParameters['seller_order_id'] - [String]
239
+ * @optional requestParameters['store_name'] - [String]
240
+ * @optional requestParameters['custom_information'] - [String]
241
+ * @optional requestParameters['mws_auth_token'] - [String]
242
+ */
243
+
244
+ public function createOrderReferenceForId($requestParameters = array());
245
+
246
+ /* GetBillingAgreementDetails API Call - Returns details about the Billing Agreement object and its current state.
247
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetBillingAgreementDetails.html
248
+ *
249
+ * @param requestParameters['merchant_id'] - [String]
250
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
251
+ * @optional requestParameters['mws_auth_token'] - [String]
252
+ */
253
+
254
+ public function getBillingAgreementDetails($requestParameters = array());
255
+
256
+ /* SetBillingAgreementDetails API call - Sets Billing Agreement details such as a description of the agreement and other information about the seller.
257
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetBillingAgreementDetails.html
258
+ *
259
+ * @param requestParameters['merchant_id'] - [String]
260
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
261
+ * @param requestParameters['amount'] - [String]
262
+ * @param requestParameters['currency_code'] - [String]
263
+ * @optional requestParameters['platform_id'] - [String]
264
+ * @optional requestParameters['seller_note'] - [String]
265
+ * @optional requestParameters['seller_billing_agreement_id'] - [String]
266
+ * @optional requestParameters['store_name'] - [String]
267
+ * @optional requestParameters['custom_information'] - [String]
268
+ * @optional requestParameters['mws_auth_token'] - [String]
269
+ */
270
+
271
+ public function setBillingAgreementDetails($requestParameters = array());
272
+
273
+ /* ConfirmBillingAgreement API Call - Confirms that the Billing Agreement is free of constraints and all required information has been set on the Billing Agreement.
274
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmBillingAgreement.html
275
+ *
276
+ * @param requestParameters['merchant_id'] - [String]
277
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
278
+ * @optional requestParameters['mws_auth_token'] - [String]
279
+ */
280
+
281
+ public function confirmBillingAgreement($requestParameters = array());
282
+
283
+ /* ValidateBillingAgreement API Call - Validates the status of the Billing Agreement object and the payment method associated with it.
284
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ValidateBillignAgreement.html
285
+ *
286
+ * @param requestParameters['merchant_id'] - [String]
287
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
288
+ * @optional requestParameters['mws_auth_token'] - [String]
289
+ */
290
+
291
+ public function validateBillingAgreement($requestParameters = array());
292
+
293
+ /* AuthorizeOnBillingAgreement API call - Reserves a specified amount against the payment method(s) stored in the Billing Agreement.
294
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_AuthorizeOnBillingAgreement.html
295
+ *
296
+ * @param requestParameters['merchant_id'] - [String]
297
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
298
+ * @param requestParameters['authorization_reference_id'] [String]
299
+ * @param requestParameters['authorization_amount'] [String]
300
+ * @param requestParameters['currency_code'] - [String]
301
+ * @optional requestParameters['seller_authorization_note'] [String]
302
+ * @optional requestParameters['transaction_timeout'] - Defaults to 1440 minutes
303
+ * @optional requestParameters['capture_now'] [String]
304
+ * @optional requestParameters['soft_descriptor'] - - [String]
305
+ * @optional requestParameters['seller_note'] - [String]
306
+ * @optional requestParameters['platform_id'] - [String]
307
+ * @optional requestParameters['custom_information'] - [String]
308
+ * @optional requestParameters['seller_order_id'] - [String]
309
+ * @optional requestParameters['store_name'] - [String]
310
+ * @optional requestParameters['inherit_shipping_address'] [Boolean] - Defaults to true
311
+ * @optional requestParameters['mws_auth_token'] - [String]
312
+ */
313
+
314
+ public function authorizeOnBillingAgreement($requestParameters = array());
315
+
316
+ /* CloseBillingAgreement API Call - Returns details about the Billing Agreement object and its current state.
317
+ * @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseBillingAgreement.html
318
+ *
319
+ * @param requestParameters['merchant_id'] - [String]
320
+ * @param requestParameters['amazon_billing_agreement_id'] - [String]
321
+ * @optional requestParameters['closure_reason'] [String]
322
+ * @optional requestParameters['mws_auth_token'] - [String]
323
+ */
324
+
325
+ public function closeBillingAgreement($requestParameters = array());
326
+
327
+ /* charge convenience method
328
+ * Performs the API calls
329
+ * 1. SetOrderReferenceDetails / SetBillingAgreementDetails
330
+ * 2. ConfirmOrderReference / ConfirmBillingAgreement
331
+ * 3. Authorize (with Capture) / AuthorizeOnBillingAgreeemnt (with Capture)
332
+ *
333
+ * @param requestParameters['merchant_id'] - [String]
334
+ * @param requestParameters['amazon_reference_id'] - [String] : Order Reference ID /Billing Agreement ID
335
+ * @param $requestParameters['charge_amount'] - [String] : Amount value to be captured
336
+ * @param requestParameters['charge_currency_code'] - [String] : Currency Code for the Amount
337
+ * @param requestParameters['authorization_reference_id'] - [String]- Any unique string that needs to be passed
338
+ * @optional requestParameters['charge_note'] - [String] : seller note sent to the buyer
339
+ * @optional requestParameters['transaction_timeout'] - [String] : Defaults to 1440 minutes
340
+ * @optional requestParameters['charge_order_id'] - [String] : Custom Order ID provided
341
+ * @optional requestParameters['mws_auth_token'] - [String]
342
+ */
343
+
344
+ public function charge($requestParameters = array());
345
+
346
+ /* GetProviderCreditDetails API Call - Get the details of the Provider Credit.
347
+ *
348
+ * @param requestParameters['merchant_id'] - [String]
349
+ * @param requestParameters['amazon_provider_credit_id'] - [String]
350
+ * @optional requestParameters['mws_auth_token'] - [String]
351
+ */
352
+
353
+ public function getProviderCreditDetails($requestParameters = array());
354
+
355
+ /* GetProviderCreditReversalDetails API Call - Get details of the Provider Credit Reversal.
356
+ *
357
+ * @param requestParameters['merchant_id'] - [String]
358
+ * @param requestParameters['amazon_provider_credit_reversal_id'] - [String]
359
+ * @optional requestParameters['mws_auth_token'] - [String]
360
+ */
361
+
362
+ public function getProviderCreditReversalDetails($requestParameters = array());
363
+
364
+ /* ReverseProviderCredit API Call - Reverse the Provider Credit.
365
+ *
366
+ * @param requestParameters['merchant_id'] - [String]
367
+ * @param requestParameters['amazon_provider_credit_id'] - [String]
368
+ * @optional requestParameters['credit_reversal_reference_id'] - [String]
369
+ * @param requestParameters['credit_reversal_amount'] - [String]
370
+ * @optional requestParameters['currency_code'] - [String]
371
+ * @optional requestParameters['credit_reversal_note'] - [String]
372
+ * @optional requestParameters['mws_auth_token'] - [String]
373
+ */
374
+
375
+ public function reverseProviderCredit($requestParameters = array());
376
+ }
377
+
378
+ /* Interface for IpnHandler.php */
379
+
380
+ interface IpnHandlerInterface
381
+ {
382
+ /* Takes headers and body of the IPN message as input in the constructor
383
+ * verifies that the IPN is from the right resource and has the valid data
384
+ */
385
+
386
+ public function __construct($headers, $body, $ipnConfig = null);
387
+
388
+ /* returnMessage() - JSON decode the raw [Message] portion of the IPN */
389
+
390
+ public function returnMessage();
391
+
392
+ /* toJson() - Converts IPN [Message] field to JSON
393
+ *
394
+ * Has child elements
395
+ * ['NotificationData'] [XML] - API call XML notification data
396
+ * @param remainingFields - consists of remaining IPN array fields that are merged
397
+ * Type - Notification
398
+ * MessageId - ID of the Notification
399
+ * Topic ARN - Topic of the IPN
400
+ * @return response in JSON format
401
+ */
402
+
403
+ public function toJson();
404
+
405
+ /* toArray() - Converts IPN [Message] field to associative array
406
+ * @return response in array format
407
+ */
408
+
409
+ public function toArray();
410
+ }
411
+
412
+ /* Interface for HttpCurl.php */
413
+
414
+ interface HttpCurlInterface
415
+ {
416
+ /* Takes user configuration array as input
417
+ * Takes configuration for API call or IPN config
418
+ */
419
+
420
+ public function __construct($config = null);
421
+
422
+ /* Set Http header for Access token for the GetUserInfo call */
423
+
424
+ public function setHttpHeader();
425
+
426
+ /* Setter for Access token to get the user info */
427
+
428
+ public function setAccessToken($accesstoken);
429
+
430
+ /* POST using curl for the following situations
431
+ * 1. API calls
432
+ * 2. IPN certificate retrieval
433
+ * 3. Get User Info
434
+ */
435
+
436
+ public function httpPost($url, $userAgent = null, $parameters = null);
437
+
438
+ /* GET using curl for the following situations
439
+ * 1. IPN certificate retrieval
440
+ * 3. Get User Info
441
+ */
442
+
443
+ public function httpGet($url, $userAgent = null);
444
+ }
445
+
446
+ /* Interface for ResponseParser.php */
447
+
448
+ interface ResponseInterface
449
+ {
450
+ /* Takes response from the API call */
451
+
452
+ public function __construct($response = null);
453
+
454
+ /* Returns the XML portion of the response */
455
+
456
+ public function toXml();
457
+
458
+ /* toJson - converts XML into Json
459
+ * @param $response [XML]
460
+ */
461
+
462
+ public function toJson();
463
+
464
+ /* toArray - converts XML into associative array
465
+ * @param $this->_response [XML]
466
+ */
467
+
468
+ public function toArray();
469
+
470
+ /* Get the status of the BillingAgreement */
471
+
472
+ public function getBillingAgreementDetailsStatus($response);
473
+ }
wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/IpnHandler.php ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace PayWithAmazon;
3
+
4
+ /* Class IPN_Handler
5
+ * Takes headers and body of the IPN message as input in the constructor
6
+ * verifies that the IPN is from the right resource and has the valid data
7
+ */
8
+
9
+ require_once 'HttpCurl.php';
10
+ require_once 'Interface.php';
11
+ class IpnHandler implements IpnHandlerInterface
12
+ {
13
+
14
+ private $headers = null;
15
+ private $body = null;
16
+ private $snsMessage = null;
17
+ private $fields = array();
18
+ private $signatureFields = array();
19
+ private $certificate = null;
20
+ private $expectedCnName = 'sns.amazonaws.com';
21
+
22
+ private $ipnConfig = array('cabundle_file' => null,
23
+ 'proxy_host' => null,
24
+ 'proxy_port' => -1,
25
+ 'proxy_username' => null,
26
+ 'proxy_password' => null);
27
+
28
+
29
+ public function __construct($headers, $body, $ipnConfig = null)
30
+ {
31
+ $this->headers = array_change_key_case($headers, CASE_LOWER);
32
+ $this->body = $body;
33
+
34
+ if ($ipnConfig != null) {
35
+ $this->checkConfigKeys($ipnConfig);
36
+ }
37
+
38
+ // Get the list of fields that we are interested in
39
+ $this->fields = array(
40
+ "Timestamp" => true,
41
+ "Message" => true,
42
+ "MessageId" => true,
43
+ "Subject" => false,
44
+ "TopicArn" => true,
45
+ "Type" => true
46
+ );
47
+
48
+ // Validate the IPN message header [x-amz-sns-message-type]
49
+ $this->validateHeaders();
50
+
51
+ // Converts the IPN [Message] to Notification object
52
+ $this->getMessage();
53
+
54
+ // Checks if the notification [Type] is Notification and constructs the signature fields
55
+ $this->checkForCorrectMessageType();
56
+
57
+ // Verifies the signature against the provided pem file in the IPN
58
+ $this->constructAndVerifySignature();
59
+ }
60
+
61
+ private function checkConfigKeys($ipnConfig)
62
+ {
63
+ $ipnConfig = array_change_key_case($ipnConfig, CASE_LOWER);
64
+
65
+ foreach ($ipnConfig as $key => $value) {
66
+ if (array_key_exists($key, $this->ipnConfig)) {
67
+ $this->ipnConfig[$key] = $value;
68
+ } else {
69
+ throw new \Exception('Key ' . $key . ' is either not part of the configuration or has incorrect Key name.
70
+ check the ipnConfig array key names to match your key names of your config array ', 1);
71
+ }
72
+ }
73
+ }
74
+
75
+ /* Setter function
76
+ * Sets the value for the key if the key exists in ipnConfig
77
+ */
78
+
79
+ public function __set($name, $value)
80
+ {
81
+ if (array_key_exists(strtolower($name), $this->ipnConfig)) {
82
+ $this->ipnConfig[$name] = $value;
83
+ } else {
84
+ throw new \Exception("Key " . $name . " is not part of the configuration", 1);
85
+ }
86
+ }
87
+
88
+ /* Getter function
89
+ * Returns the value for the key if the key exists in ipnConfig
90
+ */
91
+
92
+ public function __get($name)
93
+ {
94
+ if (array_key_exists(strtolower($name), $this->ipnConfig)) {
95
+ return $this->ipnConfig[$name];
96
+ } else {
97
+ throw new \Exception("Key " . $name . " was not found in the configuration", 1);
98
+ }
99
+ }
100
+
101
+
102
+ private function validateHeaders()
103
+ {
104
+ // Quickly check that this is a sns message
105
+ if (!array_key_exists('x-amz-sns-message-type', $this->headers)) {
106
+ throw new \Exception("Error with message - header " . "does not contain x-amz-sns-message-type header");
107
+ }
108
+
109
+ if ($this->headers['x-amz-sns-message-type'] !== 'Notification') {
110
+ throw new \Exception("Error with message - header x-amz-sns-message-type is not " . "Notification, is " . $this->headers['x-amz-sns-message-type']);
111
+ }
112
+ }
113
+
114
+ private function getMessage()
115
+ {
116
+ $this->snsMessage = json_decode($this->body, true);
117
+
118
+ $json_error = json_last_error();
119
+
120
+ if ($json_error != 0) {
121
+ $errorMsg = "Error with message - content is not in json format" . $this->getErrorMessageForJsonError($json_error) . " " . $this->snsMessage;
122
+ throw new \Exception($errorMsg);
123
+ }
124
+ }
125
+
126
+ /* Convert a json error code to a descriptive error message
127
+ *
128
+ * @param int $json_error message code
129
+ *
130
+ * @return string error message
131
+ */
132
+
133
+ private function getErrorMessageForJsonError($json_error)
134
+ {
135
+ switch ($json_error) {
136
+ case JSON_ERROR_DEPTH:
137
+ return " - maximum stack depth exceeded.";
138
+ break;
139
+ case JSON_ERROR_STATE_MISMATCH:
140
+ return " - invalid or malformed JSON.";
141
+ break;
142
+ case JSON_ERROR_CTRL_CHAR:
143
+ return " - control character error.";
144
+ break;
145
+ case JSON_ERROR_SYNTAX:
146
+ return " - syntax error.";
147
+ break;
148
+ default:
149
+ return ".";
150
+ break;
151
+ }
152
+ }
153
+
154
+ /* checkForCorrectMessageType()
155
+ *
156
+ * Checks if the Field [Type] is set to ['Notification']
157
+ * Gets the value for the fields marked true in the fields array
158
+ * Constructs the signature string
159
+ */
160
+
161
+ private function checkForCorrectMessageType()
162
+ {
163
+ $type = $this->getMandatoryField("Type");
164
+ if (strcasecmp($type, "Notification") != 0) {
165
+ throw new \Exception("Error with SNS Notification - unexpected message with Type of " . $type);
166
+ }
167
+
168
+ if (strcmp($this->getMandatoryField("Type"), "Notification") != 0) {
169
+ throw new \Exception("Error with signature verification - unable to verify " . $this->getMandatoryField("Type") . " message");
170
+ } else {
171
+
172
+ // Sort the fields into byte order based on the key name(A-Za-z)
173
+ ksort($this->fields);
174
+
175
+ // Extract the key value pairs and sort in byte order
176
+ $signatureFields = array();
177
+ foreach ($this->fields as $fieldName => $mandatoryField) {
178
+ if ($mandatoryField) {
179
+ $value = $this->getMandatoryField($fieldName);
180
+ } else {
181
+ $value = $this->getField($fieldName);
182
+ }
183
+
184
+ if (!is_null($value)) {
185
+ array_push($signatureFields, $fieldName);
186
+ array_push($signatureFields, $value);
187
+ }
188
+ }
189
+
190
+ /* Create the signature string - key / value in byte order
191
+ * delimited by newline character + ending with a new line character
192
+ */
193
+ $this->signatureFields = implode("\n", $signatureFields) . "\n";
194
+
195
+ }
196
+ }
197
+
198
+ /* Verify that the signature is correct for the given data and
199
+ * public key
200
+ *
201
+ * @param string $data data to validate
202
+ * @param string $signature decoded signature to compare against
203
+ * @param string $certificatePath path to certificate, can be file or url
204
+ *
205
+ * @throws Exception if there is an error with the call
206
+ *
207
+ * @return bool true if valid
208
+ */
209
+
210
+ private function constructAndVerifySignature()
211
+ {
212
+ $signature = base64_decode($this->getMandatoryField("Signature"));
213
+ $certificatePath = $this->getMandatoryField("SigningCertURL");
214
+
215
+ $this->certificate = $this->getCertificate($certificatePath);
216
+
217
+ $result = $this->verifySignatureIsCorrectFromCertificate($signature);
218
+ if (!$result) {
219
+ throw new \Exception("Unable to match signature from remote server: signature of " . $this->getCertificate($certificatePath) . " , SigningCertURL of " . $this->getMandatoryField("SigningCertURL") . " , SignatureOf " . $this->getMandatoryField("Signature"));
220
+ }
221
+ }
222
+
223
+ /* getCertificate($certificatePath)
224
+ *
225
+ * gets the certificate from the $certificatePath using Curl
226
+ */
227
+
228
+ private function getCertificate($certificatePath)
229
+ {
230
+ $httpCurlRequest = new HttpCurl($this->ipnConfig);
231
+
232
+ $response = $httpCurlRequest->httpGet($certificatePath);
233
+
234
+ return $response;
235
+ }
236
+
237
+ /* Verify that the signature is correct for the given data and public key
238
+ *
239
+ * @param string $data data to validate
240
+ * @param string $signature decoded signature to compare against
241
+ * @param string $certificate certificate object defined in Certificate.php
242
+ */
243
+
244
+ public function verifySignatureIsCorrectFromCertificate($signature)
245
+ {
246
+ $certKey = openssl_get_publickey($this->certificate);
247
+
248
+ if ($certKey === False) {
249
+ throw new \Exception("Unable to extract public key from cert");
250
+ }
251
+
252
+ try {
253
+ $certInfo = openssl_x509_parse($this->certificate, true);
254
+ $certSubject = $certInfo["subject"];
255
+
256
+ if (is_null($certSubject)) {
257
+ throw new \Exception("Error with certificate - subject cannot be found");
258
+ }
259
+ } catch (\Exception $ex) {
260
+ throw new \Exception("Unable to verify certificate - error with the certificate subject", null, $ex);
261
+ }
262
+
263
+ if (strcmp($certSubject["CN"], $this->expectedCnName)) {
264
+ throw new \Exception("Unable to verify certificate issued by Amazon - error with certificate subject");
265
+ }
266
+
267
+ $result = -1;
268
+ try {
269
+ $result = openssl_verify($this->signatureFields, $signature, $certKey, OPENSSL_ALGO_SHA1);
270
+ } catch (\Exception $ex) {
271
+ throw new \Exception("Unable to verify signature - error with the verification algorithm", null, $ex);
272
+ }
273
+
274
+ return ($result > 0);
275
+ }
276
+
277
+
278
+ /* Extract the mandatory field from the message and return the contents
279
+ *
280
+ * @param string $fieldName name of the field to extract
281
+ *
282
+ * @throws Exception if not found
283
+ *
284
+ * @return string field contents if found
285
+ */
286
+
287
+ private function getMandatoryField($fieldName)
288
+ {
289
+ $value = $this->getField($fieldName);
290
+ if (is_null($value)) {
291
+ throw new \Exception("Error with json message - mandatory field " . $fieldName . " cannot be found");
292
+ }
293
+ return $value;
294
+ }
295
+
296
+ /* Extract the field if present, return null if not defined
297
+ *
298
+ * @param string $fieldName name of the field to extract
299
+ *
300
+ * @return string field contents if found, null otherwise
301
+ */
302
+
303
+ private function getField($fieldName)
304
+ {
305
+ if (array_key_exists($fieldName, $this->snsMessage)) {
306
+ return $this->snsMessage[$fieldName];
307
+ } else {
308
+ return null;
309
+ }
310
+ }
311
+
312
+ /* returnMessage() - JSON decode the raw [Message] portion of the IPN */
313
+
314
+ public function returnMessage()
315
+ {
316
+ return json_decode($this->snsMessage['Message'], true);
317
+ }
318
+
319
+ /* toJson() - Converts IPN [Message] field to JSON
320
+ *
321
+ * Has child elements
322
+ * ['NotificationData'] [XML] - API call XML notification data
323
+ * @param remainingFields - consists of remaining IPN array fields that are merged
324
+ * Type - Notification
325
+ * MessageId - ID of the Notification
326
+ * Topic ARN - Topic of the IPN
327
+ * @return response in JSON format
328
+ */
329
+
330
+ public function toJson()
331
+ {
332
+ $response = $this->simpleXmlObject();
333
+
334
+ // Merging the remaining fields with the response
335
+ $remainingFields = $this->getRemainingIpnFields();
336
+ $responseArray = array_merge($remainingFields,(array)$response);
337
+
338
+ // Converting to JSON format
339
+ $response = json_encode($responseArray);
340
+
341
+ return $response;
342
+ }
343
+
344
+ /* toArray() - Converts IPN [Message] field to associative array
345
+ * @return response in array format
346
+ */
347
+
348
+ public function toArray()
349
+ {
350
+ $response = $this->simpleXmlObject();
351
+
352
+ // Converting the SimpleXMLElement Object to array()
353
+ $response = json_encode($response);
354
+ $response = json_decode($response, true);
355
+
356
+ // Merging the remaining fields with the response array
357
+ $remainingFields = $this->getRemainingIpnFields();
358
+ $response = array_merge($remainingFields,$response);
359
+
360
+ return $response;
361
+ }
362
+
363
+ /* addRemainingFields() - Add remaining fields to the datatype
364
+ *
365
+ * Has child elements
366
+ * ['NotificationData'] [XML] - API call XML response data
367
+ * Convert to SimpleXML element object
368
+ * Type - Notification
369
+ * MessageId - ID of the Notification
370
+ * Topic ARN - Topic of the IPN
371
+ * @return response in array format
372
+ */
373
+
374
+ private function simpleXmlObject()
375
+ {
376
+ $ipnMessage = $this->returnMessage();
377
+
378
+ // Getting the Simple XML element object of the IPN XML Response Body
379
+ $response = simplexml_load_string((string) $ipnMessage['NotificationData']);
380
+
381
+ // Adding the Type, MessageId, TopicArn details of the IPN to the Simple XML element Object
382
+ $response->addChild('Type', $this->snsMessage['Type']);
383
+ $response->addChild('MessageId', $this->snsMessage['MessageId']);
384
+ $response->addChild('TopicArn', $this->snsMessage['TopicArn']);
385
+
386
+ return $response;
387
+ }
388
+
389
+ /* getRemainingIpnFields()
390
+ * Gets the remaining fields of the IPN to be later appended to the return message
391
+ */
392
+
393
+ private function getRemainingIpnFields()
394
+ {
395
+ $ipnMessage = $this->returnMessage();
396
+
397
+ $remainingFields = array(
398
+ 'NotificationReferenceId' =>$ipnMessage['NotificationReferenceId'],
399
+ 'NotificationType' =>$ipnMessage['NotificationType'],
400
+ 'IsSample' =>$ipnMessage['IsSample'],
401
+ 'SellerId' =>$ipnMessage['SellerId'],
402
+ 'ReleaseEnvironment' =>$ipnMessage['ReleaseEnvironment'],
403
+ 'Version' =>$ipnMessage['Version']);
404
+
405
+ return $remainingFields;
406
+ }
407
+ }
wpsc-components/merchant-core-v3/libraries/amazon-payments/sdk/ResponseParser.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace PayWithAmazon;
3
+
4
+ /* ResponseParser
5
+ * Methods provided to convert the Response from the POST to XML, Array or JSON
6
+ */
7
+
8
+ require_once 'Interface.php';
9
+
10
+ class ResponseParser implements ResponseInterface
11
+ {
12
+ public $response = null;
13
+
14
+ public function __construct($response=null)
15
+ {
16
+ $this->response = $response;
17
+ }
18
+
19
+ /* Returns the XML portion of the response */
20
+
21
+ public function toXml()
22
+ {
23
+ return $this->response['ResponseBody'];
24
+ }
25
+
26
+ /* toJson - converts XML into Json
27
+ * @param $response [XML]
28
+ */
29
+
30
+ public function toJson()
31
+ {
32
+ $response = $this->simpleXmlObject();
33
+
34
+ return (json_encode($response));
35
+ }
36
+
37
+ /* toArray - converts XML into associative array
38
+ * @param $this->response [XML]
39
+ */
40
+
41
+ public function toArray()
42
+ {
43
+ $response = $this->simpleXmlObject();
44
+
45
+ // Converting the SimpleXMLElement Object to array()
46
+ $response = json_encode($response);
47
+
48
+ return (json_decode($response, true));
49
+ }
50
+
51
+ private function simpleXmlObject()
52
+ {
53
+ $response = $this->response;
54
+
55
+ // Getting the HttpResponse Status code to the output as a string
56
+ $status = strval($response['Status']);
57
+
58
+ // Getting the Simple XML element object of the XML Response Body
59
+ $response = simplexml_load_string((string) $response['ResponseBody']);
60
+
61
+ // Adding the HttpResponse Status code to the output as a string
62
+ $response->addChild('ResponseStatus', $status);
63
+
64
+ return $response;
65
+ }
66
+
67
+ /* Get the status of the BillingAgreement */
68
+
69
+ public function getBillingAgreementDetailsStatus($response)
70
+ {
71
+ $data= new \SimpleXMLElement($response);
72
+ $namespaces = $data->getNamespaces(true);
73
+ foreach($namespaces as $key=>$value){
74
+ $namespace = $value;
75
+ }
76
+ $data->registerXPathNamespace('GetBA', $namespace);
77
+ foreach ($data->xpath('//GetBA:BillingAgreementStatus') as $value) {
78
+ $baStatus = json_decode(json_encode((array)$value), TRUE);
79
+ }
80
+
81
+ return $baStatus ;
82
+ }
83
+ }
wpsc-components/theme-engine-v1/classes/breadcrumbs.php CHANGED
@@ -74,9 +74,28 @@ function wpsc_breadcrumb_url() {
74
  */
75
  function wpsc_output_breadcrumbs( $options = null ) {
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  // Defaults
78
  $options = apply_filters( 'wpsc_output_breadcrumbs_options', $options );
79
- $options = wp_parse_args( (array)$options, array(
80
  'before-breadcrumbs' => '<div class="wpsc-breadcrumbs">',
81
  'after-breadcrumbs' => '</div>',
82
  'before-crumb' => '',
@@ -84,19 +103,37 @@ function wpsc_output_breadcrumbs( $options = null ) {
84
  'crumb-separator' => ' &raquo; ',
85
  'show_home_page' => true,
86
  'show_products_page' => true,
87
- 'echo' => true
 
88
  ) );
89
 
90
  $output = '';
91
- $products_page_id = wpsc_get_the_post_id_by_shortcode( '[productspage]' );
92
  $products_page = get_post( $products_page_id );
93
- if ( !wpsc_has_breadcrumbs() ) {
 
94
  return;
95
  }
 
96
  $filtered_products_page = array(
97
  'url' => get_option( 'product_list_url' ),
98
- 'name' => apply_filters ( 'the_title', $products_page->post_title )
99
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  $filtered_products_page = apply_filters( 'wpsc_change_pp_breadcrumb', $filtered_products_page );
101
 
102
  // Home Page Crumb
@@ -131,6 +168,15 @@ function wpsc_output_breadcrumbs( $options = null ) {
131
  }
132
  $output .= $options['after-crumb'];
133
  }
 
 
 
 
 
 
 
 
 
134
  $output = $options['before-breadcrumbs'] . apply_filters( 'wpsc_output_breadcrumbs', $output, $options ) . $options['after-breadcrumbs'];
135
  if ( $options['echo'] ) {
136
  echo $output;
74
  */
75
  function wpsc_output_breadcrumbs( $options = null ) {
76
 
77
+ /**
78
+ * Filter the arguments passed to wpsc_output_breadcrumbs.
79
+ *
80
+ * @since 3.9.0
81
+ * @param array $options {
82
+ * associative array of options for outputting the breadcrumbs to this page.
83
+ *
84
+ * 'before-breadcrumbs' string HTML output to start the breadcrumb.
85
+ * 'after-breadcrumbs' string HTML output at the end of the breadcrumb eg closing tag.
86
+ * 'before-crumb' string output before each step in path, typically decorative.
87
+ * 'after-crumb' string output after each step in path.
88
+ * 'crumb-separator' string demarks space between steps in path.
89
+ * 'show_home_page' bool Whether to include home page as step at start of path.
90
+ * 'show_products_page' bool Whether to include products-page as second step in path.
91
+ * 'echo' bool if true, outputs constructed string; if false, returns constructed string.
92
+ * 'products_page_id' int Override the page id used for products_page
93
+ * }
94
+ *
95
+ */
96
  // Defaults
97
  $options = apply_filters( 'wpsc_output_breadcrumbs_options', $options );
98
+ $options = wp_parse_args( (array) $options, array(
99
  'before-breadcrumbs' => '<div class="wpsc-breadcrumbs">',
100
  'after-breadcrumbs' => '</div>',
101
  'before-crumb' => '',
103
  'crumb-separator' => ' &raquo; ',
104
  'show_home_page' => true,
105
  'show_products_page' => true,
106
+ 'echo' => true,
107
+ 'products_page_id' => wpsc_get_the_post_id_by_shortcode( '[productspage]' )
108
  ) );
109
 
110
  $output = '';
111
+ $products_page_id = absint( $options['products_page_id'] );
112
  $products_page = get_post( $products_page_id );
113
+
114
+ if ( ! wpsc_has_breadcrumbs() ) {
115
  return;
116
  }
117
+
118
  $filtered_products_page = array(
119
  'url' => get_option( 'product_list_url' ),
120
+ 'name' => apply_filters ( 'the_title', $products_page->post_title, $products_page_id )
121
  );
122
+
123
+ /**
124
+ * Filter the values used to create the products-page step.
125
+ *
126
+ * Overrides the url and text show for the products-page step in breadcrumb.
127
+ *
128
+ * @since 3.9.0
129
+ * @param array $filtered_products_page {
130
+ * associative array of options for outputting the breadcrumbs to this page.
131
+ *
132
+ * 'url' string Fully-qualified url to products-page.
133
+ * 'name' string The name that will appear for the products-page in breadcrumb.
134
+ * }
135
+ *
136
+ */
137
  $filtered_products_page = apply_filters( 'wpsc_change_pp_breadcrumb', $filtered_products_page );
138
 
139
  // Home Page Crumb
168
  }
169
  $output .= $options['after-crumb'];
170
  }
171
+
172
+ /**
173
+ * Filter the assembled breadcrumb.
174
+ *
175
+ * @since 3.9.0
176
+ * @param string $output The constructed breadcrumb string.
177
+ * @param array $options {@see 'wpsc_output_breadcrumbs_options'}
178
+ *
179
+ */
180
  $output = $options['before-breadcrumbs'] . apply_filters( 'wpsc_output_breadcrumbs', $output, $options ) . $options['after-breadcrumbs'];
181
  if ( $options['echo'] ) {
182
  echo $output;
wpsc-components/theme-engine-v1/classes/checkout-ajax.php CHANGED
@@ -213,7 +213,7 @@ function wpsc_customer_updated_data_ajax() {
213
  } elseif ( ! empty( $_REQUEST['meta_key'] ) && isset( $_REQUEST['meta_value'] ) ) {
214
  $customer_meta = array( $_REQUEST['meta_key'] => $_REQUEST['meta_value'] );
215
  } else {
216
- _wpsc_doing_it_wrong( __FUNCTION__, __( 'missing meta key or meta array', 'wpsc' ), '3.8.14' );
217
  $customer_meta = array();
218
  }
219
 
@@ -250,11 +250,11 @@ function wpsc_customer_updated_data_ajax() {
250
  $response['error'] = '';
251
  } else {
252
  $response['type'] = 'error';
253
- $response['error'] = __( 'meta values may not have been updated', 'wpsc' );
254
  }
255
  } else {
256
  $response['type'] = 'error';
257
- $response['error'] = __( 'invalid parameters, meta array or meta key value pair required', 'wpsc' );
258
  }
259
 
260
  // Let's see what the current state of the customer meta set is after we applied the requested updates
213
  } elseif ( ! empty( $_REQUEST['meta_key'] ) && isset( $_REQUEST['meta_value'] ) ) {
214
  $customer_meta = array( $_REQUEST['meta_key'] => $_REQUEST['meta_value'] );
215
  } else {
216
+ _wpsc_doing_it_wrong( __FUNCTION__, __( 'missing meta key or meta array', 'wp-e-commerce' ), '3.8.14' );
217
  $customer_meta = array();
218
  }
219
 
250
  $response['error'] = '';
251
  } else {
252
  $response['type'] = 'error';
253
+ $response['error'] = __( 'meta values may not have been updated', 'wp-e-commerce' );
254
  }
255
  } else {
256
  $response['type'] = 'error';
257
+ $response['error'] = __( 'invalid parameters, meta array or meta key value pair required', 'wp-e-commerce' );
258
  }
259
 
260
  // Let's see what the current state of the customer meta set is after we applied the requested updates
wpsc-components/theme-engine-v1/classes/checkout-localization.php CHANGED
@@ -14,9 +14,9 @@ add_filter( 'wpsc_javascript_localizations', '_wpsc_countries_localizations', 10
14
  */
15
  function _wpsc_countries_localizations( $localizations_array ) {
16
 
17
- $localizations_array['no_country_selected'] = __( 'Please select a country', 'wpsc' );
18
- $localizations_array['no_region_selected_format'] = __( 'Please select a %s', 'wpsc' );
19
- $localizations_array['no_region_label'] = __( 'State/Province', 'wpsc' );
20
  $localizations_array['base_country'] = get_option( 'base_country' );
21
 
22
  $country_list = array();
14
  */
15
  function _wpsc_countries_localizations( $localizations_array ) {
16
 
17
+ $localizations_array['no_country_selected'] = __( 'Please select a country', 'wp-e-commerce' );
18
+ $localizations_array['no_region_selected_format'] = __( 'Please select a %s', 'wp-e-commerce' );
19
+ $localizations_array['no_region_label'] = __( 'State/Province', 'wp-e-commerce' );
20
  $localizations_array['base_country'] = get_option( 'base_country' );
21
 
22
  $country_list = array();
wpsc-components/theme-engine-v1/classes/hide-subcatsprods-in-cat.php CHANGED
@@ -13,49 +13,37 @@ class WPSC_Hide_subcatsprods_in_cat {
13
  var $q;
14
 
15
  function get_posts( &$q ) {
16
- $this->q =& $q;
17
- if ( ( !isset($q->query_vars['taxonomy']) || ( "wpsc_product_category" != $q->query_vars['taxonomy'] )) )
18
- return false;
19
 
20
- add_action( 'posts_where', array( &$this, 'where' ) );
21
- add_action( 'posts_join', array( &$this, 'join' ) );
 
 
22
  }
23
 
24
  function where( $where ) {
25
- global $wpdb;
26
 
27
- remove_action( 'posts_where', array( &$this, 'where' ) );
28
 
29
- $term_id=$wpdb->get_var($wpdb->prepare('SELECT term_id FROM '.$wpdb->terms.' WHERE slug = %s ', $this->q->query_vars['term']));
 
30
 
31
- if ( !is_numeric( $term_id ) || $term_id < 1 )
32
- return $where;
33
 
34
- $term_taxonomy_id = $wpdb->get_var($wpdb->prepare('SELECT term_taxonomy_id FROM '.$wpdb->term_taxonomy.' WHERE term_id = %d and taxonomy = %s', $term_id, $this->q->query_vars['taxonomy']));
35
 
36
- if ( !is_numeric($term_taxonomy_id) || $term_taxonomy_id < 1)
37
- return $where;
38
 
39
- $field = preg_quote( "$wpdb->term_relationships.term_taxonomy_id", '#' );
 
 
 
 
 
 
40
 
41
- $just_one = $wpdb->prepare( " AND $wpdb->term_relationships.term_taxonomy_id = %d ", $term_taxonomy_id );
42
- if ( preg_match( "#AND\s+$field\s+IN\s*\(\s*(?:['\"]?\d+['\"]?\s*,\s*)*['\"]?\d+['\"]?\s*\)#", $where, $matches ) )
43
- $where = str_replace( $matches[0], $just_one, $where );
44
- else
45
- $where .= $just_one;
46
 
47
- return $where;
48
  }
49
 
50
- function join($join){
51
- global $wpdb;
52
- remove_action( 'posts_where', array( &$this, 'where' ) );
53
- remove_action( 'posts_join', array( &$this, 'join' ) );
54
- if( strpos($join, "JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)" ) ){
55
- return $join;
56
- }
57
- $join .= " JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)";
58
- return $join;
59
- }
60
  }
61
-
13
  var $q;
14
 
15
  function get_posts( &$q ) {
 
 
 
16
 
17
+ $this->_wpsc_doing_it_wrong( 'get_posts' );
18
+
19
+ return false;
20
+
21
  }
22
 
23
  function where( $where ) {
 
24
 
25
+ $this->_wpsc_doing_it_wrong( 'where' );
26
 
27
+ return $where;
28
+ }
29
 
30
+ function join( $join ){
 
31
 
32
+ $this->_wpsc_doing_it_wrong( 'join' );
33
 
34
+ return $join;
35
+ }
36
 
37
+ /**
38
+ * Doing it Wrong
39
+ *
40
+ * @since 4.0
41
+ * @access private
42
+ */
43
+ function _wpsc_doing_it_wrong( $method ) {
44
 
45
+ _wpsc_doing_it_wrong( 'WPSC_Hide_subcatsprods_in_cat->' . $method . '()', __( 'This class is deprecated. There is no direct replacement. Hiding subcategory products in parent categories is now handled by the private wpsc_hide_subcatsprods_in_cat_query() function.', 'wp-e-commerce' ), '4.0' );
 
 
 
 
46
 
 
47
  }
48
 
 
 
 
 
 
 
 
 
 
 
49
  }
 
wpsc-components/theme-engine-v1/classes/settings-tab-presentation.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
4
  public function __construct() {
5
- $this->page_title = __( 'General Settings', 'wpsc' );
6
  }
7
 
8
  public function category_list() {
@@ -17,16 +17,16 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
17
  else
18
  $selected = '';
19
 
20
- $categorylist .= "<option value='all' " . $selected . " >" . __( 'Show All Products', 'wpsc' ) . "</option>";
21
 
22
  if ( $current_default == 'list' )
23
  $selected = "selected='selected'";
24
  else
25
  $selected = '';
26
 
27
- $categorylist .= "<option value='list' " . $selected . " >" . __( 'Show list of product categories', 'wpsc' ) . "</option>";
28
 
29
- $categorylist .= "<optgroup label='" . __( 'Product Categories', 'wpsc' ) . "'>";
30
  foreach ( $group_data as $group ) {
31
  $selected = "";
32
  if ( $current_default == $group->term_id )
@@ -81,7 +81,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
81
  ?>
82
  <div id="poststuff" class="metabox-holder">
83
  <div id="themes_and_appearance" class='postbox'>
84
- <h3 class="hndle"><span><?php esc_html_e( "Advanced Theme Settings", 'wpsc' ); ?></span></h3>
85
  <div class="inside">
86
  <?php
87
 
@@ -89,7 +89,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
89
  ?>
90
 
91
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
92
- <p><?php esc_html_e( 'You did not specify any template files to be moved.', 'wpsc' ); ?></p>
93
  </div>
94
  <?php
95
  $_SESSION['wpsc_theme_empty'] = false;
@@ -99,9 +99,9 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
99
  ?>
100
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
101
  <?php if(in_array(false, $_SESSION['wpsc_themes_copied_results'], true)): ?>
102
- <p style="color:red;"><?php esc_html_e( 'Error: some files could not be copied. Please make sure that theme folder is writable.', 'wpsc' ); ?></p>
103
  <?php else: ?>
104
- <p><?php esc_html_e( 'Thanks, the themes have been copied.', 'wpsc' ); ?></p>
105
  <?php endif; ?>
106
  </div>
107
  <?php
@@ -111,8 +111,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
111
  if ( isset( $_SESSION['wpsc_themes_backup'] ) && ($_SESSION['wpsc_themes_backup'] == true) ) {
112
  ?>
113
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
114
- <p><?php _e( 'Thanks, you have made a succesful backup of your theme. It is located at the URL below. Please note each backup you create will replace your previous backups.', 'wpsc' ); ?></p>
115
- <p><?php _e( 'URL:', 'wpsc' ); ?> <?php echo "/" . str_replace( ABSPATH, "", WPSC_THEME_BACKUP_DIR ); ?></p>
116
  </div>
117
  <?php
118
  $_SESSION['wpsc_themes_backup'] = false;
@@ -121,9 +121,9 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
121
  <p>
122
  <?php if(false !== $themes_location)
123
  //Some themes have been moved to the themes folder
124
- _e( 'Some Theme files have been moved to your WordPress Theme Folder.', 'wpsc' );
125
  else
126
- _e( 'No Theme files have been moved to your WordPress Theme Folder.', 'wpsc' );
127
 
128
  ?>
129
 
@@ -131,7 +131,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
131
  <p>
132
  <?php _e( 'WP eCommerce provides you the ability to move your theme files to a safe place for theming control.
133
 
134
- If you want to change the look of your site, select the files you want to edit from the list and click the move button. This will copy the template files to your active WordPress theme. ','wpsc' ); ?>
135
  </p>
136
  <ul>
137
  <?php
@@ -147,7 +147,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
147
  </ul>
148
  <p>
149
  <?php if(false !== $themes_location){
150
- esc_html_e( 'To change the look of certain aspects of your shop, you can edit the moved files that are found here:', 'wpsc' );
151
  ?>
152
  </p>
153
  <p class="howto"> <?php echo get_stylesheet_directory(); ?></p>
@@ -155,19 +155,19 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
155
  <p><?php
156
  wp_nonce_field('wpsc_copy_themes');
157
  ?>
158
- <input type='submit' value='<?php esc_attr_e( 'Move Template Files &rarr;' ); ?>' class="button" name='wpsc_move_themes' />
159
  </p>
160
- <p><?php _e( 'You can create a copy of your WordPress Theme by clicking the backup button bellow. Once copied you can find them here:' ,'wpsc' ); ?></p>
161
  <p class="howto"><?php echo esc_html( '/wp-content/uploads/wpsc/theme_backup/' ); ?></p>
162
  <p>
163
  <?php
164
- printf( __( '<a href="%s" class="button">Backup Your WordPress Theme</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_admin_action=backup_themes', 'backup_themes' ) ); ?>
165
  <br style="clear:both" />
166
  </p>
167
 
168
  <br style="clear:both" />
169
- <p><?php esc_html_e( 'If you have moved your files in some other way i.e FTP, you may need to click the Flush Theme Cache. This will refresh the locations WordPress looks for your templates.' ,'wpsc' ); ?></p>
170
- <p><?php printf( __( '<a href="%s" class="button">Flush Theme Cache</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_flush_theme_transients=true', 'wpsc_flush_theme_transients' ) ); ?></p>
171
  <br style="clear:both" />
172
  <br style="clear:both" />
173
  </div>
@@ -182,10 +182,10 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
182
 
183
  <?php $this->theme_metabox(); ?>
184
 
185
- <h3 class="form_group"><?php esc_html_e( 'Button Settings', 'wpsc' ); ?></h3>
186
  <table class='wpsc_options form-table' style="width:550px">
187
  <tr>
188
- <th scope="row"><?php esc_html_e( 'Button Type', 'wpsc' ); ?>:</th>
189
  <td>
190
  <?php
191
  $addtocart_or_buynow = get_option( 'addtocart_or_buynow' );
@@ -202,22 +202,22 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
202
  }
203
  ?>
204
  <input type='radio' value='0' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow1' <?php echo $addtocart_or_buynow1; ?> />
205
- <label for='addtocart_or_buynow1'><?php esc_html_e( 'Add To Cart', 'wpsc' ); ?></label> &nbsp;<br />
206
  <?php $selected_gateways = get_option( 'custom_gateway_options' );
207
  $disable_buy_now = '';
208
  $message = '';
209
  if (!in_array( 'wpsc_merchant_paypal_standard', (array)$selected_gateways )){
210
  $disable_buy_now = 'disabled="disabled"';
211
- $message = __( 'Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.','wpsc' );
212
  } ?>
213
  <input <?php echo $disable_buy_now; ?> type='radio' value='1' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow2' <?php echo $addtocart_or_buynow2; ?> />
214
- <label for='addtocart_or_buynow2'><?php _e( 'Buy Now', 'wpsc' ); ?></label><br />
215
  <?php echo $message; ?>
216
  </td>
217
  </tr>
218
 
219
  <tr>
220
- <th scope="row"><?php esc_html_e( 'Hide "Add to cart" button', 'wpsc' ); ?>:</th>
221
  <td>
222
  <?php
223
  $hide_addtocart_button = get_option( 'hide_addtocart_button' );
@@ -233,18 +233,18 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
233
  break;
234
  }
235
  ?>
236
- <input type='radio' value='1' name='wpsc_options[hide_addtocart_button]' id='hide_addtocart_button1' <?php echo $hide_addtocart_button1; ?> /> <label for='hide_addtocart_button1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
237
- <input type='radio' value='0' name='wpsc_options[hide_addtocart_button]' id='hide_addtocart_button2' <?php echo $hide_addtocart_button2; ?> /> <label for='hide_addtocart_button2'><?php _e( 'No', 'wpsc' ); ?></label>
238
  </td>
239
  </tr>
240
  </table>
241
 
242
- <h3 class="form_group"><?php esc_html_e( 'Product Settings', 'wpsc' ); ?></h3>
243
 
244
  <table class='wpsc_options form-table'>
245
 
246
  <tr>
247
- <th scope="row"><?php esc_html_e( 'Show Product Ratings', 'wpsc' ); ?>:</th>
248
  <td>
249
  <?php
250
  $display_pnp = get_option( 'product_ratings' );
@@ -260,8 +260,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
260
  break;
261
  }
262
  ?>
263
- <input type='radio' value='1' name='wpsc_options[product_ratings]' id='product_ratings1' <?php echo $product_ratings1; ?> /> <label for='product_ratings1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
264
- <input type='radio' value='0' name='wpsc_options[product_ratings]' id='product_ratings2' <?php echo $product_ratings2; ?> /> <label for='product_ratings2'><?php _e( 'No', 'wpsc' ); ?></label>
265
  </td>
266
  </tr>
267
  <tr>
@@ -274,16 +274,16 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
274
  $list_view_quantity_value2 = 'checked="checked"';
275
  ?>
276
  <th scope="row">
277
- <?php esc_html_e( 'Show Stock Availability', 'wpsc' ); ?>:
278
  </th>
279
  <td>
280
- <input type='radio' value='1' name='wpsc_options[list_view_quantity]' id='list_view_quantity1' <?php echo $list_view_quantity_value1; ?> /> <label for='list_view_quantity1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
281
- <input type='radio' value='0' name='wpsc_options[list_view_quantity]' id='list_view_quantity2' <?php echo $list_view_quantity_value2; ?> /> <label for='list_view_quantity2'><?php _e( 'No', 'wpsc' ); ?></label> &nbsp;
282
  </td>
283
  </tr>
284
  <tr>
285
  <th scope="row">
286
- <?php esc_html_e( 'Display Fancy Purchase Notifications', 'wpsc' ); ?>:
287
  </th>
288
  <td>
289
  <?php
@@ -300,14 +300,14 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
300
  break;
301
  }
302
  ?>
303
- <input type='radio' value='1' name='wpsc_options[fancy_notifications]' id='fancy_notifications1' <?php echo $fancy_notifications1; ?> /> <label for='fancy_notifications1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
304
- <input type='radio' value='0' name='wpsc_options[fancy_notifications]' id='fancy_notifications2' <?php echo $fancy_notifications2; ?> /> <label for='fancy_notifications2'><?php _e( 'No', 'wpsc' ); ?></label>
305
  </td>
306
  </tr>
307
 
308
 
309
  <tr>
310
- <th scope="row"><?php esc_html_e( 'Display per item shipping', 'wpsc' ); ?>:</th>
311
  <td>
312
  <?php
313
  $display_pnp = get_option( 'display_pnp' );
@@ -323,13 +323,13 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
323
  break;
324
  }
325
  ?>
326
- <input type='radio' value='1' name='wpsc_options[display_pnp]' id='display_pnp1' <?php echo $display_pnp1; ?> /> <label for='display_pnp1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
327
- <input type='radio' value='0' name='wpsc_options[display_pnp]' id='display_pnp2' <?php echo $display_pnp2; ?> /> <label for='display_pnp2'><?php _e( 'No', 'wpsc' ); ?></label>
328
  </td>
329
  </tr>
330
 
331
  <tr>
332
- <th scope="row"><?php esc_html_e( 'Disable link in Title', 'wpsc' ); ?>: </th>
333
  <td>
334
  <?php
335
  $hide_name_link = get_option( 'hide_name_link' );
@@ -346,14 +346,14 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
346
  }
347
  ?>
348
  <input type='radio' value='1' name='wpsc_options[hide_name_link]' id='hide_name_link1' <?php echo $hide_name_link1; ?> />
349
- <label for='hide_name_link1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
350
  <input type='radio' value='0' name='wpsc_options[hide_name_link]' id='hide_name_link2' <?php echo $hide_name_link2; ?> />
351
- <label for='hide_name_link2'><?php _e( 'No', 'wpsc' ); ?></label>
352
  </td>
353
  </tr>
354
 
355
  <tr>
356
- <th scope="row"><?php esc_html_e( 'Add quantity field to each product description', 'wpsc' ); ?>:</th>
357
  <td>
358
  <?php
359
  $multi_adding = get_option( 'multi_add' );
@@ -369,20 +369,20 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
369
  ?>
370
  <input type='radio' value='1' name='wpsc_options[multi_add]' id='multi_adding1' <?php if ( isset( $multi_adding1 ) )
371
  echo $multi_adding1; ?> />
372
- <label for='multi_adding1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
373
  <input type='radio' value='0' name='wpsc_options[multi_add]' id='multi_adding2' <?php if ( isset( $multi_adding2 ) )
374
  echo $multi_adding2; ?> />
375
- <label for='multi_adding2'><?php _e( 'No', 'wpsc' ); ?></label>
376
  </td>
377
  </tr>
378
  </table>
379
  </div>
380
 
381
 
382
- <h3 class="form_group"><?php esc_html_e( 'Product Page Settings', 'wpsc' ); ?></h3>
383
  <table class='wpsc_options form-table'>
384
  <tr>
385
- <th scope="row"><?php esc_html_e( 'Product Display', 'wpsc' ); ?>:</th>
386
  <td>
387
  <?php
388
  $display_pnp = get_option( 'product_view' );
@@ -434,25 +434,25 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
434
  }
435
  ?>
436
  <select name='wpsc_options[product_view]'>
437
- <option value='default' <?php echo $product_view1; ?>><?php esc_html_e( 'Default View', 'wpsc' ); ?></option>
438
  <?php
439
  if ( function_exists( 'product_display_list' ) ) {
440
  ?>
441
- <option value='list' <?php echo $product_view2; ?>><?php esc_html_e( 'List View', 'wpsc' ); ?></option>
442
  <?php
443
  } else {
444
  ?>
445
- <option value='list' disabled='disabled' <?php echo $product_view2; ?>><?php esc_html_e( 'List View', 'wpsc' ); ?></option>
446
  <?php
447
  }
448
 
449
  if ( function_exists( 'product_display_grid' ) ) {
450
  ?>
451
- <option value='grid' <?php echo $product_view3; ?>><?php esc_html_e( 'Grid View', 'wpsc' ); ?></option>
452
  <?php
453
  } else {
454
  ?>
455
- <option value='grid' disabled='disabled' <?php echo $product_view3; ?>><?php esc_html_e( 'Grid View', 'wpsc' ); ?></option>
456
  <?php
457
  }
458
  ?>
@@ -460,7 +460,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
460
  <?php
461
  if ( ! function_exists( 'product_display_grid' ) ) {
462
  ?>
463
- <a href='http://wpecommerce.org/store/premium-plugins/'><?php esc_html_e( 'Purchase unavailable options', 'wpsc' ); ?></a>
464
  <?php
465
  }
466
  ?>
@@ -468,30 +468,30 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
468
  </tr>
469
 
470
  <tr id="wpsc-grid-settings">
471
- <th scope="row"><?php esc_html_e( 'Grid view settings:', 'wpsc' ) ?></th>
472
  <td>
473
- <input type='number' min="0" name='wpsc_options[grid_number_per_row]' id='grid_number_per_row' size='2' value='<?php esc_attr_e( get_option( 'grid_number_per_row' ) ); ?>' class='small-text' />
474
- <label for='grid_number_per_row'><?php esc_html_e( 'Products Per Row', 'wpsc' ); ?></label><br />
475
 
476
  <input type='hidden' value='0' name='wpsc_options[show_images_only]' />
477
  <input type='checkbox' value='1' name='wpsc_options[show_images_only]' id='wpsc-show-images-only' <?php echo $show_images_only_value; ?> />
478
- <label for='wpsc-show-images-only'><?php esc_html_e( 'Show images only', 'wpsc' ); ?></label><br />
479
 
480
  <input type='hidden' value='0' name='wpsc_options[display_variations]' />
481
  <input type='checkbox' value='1' name='wpsc_options[display_variations]' id='wpsc-display-variations' <?php echo $display_variations; ?> />
482
- <label for='wpsc-display-variations'><?php esc_html_e( 'Display Variations', 'wpsc' ); ?></label><br />
483
 
484
  <input type='hidden' value='0' name='wpsc_options[display_description]' />
485
  <input type='checkbox' value='1' name='wpsc_options[display_description]' id='wpsc-display-description' <?php echo $display_description; ?> />
486
- <label for='wpsc-display-description'><?php esc_html_e( 'Display Description', 'wpsc' ); ?></label><br />
487
 
488
  <input type='hidden' value='0' name='wpsc_options[display_addtocart]' />
489
  <input type='checkbox' value='1' name='wpsc_options[display_addtocart]' id='wpsc-display-add-to-cart' <?php echo $display_addtocart; ?> />
490
- <label for='wpsc-display-add-to-cart'><?php esc_html_e( 'Display "Add To Cart" Button', 'wpsc' ); ?></label><br />
491
 
492
  <input type='hidden' value='0' name='wpsc_options[display_moredetails]' />
493
  <input type='checkbox' value='1' name='wpsc_options[display_moredetails]' id='wpsc-display-more-details' <?php echo $display_moredetails; ?> />
494
- <label for='wpsc-display-more-details'><?php esc_html_e( 'Display "More Details" Button', 'wpsc' ); ?></label>
495
  </td>
496
  </tr>
497
 
@@ -504,17 +504,17 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
504
  ?>
505
 
506
  <tr>
507
- <th scope="row"><?php esc_html_e( 'Show list of categories', 'wpsc' ); ?>:</th>
508
  <td>
509
  <input type='radio' value='1' name='wpsc_options[wpsc_display_categories]' id='display_categories2' <?php echo $selected1; ?> />
510
- <label for='display_categories2'><?php _e( 'Yes', 'wpsc' ); ?></label>
511
  <input type='radio' value='0' name='wpsc_options[wpsc_display_categories]' id='display_categories1' <?php echo $selected2; ?> />
512
- <label for='display_categories1'><?php _e( 'No', 'wpsc' ); ?></label><br />
513
  </td>
514
  </tr>
515
 
516
  <tr>
517
- <th scope="row"><?php esc_html_e( 'Select what product category you want to display on the products page', 'wpsc' ); ?>:</th>
518
  <td>
519
  <?php echo $this->category_list(); ?>
520
  </td>
@@ -542,29 +542,29 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
542
  ?>
543
  <tr>
544
  <th scope="row">
545
- <?php _e( 'Sort Product By', 'wpsc' ); ?>:
546
  </th>
547
  <td>
548
  <select name='wpsc_options[wpsc_sort_by]'>
549
  <option <?php if ( isset( $wpsc_sort_by1 ) )
550
- echo $wpsc_sort_by1; ?> value='name'><?php esc_html_e( 'Name', 'wpsc' ); ?></option>
551
  <option <?php if ( isset( $wpsc_sort_by2 ) )
552
- echo $wpsc_sort_by2; ?> value='price'><?php esc_html_e( 'Price', 'wpsc' ); ?></option>
553
  <option <?php if ( isset( $wpsc_sort_by4 ) )
554
- echo $wpsc_sort_by4; ?> value='dragndrop'><?php esc_html_e( 'Drag &amp; Drop', 'wpsc' ); ?></option>
555
  <option <?php if ( isset( $wpsc_sort_by3 ) )
556
- echo $wpsc_sort_by3; ?> value='id'><?php esc_html_e( 'Time Uploaded', 'wpsc' ); ?></option>
557
  </select>
558
 
559
  <select name="wpsc_options[wpsc_product_order]">
560
- <option value="ASC" <?php selected( get_option( 'wpsc_product_order' ), 'ASC' ); ?>><?php _ex( 'Ascending', 'product order setting', 'wpsc' ); ?></option>
561
- <option value="DESC" <?php selected( get_option( 'wpsc_product_order' ), 'DESC' ); ?>><?php _ex( 'Descending', 'product order setting', 'wpsc' ); ?></option>
562
  </select>
563
  </td>
564
  </tr>
565
 
566
  <tr>
567
- <th scope="row"><?php esc_html_e( 'Show Breadcrumbs', 'wpsc' ); ?>:</th>
568
  <td>
569
  <?php
570
  $show_breadcrumbs = get_option( 'show_breadcrumbs' );
@@ -580,8 +580,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
580
  break;
581
  }
582
  ?>
583
- <input type='radio' value='1' name='wpsc_options[show_breadcrumbs]' id='show_breadcrumbs1' <?php echo $show_breadcrumbs1; ?> /> <label for='show_breadcrumbs1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
584
- <input type='radio' value='0' name='wpsc_options[show_breadcrumbs]' id='show_breadcrumbs2' <?php echo $show_breadcrumbs2; ?> /> <label for='show_breadcrumbs2'><?php _e( 'No', 'wpsc' ); ?></label>
585
  </td>
586
  </tr>
587
 
@@ -589,7 +589,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
589
 
590
  <tr>
591
  <th scope="row">
592
- <?php esc_html_e( 'Product Groups/Products Display', 'wpsc' ); ?>:
593
  </th>
594
  <td>
595
  <?php
@@ -606,14 +606,14 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
606
  break;
607
  }
608
  ?>
609
- <input type='radio' value='0' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type1' <?php echo $catsprods_display_type1; ?> /> <label for='catsprods_display_type1'><?php _e( 'Product Groups Only (All products displayed)', 'wpsc' ); ?></label><br/>
610
- <input type='radio' value='1' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type2' <?php echo $catsprods_display_type2; ?> /> <label for='catsprods_display_type2'><?php _e( 'Sliding Product Groups (1 product per page)', 'wpsc' ); ?></label>
611
  </td>
612
  </tr>
613
 
614
  <tr>
615
  <th scope="row">
616
- <?php esc_html_e( 'Show Subcategory Products in Parent Category', 'wpsc' ); ?>:
617
  </th>
618
  <td>
619
  <?php
@@ -629,8 +629,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
629
  break;
630
  }
631
  ?>
632
- <input type="radio" value="1" name="wpsc_options[show_subcatsprods_in_cat]" id="show_subcatsprods_in_cat_on" <?php echo $show_subcatsprods_in_cat_on; ?> /> <label for="show_subcatsprods_in_cat_on"><?php echo __( 'Yes', 'wpsc' ); ?></label> &nbsp;
633
- <input type="radio" value="0" name="wpsc_options[show_subcatsprods_in_cat]" id="show_subcatsprods_in_cat_off" <?php echo $show_subcatsprods_in_cat_off; ?> /> <label for="show_subcatsprods_in_cat_off"><?php echo __( 'No', 'wpsc' ); ?></label>
634
  </td>
635
  </tr>
636
 
@@ -638,7 +638,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
638
  if ( function_exists( 'gold_shpcrt_search_form' ) ) {
639
  ?>
640
  <tr>
641
- <th scope="row"><?php esc_html_e( 'Show Search', 'wpsc' ); ?>:</th>
642
  <td>
643
  <?php
644
  $display_pnp = get_option( 'show_search' );
@@ -675,19 +675,19 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
675
 
676
  $embed_live_search_results = get_option( 'embed_live_search_results', '0' ) == '1' ? ' checked="checked"' : '';
677
  ?>
678
- <input type='radio' onclick='jQuery("#wpsc_advanced_search").show()' value='1' name='wpsc_options[show_search]' id='show_search1' <?php echo $show_search1; ?> /> <label for='show_search1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
679
- <input type='radio' onclick='jQuery("#wpsc_advanced_search").hide()' value='0' name='wpsc_options[show_search]' id='show_search2' <?php echo $show_search2; ?> /> <label for='show_search2'><?php _e( 'No', 'wpsc' ); ?></label>
680
 
681
  <div <?php echo $dis; ?> id='wpsc_advanced_search'>
682
  <input type='hidden' name='wpsc_options[show_advanced_search]' value='0' />
683
  <input type='checkbox' name='wpsc_options[show_advanced_search]' id='show_advanced_search' <?php echo $show_advanced_search; ?> value='1' />
684
- <?php esc_html_e( 'Show Advanced Search', 'wpsc' ); ?><br />
685
  <input type='hidden' name='wpsc_options[show_live_search]' value='0' />
686
  <input type='checkbox' name='wpsc_options[show_live_search]' id='show_live_search' <?php echo $show_live_search; ?> value='1' />
687
- <?php esc_html_e( 'Use Live Search', 'wpsc' ); ?><br />
688
  <input type='hidden' name='wpsc_options[embed_live_search_results]' value='0' />
689
  <input type='checkbox' name='wpsc_options[embed_live_search_results]' id='embed_live_search_results'<?php echo $embed_live_search_results; ?> value='1' />
690
- <?php esc_html_e( 'Dynamically replace search results into product list', 'wpsc' ); ?>
691
  </div>
692
  </td>
693
  </tr>
@@ -697,7 +697,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
697
 
698
 
699
  <tr>
700
- <th scope="row"><?php esc_html_e( 'Replace Page Title With Product/Category Name', 'wpsc' ); ?>:</th>
701
  <td>
702
  <?php
703
  $wpsc_replace_page_title = get_option( 'wpsc_replace_page_title' );
@@ -713,12 +713,12 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
713
  break;
714
  }
715
  ?>
716
- <input type='radio' value='1' name='wpsc_options[wpsc_replace_page_title]' id='wpsc_replace_page_title1' <?php echo $wpsc_replace_page_title1; ?> /> <label for='wpsc_replace_page_title1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
717
- <input type='radio' value='0' name='wpsc_options[wpsc_replace_page_title]' id='wpsc_replace_page_title2' <?php echo $wpsc_replace_page_title2; ?> /> <label for='wpsc_replace_page_title2'><?php _e( 'No', 'wpsc' ); ?></label>
718
  </td>
719
  </tr>
720
  <tr>
721
- <th scope="row"><?php esc_html_e( 'Display Featured Product above Product Pages', 'wpsc' ); ?>:</th>
722
  <td>
723
  <?php
724
  $wpsc_hide_featured_products = get_option( 'wpsc_hide_featured_products' );
@@ -735,16 +735,16 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
735
  break;
736
  }
737
  ?>
738
- <input type='radio' value='1' name='wpsc_options[wpsc_hide_featured_products]' id='wpsc_hide_featured_products1' <?php echo $wpsc_hide_featured_products1; ?> /> <label for='wpsc_hide_featured_products1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
739
- <input type='radio' value='0' name='wpsc_options[wpsc_hide_featured_products]' id='wpsc_hide_featured_products2' <?php echo $wpsc_hide_featured_products2; ?> /> <label for='wpsc_hide_featured_products2'><?php _e( 'No', 'wpsc' ); ?></label>
740
  </td>
741
  </tr>
742
  </table>
743
 
744
- <h3 class="form_group"><?php esc_html_e( 'Shopping Cart Settings', 'wpsc' ); ?></h3>
745
  <table class='wpsc_options form-table'>
746
  <tr>
747
- <th scope="row"><?php esc_html_e( 'Cart Location', 'wpsc' ); ?>:</th>
748
  <td>
749
  <?php
750
  $cart_location = get_option( 'cart_location' );
@@ -770,31 +770,31 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
770
  break;
771
  }
772
  ?>
773
- <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='2' name='wpsc_options[cart_location]' id='cart2' <?php echo $cart2; ?> /> <label for='cart2'><?php esc_html_e( 'Page', 'wpsc' ); ?></label> &nbsp;
774
  <?php
775
  if ( function_exists( 'wp_register_sidebar_widget' ) ) {
776
  ?>
777
- <input type='radio' value='4' onclick='hideelement1("dropshop_option", this.value)' name='wpsc_options[cart_location]' id='cart4' <?php echo $cart4; ?> /> <label for='cart4'><?php esc_html_e( 'Widget', 'wpsc' ); ?></label> &nbsp;
778
  <?php
779
  } else {
780
  ?>
781
- <input type='radio' disabled='disabled' value='4' name='wpsc_options[cart_location]' id='cart4' alt='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' title='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' <?php echo $cart4; ?> /> <label style='color: #666666;' for='cart4' title='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>'><?php esc_html_e( 'Widget', 'wpsc' ); ?></label> &nbsp;
782
  <?php
783
  }
784
 
785
  if ( function_exists( 'drag_and_drop_cart_ajax' ) ) {
786
  ?>
787
- <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='5' name='wpsc_options[cart_location]' id='cart5' <?php echo $cart5; ?> /> <label for='cart5'><?php esc_html_e( 'DropShop', 'wpsc' ); ?></label> &nbsp;
788
  <?php
789
  } else {
790
  ?>
791
- <input type='radio' disabled='disabled' value='5' name='wpsc_options[cart_location]' id='cart5' alt='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' title='<?php esc_attr_e( 'You need to install the Gold and DropShop extentions to use this', 'wpsc' ); ?>' <?php if ( isset( $cart5 ) )
792
- echo $cart5; ?> /> <label style='color: #666666;' for='cart5' title='<?php esc_attr_e( 'You need to install the Gold and DropShop extentions to use this', 'wpsc' ); ?>'><?php esc_html_e( 'DropShop', 'wpsc' ); ?></label> &nbsp;
793
  <?php
794
  }
795
  ?>
796
  <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='3' name='wpsc_options[cart_location]' id='cart3' <?php if ( isset( $cart3 ) )
797
- echo $cart3; ?> /> <label for='cart3'><?php esc_html_e( 'Manual', 'wpsc' ); ?> <span style='font-size: 7pt;'><?php echo esc_html( '(PHP code: <?php echo wpsc_shopping_cart(); ?> )')?></span></label>
798
  <div style='display: <?php if ( !empty( $cart5 ) ) {
799
  echo "block";
800
  } else {
@@ -803,21 +803,21 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
803
  <p>
804
  <input type="radio" id="drop1" value="all" <?php if ( get_option( 'dropshop_display' ) == 'all' ) {
805
  echo "checked='checked'";
806
- } ?> name="wpsc_options[dropshop_display]" /><label for="drop1"><?php esc_html_e( 'Show Dropshop on every page', 'wpsc' ); ?></label>
807
  <input type="radio" id="drop2" value="product" <?php if ( get_option( 'dropshop_display' ) == 'product' ) {
808
  echo "checked='checked'";
809
- } ?> name="wpsc_options[dropshop_display]"/><label for="drop2"><?php esc_html_e( 'Show Dropshop only on product page', 'wpsc' ); ?></label>
810
  </p>
811
  <p>
812
  <input type="radio" id="wpsc_dropshop_theme1" value="light" <?php if ( get_option( 'wpsc_dropshop_theme' ) != 'dark' ) {
813
  echo "checked='checked'";
814
- } ?> name="wpsc_options[wpsc_dropshop_theme]" /><label for="wpsc_dropshop_theme1"><?php esc_html_e( 'Use light Dropshop style', 'wpsc' ); ?></label>
815
  <input type="radio" id="wpsc_dropshop_theme2" value="dark" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'dark' ) {
816
  echo "checked='checked'";
817
- } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php esc_html_e( 'Use dark Dropshop style', 'wpsc' ); ?></label>
818
  <input type="radio" id="wpsc_dropshop_theme3" value="craftyc" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'craftyc' ) {
819
  echo "checked='checked'";
820
- } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php esc_html_e( 'Crafty', 'wpsc' ); ?></label>
821
 
822
  </p>
823
  </div>
@@ -826,7 +826,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
826
 
827
  <tr>
828
  <th scope="row">
829
- <?php esc_html_e( 'Display "+ Postage & Tax"', 'wpsc' ); ?>:
830
  </th>
831
  <td>
832
  <?php
@@ -843,17 +843,17 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
843
  break;
844
  }
845
  ?>
846
- <input type='radio' value='1' name='wpsc_options[add_plustax]' id='add_plustax1' <?php echo $add_plustax1; ?> /> <label for='add_plustax1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
847
- <input type='radio' value='0' name='wpsc_options[add_plustax]' id='add_plustax2' <?php echo $add_plustax2; ?> /> <label for='add_plustax2'><?php _e( 'No', 'wpsc' ); ?></label>
848
  </td>
849
  </tr>
850
  </table>
851
 
852
- <h3 class="form_group"><?php esc_html_e( 'Product Category Settings', 'wpsc' ); ?></h3>
853
  <table class='wpsc_options form-table'>
854
 
855
  <tr>
856
- <th scope="row"><?php esc_html_e( 'Show Product Category Description', 'wpsc' ); ?>:</th>
857
  <td>
858
  <?php
859
  $wpsc_category_description = get_option( 'wpsc_category_description' );
@@ -870,14 +870,14 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
870
  break;
871
  }
872
  ?>
873
- <input type='radio' value='1' name='wpsc_options[wpsc_category_description]' id='wpsc_category_description1' <?php echo $wpsc_category_description1; ?> /> <label for='wpsc_category_description1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
874
- <input type='radio' value='0' name='wpsc_options[wpsc_category_description]' id='wpsc_category_description2' <?php echo $wpsc_category_description2; ?> /> <label for='wpsc_category_description2'><?php _e( 'No', 'wpsc' ); ?></label>
875
  </td>
876
  </tr>
877
 
878
  <tr>
879
  <th scope="row">
880
- <?php esc_html_e( 'Show Product Category Thumbnails', 'wpsc' ); ?>:
881
  </th>
882
  <td>
883
  <?php
@@ -894,8 +894,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
894
  break;
895
  }
896
  ?>
897
- <input type='radio' value='1' name='wpsc_options[show_category_thumbnails]' id='show_category_thumbnails1' <?php echo $show_category_thumbnails1; ?> /> <label for='show_category_thumbnails1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
898
- <input type='radio' value='0' name='wpsc_options[show_category_thumbnails]' id='show_category_thumbnails2' <?php echo $show_category_thumbnails2; ?> /> <label for='show_category_thumbnails2'><?php _e( 'No', 'wpsc' ); ?></label>
899
  </td>
900
  </tr>
901
 
@@ -903,7 +903,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
903
 
904
  <tr>
905
  <th scope="row">
906
- <?php esc_html_e( 'Show Product Count per Product Category', 'wpsc' ); ?>:
907
  </th>
908
  <td>
909
  <?php
@@ -920,15 +920,15 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
920
  break;
921
  }
922
  ?>
923
- <input type='radio' value='1' name='wpsc_options[show_category_count]' id='show_category_count1' <?php echo $show_category_count1; ?> /> <label for='show_category_count1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
924
- <input type='radio' value='0' name='wpsc_options[show_category_count]' id='show_category_count2' <?php echo $show_category_count2; ?> /> <label for='show_category_count2'><?php _e( 'No', 'wpsc' ); ?></label>
925
  </td>
926
  </tr>
927
 
928
  <!-- // Adrian - options for displaying category display type -->
929
 
930
  <tr>
931
- <th scope="row"><?php esc_html_e( 'Use Category Grid View', 'wpsc' ); ?>:</th>
932
  <td>
933
  <?php
934
  $wpsc_category_grid_view = get_option( 'wpsc_category_grid_view' );
@@ -945,51 +945,51 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
945
  break;
946
  }
947
  ?>
948
- <input type='radio' value='1' name='wpsc_options[wpsc_category_grid_view]' id='wpsc_category_grid_view1' <?php echo $wpsc_category_grid_view1; ?> /> <label for='wpsc_category_grid_view1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
949
- <input type='radio' value='0' name='wpsc_options[wpsc_category_grid_view]' id='wpsc_category_grid_view2' <?php echo $wpsc_category_grid_view2; ?> /> <label for='wpsc_category_grid_view2'><?php _e( 'No', 'wpsc' ); ?></label>
950
  </td>
951
  </tr>
952
  </table>
953
 
954
 
955
- <h3 class="form_group"><a name='thumb_settings'><?php esc_html_e( 'Thumbnail Settings', 'wpsc' ); ?></a></h3>
956
- <p><em><?php esc_html_e( 'Note: Anytime you update any of the thumbnail settings, WPeC will automatically resize all of your thumbnails for you. Depending on how many images you have, this could take awhile.', 'wpsc' ); ?></em></p>
957
  <table class='wpsc_options form-table'>
958
  <?php if ( function_exists( "getimagesize" ) ) { ?>
959
  <tr>
960
- <th scope="row"><?php esc_html_e( 'Default Product Thumbnail Size', 'wpsc' ); ?>:</th>
961
  <td>
962
  <fieldset class="wpsc-width-height-fields">
963
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
964
- <input name="wpsc_options[product_image_width]" type="number" step="1" min="0" id="product_image_width" value="<?php esc_attr_e( get_option( 'product_image_width' ) ); ?>" class="small-text">
965
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
966
- <input name="wpsc_options[product_image_height]" type="number" step="1" min="0" id="product_image_height" value="<?php esc_attr_e( get_option( 'product_image_height' ) ); ?>" class="small-text">
967
  </fieldset>
968
  </td>
969
  </tr>
970
  <tr>
971
  <th scope="row">
972
- <?php esc_html_e( 'Default Product Category Thumbnail Size', 'wpsc' ); ?>:
973
  </th>
974
  <td>
975
  <fieldset class="wpsc-width-height-fields">
976
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
977
- <input name="wpsc_options[category_image_width]" type="number" step="1" min="0" id="category_image_width" value="<?php esc_attr_e( get_option( 'category_image_width' ) ); ?>" class="small-text">
978
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
979
- <input name="wpsc_options[category_image_height]" type="number" step="1" min="0" id="category_image_height" value="<?php esc_attr_e( get_option( 'category_image_height' ) ); ?>" class="small-text">
980
  </fieldset>
981
  </td>
982
  </tr>
983
  <tr>
984
  <th scope="row">
985
- <?php esc_html_e( 'Single Product Image Size', 'wpsc' ); ?>:
986
  </th>
987
  <td>
988
  <fieldset class="wpsc-width-height-fields">
989
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
990
- <input name="wpsc_options[single_view_image_width]" type="number" step="1" min="0" id="single_view_image_width" value="<?php esc_attr_e( get_option( 'single_view_image_width' ) ); ?>" class="small-text">
991
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
992
- <input name="wpsc_options[single_view_image_height]" type="number" step="1" min="0" id="single_view_image_height" value="<?php esc_attr_e( get_option( 'single_view_image_height' ) ); ?>" class="small-text">
993
  </fieldset>
994
  </td>
995
  </tr>
@@ -1009,12 +1009,12 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1009
  break;
1010
  }
1011
  ?>
1012
- <?php esc_html_e( 'Crop Thumbnails', 'wpsc' ); ?>:
1013
  </th>
1014
  <td>
1015
- <input type='radio' value='1' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails1' <?php echo $crop1; ?> /> <label for='crop1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1016
- <input type='radio' value='0' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails2' <?php echo $crop2; ?> /> <label for='crop2'><?php _e( 'No', 'wpsc' ); ?></label><br />
1017
- <?php esc_html_e( 'Choosing "Yes" means that thumbnails are cropped to exact dimensions (normally thumbnails are proportional)', 'wpsc' ); ?>
1018
  </td>
1019
  </tr>
1020
  <?php
@@ -1022,7 +1022,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1022
  ?>
1023
 
1024
  <tr>
1025
- <th scope="row"><?php esc_html_e( 'Show Thumbnails', 'wpsc' ); ?>:</th>
1026
  <td>
1027
  <?php
1028
  $show_thumbnails = get_option( 'show_thumbnails' );
@@ -1038,12 +1038,12 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1038
  break;
1039
  }
1040
  ?>
1041
- <input type='radio' value='1' name='wpsc_options[show_thumbnails]' id='show_thumbnails1' <?php echo $show_thumbnails1; ?> /> <label for='show_thumbnails1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1042
- <input type='radio' value='0' name='wpsc_options[show_thumbnails]' id='show_thumbnails2' <?php echo $show_thumbnails2; ?> /> <label for='show_thumbnails2'><?php _e( 'No', 'wpsc' ); ?></label>
1043
  </td>
1044
  </tr>
1045
  <tr>
1046
- <th scope="row"><?php esc_html_e( 'Use Lightbox Effect for product images', 'wpsc' ); ?>:</th>
1047
  <td>
1048
  <?php
1049
  $show_thumbnails_thickbox = get_option( 'show_thumbnails_thickbox' );
@@ -1059,13 +1059,13 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1059
  break;
1060
  }
1061
  ?>
1062
- <input type='radio' value='1' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox1' <?php echo $show_thumbnails_thickbox1; ?> /> <label for='show_thumbnails_thickbox1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1063
- <input type='radio' value='0' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox2' <?php echo $show_thumbnails_thickbox2; ?> /> <label for='show_thumbnails_thickbox2'><?php _e( 'No', 'wpsc' ); ?></label><br />
1064
- <?php esc_html_e( 'Using lightbox means that when clicking on a product image, a larger version will be displayed in a "lightbox" style window. If you are using a plugin such as Shutter Reloaded, you may want to disable lightbox.', 'wpsc' ); ?>
1065
  </td>
1066
  </tr>
1067
  <tr>
1068
- <th scope="row"><?php esc_html_e( 'Lightbox script to use', 'wpsc' ); ?>:</th>
1069
  <td>
1070
  <?php
1071
  $wpsc_lightbox = get_option( 'wpsc_lightbox', 'thickbox' );
@@ -1076,8 +1076,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1076
  if( $wpsc_lightbox == "colorbox" )
1077
  $wpsc_lightbox_thickbox1 = "checked ='checked'";
1078
  ?>
1079
- <input type='radio' value='colorbox' name='wpsc_options[wpsc_lightbox]' id='wpsc_lightbox_thickbox1' <?php echo $wpsc_lightbox_thickbox1; ?> /> <label for='show_thumbnails_thickbox1'><?php _e( 'Colorbox', 'wpsc' ); ?></label> &nbsp;
1080
- <input type='radio' value='thickbox' name='wpsc_options[wpsc_lightbox]' id='wpsc_lightbox_thickbox2' <?php echo $wpsc_lightbox_thickbox2; ?> /> <label for='show_thumbnails_thickbox2'><?php _e( 'Thickbox', 'wpsc' ); ?></label><br />
1081
  </td>
1082
  </tr>
1083
 
@@ -1086,7 +1086,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1086
  ?>
1087
  <tr>
1088
  <th scope="row">
1089
- <?php esc_html_e( 'Show Thumbnail Gallery', 'wpsc' ); ?>:
1090
  </th>
1091
  <td>
1092
  <?php
@@ -1103,19 +1103,18 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1103
  break;
1104
  }
1105
  ?>
1106
- <input type='radio' value='1' name='wpsc_options[show_gallery]' id='show_gallery1' <?php echo $show_gallery1; ?> /> <label for='show_gallery1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1107
- <input type='radio' value='0' name='wpsc_options[show_gallery]' id='show_gallery2' <?php echo $show_gallery2; ?> /> <label for='show_gallery2'><?php _e( 'No', 'wpsc' ); ?></label>
1108
  </td>
1109
  </tr>
1110
 
1111
  <tr>
1112
  <th scope="row">
1113
- <?php esc_html_e( 'Gallery Thumbnail Image Size', 'wpsc' ); ?>:
1114
  </th>
1115
  <td>
1116
- <?php esc_html_e( 'Width', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_width]' value='<?php esc_attr_e( get_option( 'wpsc_gallery_image_width' ) ); ?>' />
1117
- <?php esc_html_e( 'Height', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_height]' value='<?php esc_attr_e( get_option( 'wpsc_gallery_image_height' ) ); ?>' /><br />
1118
-
1119
  </td>
1120
  </tr>
1121
 
@@ -1125,11 +1124,11 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1125
  </table>
1126
 
1127
 
1128
- <h3 class="form_group"><?php esc_html_e( 'Pagination Settings', 'wpsc' ); ?></h3>
1129
  <table class='wpsc_options form-table'>
1130
  <tr>
1131
  <th scope="row">
1132
- <?php esc_html_e( 'Use Pagination', 'wpsc' ); ?>:
1133
  </th>
1134
  <td>
1135
  <?php
@@ -1148,40 +1147,40 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1148
  break;
1149
  }
1150
  ?>
1151
- <input onclick='jQuery("#wpsc_products_per_page").show()' type='radio' value='1' name='wpsc_options[use_pagination]' id='use_pagination1' <?php echo $use_pagination1; ?> /> <label for='use_pagination1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1152
- <input onclick='jQuery("#wpsc_products_per_page").hide()' type='radio' value='0' name='wpsc_options[use_pagination]' id='use_pagination2' <?php echo $use_pagination2; ?> /> <label for='use_pagination2'><?php _e( 'No', 'wpsc' ); ?></label><br />
1153
  <div id='wpsc_products_per_page' <?php echo $page_count_display_state; ?> >
1154
- <input type='text' size='6' name='wpsc_options[wpsc_products_per_page]' value='<?php echo get_option( 'wpsc_products_per_page' ); ?>' /> <?php _e( 'number of products to show per page', 'wpsc' ); ?>
1155
  </div>
1156
  </td>
1157
  </tr>
1158
 
1159
  <tr>
1160
  <th scope="row">
1161
- <?php esc_html_e( 'Page Number position', 'wpsc' ); ?>:
1162
  </th>
1163
  <td>
1164
  <input type='radio' value='1' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position1' <?php if ( get_option( 'wpsc_page_number_position' ) == 1 ) {
1165
  echo "checked='checked'";
1166
- } ?> />&nbsp;<label for='wpsc_page_number_position1'><?php esc_html_e( 'Top', 'wpsc' ); ?></label> &nbsp;
1167
  <input type='radio' value='2' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position2' <?php if ( get_option( 'wpsc_page_number_position' ) == 2 ) {
1168
  echo "checked='checked'";
1169
- } ?> />&nbsp;<label for='wpsc_page_number_position2'><?php esc_html_e( 'Bottom', 'wpsc' ); ?></label>&nbsp;
1170
  <input type='radio' value='3' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position3' <?php if ( get_option( 'wpsc_page_number_position' ) == 3 ) {
1171
  echo "checked='checked'";
1172
- } ?> />&nbsp;<label for='wpsc_page_number_position3'><?php esc_html_e( 'Both', 'wpsc' ); ?></label>
1173
  <br />
1174
  </td>
1175
  </tr>
1176
  </table>
1177
 
1178
 
1179
- <h3 class="form_group"><?php esc_html_e( 'Comment Settings', 'wpsc' ); ?></h3>
1180
  <table class='wpsc_options form-table'>
1181
  <tr>
1182
  <th scope="row">
1183
- <?php esc_html_e( 'Use IntenseDebate Comments', 'wpsc' ); ?>:
1184
- <a href="http://intensedebate.com/" title="<?php esc_attr_e( 'IntenseDebate comments enhance and encourage conversation on your blog or website', 'wpsc' ); ?>" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/intensedebate-logo.png" alt="<?php esc_attr_e( 'intensedebate-logo', 'wpsc' ); ?>" title="<?php esc_attr_e( 'IntenseDebate', 'wpsc' ); ?>" /></a>
1185
  </th>
1186
  <td>
1187
  <?php
@@ -1201,12 +1200,12 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1201
  break;
1202
  }
1203
  ?>
1204
- <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").show()' type='radio' value='1' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments1' <?php echo $enable_comments1; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1205
- <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").hide()' type='radio' value='0' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments2' <?php echo $enable_comments2; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'No', 'wpsc' ); ?></label><br />
1206
  <div id='wpsc_enable_comments' <?php echo $intense_debate_account_id_display_state; ?> >
1207
- <?php esc_html_e( 'IntenseDebate Account ID', 'wpsc' ); ?>:<br/>
1208
- <input type='text' size='30' name='wpsc_options[wpsc_intense_debate_account_id]' value='<?php esc_attr_e( get_option( 'wpsc_intense_debate_account_id' ) ); ?>' /><br/>
1209
- <small><a href='http://intensedebate.com/sitekey/' title='<?php esc_attr_e( 'Help on finding the Account ID', 'wpsc' ); ?>'><?php _e( 'Help on finding the Account ID', 'wpsc' ); ?></a></small>
1210
  </div>
1211
  </td>
1212
  </tr>
@@ -1215,17 +1214,17 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1215
 
1216
  <th scope="row">
1217
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1218
- <?php esc_html_e( 'By Default Display Comments on', 'wpsc' ); ?>:
1219
  </div>
1220
  </th>
1221
  <td>
1222
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1223
  <input type='radio' value='1' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products1' <?php if ( get_option( 'wpsc_comments_which_products' ) == 1 || !get_option( 'wpsc_comments_which_products' ) ) {
1224
  echo "checked='checked'";
1225
- } ?> /><label for='wpsc_comments_which_products1'><?php esc_html_e( 'All Products', 'wpsc' ); ?></label>&nbsp;
1226
  <input type='radio' value='2' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products2' <?php if ( get_option( 'wpsc_comments_which_products' ) == 2 ) {
1227
  echo "checked='checked'";
1228
- } ?> /><label for='wpsc_comments_which_products2'><?php esc_html_e( 'Per Product', 'wpsc' ); ?></label>&nbsp;
1229
  <br />
1230
  </div>
1231
  </td>
@@ -1234,4 +1233,4 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1234
  </table>
1235
  <?php
1236
  }
1237
- }
2
 
3
  class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
4
  public function __construct() {
5
+ $this->page_title = __( 'General Settings', 'wp-e-commerce' );
6
  }
7
 
8
  public function category_list() {
17
  else
18
  $selected = '';
19
 
20
+ $categorylist .= "<option value='all' " . $selected . " >" . __( 'Show All Products', 'wp-e-commerce' ) . "</option>";
21
 
22
  if ( $current_default == 'list' )
23
  $selected = "selected='selected'";
24
  else
25
  $selected = '';
26
 
27
+ $categorylist .= "<option value='list' " . $selected . " >" . __( 'Show list of product categories', 'wp-e-commerce' ) . "</option>";
28
 
29
+ $categorylist .= "<optgroup label='" . __( 'Product Categories', 'wp-e-commerce' ) . "'>";
30
  foreach ( $group_data as $group ) {
31
  $selected = "";
32
  if ( $current_default == $group->term_id )
81
  ?>
82
  <div id="poststuff" class="metabox-holder">
83
  <div id="themes_and_appearance" class='postbox'>
84
+ <h3 class="hndle"><span><?php esc_html_e( "Advanced Theme Settings", 'wp-e-commerce' ); ?></span></h3>
85
  <div class="inside">
86
  <?php
87
 
89
  ?>
90
 
91
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
92
+ <p><?php esc_html_e( 'You did not specify any template files to be moved.', 'wp-e-commerce' ); ?></p>
93
  </div>
94
  <?php
95
  $_SESSION['wpsc_theme_empty'] = false;
99
  ?>
100
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
101
  <?php if(in_array(false, $_SESSION['wpsc_themes_copied_results'], true)): ?>
102
+ <p style="color:red;"><?php esc_html_e( 'Error: some files could not be copied. Please make sure that theme folder is writable.', 'wp-e-commerce' ); ?></p>
103
  <?php else: ?>
104
+ <p><?php esc_html_e( 'Thanks, the themes have been copied.', 'wp-e-commerce' ); ?></p>
105
  <?php endif; ?>
106
  </div>
107
  <?php
111
  if ( isset( $_SESSION['wpsc_themes_backup'] ) && ($_SESSION['wpsc_themes_backup'] == true) ) {
112
  ?>
113
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
114
+ <p><?php _e( 'Thanks, you have made a succesful backup of your theme. It is located at the URL below. Please note each backup you create will replace your previous backups.', 'wp-e-commerce' ); ?></p>
115
+ <p><?php _e( 'URL:', 'wp-e-commerce' ); ?> <?php echo "/" . str_replace( ABSPATH, "", WPSC_THEME_BACKUP_DIR ); ?></p>
116
  </div>
117
  <?php
118
  $_SESSION['wpsc_themes_backup'] = false;
121
  <p>
122
  <?php if(false !== $themes_location)
123
  //Some themes have been moved to the themes folder
124
+ _e( 'Some Theme files have been moved to your WordPress Theme Folder.', 'wp-e-commerce' );
125
  else
126
+ _e( 'No Theme files have been moved to your WordPress Theme Folder.', 'wp-e-commerce' );
127
 
128
  ?>
129
 
131
  <p>
132
  <?php _e( 'WP eCommerce provides you the ability to move your theme files to a safe place for theming control.
133
 
134
+ If you want to change the look of your site, select the files you want to edit from the list and click the move button. This will copy the template files to your active WordPress theme. ','wp-e-commerce' ); ?>
135
  </p>
136
  <ul>
137
  <?php
147
  </ul>
148
  <p>
149
  <?php if(false !== $themes_location){
150
+ esc_html_e( 'To change the look of certain aspects of your shop, you can edit the moved files that are found here:', 'wp-e-commerce' );
151
  ?>
152
  </p>
153
  <p class="howto"> <?php echo get_stylesheet_directory(); ?></p>
155
  <p><?php
156
  wp_nonce_field('wpsc_copy_themes');
157
  ?>
158
+ <input type='submit' value='<?php esc_attr_e( 'Move Template Files &rarr;', 'wp-e-commerce' ); ?>' class="button" name='wpsc_move_themes' />
159
  </p>
160
+ <p><?php _e( 'You can create a copy of your WordPress Theme by clicking the backup button bellow. Once copied you can find them here:' ,'wp-e-commerce' ); ?></p>
161
  <p class="howto"><?php echo esc_html( '/wp-content/uploads/wpsc/theme_backup/' ); ?></p>
162
  <p>
163
  <?php
164
+ printf( __( '<a href="%s" class="button">Backup Your WordPress Theme</a>', 'wp-e-commerce' ), wp_nonce_url( 'admin.php?wpsc_admin_action=backup_themes', 'backup_themes' ) ); ?>
165
  <br style="clear:both" />
166
  </p>
167
 
168
  <br style="clear:both" />
169
+ <p><?php esc_html_e( 'If you have moved your files in some other way, e.g. through FTP, you may need to click the Flush Theme Cache. This will refresh the locations in which WordPress looks for your templates.' ,'wp-e-commerce' ); ?></p>
170
+ <p><?php printf( __( '<a href="%s" class="button">Flush Theme Cache</a>', 'wp-e-commerce' ), wp_nonce_url( 'admin.php?wpsc_flush_theme_transients=true', 'wpsc_flush_theme_transients' ) ); ?></p>
171
  <br style="clear:both" />
172
  <br style="clear:both" />
173
  </div>
182
 
183
  <?php $this->theme_metabox(); ?>
184
 
185
+ <h3 class="form_group"><?php esc_html_e( 'Button Settings', 'wp-e-commerce' ); ?></h3>
186
  <table class='wpsc_options form-table' style="width:550px">
187
  <tr>
188
+ <th scope="row"><?php esc_html_e( 'Button Type', 'wp-e-commerce' ); ?>:</th>
189
  <td>
190
  <?php
191
  $addtocart_or_buynow = get_option( 'addtocart_or_buynow' );
202
  }
203
  ?>
204
  <input type='radio' value='0' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow1' <?php echo $addtocart_or_buynow1; ?> />
205
+ <label for='addtocart_or_buynow1'><?php esc_html_e( 'Add To Cart', 'wp-e-commerce' ); ?></label> &nbsp;<br />
206
  <?php $selected_gateways = get_option( 'custom_gateway_options' );
207
  $disable_buy_now = '';
208
  $message = '';
209
  if (!in_array( 'wpsc_merchant_paypal_standard', (array)$selected_gateways )){
210
  $disable_buy_now = 'disabled="disabled"';
211
+ $message = __( 'Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.','wp-e-commerce' );
212
  } ?>
213
  <input <?php echo $disable_buy_now; ?> type='radio' value='1' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow2' <?php echo $addtocart_or_buynow2; ?> />
214
+ <label for='addtocart_or_buynow2'><?php _e( 'Buy Now', 'wp-e-commerce' ); ?></label><br />
215
  <?php echo $message; ?>
216
  </td>
217
  </tr>
218
 
219
  <tr>
220
+ <th scope="row"><?php esc_html_e( 'Hide "Add to cart" button', 'wp-e-commerce' ); ?>:</th>
221
  <td>
222
  <?php
223
  $hide_addtocart_button = get_option( 'hide_addtocart_button' );
233
  break;
234
  }
235
  ?>
236
+ <input type='radio' value='1' name='wpsc_options[hide_addtocart_button]' id='hide_addtocart_button1' <?php echo $hide_addtocart_button1; ?> /> <label for='hide_addtocart_button1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
237
+ <input type='radio' value='0' name='wpsc_options[hide_addtocart_button]' id='hide_addtocart_button2' <?php echo $hide_addtocart_button2; ?> /> <label for='hide_addtocart_button2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
238
  </td>
239
  </tr>
240
  </table>
241
 
242
+ <h3 class="form_group"><?php esc_html_e( 'Product Settings', 'wp-e-commerce' ); ?></h3>
243
 
244
  <table class='wpsc_options form-table'>
245
 
246
  <tr>
247
+ <th scope="row"><?php esc_html_e( 'Show Product Ratings', 'wp-e-commerce' ); ?>:</th>
248
  <td>
249
  <?php
250
  $display_pnp = get_option( 'product_ratings' );
260
  break;
261
  }
262
  ?>
263
+ <input type='radio' value='1' name='wpsc_options[product_ratings]' id='product_ratings1' <?php echo $product_ratings1; ?> /> <label for='product_ratings1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
264
+ <input type='radio' value='0' name='wpsc_options[product_ratings]' id='product_ratings2' <?php echo $product_ratings2; ?> /> <label for='product_ratings2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
265
  </td>
266
  </tr>
267
  <tr>
274
  $list_view_quantity_value2 = 'checked="checked"';
275
  ?>
276
  <th scope="row">
277
+ <?php esc_html_e( 'Show Stock Availability', 'wp-e-commerce' ); ?>:
278
  </th>
279
  <td>
280
+ <input type='radio' value='1' name='wpsc_options[list_view_quantity]' id='list_view_quantity1' <?php echo $list_view_quantity_value1; ?> /> <label for='list_view_quantity1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
281
+ <input type='radio' value='0' name='wpsc_options[list_view_quantity]' id='list_view_quantity2' <?php echo $list_view_quantity_value2; ?> /> <label for='list_view_quantity2'><?php _e( 'No', 'wp-e-commerce' ); ?></label> &nbsp;
282
  </td>
283
  </tr>
284
  <tr>
285
  <th scope="row">
286
+ <?php esc_html_e( 'Display Fancy Purchase Notifications', 'wp-e-commerce' ); ?>:
287
  </th>
288
  <td>
289
  <?php
300
  break;
301
  }
302
  ?>
303
+ <input type='radio' value='1' name='wpsc_options[fancy_notifications]' id='fancy_notifications1' <?php echo $fancy_notifications1; ?> /> <label for='fancy_notifications1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
304
+ <input type='radio' value='0' name='wpsc_options[fancy_notifications]' id='fancy_notifications2' <?php echo $fancy_notifications2; ?> /> <label for='fancy_notifications2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
305
  </td>
306
  </tr>
307
 
308
 
309
  <tr>
310
+ <th scope="row"><?php esc_html_e( 'Display per item shipping', 'wp-e-commerce' ); ?>:</th>
311
  <td>
312
  <?php
313
  $display_pnp = get_option( 'display_pnp' );
323
  break;
324
  }
325
  ?>
326
+ <input type='radio' value='1' name='wpsc_options[display_pnp]' id='display_pnp1' <?php echo $display_pnp1; ?> /> <label for='display_pnp1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
327
+ <input type='radio' value='0' name='wpsc_options[display_pnp]' id='display_pnp2' <?php echo $display_pnp2; ?> /> <label for='display_pnp2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
328
  </td>
329
  </tr>
330
 
331
  <tr>
332
+ <th scope="row"><?php esc_html_e( 'Disable link in Title', 'wp-e-commerce' ); ?>: </th>
333
  <td>
334
  <?php
335
  $hide_name_link = get_option( 'hide_name_link' );
346
  }
347
  ?>
348
  <input type='radio' value='1' name='wpsc_options[hide_name_link]' id='hide_name_link1' <?php echo $hide_name_link1; ?> />
349
+ <label for='hide_name_link1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
350
  <input type='radio' value='0' name='wpsc_options[hide_name_link]' id='hide_name_link2' <?php echo $hide_name_link2; ?> />
351
+ <label for='hide_name_link2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
352
  </td>
353
  </tr>
354
 
355
  <tr>
356
+ <th scope="row"><?php esc_html_e( 'Add quantity field to each product description', 'wp-e-commerce' ); ?>:</th>
357
  <td>
358
  <?php
359
  $multi_adding = get_option( 'multi_add' );
369
  ?>
370
  <input type='radio' value='1' name='wpsc_options[multi_add]' id='multi_adding1' <?php if ( isset( $multi_adding1 ) )
371
  echo $multi_adding1; ?> />
372
+ <label for='multi_adding1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
373
  <input type='radio' value='0' name='wpsc_options[multi_add]' id='multi_adding2' <?php if ( isset( $multi_adding2 ) )
374
  echo $multi_adding2; ?> />
375
+ <label for='multi_adding2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
376
  </td>
377
  </tr>
378
  </table>
379
  </div>
380
 
381
 
382
+ <h3 class="form_group"><?php esc_html_e( 'Product Page Settings', 'wp-e-commerce' ); ?></h3>
383
  <table class='wpsc_options form-table'>
384
  <tr>
385
+ <th scope="row"><?php esc_html_e( 'Product Display', 'wp-e-commerce' ); ?>:</th>
386
  <td>
387
  <?php
388
  $display_pnp = get_option( 'product_view' );
434
  }
435
  ?>
436
  <select name='wpsc_options[product_view]'>
437
+ <option value='default' <?php echo $product_view1; ?>><?php esc_html_e( 'Default View', 'wp-e-commerce' ); ?></option>
438
  <?php
439
  if ( function_exists( 'product_display_list' ) ) {
440
  ?>
441
+ <option value='list' <?php echo $product_view2; ?>><?php esc_html_e( 'List View', 'wp-e-commerce' ); ?></option>
442
  <?php
443
  } else {
444
  ?>
445
+ <option value='list' disabled='disabled' <?php echo $product_view2; ?>><?php esc_html_e( 'List View', 'wp-e-commerce' ); ?></option>
446
  <?php
447
  }
448
 
449
  if ( function_exists( 'product_display_grid' ) ) {
450
  ?>
451
+ <option value='grid' <?php echo $product_view3; ?>><?php esc_html_e( 'Grid View', 'wp-e-commerce' ); ?></option>
452
  <?php
453
  } else {
454
  ?>
455
+ <option value='grid' disabled='disabled' <?php echo $product_view3; ?>><?php esc_html_e( 'Grid View', 'wp-e-commerce' ); ?></option>
456
  <?php
457
  }
458
  ?>
460
  <?php
461
  if ( ! function_exists( 'product_display_grid' ) ) {
462
  ?>
463
+ <a href='http://wpecommerce.org/store/premium-plugins/gold-cart/'><?php esc_html_e( 'Purchase unavailable options', 'wp-e-commerce' ); ?></a>
464
  <?php
465
  }
466
  ?>
468
  </tr>
469
 
470
  <tr id="wpsc-grid-settings">
471
+ <th scope="row"><?php esc_html_e( 'Grid view settings:', 'wp-e-commerce' ) ?></th>
472
  <td>
473
+ <input type='number' min="0" name='wpsc_options[grid_number_per_row]' id='grid_number_per_row' size='2' value='<?php echo esc_attr( get_option( 'grid_number_per_row' ) ); ?>' class='small-text' />
474
+ <label for='grid_number_per_row'><?php esc_html_e( 'Products Per Row', 'wp-e-commerce' ); ?></label><br />
475
 
476
  <input type='hidden' value='0' name='wpsc_options[show_images_only]' />
477
  <input type='checkbox' value='1' name='wpsc_options[show_images_only]' id='wpsc-show-images-only' <?php echo $show_images_only_value; ?> />
478
+ <label for='wpsc-show-images-only'><?php esc_html_e( 'Show images only', 'wp-e-commerce' ); ?></label><br />
479
 
480
  <input type='hidden' value='0' name='wpsc_options[display_variations]' />
481
  <input type='checkbox' value='1' name='wpsc_options[display_variations]' id='wpsc-display-variations' <?php echo $display_variations; ?> />
482
+ <label for='wpsc-display-variations'><?php esc_html_e( 'Display Variations', 'wp-e-commerce' ); ?></label><br />
483
 
484
  <input type='hidden' value='0' name='wpsc_options[display_description]' />
485
  <input type='checkbox' value='1' name='wpsc_options[display_description]' id='wpsc-display-description' <?php echo $display_description; ?> />
486
+ <label for='wpsc-display-description'><?php esc_html_e( 'Display Description', 'wp-e-commerce' ); ?></label><br />
487
 
488
  <input type='hidden' value='0' name='wpsc_options[display_addtocart]' />
489
  <input type='checkbox' value='1' name='wpsc_options[display_addtocart]' id='wpsc-display-add-to-cart' <?php echo $display_addtocart; ?> />
490
+ <label for='wpsc-display-add-to-cart'><?php esc_html_e( 'Display "Add To Cart" Button', 'wp-e-commerce' ); ?></label><br />
491
 
492
  <input type='hidden' value='0' name='wpsc_options[display_moredetails]' />
493
  <input type='checkbox' value='1' name='wpsc_options[display_moredetails]' id='wpsc-display-more-details' <?php echo $display_moredetails; ?> />
494
+ <label for='wpsc-display-more-details'><?php esc_html_e( 'Display "More Details" Button', 'wp-e-commerce' ); ?></label>
495
  </td>
496
  </tr>
497
 
504
  ?>
505
 
506
  <tr>
507
+ <th scope="row"><?php esc_html_e( 'Show list of categories', 'wp-e-commerce' ); ?>:</th>
508
  <td>
509
  <input type='radio' value='1' name='wpsc_options[wpsc_display_categories]' id='display_categories2' <?php echo $selected1; ?> />
510
+ <label for='display_categories2'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label>
511
  <input type='radio' value='0' name='wpsc_options[wpsc_display_categories]' id='display_categories1' <?php echo $selected2; ?> />
512
+ <label for='display_categories1'><?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
513
  </td>
514
  </tr>
515
 
516
  <tr>
517
+ <th scope="row"><?php esc_html_e( 'Select what product category you want to display on the products page', 'wp-e-commerce' ); ?>:</th>
518
  <td>
519
  <?php echo $this->category_list(); ?>
520
  </td>
542
  ?>
543
  <tr>
544
  <th scope="row">
545
+ <?php _e( 'Sort Product By', 'wp-e-commerce' ); ?>:
546
  </th>
547
  <td>
548
  <select name='wpsc_options[wpsc_sort_by]'>
549
  <option <?php if ( isset( $wpsc_sort_by1 ) )
550
+ echo $wpsc_sort_by1; ?> value='name'><?php esc_html_e( 'Name', 'wp-e-commerce' ); ?></option>
551
  <option <?php if ( isset( $wpsc_sort_by2 ) )
552
+ echo $wpsc_sort_by2; ?> value='price'><?php esc_html_e( 'Price', 'wp-e-commerce' ); ?></option>
553
  <option <?php if ( isset( $wpsc_sort_by4 ) )
554
+ echo $wpsc_sort_by4; ?> value='dragndrop'><?php esc_html_e( 'Drag &amp; Drop', 'wp-e-commerce' ); ?></option>
555
  <option <?php if ( isset( $wpsc_sort_by3 ) )
556
+ echo $wpsc_sort_by3; ?> value='id'><?php esc_html_e( 'Time Uploaded', 'wp-e-commerce' ); ?></option>
557
  </select>
558
 
559
  <select name="wpsc_options[wpsc_product_order]">
560
+ <option value="ASC" <?php selected( get_option( 'wpsc_product_order' ), 'ASC' ); ?>><?php _ex( 'Ascending', 'product order setting', 'wp-e-commerce' ); ?></option>
561
+ <option value="DESC" <?php selected( get_option( 'wpsc_product_order' ), 'DESC' ); ?>><?php _ex( 'Descending', 'product order setting', 'wp-e-commerce' ); ?></option>
562
  </select>
563
  </td>
564
  </tr>
565
 
566
  <tr>
567
+ <th scope="row"><?php esc_html_e( 'Show Breadcrumbs', 'wp-e-commerce' ); ?>:</th>
568
  <td>
569
  <?php
570
  $show_breadcrumbs = get_option( 'show_breadcrumbs' );
580
  break;
581
  }
582
  ?>
583
+ <input type='radio' value='1' name='wpsc_options[show_breadcrumbs]' id='show_breadcrumbs1' <?php echo $show_breadcrumbs1; ?> /> <label for='show_breadcrumbs1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
584
+ <input type='radio' value='0' name='wpsc_options[show_breadcrumbs]' id='show_breadcrumbs2' <?php echo $show_breadcrumbs2; ?> /> <label for='show_breadcrumbs2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
585
  </td>
586
  </tr>
587
 
589
 
590
  <tr>
591
  <th scope="row">
592
+ <?php esc_html_e( 'Product Groups/Products Display', 'wp-e-commerce' ); ?>:
593
  </th>
594
  <td>
595
  <?php
606
  break;
607
  }
608
  ?>
609
+ <input type='radio' value='0' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type1' <?php echo $catsprods_display_type1; ?> /> <label for='catsprods_display_type1'><?php _e( 'Product Groups Only (All products displayed)', 'wp-e-commerce' ); ?></label><br/>
610
+ <input type='radio' value='1' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type2' <?php echo $catsprods_display_type2; ?> /> <label for='catsprods_display_type2'><?php _e( 'Sliding Product Groups (1 product per page)', 'wp-e-commerce' ); ?></label>
611
  </td>
612
  </tr>
613
 
614
  <tr>
615
  <th scope="row">
616
+ <?php esc_html_e( 'Show Subcategory Products in Parent Category', 'wp-e-commerce' ); ?>:
617
  </th>
618
  <td>
619
  <?php
629
  break;
630
  }
631
  ?>
632
+ <input type="radio" value="1" name="wpsc_options[show_subcatsprods_in_cat]" id="show_subcatsprods_in_cat_on" <?php echo $show_subcatsprods_in_cat_on; ?> /> <label for="show_subcatsprods_in_cat_on"><?php echo __( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
633
+ <input type="radio" value="0" name="wpsc_options[show_subcatsprods_in_cat]" id="show_subcatsprods_in_cat_off" <?php echo $show_subcatsprods_in_cat_off; ?> /> <label for="show_subcatsprods_in_cat_off"><?php echo __( 'No', 'wp-e-commerce' ); ?></label>
634
  </td>
635
  </tr>
636
 
638
  if ( function_exists( 'gold_shpcrt_search_form' ) ) {
639
  ?>
640
  <tr>
641
+ <th scope="row"><?php esc_html_e( 'Show Search', 'wp-e-commerce' ); ?>:</th>
642
  <td>
643
  <?php
644
  $display_pnp = get_option( 'show_search' );
675
 
676
  $embed_live_search_results = get_option( 'embed_live_search_results', '0' ) == '1' ? ' checked="checked"' : '';
677
  ?>
678
+ <input type='radio' onclick='jQuery("#wpsc_advanced_search").show()' value='1' name='wpsc_options[show_search]' id='show_search1' <?php echo $show_search1; ?> /> <label for='show_search1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
679
+ <input type='radio' onclick='jQuery("#wpsc_advanced_search").hide()' value='0' name='wpsc_options[show_search]' id='show_search2' <?php echo $show_search2; ?> /> <label for='show_search2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
680
 
681
  <div <?php echo $dis; ?> id='wpsc_advanced_search'>
682
  <input type='hidden' name='wpsc_options[show_advanced_search]' value='0' />
683
  <input type='checkbox' name='wpsc_options[show_advanced_search]' id='show_advanced_search' <?php echo $show_advanced_search; ?> value='1' />
684
+ <?php esc_html_e( 'Show Advanced Search', 'wp-e-commerce' ); ?><br />
685
  <input type='hidden' name='wpsc_options[show_live_search]' value='0' />
686
  <input type='checkbox' name='wpsc_options[show_live_search]' id='show_live_search' <?php echo $show_live_search; ?> value='1' />
687
+ <?php esc_html_e( 'Use Live Search', 'wp-e-commerce' ); ?><br />
688
  <input type='hidden' name='wpsc_options[embed_live_search_results]' value='0' />
689
  <input type='checkbox' name='wpsc_options[embed_live_search_results]' id='embed_live_search_results'<?php echo $embed_live_search_results; ?> value='1' />
690
+ <?php esc_html_e( 'Dynamically replace search results into product list', 'wp-e-commerce' ); ?>
691
  </div>
692
  </td>
693
  </tr>
697
 
698
 
699
  <tr>
700
+ <th scope="row"><?php esc_html_e( 'Replace Page Title With Product/Category Name', 'wp-e-commerce' ); ?>:</th>
701
  <td>
702
  <?php
703
  $wpsc_replace_page_title = get_option( 'wpsc_replace_page_title' );
713
  break;
714
  }
715
  ?>
716
+ <input type='radio' value='1' name='wpsc_options[wpsc_replace_page_title]' id='wpsc_replace_page_title1' <?php echo $wpsc_replace_page_title1; ?> /> <label for='wpsc_replace_page_title1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
717
+ <input type='radio' value='0' name='wpsc_options[wpsc_replace_page_title]' id='wpsc_replace_page_title2' <?php echo $wpsc_replace_page_title2; ?> /> <label for='wpsc_replace_page_title2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
718
  </td>
719
  </tr>
720
  <tr>
721
+ <th scope="row"><?php esc_html_e( 'Display Featured Product above Product Pages', 'wp-e-commerce' ); ?>:</th>
722
  <td>
723
  <?php
724
  $wpsc_hide_featured_products = get_option( 'wpsc_hide_featured_products' );
735
  break;
736
  }
737
  ?>
738
+ <input type='radio' value='1' name='wpsc_options[wpsc_hide_featured_products]' id='wpsc_hide_featured_products1' <?php echo $wpsc_hide_featured_products1; ?> /> <label for='wpsc_hide_featured_products1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
739
+ <input type='radio' value='0' name='wpsc_options[wpsc_hide_featured_products]' id='wpsc_hide_featured_products2' <?php echo $wpsc_hide_featured_products2; ?> /> <label for='wpsc_hide_featured_products2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
740
  </td>
741
  </tr>
742
  </table>
743
 
744
+ <h3 class="form_group"><?php esc_html_e( 'Shopping Cart Settings', 'wp-e-commerce' ); ?></h3>
745
  <table class='wpsc_options form-table'>
746
  <tr>
747
+ <th scope="row"><?php esc_html_e( 'Cart Location', 'wp-e-commerce' ); ?>:</th>
748
  <td>
749
  <?php
750
  $cart_location = get_option( 'cart_location' );
770
  break;
771
  }
772
  ?>
773
+ <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='2' name='wpsc_options[cart_location]' id='cart2' <?php echo $cart2; ?> /> <label for='cart2'><?php esc_html_e( 'Page', 'wp-e-commerce' ); ?></label> &nbsp;
774
  <?php
775
  if ( function_exists( 'wp_register_sidebar_widget' ) ) {
776
  ?>
777
+ <input type='radio' value='4' onclick='hideelement1("dropshop_option", this.value)' name='wpsc_options[cart_location]' id='cart4' <?php echo $cart4; ?> /> <label for='cart4'><?php esc_html_e( 'Widget', 'wp-e-commerce' ); ?></label> &nbsp;
778
  <?php
779
  } else {
780
  ?>
781
+ <input type='radio' disabled='disabled' value='4' name='wpsc_options[cart_location]' id='cart4' alt='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wp-e-commerce' ); ?>' title='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wp-e-commerce' ); ?>' <?php echo $cart4; ?> /> <label style='color: #666666;' for='cart4' title='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wp-e-commerce' ); ?>'><?php esc_html_e( 'Widget', 'wp-e-commerce' ); ?></label> &nbsp;
782
  <?php
783
  }
784
 
785
  if ( function_exists( 'drag_and_drop_cart_ajax' ) ) {
786
  ?>
787
+ <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='5' name='wpsc_options[cart_location]' id='cart5' <?php echo $cart5; ?> /> <label for='cart5'><?php esc_html_e( 'DropShop', 'wp-e-commerce' ); ?></label> &nbsp;
788
  <?php
789
  } else {
790
  ?>
791
+ <input type='radio' disabled='disabled' value='5' name='wpsc_options[cart_location]' id='cart5' alt='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wp-e-commerce' ); ?>' title='<?php esc_attr_e( 'You need to install the Gold and DropShop extentions to use this', 'wp-e-commerce' ); ?>' <?php if ( isset( $cart5 ) )
792
+ echo $cart5; ?> /> <label style='color: #666666;' for='cart5' title='<?php esc_attr_e( 'You need to install the Gold and DropShop extentions to use this', 'wp-e-commerce' ); ?>'><?php esc_html_e( 'DropShop', 'wp-e-commerce' ); ?></label> &nbsp;
793
  <?php
794
  }
795
  ?>
796
  <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='3' name='wpsc_options[cart_location]' id='cart3' <?php if ( isset( $cart3 ) )
797
+ echo $cart3; ?> /> <label for='cart3'><?php esc_html_e( 'Manual', 'wp-e-commerce' ); ?> <span style='font-size: 7pt;'><?php echo esc_html( '(PHP code: <?php echo wpsc_shopping_cart(); ?> )')?></span></label>
798
  <div style='display: <?php if ( !empty( $cart5 ) ) {
799
  echo "block";
800
  } else {
803
  <p>
804
  <input type="radio" id="drop1" value="all" <?php if ( get_option( 'dropshop_display' ) == 'all' ) {
805
  echo "checked='checked'";
806
+ } ?> name="wpsc_options[dropshop_display]" /><label for="drop1"><?php esc_html_e( 'Show Dropshop on every page', 'wp-e-commerce' ); ?></label>
807
  <input type="radio" id="drop2" value="product" <?php if ( get_option( 'dropshop_display' ) == 'product' ) {
808
  echo "checked='checked'";
809
+ } ?> name="wpsc_options[dropshop_display]"/><label for="drop2"><?php esc_html_e( 'Show Dropshop only on product page', 'wp-e-commerce' ); ?></label>
810
  </p>
811
  <p>
812
  <input type="radio" id="wpsc_dropshop_theme1" value="light" <?php if ( get_option( 'wpsc_dropshop_theme' ) != 'dark' ) {
813
  echo "checked='checked'";
814
+ } ?> name="wpsc_options[wpsc_dropshop_theme]" /><label for="wpsc_dropshop_theme1"><?php esc_html_e( 'Use light Dropshop style', 'wp-e-commerce' ); ?></label>
815
  <input type="radio" id="wpsc_dropshop_theme2" value="dark" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'dark' ) {
816
  echo "checked='checked'";
817
+ } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php esc_html_e( 'Use dark Dropshop style', 'wp-e-commerce' ); ?></label>
818
  <input type="radio" id="wpsc_dropshop_theme3" value="craftyc" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'craftyc' ) {
819
  echo "checked='checked'";
820
+ } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php esc_html_e( 'Crafty', 'wp-e-commerce' ); ?></label>
821
 
822
  </p>
823
  </div>
826
 
827
  <tr>
828
  <th scope="row">
829
+ <?php esc_html_e( 'Display "+ Postage & Tax"', 'wp-e-commerce' ); ?>:
830
  </th>
831
  <td>
832
  <?php
843
  break;
844
  }
845
  ?>
846
+ <input type='radio' value='1' name='wpsc_options[add_plustax]' id='add_plustax1' <?php echo $add_plustax1; ?> /> <label for='add_plustax1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
847
+ <input type='radio' value='0' name='wpsc_options[add_plustax]' id='add_plustax2' <?php echo $add_plustax2; ?> /> <label for='add_plustax2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
848
  </td>
849
  </tr>
850
  </table>
851
 
852
+ <h3 class="form_group"><?php esc_html_e( 'Product Category Settings', 'wp-e-commerce' ); ?></h3>
853
  <table class='wpsc_options form-table'>
854
 
855
  <tr>
856
+ <th scope="row"><?php esc_html_e( 'Show Product Category Description', 'wp-e-commerce' ); ?>:</th>
857
  <td>
858
  <?php
859
  $wpsc_category_description = get_option( 'wpsc_category_description' );
870
  break;
871
  }
872
  ?>
873
+ <input type='radio' value='1' name='wpsc_options[wpsc_category_description]' id='wpsc_category_description1' <?php echo $wpsc_category_description1; ?> /> <label for='wpsc_category_description1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
874
+ <input type='radio' value='0' name='wpsc_options[wpsc_category_description]' id='wpsc_category_description2' <?php echo $wpsc_category_description2; ?> /> <label for='wpsc_category_description2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
875
  </td>
876
  </tr>
877
 
878
  <tr>
879
  <th scope="row">
880
+ <?php esc_html_e( 'Show Product Category Thumbnails', 'wp-e-commerce' ); ?>:
881
  </th>
882
  <td>
883
  <?php
894
  break;
895
  }
896
  ?>
897
+ <input type='radio' value='1' name='wpsc_options[show_category_thumbnails]' id='show_category_thumbnails1' <?php echo $show_category_thumbnails1; ?> /> <label for='show_category_thumbnails1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
898
+ <input type='radio' value='0' name='wpsc_options[show_category_thumbnails]' id='show_category_thumbnails2' <?php echo $show_category_thumbnails2; ?> /> <label for='show_category_thumbnails2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
899
  </td>
900
  </tr>
901
 
903
 
904
  <tr>
905
  <th scope="row">
906
+ <?php esc_html_e( 'Show Product Count per Product Category', 'wp-e-commerce' ); ?>:
907
  </th>
908
  <td>
909
  <?php
920
  break;
921
  }
922
  ?>
923
+ <input type='radio' value='1' name='wpsc_options[show_category_count]' id='show_category_count1' <?php echo $show_category_count1; ?> /> <label for='show_category_count1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
924
+ <input type='radio' value='0' name='wpsc_options[show_category_count]' id='show_category_count2' <?php echo $show_category_count2; ?> /> <label for='show_category_count2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
925
  </td>
926
  </tr>
927
 
928
  <!-- // Adrian - options for displaying category display type -->
929
 
930
  <tr>
931
+ <th scope="row"><?php esc_html_e( 'Use Category Grid View', 'wp-e-commerce' ); ?>:</th>
932
  <td>
933
  <?php
934
  $wpsc_category_grid_view = get_option( 'wpsc_category_grid_view' );
945
  break;
946
  }
947
  ?>
948
+ <input type='radio' value='1' name='wpsc_options[wpsc_category_grid_view]' id='wpsc_category_grid_view1' <?php echo $wpsc_category_grid_view1; ?> /> <label for='wpsc_category_grid_view1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
949
+ <input type='radio' value='0' name='wpsc_options[wpsc_category_grid_view]' id='wpsc_category_grid_view2' <?php echo $wpsc_category_grid_view2; ?> /> <label for='wpsc_category_grid_view2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
950
  </td>
951
  </tr>
952
  </table>
953
 
954
 
955
+ <h3 class="form_group"><a name='thumb_settings'><?php esc_html_e( 'Thumbnail Settings', 'wp-e-commerce' ); ?></a></h3>
956
+ <p><em><?php esc_html_e( 'Note: Anytime you update any of the thumbnail settings, WPeC will automatically resize all of your thumbnails for you. Depending on how many images you have, this could take awhile.', 'wp-e-commerce' ); ?></em></p>
957
  <table class='wpsc_options form-table'>
958
  <?php if ( function_exists( "getimagesize" ) ) { ?>
959
  <tr>
960
+ <th scope="row"><?php esc_html_e( 'Default Product Thumbnail Size', 'wp-e-commerce' ); ?>:</th>
961
  <td>
962
  <fieldset class="wpsc-width-height-fields">
963
+ <label for="image_width"><?php esc_html_e( 'Width', 'wp-e-commerce' ); ?></label>
964
+ <input name="wpsc_options[product_image_width]" type="number" step="1" min="0" id="product_image_width" value="<?php echo esc_attr( get_option( 'product_image_width' ) ); ?>" class="small-text">
965
+ <label for="large_size_h"><?php esc_html_e( 'Height', 'wp-e-commerce' ); ?></label>
966
+ <input name="wpsc_options[product_image_height]" type="number" step="1" min="0" id="product_image_height" value="<?php echo esc_attr( get_option( 'product_image_height' ) ); ?>" class="small-text">
967
  </fieldset>
968
  </td>
969
  </tr>
970
  <tr>
971
  <th scope="row">
972
+ <?php esc_html_e( 'Default Product Category Thumbnail Size', 'wp-e-commerce' ); ?>:
973
  </th>
974
  <td>
975
  <fieldset class="wpsc-width-height-fields">
976
+ <label for="image_width"><?php esc_html_e( 'Width', 'wp-e-commerce' ); ?></label>
977
+ <input name="wpsc_options[category_image_width]" type="number" step="1" min="0" id="category_image_width" value="<?php echo esc_attr( get_option( 'category_image_width' ) ); ?>" class="small-text">
978
+ <label for="large_size_h"><?php esc_html_e( 'Height', 'wp-e-commerce' ); ?></label>
979
+ <input name="wpsc_options[category_image_height]" type="number" step="1" min="0" id="category_image_height" value="<?php echo esc_attr( get_option( 'category_image_height' ) ); ?>" class="small-text">
980
  </fieldset>
981
  </td>
982
  </tr>
983
  <tr>
984
  <th scope="row">
985
+ <?php esc_html_e( 'Single Product Image Size', 'wp-e-commerce' ); ?>:
986
  </th>
987
  <td>
988
  <fieldset class="wpsc-width-height-fields">
989
+ <label for="image_width"><?php esc_html_e( 'Width', 'wp-e-commerce' ); ?></label>
990
+ <input name="wpsc_options[single_view_image_width]" type="number" step="1" min="0" id="single_view_image_width" value="<?php echo esc_attr( get_option( 'single_view_image_width' ) ); ?>" class="small-text">
991
+ <label for="large_size_h"><?php esc_html_e( 'Height', 'wp-e-commerce' ); ?></label>
992
+ <input name="wpsc_options[single_view_image_height]" type="number" step="1" min="0" id="single_view_image_height" value="<?php echo esc_attr( get_option( 'single_view_image_height' ) ); ?>" class="small-text">
993
  </fieldset>
994
  </td>
995
  </tr>
1009
  break;
1010
  }
1011
  ?>
1012
+ <?php esc_html_e( 'Crop Thumbnails', 'wp-e-commerce' ); ?>:
1013
  </th>
1014
  <td>
1015
+ <input type='radio' value='1' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails1' <?php echo $crop1; ?> /> <label for='crop1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
1016
+ <input type='radio' value='0' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails2' <?php echo $crop2; ?> /> <label for='crop2'><?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
1017
+ <?php esc_html_e( 'Choosing "Yes" means that thumbnails are cropped to exact dimensions (normally thumbnails are proportional)', 'wp-e-commerce' ); ?>
1018
  </td>
1019
  </tr>
1020
  <?php
1022
  ?>
1023
 
1024
  <tr>
1025
+ <th scope="row"><?php esc_html_e( 'Show Thumbnails', 'wp-e-commerce' ); ?>:</th>
1026
  <td>
1027
  <?php
1028
  $show_thumbnails = get_option( 'show_thumbnails' );
1038
  break;
1039
  }
1040
  ?>
1041
+ <input type='radio' value='1' name='wpsc_options[show_thumbnails]' id='show_thumbnails1' <?php echo $show_thumbnails1; ?> /> <label for='show_thumbnails1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
1042
+ <input type='radio' value='0' name='wpsc_options[show_thumbnails]' id='show_thumbnails2' <?php echo $show_thumbnails2; ?> /> <label for='show_thumbnails2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
1043
  </td>
1044
  </tr>
1045
  <tr>
1046
+ <th scope="row"><?php esc_html_e( 'Use Lightbox Effect for product images', 'wp-e-commerce' ); ?>:</th>
1047
  <td>
1048
  <?php
1049
  $show_thumbnails_thickbox = get_option( 'show_thumbnails_thickbox' );
1059
  break;
1060
  }
1061
  ?>
1062
+ <input type='radio' value='1' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox1' <?php echo $show_thumbnails_thickbox1; ?> /> <label for='show_thumbnails_thickbox1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
1063
+ <input type='radio' value='0' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox2' <?php echo $show_thumbnails_thickbox2; ?> /> <label for='show_thumbnails_thickbox2'><?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
1064
+ <?php esc_html_e( 'Using lightbox means that when clicking on a product image, a larger version will be displayed in a "lightbox" style window. If you are using a plugin such as Shutter Reloaded, you may want to disable lightbox.', 'wp-e-commerce' ); ?>
1065
  </td>
1066
  </tr>
1067
  <tr>
1068
+ <th scope="row"><?php esc_html_e( 'Lightbox script to use', 'wp-e-commerce' ); ?>:</th>
1069
  <td>
1070
  <?php
1071
  $wpsc_lightbox = get_option( 'wpsc_lightbox', 'thickbox' );
1076
  if( $wpsc_lightbox == "colorbox" )
1077
  $wpsc_lightbox_thickbox1 = "checked ='checked'";
1078
  ?>
1079
+ <input type='radio' value='colorbox' name='wpsc_options[wpsc_lightbox]' id='wpsc_lightbox_thickbox1' <?php echo $wpsc_lightbox_thickbox1; ?> /> <label for='show_thumbnails_thickbox1'><?php _e( 'Colorbox', 'wp-e-commerce' ); ?></label> &nbsp;
1080
+ <input type='radio' value='thickbox' name='wpsc_options[wpsc_lightbox]' id='wpsc_lightbox_thickbox2' <?php echo $wpsc_lightbox_thickbox2; ?> /> <label for='show_thumbnails_thickbox2'><?php _e( 'Thickbox', 'wp-e-commerce' ); ?></label><br />
1081
  </td>
1082
  </tr>
1083
 
1086
  ?>
1087
  <tr>
1088
  <th scope="row">
1089
+ <?php esc_html_e( 'Show Thumbnail Gallery', 'wp-e-commerce' ); ?>:
1090
  </th>
1091
  <td>
1092
  <?php
1103
  break;
1104
  }
1105
  ?>
1106
+ <input type='radio' value='1' name='wpsc_options[show_gallery]' id='show_gallery1' <?php echo $show_gallery1; ?> /> <label for='show_gallery1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
1107
+ <input type='radio' value='0' name='wpsc_options[show_gallery]' id='show_gallery2' <?php echo $show_gallery2; ?> /> <label for='show_gallery2'><?php _e( 'No', 'wp-e-commerce' ); ?></label>
1108
  </td>
1109
  </tr>
1110
 
1111
  <tr>
1112
  <th scope="row">
1113
+ <?php esc_html_e( 'Gallery Thumbnail Image Size', 'wp-e-commerce' ); ?>:
1114
  </th>
1115
  <td>
1116
+ <?php esc_html_e( 'Width', 'wp-e-commerce' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_width]' value='<?php echo esc_attr( get_option( 'wpsc_gallery_image_width' ) ); ?>' />
1117
+ <?php esc_html_e( 'Height', 'wp-e-commerce' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_height]' value='<?php echo esc_attr( get_option( 'wpsc_gallery_image_height' ) ); ?>' /><br />
 
1118
  </td>
1119
  </tr>
1120
 
1124
  </table>
1125
 
1126
 
1127
+ <h3 class="form_group"><?php esc_html_e( 'Pagination Settings', 'wp-e-commerce' ); ?></h3>
1128
  <table class='wpsc_options form-table'>
1129
  <tr>
1130
  <th scope="row">
1131
+ <?php esc_html_e( 'Use Pagination', 'wp-e-commerce' ); ?>:
1132
  </th>
1133
  <td>
1134
  <?php
1147
  break;
1148
  }
1149
  ?>
1150
+ <input onclick='jQuery("#wpsc_products_per_page").show()' type='radio' value='1' name='wpsc_options[use_pagination]' id='use_pagination1' <?php echo $use_pagination1; ?> /> <label for='use_pagination1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
1151
+ <input onclick='jQuery("#wpsc_products_per_page").hide()' type='radio' value='0' name='wpsc_options[use_pagination]' id='use_pagination2' <?php echo $use_pagination2; ?> /> <label for='use_pagination2'><?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
1152
  <div id='wpsc_products_per_page' <?php echo $page_count_display_state; ?> >
1153
+ <input type='text' size='6' name='wpsc_options[wpsc_products_per_page]' value='<?php echo get_option( 'wpsc_products_per_page' ); ?>' /> <?php _e( 'number of products to show per page', 'wp-e-commerce' ); ?>
1154
  </div>
1155
  </td>
1156
  </tr>
1157
 
1158
  <tr>
1159
  <th scope="row">
1160
+ <?php esc_html_e( 'Page Number position', 'wp-e-commerce' ); ?>:
1161
  </th>
1162
  <td>
1163
  <input type='radio' value='1' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position1' <?php if ( get_option( 'wpsc_page_number_position' ) == 1 ) {
1164
  echo "checked='checked'";
1165
+ } ?> />&nbsp;<label for='wpsc_page_number_position1'><?php esc_html_e( 'Top', 'wp-e-commerce' ); ?></label> &nbsp;
1166
  <input type='radio' value='2' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position2' <?php if ( get_option( 'wpsc_page_number_position' ) == 2 ) {
1167
  echo "checked='checked'";
1168
+ } ?> />&nbsp;<label for='wpsc_page_number_position2'><?php esc_html_e( 'Bottom', 'wp-e-commerce' ); ?></label>&nbsp;
1169
  <input type='radio' value='3' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position3' <?php if ( get_option( 'wpsc_page_number_position' ) == 3 ) {
1170
  echo "checked='checked'";
1171
+ } ?> />&nbsp;<label for='wpsc_page_number_position3'><?php esc_html_e( 'Both', 'wp-e-commerce' ); ?></label>
1172
  <br />
1173
  </td>
1174
  </tr>
1175
  </table>
1176
 
1177
 
1178
+ <h3 class="form_group"><?php esc_html_e( 'Comment Settings', 'wp-e-commerce' ); ?></h3>
1179
  <table class='wpsc_options form-table'>
1180
  <tr>
1181
  <th scope="row">
1182
+ <?php esc_html_e( 'Use IntenseDebate Comments', 'wp-e-commerce' ); ?>:
1183
+ <a href="http://intensedebate.com/" title="<?php esc_attr_e( 'IntenseDebate comments enhance and encourage conversation on your blog or website', 'wp-e-commerce' ); ?>" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/intensedebate-logo.png" alt="<?php esc_attr_e( 'intensedebate-logo', 'wp-e-commerce' ); ?>" title="<?php esc_attr_e( 'IntenseDebate', 'wp-e-commerce' ); ?>" /></a>
1184
  </th>
1185
  <td>
1186
  <?php
1200
  break;
1201
  }
1202
  ?>
1203
+ <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").show()' type='radio' value='1' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments1' <?php echo $enable_comments1; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'Yes', 'wp-e-commerce' ); ?></label> &nbsp;
1204
+ <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").hide()' type='radio' value='0' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments2' <?php echo $enable_comments2; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'No', 'wp-e-commerce' ); ?></label><br />
1205
  <div id='wpsc_enable_comments' <?php echo $intense_debate_account_id_display_state; ?> >
1206
+ <?php esc_html_e( 'IntenseDebate Account ID', 'wp-e-commerce' ); ?>:<br/>
1207
+ <input type='text' size='30' name='wpsc_options[wpsc_intense_debate_account_id]' value='<?php echo esc_attr( get_option( 'wpsc_intense_debate_account_id' ) ); ?>' /><br/>
1208
+ <small><a href='http://intensedebate.com/sitekey/' title='<?php esc_attr_e( 'Help on finding the Account ID', 'wp-e-commerce' ); ?>'><?php _e( 'Help on finding the Account ID', 'wp-e-commerce' ); ?></a></small>
1209
  </div>
1210
  </td>
1211
  </tr>
1214
 
1215
  <th scope="row">
1216
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1217
+ <?php esc_html_e( 'By Default Display Comments on', 'wp-e-commerce' ); ?>:
1218
  </div>
1219
  </th>
1220
  <td>
1221
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1222
  <input type='radio' value='1' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products1' <?php if ( get_option( 'wpsc_comments_which_products' ) == 1 || !get_option( 'wpsc_comments_which_products' ) ) {
1223
  echo "checked='checked'";
1224
+ } ?> /><label for='wpsc_comments_which_products1'><?php esc_html_e( 'All Products', 'wp-e-commerce' ); ?></label>&nbsp;
1225
  <input type='radio' value='2' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products2' <?php if ( get_option( 'wpsc_comments_which_products' ) == 2 ) {
1226
  echo "checked='checked'";
1227
+ } ?> /><label for='wpsc_comments_which_products2'><?php esc_html_e( 'Per Product', 'wp-e-commerce' ); ?></label>&nbsp;
1228
  <br />
1229
  </div>
1230
  </td>
1233
  </table>
1234
  <?php
1235
  }
1236
+ }
wpsc-components/theme-engine-v1/classes/wpsc-products-by-category.php CHANGED
@@ -15,121 +15,64 @@ class wpsc_products_by_category {
15
  * @return void
16
  */
17
  function wpsc_products_by_category( $query ) {
18
- global $wpdb;
19
- $q = $query->query_vars;
20
-
21
-
22
- // Category stuff for nice URLs
23
- if ( !empty( $q['wpsc_product_category'] ) && !$query->is_singular ) {
24
- $q['taxonomy'] = 'wpsc_product_category';
25
- $q['term'] = $q['wpsc_product_category'];
26
- $in_cats = '';
27
- $join = " INNER JOIN $wpdb->term_relationships
28
- ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)
29
- INNER JOIN $wpdb->term_taxonomy
30
- ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
31
- ";
32
- if(isset($q['meta_key']))
33
- $join .= " INNER JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
34
-
35
- $whichcat = " AND $wpdb->term_taxonomy.taxonomy = '{$q['taxonomy']}' ";
36
-
37
- $term_data = get_term_by( 'slug', $q['term'], $q['taxonomy'] );
38
-
39
- if( is_object( $term_data ) )
40
- $in_cats = array( $term_data->term_id );
41
-
42
- if('0' != get_option('show_subcatsprods_in_cat') && is_object($term_data)){
43
- $term_children_data = get_term_children( $term_data->term_id, $q['taxonomy'] );
44
- $in_cats = array_reverse( array_merge( $in_cats, $term_children_data ) );
45
- }
46
- if( is_array( $in_cats ) ){
47
- $in_cats = "'" . implode( "', '", $in_cats ) . "'";
48
- $whichcat .= "AND $wpdb->term_taxonomy.term_id IN ($in_cats)";
49
- }
50
-
51
- $post_type_object = get_post_type_object( 'wpsc-product' );
52
- $permitted_post_statuses = current_user_can( $post_type_object->cap->edit_posts ) ? "'" . implode( "', '", apply_filters( 'wpsc_product_display_status', array( 'publish' ) ) ) . "'" : "'publish'";
53
-
54
- $whichcat .= " AND $wpdb->posts.post_status IN ($permitted_post_statuses) ";
55
- $groupby = "{$wpdb->posts}.ID";
56
-
57
- $this->sql_components['join'] = $join;
58
- $this->sql_components['fields'] = "{$wpdb->posts}.*, {$wpdb->term_taxonomy}.term_id, {$wpdb->term_relationships}.term_order";
59
- $this->sql_components['group_by'] = $groupby;
60
-
61
- //what about ordering by price
62
- if(isset($q['meta_key']) && '_wpsc_price' == $q['meta_key']){
63
- $whichcat .= " AND $wpdb->postmeta.meta_key = '_wpsc_price'";
64
- }else{
65
- $this->sql_components['order_by'] = "{$wpdb->term_taxonomy}.term_id";
66
-
67
- // Term Taxonomy ID Ordering
68
- if ( $q['orderby'] == 'menu_order' ) {
69
- if ( $term_data ) {
70
- $this->sql_components['order_by'] = "{$wpdb->term_relationships}.term_order ASC";
71
- }
72
- }
73
- }
74
- $this->sql_components['where'] = $whichcat;
75
- add_filter( 'posts_join', array( &$this, 'join_sql' ) );
76
- add_filter( 'posts_where', array( &$this, 'where_sql' ) );
77
- add_filter( 'posts_fields', array( &$this, 'fields_sql' ) );
78
- add_filter( 'posts_orderby', array( &$this, 'order_by_sql' ) );
79
- add_filter( 'posts_groupby', array( &$this, 'group_by_sql' ) );
80
- }
81
  }
82
 
83
  function join_sql( $sql ) {
84
- if ( isset( $this->sql_components['join'] ) )
85
- $sql = $this->sql_components['join'];
86
 
87
- remove_filter( 'posts_join', array( &$this, 'join_sql' ) );
 
88
  return $sql;
89
  }
90
 
91
  function where_sql( $sql ) {
92
- if ( isset( $this->sql_components['where'] ) )
93
- $sql = $this->sql_components['where'];
94
 
95
- remove_filter( 'posts_where', array( &$this, 'where_sql' ) );
 
96
  return $sql;
97
  }
98
 
99
  function order_by_sql( $sql ) {
100
- $order_by_parts = array( );
101
- $order_by_parts[] = $sql;
102
-
103
- if ( isset( $this->sql_components['order_by'] ) )
104
- $order_by_parts[] = $this->sql_components['order_by'];
105
 
106
- $order_by_parts = array_reverse( $order_by_parts );
107
- $sql = implode( ',', $order_by_parts );
108
 
109
- remove_filter( 'posts_orderby', array( &$this, 'order_by_sql' ) );
110
  return $sql;
111
  }
112
 
113
  function fields_sql( $sql ) {
114
- if ( isset( $this->sql_components['fields'] ) )
115
- $sql = $this->sql_components['fields'];
116
 
117
- remove_filter( 'posts_fields', array( &$this, 'fields_sql' ) );
 
118
  return $sql;
119
  }
120
 
121
  function group_by_sql( $sql ) {
122
- if ( isset( $this->sql_components['group_by'] ) )
123
- $sql = $this->sql_components['group_by'];
124
 
125
- remove_filter( 'posts_groupby', array( &$this, 'group_by_sql' ) );
 
126
  return $sql;
127
  }
128
 
129
  function request_sql( $sql ) {
130
- echo $sql . "<br />";
131
- remove_filter( 'posts_request', array( &$this, 'request_sql' ) );
 
132
  return $sql;
133
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
 
15
  * @return void
16
  */
17
  function wpsc_products_by_category( $query ) {
18
+
19
+ _wpsc_doing_it_wrong( 'wpsc_products_by_category', __( 'This class is deprecated. There is no direct replacement. Hiding subcategory products in parent categories is now handled by the private wpsc_hide_subcatsprods_in_cat_query() function.', 'wp-e-commerce' ), '4.0' );
20
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  function join_sql( $sql ) {
 
 
24
 
25
+ $this->_wpsc_doing_it_wrong( 'join_sql' );
26
+
27
  return $sql;
28
  }
29
 
30
  function where_sql( $sql ) {
 
 
31
 
32
+ $this->_wpsc_doing_it_wrong( 'where_sql' );
33
+
34
  return $sql;
35
  }
36
 
37
  function order_by_sql( $sql ) {
 
 
 
 
 
38
 
39
+ $this->_wpsc_doing_it_wrong( 'order_by_sql' );
 
40
 
 
41
  return $sql;
42
  }
43
 
44
  function fields_sql( $sql ) {
 
 
45
 
46
+ $this->_wpsc_doing_it_wrong( 'fields_sql' );
47
+
48
  return $sql;
49
  }
50
 
51
  function group_by_sql( $sql ) {
 
 
52
 
53
+ $this->_wpsc_doing_it_wrong( 'group_by_sql' );
54
+
55
  return $sql;
56
  }
57
 
58
  function request_sql( $sql ) {
59
+
60
+ $this->_wpsc_doing_it_wrong( 'request_sql' );
61
+
62
  return $sql;
63
  }
64
+
65
+ /**
66
+ * Doing it Wrong
67
+ *
68
+ * @since 4.0
69
+ * @access private
70
+ */
71
+ function _wpsc_doing_it_wrong( $method ) {
72
+
73
+ _wpsc_doing_it_wrong( 'wpsc_products_by_category->' . $method . '()', __( 'This class is deprecated. There is no direct replacement. Hiding subcategory products in parent categories is now handled by the private wpsc_hide_subcatsprods_in_cat_query() function.', 'wp-e-commerce' ), '4.0' );
74
+
75
+ }
76
+
77
  }
78
 
wpsc-components/theme-engine-v1/helpers/admin.php CHANGED
@@ -4,7 +4,7 @@ add_action( 'wpsc_register_settings_tabs', '_wpsc_te_v1_register_settings_tabs',
4
  add_action( 'wpsc_load_settings_tab_class', '_wpsc_te_v1_load_settings_tab_class', 10, 1 );
5
 
6
  function _wpsc_te_v1_register_settings_tabs( $page_instance ) {
7
- $page_instance->register_tab( 'presentation', _x( 'Presentation', 'Presentation settings tab in Settings->Store page', 'wpsc' ) );
8
  }
9
 
10
  function _wpsc_te_v1_load_settings_tab_class( $page_instance ) {
4
  add_action( 'wpsc_load_settings_tab_class', '_wpsc_te_v1_load_settings_tab_class', 10, 1 );
5
 
6
  function _wpsc_te_v1_register_settings_tabs( $page_instance ) {
7
+ $page_instance->register_tab( 'presentation', _x( 'Presentation', 'Presentation settings tab in Settings->Store page', 'wp-e-commerce' ) );
8
  }
9
 
10
  function _wpsc_te_v1_load_settings_tab_class( $page_instance ) {
wpsc-components/theme-engine-v1/helpers/ajax.php CHANGED
@@ -84,6 +84,8 @@ function wpsc_special_widget() {
84
  /**
85
  * add_to_cart function, used through ajax and in normal page loading.
86
  * No parameters, returns nothing
 
 
87
  */
88
  function wpsc_add_to_cart() {
89
  global $wpsc_cart;
@@ -96,7 +98,7 @@ function wpsc_add_to_cart() {
96
  $default_parameters['provided_price'] = null;
97
  $default_parameters['comment'] = null;
98
  $default_parameters['time_requested'] = null;
99
- $default_parameters['custom_message'] = null;
100
  $default_parameters['file_data'] = null;
101
  $default_parameters['is_customisable'] = false;
102
  $default_parameters['meta'] = null;
@@ -105,7 +107,7 @@ function wpsc_add_to_cart() {
105
  $permitted_post_statuses = current_user_can( $post_type_object->cap->edit_posts ) ? apply_filters( 'wpsc_product_display_status', array( 'publish' ) ) : array( 'publish' );
106
 
107
  /// sanitise submitted values
108
- $product_id = apply_filters( 'wpsc_add_to_cart_product_id' , (int) $_POST['product_id'] );
109
  $product = apply_filters( 'wpsc_add_to_cart_product_object', get_post( $product_id, OBJECT, 'display' ) );
110
 
111
  if ( ! in_array( $product->post_status, $permitted_post_statuses ) || 'wpsc-product' != $product->post_type ) {
@@ -113,45 +115,37 @@ function wpsc_add_to_cart() {
113
  }
114
 
115
  // compatibility with older themes
116
- if ( isset( $_POST['wpsc_quantity_update'] ) && is_array( $_POST['wpsc_quantity_update'] ) ) {
117
- $_POST['wpsc_quantity_update'] = $_POST['wpsc_quantity_update'][$product_id];
118
  }
119
 
120
- if ( isset( $_POST['variation'] ) ) {
121
-
122
- foreach ( (array) $_POST['variation'] as $key => $variation ) {
123
- $provided_parameters['variation_values'][ (int) $key ] = (int) $variation;
124
- }
125
-
126
- if ( count( $provided_parameters['variation_values'] ) > 0 ) {
127
- $variation_product_id = wpsc_get_child_object_in_terms( $product_id, $provided_parameters['variation_values'], 'wpsc-variation' );
128
- if ( $variation_product_id > 0 ) {
129
- $product_id = $variation_product_id;
130
- }
131
- }
132
  }
133
 
134
- if ( (isset( $_POST['quantity'] ) && $_POST['quantity'] > 0) && (!isset( $_POST['wpsc_quantity_update'] )) ) {
135
- $provided_parameters['quantity'] = (int) $_POST['quantity'];
136
- } else if ( isset( $_POST['wpsc_quantity_update'] ) ) {
137
- $wpsc_cart->remove_item( $_POST['key'] );
138
- $provided_parameters['quantity'] = (int) $_POST['wpsc_quantity_update'];
139
  }
140
 
141
- if ( isset( $_POST['is_customisable'] ) &&
142
- 'true' == $_POST['is_customisable'] ) {
143
  $provided_parameters['is_customisable'] = true;
144
 
145
- if ( isset( $_POST['custom_text'] ) ) {
146
- $provided_parameters['custom_message'] = stripslashes( $_POST['custom_text'] );
147
  }
148
  if ( isset( $_FILES['custom_file'] ) ) {
149
  $provided_parameters['file_data'] = $_FILES['custom_file'];
150
  }
151
  }
152
 
153
- if ( isset( $_POST['donation_price'] ) && ( (float) $_POST['donation_price'] > 0 ) ) {
154
- $provided_parameters['provided_price'] = (float) $_POST['donation_price'];
155
  }
156
 
157
  $parameters = array_merge( $default_parameters, (array) $provided_parameters );
@@ -161,25 +155,25 @@ function wpsc_add_to_cart() {
161
  if ( is_object( $cart_item ) ) {
162
 
163
  do_action( 'wpsc_add_to_cart', $product, $cart_item );
164
- $cart_messages[] = str_replace( "[product_name]", $cart_item->get_title(), __( 'You just added "[product_name]" to your cart.', 'wpsc' ) );
165
 
166
  } else {
167
  if ( $parameters['quantity'] <= 0 ) {
168
 
169
- $cart_messages[] = __( 'Sorry, but you cannot add zero items to your cart', 'wpsc' );
170
 
171
  } else if ( wpsc_product_has_variations( $product_id ) && is_null( $parameters['variation_values'] ) ) {
172
 
173
- $cart_messages[] = apply_filters( 'wpsc_add_to_cart_variation_missing_message', sprintf( __( 'This product has several options to choose from.<br /><br /><a href="%s" style="display:inline; float:none; margin: 0; padding: 0;">Visit the product page</a> to select options.', 'wpsc' ), esc_url( get_permalink( $product_id ) ) ), $product_id );
174
 
175
  } else if ( $wpsc_cart->get_remaining_quantity( $product_id, $parameters['variation_values'], $parameters['quantity'] ) > 0 ) {
176
 
177
  $quantity = $wpsc_cart->get_remaining_quantity( $product_id, $parameters['variation_values'], $parameters['quantity'] );
178
- $cart_messages[] = sprintf( _n( 'Sorry, but there is only %s of this item in stock.', 'Sorry, but there are only %s of this item in stock.', $quantity, 'wpsc' ), $quantity );
179
 
180
  } else {
181
 
182
- $cart_messages[] = apply_filters( 'wpsc_add_to_cart_out_of_stock_message', __( 'Sorry, but this item is out of stock.', 'wpsc' ), $product_id );
183
 
184
  }
185
  }
@@ -191,8 +185,9 @@ function wpsc_add_to_cart() {
191
 
192
  $json_response = $json_response + $output;
193
 
194
- if ( is_numeric( $product_id ) && 1 == get_option( 'fancy_notifications' ) )
195
  $json_response['fancy_notification'] = str_replace( array( "\n", "\r" ), array( '\n', '\r' ), fancy_notification_content( $cart_messages ) );
 
196
 
197
  $json_response = apply_filters( 'wpsc_add_to_cart_json_response', $json_response );
198
 
@@ -219,7 +214,7 @@ function wpsc_add_to_cart_button( $product_id, $return = false ) {
219
  ?>
220
  <div class='wpsc-add-to-cart-button'>
221
  <form class='wpsc-add-to-cart-button-form' id='product_<?php echo esc_attr( $product_id ) ?>' action='' method='post'>
222
- <?php do_action( 'wpsc_add_to_cart_button_form_begin' ); ?>
223
  <div class='wpsc_variation_forms'>
224
  <?php while ( wpsc_have_variation_groups() ) : wpsc_the_variation_group(); ?>
225
  <p>
@@ -234,14 +229,15 @@ function wpsc_add_to_cart_button( $product_id, $return = false ) {
234
  </div>
235
  <input type='hidden' name='wpsc_ajax_action' value='add_to_cart' />
236
  <input type='hidden' name='product_id' value='<?php echo $product_id; ?>' />
237
- <input type='submit' id='product_<?php echo $product_id; ?>_submit_button' class='wpsc_buy_button' name='Buy' value='<?php echo __( 'Add To Cart', 'wpsc' ); ?>' />
238
- <?php do_action( 'wpsc_add_to_cart_button_form_end' ); ?>
239
  </form>
240
  </div>
241
  <?php
242
 
243
- if ( $return )
244
  return ob_get_clean();
 
245
  }
246
  }
247
 
@@ -279,7 +275,7 @@ function wpsc_empty_cart() {
279
  $wpsc_cart->empty_cart( false );
280
 
281
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
282
- $output = _wpsc_ajax_get_cart( false );
283
  die( json_encode( $output ) );
284
  }
285
  }
@@ -364,7 +360,17 @@ function wpsc_update_shipping_price() {
364
  }
365
 
366
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
367
- echo json_encode( array( 'shipping' => wpsc_cart_shipping(), 'coupon' => wpsc_coupon_amount(), 'cart_total' => wpsc_cart_total(), 'tax' => wpsc_cart_tax() ) );
 
 
 
 
 
 
 
 
 
 
368
  exit();
369
  }
370
 
@@ -387,17 +393,19 @@ function wpsc_get_rating_count() {
387
  * No parameters, returns nothing
388
  */
389
  function wpsc_update_product_price() {
390
- if ( empty( $_POST['product_id'] ) || ! is_numeric( $_POST['product_id'] ) )
391
  return;
 
392
 
393
  $from = '';
394
  $change_price = true;
395
  $product_id = (int) $_POST['product_id'];
396
  $variations = array();
397
- $response = array(
398
- 'product_id' => $product_id,
399
  'variation_found' => false,
400
  );
 
401
  if ( ! empty( $_POST['variation'] ) ) {
402
  foreach ( $_POST['variation'] as $variation ) {
403
  if ( is_numeric( $variation ) ) {
@@ -413,13 +421,13 @@ function wpsc_update_product_price() {
413
  $response['variation_found'] = true;
414
  if ( $stock === 0 ) {
415
  $response += array(
416
- 'product_msg' => __( 'Sorry, but this variation is out of stock.', 'wpsc' ),
417
- 'variation_msg' => __( 'Variation not in stock', 'wpsc' ),
418
  'stock_available' => false,
419
  );
420
  } else {
421
  $response += array(
422
- 'variation_msg' => __( 'Product in stock', 'wpsc' ),
423
  'stock_available' => true,
424
  );
425
  }
@@ -442,6 +450,8 @@ function wpsc_update_product_price() {
442
  }
443
  }
444
 
 
 
445
  echo json_encode( $response );
446
  exit();
447
  }
@@ -591,7 +601,7 @@ function wpsc_submit_checkout( $collected_data = true ) {
591
  extract( $form_validity ); // extracts $is_valid and $error_messages
592
 
593
  if ( wpsc_has_tnc() && ( ! isset( $_POST['agree'] ) || $_POST['agree'] != 'yes' ) ) {
594
- $error_messages[] = __( 'Please agree to the terms and conditions, otherwise we cannot process your order.', 'wpsc' );
595
  $is_valid = false;
596
  }
597
  } else {
@@ -620,7 +630,7 @@ function wpsc_submit_checkout( $collected_data = true ) {
620
  }
621
 
622
  if ( ! empty( $countries ) && ! in_array( $country_id, (array) $countries ) ) {
623
- $errormessage = sprintf( __( '%s cannot be shipped to %s. To continue with your transaction please remove this product from the list below.', 'wpsc' ), $cartitem->get_title(), $country_name );
624
  wpsc_update_customer_meta( 'category_shipping_conflict', $errormessage );
625
  $is_valid = false;
626
  }
@@ -658,14 +668,14 @@ function wpsc_submit_checkout( $collected_data = true ) {
658
 
659
  if ( ! $has_free_shipping ) {
660
  if ( ! $wpsc_cart->shipping_method_selected() || ! $wpsc_cart->shipping_quote_selected() ) {
661
- $error_messages[] = __( 'Please select one of the available shipping options, then we can process your order.', 'wpsc' );
662
  $is_valid = false;
663
  }
664
  }
665
 
666
  // if we don't have a valid zip code ( the function also checks if we need it ) we have an error
667
  if ( ! wpsc_have_valid_shipping_zipcode() ) {
668
- wpsc_update_customer_meta( 'category_shipping_conflict', __( 'Please enter a Zipcode and click calculate to proceed', 'wpsc' ) );
669
  $is_valid = false;
670
  }
671
  }
@@ -737,6 +747,13 @@ function wpsc_submit_checkout( $collected_data = true ) {
737
  $purchase_log->save();
738
  $purchase_log_id = $purchase_log->get( 'id' );
739
 
 
 
 
 
 
 
 
740
  if ( $collected_data ) {
741
  $wpsc_checkout->save_forms_to_db( $purchase_log_id );
742
  }
@@ -934,7 +951,7 @@ function wpsc_update_shipping_quotes_on_shipping_same_as_billing() {
934
  ?>
935
  <tr class="wpsc_shipping_info">
936
  <td colspan="5">
937
- <?php _e( 'Please choose a country below to calculate your shipping costs', 'wpsc' ); ?>
938
  </td>
939
  </tr>
940
 
@@ -942,13 +959,13 @@ function wpsc_update_shipping_quotes_on_shipping_same_as_billing() {
942
  <?php if ( ! wpsc_have_valid_shipping_zipcode() ) : ?>
943
  <tr class='wpsc_update_location'>
944
  <td colspan='5' class='shipping_error' >
945
- <?php _e('Please provide a Zipcode and click Calculate in order to continue.', 'wpsc'); ?>
946
  </td>
947
  </tr>
948
  <?php else: ?>
949
  <tr class='wpsc_update_location_error'>
950
  <td colspan='5' class='shipping_error' >
951
- <?php _e('Sorry, online ordering is unavailable to this destination and/or weight. Please double check your destination details.', 'wpsc'); ?>
952
  </td>
953
  </tr>
954
  <?php endif; ?>
@@ -966,7 +983,7 @@ function wpsc_update_shipping_quotes_on_shipping_same_as_billing() {
966
  <?php if (wpsc_have_morethanone_shipping_quote()) :?>
967
  <?php while (wpsc_have_shipping_methods()) : wpsc_the_shipping_method(); ?>
968
  <?php if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
969
- <tr class='wpsc_shipping_header'><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__(' - Choose a Shipping Rate', 'wpsc'); ?> </td></tr>
970
  <?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote(); ?>
971
  <tr class='<?php echo wpsc_shipping_quote_html_id(); ?>'>
972
  <td class='wpsc_shipping_quote_name wpsc_shipping_quote_name_<?php echo wpsc_shipping_quote_html_id(); ?>' colspan='3'>
@@ -1014,7 +1031,7 @@ function _wpsc_get_alternate_html( $cart_messages ) {
1014
  wpsc_serialize_shopping_cart();
1015
 
1016
  $javascript = wp_remote_retrieve_body(
1017
- wp_remote_post(
1018
  esc_url_raw( add_query_arg( array( 'wpsc_action' => 'wpsc_get_alternate_html', 'ajax' => 'true', 'wpsc_ajax_action' => 'add_to_cart' ), home_url() ),
1019
  array(
1020
  'body' =>
@@ -1090,7 +1107,7 @@ function _wpsc_ajax_get_cart( $die = true, $cart_messages = array() ) {
1090
  }
1091
 
1092
  if ( ! empty( $action_output ) ) {
1093
- _wpsc_doing_it_wrong( 'wpsc_alternate_cart_html', __( 'As of WPeC 3.8.11, it is improper to hook into "wpsc_alternate_cart_html" to output javascript. We now have a custom javascript event called "wpsc_fancy_notification" you can hook into.', 'wpsc' ), '3.8.11' );
1094
  $return['wpsc_alternate_cart_html'] = $action_output;
1095
  }
1096
  }
84
  /**
85
  * add_to_cart function, used through ajax and in normal page loading.
86
  * No parameters, returns nothing
87
+ *
88
+ * @uses wpsc_get_product_id_from_variations() Given array of variation selections returns the variation product id as int
89
  */
90
  function wpsc_add_to_cart() {
91
  global $wpsc_cart;
98
  $default_parameters['provided_price'] = null;
99
  $default_parameters['comment'] = null;
100
  $default_parameters['time_requested'] = null;
101
+ $default_parameters['custom_message'] = '';
102
  $default_parameters['file_data'] = null;
103
  $default_parameters['is_customisable'] = false;
104
  $default_parameters['meta'] = null;
107
  $permitted_post_statuses = current_user_can( $post_type_object->cap->edit_posts ) ? apply_filters( 'wpsc_product_display_status', array( 'publish' ) ) : array( 'publish' );
108
 
109
  /// sanitise submitted values
110
+ $product_id = apply_filters( 'wpsc_add_to_cart_product_id' , (int) $_REQUEST['product_id'] );
111
  $product = apply_filters( 'wpsc_add_to_cart_product_object', get_post( $product_id, OBJECT, 'display' ) );
112
 
113
  if ( ! in_array( $product->post_status, $permitted_post_statuses ) || 'wpsc-product' != $product->post_type ) {
115
  }
116
 
117
  // compatibility with older themes
118
+ if ( isset( $_REQUEST['wpsc_quantity_update'] ) && is_array( $_REQUEST['wpsc_quantity_update'] ) ) {
119
+ $_REQUEST['wpsc_quantity_update'] = $_REQUEST['wpsc_quantity_update'][$product_id];
120
  }
121
 
122
+ if ( isset( $_REQUEST['variation'] ) ) {
123
+ $return_variation_params = wpsc_get_product_data_from_variations( $_REQUEST['variation'], $product_id );
124
+ $product_id = $return_variation_params['product_id'];
125
+ $provided_parameters['variation_values'] = $return_variation_params['variation_values'];
 
 
 
 
 
 
 
 
126
  }
127
 
128
+ if ( (isset( $_REQUEST['quantity'] ) && $_REQUEST['quantity'] > 0) && (!isset( $_REQUEST['wpsc_quantity_update'] )) ) {
129
+ $provided_parameters['quantity'] = (int) $_REQUEST['quantity'];
130
+ } else if ( isset( $_REQUEST['wpsc_quantity_update'] ) ) {
131
+ $wpsc_cart->remove_item( $_REQUEST['key'] );
132
+ $provided_parameters['quantity'] = (int) $_REQUEST['wpsc_quantity_update'];
133
  }
134
 
135
+ if ( isset( $_REQUEST['is_customisable'] ) &&
136
+ 'true' == $_REQUEST['is_customisable'] ) {
137
  $provided_parameters['is_customisable'] = true;
138
 
139
+ if ( isset( $_REQUEST['custom_text'] ) ) {
140
+ $provided_parameters['custom_message'] = stripslashes( $_REQUEST['custom_text'] );
141
  }
142
  if ( isset( $_FILES['custom_file'] ) ) {
143
  $provided_parameters['file_data'] = $_FILES['custom_file'];
144
  }
145
  }
146
 
147
+ if ( isset( $_REQUEST['donation_price'] ) && ( (float) $_REQUEST['donation_price'] > 0 ) ) {
148
+ $provided_parameters['provided_price'] = (float) $_REQUEST['donation_price'];
149
  }
150
 
151
  $parameters = array_merge( $default_parameters, (array) $provided_parameters );
155
  if ( is_object( $cart_item ) ) {
156
 
157
  do_action( 'wpsc_add_to_cart', $product, $cart_item );
158
+ $cart_messages[] = str_replace( "[product_name]", $cart_item->get_title(), __( 'You just added "[product_name]" to your cart.', 'wp-e-commerce' ) );
159
 
160
  } else {
161
  if ( $parameters['quantity'] <= 0 ) {
162
 
163
+ $cart_messages[] = __( 'Sorry, but you cannot add zero items to your cart', 'wp-e-commerce' );
164
 
165
  } else if ( wpsc_product_has_variations( $product_id ) && is_null( $parameters['variation_values'] ) ) {
166
 
167
+ $cart_messages[] = apply_filters( 'wpsc_add_to_cart_variation_missing_message', sprintf( __( 'This product has several options to choose from.<br /><br /><a href="%s" style="display:inline; float:none; margin: 0; padding: 0;">Visit the product page</a> to select options.', 'wp-e-commerce' ), esc_url( get_permalink( $product_id ) ) ), $product_id );
168
 
169
  } else if ( $wpsc_cart->get_remaining_quantity( $product_id, $parameters['variation_values'], $parameters['quantity'] ) > 0 ) {
170
 
171
  $quantity = $wpsc_cart->get_remaining_quantity( $product_id, $parameters['variation_values'], $parameters['quantity'] );
172
+ $cart_messages[] = sprintf( _n( 'Sorry, but there is only %s of this item in stock.', 'Sorry, but there are only %s of this item in stock.', $quantity, 'wp-e-commerce' ), $quantity );
173
 
174
  } else {
175
 
176
+ $cart_messages[] = apply_filters( 'wpsc_add_to_cart_out_of_stock_message', __( 'Sorry, but this item is out of stock.', 'wp-e-commerce' ), $product_id );
177
 
178
  }
179
  }
185
 
186
  $json_response = $json_response + $output;
187
 
188
+ if ( is_numeric( $product_id ) && 1 == get_option( 'fancy_notifications' ) ) {
189
  $json_response['fancy_notification'] = str_replace( array( "\n", "\r" ), array( '\n', '\r' ), fancy_notification_content( $cart_messages ) );
190
+ }
191
 
192
  $json_response = apply_filters( 'wpsc_add_to_cart_json_response', $json_response );
193
 
214
  ?>
215
  <div class='wpsc-add-to-cart-button'>
216
  <form class='wpsc-add-to-cart-button-form' id='product_<?php echo esc_attr( $product_id ) ?>' action='' method='post'>
217
+ <?php do_action( 'wpsc_add_to_cart_button_form_begin', $product_id ); ?>
218
  <div class='wpsc_variation_forms'>
219
  <?php while ( wpsc_have_variation_groups() ) : wpsc_the_variation_group(); ?>
220
  <p>
229
  </div>
230
  <input type='hidden' name='wpsc_ajax_action' value='add_to_cart' />
231
  <input type='hidden' name='product_id' value='<?php echo $product_id; ?>' />
232
+ <input type='submit' id='product_<?php echo $product_id; ?>_submit_button' class='wpsc_buy_button' name='Buy' value='<?php echo __( 'Add To Cart', 'wp-e-commerce' ); ?>' />
233
+ <?php do_action( 'wpsc_add_to_cart_button_form_end', $product_id ); ?>
234
  </form>
235
  </div>
236
  <?php
237
 
238
+ if ( $return ) {
239
  return ob_get_clean();
240
+ }
241
  }
242
  }
243
 
275
  $wpsc_cart->empty_cart( false );
276
 
277
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
278
+ $output = apply_filters( 'wpsc_empty_cart_response', _wpsc_ajax_get_cart( false ) );
279
  die( json_encode( $output ) );
280
  }
281
  }
360
  }
361
 
362
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
363
+
364
+ $response = apply_filters( 'wpsc_update_shipping_price_response', array(
365
+ 'shipping' => wpsc_cart_shipping(),
366
+ 'coupon' => wpsc_coupon_amount(),
367
+ 'cart_total' => wpsc_cart_total(),
368
+ 'tax' => wpsc_cart_tax()
369
+ ),
370
+ $quote_shipping_method,
371
+ $quote_shipping_option
372
+ );
373
+ echo json_encode( $response );
374
  exit();
375
  }
376
 
393
  * No parameters, returns nothing
394
  */
395
  function wpsc_update_product_price() {
396
+ if ( empty( $_POST['product_id'] ) || ! is_numeric( $_POST['product_id'] ) ) {
397
  return;
398
+ }
399
 
400
  $from = '';
401
  $change_price = true;
402
  $product_id = (int) $_POST['product_id'];
403
  $variations = array();
404
+ $response = array(
405
+ 'product_id' => $product_id,
406
  'variation_found' => false,
407
  );
408
+
409
  if ( ! empty( $_POST['variation'] ) ) {
410
  foreach ( $_POST['variation'] as $variation ) {
411
  if ( is_numeric( $variation ) ) {
421
  $response['variation_found'] = true;
422
  if ( $stock === 0 ) {
423
  $response += array(
424
+ 'product_msg' => __( 'Sorry, but this variation is out of stock.', 'wp-e-commerce' ),
425
+ 'variation_msg' => __( 'Variation not in stock', 'wp-e-commerce' ),
426
  'stock_available' => false,
427
  );
428
  } else {
429
  $response += array(
430
+ 'variation_msg' => __( 'Product in stock', 'wp-e-commerce' ),
431
  'stock_available' => true,
432
  );
433
  }
450
  }
451
  }
452
 
453
+ $response = apply_filters( 'wpsc_update_product_price', $response, $product_id );
454
+
455
  echo json_encode( $response );
456
  exit();
457
  }
601
  extract( $form_validity ); // extracts $is_valid and $error_messages
602
 
603
  if ( wpsc_has_tnc() && ( ! isset( $_POST['agree'] ) || $_POST['agree'] != 'yes' ) ) {
604
+ $error_messages[] = __( 'Please agree to the terms and conditions, otherwise we cannot process your order.', 'wp-e-commerce' );
605
  $is_valid = false;
606
  }
607
  } else {
630
  }
631
 
632
  if ( ! empty( $countries ) && ! in_array( $country_id, (array) $countries ) ) {
633
+ $errormessage = sprintf( __( '%s cannot be shipped to %s. To continue with your transaction, please remove this product from the list below.', 'wp-e-commerce' ), $cartitem->get_title(), $country_name );
634
  wpsc_update_customer_meta( 'category_shipping_conflict', $errormessage );
635
  $is_valid = false;
636
  }
668
 
669
  if ( ! $has_free_shipping ) {
670
  if ( ! $wpsc_cart->shipping_method_selected() || ! $wpsc_cart->shipping_quote_selected() ) {
671
+ $error_messages[] = __( 'Please select one of the available shipping options, then we can process your order.', 'wp-e-commerce' );
672
  $is_valid = false;
673
  }
674
  }
675
 
676
  // if we don't have a valid zip code ( the function also checks if we need it ) we have an error
677
  if ( ! wpsc_have_valid_shipping_zipcode() ) {
678
+ wpsc_update_customer_meta( 'category_shipping_conflict', __( 'Please enter a Zipcode and click calculate to proceed', 'wp-e-commerce' ) );
679
  $is_valid = false;
680
  }
681
  }
747
  $purchase_log->save();
748
  $purchase_log_id = $purchase_log->get( 'id' );
749
 
750
+ //Check to ensure log row was inserted successfully
751
+ if(is_null($purchase_log_id)) {
752
+ $error_messages[] = __( 'A database error occured while processing your request.', 'wp-e-commerce' );
753
+ wpsc_update_customer_meta( 'checkout_misc_error_messages', $error_messages );
754
+ return;
755
+ }
756
+
757
  if ( $collected_data ) {
758
  $wpsc_checkout->save_forms_to_db( $purchase_log_id );
759
  }
951
  ?>
952
  <tr class="wpsc_shipping_info">
953
  <td colspan="5">
954
+ <?php _e( 'Please choose a country below to calculate your shipping costs', 'wp-e-commerce' ); ?>
955
  </td>
956
  </tr>
957
 
959
  <?php if ( ! wpsc_have_valid_shipping_zipcode() ) : ?>
960
  <tr class='wpsc_update_location'>
961
  <td colspan='5' class='shipping_error' >
962
+ <?php _e('Please provide a ZIP code and click Calculate in order to continue.', 'wp-e-commerce'); ?>
963
  </td>
964
  </tr>
965
  <?php else: ?>
966
  <tr class='wpsc_update_location_error'>
967
  <td colspan='5' class='shipping_error' >
968
+ <?php _e('Sorry, online ordering is unavailable for this destination and/or weight. Please double check your destination details.', 'wp-e-commerce'); ?>
969
  </td>
970
  </tr>
971
  <?php endif; ?>
983
  <?php if (wpsc_have_morethanone_shipping_quote()) :?>
984
  <?php while (wpsc_have_shipping_methods()) : wpsc_the_shipping_method(); ?>
985
  <?php if (!wpsc_have_shipping_quotes()) { continue; } // Don't display shipping method if it doesn't have at least one quote ?>
986
+ <tr class='wpsc_shipping_header'><td class='shipping_header' colspan='5'><?php echo wpsc_shipping_method_name().__(' - Choose a Shipping Rate', 'wp-e-commerce'); ?> </td></tr>
987
  <?php while (wpsc_have_shipping_quotes()) : wpsc_the_shipping_quote(); ?>
988
  <tr class='<?php echo wpsc_shipping_quote_html_id(); ?>'>
989
  <td class='wpsc_shipping_quote_name wpsc_shipping_quote_name_<?php echo wpsc_shipping_quote_html_id(); ?>' colspan='3'>
1031
  wpsc_serialize_shopping_cart();
1032
 
1033
  $javascript = wp_remote_retrieve_body(
1034
+ wp_safe_remote_post(
1035
  esc_url_raw( add_query_arg( array( 'wpsc_action' => 'wpsc_get_alternate_html', 'ajax' => 'true', 'wpsc_ajax_action' => 'add_to_cart' ), home_url() ),
1036
  array(
1037
  'body' =>
1107
  }
1108
 
1109
  if ( ! empty( $action_output ) ) {
1110
+ _wpsc_doing_it_wrong( 'wpsc_alternate_cart_html', __( 'As of WPeC 3.8.11, it is improper to hook into "wpsc_alternate_cart_html" to output javascript. We now have a custom javascript event called "wpsc_fancy_notification" you can hook into.', 'wp-e-commerce' ), '3.8.11' );
1111
  $return['wpsc_alternate_cart_html'] = $action_output;
1112
  }
1113
  }
wpsc-components/theme-engine-v1/helpers/checkout.php CHANGED
@@ -371,7 +371,7 @@ function wpsc_shipping_country_list( $shippingdetails = false ) {
371
  'acceptable_ids' => $acceptable_countries,
372
  'selected' => $selected_country,
373
  'additional_attributes' => $additional_attributes,
374
- 'placeholder' => __( 'Please select a country', 'wpsc' ),
375
  )
376
  );
377
 
@@ -380,7 +380,7 @@ function wpsc_shipping_country_list( $shippingdetails = false ) {
380
  $output .= wpsc_checkout_shipping_state_and_region();
381
 
382
  $zipvalue = (string) wpsc_get_customer_meta( 'shippingpostcode' );
383
- $zip_code_text = __( 'Your Zipcode', 'wpsc' );
384
 
385
  if ( ( $zipvalue != '' ) && ( $zipvalue != $zip_code_text ) ) {
386
  $color = '#000';
371
  'acceptable_ids' => $acceptable_countries,
372
  'selected' => $selected_country,
373
  'additional_attributes' => $additional_attributes,
374
+ 'placeholder' => __( 'Please select a country', 'wp-e-commerce' ),
375
  )
376
  );
377
 
380
  $output .= wpsc_checkout_shipping_state_and_region();
381
 
382
  $zipvalue = (string) wpsc_get_customer_meta( 'shippingpostcode' );
383
+ $zip_code_text = __( 'Your Zipcode', 'wp-e-commerce' );
384
 
385
  if ( ( $zipvalue != '' ) && ( $zipvalue != $zip_code_text ) ) {
386
  $color = '#000';
wpsc-components/theme-engine-v1/helpers/form.php CHANGED
@@ -1,58 +1,9 @@
1
  <?php
2
 
3
- function nzshpcrt_country_list( $selected_country = null ) {
4
- return _wpsc_country_dropdown_options( array(
5
- 'selected' => $selected_country,
6
- ) );
7
- }
8
-
9
- function nzshpcrt_region_list( $selected_country = null, $selected_region = null ) {
10
- global $wpdb;
11
-
12
- if ( $selected_region == null )
13
- $selected_region = get_option( 'base_region' );
14
-
15
- $output = "";
16
- $region_list = WPSC_Countries::get_regions( $selected_country, true );
17
-
18
- if ( $region_list != null ) {
19
- foreach ( $region_list as $region ) {
20
- if ( $selected_region == $region['id'] ) {
21
- $selected = "selected='selected'";
22
- } else {
23
- $selected = "";
24
- }
25
-
26
- $output .= "<option value='" . $region['id'] . "' $selected>" . $region['name'] . "</option>\r\n";
27
- }
28
- } else {
29
- $output .= "<option value=''>" . esc_html__( 'None', 'wpsc' ) . "</option>\r\n";
30
- }
31
-
32
- return $output;
33
- }
34
-
35
- function nzshpcrt_form_field_list( $selected_field = null ) {
36
- global $wpdb;
37
- $output = "<option value=''>" . esc_html__( 'Please choose', 'wpsc' ) . "</option>";
38
- $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1';";
39
- $form_data = $wpdb->get_results( $form_sql, ARRAY_A );
40
-
41
- foreach ( (array)$form_data as $form ) {
42
- $selected = '';
43
- if ( $selected_field == $form['id'] ) {
44
- $selected = "selected='selected'";
45
- }
46
- $output .= "<option value='" . $form['id'] . "' $selected>" . $form['name'] . "</option>";
47
- }
48
-
49
- return $output;
50
- }
51
-
52
  function wpsc_parent_category_list( $taxonomies, $args, $parent, $current_term_id ) {
53
  $myterms = get_terms( $taxonomies, $args );
54
  $output = "<select name='category_parent'>";
55
- $output .="<option value='0'>" . __( 'No Parent', 'wpsc' ) . "</option>";
56
  $output .= wpsc_category_options(0, null, null, 0, $current_term_id );
57
  $output .="</select>";
58
 
@@ -83,5 +34,4 @@ function wpsc_category_options( $group_id, $this_category = null, $category_id =
83
  }
84
 
85
  return $output;
86
- }
87
-
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  function wpsc_parent_category_list( $taxonomies, $args, $parent, $current_term_id ) {
4
  $myterms = get_terms( $taxonomies, $args );
5
  $output = "<select name='category_parent'>";
6
+ $output .="<option value='0'>" . __( 'No Parent', 'wp-e-commerce' ) . "</option>";
7
  $output .= wpsc_category_options(0, null, null, 0, $current_term_id );
8
  $output .="</select>";
9
 
34
  }
35
 
36
  return $output;
37
+ }
 
wpsc-components/theme-engine-v1/helpers/page.php CHANGED
@@ -34,10 +34,6 @@ if ( ! is_admin() )
34
  if(get_option( 'wpsc_hide_featured_products' ) == 1)
35
  add_action( 'wpsc_top_of_products_page', 'wpsc_display_featured_products_page', 12 );
36
 
37
- $show_subcatsprods_in_cat = get_option( 'show_subcatsprods_in_cat' );
38
- if(!$show_subcatsprods_in_cat)
39
- add_action( 'init', 'wpsc_hidesubcatprods_init' );
40
-
41
  /**
42
  * wpsc_register_theme_file( $file_name )
43
  *
@@ -186,7 +182,7 @@ function wpsc_check_theme_location() {
186
  function wpsc_list_product_templates( $path = '' ) {
187
 
188
  $selected_theme = get_option( 'wpsc_selected_theme' );
189
-
190
  // If no path, then try to make some assuptions
191
  if ( empty( $path ) ) {
192
  if ( file_exists( WPSC_OLD_THEMES_PATH . $selected_theme . '/' . $selected_theme . '.css' ) ) {
@@ -219,7 +215,7 @@ function wpsc_list_product_templates( $path = '' ) {
219
  function wpsc_theme_upgrade_notice() { ?>
220
 
221
  <div id="message" class="updated fade">
222
- <p><?php printf( __( '<strong>WP eCommerce is ready</strong>. If you plan on editing the look of your site, you should <a href="%1s">update your active theme</a> to include the additional WP eCommerce files. <a href="%2s">Click here</a> to ignore and remove this box.', 'wpsc' ), admin_url( 'admin.php?page=wpsc-settings&tab=presentation' ), admin_url( 'admin.php?page=wpsc-settings&tab=presentation&wpsc_notices=theme_ignore' ) ) ?></p>
223
  </div>
224
 
225
  <?php
@@ -236,7 +232,7 @@ function wpsc_theme_upgrade_notice() { ?>
236
  function wpsc_database_update_notice() { ?>
237
 
238
  <div class="error fade">
239
- <p><?php printf( __( '<strong>Your WP eCommerce data needs to be updated</strong>. You\'ve upgraded from a previous version of the WP eCommerce plugin, and your store needs updating.<br>You should <a href="%1s">update your database</a> for your store to continue working.', 'wpsc' ), admin_url( 'index.php?page=wpsc-update' ) ) ?></p>
240
  </div>
241
 
242
  <?php
@@ -249,7 +245,7 @@ function wpsc_theme_admin_notices() {
249
  if ( false !== get_option( 'wpsc_version' ) ) {
250
 
251
  // Database update notice is most important
252
- if ( version_compare( get_option( 'wpsc_version' ), 3.8, '<' ) ) {
253
 
254
  add_action ( 'admin_notices', 'wpsc_database_update_notice' );
255
 
@@ -278,7 +274,7 @@ function wpsc_theme_admin_notices() {
278
  function wpsc_turn_on_wp_register() {?>
279
 
280
  <div id="message" class="updated fade">
281
- <p><?php printf( __( '<strong>Store Settings</strong>: You have set \'users must register before checkout\', for this to work you need to check \'Anyone can register\' in your WordPress <a href="%1s">General Settings</a>.', 'wpsc' ), admin_url( 'options-general.php' ) ) ?></p>
282
  </div>
283
 
284
  <?php
@@ -571,7 +567,28 @@ function wpsc_single_template( $content ) {
571
 
572
  $is_preview = isset( $wp_query->query_vars['preview'] ) && $wp_query->query_vars['preview'];
573
 
574
- $wpsc_temp_query = new WP_Query( array( 'p' => $wp_query->post->ID , 'post_type' => 'wpsc-product','posts_per_page' => 1, 'preview' => $is_preview ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
 
576
  list( $wp_query, $wpsc_temp_query ) = array( $wpsc_temp_query, $wp_query ); // swap the wpsc_query object
577
  $_wpsc_is_in_custom_loop = true;
@@ -1136,15 +1153,16 @@ function wpsc_user_log( $content = '' ) {
1136
  function wpsc_get_the_post_id_by_shortcode( $shortcode ) {
1137
 
1138
  $shortcode_options = array(
1139
- '[productspage]' => 'product_list_url',
1140
- '[shoppingcart]' => 'shopping_cart_url',
1141
- '[checkout]' => 'shopping_cart_url',
1142
- '[transactionresults]' => 'transact_url',
1143
- '[userlog]' => 'user_account_url'
1144
- );
1145
-
1146
- if ( ! isset( $shortcode_options[$shortcode] ) )
1147
  return 0;
 
1148
 
1149
  $page_ids = get_option( 'wpsc_shortcode_page_ids', false );
1150
 
@@ -1153,7 +1171,7 @@ function wpsc_get_the_post_id_by_shortcode( $shortcode ) {
1153
  $page_ids = get_option( 'wpsc_shortcode_page_ids', false );
1154
  }
1155
 
1156
- $post_id = isset( $page_ids[$shortcode] ) ? $page_ids[$shortcode] : null;
1157
 
1158
  // For back compat
1159
  $post_id = apply_filters( 'wpec_get_the_post_id_by_shortcode', $post_id );
@@ -1163,8 +1181,10 @@ function wpsc_get_the_post_id_by_shortcode( $shortcode ) {
1163
  }
1164
 
1165
  function wpec_remap_shop_subpages( $vars ) {
1166
- if( empty( $vars ) )
1167
  return $vars;
 
 
1168
  $reserved_names = array('[shoppingcart]','[userlog]','[transactionresults]');
1169
  foreach($reserved_names as $reserved_name){
1170
  if ( isset( $vars['taxonomy'] ) && $vars['taxonomy'] == 'wpsc_product_category' && isset( $vars['term'] ) && $vars['term'] == $page->post_name ) {
@@ -1178,7 +1198,7 @@ function wpec_remap_shop_subpages( $vars ) {
1178
 
1179
  function wpsc_remove_page_from_query_string( $query_string ) {
1180
 
1181
- if ( false === strpos( implode( ' ', $query_string ), 'wpsc' ) ) {
1182
  return $query_string;
1183
  }
1184
 
@@ -1272,9 +1292,15 @@ function wpsc_display_featured_products_page() {
1272
  }
1273
  }
1274
 
 
 
 
 
 
1275
  function wpsc_hidesubcatprods_init() {
1276
- $hide_subcatsprods = new WPSC_Hide_subcatsprods_in_cat;
1277
- add_action( 'pre_get_posts', array( &$hide_subcatsprods, 'get_posts' ) );
 
1278
  }
1279
 
1280
  // check for all in one SEO pack and the is_static_front_page function
@@ -1399,7 +1425,9 @@ function wpsc_set_aioseop_description( $data ) {
1399
  * @return string - the URL of the current page
1400
  */
1401
  function wpsc_this_page_url() {
 
1402
  global $wpsc_query, $wp_query;
 
1403
  if ( $wpsc_query->is_single === true ) {
1404
  $output = get_permalink( $wp_query->post->ID );
1405
  } else if ( isset( $wpsc_query->category ) && $wpsc_query->category != null ) {
@@ -1411,8 +1439,6 @@ function wpsc_this_page_url() {
1411
  $output = add_query_arg( 'page_number', $wpsc_query->query_vars['page'], $output );
1412
  }
1413
  }
1414
- } elseif ( isset( $id ) ) {
1415
- $output = get_permalink( $id );
1416
  } else {
1417
  $output = get_permalink( get_the_ID() );
1418
  }
34
  if(get_option( 'wpsc_hide_featured_products' ) == 1)
35
  add_action( 'wpsc_top_of_products_page', 'wpsc_display_featured_products_page', 12 );
36
 
 
 
 
 
37
  /**
38
  * wpsc_register_theme_file( $file_name )
39
  *
182
  function wpsc_list_product_templates( $path = '' ) {
183
 
184
  $selected_theme = get_option( 'wpsc_selected_theme' );
185
+ $templates = array();
186
  // If no path, then try to make some assuptions
187
  if ( empty( $path ) ) {
188
  if ( file_exists( WPSC_OLD_THEMES_PATH . $selected_theme . '/' . $selected_theme . '.css' ) ) {
215
  function wpsc_theme_upgrade_notice() { ?>
216
 
217
  <div id="message" class="updated fade">
218
+ <p><?php printf( __( '<strong>WP eCommerce is ready</strong>. If you plan on editing the look of your site, you should <a href="%1s">update your active theme</a> to include the additional WP eCommerce files. <a href="%2s">Click here</a> to ignore and remove this box.', 'wp-e-commerce' ), admin_url( 'admin.php?page=wpsc-settings&tab=presentation' ), admin_url( 'admin.php?page=wpsc-settings&tab=presentation&wpsc_notices=theme_ignore' ) ) ?></p>
219
  </div>
220
 
221
  <?php
232
  function wpsc_database_update_notice() { ?>
233
 
234
  <div class="error fade">
235
+ <p><?php printf( __( '<strong>Your WP eCommerce data needs to be updated</strong>. You\'ve upgraded from a previous version of the WP eCommerce plugin, and your store needs updating.<br>You should <a href="%1s">update your database</a> for your store to continue working.', 'wp-e-commerce' ), admin_url( 'index.php?page=wpsc-update' ) ) ?></p>
236
  </div>
237
 
238
  <?php
245
  if ( false !== get_option( 'wpsc_version' ) ) {
246
 
247
  // Database update notice is most important
248
+ if ( version_compare( get_option ( 'wpsc_version' ), 3.8, '<' ) ) {
249
 
250
  add_action ( 'admin_notices', 'wpsc_database_update_notice' );
251
 
274
  function wpsc_turn_on_wp_register() {?>
275
 
276
  <div id="message" class="updated fade">
277
+ <p><?php printf( __( '<strong>Store Settings</strong>: You have set \'users must register before checkout\', for this to work you need to check \'Anyone can register\' in your WordPress <a href="%1s">General Settings</a>.', 'wp-e-commerce' ), admin_url( 'options-general.php' ) ) ?></p>
278
  </div>
279
 
280
  <?php
567
 
568
  $is_preview = isset( $wp_query->query_vars['preview'] ) && $wp_query->query_vars['preview'];
569
 
570
+ $post_type_object = get_post_type_object( 'wpsc-product' );
571
+
572
+ /**
573
+ * Filter post_status on product query.
574
+ *
575
+ * Assumes publish, if user has edit_posts capability, can override
576
+ *
577
+ * @since 4.1.0
578
+ *
579
+ * @param array array() Allowed post_status values.
580
+ */
581
+ $permitted_post_statuses = current_user_can( $post_type_object->cap->edit_posts ) ? apply_filters( 'wpsc_product_display_status', array( 'publish' ) ) : array( 'publish' );
582
+
583
+ $wpsc_temp_query = new WP_Query(
584
+ array(
585
+ 'p' => $wp_query->post->ID ,
586
+ 'post_type' => 'wpsc-product',
587
+ 'posts_per_page' => 1,
588
+ 'preview' => $is_preview,
589
+ 'post_status' => $permitted_post_statuses,
590
+ )
591
+ );
592
 
593
  list( $wp_query, $wpsc_temp_query ) = array( $wpsc_temp_query, $wp_query ); // swap the wpsc_query object
594
  $_wpsc_is_in_custom_loop = true;
1153
  function wpsc_get_the_post_id_by_shortcode( $shortcode ) {
1154
 
1155
  $shortcode_options = array(
1156
+ '[productspage]' => 'product_list_url',
1157
+ '[shoppingcart]' => 'shopping_cart_url',
1158
+ '[checkout]' => 'shopping_cart_url',
1159
+ '[transactionresults]' => 'transact_url',
1160
+ '[userlog]' => 'user_account_url'
1161
+ );
1162
+
1163
+ if ( ! isset( $shortcode_options[ $shortcode ] ) ) {
1164
  return 0;
1165
+ }
1166
 
1167
  $page_ids = get_option( 'wpsc_shortcode_page_ids', false );
1168
 
1171
  $page_ids = get_option( 'wpsc_shortcode_page_ids', false );
1172
  }
1173
 
1174
+ $post_id = isset( $page_ids[ $shortcode ] ) ? $page_ids[ $shortcode ] : null;
1175
 
1176
  // For back compat
1177
  $post_id = apply_filters( 'wpec_get_the_post_id_by_shortcode', $post_id );
1181
  }
1182
 
1183
  function wpec_remap_shop_subpages( $vars ) {
1184
+ if ( empty( $vars ) ) {
1185
  return $vars;
1186
+ }
1187
+
1188
  $reserved_names = array('[shoppingcart]','[userlog]','[transactionresults]');
1189
  foreach($reserved_names as $reserved_name){
1190
  if ( isset( $vars['taxonomy'] ) && $vars['taxonomy'] == 'wpsc_product_category' && isset( $vars['term'] ) && $vars['term'] == $page->post_name ) {
1198
 
1199
  function wpsc_remove_page_from_query_string( $query_string ) {
1200
 
1201
+ if ( false === strpos( implode( ' ', $query_string ), 'wp-e-commerce' ) ) {
1202
  return $query_string;
1203
  }
1204
 
1292
  }
1293
  }
1294
 
1295
+ /**
1296
+ * Hide Subcat Products Init
1297
+ *
1298
+ * @deprecated Since 4.0. Hiding subcategory products in parent categories is now handled by the private wpsc_hide_subcatsprods_in_cat_query() function.
1299
+ */
1300
  function wpsc_hidesubcatprods_init() {
1301
+
1302
+ _wpsc_doing_it_wrong( 'wpsc_hidesubcatprods_init', __( 'This function is deprecated. There is no direct replacement. Hiding subcategory products in parent categories is now handled by the private wpsc_hide_subcatsprods_in_cat_query() function.', 'wp-e-commerce' ), '4.0' );
1303
+
1304
  }
1305
 
1306
  // check for all in one SEO pack and the is_static_front_page function
1425
  * @return string - the URL of the current page
1426
  */
1427
  function wpsc_this_page_url() {
1428
+
1429
  global $wpsc_query, $wp_query;
1430
+
1431
  if ( $wpsc_query->is_single === true ) {
1432
  $output = get_permalink( $wp_query->post->ID );
1433
  } else if ( isset( $wpsc_query->category ) && $wpsc_query->category != null ) {
1439
  $output = add_query_arg( 'page_number', $wpsc_query->query_vars['page'], $output );
1440
  }
1441
  }
 
 
1442
  } else {
1443
  $output = get_permalink( get_the_ID() );
1444
  }
wpsc-components/theme-engine-v1/helpers/product.php CHANGED
@@ -168,7 +168,7 @@ function wpsc_parent_category_image($show_thumbnails , $category_image , $width,
168
  ?>
169
  <span class='wpsc_category_image item_no_image ' style='width:<?php echo $width; ?>px; height: <?php echo $height; ?>px;'>
170
  <span class='link_substitute' >
171
- <span><?php _e('N/A', 'wpsc'); ?></span>
172
  </span>
173
  </span>
174
  <?php
@@ -454,7 +454,7 @@ function wpsc_display_category_loop($query, $category_html, &$category_branch =
454
  } elseif( isset( $query['show_name'] ) && 1 == $query['show_name']) {
455
  $category_image_html .= "<span class='wpsc_category_image item_no_image ' style='width: {$width}px; height: {$height}px;'>\n\r";
456
  $category_image_html .= " <span class='link_substitute' >\n\r";
457
- $category_image_html .= " <span>".__('N/A','wpsc')."</span>\n\r";
458
  $category_image_html .= " </span>\n\r";
459
  $category_image_html .= "</span>\n\r";
460
  }
@@ -654,7 +654,7 @@ function wpsc_buy_now_button( $product_id, $replaced_shortcode = false ) {
654
 
655
  $has_variants = wpsc_product_has_variations( $product_id ) || ! wpsc_product_has_stock( $product_id );
656
 
657
- $src = apply_filters( 'wpsc_buy_now_button_src', _x( 'https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif', 'PayPal Buy Now Button', 'wpsc' ) );
658
  $classes = apply_filters( 'wpsc_buy_now_button_class', "wpsc-buy-now-form wpsc-buy-now-form-{$product_id}" );
659
 
660
  $classes_array = array_map( 'sanitize_html_class', explode( ' ', $classes ) );
@@ -665,7 +665,7 @@ function wpsc_buy_now_button( $product_id, $replaced_shortcode = false ) {
665
  disabled( $has_variants, true, false ),
666
  esc_attr( $product_id ),
667
  esc_url( $src ),
668
- esc_attr__( 'PayPal - The safer, easier way to pay online', 'wpsc' )
669
  );
670
 
671
  $button_html = apply_filters( 'wpsc_buy_now_button_html', $button_html, $product_id );
@@ -683,13 +683,13 @@ function wpsc_buy_now_button( $product_id, $replaced_shortcode = false ) {
683
  endif; /* END wpsc_product_has_variations */
684
  ?>
685
  <?php if ( get_option( 'multi_add' ) ) : ?>
686
- <label for="quantity"><?php esc_html_e( 'Quantity', 'wpsc' ); ?></label>
687
  <input type="text" size="4" id="quantity" class="wpsc-buy-now-quantity" name="quantity" value="" /><br />
688
  <?php else: ?>
689
  <input type="hidden" name="quantity" class="wpsc-buy-now-quantity" value="1" />
690
  <?php endif ?>
691
  <?php echo $button_html; ?>
692
- <img alt='' border='0' width='1' height='1' src='<?php echo esc_url( _x( 'https://www.paypal.com/en_US/i/scr/pixel.gif', 'PayPal Pixel', 'wpsc' ) ); ?>' />
693
  </form>
694
  <?php
695
  }
@@ -726,7 +726,7 @@ function wpsc_also_bought( $product_id ) {
726
  // If above filter returns output then the following is ignore and can be deprecated in future.
727
  $also_bought = $wpdb->get_results( $wpdb->prepare( "SELECT `" . $wpdb->posts . "`.* FROM `" . WPSC_TABLE_ALSO_BOUGHT . "`, `" . $wpdb->posts . "` WHERE `selected_product`= %d AND `" . WPSC_TABLE_ALSO_BOUGHT . "`.`associated_product` = `" . $wpdb->posts . "`.`id` AND `" . $wpdb->posts . "`.`post_status` IN('publish','protected') ORDER BY `" . WPSC_TABLE_ALSO_BOUGHT . "`.`quantity` DESC LIMIT $also_bought_limit", $product_id ), ARRAY_A );
728
  if ( is_array( $also_bought ) && count( $also_bought ) > 0 ) {
729
- $output .= '<h2 class="prodtitles wpsc_also_bought">' . __( 'People who bought this item also bought', 'wpsc' ) . '</h2>';
730
  $output .= '<div class="wpsc_also_bought">';
731
  foreach ( $also_bought as $also_bought_data ) {
732
  $output .= '<div class="wpsc_also_bought_item" style="width: ' . $element_widths . 'px;">';
@@ -788,7 +788,7 @@ function wpsc_fancy_notifications( $return = false ) {
788
  $output = "";
789
  $output .= "<div id='fancy_notification'>\n\r";
790
  $output .= " <div id='loading_animation'>\n\r";
791
- $output .= '<img id="fancy_notificationimage" title="' . esc_attr__( 'Loading', 'wpsc' ) . '" alt="' . esc_attr__( 'Loading', 'wpsc' ) . '" src="' . wpsc_loading_animation_url() . '" />' . __( 'Updating', 'wpsc' ) . "...\n\r";
792
  $output .= " </div>\n\r";
793
  $output .= " <div id='fancy_notification_content'>\n\r";
794
  $output .= " </div>\n\r";
@@ -809,8 +809,8 @@ function fancy_notification_content( $cart_messages ) {
809
  foreach ( (array)$cart_messages as $cart_message ) {
810
  $output .= "<span>" . $cart_message . "</span><br />";
811
  }
812
- $output .= "<a href='" . get_option( 'shopping_cart_url' ) . "' class='go_to_checkout'>" . __( 'Go to Checkout', 'wpsc' ) . "</a>";
813
- $output .= "<a href='#' onclick='jQuery(\"#fancy_notification\").css(\"display\", \"none\"); return false;' class='continue_shopping'>" . __( 'Continue Shopping', 'wpsc' ) . "</a>";
814
  return $output;
815
  }
816
 
@@ -834,7 +834,7 @@ function external_link( $product_id ) {
834
  $link = 'http://' . $link;
835
  }
836
  $target = wpsc_product_external_link_target( $product_id );
837
- $output .= "<input class='wpsc_buy_button' type='button' value='" . wpsc_product_external_link_text( $product_id, __( 'Buy Now', 'wpsc' ) ) . "' onclick='return gotoexternallink(\"$link\", \"$target\")'>";
838
  return $output;
839
  }
840
 
168
  ?>
169
  <span class='wpsc_category_image item_no_image ' style='width:<?php echo $width; ?>px; height: <?php echo $height; ?>px;'>
170
  <span class='link_substitute' >
171
+ <span><?php _e('N/A', 'wp-e-commerce'); ?></span>
172
  </span>
173
  </span>
174
  <?php
454
  } elseif( isset( $query['show_name'] ) && 1 == $query['show_name']) {
455
  $category_image_html .= "<span class='wpsc_category_image item_no_image ' style='width: {$width}px; height: {$height}px;'>\n\r";
456
  $category_image_html .= " <span class='link_substitute' >\n\r";
457
+ $category_image_html .= " <span>".__('N/A','wp-e-commerce')."</span>\n\r";
458
  $category_image_html .= " </span>\n\r";
459
  $category_image_html .= "</span>\n\r";
460
  }
654
 
655
  $has_variants = wpsc_product_has_variations( $product_id ) || ! wpsc_product_has_stock( $product_id );
656
 
657
+ $src = apply_filters( 'wpsc_buy_now_button_src', _x( 'https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif', 'PayPal Buy Now Button', 'wp-e-commerce' ) );
658
  $classes = apply_filters( 'wpsc_buy_now_button_class', "wpsc-buy-now-form wpsc-buy-now-form-{$product_id}" );
659
 
660
  $classes_array = array_map( 'sanitize_html_class', explode( ' ', $classes ) );
665
  disabled( $has_variants, true, false ),
666
  esc_attr( $product_id ),
667
  esc_url( $src ),
668
+ esc_attr__( 'PayPal - The safer, easier way to pay online', 'wp-e-commerce' )
669
  );
670
 
671
  $button_html = apply_filters( 'wpsc_buy_now_button_html', $button_html, $product_id );
683
  endif; /* END wpsc_product_has_variations */
684
  ?>
685
  <?php if ( get_option( 'multi_add' ) ) : ?>
686
+ <label for="quantity"><?php esc_html_e( 'Quantity', 'wp-e-commerce' ); ?></label>
687
  <input type="text" size="4" id="quantity" class="wpsc-buy-now-quantity" name="quantity" value="" /><br />
688
  <?php else: ?>
689
  <input type="hidden" name="quantity" class="wpsc-buy-now-quantity" value="1" />
690
  <?php endif ?>
691
  <?php echo $button_html; ?>
692
+ <img alt='' border='0' width='1' height='1' src='<?php echo esc_url( _x( 'https://www.paypal.com/en_US/i/scr/pixel.gif', 'PayPal Pixel', 'wp-e-commerce' ) ); ?>' />
693
  </form>
694
  <?php
695
  }
726
  // If above filter returns output then the following is ignore and can be deprecated in future.
727
  $also_bought = $wpdb->get_results( $wpdb->prepare( "SELECT `" . $wpdb->posts . "`.* FROM `" . WPSC_TABLE_ALSO_BOUGHT . "`, `" . $wpdb->posts . "` WHERE `selected_product`= %d AND `" . WPSC_TABLE_ALSO_BOUGHT . "`.`associated_product` = `" . $wpdb->posts . "`.`id` AND `" . $wpdb->posts . "`.`post_status` IN('publish','protected') ORDER BY `" . WPSC_TABLE_ALSO_BOUGHT . "`.`quantity` DESC LIMIT $also_bought_limit", $product_id ), ARRAY_A );
728
  if ( is_array( $also_bought ) && count( $also_bought ) > 0 ) {
729
+ $output .= '<h2 class="prodtitles wpsc_also_bought">' . __( 'People who bought this item also bought', 'wp-e-commerce' ) . '</h2>';
730
  $output .= '<div class="wpsc_also_bought">';
731
  foreach ( $also_bought as $also_bought_data ) {
732
  $output .= '<div class="wpsc_also_bought_item" style="width: ' . $element_widths . 'px;">';
788
  $output = "";
789
  $output .= "<div id='fancy_notification'>\n\r";
790
  $output .= " <div id='loading_animation'>\n\r";
791
+ $output .= '<img id="fancy_notificationimage" title="' . esc_attr__( 'Loading', 'wp-e-commerce' ) . '" alt="' . esc_attr__( 'Loading', 'wp-e-commerce' ) . '" src="' . wpsc_loading_animation_url() . '" />' . __( 'Updating', 'wp-e-commerce' ) . "...\n\r";
792
  $output .= " </div>\n\r";
793
  $output .= " <div id='fancy_notification_content'>\n\r";
794
  $output .= " </div>\n\r";
809
  foreach ( (array)$cart_messages as $cart_message ) {
810
  $output .= "<span>" . $cart_message . "</span><br />";
811
  }
812
+ $output .= "<a href='" . get_option( 'shopping_cart_url' ) . "' class='go_to_checkout'>" . __( 'Go to Checkout', 'wp-e-commerce' ) . "</a>";
813
+ $output .= "<a href='#' onclick='jQuery(\"#fancy_notification\").css(\"display\", \"none\"); return false;' class='continue_shopping'>" . __( 'Continue Shopping', 'wp-e-commerce' ) . "</a>";
814
  return $output;
815
  }
816
 
834
  $link = 'http://' . $link;
835
  }
836
  $target = wpsc_product_external_link_target( $product_id );
837
+ $output .= "<input class='wpsc_buy_button' type='button' value='" . wpsc_product_external_link_text( $product_id, __( 'Buy Now', 'wp-e-commerce' ) ) . "' onclick='return gotoexternallink(\"$link\", \"$target\")'>";
838
  return $output;
839
  }
840
 
wpsc-components/theme-engine-v1/helpers/query.php CHANGED
@@ -295,8 +295,9 @@ function wpsc_get_page_slug( $shortcode ) {
295
  * @return array Array of query variables
296
  */
297
  function wpsc_product_sort_order_query_vars( $orderby = null ) {
298
- if ( is_null($orderby) )
299
  $orderby = get_option( 'wpsc_sort_by' );
 
300
 
301
  $query_vars = array();
302
 
@@ -503,8 +504,7 @@ function wpsc_generate_product_query( $query ) {
503
  $query->query_vars['posts_per_page'] = -1;
504
  $query->query_vars['nopaging'] = 1;
505
  }
506
- if ( $query->is_tax == true )
507
- new wpsc_products_by_category( $query );
508
  return $query;
509
  }
510
 
295
  * @return array Array of query variables
296
  */
297
  function wpsc_product_sort_order_query_vars( $orderby = null ) {
298
+ if ( is_null( $orderby ) ) {
299
  $orderby = get_option( 'wpsc_sort_by' );
300
+ }
301
 
302
  $query_vars = array();
303
 
504
  $query->query_vars['posts_per_page'] = -1;
505
  $query->query_vars['nopaging'] = 1;
506
  }
507
+
 
508
  return $query;
509
  }
510
 
wpsc-components/theme-engine-v1/helpers/template-tags.php CHANGED
@@ -33,7 +33,7 @@ function wpsc_is_single_product() {
33
  * @return string - the class of the selected category
34
  */
35
  function wpsc_category_class() {
36
- global $wpdb, $wp_query;
37
 
38
  $category_nice_name = '';
39
  if ( 'wpsc_product_category' == $wp_query->query_vars['taxonomy'] ) {
@@ -120,7 +120,7 @@ function wpsc_the_product_id() {
120
  function wpsc_edit_the_product_link( $link = null, $before = '', $after = '', $id = 0 ) {
121
  global $wpsc_query, $current_user, $table_prefix, $wp_query;
122
  if ( $link == null )
123
- $link = __( 'Edit', 'wpsc' );
124
 
125
  $product_id = $wp_query->post->ID;
126
  if ( $id > 0 )
@@ -149,7 +149,7 @@ function wpsc_the_product_title( $post = 0 ) {
149
  * @return string - the product description
150
  */
151
  function wpsc_the_product_description() {
152
- $content = get_the_content( __( 'Read the rest of this entry &raquo;', 'wpsc' ) );
153
  return do_shortcode( wpautop( $content,1 ) );
154
  }
155
 
@@ -203,7 +203,7 @@ function wpsc_product_external_link_text( $id = null, $default = null ) {
203
  else
204
  $id = get_the_ID();
205
 
206
- $external_link_text = __( 'Buy Now', 'wpsc' );
207
  if ( $default != null ) {
208
  $external_link_text = $default;
209
  }
@@ -384,19 +384,19 @@ function wpsc_pagination( $totalpages = '', $per_page = '', $current_page = '',
384
  if($totalpages == 1)
385
  return;
386
  // Pagination Prefix
387
- $output = __('Pages: ','wpsc');
388
  if(get_option('permalink_structure')){
389
  // Should we show the FIRST PAGE link?
390
  if($current_page > 1)
391
- $output .= "<a href=\"". esc_url( $page_link . $additional_links ) . "\" title=\"" . __('First Page', 'wpsc') . "\">" . __('&laquo; First', 'wpsc') . "</a>";
392
 
393
  // Should we show the PREVIOUS PAGE link?
394
  if($current_page > 1) {
395
  $previous_page = $current_page - 1;
396
  if( $previous_page == 1 )
397
- $output .= " <a href=\"". esc_url( $page_link . $additional_links ) . "\" title=\"" . __('Previous Page', 'wpsc') . "\">" . __('&lt; Previous', 'wpsc') . "</a>";
398
  else
399
- $output .= " <a href=\"". esc_url( $page_link .$separator. $previous_page . $additional_links ) . "\" title=\"" . __('Previous Page', 'wpsc') . "\">" . __('&lt; Previous', 'wpsc') . "</a>";
400
  }
401
  $i =$current_page - $num_paged_links;
402
  $count = 1;
@@ -404,9 +404,9 @@ function wpsc_pagination( $totalpages = '', $per_page = '', $current_page = '',
404
  while($i < $current_page){
405
  if($count <= $num_paged_links){
406
  if($count == 1)
407
- $output .= " <a href=\"". esc_url( $page_link . $additional_links ) . "\" title=\"" . sprintf( __('Page %s', 'wpsc'), $i ) . " \">".$i."</a>";
408
  else
409
- $output .= " <a href=\"". esc_url( $page_link .$separator. $i . '/' . $additional_links ) . "\" title=\"" . sprintf( __('Page %s', 'wpsc'), $i ) . " \">".$i."</a>";
410
  }
411
  $i++;
412
  $count++;
@@ -423,7 +423,7 @@ function wpsc_pagination( $totalpages = '', $per_page = '', $current_page = '',
423
  while(($i) > $current_page){
424
 
425
  if ( $count < ( $num_paged_links + 1 ) && ( $count + $current_page ) <= $totalpages ) {
426
- $output .= " <a href=\"". esc_url( $page_link . $separator . ( $count + $current_page ) . '/' . $additional_links ) . "\" title=\"" . sprintf( __('Page %s', 'wpsc'), ($count+$current_page) ) . "\">".($count+$current_page)."</a>";
427
  $i++;
428
  }else{
429
  break;
@@ -434,24 +434,24 @@ function wpsc_pagination( $totalpages = '', $per_page = '', $current_page = '',
434
 
435
  if($current_page < $totalpages) {
436
  $next_page = $current_page + 1;
437
- $output .= "<a href=\"". esc_url( $page_link .$separator. $next_page . '/' . $additional_links ) . "\" title=\"" . __('Next Page', 'wpsc') . "\">" . __('Next &gt;', 'wpsc') . "</a>";
438
  }
439
  // Should we show the LAST PAGE link?
440
  if($current_page < $totalpages) {
441
- $output .= "<a href=\"". esc_url( $page_link .$separator. $totalpages . '/' . $additional_links ) . "\" title=\"" . __('Last Page', 'wpsc') . "\">" . __('Last &raquo;', 'wpsc') . "</a>";
442
  }
443
  } else {
444
  // Should we show the FIRST PAGE link?
445
  if($current_page > 1)
446
- $output .= "<a href=\"". esc_url( remove_query_arg('paged' ) ) . "\" title=\"" . __('First Page', 'wpsc') . "\">" . __('&laquo; First', 'wpsc') . "</a>";
447
 
448
  // Should we show the PREVIOUS PAGE link?
449
  if($current_page > 1) {
450
  $previous_page = $current_page - 1;
451
  if( $previous_page == 1 )
452
- $output .= " <a href=\"". esc_url( remove_query_arg( 'paged' ) ) . $additional_links . "\" title=\"" . __('Previous Page', 'wpsc') . "\">" . __('&lt; Previous', 'wpsc') . "</a>";
453
  else
454
- $output .= " <a href=\"". esc_url( add_query_arg( 'paged', ($current_page - 1) ) ) . $additional_links . "\" title=\"" . __('Previous Page', 'wpsc') . "\">" . __('&lt; Previous', 'wpsc') . "</a>";
455
  }
456
  $i =$current_page - $num_paged_links;
457
  $count = 1;
@@ -459,9 +459,9 @@ function wpsc_pagination( $totalpages = '', $per_page = '', $current_page = '',
459
  while($i < $current_page){
460
  if($count <= $num_paged_links){
461
  if($i == 1)
462
- $output .= " <a href=\"". esc_url( remove_query_arg('paged' ) ) . "\" title=\"" . sprintf( __('Page %s', 'wpsc'), $i ) . " \">".$i."</a>";
463
  else
464
- $output .= " <a href=\"". esc_url( add_query_arg('paged', $i ) ) . "\" title=\"" . sprintf( __('Page %s', 'wpsc'), $i ) . " \">".$i."</a>";
465
  }
466
  $i++;
467
  $count++;
@@ -478,7 +478,7 @@ function wpsc_pagination( $totalpages = '', $per_page = '', $current_page = '',
478
  while(($i) > $current_page){
479
 
480
  if($count < $num_paged_links && ($count+$current_page) <= $totalpages){
481
- $output .= " <a href=\"". esc_url( add_query_arg( 'paged', ($count+$current_page) ) ) . "\" title=\"" . sprintf( __('Page %s', 'wpsc'), ($count+$current_page) ) . "\">".($count+$current_page)."</a>";
482
  $i++;
483
  }else{
484
  break;
@@ -489,11 +489,11 @@ function wpsc_pagination( $totalpages = '', $per_page = '', $current_page = '',
489
 
490
  if($current_page < $totalpages) {
491
  $next_page = $current_page + 1;
492
- $output .= "<a href=\"". esc_url( add_query_arg( 'paged', $next_page ) ) . "\" title=\"" . __('Next Page', 'wpsc') . "\">" . __('Next &gt;', 'wpsc') . "</a>";
493
  }
494
  // Should we show the LAST PAGE link?
495
  if($current_page < $totalpages) {
496
- $output .= "<a href=\"". esc_url( add_query_arg( 'paged', $totalpages ) ) . "\" title=\"" . __('Last Page', 'wpsc') . "\">" . __('Last &raquo;', 'wpsc') . "</a>";
497
  }
498
  }
499
  // Return the output.
@@ -596,11 +596,8 @@ add_filter( 'wpsc_product_image', 'wpsc_product_no_image_fallback' );
596
  * wpsc show pnp function
597
  * @return boolean - true if display_pnp is 1 false otherwise
598
  */
599
- function wpsc_show_pnp(){
600
- global $post;
601
- if(1 == get_option('display_pnp'))
602
- return true;
603
- return false;
604
  }
605
 
606
  /**
@@ -608,13 +605,13 @@ function wpsc_show_pnp(){
608
  * @return string - the product price
609
  */
610
  function wpsc_the_product_price( $no_decimals = false, $only_normal_price = false, $product_id = 0 ) {
611
- global $wpsc_query, $wpsc_variations, $wpdb;
612
 
613
  if ( ! $product_id )
614
  $product_id = get_the_ID();
615
 
616
  if ( wpsc_product_has_variations( $product_id ) ) {
617
- $from_text = __( ' from %s', 'wpsc' );
618
  $from_text = apply_filters( 'wpsc_product_variation_text', $from_text );
619
  $output = wpsc_product_variation_price_from( $product_id, array(
620
  'from_text' => $from_text,
@@ -682,15 +679,22 @@ function wpsc_display_categories() {
682
 
683
  /**
684
  * wpsc product creation time function
685
- * @return string - the product price
686
  */
687
- function wpsc_product_creation_time( $format = null ) {
688
  global $wpsc_query;
689
 
690
- if ( $format == null )
691
  $format = "Y-m-d H:i:s";
 
692
 
693
- return mysql2date( $format, $wpsc_query->product['date_added'] );
 
 
 
 
 
 
694
  }
695
 
696
  /**
@@ -698,7 +702,6 @@ function wpsc_product_creation_time( $format = null ) {
698
  * @return string - the product price
699
  */
700
  function wpsc_check_variation_stock_availability( $product_id, $variations ) {
701
- global $wpdb;
702
  $selected_post = get_posts( array(
703
  'post_parent' => $product_id,
704
  'post_type' => "wpsc-product",
@@ -741,7 +744,6 @@ function wpsc_check_variation_stock_availability( $product_id, $variations ) {
741
  * @return boolean - true if the product has stock or does not use stock, false if it does not
742
  */
743
  function wpsc_product_has_stock( $id = null ) {
744
- global $wpdb;
745
  // maybe do wpsc_clear_stock_claims first?
746
  if ( is_numeric( $id ) && ( $id > 0 ) )
747
  $id = absint( $id );
@@ -877,7 +879,6 @@ function wpsc_product_on_special( $id = 0 ) {
877
  * @return boolean - true if the product has a file
878
  */
879
  function wpsc_product_is_customisable() {
880
- global $wpsc_query, $wpdb;
881
  $id = get_the_ID();
882
  $product_meta = get_post_meta( $id, '_wpsc_product_metadata', true );
883
  if ( (isset($product_meta['engraved']) && $product_meta['engraved'] == true) || (isset($product_meta['can_have_uploaded_image']) && $product_meta['can_have_uploaded_image'] == true) )
@@ -891,7 +892,6 @@ function wpsc_product_is_customisable() {
891
  * @return boolean - true if the product has a file
892
  */
893
  function wpsc_product_has_personal_text() {
894
- global $wpsc_query, $wpdb;
895
  $id = get_the_ID();
896
  $product_meta = get_post_meta( $id, '_wpsc_product_metadata', true );
897
  if ( isset($product_meta['engraved']) && $product_meta['engraved'] == true )
@@ -905,7 +905,6 @@ function wpsc_product_has_personal_text() {
905
  * @return boolean - true if the product has a file
906
  */
907
  function wpsc_product_has_supplied_file() {
908
- global $wpsc_query, $wpdb;
909
  $id = get_the_ID();
910
  $product_meta = get_post_meta( $id, '_wpsc_product_metadata', true );
911
  if ( isset($product_meta['can_have_uploaded_image']) && $product_meta['can_have_uploaded_image'] == true )
@@ -1247,7 +1246,6 @@ function wpsc_the_variation() {
1247
 
1248
 
1249
  function wpsc_product_has_multicurrency() {
1250
- global $wpdb, $wpsc_query;
1251
 
1252
  $currency = get_product_meta(get_the_ID(),'currency',true);
1253
  if ( ! empty( $currency ) )
@@ -1257,7 +1255,6 @@ function wpsc_product_has_multicurrency() {
1257
  }
1258
 
1259
  function wpsc_display_product_multicurrency() {
1260
- global $wpdb, $wpsc_query;
1261
 
1262
  $results = get_product_meta(get_the_ID(),'currency',true);
1263
  if ( count( $results ) > 0 ) {
@@ -1322,7 +1319,7 @@ function wpsc_the_variation_id() {
1322
  * @return string - HTML attribute to disable select options and radio buttons
1323
  */
1324
  function wpsc_the_variation_out_of_stock() {
1325
- global $wpsc_query, $wpdb, $wpsc_variations;
1326
  $out_of_stock = false;
1327
 
1328
  // If there is more than one variation group we cannot determine a stock status for individual variations
@@ -1375,14 +1372,14 @@ function wpsc_product_rater() {
1375
  $output .= "<div class='product_footer'>";
1376
 
1377
  $output .= "<div class='product_average_vote'>";
1378
- $output .= "<strong>" . __( 'Avg. Customer Rating', 'wpsc' ) . ":</strong>";
1379
  $output .= wpsc_product_existing_rating( $product_id );
1380
  $output .= "</div>";
1381
 
1382
  $output .= "<div class='product_user_vote'>";
1383
 
1384
- $output .= "<strong><span id='rating_" . $product_id . "_text'>" . __( 'Your Rating', 'wpsc' ) . ":</span>";
1385
- $output .= "<span class='rating_saved' id='saved_" . $product_id . "_text'> " . __( 'Saved', 'wpsc' ) . "</span>";
1386
  $output .= "</strong>";
1387
 
1388
  $output .= wpsc_product_new_rating( $product_id );
@@ -1437,7 +1434,7 @@ function wpsc_product_new_rating( $product_id ) {
1437
  $output .= " <option " . (($previous_vote == '4') ? "selected='selected'" : '') . " value='4'>4</option>\n";
1438
  $output .= " <option " . (($previous_vote == '5') ? "selected='selected'" : '') . " value='5'>5</option>\n";
1439
  $output .= " </select>\n";
1440
- $output .= " <input type='submit' value='" . __( 'Save', 'wpsc' ) . "'>";
1441
  $output .= " </form>";
1442
  return $output;
1443
  }
@@ -1482,7 +1479,7 @@ function wpsc_product_count() {
1482
  * @return string - the variation price
1483
  */
1484
  function wpsc_the_variation_price( $return_as_numeric = false ) {
1485
- global $wpdb, $wpsc_variations;
1486
  if ( $wpsc_variations->variation_count > 0 ) {
1487
 
1488
  $product_id = get_the_ID();
@@ -1520,7 +1517,7 @@ function wpsc_the_variation_price( $return_as_numeric = false ) {
1520
  *
33
  * @return string - the class of the selected category
34
  */
35
  function wpsc_category_class() {
36
+ global $wp_query;
37
 
38
  $category_nice_name = '';
39
  if ( 'wpsc_product_category' == $wp_query->query_vars['taxonomy'] ) {
120
  function wpsc_edit_the_product_link( $link = null, $before = '', $after = '', $id = 0 ) {
121
  global $wpsc_query, $current_user, $table_prefix, $wp_query;
122
  if ( $link == null )
123
+ $link = __( 'Edit', 'wp-e-commerce' );
124
 
125
  $product_id = $wp_query->post->ID;
126
  if ( $id > 0 )
149
  * @return string - the product description
150
  */
151
  function wpsc_the_product_description() {
152
+ $content = get_the_content( __( 'Read the rest of this entry &raquo;', 'wp-e-commerce' ) );
153
  return do_shortcode( wpautop( $content,1 ) );
154
  }
155
 
203
  else
204
  $id = get_the_ID();
205
 
206
+ $external_link_text = __( 'Buy Now', 'wp-e-commerce' );
207
  if ( $default != null ) {
208
  $external_link_text = $default;
209
  }
384
  if($totalpages == 1)
385
  return;
386
  // Pagination Prefix
387
+ $output = __('Pages: ','wp-e-commerce');
388
  if(get_option('permalink_structure')){
389
  // Should we show the FIRST PAGE link?
390
  if($current_page > 1)
391
+ $output .= "<a href=\"". esc_url( $page_link . $additional_links ) . "\" title=\"" . __('First Page', 'wp-e-commerce') . "\">" . __('&laquo; First', 'wp-e-commerce') . "</a>";
392
 
393
  // Should we show the PREVIOUS PAGE link?
394
  if($current_page > 1) {
395
  $previous_page = $current_page - 1;
396
  if( $previous_page == 1 )
397
+ $output .= " <a href=\"". esc_url( $page_link . $additional_links ) . "\" title=\"" . __('Previous Page', 'wp-e-commerce') . "\">" . __('&lt; Previous', 'wp-e-commerce') . "</a>";
398
  else
399
+ $output .= " <a href=\"". esc_url( $page_link .$separator. $previous_page . $additional_links ) . "\" title=\"" . __('Previous Page', 'wp-e-commerce') . "\">" . __('&lt; Previous', 'wp-e-commerce') . "</a>";
400
  }
401
  $i =$current_page - $num_paged_links;
402
  $count = 1;
404
  while($i < $current_page){
405
  if($count <= $num_paged_links){
406
  if($count == 1)
407
+ $output .= " <a href=\"". esc_url( $page_link . $additional_links ) . "\" title=\"" . sprintf( __('Page %s', 'wp-e-commerce'), $i ) . " \">".$i."</a>";
408
  else
409
+ $output .= " <a href=\"". esc_url( $page_link .$separator. $i . '/' . $additional_links ) . "\" title=\"" . sprintf( __('Page %s', 'wp-e-commerce'), $i ) . " \">".$i."</a>";
410
  }
411
  $i++;
412
  $count++;
423
  while(($i) > $current_page){
424
 
425
  if ( $count < ( $num_paged_links + 1 ) && ( $count + $current_page ) <= $totalpages ) {
426
+ $output .= " <a href=\"". esc_url( $page_link . $separator . ( $count + $current_page ) . '/' . $additional_links ) . "\" title=\"" . sprintf( __('Page %s', 'wp-e-commerce'), ($count+$current_page) ) . "\">".($count+$current_page)."</a>";
427
  $i++;
428
  }else{
429
  break;
434
 
435
  if($current_page < $totalpages) {
436
  $next_page = $current_page + 1;
437
+ $output .= "<a href=\"". esc_url( $page_link .$separator. $next_page . '/' . $additional_links ) . "\" title=\"" . __('Next Page', 'wp-e-commerce') . "\">" . __('Next &gt;', 'wp-e-commerce') . "</a>";
438
  }
439
  // Should we show the LAST PAGE link?
440
  if($current_page < $totalpages) {
441
+ $output .= "<a href=\"". esc_url( $page_link .$separator. $totalpages . '/' . $additional_links ) . "\" title=\"" . __('Last Page', 'wp-e-commerce') . "\">" . __('Last &raquo;', 'wp-e-commerce') . "</a>";
442
  }
443
  } else {
444
  // Should we show the FIRST PAGE link?
445
  if($current_page > 1)
446
+ $output .= "<a href=\"". esc_url( remove_query_arg('paged' ) ) . "\" title=\"" . __('First Page', 'wp-e-commerce') . "\">" . __('&laquo; First', 'wp-e-commerce') . "</a>";
447
 
448
  // Should we show the PREVIOUS PAGE link?
449
  if($current_page > 1) {
450
  $previous_page = $current_page - 1;
451
  if( $previous_page == 1 )
452
+ $output .= " <a href=\"". esc_url( remove_query_arg( 'paged' ) ) . $additional_links . "\" title=\"" . __('Previous Page', 'wp-e-commerce') . "\">" . __('&lt; Previous', 'wp-e-commerce') . "</a>";
453
  else
454
+ $output .= " <a href=\"". esc_url( add_query_arg( 'paged', ($current_page - 1) ) ) . $additional_links . "\" title=\"" . __('Previous Page', 'wp-e-commerce') . "\">" . __('&lt; Previous', 'wp-e-commerce') . "</a>";
455
  }
456
  $i =$current_page - $num_paged_links;
457
  $count = 1;
459
  while($i < $current_page){
460
  if($count <= $num_paged_links){
461
  if($i == 1)
462
+ $output .= " <a href=\"". esc_url( remove_query_arg('paged' ) ) . "\" title=\"" . sprintf( __('Page %s', 'wp-e-commerce'), $i ) . " \">".$i."</a>";
463
  else
464
+ $output .= " <a href=\"". esc_url( add_query_arg('paged', $i ) ) . "\" title=\"" . sprintf( __('Page %s', 'wp-e-commerce'), $i ) . " \">".$i."</a>";
465
  }
466
  $i++;
467
  $count++;
478
  while(($i) > $current_page){
479
 
480
  if($count < $num_paged_links && ($count+$current_page) <= $totalpages){
481
+ $output .= " <a href=\"". esc_url( add_query_arg( 'paged', ($count+$current_page) ) ) . "\" title=\"" . sprintf( __('Page %s', 'wp-e-commerce'), ($count+$current_page) ) . "\">".($count+$current_page)."</a>";
482
  $i++;
483
  }else{
484
  break;
489
 
490
  if($current_page < $totalpages) {
491
  $next_page = $current_page + 1;
492
+ $output .= "<a href=\"". esc_url( add_query_arg( 'paged', $next_page ) ) . "\" title=\"" . __('Next Page', 'wp-e-commerce') . "\">" . __('Next &gt;', 'wp-e-commerce') . "</a>";
493
  }
494
  // Should we show the LAST PAGE link?
495
  if($current_page < $totalpages) {
496
+ $output .= "<a href=\"". esc_url( add_query_arg( 'paged', $totalpages ) ) . "\" title=\"" . __('Last Page', 'wp-e-commerce') . "\">" . __('Last &raquo;', 'wp-e-commerce') . "</a>";
497
  }
498
  }
499
  // Return the output.
596
  * wpsc show pnp function
597
  * @return boolean - true if display_pnp is 1 false otherwise
598
  */
599
+ function wpsc_show_pnp() {
600
+ return 1 == get_option( 'display_pnp' );
 
 
 
601
  }
602
 
603
  /**
605
  * @return string - the product price
606
  */
607
  function wpsc_the_product_price( $no_decimals = false, $only_normal_price = false, $product_id = 0 ) {
608
+ global $wpsc_query, $wpsc_variations;
609
 
610
  if ( ! $product_id )
611
  $product_id = get_the_ID();
612
 
613
  if ( wpsc_product_has_variations( $product_id ) ) {
614
+ $from_text = __( ' from %s', 'wp-e-commerce' );
615
  $from_text = apply_filters( 'wpsc_product_variation_text', $from_text );
616
  $output = wpsc_product_variation_price_from( $product_id, array(
617
  'from_text' => $from_text,
679
 
680
  /**
681
  * wpsc product creation time function
682
+ * @return string - the product created date/time
683
  */
684
+ function wpsc_product_creation_time( $format = '' ) {
685
  global $wpsc_query;
686
 
687
+ if ( empty( $format ) ) {
688
  $format = "Y-m-d H:i:s";
689
+ }
690
 
691
+ if ( property_exists( $wpsc_query, 'post' )&& ! empty( $wpsc_query->post ) ) {
692
+ $date_string = mysql2date( $format, $wpsc_query->post->post_date_gmt );
693
+ } else {
694
+ $date_string = '';
695
+ }
696
+
697
+ return $date_string;
698
  }
699
 
700
  /**
702
  * @return string - the product price
703
  */
704
  function wpsc_check_variation_stock_availability( $product_id, $variations ) {
 
705
  $selected_post = get_posts( array(
706
  'post_parent' => $product_id,
707
  'post_type' => "wpsc-product",
744
  * @return boolean - true if the product has stock or does not use stock, false if it does not
745
  */
746
  function wpsc_product_has_stock( $id = null ) {
 
747
  // maybe do wpsc_clear_stock_claims first?
748
  if ( is_numeric( $id ) && ( $id > 0 ) )
749
  $id = absint( $id );
879
  * @return boolean - true if the product has a file
880
  */
881
  function wpsc_product_is_customisable() {
 
882
  $id = get_the_ID();
883
  $product_meta = get_post_meta( $id, '_wpsc_product_metadata', true );
884
  if ( (isset($product_meta['engraved']) && $product_meta['engraved'] == true) || (isset($product_meta['can_have_uploaded_image']) && $product_meta['can_have_uploaded_image'] == true) )
892
  * @return boolean - true if the product has a file
893
  */
894
  function wpsc_product_has_personal_text() {
 
895
  $id = get_the_ID();
896
  $product_meta = get_post_meta( $id, '_wpsc_product_metadata', true );
897
  if ( isset($product_meta['engraved']) && $product_meta['engraved'] == true )
905
  * @return boolean - true if the product has a file
906
  */
907
  function wpsc_product_has_supplied_file() {
 
908
  $id = get_the_ID();
909
  $product_meta = get_post_meta( $id, '_wpsc_product_metadata', true );
910
  if ( isset($product_meta['can_have_uploaded_image']) && $product_meta['can_have_uploaded_image'] == true )
1246
 
1247
 
1248
  function wpsc_product_has_multicurrency() {
 
1249
 
1250
  $currency = get_product_meta(get_the_ID(),'currency',true);
1251
  if ( ! empty( $currency ) )
1255
  }
1256
 
1257
  function wpsc_display_product_multicurrency() {
 
1258
 
1259
  $results = get_product_meta(get_the_ID(),'currency',true);
1260
  if ( count( $results ) > 0 ) {
1319
  * @return string - HTML attribute to disable select options and radio buttons
1320
  */
1321
  function wpsc_the_variation_out_of_stock() {
1322
+ global $wpsc_query, $wpsc_variations;
1323
  $out_of_stock = false;
1324
 
1325
  // If there is more than one variation group we cannot determine a stock status for individual variations
1372
  $output .= "<div class='product_footer'>";
1373
 
1374
  $output .= "<div class='product_average_vote'>";
1375
+ $output .= "<strong>" . __( 'Avg. Customer Rating', 'wp-e-commerce' ) . ":</strong>";
1376
  $output .= wpsc_product_existing_rating( $product_id );
1377
  $output .= "</div>";
1378
 
1379
  $output .= "<div class='product_user_vote'>";
1380
 
1381
+ $output .= "<strong><span id='rating_" . $product_id . "_text'>" . __( 'Your Rating', 'wp-e-commerce' ) . ":</span>";
1382
+ $output .= "<span class='rating_saved' id='saved_" . $product_id . "_text'> " . __( 'Saved', 'wp-e-commerce' ) . "</span>";
1383
  $output .= "</strong>";
1384
 
1385
  $output .= wpsc_product_new_rating( $product_id );
1434
  $output .= " <option " . (($previous_vote == '4') ? "selected='selected'" : '') . " value='4'>4</option>\n";
1435
  $output .= " <option " . (($previous_vote == '5') ? "selected='selected'" : '') . " value='5'>5</option>\n";
1436
  $output .= " </select>\n";
1437
+ $output .= " <input type='submit' value='" . __( 'Save', 'wp-e-commerce' ) . "'>";
1438
  $output .= " </form>";
1439
  return $output;
1440
  }
1479
  * @return string - the variation price
1480
  */
1481
  function wpsc_the_variation_price( $return_as_numeric = false ) {
1482
+ global $wpsc_variations;
1483
  if ( $wpsc_variations->variation_count > 0 ) {
1484
 
1485
  $product_id = get_the_ID();
1517
  *