WP eCommerce - Version 3.8.9.6

Version Description

  • Fix: Fix potential reflexive XSS issue with add_query_arg() and remove_query_arg() usage. Update is highly recommended.
Download this release

Release Info

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

Code changes from version 3.9.2 to 3.8.9.6

Files changed (103) hide show
  1. images/cc.gif +0 -0
  2. images/google_checkout.gif +0 -0
  3. images/paypal.gif +0 -0
  4. readme.txt +287 -359
  5. screenshot-1.png +0 -0
  6. screenshot-2.png +0 -0
  7. screenshot-3.png +0 -0
  8. screenshot-4.png +0 -0
  9. wp-shopping-cart.php +38 -165
  10. wpsc-admin/admin-form-functions.php +198 -10
  11. wpsc-admin/admin.php +239 -696
  12. wpsc-admin/ajax-and-init.php +13 -47
  13. wpsc-admin/ajax.php +45 -289
  14. wpsc-admin/css/admin.css +1022 -1345
  15. wpsc-admin/css/arrows.png +0 -0
  16. wpsc-admin/css/jquery.ui.datepicker-classic.css +0 -579
  17. wpsc-admin/css/jquery.ui.datepicker-fresh.css +0 -579
  18. wpsc-admin/css/loading-small.gif +0 -0
  19. wpsc-admin/css/media.css +0 -26
  20. wpsc-admin/css/plus-minus.png +0 -0
  21. wpsc-admin/css/settingspage.css +68 -89
  22. wpsc-admin/css/ui-images/ui-icons_21759b_256x240.png +0 -0
  23. wpsc-admin/css/ui-images/ui-icons_333333_256x240.png +0 -0
  24. wpsc-admin/css/ui-images/ui-icons_999999_256x240.png +0 -0
  25. wpsc-admin/css/ui-images/ui-icons_cc0000_256x240.png +0 -0
  26. wpsc-admin/css/xit.gif +0 -0
  27. wpsc-admin/db-upgrades/routines/1.php +25 -20
  28. wpsc-admin/db-upgrades/routines/10.php +0 -134
  29. wpsc-admin/db-upgrades/routines/11.php +0 -83
  30. wpsc-admin/db-upgrades/routines/12.php +0 -55
  31. wpsc-admin/db-upgrades/routines/13.php +0 -54
  32. wpsc-admin/db-upgrades/routines/14.php +0 -28
  33. wpsc-admin/db-upgrades/routines/2.php +98 -79
  34. wpsc-admin/db-upgrades/routines/3.php +14 -10
  35. wpsc-admin/db-upgrades/routines/4.php +0 -43
  36. wpsc-admin/db-upgrades/routines/5.php +0 -49
  37. wpsc-admin/db-upgrades/routines/6.php +0 -12
  38. wpsc-admin/db-upgrades/routines/7.php +0 -36
  39. wpsc-admin/db-upgrades/routines/8.php +0 -12
  40. wpsc-admin/db-upgrades/routines/9.php +0 -13
  41. wpsc-admin/db-upgrades/upgrade.php +11 -18
  42. wpsc-admin/db-upgrades/views/main.php +1 -1
  43. wpsc-admin/display-coupon-add.php +0 -133
  44. wpsc-admin/display-coupon-edit.php +0 -182
  45. wpsc-admin/display-coupons.php +396 -89
  46. wpsc-admin/display-debug.page.php +6 -11
  47. wpsc-admin/display-items.page.php +69 -190
  48. wpsc-admin/display-options-settings.page.php +1 -1
  49. wpsc-admin/display-sales-logs.php +372 -432
  50. wpsc-admin/display-update.page.php +10 -6
  51. wpsc-admin/display-upgrades.page.php +134 -40
  52. wpsc-admin/includes/coupon-list-table-class.php +0 -478
  53. wpsc-admin/includes/display-items-functions.php +647 -921
  54. wpsc-admin/includes/product-functions.php +107 -207
  55. wpsc-admin/includes/product-variation-list-table.class.php +19 -48
  56. wpsc-admin/includes/product-variations-manage.page.php +0 -0
  57. wpsc-admin/includes/product-variations-page.class.php +29 -77
  58. wpsc-admin/includes/product-variations-setup.page.php +1 -1
  59. wpsc-admin/includes/product-variations.page.php +5 -15
  60. wpsc-admin/includes/products.php +0 -0
  61. wpsc-admin/includes/purchase-log-action-links.php +0 -482
  62. wpsc-admin/includes/purchase-log-list-table-class.php +42 -102
  63. wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php +0 -0
  64. wpsc-admin/includes/purchase-logs-page/item-details.php +69 -77
  65. wpsc-admin/includes/purchase-logs-page/list-table.php +10 -2
  66. wpsc-admin/includes/purchase-logs-page/packing-slip.php +0 -2
  67. wpsc-admin/includes/purchase-logs-page/upgrade.php +2 -2
  68. wpsc-admin/includes/save-data.functions.php +380 -374
  69. wpsc-admin/includes/settings-tabs/admin.php +5 -10
  70. wpsc-admin/includes/settings-tabs/checkout.php +78 -73
  71. wpsc-admin/includes/settings-tabs/gateway.php +138 -128
  72. wpsc-admin/includes/settings-tabs/general.php +121 -128
  73. wpsc-admin/includes/settings-tabs/import.php +84 -227
  74. wpsc-admin/includes/settings-tabs/marketing.php +76 -156
  75. wpsc-components/theme-engine-v1/classes/settings-tab-presentation.php → wpsc-admin/includes/settings-tabs/presentation.php +18 -28
  76. wpsc-admin/includes/settings-tabs/shipping.php +235 -249
  77. wpsc-admin/includes/settings-tabs/taxes.php +161 -134
  78. wpsc-admin/includes/tax_and_shipping.php +1 -7
  79. wpsc-admin/includes/updating-functions.php +16 -18
  80. wpsc-admin/includes/walker-variation-checklist.php +6 -14
  81. wpsc-admin/init.php +220 -315
  82. wpsc-admin/js/admin.js +469 -328
  83. wpsc-admin/js/ajax.js +48 -0
  84. wpsc-admin/js/dimensions.js +325 -0
  85. wpsc-admin/js/jquery-ui.js +1 -0
  86. wpsc-admin/js/media.js +0 -401
  87. wpsc-admin/js/product-variations.js +16 -42
  88. wpsc-admin/js/product_tagcloud.js +125 -0
  89. wpsc-admin/js/purchase-log-action-links.js +0 -124
  90. wpsc-admin/js/purchase-logs.js +10 -10
  91. wpsc-admin/js/set-post-thumbnail.js +0 -0
  92. wpsc-admin/js/settings-page.js +119 -202
  93. wpsc-admin/js/sortable-table.js +2 -2
  94. wpsc-admin/js/variations.js +6 -20
  95. wpsc-admin/js/wp-e-commerce-admin.js +0 -169
  96. wpsc-admin/js/wpsc-swfupload-handlers.js +362 -0
  97. wpsc-admin/media.php +0 -95
  98. wpsc-admin/settings-page.php +22 -43
  99. wpsc-admin/users.php +0 -7
  100. wpsc-components/marketplace-core-v1/library/Sputnik.php +0 -596
  101. wpsc-components/marketplace-core-v1/library/Sputnik/API.php +0 -246
  102. wpsc-components/marketplace-core-v1/library/Sputnik/API/Auth.php +0 -137
  103. wpsc-components/marketplace-core-v1/library/Sputnik/Admin.php +0 -98
images/cc.gif CHANGED
File without changes
images/google_checkout.gif ADDED
Binary file
images/paypal.gif CHANGED
File without changes
readme.txt CHANGED
@@ -1,28 +1,148 @@
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: 3.9
6
- Tested up to: 4.1
7
- Stable tag: 3.9.2
8
 
9
- WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
11
  == Description ==
12
 
13
- Since 2006, we've been helping entrepreneurs just like you realize their goal of selling online. Whether you're hoping to sell digital downloads, physical inventory, or subscriptions and memberships - with WP eCommerce, you're only minutes away from your next sale.
14
-
15
- * Make the plugin your own with CSS and HTML customizations
16
- * Learn quickly with our [video tutorials](http://docs.wpecommerce.org/category/resources/videos/)
17
- * Integration with [dozens of different payment gateways](http://wpecommerce.org/store/premium-plugins/)
18
- * Integrate with many popular WordPress plugins
19
- * Use built-in marketing tools to sell more
20
- * Shipping is easy with built in shipping tools and integration with popular couriers
21
- * Secure check-out with SSL
22
- * Manage your orders and catalogues with powerful built-in tools
23
- * Extend your eCommerce site with [additional modules](http://wpecommerce.org/store/premium-plugins/)
24
- * Integrate with WordPress multisite
25
- * With hundreds of available hooks, developers can make WP eCommerce do anything you can imagine
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  == Installation ==
28
 
@@ -36,312 +156,10 @@ After upgrading from earlier versions look for link "Update Store". This will up
36
 
37
  == Changelog ==
38
 
39
- = 3.9.2 =
40
-
41
- * Fix: Reverted pre_get_posts hook. See [#1444](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1444). This was causing issues with template redirection and selection on search templates.
42
- * Fix: Shipping conflict with target market restrictions on specific categories. See [#1711](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1711).
43
- * Fix: Taxes were broken following some refactoring of the admin saving callbacks.
44
- * Fix: Quick edit was overwriting variation SKUs and sale prices.
45
- * Fix: RSS Feed error.
46
- * Fix: Ensure flat rates settings are pre-populated by default, to avoid notices on new installs.
47
- * Fix: Forcing SSL when no SSL certificate is installed caused some core post type admin pages to fail to load.
48
- * 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)
49
-
50
- = 3.9.1 =
51
-
52
- * Fix: Disable 3.0 payment gateway API gateways. Will be re-enabled after more vigorous testing.
53
- * Fix: Check that $wpsc_cart->cart_items is an array, not an object.
54
- * Fix: Improve shipping method property checks in wpsc_cart class. See [#1683](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1683).
55
- * Fix: Add asterix class to required fields for PayPal Pro 2.0.
56
- * Fix: Ensure taxable checkbox can be unchecked. 3.9 regression. See [#1685](https://github.com/wp-e-commerce/WP-e-Commerce/issues/1685).
57
- * Fix: Only show completed purchases in the user account area.
58
- * Fix: Use is_email(), rather than a faulty regex, for checkout email field validation.
59
- * Fix: More than a [handful of faulty variables](https://github.com/wp-e-commerce/WP-e-Commerce/commit/58f2d3ad9698ef496a27a701e5a926e412d55c05) were referenced in wpsc_coupons.
60
- * Fix: Function `wpsc_string_to_boolean` was essentially non functional.
61
- * Fix: Send country and state through to PayPal only if they actually exist.
62
- * Fix: Broken theme-engine activation routine. Would always fail, running 1.0 engine.
63
-
64
- = 3.9 =
65
-
66
- * Fix: Eliminate most usage of number-based inputs in product UI.
67
- * Fix: Fall back to product ID if SKU is not set for Google Analytics reporting.
68
- * Fix: Restored inadvertently removed filter, `wpsc_add_advanced_options`.
69
- * Fix: Ensure price entered for "Free Shipping" threshold is locale-aware.
70
- * Fix: Generally improved metadata saving routines for quick/bulk edit areas.
71
- * Fix: Ensure "Combination of product variants is not available" message is hidden from Grid View.
72
- * Fix: Don't require a shipping method to be selected if you qualify for free shipping.
73
- * Fix: When "Buy Now" button is used, it is now disabled if item is out of stock.
74
- * New: Introduced `wpsc_get_countries` and `wpsc_get_countries_array` filters.
75
- * New: Introduced `wpsc_google_analytics_pushed_product` filter.
76
- * New: Introduced `wpsc_get_downloadable_links` filter.
77
- * New: Added screen option for number of purchase logs to show on a page.
78
- * New: Introduced WPSC_Logging class. Based on WP_Logging.
79
- * New: Customers may now checkout with carts that have a value of $0.
80
- * New: Introduces `wpsc_is_free_cart` filter.
81
- * New: Added 2.0 theme engine component. Defaults off until the 4.0 release, but can be enabled via filter for testing.
82
- * New: Added marketplace component.
83
- * New: Added 3.0 payment gateway API component.
84
- * New: PayPal Digital Goods gateway, updated PayPal Express Checkout, PayPal Pro and Manual Payment gateways.
85
- * New: Product Tags now have proper body classes.
86
- * New: Meta updates, kind of a big deal: We're now using X.X.Y versioning (like WordPress) and we now have unit tests.
87
- * New: Introduce attachments method and filter for WPSC_Purchase_Log_Notification class.
88
- * New: Single Product pages now have ID-based body classes.
89
- * New: Supports Universal Analytics in Google Analytics.
90
- * New: Added `wpsc_checkout_fields` filter for filtering checkout form fields.
91
- * Change: Dates are now optional on coupons. Expiration, specifically, is no longer required. Validation is filterable via `wpsc_coupons_validate_coupon`.
92
- * Change: Refactored purchase log action links, introduced new API for adding links.
93
- * Change: Product page shortcodes, e.g. [productspage], are now stripped from the_excerpt(). Helpful for cleaner looking search results.
94
- * Change: Limit Google Product ID to 50 characters in Google Product Feed. Introduced `wpsc_google_product_feed_product_id`.
95
- * Change: When only one shipping rate is available, it will automatically be selected as the default rate.
96
-
97
- = 3.8.14.4 =
98
-
99
- * Fix: Significant security vulnerability whereby some admin actions were exploitable by unauthorized users. Props to Sucuri for the responsible disclosure.
100
- * Fix: Other less significant security hardening and minor code maintenance.
101
-
102
- = 3.8.14.3 =
103
-
104
- * Fix: Resolve PHP warning in stats logging class.
105
-
106
- = 3.8.14.2 =
107
-
108
- * Fix: Clear country cache automatically.
109
- * Fix: Fixed notices when using quick edit.
110
- * Fix: Fixed html in checkout form.
111
- * Fix: Fixed shipping results not being displayed.
112
- * Fix: Does not show errors when deprecated google checkout is used.
113
- * Fix: Makes sure countries are validated if mandatory.
114
- * Fix: Makes sure the payment gateway checks for first and last name.
115
- * Fix: Only output html for shipping error page.
116
- * Fix: Updated shipping calculator to check for new checkout information and made the calculator more efficient.
117
- * Fix: USPS shipping now works for servers that don't support curl.
118
- * Fix: Personalization forms are correctly initialized in database.
119
- * Fix: Display of products in admin product gallery will display in the order admins want them to.
120
- * New: Updated Polish and Russian language files.
121
- * New: Added filter wpsc_uncategorized_product_category to change uncategorized section.
122
- * New: New hook - wpsc_coupon_add_top and wpsc_coupon_add_bottom for the add coupon section.
123
- * New: New hook - wpsc_element_is_visible to check and see if an element is visible.
124
- * Change: Show region on shipping calculator.
125
- * Change: Billing was accidentally referred to as shipping when billing state and region was a drop down.
126
-
127
- = 3.8.14.1 =
128
-
129
- * Fix: For users with older (3.7.x and older) templates copied into their theme directory, we inadvertently broke the visibility of the shipping calculator.
130
- * Fix: Under similar circumstances, taxes would not properly calculate.
131
- * Fix: Ensured compatibility with the popular "Weight and Destination" shipping module. Note: You may need to go to your Target Markets and re-save the values there to properly flush the cache for this compatibility.
132
- * Fix: Edge case where $0.00 could be returned for a shipping rate.
133
- * Fix: Race condition on AJAX save while submitting purchase.
134
- * Fix: Restored proper functionality on digital downloads.
135
- * Fix: Ensure that UPS and USPS always return proper and expected values. Incrementally improved error handling here.
136
- * Fix: Ensure that shipping method is properly retained if checkout page is refreshed.
137
- * Change: Added "County" as the region label for the UK.
138
-
139
- = 3.8.14 =
140
- * Fix: Improved visitor profiles performance, new infrastructure does not use WordPress Users.
141
- * Fix: When page caching is being used, probability of empty or superfluous visitor profiles being created drastically diminished.
142
- * Fix: Send appropriate addresses to PayPal via PayPal Standard.
143
- * Fix: Ensure that sales tax is not added to non-tax items when using a coupon.
144
- * Fix: Ensure state text field is not visible at the same time as state dropdown.
145
- * Fix: Ensure shortcodes respect display type as overridden by categories. Note: Requires latest Gold Cart release.
146
- * Fix: Ensure that adding a new item to the cart after a coupon code properly reflects that coupon code.
147
- * Fix: Don't create cron events for unknown schedules.
148
- * Fix: Shipping options were disappearing when "same as billing address" were selected.
149
- * Fix: Protect against "Price From: " being zero if a sales price was set without a normal price.
150
- * Fix: Added programmatic and UX checks for conflict where grid/list view could show products with variations without the variation drop-downs, adding an improper product to the cart.
151
- * Fix: Improved shipping rate quote retrieval performance.
152
- * Fix: Sends proper tax amount to PayPal Standard when carts are aggregated.
153
- * Fix: Fixed pagination bug where improper number of paged links were returned.
154
- * Fix: Ensure UPS Environment test mode works.
155
- * Fix: Downloadable products were not being properly added as attachments.
156
- * Fix: "Shipping Same as Billing" could cause products to be shipped to countries which are not allowed.
157
- * Fix: Eliminate undefined index errors on sales log page when checkout fields are removed.
158
- * Fix: Address edge case where purchase notifications are not sent when there are multiple email fields in different checkout form sets.
159
- * Fix: Improved bbPress compatibility.
160
- * Fix: Ensure User Account pages are properly overridable in the template stack.
161
- * Fix: Properly escape classes for Buy Now button classes.
162
- * Fix: Fix IE8 javascript conflicts.
163
- * Fix: Shored up backwards compatibility for Session usage
164
- * Fix: Ensure cart items with variations that are out of stock (and stock limited) don't return a fatal error.
165
- * Fix: Address malformed XML output for shipping quotes from UPS and USPS.
166
- * Fix: Ensure PayPal Express does not show coupons as an empty line item when discounts are not used.
167
- * Fix: A redirection error on our wpsc_scale_image fallback was resolved.
168
- * Fix: Ensure only available countries are shown as available in PayPal Express.
169
- * Fix: Resolved issue whereby amounts over 1,000 (in a given currency) would be incorrectly sent to Google Analytics.
170
- * Fix: Shipping calculator uses information set in user account profile, if set.
171
- * Fix: When PATHINFO Permalinks ("Almost Pretty"), product pages would 404.
172
- * Fix: Ensure 3.7.x -> 3.8.x upgrade routine uses wpdb::prepare() properly.
173
- * New: AJAX API to get and set information about customers.
174
- * New: Visitor API to get and set information about current and past visits.
175
- * New: Introduced WPSC_Claimed_Stock class.
176
- * New: Introduced WPSC_Stats class.
177
- * New: Introduced WPSC_Product/WPSC_Products class.
178
- * New: Introduced WPSC_Countries / WPSC_Region class.
179
- * New: Totally revamped product editing and adding user interface.
180
- * New: Added new Purchase Meta API.
181
- * New: Some compatibility fixes for WordPress 3.9.
182
- * New: Improved extendibility of the Import Settings area.
183
- * New: Improved extendibility for our conditional coupon callbacks.
184
- * Change: Iterated upon WPSC_Country class.
185
- * Change: Improved UK Country Display.
186
- * Change: Improved upgrade routines for currencies and countries.
187
- * Change: Introduced filter for themeable packing slips.
188
- * Change: Modified calculation for total price to ensure coupons don't reduce shipping and tax.
189
- * Change: Improved Checkout workflow and UI.
190
- * Change: Fully remove Google Checkout from WP eCommerce, as it has been deprecated.
191
- * Change: Don't show transaction results to anyone but the purchaser
192
- * Change: Eliminated usage of dynamic CSS and javascript in front-end and admin.
193
- * Change: Couldn't use decimals in product's variation sale price.
194
- * Change: Tons of performance improvements to USPS and UPS.
195
- * Change: Add condition as parameter to wpsc_coupon_rule_property_options action.
196
- * Change: Improved security for our customer cookie hash.
197
- * Change: Don't default to base country of store in checkout fields.
198
- * Change: Taxes class previously regarded regions as unique, when they are not. We now check both region and country where applicable.
199
- * Change: By default, quantity boxes will be shown on new installs.
200
-
201
- = 3.8.13.3 =
202
- * Fix: Users disappear in Network Admin -> Users page (for multisite).
203
- * Fix: User counts are incorrect when there are thousands separators.
204
- * Fix: "Save Product Files" button doesn't like being clicked on.
205
-
206
-
207
- = 3.8.13.2 =
208
- * Fix: Anonymous customers should not be visible in admin UI.
209
- * Fix: Cronjob to purge anonymous customers doesn't work due to memory issues.
210
- * Fix: Anonymous cart items will be lost after signing in.
211
-
212
- = 3.8.13.1 =
213
- * Security and maintenance release
214
-
215
- = 3.8.13 =
216
-
217
- * New: Product Media UI.
218
- * New: Cart Item Meta API
219
- * New: 'wpsc_after_checkout_cart_rows' action.
220
- * New: Add 'wpsc_default_dimension_unit' and 'wpsc_default_weight_unit' filters.
221
- * New: Add 'wpsc_save_product_order' action and use it to save category product order in the term_relationships table.
222
- * New: Add logic filter for coupons. We currently have one for properties, this should sufficiently round out the extensibility for the UI.
223
- * New: Allow gateway images to be filtered.
224
- * New: Allow multiple comma-separated categories in coupon conditions.
225
- * New: Product Gallery metabox.
226
- * Change: Better Customer API.
227
- * Change: Prepend (WPEC) to widget names in wp-admin
228
- * Change: Replace default noimage.png with a better image.
229
- * Change: Updated NL language
230
- * Change: Updated german language strings
231
- * Change: Use new spinner image in WordPress 3.8
232
- * Fix: Add preg_quote() to coupon regexes that intend to parse strings. Fixes issue where unexpected results occur when strings contain slashes, or really, any regex-oriented characters.
233
- * Fix: Change wpsc_get_remaining_quantity() to call the method dynamically, rather than statically. The previous behaviour caused a strict standards warning.
234
- * Fix: Database Upgrade Routine to rename old _wpsc_* product metadata array keys so they no longer include the '_wpsc_' prefix
235
- * Fix: In Purchase log admin screen, item count is sum of quantity field rather than count of rows
236
- * Fix: Invert logic on shipping ZIP code check in core theme files.
237
- * Fix: Modify behavior in Download CSV functionality to properly convert region IDs to regions.
238
- * Fix: Modify wpsc_update_item_quantity() to listen for wpsc_quantity_update, reverting to $_POST['quantity'] only if it exists.
239
- * Fix: PHP strict warnings.
240
- * Fix: Properly quote SKUs in CSV file.
241
- * Fix: Rename generically named function.
242
- * Fix: Stock and sale price empty values should be preserved.
243
- * Fix: Variation thumbnail size in admin screen.
244
- * Fix: cart is not initialized when some shipping modules are triggered
245
- * Fix: redundant product thumbnail is displayed on category / single product list.
246
- * Fix: variation checkbox column width in WP 3.7.
247
- * Fix: Out of stock message for variations now correctly shows variation of product for the title, rather than main product.
248
- * Fix: Use proper link in checkout for variation products.
249
- * Fix: Return tax information in switchmethod() JS function.
250
- * Fix: Resolve conflict with Advanced Custom Fields on save_post hook for products.
251
- * Fix: Update Bulgarian Currency symbol.
252
- * Fix: Resolve issue where updating pages causes rewrite rule conflicts when pretty permalinks are enabled.
253
-
254
- = 3.8.12.1 =
255
- * Fix: Fatal error in wpsc_product_list_exclude_child_categories() due to other themes
256
- or plugins calling get_posts() before the main query is set up
257
-
258
- = 3.8.12 =
259
- * New: Filter to hide drafts on the front-end: "wpsc_product_display_status"
260
- * New: Shipwire staging / production option
261
- * Change: Remove deprecated and unused javascript (and by extension, CSS) from core
262
- * Change: Remove nusoap
263
- * Change: Improvements to Marketing admin panel
264
- * Change: Improvements to Products List Admin Page
265
- * Fix: WP eCommerce pagination breaks WordPress pagination
266
- * Fix: Wrong thumbnail size in Product Specials widget
267
- * Fix: Filtering by a category also shows all products in subcategories
268
- * Fix: admin.js throwing a Parse Error in Safari
269
- * Fix: Product Image Links not working when over HTTPS
270
- * Fix: If AJAX_URL returns HTTPS and Add to Cart is on HTTP, errors
271
- * Fix: Add to Cart button doesn't work
272
- * Fix: Can no longer upload customer attachments
273
- * Fix: Deprecated warning for wp_convert_bytes_to_hr() function in WordPress 3.6
274
-
275
-
276
- = 3.8.11.1 =
277
- * Fix: Some users had theme compatibilities and other configurations that caused "Add to Cart" to no longer function as expected.
278
- * Fix: Customer uploads for products broke with JS overhaul
279
- * Fix: Product image links broke.
280
-
281
- = 3.8.11 =
282
- * New: Payment Gateway UI is revamped.
283
- * New: Sales Log UI is revamped.
284
- * New: wpsc_single_purchase_log_date_time_format and wpsc_single_purchase_log_date_format (Used in new Sales Log UI).
285
- * New: Added 'wpsc_usps_domestic_rate' and 'wpsc_usps_intl_rate' filters.
286
- * New: 'wpsc_country_get_property' filter.
287
- * New: WPSC_Country::get_data() method and 'wpsc_country_get_data' filter.
288
- * New: Added generic 'wpsc_save_' . $this->current_tab_id . '_settings' action.
289
- * New: 'wpsc_shipping_module_settings_form' filter on admin shipping module form output.
290
- * New: Choose either AND or OR for coupon conditions logic.
291
- * Change: Reduced internal usage of get_option( 'siteurl' ) in favor of home_url().
292
- * Change: Updated Colorbox.js to v.1.4.15.
293
- * Change: Eliminated internal usage of 'index.php' as an AJAX callback URL. Nginx users, rejoice.
294
- * Change: Eliminated internal usage of eval() in javascript.
295
- * Change: wpsc_get_country() uses WPSC_Country now.
296
- * Change: .on() is now used in place of .livequery(), .bind(), .live() and .delegate().
297
- * Change: Minor cleanup of Marketing settings tab UI.
298
- * Change: wpsc_the_product_image() optimized to utilize the product thumbnail earlier in the function.
299
- * Change: wpsc_the_variation_price() output is now filtered through wpsc_do_convert_price filter.
300
- * Change: Submitted_Form_Data table now has a value field with a LONGTEXT data type, rather than varchar(255).
301
- * Change: Continued internal cleanup of coding standards and documentation.
302
- * Fix: Properly substitute placeholder in "Out of stock" email to administrator.
303
- * Fix: Fixed PHP notices when accessing Dashboard as subscriber.
304
- * Fix: Coupon logic improvements (edge case of using 'not_contains" logic with item_quantity).
305
- * Fix: Automated fix when possible, and nag when not, for 3.8.10 regression in User Management templates.
306
- * Fix: Error notices on category functions.
307
- * Fix: fetch_feed() error on GetShopped news.
308
- * Fix: Variation terms were not being applied to the parent product.
309
- * Fix: If you emptied variation sale price, the stock levels would not work any more.
310
- * Fix: A notice was thrown if you had UPS selected but had not saved settings for it.
311
- * Fix: USPS Shipping Module now correctly respects testing environement settings.
312
- * Fix: Correcting casting price value to float instead of integer in coupon logic conditions for sub_total.
313
- * Fix: 'wpsc_transaction_result_content' now returns the $cart_item as an array instead of an object (which was a regression).
314
-
315
- = 3.8.10 =
316
- * New: Coupon UI is revamped.
317
- * New: [Shipwire] Addition of Shipping Services, Economy, Plus & Premium.
318
- * Change: After filling out a registration form, the user is logged in.
319
- * Change: Limit quantity of individual products that can be added to the cart. Default value is filterable.
320
- * Change: Remove FPDF which is not used any more.
321
- * Change: Return cart item messages as key => value array rather than HTML.
322
- * Change: Variation table class orderby to 'menu_order title'
323
- * Change: When displaying packing slip, form data should be output in the same order as that of checkout page.
324
- * Fix: "you save" prices are not correct on variations with a value over 1000
325
- * Fix: Cart widget missing closing </div> tag.
326
- * Fix: Display the "You save" price as a currency, not just a raw unformatted number
327
- * Fix: Ensure all variations are deleted when deleting a product.
328
- * Fix: Foreign characters are not displayed correctly in packing slip.
329
- * Fix: Improved performance with variations.
330
- * Fix: JavaScript error when no variations exist in admin.
331
- * Fix: Make sure Add / Edit Product page respects decimal and thousands separators set in Settings->Store->General.
332
- * Fix: Manual / Test Payment instructions don't appear on transaction results page and email.
333
- * Fix: Only print Google Analytics scripts on transaction results footer
334
- * Fix: PHP Warnings when bulk editing variations.
335
- * Fix: Prevent old paypal express from hijacking new paypal express callback.
336
- * Fix: Product category pages don't respect pagination and sort order settings.
337
- * Fix: Re-generate products pages' IDs after plugin reactivation.
338
- * Fix: Refactor user account page
339
- * Fix: SQL IN error in wpsc_populate_also_bought_list().
340
- * Fix: Switching a purchase log status to "Closed Order" doesn't reduce stocks.
341
- * Fix: WPML compatibility
342
- * Fix: Wrong cache set for checkout form data.
343
- * Fix: split() deprecation notice in PHP 5.3+
344
- * Fix: stripslashes issues when duplicating products.
345
 
346
  = 3.8.9.5 =
347
  * New: Polish translation.
@@ -433,7 +251,7 @@ After upgrading from earlier versions look for link "Update Store". This will up
433
  * Change: Default checkout shipping option to lowest shipping cost of all choices.
434
  * Fix: "Variation Controls" anchor in metabox leads nowhere.
435
  * Fix: AJAX code audit (security)
436
- * Fix: Activating WP eCommerce on a vanilla WordPress installation with pretty permalinks enabled messes up the rewrite rules.
437
  * Fix: Add a space after tilde character to avoid confusion in admin product list.
438
  * Fix: Add new variation sets and terms from Edit Product page doesn't work properly.
439
  * Fix: Additional description is double escaped in product edit page.
@@ -630,7 +448,7 @@ After upgrading from earlier versions look for link "Update Store". This will up
630
  * Fix: Fatal error when trying to include a non-existent admin file.
631
  * Fix: Hide Google Feed information from display
632
  * Fix: Incompatibility with Genesis framework in Product Edit page.
633
- * Fix: Make the WP eCommerce 3.8.x activation/installation routine much more efficient.
634
  * Fix: Mandatory fields in user_log_functions.php are not properly validated.
635
  * Fix: Memory improvement for productfeed.
636
  * Fix: Purchase logs have incorrect time if a timezone is specified in Settings->General.
@@ -774,44 +592,154 @@ After upgrading from earlier versions look for link "Update Store". This will up
774
  * Fix: Checking (or unchecking) Stock checkbox when editing product causes variation table columns to break.
775
  * Fix: jQuery 1.6 incompatibility with attr( 'className' ).
776
 
777
- == Frequently Asked Questions ==
778
-
779
- = How do I customize WP eCommerce =
780
-
781
- First of all, you should check out the Presentation settings which are in the Settings -> Store page.
782
-
783
- For advanced users, all of our eCommerce templates and CSS can be moved into your active theme folder for customization. Less advanced users have [several fantastic WP eCommerce consultants](https://wpecommerce.org/hire-an-expert/) to get help from.
784
-
785
- = What payment gateways does WP eCommerce integrate with? =
786
 
787
- Our [Gold Cart plugin](https://wpecommerce.org/store/premium-plugins/gold-cart/) contains nearly a dozen payment gateway options, including Authorize.net, LinkPoint and DPS. Our [Mirijeh integration plugin](https://wpecommerce.org/store/premium-plugins/mijireh-99-payment-gateways-pack/) provides access to nearly one hundred different gateway options. Beyond that, we have individual integration plugins for [Braintree](https://wpecommerce.org/store/premium-plugins/braintree-payment-gateway/), [Stripe](https://wpecommerce.org/store/premium-plugins/stripe/), [Authorize.net SIM](https://wpecommerce.org/store/premium-plugins/authorize-net-sim-payment-gateway-for-wordpress/) and more.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
788
 
789
- = I want to integrate a payment gateway that you don't support. Can you help with that? =
790
-
791
- Absolutely! We have a [growing list of trusted consultants](https://wpecommerce.org/hire-an-expert/) who would be happy to partner with you to build a custom gateway. Alternatively, you're more than welcome to request that we build it as a plugin or part of our core plugin. The more requests we get, the more likely we are to build it. If you happen to be a talented developer, we have a great documentation site with helpful information on building payment gateways
792
-
793
- = Which couriers does the plugin integrate with? =
794
-
795
- We have table rate, weight rate and flat rate shipping calculators.
796
-
797
- We also currently integrate with UPS, USPS, Australia Post and Shipwire for real-time shipping rates. We have a premium plugin for [FedEx](https://wpecommerce.org/store/premium-plugins/fedex-shipping-module/) as well.
798
-
799
- = Which multi-lingual plugins is WP eCommerce compatible with? =
800
-
801
- We currently provide basic support for WPML and qTranslate. We're excited about an up-and-coming multi-lingual project called [Babble](https://github.com/cftp/babble). We intend to fully and canonically support Babble as our primary multi-lingual partner in releases to come.
 
 
 
 
 
 
802
 
803
- = Which additional modules are available for use with WP eCommerce? =
804
 
805
- * [Gold Cart](https://wpecommerce.org/store/premium-plugins/gold-cart/) - adds more options, gateways and functionality to your store
806
- * [MP3 Audio Player](https://wpecommerce.org/store/premium-plugins/mp3-player-plugin/) - Preview audio clips on your website
807
- * [NextGen Gallery Buy Now Buttons](https://wpecommerce.org/store/premium-plugins/nextgen-gallery-buy-now-buttons/) - turns your NextGen gallery into an eCommerce solution
808
- * [Members Plugin](https://wpecommerce.org/store/premium-plugins/membership-subscriptions/) - Integrates with PayPal Standard and Authorize.Net, allows you to create a Subscription-Based Product, as well as a "Members-Only" website with paid access to restricted content.
809
 
810
- = How do you provide support? =
811
 
812
- For users who have purchased a premium plugin from us (or a have purchased a [premium support token](https://wpecommerce.org/store/premium-plugins/premium-support-token/)), we offer high-touch, 1-on-1 support from our trained support staff. If you submit a support request here, you'll get a helpful response within 24 hours or less (during business hours).
813
 
814
- For the rest of our users, we do our best to monitor the WordPress.org support forums and respond in as timely a manner as we are able. We appreciate the countless helpful volunteers who also take time to respond to forum posts here.
815
 
816
  == Screenshots ==
817
 
1
+ === WP e-Commerce ===
2
+ Contributors: mufasa, mychelle, garyc40, JustinSainton
3
+ Donate link: http://getshopped.org
4
  Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
+ Requires at least: 3.1
6
+ Tested up to: 3.5
7
+ Stable tag: 3.8.9.6
8
 
9
+ WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
10
 
11
  == Description ==
12
 
13
+ We make setting up an ecommerce shop easy, and with over 2 Million downloads, we have unparalleled experience.
14
+
15
+ Features:
16
+
17
+ = WordPress Integration =
18
+ * Easy to install WordPress plugin
19
+ * Works with any standards compliant WordPress theme
20
+ * Plays well with other Plugins
21
+ * Supports regular WordPress widgets, as well as a few snazzy ones of our own
22
+ * Utilizes shortcodes and template tags (just like WordPress)
23
+ * Works out-of-the-box with WordPress MU (make sure you use sub domains with your MU setup)
24
+
25
+ = 100% Customizable =
26
+ * A designers dream – use your own HTML & CSS and have complete control over the look and feel of your store
27
+ * Easy to modify templates
28
+
29
+ = Amazing Support =
30
+ * Lots of video tutorials
31
+ * Guaranteed speedy response (through our premium forums)
32
+ * Access to instant support from our community of users
33
+
34
+ = Payment Gateways Integration =
35
+ * Manual Payment (checks/money orders) (included)
36
+ * PayPal Payments Standard (included)
37
+ * PayPal Payments Pro (included)
38
+ * PayPal Express Checkout (included)
39
+ * Google Checkout (Level 2) (included)
40
+ * Chronopay (included)
41
+ * PayPal Payflow Pro (available with Gold Cart)
42
+ * Authorize.net (available with Gold Cart)
43
+ * FirstData/LinkPoint (available with Gold Cart)
44
+ * eWay Payment (available with Gold Cart)
45
+ * iDEAL (available with Gold Cart)
46
+ * BluePay (available with Gold Cart)
47
+ * DPS (available with Gold Cart)
48
+ * Paystation (available with Gold Cart)
49
+ * SagePay (available with Gold Cart)
50
+ * If you still aren’t happy, we provide you with the necessary info to write your payment gateway
51
+
52
+ = Marketing =
53
+ * Flexible coupon/discount pricing rules
54
+ * Product specific sales
55
+ * Quantity discounts
56
+ * Free shipping options
57
+ * Multi-tier pricing for quantity discounts.
58
+ * Search Engine Friendly URLs
59
+ * New Products widget
60
+ * Cross-sells on product pages (in 3.8 this is now available as a Plugin)
61
+ * Google Site Map
62
+ * Uses the popular “Share This” button for easily promoting your products on popular social networking sites
63
+ * Integrates with Facebook Marketplace (Facebook Marketplace API has closed – we’re working on it)
64
+ * Integrates with Google Base
65
+ * Integrates with Campaign Monitor for advanced email marketing
66
+ * Integrates with Intense Debate for shared comments
67
+ * Mail Chimp integration coming soon
68
+
69
+ = Search Engine Optimization =
70
+ * 100% Search Engine Friendly
71
+ * Meta-information for products and categories
72
+ * RSS feeds for products and categories
73
+ * Integrates with Google (XML site maps and Google Merchant Centre)
74
+ * Integrates with the All in One SEO plugin for WordPress (which includes Google Analytics)
75
+
76
+ = Internationalization Support =
77
+ * Multi-lingual (the first Plugin to fully utilize and integrate with GlotPress)
78
+ * Support for multiple currencies
79
+ * Ability to target specific countries
80
+
81
+ = Shipping =
82
+ * Integrates with UPS, USPS, Australia Post and Shipwire for real-time shipping rates
83
+ * Flexible built-in shipping rate calculators
84
+ * Domestic and global shipping rates
85
+ * Flat rate shipping
86
+ * Table rate shipping
87
+ * Weight rate shipping
88
+
89
+ = Checkout =
90
+ * One-Page Checkout or Stepped Checkout, whichever you prefer
91
+ * SSL security support for orders on both front-end and back-end
92
+ * Checkout without account/Guest Checkout
93
+ * Shopping Cart with tax and shipping estimates
94
+ * Option to create account at beginning of checkout
95
+ * Fully customizable checkout page
96
+
97
+ = Managing Orders =
98
+ * Admin dashboard for sales overview
99
+ * Export orders and customers into CSV formats
100
+ * Order history with labels for order processing status
101
+ * Email notifications of orders
102
+ * Print invoices and packing slips
103
+
104
+ = Catalog Management =
105
+ * Single-page product data entry
106
+ * Ability to duplicate products
107
+ * Quickly edit your products from the store front (saving you heaps of time)
108
+ * Smart Groups allow you to organize your products with hierarchical categories, as well as by brand.
109
+ * Batch import/export of catalog
110
+ * Google Base integration
111
+ * Product variation management
112
+ * Create attributes on the fly
113
+ * Downloadable/Digital Products
114
+ * Support for donations
115
+ * Customer Personalized Products
116
+ * Media Manager with automatic image resizing
117
+ * Handles multiple product images with easy drag-and-drop sorting
118
+ * support for Special Prices
119
+ * Tax rates per location
120
+ * Basic inventory control
121
+
122
+ = Catalog Browsing =
123
+ * Live product search – mmm just like apple.com (available add on)
124
+ * Cross-sells
125
+ * Product listing in list format
126
+ * Product listing in grid format (available with Gold Cart)
127
+ * Breadcrumbs
128
+ * Product Image Zoom-in Capability
129
+ * Stock Availability
130
+ * Multiple Images Per Product (activated with Gold Cart)
131
+ * Product comments
132
+ * Filter by Product Tags
133
+ * New Products widget
134
+ * Features Products widget
135
+ * Live updating shopping cart (put it wherever you want)
136
+
137
+ = Additional Modules =
138
+ * Gold Cart & Grid Module – adds more options and functionality to your store
139
+ * Drop Shop – an incredibly snazzy way for buyers to add products to their cart, via a simple drag n drop process.
140
+ * Mp3 Audio Player – Preview audio clips on your website
141
+ * NextGen Gallery Buy Now Buttons – turns your NextGen gallery into an ecommerce solution
142
+ * Product Slider – Display your products in a new and fancy way
143
+ * Members Only Module – Create pay to view subscription sites
144
+
145
+ For more information visit [http://getshopped.org](http://getshopped.org "http://getshopped.org")
146
 
147
  == Installation ==
148
 
156
 
157
  == Changelog ==
158
 
159
+
160
+ = 3.8.9.6 =
161
+
162
+ * Fix: Fix potential reflexive XSS issue with add_query_arg() and remove_query_arg() usage. Update is _highly_ recommended.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
  = 3.8.9.5 =
165
  * New: Polish translation.
251
  * Change: Default checkout shipping option to lowest shipping cost of all choices.
252
  * Fix: "Variation Controls" anchor in metabox leads nowhere.
253
  * Fix: AJAX code audit (security)
254
+ * Fix: Activating WP e-Commerce on a vanilla WordPress installation with pretty permalinks enabled messes up the rewrite rules.
255
  * Fix: Add a space after tilde character to avoid confusion in admin product list.
256
  * Fix: Add new variation sets and terms from Edit Product page doesn't work properly.
257
  * Fix: Additional description is double escaped in product edit page.
448
  * Fix: Fatal error when trying to include a non-existent admin file.
449
  * Fix: Hide Google Feed information from display
450
  * Fix: Incompatibility with Genesis framework in Product Edit page.
451
+ * Fix: Make the WP e-Commerce 3.8.x activation/installation routine much more efficient.
452
  * Fix: Mandatory fields in user_log_functions.php are not properly validated.
453
  * Fix: Memory improvement for productfeed.
454
  * Fix: Purchase logs have incorrect time if a timezone is specified in Settings->General.
592
  * Fix: Checking (or unchecking) Stock checkbox when editing product causes variation table columns to break.
593
  * Fix: jQuery 1.6 incompatibility with attr( 'className' ).
594
 
 
 
 
 
 
 
 
 
 
595
 
596
+ = 3.8.5 =
597
+ * New: Added hooks to support WPML.
598
+ * New: Links to WP e-Commerce documentation for individual payment gateways.
599
+ * Change: User can specify 0 in thumbnail width or height to make it scale proportional.
600
+ * Change: Show display name, not internal name for shipping method on purchase log view.
601
+ * Change: Presentation settings page is restored to WPEC Settings page when WooTheme is activated.
602
+ * Fix: Add to cart using Donation widget causes the page to reload and the item is added twice.
603
+ * Fix: Free-shipping discount causes tax to be calculated incorrectly.
604
+ * Fix: Paypal Buy Now button passes the wrong price to Paypal if product is on sale.
605
+ * Fix: Thumbnail sizes are not generated correctly.
606
+ * Fix: Broken output buffering rendering wpsc_add_advanced_options hook useless.
607
+ * Fix: Paypal Pro doesn't properly account for discount and coupon.
608
+ * Fix: IPN doesn't work on Paypal Standard.
609
+ * Fix: IPN doesn't work on Paypal Pro gateway.
610
+ * Fix: Paypal Express doesn't handle discounts.
611
+ * Fix: Paypal Express doesn't handle IPN.
612
+ * Fix: Paypal Express doesn't send purchase receipt after a payment is accepted on Paypal.
613
+ * Fix: Paypal Express doesn't include item description, quantity, tax etc. in email receipts.
614
+ * Fix: Invalid country code in Paypal Pro and Express, should be GB instead of UK
615
+ * Fix: Take Discount into account when DoExpressCheckout in Paypal Express gateway.
616
+ * Fix: Category checkout form sets don't work.
617
+ * Fix: Incorrect Product display mode selected when ['view_type'] is set and 'show_advanced_search' is disabled.
618
+ * Fix: PHP notice in wpsc-transaction_results_functions.php.
619
+ * Fix: attr('checked') == true always evaluates to false. Use is(':checked') instead.
620
+ * Fix: jQuery 1.6 select by attribute incompatibility.
621
+ * Fix: Price tag is added to RSS even when there is no price.
622
+ * Fix: Span tag is not closed in issue 598.
623
+ * Fix: Faulty php tag in template (issue 589).
624
+ * Fix: PHP Notices when checking out with shipping disabled.
625
+
626
+ = 3.8.4 =
627
+ * Add: User can duplicate a product in admin panel
628
+ * Add: WooThemes integration support
629
+ * Change: Total in Cart widget now excludes shipping and tax
630
+ * Fix: Invalid country code in paypal-standard.merchant.php
631
+ * Fix: Tax is not passed properly to Paypal Pro
632
+ * Fix: Currency code preference not correctly selected in Paypal gateways
633
+ * Fix: Paypal gateways doesn't check whether the currency being sent to Paypal is accepted or not, resulting in wrong currency
634
+ * Fix: Checkout form selecting the wrong field when a previous field with the same uniquename was deleted
635
+ * Fix: Various issues with Google Checkout
636
+ * Fix: State data outside of US is not passed to payment gateways
637
+ * Fix: State is not displaying correctly in the users purchase history
638
+ * Fix: Wrong generated product permalink when a product is assigned multiple cats, and a product category is being viewed
639
+ * Fix: Submitting a checkout form with mandatory billing state only refreshes the form although everything is filled out correctly
640
+ * Fix: Billing Country is trimmed, and Billing State is not properly decoded
641
+ * Fix: Billing and shipping state no longer stored correctly
642
+ * Fix: Checkout form validation skips mandatory custom checkout fields on default form set
643
+ * Fix: Paystation does not properly update purchase logs
644
+ * Fix: When there's no product, and Sort Product By is set to 'dragndrop', viewing the admin product list would produce a Division by zero warning
645
+ * Fix: Store sub-pages return 404 error
646
+ * Fix: Only Purchase History in Your Account show the login option
647
+ * Fix: Weight on Variations contain too many decimals
648
+ * Fix: Add to Cart in grid view bypasses Variations selection
649
+ * Fix: get_queried_object() requires WP 3.1
650
+ * Fix: Invalid version number in display-update.page.php
651
+ * Fix: Correct HTML, to stop Free Shipping Discount getting blanked
652
+ * Fix: Support taxonomy archives for product_tag taxonomy
653
+
654
+ = 3.8.3 =
655
+ * New: Individual item details are sent to Paypal Express Checkout
656
+ * Change: Automatically reload database update page when PHP maximum execution time is detected
657
+ * Change: Add progress bar and estimated time remaining for database update tasks
658
+ * Change: Themes can now use taxonomy-wpsc_product_category-{$term}.php and taxonomy-wpsc_product_category.php templates, which take precedence over page.php when viewing a product category
659
+ * Change: Paypal Express Checkout API is updated to ver 71.0
660
+ * Fix: Tax is calculated incorrectly when a coupon is used
661
+ * Fix: Update a large database of products and variations take ages
662
+ * Fix: Reloading database update page makes wpec scan the records from the beginning instead of continuing where it left off
663
+ * Fix: Reactivating the plugin causes Fatal Error (PHP Timeout) if there are a lot of attached images (not just post products, but all image attachments)
664
+ * Fix: Purchase logs' statuses are not properly updated when upgrading from 3.7.x
665
+ * Fix: Billing state is not sent to checkout
666
+ * Fix: Country name is truncated when sending to payment gateway
667
+ * Fix: Billing state code is not properly converted before sending to payment gateway
668
+ * Fix: Wrong USA country code is sent to Paypal Standard Payment
669
+ * Fix: Wrong sandbox gateway URL for Paypal Pro
670
+ * Fix: SSLVERIFY error when connecting to Paypal Pro Gateway
671
+ * Fix: Template hierarchy error with child themes
672
+ * Fix: Total amount is not visible when checking out with Paypal Express Checkout
673
+ * Fix: Transaction result page is inaccurate after checking out with Paypal Express Checkout
674
+ * Fix: Incompatibility with Thesis theme's loop when viewing product category, or paginated product listing
675
+
676
+ = 3.8.2 =
677
+ * Add: Currency display for Google RSS feed
678
+ * Add: Third-party plugins can now filter 'wpsc-tax_rate' to provide their own tax solution
679
+ * Change: Merchant subclasses now have access to $this->address_keys
680
+ * Change: Grid Settings are now always visible
681
+ * Change: Total Shipping is no longer included in notification email when shipping is disabled
682
+ * Change: Thumbnail size for single product view now defaults to Single Product Page thumbnail size option
683
+ * Change: wpsc_the_product_thumbnail() defaults to 'medium-single-product' size when in single product view
684
+ * Fix: Update notice being displayed when it has already been completed
685
+ * Fix: Broken image in latest products widget
686
+ * Fix: Custom checkout field not always saved
687
+ * Fix: Downloadable file list not updated after existing files are selected
688
+ * Fix: Already attached downloadable files are duplicated each time you select an existing downloadable file
689
+ * Fix: Inconsistent behavior when adding a new field to a checkout form set
690
+ * Fix: Custom product slug not editable
691
+ * Fix: Incompatibility issues with shipping helper and modules
692
+ * Fix: Product meta are not included in Google product feed
693
+ * Fix: Incorrect variation "from" price
694
+ * Fix: Shortcode not working in single product description
695
+ * Fix: Item cost not correctly calculated in paypal-standard-merchant
696
+ * Fix: Invalid SSL URL for some images
697
+ * Fix: Select from wrong table in WPSC_Merchant::get_authcode()
698
+ * Fix: Wrong use of get_query_var() in wpsc_category_id()
699
+ * Fix: Table `wordpress.wp_wpsc_product_list` doesn't exist
700
+ * Fix: ?items_per_page=all is ignored
701
+ * Fix: Duplicate transaction result emails
702
+ * Fix: Wrong filter in wpsc_item_add_preview_file()
703
+ * Fix: Wrong display type when using advanced search view mode and viewing a category
704
+ * Fix: Category list is displayed in tag archive
705
+ * Fix: wpsc_display_products_page() outputs "Fail" when the product shortcode is used 10 times (no kidding)
706
+ * Fix: Single product view's thumbnail size is incorrect
707
+ * Fix: Wrong featured thumbnail is displayed in Single Product View when there are multiple attached product images
708
+ * Fix: Incorrect condition statements in WPSC_Coupons::compare_logic()
709
+ * Fix: Can't add new field to checkout form set in IE
710
+ * Fix: Missing trash icon when adding custom options to dropdowns in checkout form
711
+ * Fix: Custom select, checkbox and radio fields are displayed as textbox on [userlog] page
712
+ * Fix: Custom checkboxes, radios and select fields are not properly populated in Checkout form
713
+ * Fix: Attachment metadata are not properly generated when converting product thumbnails from 3.7.x to 3.8
714
 
715
+ = 3.8.1 =
716
+ * Fix: Special price mix-up when ugprade to 3.8
717
+ * Fix: Missing database update notice
718
+ * Fix: Breadcrumb markup and style fixes
719
+ * Fix: Deprecate WPSC_Query()
720
+ * Fix: Deprecate wpsc_total_product_count()
721
+ * Fix: Deprecate wpsc_print_product_list()
722
+ * Change: Warning message for PHP 4 users. GoldCart requires PHP 5 or above.
723
+ * Change: Don't display categories when there's a search
724
+
725
+ = 3.8 =
726
+ * Utilize custom post types for products
727
+ * Utilize custom taxonomy for categories and variations
728
+ * Database optimization
729
+ * Redesigned taxes and shipping systems
730
+ * New user interface
731
+ * Integrates with WordPress Media Manager
732
+ * Better template integration for designers
733
+ * Optimized for ticketing (Tikipress)
734
 
 
735
 
736
+ == Frequently Asked Questions ==
 
 
 
737
 
738
+ = How do I customize WP e-Commerce =
739
 
740
+ First of all you should check out the Presentation settings which are in the Settings->Store page.
741
 
742
+ Advanced users can edit the CSS (and do just about anything). Not so advanced users can hire WP consultants developers and designers from [http://getshopped.org/resources/wp-consultants/](http://getshopped.org/resources/wp-consultants/ "http://getshopped.org/resources/wp-consultants/").
743
 
744
  == Screenshots ==
745
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
wp-shopping-cart.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
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.9.2
7
- * Author: WP eCommerce
8
- * Author URI: http://wpecommerce.org/
9
  **/
10
 
11
  /**
@@ -16,34 +16,18 @@
16
  * @package wp-e-commerce
17
  */
18
  class WP_eCommerce {
19
- private $components = array(
20
- 'merchant' => array(),
21
- 'marketplace' => array(),
22
- 'theme-engine' => array(),
23
- );
24
 
25
  /**
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 );
33
- add_filter( 'wpsc_components', array( $this, '_register_core_components' ) );
34
  }
35
 
36
  /**
37
  * Takes care of loading up WPEC
38
- *
39
- * @uses WP_eCommerce::start() Initializes basic WPEC constants
40
- * @uses WP_eCommerce::constants() Setup WPEC core constants
41
- * @uses WP_eCommerce::includes() Includes the WPEC files
42
- * @uses WP_eCommerce::load() Setup WPEC Core
43
- * @uses do_action() Calls 'wpsc_pre_init' which runs before WPEC initializes
44
- * @uses do_action() Calls 'wpsc_init' runs just after WPEC initializes
45
  */
46
- public function init() {
47
  // Previous to initializing
48
  do_action( 'wpsc_pre_init' );
49
 
@@ -58,99 +42,31 @@ class WP_eCommerce {
58
  }
59
 
60
  /**
61
- * New WPSC components API.
62
- *
63
- * Allows for modular coupling of different functionalities within WPSC.
64
- * This is the way we'll be introducing cutting-edge APIs.
65
- *
66
- * @since 3.8.9.5
67
- *
68
- * @param array $components
69
- * @return array $components
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
- );
89
-
90
- return $components;
91
- }
92
-
93
- /**
94
- * Initialize the basic WP eCommerce constants
95
- *
96
- * @uses plugins_url() Retrieves url to plugins directory
97
- * @uses load_plugin_textdomain() Loads plugin transations strings
98
- * @uses plugin_basename() Gets the basename of a plugin (extracts the name of a plugin from its filename)
99
- * @uses do_action() Calls 'wpsc_started' which runs after WPEC has started
100
- */
101
- public function start() {
102
  // Set the core file path
103
  define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
104
 
105
  // Define the path to the plugin folder
106
  define( 'WPSC_DIR_NAME', basename( WPSC_FILE_PATH ) );
107
- define( 'WPSC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
108
 
109
  // Define the URL to the plugin folder
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
- public function setup_table_names() {
123
- global $wpdb;
124
- $wpdb->wpsc_meta = WPSC_TABLE_META;
125
- $wpdb->wpsc_also_bought = WPSC_TABLE_ALSO_BOUGHT;
126
- $wpdb->wpsc_region_tax = WPSC_TABLE_REGION_TAX;
127
- $wpdb->wpsc_coupon_codes = WPSC_TABLE_COUPON_CODES;
128
- $wpdb->wpsc_cart_contents = WPSC_TABLE_CART_CONTENTS;
129
- $wpdb->wpsc_claimed_stock = WPSC_TABLE_CLAIMED_STOCK;
130
- $wpdb->wpsc_currency_list = WPSC_TABLE_CURRENCY_LIST;
131
- $wpdb->wpsc_purchase_logs = WPSC_TABLE_PURCHASE_LOGS;
132
- $wpdb->wpsc_checkout_forms = WPSC_TABLE_CHECKOUT_FORMS;
133
- $wpdb->wpsc_product_rating = WPSC_TABLE_PRODUCT_RATING;
134
- $wpdb->wpsc_download_status = WPSC_TABLE_DOWNLOAD_STATUS;
135
- $wpdb->wpsc_submitted_form_data = WPSC_TABLE_SUBMITTED_FORM_DATA;
136
- $wpdb->wpsc_cart_itemmeta = WPSC_TABLE_CART_ITEM_META;
137
- $wpdb->wpsc_purchasemeta = WPSC_TABLE_PURCHASE_META;
138
- $wpdb->wpsc_visitors = WPSC_TABLE_VISITORS;
139
- $wpdb->wpsc_visitormeta = WPSC_TABLE_VISITOR_META;
140
- }
141
-
142
  /**
143
  * Setup the WPEC core constants
144
- *
145
- * @uses wpsc_core_constants() Loads the WPEC Core constants
146
- * @uses wpsc_core_is_multisite() Checks if this is a multisite install. True if is multisite
147
- * @uses wpsc_core_load_session() Loads the WPEC core session
148
- * @uses wpsc_core_constants_version_processing() Checks and sets a constant for WordPress version
149
- * @uses wpsc_core_constants_table_names() Sets constants for WPEC table names
150
- * @uses wpsc_core_constants_uploads() Set the upload related constants
151
- * @uses do_action() Calls 'wpsc_constants' which runs after the WPEC constants are defined
152
  */
153
- public function constants() {
154
  // Define globals and constants used by wp-e-commerce
155
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-constants.php' );
156
 
@@ -169,9 +85,6 @@ class WP_eCommerce {
169
  // WPEC Table names and related constants
170
  wpsc_core_constants_table_names();
171
 
172
- // setup wpdb table name attributes
173
- $this->setup_table_names();
174
-
175
  // Uploads directory info
176
  wpsc_core_constants_uploads();
177
 
@@ -181,34 +94,11 @@ class WP_eCommerce {
181
 
182
  /**
183
  * Include the rest of WPEC's files
184
- *
185
- * @uses apply_filters() Calls 'wpsc_components' private merchant components
186
- * @uses do_action() Calls 'wpsc_includes' which runs after WPEC files have been included
187
  */
188
- public function includes() {
189
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-util.php' );
190
- require_once( WPSC_FILE_PATH . '/wpsc-includes/customer.php' );
191
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-customer.php' );
192
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-visitor.php' );
193
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-cart-item.php' );
194
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php' );
195
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
196
- require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-includes.php' );
197
-
198
- $this->components = apply_filters( 'wpsc_components', $this->components );
199
-
200
- foreach ( $this->components as $type => $registered ) {
201
- foreach ( $registered as $component ) {
202
-
203
- if ( ! is_array( $component['includes'] ) ) {
204
- $component['includes'] = array( $component['includes' ] );
205
- }
206
-
207
- foreach ( $component['includes'] as $include ) {
208
- require_once( $include );
209
- }
210
- }
211
- }
212
 
213
  // Any additional file includes can hook in here
214
  do_action( 'wpsc_includes' );
@@ -216,34 +106,25 @@ class WP_eCommerce {
216
 
217
  /**
218
  * Setup the WPEC core
219
- *
220
- * @uses do_action() Calls 'wpsc_pre_load' which runs before WPEC setup
221
- * @uses do_action() Calls 'wpsc_before_init' which is a legacy action
222
- * @uses _wpsc_action_create_customer_id() Sets up a customer id just in case we don't have it
223
- * @uses wpsc_core_setup_globals() Sets up the WPEC core globals
224
- * @uses wpsc_core_setup_cart() Sets up the WPEC core cart
225
- * @uses wpsc_core_load_thumbnail_sizes() Sets up the core WPEC thumbnail sizes
226
- * @uses wpsc_core_load_purchase_log_statuses() Loads the statuses for the purchase logs
227
- * @uses wpsc_core_load_checkout_data() Sets up the core WPEC form checkout data
228
- * @uses wpsc_core_load_gateways() Loads the merchants from the directory
229
- * @uses wpsc_core_load_shipping_modules() Gets shipping modules from the shipping directory
230
- * @uses wpsc_core_load_page_titles() Loads the core WPEC pagetitles
231
- * @uses do_action() Calls 'wpsc_loaded' which runs after WPEC is fully loaded
232
  */
233
- public function load() {
234
  // Before setup
235
  do_action( 'wpsc_pre_load' );
236
 
237
  // Legacy action
238
  do_action( 'wpsc_before_init' );
239
 
 
 
 
240
  // Setup the core WPEC globals
241
  wpsc_core_setup_globals();
242
 
243
- add_action( 'init', '_wpsc_action_setup_customer', 1 );
 
244
 
245
- // WPEC is ready to use as soon as WordPress and customer is setup and loaded
246
- add_action( 'init', array( &$this, '_wpsc_fire_ready_action' ), 100 );
247
 
248
  // Load the purchase log statuses
249
  wpsc_core_load_purchase_log_statuses();
@@ -257,39 +138,30 @@ class WP_eCommerce {
257
  // Load the shipping modules
258
  wpsc_core_load_shipping_modules();
259
 
 
 
 
260
  // WPEC is fully loaded
261
  do_action( 'wpsc_loaded' );
262
  }
263
 
264
- public function _wpsc_fire_ready_action() {
265
- // WPEC is ready to use as soon as WordPress and customer is setup and loaded
266
- do_action( 'wpsc_ready' );
267
- }
268
-
269
  /**
270
  * WPEC Activation Hook
271
- *
272
- * @uses deactivate_plugins() Deactivates plugins by string
273
- * @uses wp_die() Kills loading and returns the HTML
274
- * @uses wpsc_install() Performs checks to see if this is a clean install or not
275
  */
276
- public function install() {
277
-
278
- if ( ! defined( 'WPSC_FILE_PATH' ) ) {
279
- define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
 
 
280
  }
281
-
282
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
283
  $this->constants();
284
  wpsc_install();
 
285
  }
286
 
287
- /**
288
- * Runs the WPEC deactivation routines.
289
- *
290
- * @uses wp_get_schedules() Retrieves all filtered WP_Cron recurrences
291
- * @uses wp_clear_scheduled_hook() Removes any hooks on WP_Cron
292
- */
293
  public function deactivate() {
294
  foreach ( wp_get_schedules() as $cron => $schedule ) {
295
  wp_clear_scheduled_hook( "wpsc_{$cron}_cron_task" );
@@ -301,5 +173,6 @@ class WP_eCommerce {
301
  $wpec = new WP_eCommerce();
302
 
303
  // Activation
304
- register_activation_hook( __FILE__ , array( $wpec, 'install' ) );
305
  register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
 
1
  <?php
2
  /**
3
+ * Plugin Name: WP e-Commerce
4
+ * Plugin URI: http://getshopped.org/
5
+ * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
6
+ * Version: 3.8.9.6
7
+ * Author: Instinct Entertainment
8
+ * Author URI: http://getshopped.org/
9
  **/
10
 
11
  /**
16
  * @package wp-e-commerce
17
  */
18
  class WP_eCommerce {
 
 
 
 
 
19
 
20
  /**
21
  * Start WPEC on plugins loaded
 
 
 
22
  */
23
+ function WP_eCommerce() {
24
+ add_action( 'plugins_loaded', array( $this, 'init' ), 8 );
 
25
  }
26
 
27
  /**
28
  * Takes care of loading up WPEC
 
 
 
 
 
 
 
29
  */
30
+ function init() {
31
  // Previous to initializing
32
  do_action( 'wpsc_pre_init' );
33
 
42
  }
43
 
44
  /**
45
+ * Initialize the basic WPEC constants
 
 
 
 
 
 
 
 
46
  */
47
+ function start() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  // Set the core file path
49
  define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
50
 
51
  // Define the path to the plugin folder
52
  define( 'WPSC_DIR_NAME', basename( WPSC_FILE_PATH ) );
 
53
 
54
  // Define the URL to the plugin folder
55
+ define( 'WPSC_FOLDER', dirname( plugin_basename( __FILE__ ) ) );
56
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
57
 
58
  //load text domain
59
+ if( !load_plugin_textdomain( 'wpsc', false, '../languages/' ) )
60
+ load_plugin_textdomain( 'wpsc', false, dirname( plugin_basename( __FILE__ ) ) . '/wpsc-languages/' );
 
61
 
62
  // Finished starting
63
  do_action( 'wpsc_started' );
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * Setup the WPEC core constants
 
 
 
 
 
 
 
 
68
  */
69
+ function constants() {
70
  // Define globals and constants used by wp-e-commerce
71
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-constants.php' );
72
 
85
  // WPEC Table names and related constants
86
  wpsc_core_constants_table_names();
87
 
 
 
 
88
  // Uploads directory info
89
  wpsc_core_constants_uploads();
90
 
94
 
95
  /**
96
  * Include the rest of WPEC's files
 
 
 
97
  */
98
+ function includes() {
 
 
 
 
 
99
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php' );
100
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
101
+ require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-includes.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  // Any additional file includes can hook in here
104
  do_action( 'wpsc_includes' );
106
 
107
  /**
108
  * Setup the WPEC core
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  */
110
+ function load() {
111
  // Before setup
112
  do_action( 'wpsc_pre_load' );
113
 
114
  // Legacy action
115
  do_action( 'wpsc_before_init' );
116
 
117
+ // Setup the customer ID just in case to make sure it's set up correctly
118
+ _wpsc_action_create_customer_id( 'create' );
119
+
120
  // Setup the core WPEC globals
121
  wpsc_core_setup_globals();
122
 
123
+ // Setup the core WPEC cart
124
+ wpsc_core_setup_cart();
125
 
126
+ // Load the thumbnail sizes
127
+ wpsc_core_load_thumbnail_sizes();
128
 
129
  // Load the purchase log statuses
130
  wpsc_core_load_purchase_log_statuses();
138
  // Load the shipping modules
139
  wpsc_core_load_shipping_modules();
140
 
141
+ // Set page title array for important WPSC pages
142
+ wpsc_core_load_page_titles();
143
+
144
  // WPEC is fully loaded
145
  do_action( 'wpsc_loaded' );
146
  }
147
 
 
 
 
 
 
148
  /**
149
  * WPEC Activation Hook
 
 
 
 
150
  */
151
+ function install() {
152
+ global $wp_version;
153
+ if((float)$wp_version < 3.0){
154
+ deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourselves
155
+ wp_die( __('Looks like you\'re running an older version of WordPress, you need to be running at least WordPress 3.0 to use WP e-Commerce 3.8', 'wpsc'), __('WP e-Commerce 3.8 not compatible', 'wpsc'), array('back_link' => true));
156
+ return;
157
  }
158
+ define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
159
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
160
  $this->constants();
161
  wpsc_install();
162
+
163
  }
164
 
 
 
 
 
 
 
165
  public function deactivate() {
166
  foreach ( wp_get_schedules() as $cron => $schedule ) {
167
  wp_clear_scheduled_hook( "wpsc_{$cron}_cron_task" );
173
  $wpec = new WP_eCommerce();
174
 
175
  // Activation
176
+ register_activation_hook( __FILE__, array( $wpec, 'install' ) );
177
  register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
178
+ ?>
wpsc-admin/admin-form-functions.php CHANGED
@@ -1,11 +1,4 @@
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']);
@@ -145,7 +138,6 @@ $output ='
145
  <input type="text" name="rules[value][]"/>
146
  </span>
147
 
148
-
149
  </div>
150
  </div>
151
  </td>
@@ -165,7 +157,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,7 +169,7 @@ 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'>";
@@ -261,5 +253,201 @@ function wpsc_right_now() {
261
  <?php
262
  }
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  function wpsc_product_item_row() {
265
  }
1
  <?php
 
 
 
 
 
 
 
2
  function coupon_edit_form($coupon) {
3
 
4
  $conditions = maybe_unserialize($coupon['condition']);
138
  <input type="text" name="rules[value][]"/>
139
  </span>
140
 
 
141
  </div>
142
  </div>
143
  </td>
157
  );
158
  $nonced_url = wp_nonce_url( $nonced_url, 'delete-coupon' );
159
 
160
+ $output.= "<a class='delete_button' style='text-decoration:none;' href=" .esc_url( $nonced_url ).">" . esc_html__( 'Delete', 'wpsc' ) . "</a>";
161
 
162
  $output.='
163
  </td>
169
  function setting_button(){
170
  $next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
171
 
172
+ // $output.="<div><img src='".get_option('siteurl')."/wp-content/plugins/".WPSC_DIR_NAME."/images/settings_button.jpg' onclick='display_settings_button()'>";
173
  $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>";
174
  $output.="<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
175
  $output.="<ul class='settings_button'>";
253
  <?php
254
  }
255
 
256
+
257
+ function wpsc_packing_slip( $purchase_id ) {
258
+ echo "<!DOCTYPE html><html><head><title>" . __( 'Packing Slip', 'wpsc' ) . "</title></head><body id='wpsc-packing-slip'>";
259
+ global $wpdb;
260
+ $purch_sql = $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id`=%d", $purchase_id );
261
+ $purch_data = $wpdb->get_row( $purch_sql, ARRAY_A ) ;
262
+
263
+ $cartsql = $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`=%d", $purchase_id );
264
+ $cart_log = $wpdb->get_results($cartsql,ARRAY_A) ;
265
+ $j = 0;
266
+
267
+ if($cart_log != null) {
268
+ echo "<div class='packing_slip'>\n\r";
269
+ echo apply_filters( 'wpsc_packing_slip_header', '<h2>' . esc_html__( 'Packing Slip', 'wpsc' ) . "</h2>\n\r" );
270
+ echo "<strong>". esc_html__( 'Order', 'wpsc' )." #</strong> ".$purchase_id."<br /><br />\n\r";
271
+
272
+ echo "<table>\n\r";
273
+
274
+ $form_sql = $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_SUBMITED_FORM_DATA."` WHERE `log_id` = %d", $purchase_id );
275
+ $input_data = $wpdb->get_results($form_sql,ARRAY_A);
276
+
277
+ foreach($input_data as $input_row) {
278
+ $rekeyed_input[$input_row['form_id']] = $input_row;
279
+ }
280
+
281
+
282
+ if($input_data != null) {
283
+ $form_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1'",ARRAY_A);
284
+
285
+ foreach($form_data as $form_field) {
286
+
287
+ switch($form_field['type']) {
288
+ case 'country':
289
+ $region_count_sql = $wpdb->prepare( "SELECT COUNT(`regions`.`id`) FROM `".WPSC_TABLE_REGION_TAX."` AS `regions` INNER JOIN `".WPSC_TABLE_CURRENCY_LIST."` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('%s')", $purch_data['billing_country'] );
290
+ $delivery_region_count = $wpdb->get_var( $region_count_sql );
291
+
292
+ if(is_numeric($purch_data['billing_region']) && ($delivery_region_count > 0))
293
+ echo " <tr><td>".esc_html__('State', 'wpsc').":</td><td>".wpsc_get_region($purch_data['billing_region'])."</td></tr>\n\r";
294
+
295
+ echo " <tr><td>" . esc_html( $form_field['name'] ) . ":</td><td>" . esc_html( $rekeyed_input[$form_field['id']]['value'] ) . "</td></tr>\n\r";
296
+ break;
297
+
298
+ case 'delivery_country':
299
+
300
+ if(is_numeric($purch_data['shipping_region']) && ($delivery_region_count > 0))
301
+ echo " <tr><td>".esc_html__('State', 'wpsc').":</td><td>".wpsc_get_region($purch_data['shipping_region'])."</td></tr>\n\r";
302
+
303
+ echo " <tr><td>" . esc_html( $form_field['name'] ) . ":</td><td>" . esc_html( $rekeyed_input[ $form_field['id']]['value'] ) . "</td></tr>\n\r";
304
+ break;
305
+
306
+ case 'heading':
307
+
308
+ if($form_field['name'] == "Hidden Fields")
309
+ continue;
310
+ else
311
+ echo " <tr class='heading'><td colspan='2'><strong>" . esc_html( $form_field['name'] ) . ":</strong></td></tr>\n\r";
312
+ break;
313
+
314
+ default:
315
+ if ($form_field['name']=="State" && !empty($purch_data['billing_region']) || $form_field['name']=="State" && !empty($purch_data['billing_region']))
316
+ echo "";
317
+ else
318
+ echo " <tr><td>" . esc_html( $form_field['name'] ) . ":</td><td>".
319
+ ( isset( $rekeyed_input[$form_field['id']] ) ? esc_html( $rekeyed_input[$form_field['id']]['value'] ) : '' ) .
320
+ "</td></tr>\n\r";
321
+ break;
322
+ }
323
+
324
+ }
325
+ } else {
326
+ echo " <tr><td>".esc_html__('Name', 'wpsc').":</td><td>".$purch_data['firstname']." ".$purch_data['lastname']."</td></tr>\n\r";
327
+ echo " <tr><td>".esc_html__('Address', 'wpsc').":</td><td>".$purch_data['address']."</td></tr>\n\r";
328
+ echo " <tr><td>".esc_html__('Phone', 'wpsc').":</td><td>".$purch_data['phone']."</td></tr>\n\r";
329
+ echo " <tr><td>".esc_html__('Email', 'wpsc').":</td><td>".$purch_data['email']."</td></tr>\n\r";
330
+ }
331
+
332
+ if ( 2 == get_option( 'payment_method' ) ) {
333
+ $gateway_name = '';
334
+ $nzshpcrt_gateways = nzshpcrt_get_gateways();
335
+
336
+ foreach( $nzshpcrt_gateways as $gateway ) {
337
+ if ( $purch_data['gateway'] != 'testmode' ) {
338
+ if ( $gateway['internalname'] == $purch_data['gateway'] ) {
339
+ $gateway_name = $gateway['name'];
340
+ }
341
+ } else {
342
+ $gateway_name = esc_html__('Manual Payment', 'wpsc');
343
+ }
344
+ }
345
+ }
346
+
347
+ echo "</table>\n\r";
348
+
349
+
350
+ do_action ('wpsc_packing_slip_extra_info',$purchase_id);
351
+
352
+
353
+ echo "<table class='packing_slip'>";
354
+
355
+ echo "<tr>";
356
+ echo " <th>".esc_html__('Quantity', 'wpsc')." </th>";
357
+
358
+ echo " <th>".esc_html__('Name', 'wpsc')."</th>";
359
+
360
+
361
+ echo " <th>".esc_html__('Price', 'wpsc')." </th>";
362
+
363
+ echo " <th>".esc_html__('Shipping', 'wpsc')." </th>";
364
+ echo '<th>' . esc_html__('Tax', 'wpsc') . '</th>';
365
+ echo '</tr>';
366
+ $endtotal = 0;
367
+ $all_donations = true;
368
+ $all_no_shipping = true;
369
+ $file_link_list = array();
370
+ $total_shipping = 0;
371
+ foreach($cart_log as $cart_row) {
372
+ $alternate = "";
373
+ $j++;
374
+ if(($j % 2) != 0) {
375
+ $alternate = "class='alt'";
376
+ }
377
+ // product ID will be $cart_row['prodid']. need to fetch name and stuff
378
+
379
+ $variation_list = '';
380
+
381
+ if($cart_row['donation'] != 1) {
382
+ $all_donations = false;
383
+ }
384
+
385
+ if($cart_row['no_shipping'] != 1) {
386
+ $shipping = $cart_row['pnp'];
387
+ $total_shipping += $shipping;
388
+ $all_no_shipping = false;
389
+ } else {
390
+ $shipping = 0;
391
+ }
392
+
393
+ $price = $cart_row['price'] * $cart_row['quantity'];
394
+ $gst = $price - ($price / (1+($cart_row['gst'] / 100)));
395
+
396
+ if($gst > 0) {
397
+ $tax_per_item = $gst / $cart_row['quantity'];
398
+ }
399
+
400
+
401
+ echo "<tr $alternate>";
402
+
403
+
404
+ echo " <td>";
405
+ echo $cart_row['quantity'];
406
+ echo " </td>";
407
+
408
+ echo " <td>";
409
+ echo apply_filters( 'the_title', $cart_row['name'] );
410
+ echo $variation_list;
411
+ echo " </td>";
412
+
413
+
414
+ echo " <td>";
415
+ echo wpsc_currency_display( $price );
416
+ echo " </td>";
417
+
418
+ echo " <td>";
419
+ echo wpsc_currency_display($shipping );
420
+ echo " </td>";
421
+
422
+
423
+
424
+ echo '<td>';
425
+ echo wpsc_currency_display( $cart_row['tax_charged'] );
426
+ echo '</td>';
427
+ echo '</tr>';
428
+ }
429
+
430
+ echo "</table>";
431
+ echo '<table class="packing-slip-totals">';
432
+ if ( floatval( $purch_data['discount_value'] ) )
433
+ echo '<tr><th>'.esc_html__('Discount', 'wpsc').'</th><td>(' . wpsc_currency_display( $purch_data['discount_value'] ) . ')</td></tr>';
434
+
435
+ echo '<tr><th>'.esc_html__('Base Shipping','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['base_shipping'] ) . '</td></tr>';
436
+ echo '<tr><th>'.esc_html__('Total Shipping','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['base_shipping'] + $total_shipping ) . '</td></tr>';
437
+ //wpec_taxes
438
+ if($purch_data['wpec_taxes_total'] != 0.00)
439
+ {
440
+ echo '<tr><th>'.esc_html__('Taxes','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['wpec_taxes_total'] ) . '</td></tr>';
441
+ }
442
+ echo '<tr><th>'.esc_html__('Total Price','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['totalprice'] ) . '</td></tr>';
443
+ echo '</table>';
444
+
445
+ echo "</div>\n\r";
446
+ } else {
447
+ echo "<br />".esc_html__('This users cart was empty', 'wpsc');
448
+ }
449
+
450
+ }
451
+
452
  function wpsc_product_item_row() {
453
  }
wpsc-admin/admin.php CHANGED
@@ -24,7 +24,6 @@ require_once( WPSC_FILE_PATH . '/wpsc-admin/init.php' );
24
  require_once( WPSC_FILE_PATH . '/wpsc-admin/ajax-and-init.php' );
25
  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' );
@@ -33,20 +32,13 @@ 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
-
37
- // if we add and wpec admin javascript will add the localizations
38
- add_filter( 'wpsc_javascript_localizations', '_wpsc_admin_localizations', 1 );
39
-
40
  /**
41
  * wpsc_query_vars_product_list sets the ordering for the edit-products page list
42
- *
43
- * @since 3.8
44
  * @access public
45
  *
46
- * @uses get_option() Gets option from the DB given key
47
- *
48
- * @param array $vars req Default query arguments
49
- * @return array $vars Modified query arguments
50
  */
51
  function wpsc_query_vars_product_list( $vars ){
52
 
@@ -65,43 +57,17 @@ function wpsc_query_vars_product_list( $vars ){
65
  }
66
 
67
  /**
68
- * Admin Edit Posts Order
69
- *
70
- * @since 3.8.12
71
  * @access public
72
  *
73
- * @param string $orderby_sql Order by SQL.
74
- * @return string Filtered order by SQL.
75
- */
76
- function wpsc_admin_edit_posts_orderby( $orderby_sql ) {
77
- global $wp_query, $wpdb;
78
- if ( 'dragndrop' == get_option( 'wpsc_sort_by' ) ) {
79
- if ( function_exists( 'is_main_query' ) && is_main_query() && 'wpsc-product' == get_query_var( 'post_type' ) && is_tax( 'wpsc_product_category' ) ) {
80
- if ( ! empty( $orderby_sql ) )
81
- $orderby_sql = ', ' . $orderby_sql;
82
- $orderby_sql = " {$wpdb->term_relationships}.term_order ASC" . $orderby_sql;
83
- remove_filter( 'posts_orderby', 'wpsc_admin_edit_posts_orderby' );
84
- }
85
- }
86
- return $orderby_sql;
87
- }
88
- add_filter( 'posts_orderby', 'wpsc_admin_edit_posts_orderby' );
89
-
90
- /**
91
- * setting the product & variations per page screen option to between 1 and 999
92
- *
93
  * @since 3.8
94
- * @access public
95
- *
96
- * @uses update_user_option() Updates user option given userid, key, value
97
- *
98
- * @param $status
99
- * @param string $option req Name of option being saved
100
- * @param string $value req Value of option being saved
101
  * @return $value after changes...
102
  */
103
  function wpsc_set_screen_option($status, $option, $value){
104
- if( in_array($option, array ("edit_wpsc_variation_per_page","edit_wpsc_product_per_page", "wpsc_purchases_per_page" )) ){
105
  if ( "edit_wpsc_variation_per_page" == $option ){
106
  global $user_ID;
107
  update_user_option($user_ID,'edit_wpsc-variation_per_page',$value);
@@ -116,12 +82,8 @@ add_filter('set-screen-option', 'wpsc_set_screen_option', 99, 3);
116
  * @access public
117
  *
118
  * @since 3.8
119
- * @access public
120
- *
121
- * @uses get_option() Gets option from the database given key
122
- *
123
- * @param int $per_page req number of products per page
124
- * @param string $post_type req name of current post type
125
  * @return $per_page after changes...
126
  */
127
  function wpsc_drag_and_drop_ordering($per_page, $post_type){
@@ -131,16 +93,13 @@ function wpsc_drag_and_drop_ordering($per_page, $post_type){
131
  return $per_page;
132
  }
133
  add_filter( 'request', 'wpsc_query_vars_product_list' );
134
- add_filter( 'edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
135
-
136
  /**
137
  * Checks whether to display or hide the update wp-e-commerce link
138
  *
139
- * @since 3.8
140
  * @access public
141
  *
142
- * @uses get_option() Gets option from DB given key
143
- *
144
  * @return boolean true - show link, false- hide link
145
  */
146
  function wpsc_show_update_link() {
@@ -164,18 +123,6 @@ function wpsc_show_update_link() {
164
  *
165
  * If the permissions are changed here, they will likewise need to be changed for the other sections of the admin that either use ajax
166
  * or bypass the normal download system.
167
- *
168
- * @access public
169
- *
170
- * @uses wpsc_show_update_link() Decides whether or not to show the update link
171
- * @uses add_submenu_page() Adds a WordPress submenu page
172
- * @uses apply_filters() Calls wpsc_upgrades_cap allows hooking caps for adiministrator
173
- * @uses apply_filters() Calls wpsc_coupon_cap allows filtering for the coupon caps
174
- * @uses add_options_page() Adds a submenu to the settings page
175
- * @uses add_action() Calls 'admin_print_scripts.$edit_options_page prints out WPEC admin scripts
176
- * @uses apply_filters() Calls 'wpsc_additional_pages' Passes the page_hooks and product_page URL
177
- * @uses do_action() Calls 'wpsc_add_submenu' Allows you to hook in to the WPEC menu
178
- * @uses update_option() Updates option given key and value
179
  */
180
  function wpsc_admin_pages() {
181
 
@@ -262,9 +209,6 @@ function wpsc_admin_pages() {
262
  add_action( 'load-post.php' , 'wpsc_add_help_tabs' );
263
  add_action( 'load-post-new.php' , 'wpsc_add_help_tabs' );
264
  add_action( 'load-edit-tags.php' , 'wpsc_add_help_tabs' );
265
-
266
- // screen options on Sales Log
267
- add_action( 'load-' . $purchase_logs_page , 'wpsc_add_purchase_logs_screen_option' );
268
  }
269
 
270
  /**
@@ -272,11 +216,6 @@ function wpsc_admin_pages() {
272
  * add_contextual_help() is supported as well as $screen->add_help_tab().
273
  *
274
  * @since 3.8.8
275
- * @access public
276
- *
277
- * @uses get_current_screen() Returns WordPress admin screen object
278
- * @uses get_bloginfo() Returns information about the WordPress site
279
- * @uses add_help_tab() Used to add a tab to the contextual help menu
280
  */
281
  function wpsc_add_help_tabs() {
282
  $tabs = array(
@@ -354,50 +293,24 @@ function wpsc_add_help_tabs() {
354
  $content = '<p><strong>' . __( 'For More Information', 'wpsc' ) . '</strong></p>';
355
  $links = array();
356
  foreach( $tab['links'] as $link => $link_title ) {
357
- $link = 'http://docs.wpecommerce.org/' . $link;
358
  $links[] = '<a target="_blank" href="' . esc_url( $link ) . '">' . esc_html( $link_title ) . '</a>';
359
  }
360
  $content .= '<p>' . implode( '<br />', $links ) . '</p>';
361
 
362
- $screen->add_help_tab( array(
363
- 'id' => $screen->id . '_help',
364
- 'title' => $tab['title'],
365
- 'content' => $content,
366
- ) );
367
-
 
 
 
368
  }
369
  }
370
 
371
- /**
372
- * This function allows change in number of purchase logs shown on Sales Log (Screen Options).
373
- *
374
- * @since 3.9
375
- * @access public
376
- *
377
- * @uses add_screen_option()
378
- */
379
- function wpsc_add_purchase_logs_screen_option(){
380
-
381
- // setup Screen Option for purchase logs per page
382
- add_screen_option( 'per_page', array(
383
- 'label' => __("Sales Orders", 'wpsc'),
384
- 'default' => 20,
385
- 'option' => 'wpsc_purchases_per_page'
386
- ) );
387
- }
388
-
389
- /**
390
- * Includes purchase logs CSS and JS
391
- *
392
- * @acces public
393
- *
394
- * @uses wp_enqueue_script() Recommended way of adding scripts in WordPress
395
- * @uses wp_localize_script() Adds noncing and other data to the logs script
396
- */
397
  function wpsc_admin_include_purchase_logs_css_and_js() {
398
-
399
- _wpsc_enqueue_wp_e_commerce_admin();
400
-
401
  wp_enqueue_script( 'wp-e-commerce-purchase-logs', WPSC_URL . '/wpsc-admin/js/purchase-logs.js', array( 'jquery' ), WPSC_VERSION . '.' . WPSC_MINOR_VERSION );
402
  wp_localize_script( 'wp-e-commerce-purchase-logs', 'WPSC_Purchase_Logs_Admin', array(
403
  'nonce' => wp_create_nonce( 'wpsc_purchase_logs' ),
@@ -408,105 +321,51 @@ function wpsc_admin_include_purchase_logs_css_and_js() {
408
  'sent_message' => _x( 'Email Sent!', 'sending tracking email for purchase log', 'wpsc' ),
409
  'current_view' => empty( $_REQUEST['status'] ) ? 'all' : $_REQUEST['status'],
410
  'current_filter' => empty( $_REQUEST['m'] ) ? '' : $_REQUEST['m'],
411
- 'current_page' => empty( $_REQUEST['paged'] ) ? '' : $_REQUEST['paged'],
412
  ) );
413
-
414
- // Purchase Log Action Links
415
- wp_enqueue_script( 'wpsc-purchase-log-action-links', WPSC_URL . '/wpsc-admin/js/purchase-log-action-links.js', array( 'jquery' ), WPSC_VERSION . '.' . WPSC_MINOR_VERSION );
416
- wp_localize_script( 'wpsc-purchase-log-action-links', 'WPSC_Purchase_Log_Action_Links', array(
417
- 'purchase_log_action_link_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_action_link' ),
418
- 'log_id' => empty( $_REQUEST['id'] ) ? '' : absint( $_REQUEST['id'] )
419
- ) );
420
-
421
  }
422
 
423
- /**
424
- * Loads the WPEC settings page
425
- *
426
- * @access public
427
- *
428
- * @uses WPSC_Settings_Page::get_instance() Gets instance of WPEC settings page
429
- */
430
  function wpsc_load_settings_page() {
431
  require_once('settings-page.php');
432
  WPSC_Settings_Page::get_instance();
433
  }
434
 
435
- /**
436
- * Leads the purchase logs page
437
- *
438
- * @uses WPSC_Purchase_Log_Page() Loads the edit and view sales page
439
- */
440
  function wpsc_load_purchase_logs_page() {
441
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-list-table-class.php' );
442
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
443
  $page = new WPSC_Purchase_Log_Page();
444
  }
445
 
446
- /**
447
- * Displays the WPEC purchase logs
448
- *
449
- * @uses do_action() Calls 'wpsc_display_purchase_logs_page' allows hooking of the sales log page
450
- */
451
  function wpsc_display_purchase_logs_page() {
452
  do_action( 'wpsc_display_purchase_logs_page' );
453
  }
454
 
455
- /**
456
- * Produces an RSS feed for the product log
457
- *
458
- * @uses add_query_arg() Allows you to add arguments to the end of a URL
459
- * @uses admin_url() Retrieves URL to the WordPress admin
460
- */
461
  function wpsc_product_log_rss_feed() {
462
- 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' />";
463
  }
464
-
465
- /**
466
- * Includes and enqueues scripts and styles for coupons
467
- *
468
- * @uses wp_enqueue_style() Includes and prints styles for WPEC in the WordPress admin
469
- * @uses wp_enqueue_script() Includes and prints scripts for WPEC in the WordPress admin
470
- */
471
  function wpsc_admin_include_coupon_js() {
472
 
473
  // Variables
474
- $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
475
-
476
- // global js
477
- _wpsc_enqueue_wp_e_commerce_admin();
478
 
479
  // Coupon CSS
480
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
481
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
482
 
483
  // Coupon JS
 
484
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
485
- wp_enqueue_script( 'jquery-ui-datepicker' );
486
- wp_enqueue_style( 'jquery-ui-datepicker' );
487
-
488
- wp_enqueue_script( 'wp-e-commerce-admin_legacy', WPSC_URL . '/wpsc-admin/js/admin-legacy.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker' ), $version_identifier );
489
-
490
- $admin_color = get_user_option( 'admin_color' );
491
- $scheme = 'classic' === $admin_color ? $admin_color : 'fresh';
492
-
493
- wp_enqueue_style( 'wpsc-jquery-ui-datepicker', WPSC_URL . '/wpsc-admin/css/jquery.ui.datepicker-' . $scheme . '.css', false, $version_identifier );
494
  }
495
 
496
  /**
497
- * Includes and enqueues scripts and styles for the WPEC options page
498
- *
499
- * @uses wp_enqueue_script() Includes and prints out the JS for the WPEC options page
500
- * @uses wp_localize_script() Sets up the JS vars needed
501
- * @uses _wpsc_create_ajax_nonce() Alias for wp_create_nonce, creates a random one time use token
502
- * @uses get_current_tab_id() Returns the current tab id
503
- * @uses wp_enqueue_style() Includes and prints out the CSS for the WPEC options page
504
  */
505
  function wpsc_admin_include_optionspage_css_and_js() {
506
-
507
- _wpsc_enqueue_wp_e_commerce_admin();
508
-
509
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
 
510
  wp_enqueue_script( 'wp-e-commerce-admin-settings-page', WPSC_URL . '/wpsc-admin/js/settings-page.js', array( 'jquery-query' ), $version_identifier );
511
 
512
  wp_localize_script( 'wp-e-commerce-admin-settings-page', 'WPSC_Settings_Page', array(
@@ -528,12 +387,6 @@ function wpsc_admin_include_optionspage_css_and_js() {
528
  wp_enqueue_style( 'wp-e-commerce-ui-tabs', WPSC_URL . '/wpsc-admin/css/jquery.ui.tabs.css', false, $version_identifier, 'all' );
529
  }
530
 
531
- /**
532
- * Sets up the WPEC metaboxes
533
- *
534
- * @uses remove_meta_box() Removes the default taxonomy meta box so our own can be added
535
- * @uses add_meta_bax() Adds metaboxes to the WordPress admin interface
536
- */
537
  function wpsc_meta_boxes() {
538
  global $post;
539
  $pagename = 'wpsc-product';
@@ -542,37 +395,31 @@ function wpsc_meta_boxes() {
542
  //if a variation page do not show these metaboxes
543
  if ( is_object( $post ) && $post->post_parent == 0 ) {
544
  add_meta_box( 'wpsc_product_variation_forms' , __( 'Variations', 'wpsc' ) , 'wpsc_product_variation_forms' , $pagename, 'normal', 'high' );
 
545
  } else if( is_object( $post ) && $post->post_status == "inherit" ) {
546
  remove_meta_box( 'tagsdiv-product_tag' , 'wpsc-product', 'core' );
 
547
  remove_meta_box( 'wpsc_product_categorydiv' , 'wpsc-product', 'core' );
548
  }
549
 
550
- add_meta_box( 'wpsc_price_control_forms', __('Product Pricing', 'wpsc'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
551
- add_meta_box( 'wpsc_stock_control_forms', __('Stock Inventory', 'wpsc'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
552
  add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wpsc'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
553
- add_meta_box( 'wpsc_product_delivery_forms', __('Product Delivery', 'wpsc'), 'wpsc_product_delivery_forms', $pagename, 'normal', 'high' );
554
- add_meta_box( 'wpsc_product_details_forms', __('Product Details', 'wpsc'), 'wpsc_product_details_forms', $pagename, 'normal', 'high' );
 
 
 
 
555
  }
556
 
557
  add_action( 'admin_footer', 'wpsc_meta_boxes' );
558
  add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
559
-
560
- /**
561
- * Includes the JS and CSS
562
- *
563
- * @param string $pagehook The pagehook for the currently viewing page, provided by the 'admin_enqueue_scripts' action
564
- *
565
- * @uses wp_admin_css() Enqueues or prints a stylesheet in the admin
566
- * @uses wp_enqueue_script() Enqueues the specified script
567
- * @uses wp_localize_script() Sets up the JS vars needed
568
- * @uses wp_enqueue_style() Enqueues the styles
569
- * @uses wp_dequeue_script() Removes a previously enqueued script by handle
570
- * @uses _wpsc_create_ajax_nonce() Alias for wp_create_nonce, creates a random one time use token
571
- */
572
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
573
- global $post_type, $post;
574
 
575
- $current_screen = get_current_screen();
 
576
 
577
  if ( 'dashboard_page_wpsc-sales-logs' == $current_screen->id ) {
578
  // jQuery
@@ -591,11 +438,11 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
591
  $pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
592
 
593
  if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'dashboard_page_wpsc-purchase-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' || $current_screen->id == 'edit-wpsc-variation' || $current_screen->id == 'wpsc-product-variations-iframe' || ( $pagehook == 'media-upload-popup' && get_post_type( $_REQUEST['post_id'] ) == 'wpsc-product' ) ) {
594
-
595
- _wpsc_enqueue_wp_e_commerce_admin();
596
-
597
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
 
598
  wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
 
 
599
  wp_enqueue_script( 'wpsc-sortable-table', WPSC_URL . '/wpsc-admin/js/sortable-table.js', array( 'jquery' ) );
600
 
601
  if ( in_array( $current_screen->id, array( 'wpsc-product', 'edit-wpsc-variation', 'wpsc-product' ) ) ) {
@@ -609,37 +456,22 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
609
  );
610
  }
611
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
612
-
613
- static $_wpsc_admin_l10n_loaded;
614
-
615
- if ( ! $_wpsc_admin_l10n_loaded ) {
616
- // Localize scripts
617
- wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
618
- 'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
619
- 'save_product_order_nonce' => _wpsc_create_ajax_nonce( 'save_product_order' ),
620
- 'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};',
621
- 'empty_coupon' => esc_html__( 'Please enter a coupon code.', 'wpsc' ),
622
- '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' ),
623
- 'wpsc_core_images_url' => WPSC_CORE_IMAGES_URL,
624
- 'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wpsc' ),
625
- /* translators : This string is prepended to the 'New Variation Set' string */
626
- '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' ),
627
- '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' ),
628
- /* translators : These strings are dynamically inserted as a drop-down for the Coupon comparison conditions */
629
- 'coupons_compare_or' => esc_html_x( 'OR' , 'Coupon comparison logic', 'wpsc' ),
630
- 'coupons_compare_and' => esc_html_x( 'AND' , 'Coupon comparison logic', 'wpsc' ),
631
- 'meta_downloads_plural' => __( ' downloads', 'live preview for downloads metabox', 'wpsc' ),
632
- 'meta_downloads_singular' => __( ' download' , 'live preview for downloads metabox', 'wpsc' ),
633
- 'wpsc_inline_css_error' => __( 'It is not possible to enable the inline CSS without also enabling the common CSS.' )
634
- ) );
635
-
636
- $_wpsc_admin_l10n_loaded = true;
637
- }
638
-
639
  }
640
  if ( $pagehook == 'wpsc-product-variations-iframe' ) {
641
- _wpsc_enqueue_wp_e_commerce_admin();
642
-
643
  wp_enqueue_script( 'wp-e-commerce-product-variations', WPSC_URL . '/wpsc-admin/js/product-variations.js', array( 'jquery' ), $version_identifier );
644
  wp_localize_script( 'wp-e-commerce-product-variations', 'WPSC_Product_Variations', array(
645
  'product_id' => $_REQUEST['product_id'],
@@ -648,11 +480,8 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
648
  }
649
 
650
  if ( $pagehook == 'media-upload-popup' ) {
651
-
652
  $post = get_post( $_REQUEST['post_id'] );
653
  if ( $post->post_type == 'wpsc-product' && $post->post_parent ) {
654
- _wpsc_enqueue_wp_e_commerce_admin();
655
-
656
  wp_dequeue_script( 'set-post-thumbnail' );
657
  wp_enqueue_script( 'wpsc-set-post-thumbnail', WPSC_URL . '/wpsc-admin/js/set-post-thumbnail.js', array( 'jquery', 'wp-e-commerce-admin' ), $version_identifier );
658
  wp_localize_script( 'wpsc-set-post-thumbnail', 'WPSC_Set_Post_Thumbnail', array(
@@ -669,97 +498,114 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
669
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
670
  }
671
 
 
 
 
 
 
672
 
673
- /**
674
- * Adds admin javascript to the wp-e-commerce-admin javascript
675
- *
676
- * @since 3.8.14
677
- *
678
- * @param array array containing key value pairs, keys are turned into javascript globals with thier associated values
679
- *
680
- */
681
- function _wpsc_admin_localizations( $localizations ) {
682
-
683
- $hidden_boxes = get_option( 'wpsc_hidden_box' );
684
- $hidden_boxes = implode( ',', (array)$hidden_boxes );
685
 
686
- $form_types_option = get_option( 'wpsc_checkout_form_fields' );
687
- if ( ! $form_types_option || ! is_array( $form_types_option ) ) {
688
- $form_types_option = array();
689
- }
690
-
691
- $unique_names_option = get_option( 'wpsc_checkout_unique_names' );
692
- if ( ! $unique_names_option || ! is_array( $unique_names_option ) ) {
693
- $unique_names_option = array();
694
- }
695
 
696
  $form_types = '';
697
- foreach ( $form_types_option as $form_type ) {
698
- $form_types .= '<option value="' . $form_type . '">' . $form_type . '</option>';
699
  }
700
 
701
- $unique_names = '<option value="-1">' . __( 'Select a Unique Name', 'wpsc' ) . '</option>';
702
- foreach ( $unique_names_option as $unique_name ) {
703
- $unique_names .= '<option value="' . $unique_name . '">' . $unique_name . '</option>';
704
  }
705
 
706
- $localizations['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
707
- $localizations['hidden_boxes'] = '"' . esc_js( $hidden_boxes ) . '"';
708
- $localizations['IS_WP27'] = '"' . esc_js( IS_WP27 ) . '"';
709
- $localizations['TXT_WPSC_DELETE'] = '"' . esc_js( __( 'Delete', 'wpsc' ) ) . '"';
710
- $localizations['TXT_WPSC_TEXT'] = '"' . esc_js( __( 'Text', 'wpsc' ) ) . '"';
711
- $localizations['TXT_WPSC_EMAIL'] = '"' . esc_js( __( 'Email', 'wpsc' ) ) . '"';
712
- $localizations['TXT_WPSC_COUNTRY'] = '"' . esc_js( __( 'Country', 'wpsc' ) ) . '"';
713
- $localizations['TXT_WPSC_TEXTAREA'] = '"' . esc_js( __( 'Textarea', 'wpsc' ) ) . '"';
714
- $localizations['TXT_WPSC_HEADING'] = '"' . esc_js( __( 'Heading', 'wpsc' ) ) . '"';
715
- $localizations['TXT_WPSC_COUPON'] = '"' . esc_js( __( 'Coupon', 'wpsc' ) ) . '"';
716
-
717
- $localizations['HTML_FORM_FIELD_TYPES'] = '"' . esc_js( $form_types ) . '"';
718
- $localizations['HTML_FORM_FIELD_UNIQUE_NAMES'] = '"' . esc_js( $unique_names ) . '"';
719
-
720
- $localizations['TXT_WPSC_LABEL'] = '"' . esc_js( __( 'Label', 'wpsc' ) ) . '"';
721
- $localizations['TXT_WPSC_LABEL_DESC'] = '"' . esc_js( __( 'Label Description', 'wpsc' ) ) . '"';
722
- $localizations['TXT_WPSC_ITEM_NUMBER'] = '"' . esc_js( __( 'Item Number', 'wpsc' ) ) . '"';
723
- $localizations['TXT_WPSC_LIFE_NUMBER'] = '"' . esc_js( __( 'Life Number', 'wpsc' ) ) . '"';
724
- $localizations['TXT_WPSC_PRODUCT_CODE'] = '"' . esc_js( __( 'Product Code', 'wpsc' ) ) . '"';
725
- $localizations['TXT_WPSC_PDF'] = '"' . esc_js( __( 'PDF', 'wpsc' ) ) . '"';
726
-
727
- $localizations['TXT_WPSC_AND_ABOVE'] = '"' . esc_js( __( ' and above', 'wpsc' ) ) . '"';
728
- $localizations['TXT_WPSC_IF_PRICE_IS'] = '"' . esc_js( __( 'If price is ', 'wpsc' ) ) . '"';
729
- $localizations['TXT_WPSC_IF_WEIGHT_IS'] = '"' . esc_js( __( 'If weight is ', 'wpsc' ) ) . '"';
730
-
731
- // we only want to add these localizations once, it should happen on the first admin script load
732
- remove_filter( 'wpsc_javascript_localizations', '_wpsc_admin_localizations', 1 );
733
-
734
- return $localizations;
 
 
 
 
 
 
 
 
 
 
 
 
735
  }
736
 
737
- /*
738
- * Enqueue the admin script that applies to applies to all wpsc admin pages
739
- */
740
- function _wpsc_enqueue_wp_e_commerce_admin( ) {
741
- static $already_enqueued = false;
742
- if ( ! $already_enqueued ) {
743
- $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
744
- wp_enqueue_script( 'wp-e-commerce-admin-js', WPSC_URL . '/wpsc-admin/js/wp-e-commerce-admin.js', false, false, $version_identifier );
745
- wp_localize_script( 'wp-e-commerce-admin-js', 'wpsc_admin_vars', wpsc_javascript_localizations() );
746
- $already_enqueued = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
747
  }
 
 
 
 
 
748
  }
749
 
750
  add_action( 'admin_menu', 'wpsc_admin_pages' );
751
 
752
- /**
753
- * Displays latest activity in the Dashboard widget
754
- *
755
- * @uses $wpdb WordPress database object for queries
756
- * @uses get_var() Returns single variable from the database
757
- * @uses esc_html__() Gets translation of $text and escapes it for HTML output
758
- * @uses wpsc_currency_display() Displays the currency
759
- * @uses admin_display_total_price() Displays the total price
760
- * @uses esc_html_x()
761
- * @uses _n() Retrieves the singular or plural version
762
- */
763
  function wpsc_admin_latest_activity() {
764
  global $wpdb;
765
  $totalOrders = $wpdb->get_var( "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "`" );
@@ -830,19 +676,16 @@ function wpsc_admin_latest_activity() {
830
  echo "</div>";
831
  echo "<div style='clear:both'></div>";
832
  }
 
833
  add_action( 'wpsc_admin_pre_activity', 'wpsc_admin_latest_activity' );
834
 
 
835
  /*
836
  * Dashboard Widget Setup
837
  * Adds the dashboard widgets if the user is an admin
838
- *
839
  * Since 3.6
840
- *
841
- * @uses wp_enqueue_style() Enqueues CSS
842
- * @uses wp_enqueue_script() Enqueues JS
843
- * @uses wp_add_dashboard_widget() Adds a new widget to the WordPress admin dashboard
844
- * @uses current_user_can() Checks the capabilities of the current user
845
  */
 
846
  function wpsc_dashboard_widget_setup() {
847
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
848
  // Enqueue the styles and scripts necessary
@@ -856,7 +699,7 @@ function wpsc_dashboard_widget_setup() {
856
 
857
  // Add the dashboard widgets
858
  if ( current_user_can( $news_cap ) )
859
- wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'WP eCommerce News' , 'wpsc' ), 'wpsc_dashboard_news' );
860
  if ( current_user_can( $sales_cap ) )
861
  wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
862
  if ( current_user_can( $quarterly_sales_cap ) )
@@ -866,10 +709,7 @@ function wpsc_dashboard_widget_setup() {
866
 
867
  // Sort the Dashboard widgets so ours it at the top
868
  global $wp_meta_boxes;
869
- $boxes = $wp_meta_boxes['dashboard'];
870
- $normal = isset( $wp_meta_boxes['dashboard']['normal'] ) ? $wp_meta_boxes['dashboard']['normal'] : array();
871
-
872
- $normal_dashboard = isset( $normal['core'] ) ? $normal['core'] : array();
873
 
874
  // Backup and delete our new dashbaord widget from the end of the array
875
  $wpsc_widget_backup = array();
@@ -904,33 +744,19 @@ function wpsc_dashboard_widget_setup() {
904
 
905
  add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
906
 
907
- /**
908
- * Shows the RSS feed for the WPEC dashboard widget
909
- *
910
- * @uses fetch_feed() Build SimplePie object based on RSS or Atom feed from URL.
911
- * @uses wp_widget_rss_output() Display the RSS entries in a list
912
- */
913
  function wpsc_dashboard_news() {
914
- $rss = fetch_feed( 'http://wpecommerce.org/feed/?category_name=news' );
915
- $args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items' => 3 );
916
  wp_widget_rss_output( $rss, $args );
917
 
918
  }
919
 
920
- /**
921
- * Gets the quarterly summary of revenue
922
- *
923
- * @uses get_option() Retrieves an option from the WordPress database
924
- * @uses admin_display_total_price() Displays the total price
925
- *
926
- * @return array The array of prices
927
- */
928
  function wpsc_get_quarterly_summary() {
929
- $firstquarter = (int)get_option( 'wpsc_first_quart' );
930
- $secondquarter = (int)get_option( 'wpsc_second_quart' );
931
- $thirdquarter = (int)get_option( 'wpsc_third_quart' );
932
- $fourthquarter = (int)get_option( 'wpsc_fourth_quart' );
933
- $finalquarter = (int)get_option( 'wpsc_final_quart' );
934
 
935
  $results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
936
  $results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
@@ -939,12 +765,6 @@ function wpsc_get_quarterly_summary() {
939
  return $results;
940
  }
941
 
942
- /**
943
- * Called by wp_add_dashboard_widget and ads the quarterly revenue reports to the WordPress admin dashboard
944
- *
945
- * @uses get_option() Gets the specified option from database
946
- * @uses esc_html_e() Displays translated text that has been escaped for safe use in HTML
947
- */
948
  function wpsc_quarterly_dashboard_widget() {
949
  if ( get_option( 'wpsc_business_year_start' ) == false ) {
950
  ?>
@@ -1030,12 +850,7 @@ function wpsc_quarterly_dashboard_widget() {
1030
  }
1031
  }
1032
 
1033
- /**
1034
- * Called by wp_add_dashboard_widget to add the WPSC dashboard widget
1035
- *
1036
- * @uses do_action() Calls 'wpsc_admin_pre_activity'
1037
- * @uses do_action() Calls 'wpsc_admin_post_activity'
1038
- */
1039
  function wpsc_dashboard_widget() {
1040
  do_action( 'wpsc_admin_pre_activity' );
1041
  do_action( 'wpsc_admin_post_activity' );
@@ -1048,12 +863,8 @@ function wpsc_dashboard_widget() {
1048
 
1049
  /*
1050
  * Dashboard Widget Last Four Month Sales.
1051
- *
1052
- * @uses $wpdb WordPress database object for queries
1053
- * @uses get_results() Gets generic multiple row results from the WordPress database
1054
- * @uses get_var() Returns a single variable from the database
1055
- * @uses wpsc_currency_display() Returns the currency with the display options applied
1056
  */
 
1057
  function wpsc_dashboard_4months_widget() {
1058
  global $wpdb;
1059
 
@@ -1083,7 +894,7 @@ function wpsc_dashboard_4months_widget() {
1083
  $timeranges[2]["start"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
1084
  $timeranges[2]["end"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
1085
  $timeranges[3]["start"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
1086
- $timeranges[3]["end"] = time(); // using mktime here can generate a php runtime warning
1087
 
1088
  $prod_data = array( );
1089
  foreach ( (array)$products as $product ) { //run through products and get each product income amounts and name
@@ -1137,12 +948,6 @@ function wpsc_dashboard_4months_widget() {
1137
 
1138
  //Modification to allow for multiple column layout
1139
 
1140
- /**
1141
- * @todo docs
1142
- * @param $columns
1143
- * @param $screen
1144
- * @return mixed
1145
- */
1146
  function wpec_two_columns( $columns, $screen ) {
1147
  if ( $screen == 'toplevel_page_wpsc-edit-products' )
1148
  $columns['toplevel_page_wpsc-edit-products'] = 2;
@@ -1151,46 +956,60 @@ function wpec_two_columns( $columns, $screen ) {
1151
  }
1152
  add_filter( 'screen_layout_columns', 'wpec_two_columns', 10, 2 );
1153
 
1154
- /**
1155
- * @todo docs
1156
- * @param $actions
1157
- * @return mixed
1158
- */
1159
  function wpsc_fav_action( $actions ) {
1160
  $actions['post-new.php?post_type=wpsc-product'] = array( 'New Product', 'manage_options' );
1161
  return $actions;
1162
  }
1163
  add_filter( 'favorite_actions', 'wpsc_fav_action' );
1164
 
 
 
 
 
 
1165
  /**
1166
- * Enqueue the admin scripts
1167
  *
1168
- * @uses wp_enqueue_script() Enqueues scripts
1169
- * @uses home_url() Returns the base url for the site
1170
  */
1171
- function wpsc_print_admin_scripts() {
1172
- $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
1173
- wp_enqueue_script( 'wp-e-commerce-admin', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array( 'jquery' ), $version_identifier );
1174
- wp_localize_script( 'wp-e-commerce-admin', 'wpsc_ajax', wpsc_javascript_localizations() );
 
 
 
 
 
 
 
1175
  }
1176
 
1177
  /**
1178
- * wpsc_ajax_ie_save save changes made using inline edit
 
1179
  *
1180
- * @since 3.8
1181
- * @access public
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1182
  *
1183
- * @uses get_post_type_object() Gets post object for given registered post type name
1184
- * @uses current_user_can() Checks the capabilities of the current user
1185
- * @uses absint() Converts to a nonnegative integer
1186
- * @uses get_post() Gets the post object given post id
1187
- * @uses wp_get_object_terms() Gets terms for given post object
1188
- * @uses wp_update_post() Updates the post in the database
1189
- * @uses get_product_meta() An alias for get_post_meta prefixes with the WPSC key
1190
- * @uses wpsc_convert_weight() Converts to weight format specified by user
1191
- * @uses json_encode() Encodes array for JS
1192
- * @uses esc_js() Escape single quotes, htmlspecialchar " < > &, and fix line endings.
1193
  *
 
1194
  * @returns nothing
1195
  */
1196
  function wpsc_ajax_ie_save() {
@@ -1205,7 +1024,7 @@ function wpsc_ajax_ie_save() {
1205
  $id = absint( $_POST['id'] );
1206
  $post = get_post( $_POST['id'] );
1207
  $parent = get_post( $post->post_parent );
1208
- $terms = wpsc_get_product_terms( $id, 'wpsc-variation', 'name' );
1209
 
1210
  $product = array(
1211
  'ID' => $_POST['id'],
@@ -1247,11 +1066,6 @@ function wpsc_ajax_ie_save() {
1247
  die();
1248
  }
1249
 
1250
- /**
1251
- * @todo docs
1252
- *
1253
- * @uses add_meta_box Allows addition of metaboxes to the wpsc_add_meta_boxes admin
1254
- */
1255
  function wpsc_add_meta_boxes(){
1256
  add_meta_box( 'dashboard_right_now', __( 'Current Month', 'wpsc' ), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
1257
  }
@@ -1260,15 +1074,9 @@ function wpsc_add_meta_boxes(){
1260
  * Displays notice if user has Great Britain selected as their base country
1261
  * Since 3.8.9, we have deprecated Great Britain in favor of the UK
1262
  *
1263
- * @since 3.8.9
1264
- * @access private
1265
  * @link http://code.google.com/p/wp-e-commerce/issues/detail?id=1079
1266
- *
1267
- * @uses get_option() Retrieves option from the WordPress database
1268
- * @uses get_outdate_isocodes() Returns outdated isocodes
1269
- * @uses admin_url() Returns admin_url of the site
1270
- *
1271
- * @return string The admin notices for deprecated countries
1272
  */
1273
  function _wpsc_action_admin_notices_deprecated_countries_notice() {
1274
  $base_country = get_option( 'base_country' );
@@ -1281,12 +1089,12 @@ function _wpsc_action_admin_notices_deprecated_countries_notice() {
1281
  $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' );
1282
  break;
1283
  case 'UK':
1284
- $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' );
1285
  break;
1286
  case 'AN':
1287
  $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' );
1288
  case 'TP':
1289
- $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' );
1290
  break;
1291
  }
1292
 
@@ -1299,27 +1107,13 @@ function _wpsc_action_admin_notices_deprecated_countries_notice() {
1299
  echo '<div id="wpsc-warning" class="error"><p>' . $message . '</p></div>';
1300
  }
1301
 
1302
- add_action( 'admin_notices' , '_wpsc_action_admin_notices_deprecated_countries_notice' );
1303
- add_action( 'wp_ajax_category_sort_order' , 'wpsc_ajax_set_category_order' );
 
1304
  add_action( 'wp_ajax_variation_sort_order', 'wpsc_ajax_set_variation_order' );
1305
- add_action( 'wp_ajax_wpsc_ie_save' , 'wpsc_ajax_ie_save' );
1306
- add_action( 'in_admin_header' , 'wpsc_add_meta_boxes' );
1307
 
1308
- /**
1309
- * Deletes file associated with a product.
1310
- *
1311
- * @access private
1312
- *
1313
- * @uses $wpdb WordPress database object for queries
1314
- * @uses prepare() Prepares a database query by escaping
1315
- * @uses wp_delete_post() Removes a post attachment or page*
1316
- *
1317
- * @param int $product_id req The id of the product
1318
- * @param string $file_name req The string
1319
- *
1320
- * @return mixed
1321
- *
1322
- */
1323
  function _wpsc_delete_file( $product_id, $file_name ) {
1324
  global $wpdb;
1325
 
@@ -1328,31 +1122,18 @@ function _wpsc_delete_file( $product_id, $file_name ) {
1328
  return wp_delete_post( $product_id_to_delete, true );
1329
  }
1330
 
1331
- /**
1332
- * Duplicates a product
1333
- *
1334
- * @uses wp_insert_post() Inserts a new post to the database
1335
- * @uses wpsc_duplicate_taxonomies() Copy the taxonomies of a post to another post
1336
- * @uses wpsc_duplicate_product_meta() Copy the metadata of a post to another post
1337
- * @uses wpsc_duplicate_children() Copy the children of the product
1338
- *
1339
- * @param object $post req The post object
1340
- * @param bool $new_parent_id opt The parent post id
1341
- *
1342
- * @return int|WP_Error New post id or error
1343
- */
1344
  function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
1345
- $new_post_date = $post->post_date;
1346
  $new_post_date_gmt = get_gmt_from_date( $new_post_date );
1347
 
1348
- $new_post_type = $post->post_type;
1349
- $post_content = $post->post_content;
1350
- $post_content_filtered = $post->post_content_filtered;
1351
- $post_excerpt = $post->post_excerpt;
1352
- $post_title = sprintf( __( '%s (Duplicate)', 'wpsc' ), $post->post_title );
1353
- $post_name = $post->post_name;
1354
- $comment_status = $post->comment_status;
1355
- $ping_status = $post->ping_status;
1356
 
1357
  $defaults = array(
1358
  'post_status' => $post->post_status,
@@ -1360,7 +1141,7 @@ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
1360
  'ping_status' => $ping_status,
1361
  'post_parent' => $new_parent_id ? $new_parent_id : $post->post_parent,
1362
  'menu_order' => $post->menu_order,
1363
- 'to_ping' => $post->to_ping,
1364
  'pinged' => $post->pinged,
1365
  'post_excerpt' => $post_excerpt,
1366
  'post_title' => $post_title,
@@ -1373,8 +1154,6 @@ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
1373
  if ( 'attachment' == $post->post_type )
1374
  $defaults['guid'] = $post->guid;
1375
 
1376
- $defaults = stripslashes_deep( $defaults );
1377
-
1378
  // Insert the new template in the post table
1379
  $new_post_id = wp_insert_post($defaults);
1380
 
@@ -1384,8 +1163,6 @@ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
1384
  // Copy the meta information
1385
  wpsc_duplicate_product_meta( $post->ID, $new_post_id );
1386
 
1387
- do_action( 'wpsc_duplicate_product', $post, $new_post_id );
1388
-
1389
  // Finds children (Which includes product files AND product images), their meta values, and duplicates them.
1390
  wpsc_duplicate_children( $post->ID, $new_post_id );
1391
 
@@ -1394,35 +1171,19 @@ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
1394
 
1395
  /**
1396
  * Copy the taxonomies of a post to another post
1397
- *
1398
- * @uses get_object_taxonomies() Gets taxonomies for the give object
1399
- * @uses wp_get_object_terms() Gets terms for the taxonomies
1400
- * @uses wp_set_object_terms() Sets the terms for a post object
1401
- *
1402
- * @param int $id req ID of the post we are duping
1403
- * @param int $new_id req ID of the new post
1404
- * @param string $post_type req The post type we are setting
1405
  */
1406
  function wpsc_duplicate_taxonomies( $id, $new_id, $post_type ) {
1407
  $taxonomies = get_object_taxonomies( $post_type ); //array("category", "post_tag");
1408
  foreach ( $taxonomies as $taxonomy ) {
1409
- $post_terms = wpsc_get_product_terms( $id, $taxonomy );
1410
- foreach ( $post_terms as $post_term ) {
1411
- wp_set_object_terms( $new_id, $post_term->slug, $taxonomy, true );
1412
  }
1413
  }
1414
  }
1415
 
1416
  /**
1417
  * Copy the meta information of a post to another post
1418
- *
1419
- * @uses $wpdb WordPress database object for queries
1420
- * @uses get_results() Gets generic multirow results from the database
1421
- * @uses prepare() Prepares a database query making it safe
1422
- * @uses query() Runs an SQL query
1423
- *
1424
- * @param int $id req ID of the post we are duping
1425
- * @param int $new_id req ID of the new post
1426
  */
1427
  function wpsc_duplicate_product_meta( $id, $new_id ) {
1428
  global $wpdb;
@@ -1445,23 +1206,15 @@ function wpsc_duplicate_product_meta( $id, $new_id ) {
1445
  $sql_query.= implode( ",", $sql_query_sel );
1446
  $sql_query = $wpdb->prepare( $sql_query, $values );
1447
  $wpdb->query( $sql_query );
1448
- clean_post_cache( $new_id );
1449
  }
1450
-
1451
  }
1452
 
1453
  /**
1454
  * Duplicates children product and children meta
1455
- *
1456
- * @uses get_posts() Gets an array of posts given array of arguments
1457
- * @uses wpsc_duplicate_product_process() Duplicates product
1458
- *
1459
- * @param int $old_parent_id req Post id for old parent
1460
- * @param int $new_parenc_id req Post id for the new parent
1461
  */
1462
  function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
1463
 
1464
- // Get children products and duplicate them
1465
  $child_posts = get_posts( array(
1466
  'post_parent' => $old_parent_id,
1467
  'post_type' => 'any',
@@ -1470,235 +1223,25 @@ function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
1470
  'order' => 'ASC',
1471
  ) );
1472
 
1473
- foreach ( $child_posts as $child_post ) {
1474
-
1475
- // Duplicate product images and child posts
1476
- if ( 'attachment' == get_post_type( $child_post ) ) {
1477
- wpsc_duplicate_product_image_process( $child_post, $new_parent_id );
1478
- } else {
1479
- wpsc_duplicate_product_process( $child_post, $new_parent_id );
1480
- }
1481
-
1482
- do_action( 'wpsc_duplicate_product_child', $child_post, $new_parent_id );
1483
-
1484
- }
1485
-
1486
- }
1487
-
1488
- /**
1489
- * Duplicates a product image.
1490
- *
1491
- * Uses a portion of code from media_sideload_image() in `wp-admin/includes/media.php`
1492
- * to check file before downloading from URL.
1493
- *
1494
- * @since 3.9.0
1495
- *
1496
- * @uses get_post_type() Gets post type.
1497
- * @uses wp_get_attachment_url() Gets attachment URL.
1498
- * @uses download_url() Download file from URl to temp location.
1499
- * @uses is_wp_error() Is WP error?
1500
- * @uses media_handle_sideload() Handle creation of new attachment and attach to post.
1501
- *
1502
- * @param object $post The post object.
1503
- * @param bool $new_parent_id Optional. The parent post id.
1504
- * @return int Attachment ID.
1505
- */
1506
- function wpsc_duplicate_product_image_process( $child_post, $new_parent_id ) {
1507
-
1508
- if ( 'attachment' == get_post_type( $child_post ) && apply_filters( 'wpsc_duplicate_product_attachment', true, $child_post ) ) {
1509
-
1510
- $file = wp_get_attachment_url( $child_post->ID );
1511
-
1512
- if ( ! empty( $file ) ) {
1513
-
1514
- // Set variables for storage, fix file filename for query strings.
1515
- preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
1516
- $file_array = array();
1517
- $file_array['name'] = basename( $matches[0] );
1518
-
1519
- // Download file to temp location.
1520
- $file_array['tmp_name'] = download_url( $file );
1521
-
1522
- // If error storing temporarily, return the error.
1523
- if ( is_wp_error( $file_array['tmp_name'] ) ) {
1524
- return $file_array['tmp_name'];
1525
- }
1526
-
1527
- // Do the validation and storage stuff.
1528
- $id = media_handle_sideload( $file_array, $new_parent_id );
1529
-
1530
- // If error storing permanently, unlink.
1531
- if ( is_wp_error( $id ) ) {
1532
- @unlink( $file_array['tmp_name'] );
1533
- }
1534
-
1535
- // Re-attribute featured image
1536
- if ( has_post_thumbnail( $new_parent_id ) && $child_post->ID == get_post_thumbnail_id( $new_parent_id ) ) {
1537
- set_post_thumbnail( $new_parent_id, $id );
1538
- }
1539
-
1540
- // Copy attachment data
1541
- $post_data = array(
1542
- 'ID' => $id,
1543
- 'post_content' => $child_post->post_content,
1544
- 'post_title' => $child_post->post_title,
1545
- 'post_excerpt' => $child_post->post_excerpt,
1546
- 'post_status' => $child_post->post_status,
1547
- 'comment_status' => $child_post->comment_status,
1548
- 'ping_status' => $child_post->ping_status,
1549
- 'post_password' => $child_post->post_password,
1550
- 'post_content_filtered' => $child_post->post_content_filtered,
1551
- 'menu_order' => $child_post->menu_order
1552
- );
1553
-
1554
- wp_update_post( $post_data );
1555
-
1556
- // Copy alt text
1557
- update_post_meta( $id, '_wp_attachment_image_alt', get_post_meta( $child_post->ID, '_wp_attachment_image_alt', true ) );
1558
-
1559
- return $id;
1560
-
1561
- }
1562
-
1563
- }
1564
 
1565
  }
1566
 
1567
- /**
1568
- * @todo docs
1569
- * @access private
1570
- *
1571
- * @uses add_query_arg() Adds argument to the WordPress query
1572
- * @uses update_option() Updates an option in the WordPress database given string and value
1573
- * @uses get_option() Gets option from the database given string
1574
- */
1575
  function _wpsc_admin_notices_3dot8dot9() {
1576
- $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>';
1577
  $message .= "\n<p>" . __( '<a href="%2$s">Hide this warning</a>', 'wpsc' ) . '</p>';
1578
  $message = sprintf(
1579
  $message,
1580
- 'https://wpecommerce.org/wp-e-commerce-3-8-9-compatibility-issues/',
1581
- add_query_arg( 'dismiss_389_upgrade_notice', 1 )
1582
  );
1583
 
1584
  echo '<div id="wpsc-3.8.9-notice" class="error">' . $message . '</div>';
1585
  }
1586
 
1587
- if ( isset( $_REQUEST['dismiss_389_upgrade_notice'] ) || version_compare( WPSC_VERSION, '3.8.10', '>=' ) )
1588
  update_option( 'wpsc_hide_3.8.9_notices', true );
1589
 
1590
  if ( ! get_option( 'wpsc_hide_3.8.9_notices' ) )
1591
- add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot9' );
1592
-
1593
- /**
1594
- * Checks to ensure that shipping is enabled, and one or both of the shipping/billing states are not displayed.
1595
- * If those condtions are met, and the user has not previously dismissed the notice, then we notify them
1596
- * that the shipping calculator now depend on those fields.
1597
- *
1598
- * @access private
1599
- *
1600
- * @uses add_query_arg() Adds argument to the WordPress query
1601
- * @uses update_option() Updates an option in the WordPress database given string and value
1602
- * @uses get_option() Gets option from the database given string
1603
- */
1604
- function _wpsc_admin_notices_3_8_14_1() {
1605
-
1606
- if ( get_option( 'do_not_use_shipping' ) ) {
1607
- return;
1608
- }
1609
-
1610
- global $wpdb;
1611
-
1612
- $state_visibility = $wpdb->get_var( "SELECT COUNT(active) FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE unique_name IN ( 'billingstate', 'shippingstate' ) AND active = '1'" );
1613
-
1614
- if ( '2' === $state_visibility ) {
1615
- return;
1616
- }
1617
-
1618
- $message = '<p>' . __( 'WP eCommerce has been updated, please confirm the checkout field display
1619
- settings are correct for your store.<br><br><i>The visibility of the checkout billing and shipping
1620
- drop downs that show states and provinces is now controlled by the "billingstate" and "shippingstate"
1621
- options set in the <b>Store Settings</b> on the <b>Checkout</b> tab. Prior versions used
1622
- the "billingcountry" and "shippingcountry" settings to control the visibility of the drop downs.</i>' , 'wpsc' ) . '</p>';
1623
- $message .= "\n<p>" . __( '<a href="%s">Hide this warning</a>', 'wpsc' ) . '</p>';
1624
- $message = sprintf(
1625
- $message,
1626
- add_query_arg( 'dismiss_3_8_14_1_upgrade_notice', 1 )
1627
- );
1628
-
1629
- echo '<div id="wpsc-3-8-14-1-notice" class="error">' . $message . '</div>';
1630
- }
1631
-
1632
- if ( isset( $_REQUEST['dismiss_3_8_14_1_upgrade_notice'] ) || version_compare( WPSC_VERSION, '3.9', '>=' ) ) {
1633
- update_option( 'wpsc_hide_3_8_14_1_notices', true );
1634
- }
1635
-
1636
- if ( ! get_option( 'wpsc_hide_3_8_14_1_notices' ) )
1637
- add_action( 'admin_notices', '_wpsc_admin_notices_3_8_14_1' );
1638
-
1639
- /**
1640
- * @todo docs
1641
- * @access private
1642
- *
1643
- * @uses add_query_arg() Adds argument to the WordPress query
1644
- * @uses update_option() Updates an option in the WordPress database given string and value
1645
- * @uses get_option() Gets option from the database given string
1646
- */
1647
- function _wpsc_admin_notices_3dot8dot11() {
1648
- $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>';
1649
- $message .= "\n<p>" . __( '<a href="%4$s">Hide this warning</a>', 'wpsc' ) . '</p>';
1650
- $message = sprintf(
1651
- $message,
1652
- WPSC_VERSION,
1653
- 'https://github.com/wp-e-commerce/WP-e-Commerce/issues/359',
1654
- 'http://docs.wpecommerce.org/documentation/3-8-11-user-logs',
1655
- add_query_arg( 'dismiss_3811_upgrade_notice', 1 )
1656
- );
1657
-
1658
- echo '<div id="wpsc-3.8.11-notice" class="error">' . $message . '</div>';
1659
- }
1660
-
1661
- if ( isset( $_REQUEST['dismiss_3811_upgrade_notice'] ) )
1662
- update_option( '_wpsc_3811_user_log_notice', false );
1663
-
1664
- if ( get_option( '_wpsc_3811_user_log_notice' ) )
1665
- add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot11' );
1666
-
1667
- function _wpsc_notify_google_checkout_deprecation() {
1668
- $gateways = get_option( 'custom_gateway_options', array() );
1669
-
1670
- if ( false !== ( $key = array_search( 'google', $gateways ) ) ) {
1671
- unset( $gateways[ $key ] );
1672
- }
1673
-
1674
- if ( empty( $gateways ) ) {
1675
- $gateways[] = 'wpsc_merchant_testmode';
1676
- }
1677
-
1678
- update_option( 'custom_gateway_options', $gateways );
1679
-
1680
- $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>';
1681
-
1682
- echo '<div id="wpsc-3.8.11-notice" class="error">' . $message . '</div>';
1683
- }
1684
-
1685
- if ( in_array( 'google', get_option( 'custom_gateway_options', array() ) ) ) {
1686
- add_action( 'admin_notices', '_wpsc_notify_google_checkout_deprecation' );
1687
- }
1688
-
1689
- /**
1690
- * Adds links to premium support and documentation on WPeCommerce.org
1691
- *
1692
- * @since 3.9.0
1693
- *
1694
- * @param array $links Original links
1695
- * @return array $links Updated links
1696
- */
1697
- function wpsc_support_links( $links ) {
1698
- $links[] = sprintf( '<a href="%s">%s</a>', _x( 'https://wpecommerce.org/premium-support/', 'Premium Support URL', 'wpsc' ), __( 'Premium Support', 'wpsc' ) );
1699
- $links[] = sprintf( '<a href="%s">%s</a>', _x( 'http://docs.wpecommerce.org/', 'Documentation URL', 'wpsc' ), __( 'Documentation', 'wpsc' ) );
1700
-
1701
- return $links;
1702
- }
1703
-
1704
- add_filter( 'plugin_action_links_' . WPSC_PLUGIN_BASENAME, 'wpsc_support_links' );
24
  require_once( WPSC_FILE_PATH . '/wpsc-admin/ajax-and-init.php' );
25
  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
 
28
  if ( ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( $_SESSION['wpsc_activate_debug_page'] == true ) ) || ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( constant( 'WPSC_ADD_DEBUG_PAGE' ) == true ) ) )
29
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-debug.page.php' );
32
  $form_sets = array( __( 'Default Checkout Forms', 'wpsc' ) );
33
  update_option( 'wpsc_checkout_form_sets', $form_sets );
34
  }
 
 
 
 
35
  /**
36
  * wpsc_query_vars_product_list sets the ordering for the edit-products page list
 
 
37
  * @access public
38
  *
39
+ * @since 3.8
40
+ * @param $vars (array) - default query arguments
41
+ * @return $vars (array) - modified query arguments
 
42
  */
43
  function wpsc_query_vars_product_list( $vars ){
44
 
57
  }
58
 
59
  /**
60
+ * setting the screen option to between 1 and 999
 
 
61
  * @access public
62
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  * @since 3.8
64
+ * @param $status
65
+ * @param $option (string) name of option being saved
66
+ * @param $value (string) value of option being saved
 
 
 
 
67
  * @return $value after changes...
68
  */
69
  function wpsc_set_screen_option($status, $option, $value){
70
+ if( in_array($option, array ("edit_wpsc_variation_per_page","edit_wpsc_product_per_page" )) ){
71
  if ( "edit_wpsc_variation_per_page" == $option ){
72
  global $user_ID;
73
  update_user_option($user_ID,'edit_wpsc-variation_per_page',$value);
82
  * @access public
83
  *
84
  * @since 3.8
85
+ * @param $per_page (int) number of products per page
86
+ * @param $post_type (string) name of current post type
 
 
 
 
87
  * @return $per_page after changes...
88
  */
89
  function wpsc_drag_and_drop_ordering($per_page, $post_type){
93
  return $per_page;
94
  }
95
  add_filter( 'request', 'wpsc_query_vars_product_list' );
96
+ add_filter('edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
 
97
  /**
98
  * Checks whether to display or hide the update wp-e-commerce link
99
  *
 
100
  * @access public
101
  *
102
+ * @since 3.8
 
103
  * @return boolean true - show link, false- hide link
104
  */
105
  function wpsc_show_update_link() {
123
  *
124
  * If the permissions are changed here, they will likewise need to be changed for the other sections of the admin that either use ajax
125
  * or bypass the normal download system.
 
 
 
 
 
 
 
 
 
 
 
 
126
  */
127
  function wpsc_admin_pages() {
128
 
209
  add_action( 'load-post.php' , 'wpsc_add_help_tabs' );
210
  add_action( 'load-post-new.php' , 'wpsc_add_help_tabs' );
211
  add_action( 'load-edit-tags.php' , 'wpsc_add_help_tabs' );
 
 
 
212
  }
213
 
214
  /**
216
  * add_contextual_help() is supported as well as $screen->add_help_tab().
217
  *
218
  * @since 3.8.8
 
 
 
 
 
219
  */
220
  function wpsc_add_help_tabs() {
221
  $tabs = array(
293
  $content = '<p><strong>' . __( 'For More Information', 'wpsc' ) . '</strong></p>';
294
  $links = array();
295
  foreach( $tab['links'] as $link => $link_title ) {
296
+ $link = 'http://docs.getshopped.org/' . $link;
297
  $links[] = '<a target="_blank" href="' . esc_url( $link ) . '">' . esc_html( $link_title ) . '</a>';
298
  }
299
  $content .= '<p>' . implode( '<br />', $links ) . '</p>';
300
 
301
+ if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
302
+ add_contextual_help( $screen->id, $content );
303
+ } else {
304
+ $screen->add_help_tab( array(
305
+ 'id' => $screen->id . '_help',
306
+ 'title' => $tab['title'],
307
+ 'content' => $content,
308
+ ) );
309
+ }
310
  }
311
  }
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  function wpsc_admin_include_purchase_logs_css_and_js() {
 
 
 
314
  wp_enqueue_script( 'wp-e-commerce-purchase-logs', WPSC_URL . '/wpsc-admin/js/purchase-logs.js', array( 'jquery' ), WPSC_VERSION . '.' . WPSC_MINOR_VERSION );
315
  wp_localize_script( 'wp-e-commerce-purchase-logs', 'WPSC_Purchase_Logs_Admin', array(
316
  'nonce' => wp_create_nonce( 'wpsc_purchase_logs' ),
321
  'sent_message' => _x( 'Email Sent!', 'sending tracking email for purchase log', 'wpsc' ),
322
  'current_view' => empty( $_REQUEST['status'] ) ? 'all' : $_REQUEST['status'],
323
  'current_filter' => empty( $_REQUEST['m'] ) ? '' : $_REQUEST['m'],
324
+ 'current_page' => empty( $_REQUEST['paged']) ? '' : $_REQUEST['paged'],
325
  ) );
 
 
 
 
 
 
 
 
326
  }
327
 
 
 
 
 
 
 
 
328
  function wpsc_load_settings_page() {
329
  require_once('settings-page.php');
330
  WPSC_Settings_Page::get_instance();
331
  }
332
 
 
 
 
 
 
333
  function wpsc_load_purchase_logs_page() {
334
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-list-table-class.php' );
335
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
336
  $page = new WPSC_Purchase_Log_Page();
337
  }
338
 
 
 
 
 
 
339
  function wpsc_display_purchase_logs_page() {
340
  do_action( 'wpsc_display_purchase_logs_page' );
341
  }
342
 
 
 
 
 
 
 
343
  function wpsc_product_log_rss_feed() {
344
+ echo "<link type='application/rss+xml' href='" . esc_url( add_query_arg( array( 'rss' => 'true', 'rss_key' => 'key', 'action' => 'purchase_log', 'type' => 'rss' ), admin_url( 'index.php' ) ) ) . "' title='" . esc_attr( 'WP e-Commerce Purchase Log RSS', 'wpsc' ) . "' rel='alternate' />";
345
  }
 
 
 
 
 
 
 
346
  function wpsc_admin_include_coupon_js() {
347
 
348
  // Variables
349
+ $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
 
 
 
350
 
351
  // Coupon CSS
352
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
353
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
354
 
355
  // Coupon JS
356
+ wp_enqueue_script( 'wp-e-commerce-admin-parameters', admin_url( '/wp-admin/admin.php?wpsc_admin_dynamic_js=true' ), false, $version_identifier );
357
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
358
+ wp_enqueue_script( 'datepicker-ui', WPSC_CORE_JS_URL . '/ui.datepicker.js', array( 'jquery-ui-core' ), $version_identifier );
359
+ wp_enqueue_script( 'wp-e-commerce-admin_legacy', WPSC_URL . '/wpsc-admin/js/admin-legacy.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'datepicker-ui' ), $version_identifier );
 
 
 
 
 
 
 
360
  }
361
 
362
  /**
363
+ * wpsc_admin_include_optionspage_css_and_js function, includes the wpsc_admin CSS and JS for the specific options page
364
+ * No parameters, returns nothing
 
 
 
 
 
365
  */
366
  function wpsc_admin_include_optionspage_css_and_js() {
 
 
 
367
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
368
+ wp_enqueue_script( 'wp-e-commerce-js-ajax', WPSC_URL . '/wpsc-core/js/ajax.js', false, $version_identifier );
369
  wp_enqueue_script( 'wp-e-commerce-admin-settings-page', WPSC_URL . '/wpsc-admin/js/settings-page.js', array( 'jquery-query' ), $version_identifier );
370
 
371
  wp_localize_script( 'wp-e-commerce-admin-settings-page', 'WPSC_Settings_Page', array(
387
  wp_enqueue_style( 'wp-e-commerce-ui-tabs', WPSC_URL . '/wpsc-admin/css/jquery.ui.tabs.css', false, $version_identifier, 'all' );
388
  }
389
 
 
 
 
 
 
 
390
  function wpsc_meta_boxes() {
391
  global $post;
392
  $pagename = 'wpsc-product';
395
  //if a variation page do not show these metaboxes
396
  if ( is_object( $post ) && $post->post_parent == 0 ) {
397
  add_meta_box( 'wpsc_product_variation_forms' , __( 'Variations', 'wpsc' ) , 'wpsc_product_variation_forms' , $pagename, 'normal', 'high' );
398
+ add_meta_box( 'wpsc_product_external_link_forms', __( 'Off Site Product link', 'wpsc' ), 'wpsc_product_external_link_forms', $pagename, 'normal', 'high' );
399
  } else if( is_object( $post ) && $post->post_status == "inherit" ) {
400
  remove_meta_box( 'tagsdiv-product_tag' , 'wpsc-product', 'core' );
401
+ remove_meta_box( 'wpsc_product_external_link_forms', 'wpsc-product', 'core' );
402
  remove_meta_box( 'wpsc_product_categorydiv' , 'wpsc-product', 'core' );
403
  }
404
 
405
+ add_meta_box( 'wpsc_price_control_forms', __('Price Control', 'wpsc'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
406
+ add_meta_box( 'wpsc_stock_control_forms', __('Stock Control', 'wpsc'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
407
  add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wpsc'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
408
+ add_meta_box( 'wpsc_additional_desc', __('Additional Description', 'wpsc'), 'wpsc_additional_desc', $pagename, 'normal', 'high' );
409
+ add_meta_box( 'wpsc_product_download_forms', __('Product Download', 'wpsc'), 'wpsc_product_download_forms', $pagename, 'normal', 'high' );
410
+ add_meta_box( 'wpsc_product_image_forms', __('Product Images', 'wpsc'), 'wpsc_product_image_forms', $pagename, 'normal', 'high' );
411
+ if ( ! empty( $post->ID ) && ! wpsc_product_has_variations( $post->ID ) )
412
+ add_meta_box( 'wpsc_product_shipping_forms', __('Shipping', 'wpsc'), 'wpsc_product_shipping_forms_metabox', $pagename, 'normal', 'high' );
413
+ add_meta_box( 'wpsc_product_advanced_forms', __('Advanced Settings', 'wpsc'), 'wpsc_product_advanced_forms', $pagename, 'normal', 'high' );
414
  }
415
 
416
  add_action( 'admin_footer', 'wpsc_meta_boxes' );
417
  add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
 
 
 
 
 
 
 
 
 
 
 
 
 
418
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
419
+ global $post_type, $current_screen, $post;
420
 
421
+ if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) )
422
+ wp_admin_css( 'dashboard' );
423
 
424
  if ( 'dashboard_page_wpsc-sales-logs' == $current_screen->id ) {
425
  // jQuery
438
  $pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
439
 
440
  if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'dashboard_page_wpsc-purchase-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' || $current_screen->id == 'edit-wpsc-variation' || $current_screen->id == 'wpsc-product-variations-iframe' || ( $pagehook == 'media-upload-popup' && get_post_type( $_REQUEST['post_id'] ) == 'wpsc-product' ) ) {
 
 
 
441
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
442
+ wp_enqueue_script( 'wp-e-commerce-admin-parameters', admin_url( 'admin.php?wpsc_admin_dynamic_js=true' ), false, $version_identifier );
443
  wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
444
+ wp_enqueue_script( 'wp-e-commerce-legacy-ajax', WPSC_URL . '/wpsc-admin/js/ajax.js', false, $version_identifier ); // needs removing
445
+
446
  wp_enqueue_script( 'wpsc-sortable-table', WPSC_URL . '/wpsc-admin/js/sortable-table.js', array( 'jquery' ) );
447
 
448
  if ( in_array( $current_screen->id, array( 'wpsc-product', 'edit-wpsc-variation', 'wpsc-product' ) ) ) {
456
  );
457
  }
458
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
459
+ wp_enqueue_style( 'wp-e-commerce-admin-dynamic', admin_url( "admin.php?wpsc_admin_dynamic_css=true" ), false, $version_identifier, 'all' );
460
+ // Localize scripts
461
+ wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
462
+ 'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
463
+ 'save_product_order_nonce' => _wpsc_create_ajax_nonce( 'save_product_order' ),
464
+ 'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};',
465
+ 'empty_coupon' => esc_html__( 'Please enter a coupon code.', 'wpsc' ),
466
+ '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' ),
467
+ 'wpsc_core_images_url' => WPSC_CORE_IMAGES_URL,
468
+ 'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wpsc' ),
469
+ /* translators : This string is prepended to the 'New Variation Set' string */
470
+ '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' ),
471
+ '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' )
472
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  }
474
  if ( $pagehook == 'wpsc-product-variations-iframe' ) {
 
 
475
  wp_enqueue_script( 'wp-e-commerce-product-variations', WPSC_URL . '/wpsc-admin/js/product-variations.js', array( 'jquery' ), $version_identifier );
476
  wp_localize_script( 'wp-e-commerce-product-variations', 'WPSC_Product_Variations', array(
477
  'product_id' => $_REQUEST['product_id'],
480
  }
481
 
482
  if ( $pagehook == 'media-upload-popup' ) {
 
483
  $post = get_post( $_REQUEST['post_id'] );
484
  if ( $post->post_type == 'wpsc-product' && $post->post_parent ) {
 
 
485
  wp_dequeue_script( 'set-post-thumbnail' );
486
  wp_enqueue_script( 'wpsc-set-post-thumbnail', WPSC_URL . '/wpsc-admin/js/set-post-thumbnail.js', array( 'jquery', 'wp-e-commerce-admin' ), $version_identifier );
487
  wp_localize_script( 'wpsc-set-post-thumbnail', 'WPSC_Set_Post_Thumbnail', array(
498
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
499
  }
500
 
501
+ function wpsc_admin_dynamic_js() {
502
+ header( 'Content-Type: text/javascript' );
503
+ header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
504
+ header( 'Cache-Control: public, must-revalidate, max-age=86400' );
505
+ header( 'Pragma: public' );
506
 
507
+ $siteurl = get_option( 'siteurl' );
508
+ $hidden_boxes = get_option( 'wpsc_hidden_box' );
 
 
 
 
 
 
 
 
 
 
509
 
510
+ $form_types1 = get_option( 'wpsc_checkout_form_fields' );
511
+ $unique_names1 = get_option( 'wpsc_checkout_unique_names' );
 
 
 
 
 
 
 
512
 
513
  $form_types = '';
514
+ foreach ( (array)$form_types1 as $form_type ) {
515
+ $form_types .= "<option value='" . $form_type . "'>" . $form_type . "</option>";
516
  }
517
 
518
+ $unique_names = "<option value='-1'>" . __('Select a Unique Name', 'wpsc') . "</option>";
519
+ foreach ( (array)$unique_names1 as $unique_name ) {
520
+ $unique_names.= "<option value='" . $unique_name . "'>" . $unique_name . "</option>";
521
  }
522
 
523
+ $hidden_boxes = implode( ',', (array)$hidden_boxes );
524
+ echo "var base_url = '" . esc_js( $siteurl ) . "';\n\r";
525
+ echo "var WPSC_URL = '" . esc_js( WPSC_URL ) . "';\n\r";
526
+ echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
527
+ echo "var WPSC_DIR_NAME = '" . esc_js( WPSC_DIR_NAME ) . "';\n\r";
528
+ echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
529
+
530
+ // LightBox Configuration start
531
+ echo "var fileLoadingImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/loading.gif';\n\r";
532
+ echo "var fileBottomNavCloseImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/closelabel.gif';\n\r";
533
+ echo "var fileThickboxLoadingImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/loadingAnimation.gif';\n\r";
534
+
535
+ echo "var resizeSpeed = 9;\n\r";
536
+
537
+ echo "var borderSize = 10;\n\r";
538
+
539
+ echo "var hidden_boxes = '" . esc_js( $hidden_boxes ) . "';\n\r";
540
+ echo "var IS_WP27 = '" . esc_js( IS_WP27 ) . "';\n\r";
541
+ echo "var TXT_WPSC_DELETE = '" . esc_js( __( 'Delete', 'wpsc' ) ) . "';\n\r";
542
+ echo "var TXT_WPSC_TEXT = '" . esc_js( __( 'Text', 'wpsc' ) ) . "';\n\r";
543
+ echo "var TXT_WPSC_EMAIL = '" . esc_js( __( 'Email', 'wpsc' ) ) . "';\n\r";
544
+ echo "var TXT_WPSC_COUNTRY = '" . esc_js( __( 'Country', 'wpsc' ) ) . "';\n\r";
545
+ echo "var TXT_WPSC_TEXTAREA = '" . esc_js( __( 'Textarea', 'wpsc' ) ) . "';\n\r";
546
+ echo "var TXT_WPSC_HEADING = '" . esc_js( __( 'Heading', 'wpsc' ) ) . "';\n\r";
547
+ echo "var TXT_WPSC_COUPON = '" . esc_js( __( 'Coupon', 'wpsc' ) ) . "';\n\r";
548
+
549
+ echo "var HTML_FORM_FIELD_TYPES =\" " . esc_js( $form_types ) . "; \" \n\r";
550
+ echo "var HTML_FORM_FIELD_UNIQUE_NAMES = \" " . esc_js( $unique_names ) . "; \" \n\r";
551
+
552
+ echo "var TXT_WPSC_LABEL = '" . esc_js( __( 'Label', 'wpsc' ) ) . "';\n\r";
553
+ echo "var TXT_WPSC_LABEL_DESC = '" . esc_js( __( 'Label Description', 'wpsc' ) ) . "';\n\r";
554
+ echo "var TXT_WPSC_ITEM_NUMBER = '" . esc_js( __( 'Item Number', 'wpsc' ) ) . "';\n\r";
555
+ echo "var TXT_WPSC_LIFE_NUMBER = '" . esc_js( __( 'Life Number', 'wpsc' ) ) . "';\n\r";
556
+ echo "var TXT_WPSC_PRODUCT_CODE = '" . esc_js( __( 'Product Code', 'wpsc' ) ) . "';\n\r";
557
+ echo "var TXT_WPSC_PDF = '" . esc_js( __( 'PDF', 'wpsc' ) ) . "';\n\r";
558
+
559
+ echo "var TXT_WPSC_AND_ABOVE = '" . esc_js( __( ' and above', 'wpsc' ) ) . "';\n\r";
560
+ echo "var TXT_WPSC_IF_PRICE_IS = '" . esc_js( __( 'If price is ', 'wpsc' ) ) . "';\n\r";
561
+ echo "var TXT_WPSC_IF_WEIGHT_IS = '" . esc_js( __( 'If weight is ', 'wpsc' ) ) . "';\n\r";
562
+
563
+ exit();
564
  }
565
 
566
+ if ( isset( $_GET['wpsc_admin_dynamic_js'] ) && ( $_GET['wpsc_admin_dynamic_js'] == 'true' ) ) {
567
+ add_action( "admin_init", 'wpsc_admin_dynamic_js' );
568
+ }
569
+
570
+ function wpsc_admin_dynamic_css() {
571
+ header( 'Content-Type: text/css' );
572
+ header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
573
+ header( 'Cache-Control: public, must-revalidate, max-age=86400' );
574
+ header( 'Pragma: public' );
575
+ $flash = 0;
576
+ $flash = apply_filters( 'flash_uploader', $flash );
577
+
578
+ if ( $flash = 1 ) {
579
+ ?>
580
+ div.flash-image-uploader {
581
+ display: block;
582
+ }
583
+
584
+ div.browser-image-uploader {
585
+ display: none;
586
+ }
587
+ <?php
588
+ } else {
589
+ ?>
590
+ div.flash-image-uploader {
591
+ display: none;
592
+ }
593
+
594
+ div.browser-image-uploader {
595
+ display: block;
596
+ }
597
+ <?php
598
  }
599
+ exit();
600
+ }
601
+
602
+ if ( isset( $_GET['wpsc_admin_dynamic_css'] ) && ( $_GET['wpsc_admin_dynamic_css'] == 'true' ) ) {
603
+ add_action( "admin_init", 'wpsc_admin_dynamic_css' );
604
  }
605
 
606
  add_action( 'admin_menu', 'wpsc_admin_pages' );
607
 
608
+
 
 
 
 
 
 
 
 
 
 
609
  function wpsc_admin_latest_activity() {
610
  global $wpdb;
611
  $totalOrders = $wpdb->get_var( "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "`" );
676
  echo "</div>";
677
  echo "<div style='clear:both'></div>";
678
  }
679
+
680
  add_action( 'wpsc_admin_pre_activity', 'wpsc_admin_latest_activity' );
681
 
682
+
683
  /*
684
  * Dashboard Widget Setup
685
  * Adds the dashboard widgets if the user is an admin
 
686
  * Since 3.6
 
 
 
 
 
687
  */
688
+
689
  function wpsc_dashboard_widget_setup() {
690
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
691
  // Enqueue the styles and scripts necessary
699
 
700
  // Add the dashboard widgets
701
  if ( current_user_can( $news_cap ) )
702
+ wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'Getshopped News' , 'wpsc' ), 'wpsc_dashboard_news' );
703
  if ( current_user_can( $sales_cap ) )
704
  wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
705
  if ( current_user_can( $quarterly_sales_cap ) )
709
 
710
  // Sort the Dashboard widgets so ours it at the top
711
  global $wp_meta_boxes;
712
+ $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
 
 
 
713
 
714
  // Backup and delete our new dashbaord widget from the end of the array
715
  $wpsc_widget_backup = array();
744
 
745
  add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
746
 
 
 
 
 
 
 
747
  function wpsc_dashboard_news() {
748
+ $rss = fetch_feed( 'http://getshopped.org/category/wp-e-commerce-plugin/' );
749
+ $args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items'=>3 );
750
  wp_widget_rss_output( $rss, $args );
751
 
752
  }
753
 
 
 
 
 
 
 
 
 
754
  function wpsc_get_quarterly_summary() {
755
+ (int)$firstquarter = get_option( 'wpsc_first_quart' );
756
+ (int)$secondquarter = get_option( 'wpsc_second_quart' );
757
+ (int)$thirdquarter = get_option( 'wpsc_third_quart' );
758
+ (int)$fourthquarter = get_option( 'wpsc_fourth_quart' );
759
+ (int)$finalquarter = get_option( 'wpsc_final_quart' );
760
 
761
  $results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
762
  $results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
765
  return $results;
766
  }
767
 
 
 
 
 
 
 
768
  function wpsc_quarterly_dashboard_widget() {
769
  if ( get_option( 'wpsc_business_year_start' ) == false ) {
770
  ?>
850
  }
851
  }
852
 
853
+
 
 
 
 
 
854
  function wpsc_dashboard_widget() {
855
  do_action( 'wpsc_admin_pre_activity' );
856
  do_action( 'wpsc_admin_post_activity' );
863
 
864
  /*
865
  * Dashboard Widget Last Four Month Sales.
 
 
 
 
 
866
  */
867
+
868
  function wpsc_dashboard_4months_widget() {
869
  global $wpdb;
870
 
894
  $timeranges[2]["start"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
895
  $timeranges[2]["end"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
896
  $timeranges[3]["start"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
897
+ $timeranges[3]["end"] = mktime();
898
 
899
  $prod_data = array( );
900
  foreach ( (array)$products as $product ) { //run through products and get each product income amounts and name
948
 
949
  //Modification to allow for multiple column layout
950
 
 
 
 
 
 
 
951
  function wpec_two_columns( $columns, $screen ) {
952
  if ( $screen == 'toplevel_page_wpsc-edit-products' )
953
  $columns['toplevel_page_wpsc-edit-products'] = 2;
956
  }
957
  add_filter( 'screen_layout_columns', 'wpec_two_columns', 10, 2 );
958
 
 
 
 
 
 
959
  function wpsc_fav_action( $actions ) {
960
  $actions['post-new.php?post_type=wpsc-product'] = array( 'New Product', 'manage_options' );
961
  return $actions;
962
  }
963
  add_filter( 'favorite_actions', 'wpsc_fav_action' );
964
 
965
+ function wpsc_print_admin_scripts() {
966
+ $scheme = is_ssl() ? 'https' : 'http';
967
+ wp_enqueue_script( 'wp-e-commerce-dynamic', home_url( "/index.php?wpsc_user_dynamic_js=true", $scheme ) );
968
+ }
969
+
970
  /**
971
+ * Update products page URL options when permalink scheme changes.
972
  *
973
+ * @since 3.8.9
974
+ * @access private
975
  */
976
+ function _wpsc_action_permalink_structure_changed() {
977
+ $wp_version = get_bloginfo( 'version' );
978
+
979
+ // see WordPress core trac ticket:
980
+ // http://core.trac.wordpress.org/ticket/16736
981
+ // this has been fixed in WordPress 3.3
982
+ if ( version_compare( $wp_version, '3.3', '<' ) )
983
+ _wpsc_display_permalink_refresh_notice();
984
+ add_action( 'admin_notices', 'wpsc_check_permalink_notice' );
985
+
986
+ wpsc_update_page_urls( true );
987
  }
988
 
989
  /**
990
+ * Display warning if the user is using WordPress prior to 3.3 because there is a bug with custom
991
+ * post type and taxonomy permalink generation.
992
  *
993
+ * @access private
994
+ * @since 3.8.9
995
+ */
996
+ function _wpsc_display_permalink_refresh_notice(){
997
+ ?>
998
+ <div id="notice" class="error fade">
999
+ <p>
1000
+ <?php printf( __( 'Due to <a href="%1$s">a bug in WordPress prior to version 3.3</a>, you might run into 404 errors when viewing your products. To work around this, <a href="%2$s">upgrade to WordPress 3.3 or later</a>, or simply click "Save Changes" below a second time.' , 'wpsc' ), 'http://core.trac.wordpress.org/ticket/16736', 'http://codex.wordpress.org/Updating_WordPress' ); ?>
1001
+ </p>
1002
+ </div>
1003
+ <?php
1004
+ }
1005
+
1006
+
1007
+ /**
1008
+ * wpsc_ajax_ie_save save changes made using inline edit
1009
  *
1010
+ * @public
 
 
 
 
 
 
 
 
 
1011
  *
1012
+ * @3.8
1013
  * @returns nothing
1014
  */
1015
  function wpsc_ajax_ie_save() {
1024
  $id = absint( $_POST['id'] );
1025
  $post = get_post( $_POST['id'] );
1026
  $parent = get_post( $post->post_parent );
1027
+ $terms = wp_get_object_terms( $id, 'wpsc-variation', array( 'fields' => 'names' ) );
1028
 
1029
  $product = array(
1030
  'ID' => $_POST['id'],
1066
  die();
1067
  }
1068
 
 
 
 
 
 
1069
  function wpsc_add_meta_boxes(){
1070
  add_meta_box( 'dashboard_right_now', __( 'Current Month', 'wpsc' ), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
1071
  }
1074
  * Displays notice if user has Great Britain selected as their base country
1075
  * Since 3.8.9, we have deprecated Great Britain in favor of the UK
1076
  *
 
 
1077
  * @link http://code.google.com/p/wp-e-commerce/issues/detail?id=1079
1078
+ * @since 3.8.9
1079
+ * @return html
 
 
 
 
1080
  */
1081
  function _wpsc_action_admin_notices_deprecated_countries_notice() {
1082
  $base_country = get_option( 'base_country' );
1089
  $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' );
1090
  break;
1091
  case 'UK':
1092
+ $message = __( 'Prior to WP e-Commerce 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 e-Commerce 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 Setings</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' );
1093
  break;
1094
  case 'AN':
1095
  $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' );
1096
  case 'TP':
1097
+ $message = __( 'Prior to WP e-Commerce 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 e-Commerce 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 Setings</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' );
1098
  break;
1099
  }
1100
 
1107
  echo '<div id="wpsc-warning" class="error"><p>' . $message . '</p></div>';
1108
  }
1109
 
1110
+ add_action( 'admin_notices', '_wpsc_action_admin_notices_deprecated_countries_notice' );
1111
+ add_action( 'permalink_structure_changed' , '_wpsc_action_permalink_structure_changed' );
1112
+ add_action( 'wp_ajax_category_sort_order', 'wpsc_ajax_set_category_order' );
1113
  add_action( 'wp_ajax_variation_sort_order', 'wpsc_ajax_set_variation_order' );
1114
+ add_action( 'wp_ajax_wpsc_ie_save', 'wpsc_ajax_ie_save' );
1115
+ add_action('in_admin_header', 'wpsc_add_meta_boxes');
1116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1117
  function _wpsc_delete_file( $product_id, $file_name ) {
1118
  global $wpdb;
1119
 
1122
  return wp_delete_post( $product_id_to_delete, true );
1123
  }
1124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1125
  function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
1126
+ $new_post_date = $post->post_date;
1127
  $new_post_date_gmt = get_gmt_from_date( $new_post_date );
1128
 
1129
+ $new_post_type = $post->post_type;
1130
+ $post_content = str_replace( "'", "''", $post->post_content );
1131
+ $post_content_filtered = str_replace( "'", "''", $post->post_content_filtered );
1132
+ $post_excerpt = str_replace( "'", "''", $post->post_excerpt );
1133
+ $post_title = str_replace( "'", "''", $post->post_title ) . " (Duplicate)";
1134
+ $post_name = str_replace( "'", "''", $post->post_name );
1135
+ $comment_status = str_replace( "'", "''", $post->comment_status );
1136
+ $ping_status = str_replace( "'", "''", $post->ping_status );
1137
 
1138
  $defaults = array(
1139
  'post_status' => $post->post_status,
1141
  'ping_status' => $ping_status,
1142
  'post_parent' => $new_parent_id ? $new_parent_id : $post->post_parent,
1143
  'menu_order' => $post->menu_order,
1144
+ 'to_ping' => $post->to_ping,
1145
  'pinged' => $post->pinged,
1146
  'post_excerpt' => $post_excerpt,
1147
  'post_title' => $post_title,
1154
  if ( 'attachment' == $post->post_type )
1155
  $defaults['guid'] = $post->guid;
1156
 
 
 
1157
  // Insert the new template in the post table
1158
  $new_post_id = wp_insert_post($defaults);
1159
 
1163
  // Copy the meta information
1164
  wpsc_duplicate_product_meta( $post->ID, $new_post_id );
1165
 
 
 
1166
  // Finds children (Which includes product files AND product images), their meta values, and duplicates them.
1167
  wpsc_duplicate_children( $post->ID, $new_post_id );
1168
 
1171
 
1172
  /**
1173
  * Copy the taxonomies of a post to another post
 
 
 
 
 
 
 
 
1174
  */
1175
  function wpsc_duplicate_taxonomies( $id, $new_id, $post_type ) {
1176
  $taxonomies = get_object_taxonomies( $post_type ); //array("category", "post_tag");
1177
  foreach ( $taxonomies as $taxonomy ) {
1178
+ $post_terms = wp_get_object_terms( $id, $taxonomy );
1179
+ for ( $i = 0; $i < count( $post_terms ); $i++ ) {
1180
+ wp_set_object_terms( $new_id, $post_terms[$i]->slug, $taxonomy, true );
1181
  }
1182
  }
1183
  }
1184
 
1185
  /**
1186
  * Copy the meta information of a post to another post
 
 
 
 
 
 
 
 
1187
  */
1188
  function wpsc_duplicate_product_meta( $id, $new_id ) {
1189
  global $wpdb;
1206
  $sql_query.= implode( ",", $sql_query_sel );
1207
  $sql_query = $wpdb->prepare( $sql_query, $values );
1208
  $wpdb->query( $sql_query );
 
1209
  }
 
1210
  }
1211
 
1212
  /**
1213
  * Duplicates children product and children meta
 
 
 
 
 
 
1214
  */
1215
  function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
1216
 
1217
+ //Get children products and duplicate them
1218
  $child_posts = get_posts( array(
1219
  'post_parent' => $old_parent_id,
1220
  'post_type' => 'any',
1223
  'order' => 'ASC',
1224
  ) );
1225
 
1226
+ foreach ( $child_posts as $child_post )
1227
+ wpsc_duplicate_product_process( $child_post, $new_parent_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1228
 
1229
  }
1230
 
 
 
 
 
 
 
 
 
1231
  function _wpsc_admin_notices_3dot8dot9() {
1232
+ $message = '<p>' . __( 'You are currently using WP e-Commerce 3.8.9. There have been major changes in WP e-Commerce 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 e-Commerce 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>';
1233
  $message .= "\n<p>" . __( '<a href="%2$s">Hide this warning</a>', 'wpsc' ) . '</p>';
1234
  $message = sprintf(
1235
  $message,
1236
+ 'http://getshopped.org/wp-e-commerce-3-8-9-compatibility-issues/',
1237
+ esc_url( add_query_arg( 'dismiss_389_upgrade_notice', 1 ) )
1238
  );
1239
 
1240
  echo '<div id="wpsc-3.8.9-notice" class="error">' . $message . '</div>';
1241
  }
1242
 
1243
+ if ( isset( $_REQUEST['dismiss_389_upgrade_notice'] ) )
1244
  update_option( 'wpsc_hide_3.8.9_notices', true );
1245
 
1246
  if ( ! get_option( 'wpsc_hide_3.8.9_notices' ) )
1247
+ add_action( 'admin_notices', '_wpsc_admin_notices_3dot8dot9' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/ajax-and-init.php CHANGED
@@ -7,22 +7,8 @@
7
  *
8
  * @package wp-e-commerce
9
  * @since 3.7
10
- *
11
- * @uses update_option() Updates option in the database given key and value
12
- * @uses wp_delete_term() Removes term from the database
13
- * @uses fetch_rss() DEPRECATED
14
- * @uses wpsc_member_dedeactivate_subscriptions() @todo docs
15
- * @uses wpsc_member_deactivate_subscriptions() @todo docs
16
- * @uses wpsc_update_purchase_log_status() Updates the status of the logs for a purchase
17
- * @uses transaction_results() Main function for creating purchase reports
18
- * @uses wpsc_find_purchlog_status_name() Finds name of given status
19
  */
20
  function wpsc_admin_ajax() {
21
-
22
- if ( ! wpsc_is_store_admin() ) {
23
- return;
24
- }
25
-
26
  global $wpdb;
27
 
28
  if ( isset( $_POST['action'] ) && $_POST['action'] == 'product-page-order' ) {
@@ -53,6 +39,15 @@ function wpsc_admin_ajax() {
53
  exit();
54
  }
55
 
 
 
 
 
 
 
 
 
 
56
  if ( isset( $_REQUEST['log_state'] ) && $_REQUEST['log_state'] == "true" && is_numeric( $_POST['id'] ) && is_numeric( $_POST['value'] ) ) {
57
  $newvalue = $_POST['value'];
58
  if ( $_REQUEST['suspend'] == 'true' ) {
@@ -94,16 +89,7 @@ function wpsc_admin_ajax() {
94
  if ( isset( $_REQUEST['ajax'] ) && isset( $_REQUEST['admin'] ) && ($_REQUEST['ajax'] == "true") && ($_REQUEST['admin'] == "true") )
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() {
102
-
103
- if ( ! wpsc_is_store_admin() ) {
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;
@@ -118,16 +104,7 @@ function wpsc_change_currency() {
118
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_currency') )
119
  add_action( 'admin_init', 'wpsc_change_currency' );
120
 
121
- /**
122
- * @todo docs
123
- * @uses $wpdb WordPress database object for queries
124
- */
125
  function wpsc_rearrange_images() {
126
-
127
- if ( ! wpsc_is_store_admin() ) {
128
- return;
129
- }
130
-
131
  global $wpdb;
132
  $images = explode( ",", $_POST['order'] );
133
  $product_id = absint( $_POST['product_id'] );
@@ -160,21 +137,7 @@ function wpsc_rearrange_images() {
160
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'rearrange_images') )
161
  add_action( 'admin_init', 'wpsc_rearrange_images' );
162
 
163
- /**
164
- * @todo docs
165
- *
166
- * @uses $wpdb WordPress database object for queries
167
- * @uses $wp_rewrite Global variable instance of the WP_Rewrite Class
168
- * @uses wp_get_referer() Retrieve referer from '_wp_http_referer' or HTTP referer.
169
- * @uses add_query_arg() Retrieve a modified URL query string.
170
- * @uses wp_redirect() Redirects to string given as argument
171
- */
172
  function wpsc_clean_categories() {
173
-
174
- if ( ! wpsc_is_store_admin() ) {
175
- return;
176
- }
177
-
178
  global $wpdb, $wp_rewrite;
179
  $sql_query = "SELECT `id`, `name`, `active` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`";
180
  $sql_data = $wpdb->get_results( $sql_query, ARRAY_A );
@@ -202,6 +165,8 @@ function wpsc_clean_categories() {
202
  '%d'
203
  );
204
 
 
 
205
  } else if ( $datarow['active'] == 0 ) {
206
  $wpdb->update(
207
  WPSC_TABLE_PRODUCT_CATEGORIES,
@@ -214,6 +179,7 @@ function wpsc_clean_categories() {
214
  '%s',
215
  '%d'
216
  );
 
217
  }
218
  }
219
  $wp_rewrite->flush_rules();
@@ -226,7 +192,7 @@ function wpsc_clean_categories() {
226
  $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
227
  }
228
 
229
- wp_redirect( $sendback );
230
 
231
  exit();
232
  }
7
  *
8
  * @package wp-e-commerce
9
  * @since 3.7
 
 
 
 
 
 
 
 
 
10
  */
11
  function wpsc_admin_ajax() {
 
 
 
 
 
12
  global $wpdb;
13
 
14
  if ( isset( $_POST['action'] ) && $_POST['action'] == 'product-page-order' ) {
39
  exit();
40
  }
41
 
42
+ if ( isset( $_POST['hide_ecom_dashboard'] ) && $_POST['hide_ecom_dashboard'] == 'true' ) {
43
+ require_once (ABSPATH . WPINC . '/rss.php');
44
+ $rss = fetch_rss( 'http://www.instinct.co.nz/feed/' );
45
+ $rss->items = array_slice( $rss->items, 0, 5 );
46
+ $rss_hash = sha1( serialize( $rss->items ) );
47
+ update_option( 'wpsc_ecom_news_hash', $rss_hash );
48
+ exit( 1 );
49
+ }
50
+
51
  if ( isset( $_REQUEST['log_state'] ) && $_REQUEST['log_state'] == "true" && is_numeric( $_POST['id'] ) && is_numeric( $_POST['value'] ) ) {
52
  $newvalue = $_POST['value'];
53
  if ( $_REQUEST['suspend'] == 'true' ) {
89
  if ( isset( $_REQUEST['ajax'] ) && isset( $_REQUEST['admin'] ) && ($_REQUEST['ajax'] == "true") && ($_REQUEST['admin'] == "true") )
90
  add_action( 'admin_init', 'wpsc_admin_ajax' );
91
 
 
 
 
 
92
  function wpsc_change_currency() {
 
 
 
 
 
93
  if ( is_numeric( $_POST['currencyid'] ) ) {
94
  $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 );
95
  $price_out = null;
104
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_currency') )
105
  add_action( 'admin_init', 'wpsc_change_currency' );
106
 
 
 
 
 
107
  function wpsc_rearrange_images() {
 
 
 
 
 
108
  global $wpdb;
109
  $images = explode( ",", $_POST['order'] );
110
  $product_id = absint( $_POST['product_id'] );
137
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'rearrange_images') )
138
  add_action( 'admin_init', 'wpsc_rearrange_images' );
139
 
 
 
 
 
 
 
 
 
 
140
  function wpsc_clean_categories() {
 
 
 
 
 
141
  global $wpdb, $wp_rewrite;
142
  $sql_query = "SELECT `id`, `name`, `active` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`";
143
  $sql_data = $wpdb->get_results( $sql_query, ARRAY_A );
165
  '%d'
166
  );
167
 
168
+ $updated;
169
+
170
  } else if ( $datarow['active'] == 0 ) {
171
  $wpdb->update(
172
  WPSC_TABLE_PRODUCT_CATEGORIES,
179
  '%s',
180
  '%d'
181
  );
182
+ $updated;
183
  }
184
  }
185
  $wp_rewrite->flush_rules();
192
  $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
193
  }
194
 
195
+ wp_redirect( esc_url( $sendback ) );
196
 
197
  exit();
198
  }
wpsc-admin/ajax.php CHANGED
@@ -5,43 +5,31 @@
5
  *
6
  * @since 3.8.9
7
  * @access private
8
- *
9
- * @uses WP_Error WordPress Error Class
10
- * @uses wp_verify_nonce() Verify that correct nonce was used with time limit.
11
- *
12
  * @param string $ajax_action Name of AJAX action
13
  * @return WP_Error|boolean True if nonce is valid. WP_Error if otherwise.
14
  */
15
  function _wpsc_ajax_verify_nonce( $ajax_action ) {
16
  // nonce can be passed with name wpsc_nonce or _wpnonce
17
  $nonce = '';
18
-
19
  if ( isset( $_REQUEST['nonce'] ) )
20
  $nonce = $_REQUEST['nonce'];
21
  elseif ( isset( $_REQUEST['_wpnonce'] ) )
22
  $nonce = $_REQUEST['_wpnonce'];
23
  else
24
- return _wpsc_error_invalid_nonce();
25
 
26
  // validate nonce
27
  if ( ! wp_verify_nonce( $nonce, 'wpsc_ajax_' . $ajax_action ) )
28
- return _wpsc_error_invalid_nonce();
29
 
30
  return true;
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
  /**
38
  * Verify AJAX callback and call it if it exists.
39
  *
40
  * @since 3.8.9
41
  * @access private
42
- *
43
- * @uses WP_Error WordPress Error object
44
- *
45
  * @param string $ajax_action Name of AJAX action
46
  * @return WP_Error|array Array of response args if callback is valid. WP_Error if otherwise.
47
  */
@@ -64,20 +52,10 @@ function _wpsc_ajax_fire_callback( $ajax_action ) {
64
  *
65
  * @since 3.8.9
66
  * @access private
67
- *
68
- * @uses _wpsc_ajax_fire_callback() Verify ajax callback if it exists
69
- * @uses _wpsc_ajax_verify_nonce() Verify nonce of an ajax request
70
- * @uses is_wp_error() Check whether variable is a WordPress Error.
71
- *
72
- * @return array $output json encoded response
73
  */
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 );
@@ -102,12 +80,6 @@ function _wpsc_ajax_handler() {
102
  }
103
  add_action( 'wp_ajax_wpsc_ajax', '_wpsc_ajax_handler' );
104
 
105
- /**
106
- * Checks if WPSC is doing ajax
107
- *
108
- * @param string $action req The action we're checking
109
- * @return bool True if doing ajax
110
- */
111
  function wpsc_is_doing_ajax( $action = '' ) {
112
  $ajax = defined( 'DOING_AJAX' ) && DOING_AJAX && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'wpsc_ajax';
113
 
@@ -123,9 +95,6 @@ function wpsc_is_doing_ajax( $action = '' ) {
123
  *
124
  * @since 3.8.9
125
  * @access private
126
- *
127
- * @uses wp_create_nonce() Creates a random one time use token
128
- *
129
  * @param string $action AJAX action without prefix
130
  * @return string The generated nonce.
131
  */
@@ -141,19 +110,6 @@ function _wpsc_create_ajax_nonce( $ajax_action ) {
141
  *
142
  * @since 3.8.8
143
  * @access private
144
- *
145
- * @uses term_exists() Returns true if term exists
146
- * @uses get_term() Gets all term data by term_id
147
- * @uses wp_insert_term() Inserts a term to the WordPress database
148
- * @uses is_wp_error() Checks whether variable is a WordPress error
149
- * @uses WP_Error WordPress Error class
150
- * @uses clean_term_cache() Will remove all of the term ids from the cache.
151
- * @uses delete_option() Deletes option from the database
152
- * @uses wp_cache_set() Saves the data to the cache.
153
- * @uses _get_term_hierarchy() Retrieves children of taxonomy as Term IDs.
154
- * @uses wp_terms_checklist() Output an unordered list of checkbox <input> elements labelled
155
- * @uses WPSC_Walker_Variation_Checklist Walker variation checklist
156
- *
157
  * @return array Response args
158
  */
159
  function _wpsc_ajax_add_variation_set() {
@@ -172,7 +128,7 @@ function _wpsc_ajax_add_variation_set() {
172
  }
173
 
174
  if ( empty( $variation_set_id ) ) {
175
- $results = wp_insert_term( apply_filters( 'wpsc_new_variation_set', $new_variation_set ), 'wpsc-variation' );
176
  if ( is_wp_error( $results ) )
177
  return $results;
178
  $variation_set_id = $results['term_id'];
@@ -182,7 +138,7 @@ function _wpsc_ajax_add_variation_set() {
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 ) );
186
 
187
  if ( is_wp_error( $results ) )
188
  return $results;
@@ -192,32 +148,26 @@ function _wpsc_ajax_add_variation_set() {
192
 
193
  require_once( 'includes/walker-variation-checklist.php' );
194
 
195
- if ( ! version_compare( $GLOBALS['wp_version'], '3.8.3', '>' ) ) {
196
-
197
- /* --- DIRTY HACK START --- */
198
- /*
199
- There's a bug with term cache in WordPress core. See http://core.trac.wordpress.org/ticket/14485. Fixed in 3.9.
200
- The next 3 lines will delete children term cache for wpsc-variation.
201
- Without this hack, the new child variations won't be displayed on "Variations" page and
202
- also won't be displayed in wp_terms_checklist() call below.
203
- */
204
- clean_term_cache( $variation_set_id, 'wpsc-variation' );
205
- delete_option('wpsc-variation_children');
206
- wp_cache_set( 'last_changed', 1, 'terms' );
207
- _get_term_hierarchy('wpsc-variation');
208
- /* --- DIRTY HACK END --- */
209
-
210
- }
211
 
212
  ob_start();
213
-
214
  wp_terms_checklist( (int) $_POST['post_id'], array(
215
  'taxonomy' => 'wpsc-variation',
216
  'descendants_and_self' => $variation_set_id,
217
  'walker' => new WPSC_Walker_Variation_Checklist( $inserted_variants ),
218
  'checked_ontop' => false,
219
  ) );
220
-
221
  $content = ob_get_clean();
222
 
223
  $return = array(
@@ -234,10 +184,6 @@ function _wpsc_ajax_add_variation_set() {
234
  *
235
  * @since 3.8.9
236
  * @access private
237
- *
238
- * @uses WPSC_Settings_Tab_Gateway
239
- * @uses WPSC_Settings_Tab_Gateway::display_payment_gateway_settings_form() Displays payment gateway form
240
- *
241
  * @return array Response args
242
  */
243
  function _wpsc_ajax_payment_gateway_settings_form() {
@@ -258,11 +204,7 @@ function _wpsc_ajax_payment_gateway_settings_form() {
258
  *
259
  * @since 3.8.9
260
  * @access private
261
- *
262
- * @uses WPSC_Settings_Table_Shipping
263
- * @uses WPSC_Settings_Table_Shipping::display_shipping_module_settings_form() Displays shipping module form
264
- *
265
- * @return array $return Response args
266
  */
267
  function _wpsc_ajax_shipping_module_settings_form() {
268
  require_once( 'settings-page.php' );
@@ -282,11 +224,7 @@ function _wpsc_ajax_shipping_module_settings_form() {
282
  *
283
  * @since 3.8.9
284
  * @access private
285
- *
286
- * @uses WPSC_Settings_Page
287
- * @uses WPSC_Settings_Page::display_current_tab() Shows current tab of settings page
288
- *
289
- * @return array $return Response args
290
  */
291
  function _wpsc_ajax_navigate_settings_tab() {
292
  require_once( 'settings-page.php' );
@@ -299,17 +237,12 @@ function _wpsc_ajax_navigate_settings_tab() {
299
 
300
  return $return;
301
  }
302
-
303
  /**
304
  * Display base region list in Store Settings -> General
305
  *
306
  * @since 3.8.9
307
  * @access private
308
- *
309
- * @uses WPSC_Settings_Tab_General
310
- * @uses WPSC_Settings_Tab_General::display_region_drop_down() Shows region dropdown
311
- *
312
- * @return array $return Response args
313
  */
314
  function _wpsc_ajax_display_region_list() {
315
  require_once( 'settings-page.php' );
@@ -329,10 +262,7 @@ function _wpsc_ajax_display_region_list() {
329
  *
330
  * @since 3.8.9
331
  * @access private
332
- *
333
- * @uses WP_Error WordPress Error class
334
- *
335
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise.
336
  */
337
  function _wpsc_ajax_purchase_log_save_tracking_id() {
338
  global $wpdb;
@@ -366,15 +296,7 @@ function _wpsc_ajax_purchase_log_save_tracking_id() {
366
  *
367
  * @since 3.8.9
368
  * @access private
369
- *
370
- * @uses $wpdb WordPress database object for queries
371
- * @uses get_option() Gets option from DB given key
372
- * @uses add_filter() Calls 'wp_mail_from' which can replace the from email address
373
- * @uses add_filter() Calls 'wp_mail_from_name' allows replacement of the from name on WordPress emails
374
- * @uses wp_mail() All the emailses in WordPress are sent through this function
375
- * @uses WP_Error WordPress Error class
376
- *
377
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
378
  */
379
  function _wpsc_ajax_purchase_log_send_tracking_email() {
380
  global $wpdb;
@@ -387,7 +309,8 @@ function _wpsc_ajax_purchase_log_send_tracking_email() {
387
  $message = str_replace( '%trackid%', $trackingid, $message );
388
  $message = str_replace( '%shop_name%', get_option( 'blogname' ), $message );
389
 
390
- $email = wpsc_get_buyers_email( $id );
 
391
 
392
  $subject = get_option( 'wpsc_trackingid_subject' );
393
  $subject = str_replace( '%shop_name%', get_option( 'blogname' ), $subject );
@@ -411,98 +334,12 @@ function _wpsc_ajax_purchase_log_send_tracking_email() {
411
  return $return;
412
  }
413
 
414
- /**
415
- * Do purchase log action link via AJAX
416
- *
417
- * @since 3.9.0
418
- * @access private
419
- *
420
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
421
- */
422
- function _wpsc_ajax_purchase_log_action_link() {
423
-
424
- if ( isset( $_POST['log_id'] ) && isset( $_POST['purchase_log_action_link'] ) && isset( $_POST['purchase_log_action_nonce'] ) ) {
425
-
426
- $log_id = absint( $_POST['log_id'] );
427
- $purchase_log_action_link = sanitize_key( $_POST['purchase_log_action_link'] );
428
-
429
- // Verify action nonce
430
- if ( wp_verify_nonce( $_POST['purchase_log_action_nonce'], 'wpsc_purchase_log_action_ajax_' . $purchase_log_action_link ) ) {
431
-
432
- // Expected to receive success = true by default, or false on error.
433
- $return = apply_filters( 'wpsc_purchase_log_action_ajax-' . $purchase_log_action_link, array( 'success' => null ), $log_id );
434
-
435
- } else {
436
- $return = _wpsc_error_invalid_nonce();
437
- }
438
-
439
- if ( ! is_wp_error( $return ) ) {
440
- $return['log_id'] = $log_id;
441
- $return['purchase_log_action_link'] = $purchase_log_action_link;
442
- $return['success'] = isset( $return['success'] ) ? (bool) $return['success'] : null;
443
- }
444
-
445
- return $return;
446
-
447
- }
448
-
449
- return new WP_Error( 'wpsc_ajax_invalid_purchase_log_action', __( 'Purchase log action failed.', 'wpsc' ) );
450
-
451
- }
452
-
453
- /**
454
- * Handle AJAX clear downloads lock purchase log action
455
- *
456
- * The _wpsc_ajax_purchase_log_action_link() function which triggers this function is nonce
457
- * and capability checked in _wpsc_ajax_handler().
458
- *
459
- * @since 3.9.0
460
- * @access private
461
- *
462
- * @param array $response AJAX response.
463
- * @param int $log_id Purchase log ID.
464
- */
465
- function wpsc_purchase_log_action_ajax_downloads_lock( $response, $log_id ) {
466
-
467
- $response['success'] = wpsc_purchlog_clear_download_items( $log_id );
468
-
469
- return $response;
470
-
471
- }
472
- add_action( 'wpsc_purchase_log_action_ajax-downloads_lock', 'wpsc_purchase_log_action_ajax_downloads_lock', 10, 2 );
473
-
474
-
475
- /**
476
- * Handle AJAX email receipt purchase log action
477
- *
478
- * The _wpsc_ajax_purchase_log_action_link() function which triggers this function is nonce
479
- * and capability checked in _wpsc_ajax_handler().
480
- *
481
- * @since 3.9.0
482
- * @access private
483
- *
484
- * @param array $response AJAX response.
485
- * @param int $log_id Purchase log ID.
486
- */
487
- function wpsc_purchase_log_action_ajax_email_receipt( $response, $log_id ) {
488
-
489
- $response['success'] = wpsc_purchlog_resend_email( $log_id );
490
-
491
- return $response;
492
-
493
- }
494
- add_action( 'wpsc_purchase_log_action_ajax-email_receipt', 'wpsc_purchase_log_action_ajax_email_receipt', 10, 2 );
495
-
496
  /**
497
  * Delete an attached downloadable file via AJAX.
498
  *
499
  * @since 3.8.9
500
  * @access private
501
- *
502
- * @uses _wpsc_delete_file() Deletes files associated with a product
503
- * @uses WP_Error WordPress error class
504
- *
505
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
506
  */
507
  function _wpsc_ajax_delete_file() {
508
  $product_id = absint( $_REQUEST['product_id'] );
@@ -526,11 +363,7 @@ function _wpsc_ajax_delete_file() {
526
  *
527
  * @since 3.8.9
528
  * @access private
529
- *
530
- * @uses delete_meta() Deletes metadata by meta id
531
- * @uses WP_Error WordPress error class
532
- *
533
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise
534
  */
535
  function _wpsc_ajax_remove_product_meta() {
536
  $meta_id = (int) $_POST['meta_id'];
@@ -545,15 +378,7 @@ function _wpsc_ajax_remove_product_meta() {
545
  *
546
  * @since 3.8.9
547
  * @access private
548
- *
549
- * @uses wpsc_purchlog_edit_status() Edits purchase log status
550
- * @uses WP_Error WordPress Error class
551
- * @uses WPSC_Purchase_Log_List_Table
552
- * @uses WPSC_Purchase_Log_List_Table::prepare_items()
553
- * @uses WPSC_Purchase_Log_List_Table::views()
554
- * @uses WPSC_Purchase_Log_List_Table::display_tablenav() @todo docs
555
- *
556
- * @return array|WP_Error $return Response args if successful, WP_Error if otherwise.
557
  */
558
  function _wpsc_ajax_change_purchase_log_status() {
559
  $result = wpsc_purchlog_edit_status( $_POST['id'], $_POST['new_status'] );
@@ -562,7 +387,10 @@ function _wpsc_ajax_change_purchase_log_status() {
562
 
563
  $args = array();
564
 
565
- $args['screen'] = 'dashboard_page_wpsc-sales-logs';
 
 
 
566
 
567
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-list-table-class.php' );
568
  $purchaselog_table = new WPSC_Purchase_Log_List_Table( $args );
@@ -596,14 +424,10 @@ function _wpsc_ajax_change_purchase_log_status() {
596
  *
597
  * @since 3.8.9
598
  * @access private
599
- *
600
- * @uses $wpdb WordPress database object for use in queries
601
- * @uses wp_update_post() Updates post based on passed $args. Needs a post_id
602
- * @uses WP_Error WordPress Error class
603
- *
604
  * @return array|WP_Error Response args if successful, WP_Error if otherwise
605
  */
606
  function _wpsc_ajax_save_product_order() {
 
607
 
608
  $products = array( );
609
  foreach ( $_POST['post'] as $product ) {
@@ -621,10 +445,6 @@ function _wpsc_ajax_save_product_order() {
621
  $failed[] = $product_id;
622
  }
623
 
624
- // Validate data before exposing to action
625
- $category = isset( $_POST['category_id'] ) ? get_term_by( 'slug', $_POST['category_id'], 'wpsc_product_category' ) : false;
626
- do_action( 'wpsc_save_product_order', $products, $category );
627
-
628
  if ( ! empty( $failed ) ) {
629
  $error_data = array(
630
  'failed_ids' => $failed,
@@ -638,48 +458,11 @@ function _wpsc_ajax_save_product_order() {
638
  );
639
  }
640
 
641
- /**
642
- * Save Category Product Order
643
- *
644
- * Note that this uses the 'term_order' field in the 'term_relationships' table to store
645
- * the order. Although this column presently seems to be unused by WordPress, the intention
646
- * is it should be used to store the order of terms associates to a post, not the order
647
- * of posts as we are doing. This shouldn't be an issue for WPEC unless WordPress adds a UI
648
- * for this. More info at http://core.trac.wordpress.org/ticket/9547
649
- *
650
- * @since 3.9
651
- * @access private
652
- *
653
- * @uses $wpdb WordPress database object used for queries
654
- */
655
- function _wpsc_save_category_product_order( $products, $category ) {
656
- global $wpdb;
657
-
658
- // Only save category product order if in category
659
- if ( ! $category )
660
- return;
661
-
662
- // Save product order in term_relationships table
663
- foreach ( $products as $order => $product_id ) {
664
- $wpdb->update( $wpdb->term_relationships,
665
- array( 'term_order' => $order ),
666
- array( 'object_id' => $product_id, 'term_taxonomy_id' => $category->term_taxonomy_id ),
667
- array( '%d' ),
668
- array( '%d', '%d' )
669
- );
670
- }
671
- }
672
- add_action( 'wpsc_save_product_order', '_wpsc_save_category_product_order', 10, 2 );
673
-
674
  /**
675
  * Update Checkout fields order
676
  *
677
  * @since 3.8.9
678
  * @access private
679
- *
680
- * @uses $wpdb WordPress database object used for queries
681
- * @uses WP_Error WordPress error class
682
- *
683
  * @return array|WP_Error Response args or WP_Error
684
  */
685
  function _wpsc_ajax_update_checkout_fields_order() {
@@ -725,17 +508,6 @@ function _wpsc_ajax_update_checkout_fields_order() {
725
  *
726
  * @since 3.8.9
727
  * @access private
728
- *
729
- * @uses $wpdb WordPress database object for use in queries
730
- * @uses _wpsc_create_ajax_nonce() Creates nonce for an ajax action
731
- * @uses wpsc_get_mimetype() Returns mimetype of file
732
- * @uses wp_insert_post() Inserts post to WordPress database
733
- * @uses wp_nonce_url() Retrieve URL with nonce added to URL query.
734
- * @uses wpsc_convert_bytes() Formats bytes
735
- * @uses wpsc_get_extension() Gets extension of file
736
- * @uses esc_attr() Escapes HTML attributes
737
- * @uses _x() Retrieve translated string with gettext context
738
- *
739
  * @return array|WP_Error Response args if successful, WP_Error if otherwise.
740
  */
741
  function _wpsc_ajax_upload_product_file() {
@@ -805,10 +577,6 @@ function _wpsc_ajax_upload_product_file() {
805
  *
806
  * @since 3.8.9
807
  * @access private
808
- *
809
- * @uses wpsc_update_variations() Updates product variations given
810
- * @uses wpsc_admin_product_listing() DEPRECATED
811
- *
812
  * @return array|WP_Error Response args if successful, WP_Error if otherwise
813
  */
814
  function _wpsc_ajax_update_variations() {
@@ -838,13 +606,6 @@ add_action( 'wp_ajax_wpsc_tinymce_window', '_wpsc_action_tinymce_window' );
838
  * Add tax rate
839
  * @since 3.8.9
840
  * @access private
841
- *
842
- * @uses wpec_taxes_controller Contains all the logic to communicate with the taxes system
843
- * @uses wpec_taxes_controller::wpec_taxes::wpec_taxes_get_regions() Gets tax regions based on input country code
844
- * @uses wpec_taxes_controller::wpec_taxes_build_select_options() Returns HTML formatted options from input array
845
- * @uses wpec_taxes_controller::wpec_taxes_build_form() Builds the tax rate form
846
- * @uses wpec_taxes_controller::wpec_taxes::wpec_taxes_get_band_from_index() Retrieves tax band for given name
847
- *
848
  * @return array|WP_Error Response args if successful, WP_Error if otherwise
849
  */
850
  function _wpsc_ajax_add_tax_rate() {
@@ -864,6 +625,19 @@ function _wpsc_ajax_add_tax_rate() {
864
  );
865
  $returnable = $wpec_taxes_controller->wpec_taxes_build_select_options( $regions, 'region_code', 'name', $default_option, $select_settings );
866
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
867
  }// switch
868
 
869
  return array(
@@ -871,16 +645,8 @@ function _wpsc_ajax_add_tax_rate() {
871
  );
872
  }
873
 
874
- /**
875
- * Displays the WPSC product variations table
876
- *
877
- * @uses check_admin_referrer() Makes sure user was referred from another admin page
878
- * @uses WPSC_Product_Variations_Page The WPSC Product variations class
879
- * @uses WPSC_Product_Variations_Page::display() Displays the product variations page
880
- */
881
  function wpsc_product_variations_table() {
882
  check_admin_referer( 'wpsc_product_variations_table' );
883
- set_current_screen( 'wpsc-product' );
884
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-variations-page.class.php' );
885
  $page = new WPSC_Product_Variations_Page();
886
  $page->display();
@@ -889,16 +655,6 @@ function wpsc_product_variations_table() {
889
  }
890
  add_action( 'wp_ajax_wpsc_product_variations_table', 'wpsc_product_variations_table' );
891
 
892
- /**
893
- * @access private
894
- *
895
- * @uses current_user_can() Checks user capabilities given string
896
- * @uses delete_post_thumbnail() Deletes post thumbnail given thumbnail id
897
- * @uses set_post_thumbnail() Sets post thumbnail given post_id and thumbnail_id
898
- * @uses wpsc_the_product_thumbnail() Returns URL to the product thumbnail
899
- *
900
- * @return array $response Includes the thumbnail URL and success bool value
901
- */
902
  function _wpsc_ajax_set_variation_product_thumbnail() {
903
  $response = array(
904
  'success' => false
5
  *
6
  * @since 3.8.9
7
  * @access private
 
 
 
 
8
  * @param string $ajax_action Name of AJAX action
9
  * @return WP_Error|boolean True if nonce is valid. WP_Error if otherwise.
10
  */
11
  function _wpsc_ajax_verify_nonce( $ajax_action ) {
12
  // nonce can be passed with name wpsc_nonce or _wpnonce
13
  $nonce = '';
 
14
  if ( isset( $_REQUEST['nonce'] ) )
15
  $nonce = $_REQUEST['nonce'];
16
  elseif ( isset( $_REQUEST['_wpnonce'] ) )
17
  $nonce = $_REQUEST['_wpnonce'];
18
  else
19
+ return new WP_Error( 'wpsc_ajax_invalid_nonce', __( 'Your session has expired. Please refresh the page and try again.', 'wpsc' ) );
20
 
21
  // validate nonce
22
  if ( ! wp_verify_nonce( $nonce, 'wpsc_ajax_' . $ajax_action ) )
23
+ return new WP_Error( 'wpsc_ajax_invalid_nonce', __( 'Your session has expired. Please refresh the page and try again.', 'wpsc' ) );
24
 
25
  return true;
26
  }
27
 
 
 
 
 
28
  /**
29
  * Verify AJAX callback and call it if it exists.
30
  *
31
  * @since 3.8.9
32
  * @access private
 
 
 
33
  * @param string $ajax_action Name of AJAX action
34
  * @return WP_Error|array Array of response args if callback is valid. WP_Error if otherwise.
35
  */
52
  *
53
  * @since 3.8.9
54
  * @access private
 
 
 
 
 
 
55
  */
56
  function _wpsc_ajax_handler() {
57
  $ajax_action = str_replace( '-', '_', $_REQUEST['wpsc_action'] );
58
+ $result = _wpsc_ajax_verify_nonce( $ajax_action );
 
 
 
 
59
 
60
  if ( ! is_wp_error( $result ) )
61
  $result = _wpsc_ajax_fire_callback( $ajax_action );
80
  }
81
  add_action( 'wp_ajax_wpsc_ajax', '_wpsc_ajax_handler' );
82
 
 
 
 
 
 
 
83
  function wpsc_is_doing_ajax( $action = '' ) {
84
  $ajax = defined( 'DOING_AJAX' ) && DOING_AJAX && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'wpsc_ajax';
85
 
95
  *
96
  * @since 3.8.9
97
  * @access private
 
 
 
98
  * @param string $action AJAX action without prefix
99
  * @return string The generated nonce.
100
  */
110
  *
111
  * @since 3.8.8
112
  * @access private
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  * @return array Response args
114
  */
115
  function _wpsc_ajax_add_variation_set() {
128
  }
129
 
130
  if ( empty( $variation_set_id ) ) {
131
+ $results = wp_insert_term( $new_variation_set, 'wpsc-variation' );
132
  if ( is_wp_error( $results ) )
133
  return $results;
134
  $variation_set_id = $results['term_id'];
138
  return new WP_Error( 'wpsc_invalid_variation_id', __( 'Cannot retrieve the variation set in order to proceed.', 'wpsc' ) );
139
 
140
  foreach ( $variants as $variant ) {
141
+ $results = wp_insert_term( $variant, 'wpsc-variation', array( 'parent' => $variation_set_id ) );
142
 
143
  if ( is_wp_error( $results ) )
144
  return $results;
148
 
149
  require_once( 'includes/walker-variation-checklist.php' );
150
 
151
+ /* --- DIRTY HACK START --- */
152
+ /*
153
+ There's a bug with term cache in WordPress core. See http://core.trac.wordpress.org/ticket/14485.
154
+ The next 3 lines will delete children term cache for wpsc-variation.
155
+ Without this hack, the new child variations won't be displayed on "Variations" page and
156
+ also won't be displayed in wp_terms_checklist() call below.
157
+ */
158
+ clean_term_cache( $variation_set_id, 'wpsc-variation' );
159
+ delete_option('wpsc-variation_children');
160
+ wp_cache_set( 'last_changed', 1, 'terms' );
161
+ _get_term_hierarchy('wpsc-variation');
162
+ /* --- DIRTY HACK END --- */
 
 
 
 
163
 
164
  ob_start();
 
165
  wp_terms_checklist( (int) $_POST['post_id'], array(
166
  'taxonomy' => 'wpsc-variation',
167
  'descendants_and_self' => $variation_set_id,
168
  'walker' => new WPSC_Walker_Variation_Checklist( $inserted_variants ),
169
  'checked_ontop' => false,
170
  ) );
 
171
  $content = ob_get_clean();
172
 
173
  $return = array(
184
  *
185
  * @since 3.8.9
186
  * @access private
 
 
 
 
187
  * @return array Response args
188
  */
189
  function _wpsc_ajax_payment_gateway_settings_form() {
204
  *
205
  * @since 3.8.9
206
  * @access private
207
+ * @return array Response args
 
 
 
 
208
  */
209
  function _wpsc_ajax_shipping_module_settings_form() {
210
  require_once( 'settings-page.php' );
224
  *
225
  * @since 3.8.9
226
  * @access private
227
+ * @return array Response args
 
 
 
 
228
  */
229
  function _wpsc_ajax_navigate_settings_tab() {
230
  require_once( 'settings-page.php' );
237
 
238
  return $return;
239
  }
 
240
  /**
241
  * Display base region list in Store Settings -> General
242
  *
243
  * @since 3.8.9
244
  * @access private
245
+ * @return array Response args
 
 
 
 
246
  */
247
  function _wpsc_ajax_display_region_list() {
248
  require_once( 'settings-page.php' );
262
  *
263
  * @since 3.8.9
264
  * @access private
265
+ * @return array|WP_Error Response args if successful, WP_Error if otherwise.
 
 
 
266
  */
267
  function _wpsc_ajax_purchase_log_save_tracking_id() {
268
  global $wpdb;
296
  *
297
  * @since 3.8.9
298
  * @access private
299
+ * @return array|WP_Error Response args if successful, WP_Error if otherwise
 
 
 
 
 
 
 
 
300
  */
301
  function _wpsc_ajax_purchase_log_send_tracking_email() {
302
  global $wpdb;
309
  $message = str_replace( '%trackid%', $trackingid, $message );
310
  $message = str_replace( '%shop_name%', get_option( 'blogname' ), $message );
311
 
312
+ $email_form_field = $wpdb->get_var( "SELECT `id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1" );
313
+ $email = $wpdb->get_var( $wpdb->prepare( "SELECT `value` FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id`=%d AND `form_id` = '$email_form_field' LIMIT 1", $id ) );
314
 
315
  $subject = get_option( 'wpsc_trackingid_subject' );
316
  $subject = str_replace( '%shop_name%', get_option( 'blogname' ), $subject );
334
  return $return;
335
  }
336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  /**
338
  * Delete an attached downloadable file via AJAX.
339
  *
340
  * @since 3.8.9
341
  * @access private
342
+ * @return array|WP_Error Response args if successful, WP_Error if otherwise
 
 
 
 
343
  */
344
  function _wpsc_ajax_delete_file() {
345
  $product_id = absint( $_REQUEST['product_id'] );
363
  *
364
  * @since 3.8.9
365
  * @access private
366
+ * @return array|WP_Error Response args if successful, WP_Error if otherwise
 
 
 
 
367
  */
368
  function _wpsc_ajax_remove_product_meta() {
369
  $meta_id = (int) $_POST['meta_id'];
378
  *
379
  * @since 3.8.9
380
  * @access private
381
+ * @return array|WP_Error Response args if successful, WP_Error if otherwise.
 
 
 
 
 
 
 
 
382
  */
383
  function _wpsc_ajax_change_purchase_log_status() {
384
  $result = wpsc_purchlog_edit_status( $_POST['id'], $_POST['new_status'] );
387
 
388
  $args = array();
389
 
390
+ if ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
391
+ set_current_screen( 'dashboard_page_wpsc-sales-logs' );
392
+ else
393
+ $args['screen'] = 'dashboard_page_wpsc-sales-logs';
394
 
395
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-list-table-class.php' );
396
  $purchaselog_table = new WPSC_Purchase_Log_List_Table( $args );
424
  *
425
  * @since 3.8.9
426
  * @access private
 
 
 
 
 
427
  * @return array|WP_Error Response args if successful, WP_Error if otherwise
428
  */
429
  function _wpsc_ajax_save_product_order() {
430
+ global $wpdb;
431
 
432
  $products = array( );
433
  foreach ( $_POST['post'] as $product ) {
445
  $failed[] = $product_id;
446
  }
447
 
 
 
 
 
448
  if ( ! empty( $failed ) ) {
449
  $error_data = array(
450
  'failed_ids' => $failed,
458
  );
459
  }
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  /**
462
  * Update Checkout fields order
463
  *
464
  * @since 3.8.9
465
  * @access private
 
 
 
 
466
  * @return array|WP_Error Response args or WP_Error
467
  */
468
  function _wpsc_ajax_update_checkout_fields_order() {
508
  *
509
  * @since 3.8.9
510
  * @access private
 
 
 
 
 
 
 
 
 
 
 
511
  * @return array|WP_Error Response args if successful, WP_Error if otherwise.
512
  */
513
  function _wpsc_ajax_upload_product_file() {
577
  *
578
  * @since 3.8.9
579
  * @access private
 
 
 
 
580
  * @return array|WP_Error Response args if successful, WP_Error if otherwise
581
  */
582
  function _wpsc_ajax_update_variations() {
606
  * Add tax rate
607
  * @since 3.8.9
608
  * @access private
 
 
 
 
 
 
 
609
  * @return array|WP_Error Response args if successful, WP_Error if otherwise
610
  */
611
  function _wpsc_ajax_add_tax_rate() {
625
  );
626
  $returnable = $wpec_taxes_controller->wpec_taxes_build_select_options( $regions, 'region_code', 'name', $default_option, $select_settings );
627
  break;
628
+ case 'wpec_taxes_build_rates_form':
629
+ $key = $_REQUEST['current_key'];
630
+ $returnable = $wpec_taxes_controller->wpec_taxes_build_form( $key );
631
+ break;
632
+ case 'wpec_taxes_build_bands_form':
633
+ $key = $_REQUEST['current_key'];
634
+ //get a new key if a band is already defined for this key
635
+ while($wpec_taxes_controller->wpec_taxes->wpec_taxes_get_band_from_index($key))
636
+ {
637
+ $key++;
638
+ }
639
+ $returnable = $wpec_taxes_controller->wpec_taxes_build_form( $key, false, 'bands' );
640
+ break;
641
  }// switch
642
 
643
  return array(
645
  );
646
  }
647
 
 
 
 
 
 
 
 
648
  function wpsc_product_variations_table() {
649
  check_admin_referer( 'wpsc_product_variations_table' );
 
650
  require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-variations-page.class.php' );
651
  $page = new WPSC_Product_Variations_Page();
652
  $page->display();
655
  }
656
  add_action( 'wp_ajax_wpsc_product_variations_table', 'wpsc_product_variations_table' );
657
 
 
 
 
 
 
 
 
 
 
 
658
  function _wpsc_ajax_set_variation_product_thumbnail() {
659
  $response = array(
660
  'success' => false
wpsc-admin/css/admin.css CHANGED
@@ -1,507 +1,316 @@
1
- /**
2
- * WPSC Admin CSS file
3
- */
4
-
5
- table.wp-list-table .column-featured {
6
- width: 30px;
7
- }
8
-
9
- table.wp-list-table .column-price,
10
- table.wp-list-table .column-sale_price {
11
- width: 8%;
12
- }
13
-
14
- table.wp-list-table .column-SKU {
15
- width: 11%;
16
- }
17
-
18
- table.wp-list-table .column-stock {
19
- width: 8%;
20
- }
21
-
22
- table.wp-list-table .column-weight {
23
- width: 7%;
24
- }
25
-
26
- table.wp-list-table .column-cats {
27
- width: 15%;
28
- }
29
 
 
30
  ul.variation_checkboxes li {
31
- margin: 1px 0 3px;
32
  }
33
-
34
  /* This is the variation meta box stuff need to put it in the correct place - mychelle */
35
-
36
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td span {
37
- display: none;
38
  }
39
 
40
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.weight {
41
  width: 81px;
42
  }
43
 
44
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.stock {
45
  width: 110px;
46
  }
47
 
48
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.price {
49
  width: 125px;
50
  }
51
 
52
- div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.post-title {
53
  width: 115px;
54
  }
55
 
56
  .wpsc_ie_stock[disabled] {
57
- background-color: #f6f6f6;
58
  }
59
 
60
  div#wpsc_add_variant_desc,
61
- div#wpsc_add_variation_desc {
62
  float: left;
63
- margin: 33px 0px 30px 20px;
64
  }
65
 
66
- div#wpsc_add_variation_desc {
67
- width: 300px;
68
  }
69
 
70
- div#wpsc_add_variant_desc {
71
- width: 200px;
72
  }
73
 
74
- div#wpsc_add_variant {
75
  float: left;
76
  max-width: 245px;
77
  }
78
 
79
- div #add_new_variation {
80
- float: left;
81
- width: 215px;
82
  }
83
 
84
  input.wpsc_ie_field {
85
  margin-bottom:10px;
86
  }
87
 
88
- .wpsc_ie_save {
89
- margin-bottom: 5px;
90
  }
91
 
92
- .wpsc_trackingid_row {
93
- margin-left: 20px;
94
  }
95
 
96
- ul.children {
97
- padding-left: 5px;
98
  }
99
-
100
- .category_indenter {
101
- float: left;
102
- width: auto;
103
  }
104
 
105
-
106
  /**
107
- * Dashboard Widget CSS
108
- */
109
-
110
- #leftDashboard {
111
- width: 45%;
112
- float: left;
113
- text-align: right;
114
- border-right: 1px #999999 solid;
115
-
116
- }
117
-
118
- #leftDashboard strong {
119
- float: left;
120
  padding-left: 40px;
121
  }
122
-
123
- #rightDashboard strong {
124
- float: left;
125
  padding-left: 40px;
126
  }
 
 
 
 
127
 
128
- #rightDashboard {
129
- width: 45%;
130
- float: right;
131
- text-align: right;
132
  }
133
-
134
- .dashboardWidgetSpecial {
135
- font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
136
- color: #21759B;
137
- font-size: 15px !important;
 
 
 
138
  margin: 5px 0 5px 0;
139
  }
140
-
141
- .dashboardWidget {
142
- color: #777777;
143
- padding-left: 10px;
144
  padding-right: 30px;
145
- }
146
 
147
- span.wpsc_quart_left {
148
- width: 40%;
149
- float: left;
150
  }
151
-
152
- p.atglance {
153
- color: #777777;
154
- font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
155
- font-size: 13px;
156
- font-style: italic;
157
  }
158
-
159
- span.wpsc_quart_right {
160
- width: 60%;
161
- float: right;
 
 
 
 
 
162
  text-align: right;
163
  }
164
-
165
- #box span {
166
  border-bottom: 1px solid #999999;
167
  }
168
-
169
- p.quarterly {
170
- color: #21759B;
171
- font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
172
- font-size: 12px;
173
  line-height: 140%;
174
- margin: 5px 0;
175
- }
176
-
177
- /* End of dashboard widget css */
178
-
179
-
180
- /**
181
- * Display Purchase log Details CSS is HERE
182
- */
183
-
184
- #purchlogs_customfields {
185
- clear: both;
186
  }
187
-
188
- th#date {
189
- width: 120px;
 
 
 
190
  }
191
-
192
- th#purchid {
193
- width: 60px;
194
  }
195
-
196
- th#details {
197
- width: 100px;
198
  }
199
-
200
- th#track {
201
- width: 75px;
202
  }
203
-
204
- th#delete {
205
- width: 60px;
206
- }
207
-
208
- th#status {
209
- width: 200px;
210
- }
211
-
212
- #wpsc_items_ordered {
213
- clear: both;
214
- }
215
-
216
- .wpsc_pushdown_img {
217
- float: left;
218
- }
219
-
220
- #wpsc_purchlogitems_links {
221
- clear: both;
222
- }
223
-
224
- #wpsc_purchlog_order_status {
225
- float: right;
226
- width: 250px;
227
- }
228
-
229
- #wpsc_purchlog_order_status .selector {
230
- margin-top: -.2em;
231
- }
232
-
233
- /* Purchase Log Action Links */
234
-
235
- #wpsc_purchlogitems_links a {
236
- text-decoration: none;
237
- line-height: 14pt;
238
  }
239
-
240
- #wpsc_purchlogitems_links img {
241
- padding-top: 2px;
242
- float: left;
243
  }
244
-
245
- #wpsc_purchlogitems_links li .dashicons {
246
- margin-right: 10px;
247
  }
248
-
249
- #wpsc_purchlogitems_links li a {
250
- position: relative;
251
  }
252
-
253
- #wpsc_purchlogitems_links li a .spinner {
254
- display: none;
255
- float: none;
256
- margin: 0px;
257
- position: absolute;
258
- top: 0px;
259
- left: 0px;
260
  }
261
-
262
- #wpsc_purchlogitems_links li a .dashicons {
263
- color: #888;
264
  }
265
-
266
- #wpsc_purchlogitems_links li a .dashicons-yes {
267
- color: #7ad03a;
268
  }
269
-
270
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-delete .dashicons,
271
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-back .dashicons {
272
- color: #bbb;
273
  }
 
 
274
 
275
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-delete:hover .dashicons,
276
- #wpsc_purchlogitems_links li a .dashicons-no {
277
- color: #c00;
278
  }
279
-
280
- #wpsc_purchlogitems_links li a.wpsc-purchlog-action-link-back:hover .dashicons {
281
- color: #888;
282
  }
283
-
284
- #wpsc_purchlogitems_links li a.doing {
285
- padding-left: 30px;
286
  }
287
 
288
- #wpsc_purchlogitems_links li a.doing .spinner {
289
- display: block;
 
290
  }
291
-
292
- #wpsc_purchlogitems_links li a.doing .dashicons {
293
- display: none;
294
  }
295
-
296
- #wpsc_shipping_details_box {
297
- width: 45%;
298
- float: left;
299
- margin: .4em;
300
- padding: .6em;
301
- margin-right: 5em;
302
  }
303
-
304
- #wpsc_billing_details_box {
305
- width: 35%;
306
- float: left;
307
- margin: .4em;
308
- padding: .6em;
309
  }
 
 
 
310
 
311
- #wpsc_shipping_details_box em.field-blank,
312
- #wpsc_billing_details_box em.field-blank {
313
- color: #999;
314
- }
315
 
316
- #wpsc_purchlog_searchbox {
317
- width: 100%;
318
- text-align: right;
319
  }
320
-
321
-
322
- /**
323
  * Display Products CSS starts here
324
- */
325
-
326
  .tablenav select[name="bulkAction"] {
327
- width: 100px;
328
  }
329
-
330
- textarea#additional_description {
331
  border: 1px solid #dfdfdf;
 
 
 
 
 
 
 
 
332
  }
333
 
334
  #poststuff h3.form_heading {
335
- font-size: 1.1em;
336
  margin: 40px 0px 10px 0px;
337
  padding-left: 0px;
338
  }
339
 
340
  #poststuff h3.form_heading span {
341
- font-size: 0.8em;
342
  }
343
 
344
  div.search-box input#page-search-input {
345
  width: 129px;
 
346
  }
347
 
 
348
  #wpsc_product_list,
349
  table.widefat {
350
- width: 100%;
351
  }
352
 
353
  table.widefat .column-hidden_alerts {
354
- display: none;
355
  }
356
 
357
  #wpsc_product_list .column-cb,
358
  table.widefat .column-cb {
 
359
  vertical-align: middle;
360
  }
361
-
362
- #wpsc_product_list .column-image,
363
- #wpsc_product_list .product-image,
364
- table.widefat .column-image,
365
- table.widefat .product-image {
366
  padding-right: 0px;
367
  width: 42px;
368
  }
369
 
370
- .post-type-wpsc-product table.widefat .column-image img {
371
- max-width: 100%;
372
- max-height: 100%;
373
- width: auto;
374
- height: auto;
375
- }
376
-
377
  #wpsc_product_list .column-categories,
378
- table.widefat .column-categories {
 
379
  padding-right:18px;
380
  }
381
 
382
  #wpsc_product_list tbody tr td.column-title,
383
  table.widefat tbody tr td.column-title {
384
- border-right: none;
385
  }
386
 
387
  #wpsc_product_list tbody tr td.product-image img,
388
  table.widefat tbody tr td.product-image img {
389
  margin-top: 4px;
390
- cursor: move;
391
- }
392
-
393
-
394
- /**
395
- * Product Currency and Quantity Discount Layers
396
- */
397
-
398
- .wpsc-currency-layers {
399
- clear: both;
400
- margin: 0 0 15px 0;
401
- padding: 15px 0 0 0;
402
- }
403
-
404
- .wpsc-quantity-discounts {
405
- clear: both;
406
- margin: 0 0 20px 0;
407
- }
408
-
409
- .wpsc-currency-layers table,
410
- .wpsc-quantity-discounts table {
411
- border-collapse: collapse;
412
- margin: 10px 0;
413
- width: 100%;
414
- }
415
-
416
- .wpsc-quantity-discounts table {
417
- margin-top: 20px;
418
- }
419
-
420
- .wpsc-currency-layers th,
421
- .wpsc-quantity-discounts th {
422
- font-weight: normal;
423
- text-align: left;
424
- vertical-align: bottom;
425
- }
426
-
427
- .wpsc-currency-layers th.price,
428
- .wpsc-quantity-discounts th.price {
429
- width: 30%;
430
- }
431
-
432
- .wpsc-quantity-discounts th.qty {
433
- width: 40%;
434
- }
435
-
436
- .wpsc-quantity-discounts td {
437
- line-height: 28px;
438
- }
439
-
440
- .wpsc-quantity-discounts td.curr {
441
- text-align: right;
442
- }
443
-
444
- .wpsc-currency-layers th.remove,
445
- .wpsc-quantity-discounts th.remove {
446
- width: 20px;
447
- }
448
-
449
- .wpsc-currency-layers td,
450
- .wpsc-quantity-discounts td {
451
- padding: 3px 2px 3px 0px;
452
- }
453
-
454
- .wpsc-currency-layers .newCurrency {
455
- margin: 0px;
456
- width: 95%;
457
- }
458
-
459
- .wpsc-quantity-discounts .qty input {
460
- width: 4em;
461
- }
462
-
463
- .wpsc-currency-layers .newCurrPrice,
464
- .wpsc-quantity-discounts .newCurrPrice {
465
- width: 100%;
466
- }
467
-
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;
476
- width: 20px;
477
- height: 20px;
478
  }
479
 
480
- .wpsc_delete_currency_layer:hover,
481
- .wpsc-quantity-discounts .remove_line:hover {
482
- color: #c00;
483
  }
484
-
485
- div.wpsc_floatleft {
486
- width: 161px;
487
- float: left;
488
  }
489
-
490
  div.wpsc_floatleft label {
491
- line-height: 18px;
492
- white-space: nowrap;
493
- display: block
494
  }
495
 
496
-
497
- /**
498
- * Sortable product styling
499
- */
500
 
501
  table.product_editform {
502
- width: 100%;
503
  }
504
 
 
505
  #wpsc_product_list .ui-sortable-helper,
506
  table.widefat .ui-sortable-helper {
507
  width: 410px;
@@ -509,16 +318,12 @@ table.widefat .ui-sortable-helper {
509
  background-color: #FEFEFE;
510
  }
511
 
512
- #wpsc_product_list .ui-sortable-helper td,
513
- #wpsc_product_list .ui-sortable-helper th,
514
- table.widefat .ui-sortable-helper td,
515
- table.widefat .ui-sortable-helper th {
516
  border-top: 1px solid #DFDFDF;
517
  opacity: .4;
518
  }
519
-
520
- .wpsc-sortable-table-placeholder td,
521
- .product-placeholder {
522
  border-width: 1px;
523
  border-style: dashed;
524
  z-index: 900;
@@ -528,7 +333,7 @@ table.widefat .ui-sortable-helper th {
528
  }
529
 
530
  div#poststuff table tr td {
531
- vertical-align: top;
532
  }
533
 
534
  div#poststuff textarea {
@@ -542,15 +347,16 @@ div.admin_product_name label {
542
 
543
  div.admin_product_name {
544
  position: relative;
545
- height: 30px;
 
546
  background: #ffffff;
 
547
  border: 1px solid #dfdfdf;
 
 
548
  -webkit-border-radius: 6px;
549
- -khtml-border-radius: 6px;
550
- -moz-border-radius: 6px;
551
- border-radius: 6px;
552
  }
553
-
554
  div.admin_product_name input.wpsc_product_name {
555
  border: none;
556
  }
@@ -559,15 +365,16 @@ div.admin_product_name a.shorttag_toggle {
559
  position: absolute;
560
  top: 0px;
561
  right: 0px;
562
- background: url(../../wpsc-core/images/info_icon.jpg) no-repeat scroll 5px 8px;
563
- border-left: 1px solid #DFDFDF;
564
- display: block;
565
- height: 100%;
566
- padding: 0px 3px 0px 3px;
567
- width: 18px;
568
  }
569
 
570
- div#icon_card {
 
571
  float: left;
572
  height: 36px;
573
  margin: 7px 8px 0 0;
@@ -575,38 +382,80 @@ div#icon_card {
575
  background: url(../../wpsc-core/images/icon32.png) no-repeat center center;
576
  }
577
 
578
- /* Can .admin_product_shorttags be deprecated */
579
-
580
  div.admin_product_shorttags {
581
- width: 93%;
582
- min-width: 396px;
583
- max-width: 558px;
 
584
  clear: both;
585
  padding: 6px;
586
  font-size: 8pt;
587
- margin: 0 0 0 6px !important;
588
- border-left: 1px solid #DFDFDF;
589
- border-right: 1px solid #DFDFDF;
590
- border-bottom: 1px solid #DFDFDF;
 
591
  display: none;
 
592
  background-color: #ffffff;
593
  }
594
 
595
  #description {
596
- margin: 0;
 
597
  }
598
 
599
  h4.product_action_link {
600
- margin: 4px 0px 0px 0px;
 
 
 
 
 
 
 
 
601
  display: block;
602
- font-weight: bold;
 
 
 
 
603
  }
604
 
605
 
606
- /**
607
- * Image form styling
608
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  div.flash-image-uploader {
611
  display: none;
612
  }
@@ -615,100 +464,150 @@ div.flash-image-uploader {
615
  position: relative;
616
  border: none;
617
  }
618
-
619
- #wpbody-content div.flash-image-uploader #media-items .progress {
620
  position: static;
621
- margin: 0 0 6px;
622
  height: 16px;
623
  }
624
 
625
- .ui-selected {
626
- border: 2px dashed #969696;
 
627
  }
628
 
629
- img.deleteButton {
 
 
 
630
  display: none;
631
- position: absolute;
632
- top: -5px;
633
- right: -1px;
634
- width: 16px;
635
- height: 16px;
 
 
 
 
 
636
  cursor: pointer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  }
638
 
 
 
 
 
 
 
 
 
 
639
  a.editButton {
640
- background: #FFFFFF none repeat scroll 0%;
641
- height: 20px;
642
- display: none;
643
- position: absolute;
644
- right: 0px;
645
- top: 0px;
646
- padding-bottom: 3px;
647
- padding-left: 3px;
648
- cursor: pointer;
649
  }
650
 
651
  div.image_settings_box {
652
- position: absolute;
653
- width: 150px;
654
- display: none;
655
  margin: -66px 0px 0px 36px;
656
- padding-top: 2px;
657
- width: 252px;
658
- z-index: 69;
 
 
659
  }
660
 
661
  a.thickbox img {
662
- border: medium none;
663
  }
664
 
665
  img.previewimage {
666
- cursor: move;
667
- height: 60px;
668
- margin-right: 4px;
669
- width: 60px;
670
  }
671
 
672
  div.lower_settings_box {
673
- width: 234px;
674
- background-color: white;
675
- border: 1px solid black;
676
- border-top: 1px solid #CCCCCC;
677
- float: right;
678
  margin: -1px -6px 0px 0px;
679
  padding: 2px 0 0 4px;
680
- background-color: #EAF3FA;
681
  }
682
 
683
  div.upper_settings_box {
684
- width: 250px;
685
- background-color: white;
686
- border: 1px solid black;
687
- padding: 3px 1px 2px 5px;
688
  }
689
 
690
  div.upper_image {
691
- float: left;
692
- padding-left :5px;
693
- margin-left: -5px;
694
- margin-right: -7px;
695
- padding-bottom: 4px;
 
 
 
 
696
  }
697
 
698
- div.upper_txt {
699
- padding-left: 22px;
700
- color: #666666;
701
  }
702
 
703
  div.previewimage {
704
- position: relative;
 
 
 
 
 
 
 
 
 
705
  }
706
 
707
- tr.edit_product_image * {
708
- z-index: 80;
709
  }
710
 
711
- div.browser-image-uploader h4 {
712
  margin-bottom: 8px;
713
  }
714
 
@@ -720,32 +619,29 @@ div.image_resize_extra_forms {
720
  width: 100%;
721
  }
722
 
723
- #wpsc_product_category_and_tag_forms table td.itemfirstcol {
724
- padding-left: 3pt;
725
  width: 50%;
726
  }
727
 
 
728
 
729
- /**
730
- * Variations CSS starts
731
- */
732
-
733
- table.product_variation_listing {
734
  margin-bottom: 12px;
735
  }
736
 
737
- table.product_variation_listing th.variation_name {
738
  color: #71A4C8;
739
  font-style: italic;
740
  text-align: left;
741
  padding-bottom: 1px;
742
  }
743
 
744
- table.product_variation_grid {
745
  margin-top: 12px;
746
  }
747
 
748
- table.product_variation_grid th.variation_name {
749
  color: #71A4C8;
750
  font-style: italic;
751
  text-align: left;
@@ -755,14 +651,12 @@ table.product_variation_grid th.variation_name {
755
  div#edit_variations_container {
756
  margin-top: 12px;
757
  }
758
-
759
  table.product_variation_grid {
760
  border-collapse: collapse;
761
  margin-top: 0px;
762
  }
763
 
764
- table.product_variation_grid tr td,
765
- table.product_variation_grid tr th {
766
  border: 1px solid #cccccc;
767
  border-collapse: collapse;
768
  text-align: left;
@@ -781,17 +675,16 @@ table.product_variation_grid tr th.price {
781
  width: 78px;
782
  }
783
 
784
- table.product_variation_grid tr td.variations,
785
- table.product_variation_grid tr th {
786
  padding: 4px 0px 4px 10px;
787
  }
788
 
789
- table.product_variation_grid tr td.variations,
790
- table.product_variation_grid tr th.variations {
791
  width: 300px;
792
  }
793
 
794
- table.product_variation_grid tr td input {
 
795
  padding: 0px 3px 0px 3px;
796
  }
797
 
@@ -800,11 +693,10 @@ table.product_variation_grid tr.group_boundary td {
800
  }
801
 
802
  a.about_this_page_sub {
803
- text-decoration: underline;
804
  }
805
 
806
- table.product_variation_grid tr td,
807
- table.product_variation_grid tr th {
808
  border: 1px solid #cccccc;
809
  border-collapse: collapse;
810
  text-align: left;
@@ -819,14 +711,15 @@ table.product_variation_grid tr.settings_row td {
819
  padding: 0px !important;
820
  }
821
 
 
822
  table.product_variation_grid tr.settings_row td div.variation_settings {
823
  display: none;
824
  border-top: 1px dotted #cccccc;
825
  width: 100%;
826
  min-height: 30px;
827
  padding: 4px 10px;
828
- }
829
 
 
830
  table.product_variation_grid tr th {
831
  border-bottom: 1px solid #969696;
832
  }
@@ -840,23 +733,22 @@ table.product_variation_grid tr th.price {
840
  width: 78px;
841
  }
842
 
843
- table.product_variation_grid tr td.variations,
844
- table.product_variation_grid tr th {
845
  padding: 4px 0px 4px 10px;
846
  }
847
 
848
- table.product_variation_grid tr td.variations,
849
- table.product_variation_grid tr th.variations {
850
  width: 300px;
851
  }
852
 
853
- table.product_variation_grid tr td input {
 
854
  padding: 0px 3px 0px 3px;
855
  }
856
 
857
- table.product_variation_grid tr td input.checkbox {
858
  display: block;
859
- margin: 6px auto;
860
  }
861
 
862
  table.product_variation_grid tr.group_boundary td {
@@ -880,22 +772,22 @@ a.variation_edit_button {
880
  height: 16px;
881
  width: 16px;
882
  margin: 4px auto 0px auto;
 
883
  }
884
 
885
- div.variation_settings div.variation_settings_contents {
886
  padding-left: 10px;
887
  }
888
 
889
  div.select_variation_file {
890
  padding-left: 6px;
891
  }
892
-
893
  div.select_variation_file p {
894
- margin: 0 0 3px;
895
  }
896
 
897
  div.select_variation_file p {
898
- margin: 0 0 3px;
899
  }
900
 
901
  div.select_variation_file p input {
@@ -904,90 +796,86 @@ div.select_variation_file p input {
904
  }
905
 
906
  .variation_checkboxes li {
907
- margin: 0;
908
  }
909
 
910
  .variation_checkboxes ul {
911
- margin-left: 30px;
912
  }
913
 
914
  .js .variation_checkboxes .children {
915
- display: none;
916
  }
917
 
918
  .js .variation_checkboxes .expanded .children {
919
- display: block;
920
  }
921
 
922
  .variation_checkboxes a.expand {
923
- background: url(arrows.png) no-repeat left -108px;
924
- display: inline-block;
925
- height: 15px;
926
- width: 15px;
927
- text-indent: -999em;
928
- vertical-align: middle;
929
  }
930
 
931
  .variation_checkboxes .expanded a.expand {
932
- background-position: left top;
933
  }
934
 
935
  #add-new-variation-set {
936
- margin-bottom: 20px;
937
- display: none;
938
  }
939
 
940
  #add-new-variation-set p {
941
- position: relative;
942
  }
943
 
944
  #add-new-variation-set p.howto {
945
- margin-bottom: 16px;
946
  }
947
 
948
  #add-new-variation-set p label.focus {
949
- color: #666;
950
  }
951
 
952
  #add-new-variation-set p.error label {
953
- color: red;
954
  }
955
 
956
  #add-new-variation-set p label {
957
- color: #000;
958
- cursor: text;
959
- left: 6px;
960
- position: absolute;
961
- top: 4px;
962
  }
963
 
964
  #add-new-variation-set .text-field {
965
- width: 195px;
966
  }
967
 
968
  .variation-set-prototype {
969
- display: none;
970
  }
971
-
972
- /* Variations CSS ends */
973
 
974
  div#side-sortables input[type="file"] {
975
- width: 250px;
976
  }
977
-
978
  .wpsc_product_downloads_header {
979
  margin: 0 0 5px;
980
  }
981
-
982
  .select_product_file,
983
  .edit_select_product_file {
984
- margin-bottom: 0;
985
- margin-top: 3px;
986
- overflow-x: hidden;
987
- overflow-y: auto;
988
- position: relative;
989
- width: 100%;
990
- }
991
 
992
  span.select_product_note {
993
  margin: 0 0 5px;
@@ -999,58 +887,65 @@ img.wpsc_add_download {
999
  top: 2px;
1000
  }
1001
 
 
 
 
 
 
 
1002
  a.file_delete_button {
1003
- cursor: pointer;
1004
- color: red;
1005
  display: block;
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;
1013
- font-size: 11px;
1014
- padding: 1px 2px;
1015
- text-decoration: none;
1016
- }
1017
-
1018
- .greytext {
1019
- color: #666666;
1020
- }
1021
-
1022
- span.small_italic {
1023
  font-style: italic;
1024
  }
 
 
 
 
1025
 
1026
- /* Product details form styling ends */
1027
-
1028
- /* Display Products CSS ends here */
1029
-
1030
-
1031
- /**
1032
- * Product Groups styles start here
1033
- */
1034
-
1035
- td.firstcol div.postbox div.inside {
1036
  margin: 0px;
1037
  padding: 0px;
1038
  }
1039
 
1040
- table#productpage {
1041
  width: 100%;
1042
  clear: both;
1043
  border-collapse: collapse;
1044
  }
1045
 
1046
- table#productpage tr td {
1047
  vertical-align: top;
 
1048
  }
1049
 
1050
- table#productpage tr td.secondcol {
 
 
1051
  padding: 0px 2px 0px 16px;
 
1052
  }
1053
 
 
1054
  table.category-edit {
1055
  border-collapse: collapse;
1056
  width: 100%;
@@ -1063,100 +958,93 @@ table.category-edit tr td.column-title {
1063
  width: 450px;
1064
  }
1065
 
 
1066
  div.category-image-container {
1067
  width: 55px;
1068
  height: 30px;
 
1069
  }
1070
 
1071
  div.category-image-container img {
1072
  float: left;
1073
  }
1074
-
1075
  div.category-image-container img.category_indenter {
1076
  margin-right: 3px;
1077
- width: auto;
1078
- float: left;
1079
  }
1080
 
1081
- div#productform {
1082
- display: none;
1083
- width: 99.5%;
1084
- }
1085
 
1086
- div#edititem27 {
1087
- display: none;
1088
- width: 586px;
1089
- }
1090
 
1091
- div#productform table tr td {
1092
- height: 11px !important;
1093
- }
1094
 
1095
- div#blank_item {
1096
- display: block;
1097
- }
1098
 
1099
- #poststuff div#blank_item h3 {
 
 
 
 
 
 
 
 
 
 
 
1100
  margin-top: 0px;
1101
- }
1102
 
1103
- div#additem {
1104
- display: none;
1105
  }
1106
 
1107
- div#productform td.itemfirstcol {
1108
- padding-left: 4px;
1109
- vertical-align: top;
1110
- }
1111
 
1112
- div#productform input.text,
1113
- div#additem input.text {
1114
- width: 386px;
1115
- border: 1px solid #bbb;
 
 
 
 
1116
  }
1117
 
 
1118
  table.category_forms {
1119
  width: 100%;
1120
  }
1121
-
1122
  table.category_forms tr td {
1123
  padding: 0px;
1124
  padding-right: 8px;
1125
  }
1126
-
1127
- table.category_forms tr td textarea {
1128
  width: 386px;
1129
  }
1130
 
1131
- div#edit_variation_values input.text {
1132
- width: 286px !important;
1133
- border: 1px solid #bbb;
1134
- }
1135
 
1136
- input.image_resize {
1137
- position: relative;
1138
- top: 4px;
1139
- }
1140
 
1141
- div#additem table.additem input.wpsc_tag {
1142
- width: 180px;
1143
  }
1144
-
1145
- div#additem label {
1146
  font-style: normal;
1147
  font-size: 0.95em;
1148
  }
1149
 
1150
- .groupItem {
1151
- border-top: 1px solid #bbb;
1152
- width: 385px;
1153
- height: 35px;
 
 
 
 
1154
  clear: both;
 
1155
  padding: 0px 0px 4px 0px;
1156
  }
1157
 
1158
- .groupItem .itemHeader {
1159
- width: 65px;
1160
  line-height: 15px;
1161
  color: #000;
1162
  padding: 4px;
@@ -1166,25 +1054,24 @@ div#additem label {
1166
  clear: both;
1167
  }
1168
 
1169
- .groupItem .itemHeader a {
1170
  margin: 4px 0px 4px 0px;
1171
  font-weight: normal;
1172
  font-size: 11px;
1173
  text-decoration: none;
1174
  }
1175
-
1176
- .sortHelper {
1177
  border: 3px dashed #666;
1178
  width: auto;
1179
  }
1180
-
1181
- .groupWrapper p {
1182
  height: 1px;
1183
  overflow: hidden;
1184
  margin: 0;
1185
  padding: 0;
1186
  }
1187
 
 
1188
  table#productpage tr td.secondcol.product_groups_page {
1189
  padding-left: 16px;
1190
  }
@@ -1194,42 +1081,41 @@ table#productpage tr td.secondcol.product_groups_page h4 {
1194
  margin-top: 20px;
1195
  }
1196
 
1197
- td.product_groups_page #additem .inside,
1198
- td.product_groups_page #productform .inside {
1199
  margin: 0px 0px 15px 0px;
1200
  }
1201
 
1202
  div.editing_this_group {
1203
  margin-top: 8px;
1204
  margin-bottom: 8px;
1205
- width: 100%;
 
1206
  }
1207
 
1208
  td.product_groups_page h4 {
1209
  margin-bottom: 1ex;
1210
  }
1211
-
1212
- #editorcontainer {
1213
- clear: both;
1214
  }
1215
-
1216
  td.product_groups_page td.category_presentation_settings {
1217
  padding-bottom: 1ex;
1218
  }
1219
 
1220
  div.editing_this_group {
1221
- font-size: 8pt;
1222
  }
1223
 
1224
  div.editing_this_group p {
1225
- padding: 4px 4px 4px 8px;
1226
  }
1227
 
1228
  div.editing_this_group dl {
1229
- padding: 4px 4px 4px 8px;
1230
  }
1231
 
1232
- #blank_item a.add_category_link {
 
1233
  display: block;
1234
  margin: 8px 8px 8px 0px;
1235
  text-decoration: underline;
@@ -1239,6 +1125,7 @@ div.product_group {
1239
  margin: 12px 0px 10px 0px;
1240
  }
1241
 
 
1242
  table#wpsc_category_list td div.subcategory img.category_indenter {
1243
  float: left;
1244
  margin: 8px 0px 0px 0px;
@@ -1248,11 +1135,8 @@ table#wpsc_category_list td div.subcategory table.itemlist {
1248
  float: left;
1249
  }
1250
 
1251
- label.select_categorisation_group,
1252
- select#select_categorisation_group,
1253
- a.add_categorisation_group,
1254
- a.edit_categorisation_group,
1255
- #submit_categorisation_form span {
1256
  display: block;
1257
  float: left;
1258
  }
@@ -1269,6 +1153,7 @@ a.edit_categorisation_group,
1269
 
1270
  label.select_categorisation_group {
1271
  padding-top: 4px;
 
1272
  font-size: 11px;
1273
  }
1274
 
@@ -1280,38 +1165,39 @@ a.edit_categorisation_group {
1280
  margin-left: 30px;
1281
  }
1282
 
1283
- div#add_categorisation,
1284
- div#edit_categorisation {
 
1285
  display: none;
1286
  border: 1px solid #BBBBBB;
1287
  padding: 4px;
1288
  margin-top: 6px;
1289
  }
1290
 
1291
- div#add_categorisation br,
1292
- div#edit_categorisation br {
1293
  clear: both;
1294
  }
1295
 
1296
- div#add_categorisation fieldset,
1297
- div#edit_categorisation fieldset {
1298
  width: 230px;
1299
  float: left;
1300
  border: none;
1301
  }
1302
 
1303
- div#add_categorisation fieldset label,
1304
- div#edit_categorisation fieldset label {
1305
  display: block;
1306
  }
1307
 
1308
- ul.categorisation_links {
1309
  list-style-type: none;
1310
  clear: both;
1311
  padding: 0px;
1312
  }
1313
-
1314
- ul.categorisation_links li {
 
 
1315
  display: block;
1316
  float: left;
1317
  list-style-type: none;
@@ -1320,34 +1206,24 @@ ul.categorisation_links li {
1320
  padding: 4px;
1321
  }
1322
 
1323
- ul.categorisation_links li.selected a {
1324
  color: #D54E21;
1325
  }
1326
 
1327
- .multiple-select-container {
1328
- margin-left: 0.5em;
1329
- }
1330
-
1331
  .multiple-select {
1332
  background: white none repeat scroll 0px 0px;
1333
  border: 1px solid #DFDFDF;
1334
  display: inline-block;
1335
  height: 120px;
 
1336
  overflow-x: hidden;
1337
  overflow-y: auto;
1338
- padding: 0 0 0 5px;
1339
  position: relative;
 
1340
  }
1341
 
1342
- .multiple-select input {
1343
- width: inherit;
1344
- }
1345
-
1346
- .multiple-select label {
1347
- display: inherit;
1348
- }
1349
-
1350
- table.category_forms a.delete_button {
1351
  display: block;
1352
  margin: 3px 0px 0px 8px;
1353
  float: left;
@@ -1357,65 +1233,64 @@ table.category_forms td.last_row {
1357
  padding: 16px 0px 0px 0px;
1358
  }
1359
 
1360
- .wpsc_gold_float {
1361
- min-width: 45%;
1362
- float: left;
1363
- max-width: 450px;
 
1364
  }
1365
-
1366
- .wpsc_gold_text {
1367
- width: 70%;
1368
- float: left;
1369
- clear: both;
 
 
 
 
1370
  }
1371
 
1372
- .wpsc_gold_info {
1373
- width: 30%;
1374
- float: right;
1375
  text-align: center;
1376
- font-size: 20px;
1377
  }
 
 
 
1378
 
1379
- .wpsc_gold_module {
1380
- width: 100%;
1381
- float: left;
1382
  border-bottom: 1px solid #DFDFDF;
1383
  }
1384
-
1385
- .wpsc_gold_module strong {
1386
- width: auto;
1387
- float: left;
1388
  }
1389
-
1390
- #visitInstinct {
1391
- float: right;
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 {
@@ -1425,27 +1300,27 @@ a.admin_download {
1425
  text-decoration: none;
1426
  }
1427
 
1428
- a.admin_download img {
1429
  margin-right: 3px;
1430
  }
1431
 
1432
- a.admin_download span {
1433
  text-decoration: underline;
1434
  }
1435
 
1436
-
1437
- /**
1438
- * Product Groups styles end here
1439
- */
1440
-
1441
- .wpsc_td_note {
1442
- padding-bottom: 0 !important;
1443
  }
1444
 
1445
  .wpsc_purchaselogs_options {
1446
  margin: 0px 0px 8px 0px;
 
1447
  }
1448
 
 
1449
  p.add_new_form_set_forms {
1450
  display: none;
1451
  }
@@ -1453,13 +1328,14 @@ p.add_new_form_set_forms {
1453
  td.product-image a img.attachment-thumbnail {
1454
  height: 38px;
1455
  width: 38px;
 
1456
  }
1457
 
1458
  #wpsc_product_category_and_tag_forms .tagchecklist {
1459
- font-size: 11px;
1460
  }
1461
 
1462
- #categorydiv div {
1463
  margin-top: 4px;
1464
  }
1465
 
@@ -1469,134 +1345,290 @@ a.variation_handle {
1469
  font-size: 15px;
1470
  }
1471
 
1472
- .toplevel_page_wpsc-edit-products .wrap h2 {
1473
- padding-bottom: 0px;
1474
- border-bottom: 1px solid #CCC;
 
1475
  }
1476
-
1477
- #post-body #advanced-sortables {
1478
- margin-right: 300px
1479
  }
1480
-
1481
  #media-buttons #add_audio,
1482
  #media-buttons #add_video,
1483
  #media-buttons #add_media {
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
- */
1495
-
1496
- div.modify_coupon {
1497
- border: 1px solid #eeeeee;
 
 
1498
  display: none;
1499
- width: 100%;
 
1500
  }
1501
-
1502
- table.coupon_data {
1503
- width: 100%;
 
1504
  }
1505
-
1506
- table.add-coupon {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1507
  width: 100%;
 
1508
  }
1509
-
1510
- table.add-coupon tr th {
1511
- text-align: left;
1512
- padding: 2px 5px 0px 5px;
1513
- border: none;
1514
  }
1515
-
1516
- table.add-coupon tr td {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1517
  text-align: left;
1518
- padding: 2px 5px 2px 5px;
1519
- border: none;
1520
  }
1521
-
1522
- table.add-coupon tr td p {
1523
- padding: 0;
1524
- margin: 5px;
 
 
1525
  }
1526
- #table_header {
1527
- font-size: 16px;
1528
- margin-top: 20px;
 
1529
  font-weight: bold;
1530
  }
1531
-
1532
- table.coupon-list {
 
 
 
 
 
1533
  width: 100%;
1534
  }
1535
-
1536
- table.coupon-list th {
1537
- text-align: left;
1538
  }
1539
-
1540
- table.coupon-list tr.toprow td {
1541
- text-align: left;
1542
- font-weight: bold;
1543
  }
1544
-
1545
- table.coupon-list tr td {
1546
- padding: 5px 5px 10px 10px;
1547
- vertical-align: middle;
1548
  }
1549
-
1550
- table.coupon-list tr.alt {
1551
- background-color: #eeeeee;
1552
  }
1553
-
1554
- table.coupon-list tr.alt td {
1555
- background-color: #eeeeee;
1556
  }
1557
-
1558
- table.coupon-list tr.coupon_edit td {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1559
  padding: 0;
 
 
1560
  }
1561
-
1562
- td#order_summary_container {
1563
- width: 80px;
1564
  }
1565
-
1566
- table.category_forms a.delete_button,
1567
- span.delete_button {
1568
- color: #FF0000;
1569
- display: block;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1570
  float: left;
1571
- font-size: 11px;
1572
- margin: 3px 0 0 8px;
1573
- text-decoration: underline;
 
 
 
 
 
 
 
 
 
 
 
 
1574
  }
 
1575
 
1576
- p span.input_label {
1577
- font-size: 1.2em;
1578
- width: 180px;
1579
- float: left;
 
 
 
 
 
 
 
 
1580
  }
 
 
 
 
 
1581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1582
  a.wpsc_featured_product_toggle {
1583
  display: block;
1584
  height: 18px;
1585
  width: 18px;
1586
- margin: 4px 0px 0px 0px;
1587
- }
1588
-
1589
- .column-featured a {
1590
- background: url(../../wpsc-core/images/core-sprite.png) no-repeat 0 -32px transparent;
1591
  }
1592
 
1593
- .column-featured a.gold-star {
1594
- background-position: 0 -16px;
1595
- }
1596
 
1597
- .column-featured a:active,
1598
- .column-featured a.gold-star:active {
1599
- background-position: 0 0;
1600
  }
1601
 
1602
  div.wpsc_clear {
@@ -1610,6 +1642,7 @@ div.wpsc_clear {
1610
  position: relative;
1611
  }
1612
 
 
1613
  .wpsc_featured .item_text {
1614
  float: left;
1615
  height: 240px;
@@ -1628,12 +1661,13 @@ div.wpsc_clear {
1628
  height: 240px;
1629
  width: 340px;
1630
  border: 1px solid #FEFAF1;
 
 
1631
  -webkit-border-radius: 18px;
1632
- -moz-border-radius: 18px;
1633
- border-radius: 18px;
1634
  background-repeat: no-repeat;
1635
  }
1636
 
 
1637
  .wpsc_featured .item_text h3 {
1638
  font-size: 1.4em;
1639
  margin: 0px 0px 8px 0px;
@@ -1644,167 +1678,172 @@ div.wpsc_clear {
1644
  line-height: normal;
1645
  display: block;
1646
  margin: 0px 0px 4px 0px;
 
1647
  }
1648
 
1649
  .wpsc_featured .item_text .wpsc_description {
1650
  font-size: 1em;
1651
- line-height: 24px;
1652
- display: block;
1653
- float: left;
1654
  width: auto;
1655
  color: #9B9A96;
1656
- font-family: Georgia, "Bitstream Charter", serif;
1657
  }
1658
 
1659
  .wpsc_featured .item_text .wpsc_description p {
1660
  margin-bottom: 0px;
1661
  }
1662
 
 
1663
  .wpsc_featured .item_text .wpsc_description a {
1664
- color: #9B9A96;
1665
  }
1666
 
1667
  ul.wpsc_categories {
1668
  clear: both;
1669
  }
1670
 
1671
- a.update_variations_action {
1672
- vertical-align: middle;
 
1673
  }
1674
-
1675
  #poststuff .inside p.update-variations {
1676
- display: none;
1677
- margin-top: 1em;
1678
  }
1679
-
1680
- #search-products {
1681
- width: auto;
1682
- float: right;
1683
  }
1684
-
1685
- .productnav {
1686
- height: 30px;
1687
- margin: 6px 0px 4px;
1688
- vertical-align: middle;
1689
  }
1690
 
1691
  #wpsc_stock_control_forms .edit_stock {
1692
- margin-top: 15px;
1693
- line-height: 16px;
1694
  }
1695
-
1696
  #wpsc_stock_control_forms .unpublish_when_none_left,
1697
  #wpsc_stock_control_forms .notify_when_none_left {
1698
- margin: 0.5em 0;
1699
  }
1700
-
1701
  #media-upload form p.help {
1702
- text-align: left;
1703
- clear: both;
 
 
 
 
 
 
 
 
 
 
 
1704
  }
1705
 
 
 
 
 
1706
  ul#category_list_li li:hover span.handle {
1707
- cursor: move;
 
 
1708
  }
1709
-
1710
  ul#category_list_li li span.handle {
1711
- float: left;
 
1712
  padding: 5px;
 
1713
  }
1714
 
1715
- .category_admin_list_img a.row-title {
1716
  text-decoration: none;
1717
  }
1718
 
 
1719
  .category_admin_list_img:hover div.row-actions {
1720
- visibility: visible;
1721
  }
1722
 
1723
  ul#category_list_li ul {
1724
- margin-left: 15px;
1725
  }
1726
 
1727
  .row-title img {
1728
- width: 30px;
1729
- float: left;
1730
- padding-right: 10px;
1731
  }
1732
-
1733
  .row-title {
1734
- margin-right: 5px;
1735
  }
1736
-
1737
  body.edit-php form#posts-filter {
1738
- min-width: 830px;
1739
  }
1740
-
1741
  input.wpsc_cat_image_size {
1742
- width: 40px
1743
  }
1744
-
1745
  input.wpsc_cat_box {
1746
- width: auto;
1747
- margin: 6px;
1748
- vertical-align: middle;
1749
  }
1750
 
1751
- .wpsc_ie_field {
1752
- width: 100%;
1753
  }
1754
-
1755
  .wpsc_inline_actions .loading_indicator {
1756
- position: relative;
1757
- top: 3px;
1758
- left: 2px;
1759
  visibility: hidden;
1760
  }
1761
-
1762
  table.tags th#image {
1763
- width: 60px;
1764
  }
1765
-
1766
-
1767
- /**
1768
- * Quick and bulk edit product
1769
- */
1770
-
1771
  #wpbody-content .bulk-edit-row-post fieldset.wpsc-cols {
1772
- width: 49%;
1773
- margin-top: 0;
1774
  }
1775
 
1776
  #wpbody-content .quick-edit-row-post .inline-edit-col-left {
1777
- width: 35%;
1778
  }
1779
 
1780
  .bulk-edit-row-post fieldset.inline-edit-col-right label span.title {
1781
- padding-right: 0.5em;
1782
- width: auto;
1783
  }
1784
 
1785
  .wpsc-quick-edit {
1786
- width: 30%;
1787
- float: left;
1788
  }
1789
 
1790
  textarea.tax_input_product_tag {
1791
- width: 50% !important;
1792
- height: 95px !important;
1793
  }
1794
 
1795
  ul.wpsc_product_category-checklist {
1796
- height: 280px;
1797
  }
1798
 
1799
- span.wpsc-quick-edit {
1800
- width: 77px;
1801
- display: block;
1802
- float: left;
1803
  }
1804
-
1805
- .wpsc_var_description {
1806
- margin: 20px 0 0 20px !important;
1807
- color: red;
1808
  }
1809
 
1810
  .ajax-loading {
@@ -1812,185 +1851,173 @@ span.wpsc-quick-edit {
1812
  }
1813
 
1814
  #cart_options .delete {
1815
- color: #c00;
1816
- float: right;
1817
  }
1818
-
1819
  #cart_options .delete:hover {
1820
- color: #D54E21;
1821
  }
1822
 
1823
  .dashboard_page_wpsc-update .wpsc-progress-bar {
1824
- position: relative;
1825
- height: 20px;
1826
- width: 300px;
1827
- border: 1px solid #3a58cf;
1828
- margin: -0.75em 0 27px;
1829
  }
1830
 
1831
  .dashboard_page_wpsc-update .wpsc-progress-bar * {
1832
- position: absolute;
1833
- left: 0;
1834
- top: 0;
1835
- background: #f9f9f9;
1836
- font-size: 12px;
1837
  }
1838
 
1839
  .dashboard_page_wpsc-update .wpsc-progress-bar .block {
1840
- background-color: #527dff;
1841
- z-index: -1;
1842
- height: 20px;
1843
  }
1844
 
1845
  .dashboard_page_wpsc-update .wpsc-progress-bar span {
1846
- display: block;
1847
- left: 310px;
1848
- line-height: 20px;
1849
- width: 200px;
1850
  }
1851
 
1852
  .dashboard_page_wpsc-update .wpsc-progress-bar .eta {
1853
- top: 22px;
1854
- line-height: 15px;
1855
- width: 100%;
1856
  }
1857
 
1858
- .downloadables_float {
1859
  float: right;
1860
- width: 80px;
1861
  vertical-align: middle;
 
1862
  }
1863
 
1864
- .downloadables_headding1 {
1865
  display: inline;
1866
- float: left;
1867
  text-align: left;
1868
  vertical-align: middle;
1869
  width: auto;
1870
  }
1871
 
1872
  img.ajax-feedback-active {
1873
- vertical-align: middle;
1874
- visibility: visible;
1875
  }
1876
 
1877
  .dashboard_page_wpsc-purchase-logs .column-id {
1878
- width: 75px;
1879
  }
1880
 
1881
  .dashboard_page_wpsc-purchase-logs .column-amount {
1882
- width: 100px;
1883
  }
1884
 
1885
- .js table.purchase-logs td.column-status span,
1886
- table.purchase-logs .column-status select {
1887
- display: none;
1888
  }
1889
 
1890
  .js table.purchase-logs .column-status select {
1891
- display: inline-block;
1892
- margin-right: 5px;
1893
  }
1894
 
1895
  table.purchase-logs .column-tracking .empty {
1896
- position: relative;
1897
  }
1898
 
1899
  table.purchase-logs .column-tracking .empty .send-email {
1900
- display: none;
1901
  }
1902
 
1903
  table.purchase-logs .column-tracking .add {
1904
- position: absolute;
1905
- left: 6px;
1906
- top: 4px;
1907
  }
1908
 
1909
  table.purchase-logs .column-tracking {
1910
- width: 200px;
1911
  }
1912
 
1913
  table.purchase-logs .column-tracking input[type="text"] {
1914
- width: 180px;
1915
  }
1916
 
1917
  table.purchase-logs .column-tracking a.save {
1918
- display: none;
1919
- float: right;
1920
  }
1921
 
1922
  table.purchase-logs .column-tracking a.add {
1923
- display: none;
1924
- color: #ccc;
1925
- cursor: text;
1926
  }
1927
 
1928
  table.purchase-logs .column-tracking .empty a.add {
1929
- display: inline;
1930
  }
1931
 
1932
  table.purchase-logs .column-tracking .ajax-feedback {
1933
- display: none;
1934
- float: right;
1935
- margin-top: 5px;
1936
  }
1937
 
1938
  table.purchase-logs .column-tracking .ajax-feedback-active {
1939
- display: inline-block;
1940
  }
1941
 
1942
  table.purchase-logs .column-tracking em.sent {
1943
- color: green;
1944
  }
1945
 
1946
  table.purchase-logs .column-id .delete {
1947
- color: red;
1948
- visibility: hidden;
1949
  }
1950
 
1951
  table.purchase-logs tr:hover .column-id .delete {
1952
- visibility: visible;
1953
  }
1954
 
1955
-
1956
- /**
1957
- * Product Variations
1958
- */
1959
-
1960
  .no-js #wpsc_product_variation_forms iframe {
1961
- height: 300px;
1962
  }
1963
 
1964
  .js #wpsc_product_variation_forms iframe {
1965
- border: 0;
1966
- margin: 0;
1967
- overflow: hidden;
1968
- padding: 0;
1969
- }
1970
-
1971
- #wpsc_product_variation_forms .inside {
1972
- margin: 0;
1973
- padding: 0 12px 0 12px;
1974
  }
1975
 
1976
  #wpsc_product_variation_forms iframe {
1977
- background: transparent;
1978
- width: 100%;
1979
  }
1980
 
1981
  .wpsc-product-variation-iframe {
1982
  min-width: 400px;
1983
- padding: 6px 0 12px 0;
1984
- overflow:hidden;
1985
  }
1986
 
1987
  #wpsc-product-variations-wrapper .tablenav.top {
1988
- margin-top: 0;
1989
  }
1990
 
1991
  .wpsc-save-variations-top {
1992
- float: right;
1993
- margin: 8px 0 5px;
1994
  }
1995
 
1996
  #wpsc-product-variations-wrapper .column-stock input[type="text"],
@@ -1998,11 +2025,12 @@ table.purchase-logs tr:hover .column-id .delete {
1998
  #wpsc-product-variations-wrapper .column-price input[type="text"],
1999
  #wpsc-product-variations-wrapper .column-sale_price input[type="text"],
2000
  #wpsc-product-variations-wrapper .column-sku input[type="text"] {
2001
- width: 100%;
2002
- -webkit-box-sizing: border-box;
2003
- -moz-box-sizing: border-box;
2004
- -o-box-sizing: border-box;
2005
- box-sizing: border-box;
 
2006
  }
2007
 
2008
  #wpsc-product-variations-wrapper .inline-edit-row.column-stock input[type="text"],
@@ -2018,8 +2046,8 @@ table.purchase-logs tr:hover .column-id .delete {
2018
  #wpsc-product-variations-wrapper .column-price,
2019
  #wpsc-product-variations-wrapper .column-sale_price,
2020
  #wpsc-product-variations-wrapper .column-sku {
2021
- text-align: center;
2022
- width: 11%;
2023
  }
2024
 
2025
  #wpsc-product-variations-wrapper .column-stock input,
@@ -2027,12 +2055,15 @@ table.purchase-logs tr:hover .column-id .delete {
2027
  #wpsc-product-variations-wrapper .column-price input,
2028
  #wpsc-product-variations-wrapper .column-sale_price input,
2029
  #wpsc-product-variations-wrapper .column-sku input {
2030
- text-align: right;
2031
  }
2032
 
2033
- .js #wpsc-product-variations-wrapper tbody .active td,
2034
- .js #wpsc-product-variations-wrapper tbody .active th {
2035
- border-bottom-style: dashed;
 
 
 
2036
  }
2037
 
2038
  #wpsc-product-variations-wrapper div.updated,
@@ -2041,11 +2072,11 @@ table.purchase-logs tr:hover .column-id .delete {
2041
  }
2042
 
2043
  .js #wpsc-product-variations-wrapper .wpsc-stock-editor-row {
2044
- display: none;
2045
  }
2046
 
2047
  #wpsc-product-variations-wrapper .wpsc-stock-editor-row td {
2048
- border-bottom-style: solid;
2049
  }
2050
 
2051
  #wpsc-product-variations-wrapper {
@@ -2053,90 +2084,84 @@ table.purchase-logs tr:hover .column-id .delete {
2053
  }
2054
 
2055
  #wpsc-product-variations-wrapper .submit {
2056
- margin: 0;
2057
- padding: 0;
2058
  }
2059
 
2060
  .wpsc-stock-editor .inside {
2061
- overflow: hidden;
2062
  }
2063
 
2064
  .wpsc-stock-editor .wpsc-product-shipping-section {
 
2065
  vertical-align: top;
 
2066
  }
2067
 
2068
  .wpsc-stock-editor .wpsc-form-field {
2069
- clear: both;
2070
- }
2071
-
2072
- .wpsc-stock-editor .wpsc-form-field label {
2073
- width: 150px;
2074
- }
2075
-
2076
- .wpsc-stock-editor .wpsc-form-field input[type="number"] {
2077
- width: 70px;
2078
  }
2079
 
2080
  .wpsc-stock-editor .wpsc-product-shipping-section input[type="text"] {
2081
- text-align: right;
2082
- width: 50px;
2083
  }
2084
 
2085
  .wpsc-product-shipping-weight-dimensions label {
2086
- display: inline-block;
2087
- min-width: 60px;
2088
  }
2089
 
2090
  .wpsc-product-shipping-flat-rate label {
2091
- display: inline-block;
2092
- min-width: 160px;
2093
  }
2094
 
2095
  .wpsc-stock-editor {
2096
- overflow: hidden;
2097
  }
2098
 
2099
  .wpsc-stock-editor select {
2100
- min-width: 100px;
2101
  }
2102
 
2103
- .wpsc-product-variations-tabs {
2104
- margin: 0 0 1px 0;
2105
- width: 100%;
 
2106
  }
2107
 
2108
- .wpsc-product-variations-tabs:before,
2109
- .wpsc-product-variations-tabs:after {
2110
- display: table;
2111
- content: "";
2112
  }
2113
 
2114
- .wpsc-product-variations-tabs:after {
2115
- clear: both;
 
 
 
2116
  }
2117
 
2118
  .wpsc-product-variations-tabs li {
2119
- float: left;
2120
- margin: 5px 4px 0 0px;
2121
  }
2122
 
2123
  .wpsc-product-variations-tabs a {
2124
- display: block;
2125
- background-color: #f1f1f1;
2126
- border-color: #dfdfdf #dfdfdf #fff;
2127
  border-style: solid;
2128
  border-width: 1px 1px 0;
2129
- line-height: 1em;
2130
  color: #aaa;
2131
  padding: 5px 7px 3px;
2132
  text-decoration: none;
2133
- vertical-align: middle;
2134
- -webkit-border-top-right-radius: 3px;
2135
- -moz-border-top-right-radius: 3px;
2136
- border-top-right-radius: 3px;
2137
  -webkit-border-top-left-radius: 3px;
2138
- -moz-border-top-left-radius: 3px;
2139
- border-top-left-radius: 3px;
 
2140
  }
2141
 
2142
  .wpsc-product-variations-tabs a:hover {
@@ -2144,14 +2169,12 @@ table.purchase-logs tr:hover .column-id .delete {
2144
  }
2145
 
2146
  .wpsc-product-variations-tabs .active a {
2147
- background: #fff;
2148
  border-bottom-width: 1px;
2149
  color: #333;
2150
- margin-bottom: -1px;
2151
  }
2152
 
2153
  .wpsc-product-variations-tab-content {
2154
- clear: both;
2155
  padding: 0 10px;
2156
  }
2157
 
@@ -2160,13 +2183,8 @@ table.purchase-logs tr:hover .column-id .delete {
2160
  }
2161
 
2162
  .wpsc-save-product-variations.bottom {
2163
- float: none;
2164
- overflow: hidden;
2165
  padding-bottom: 5px;
2166
  }
2167
- .wpsc-save-product-variations.bottom input {
2168
- float: right;
2169
- }
2170
 
2171
  .wpsc-product-variation-thumbnail {
2172
  float: left;
@@ -2174,11 +2192,6 @@ table.purchase-logs tr:hover .column-id .delete {
2174
  width: 50px;
2175
  }
2176
 
2177
- .wpsc-product-variation-thumbnail img {
2178
- max-height: 50px;
2179
- max-width: 50px;
2180
- }
2181
-
2182
  .wpsc-product-variation-title {
2183
  margin-left: 60px;
2184
  }
@@ -2186,340 +2199,4 @@ table.purchase-logs tr:hover .column-id .delete {
2186
  .compat-field-wpsc_image_size input[type="radio"] {
2187
  width: auto;
2188
  margin-right:5px;
2189
- }
2190
-
2191
- .wpsc-button-round {
2192
- padding: 0 0 1px !important;
2193
- height: 28px !important;
2194
- text-align: center;
2195
- width: 28px !important;
2196
- -webkit-border-radius: 14px !important;
2197
- border-radius: 14px !important;
2198
- outline: 0 !important;
2199
- }
2200
-
2201
- /* Make the minus sign look balanced with the plus sign */
2202
-
2203
- .wpsc-button-minus {
2204
- font-weight: bold;
2205
- font-size: 10px !important;
2206
- }
2207
-
2208
- span.wpsc-button-round {
2209
- cursor: default !important;
2210
- opacity: 0.3;
2211
- }
2212
-
2213
- .wpsc-coupon-status-active {
2214
- color: #1be032;
2215
- }
2216
-
2217
- .wpsc-coupon-status-inactive {
2218
- color: #e01b1b;
2219
- }
2220
-
2221
- th.right-col {
2222
- text-align: right;
2223
- padding: 0;
2224
- }
2225
-
2226
- div.new_layer {
2227
- display: block;
2228
- margin-bottom: 10px;
2229
- }
2230
-
2231
- div.new_layer > * {
2232
- display: inline-block;
2233
- vertical-align: middle;
2234
- }
2235
-
2236
- div.new_layer select {
2237
- height: auto !important;
2238
- white-space: nowrap;
2239
- }
2240
-
2241
- body.edit-tags-php img.wpsc_category_image {
2242
- max-width: 256px;
2243
- max-height: 256px;
2244
- min-width: 128px;
2245
- }
2246
-
2247
- .wpsc-width-height-fields label {
2248
- display: inline;
2249
- }
2250
-
2251
-
2252
- /**
2253
- * Live Title Meta Box
2254
- */
2255
-
2256
- .wpsc_metabox_live_title {
2257
- position: absolute;
2258
- right: 30px;
2259
- }
2260
-
2261
- .wpsc_metabox_live_title > * {
2262
- float: right;
2263
- margin: 0px;
2264
- padding: 0px;
2265
- font-style: normal;
2266
- font-size: 13px;
2267
- color: #858585;
2268
- text-shadow: 1px 1px #fff;
2269
- }
2270
-
2271
- #wpsc_product_delivery_metabox_live_title,
2272
- #wpsc_product_details_metabox_live_title {
2273
- left: 170px;
2274
- right: auto;
2275
- }
2276
-
2277
- /**
2278
- * Product Price Meta Box
2279
- */
2280
-
2281
- .wpsc-categorydiv .tabs-panel {
2282
- max-height: none !important;
2283
- overflow: visible !important;
2284
- padding-top: 5px !important;
2285
- padding-bottom: 5px !important;
2286
- }
2287
-
2288
-
2289
- /**
2290
- * Product Delivery
2291
- */
2292
-
2293
- #wpsc_product_delivery-external_link th {
2294
- width: 50px;
2295
- }
2296
-
2297
- #external_link_target {
2298
- padding-top: 21px;
2299
- }
2300
-
2301
- #external_link_target input {
2302
- width: auto;
2303
- }
2304
-
2305
- #external_link_target span {
2306
- margin-left: 10px;
2307
- margin-right: 30px;
2308
- }
2309
-
2310
- #wpsc_product_gallery li {
2311
- float: left;
2312
- margin-right: 10px;
2313
- cursor: move;
2314
- }
2315
-
2316
- /**
2317
- * Digital download table style
2318
- */
2319
-
2320
- #wpsc_digital_download_table {
2321
- margin-top: 10px;
2322
- margin-bottom: 15px;
2323
- }
2324
-
2325
- #wpsc_digital_download_table tfoot {
2326
- display: none;
2327
- }
2328
-
2329
- #wpsc_digital_download_table a,
2330
- #wpsc_digital_download_table img {
2331
- display: inline-block;
2332
- margin-right: 10px;
2333
- }
2334
-
2335
- #wpsc_digital_download_table span {
2336
- display: inline-block;
2337
- vertical-align: middle;
2338
- }
2339
-
2340
- #wpsc_digital_download_table img {
2341
- max-height: 20px;
2342
- vertical-align: middle;
2343
- }
2344
-
2345
- #wpsc_digital_download_action_th {
2346
- width: 120px;
2347
- }
2348
-
2349
-
2350
- /**
2351
- * Custom meta style
2352
- */
2353
-
2354
- #wpsc_product_meta_table {
2355
- margin-bottom: 10px;
2356
- margin-top: 10px;
2357
- }
2358
-
2359
- #wpsc_product_meta_table tfoot {
2360
- display: none;
2361
- }
2362
-
2363
- #wpsc_product_meta_table input {
2364
- width: 100%;
2365
- }
2366
-
2367
- a.wpsc_remove_meta {
2368
- color: red;
2369
- }
2370
-
2371
- #wpsc_custom_meta_name_th {
2372
- width: 250px;
2373
- }
2374
-
2375
- #wpsc_custom_meta_action_th {
2376
- width: 70px;
2377
- }
2378
-
2379
- .wpsc_fileUpload {
2380
- display: inline-block;
2381
- position: relative;
2382
- margin: 10px;
2383
- cursor: pointer;
2384
- }
2385
-
2386
- .wpsc_fileUpload input {
2387
- position: absolute;
2388
- top: 0;
2389
- bottom: 0;
2390
- right: 0;
2391
- left: 0;
2392
- margin: 0;
2393
- padding: 0;
2394
- font-size: 20px;
2395
- cursor: pointer;
2396
- opacity: 0;
2397
- filter: alpha(opacity=0);
2398
- }
2399
-
2400
- #wpsc_sku {
2401
- width: 100%;
2402
- }
2403
-
2404
-
2405
- /**
2406
- * WordPress 3.8 Responsiveness
2407
- */
2408
-
2409
- @media screen and ( max-width: 782px ) {
2410
-
2411
- /**
2412
- * Override responsiveness in variations iframe
2413
- */
2414
-
2415
- /* Buttons */
2416
- .wpsc-product-variation-iframe.wp-core-ui .button,
2417
- .wpsc-product-variation-iframe.wp-core-ui .button.button-large,
2418
- .wpsc-product-variation-iframe.wp-core-ui .button.button-small {
2419
- padding: 0px 10px 1px;
2420
- line-height: 2;
2421
- font-size: 13px;
2422
- vertical-align: top;
2423
- height: 28px;
2424
- margin-bottom: 0px;
2425
- }
2426
-
2427
- .wpsc-product-variation-iframe.wp-core-ui .button:active,
2428
- .wpsc-product-variation-iframe.wp-core-ui .button-large:active,
2429
- .wpsc-product-variation-iframe.wp-core-ui .button-small:active {
2430
- padding-top: 1px;
2431
- padding-bottom: 0;
2432
- }
2433
-
2434
- /* Categories Metabox */
2435
- .wpsc-product-variation-iframe ul.category-tabs {
2436
- margin: 12px 0 5px;
2437
- }
2438
-
2439
- .wpsc-product-variation-iframe ul.category-tabs li.tabs {
2440
- padding: 3px 5px 5px;
2441
- }
2442
-
2443
- /* Subsubsub Nav */
2444
- .wpsc-product-variation-iframe .subsubsub {
2445
- font-size: 13px;
2446
- margin: 8px 0px 0px;
2447
- }
2448
-
2449
- /* Form Tables */
2450
- .wpsc-product-variation-iframe input[type="checkbox"],
2451
- .wpsc-product-variation-iframe .widefat th input[type="checkbox"] {
2452
- padding: 0px;
2453
- }
2454
-
2455
- .wpsc-product-variation-iframe input[type="radio"],
2456
- .wpsc-product-variation-iframe input[type="checkbox"] {
2457
- width: 16px;
2458
- height: 16px;
2459
- }
2460
-
2461
- .wpsc-product-variation-iframe textarea,
2462
- .wpsc-product-variation-iframe input,
2463
- .wpsc-product-variation-iframe select {
2464
- font-size: 14px;
2465
- }
2466
-
2467
- .wpsc-product-variation-iframe input[type=checkbox]:checked:before,
2468
- .wpsc-product-variation-iframe .widefat th input[type=checkbox]:before {
2469
- font-size: 21px;
2470
- margin: -3px 0 0 -4px;
2471
- }
2472
-
2473
- .wpsc-product-variation-iframe input[type="text"],
2474
- .wpsc-product-variation-iframe input[type="search"],
2475
- .wpsc-product-variation-iframe input[type="password"],
2476
- .wpsc-product-variation-iframe input[type="number"] {
2477
- padding: 3px 5px;
2478
- }
2479
-
2480
- .wpsc-product-variation-iframe .tablenav.bottom .displaying-num {
2481
- font-size: 12px;
2482
- }
2483
-
2484
- }
2485
-
2486
-
2487
- /**
2488
- * Pre WordPress 3.8 Compatibility
2489
- */
2490
-
2491
-
2492
- .branch-3-7.wpsc-product-variation-iframe #post-body,
2493
- .branch-3-6.wpsc-product-variation-iframe #post-body {
2494
- background: #f5f5f5;
2495
- background-image: -webkit-gradient(linear,left bottom,left top,from(#f5f5f5),to(#f9f9f9));
2496
- background-image: -webkit-linear-gradient(bottom, #f5f5f5, #f9f9f9);
2497
- background-image: -moz-linear-gradient(bottom, #f5f5f5, #f9f9f9);
2498
- background-image: -o-linear-gradient(bottom, #f5f5f5, #f9f9f9);
2499
- background-image: linear-gradient(to top, #f5f5f5, #f9f9f9);
2500
- }
2501
-
2502
- .branch-3-7.wpsc-product-variation-iframe .widefat td.column-title,
2503
- .branch-3-6.wpsc-product-variation-iframe .widefat td.column-title {
2504
- padding-bottom: 5px;
2505
- }
2506
-
2507
- .branch-3-7 .wpsc-currency-layers td.remove a,
2508
- .branch-3-7 .wpsc-quantity-discounts td.remove a,
2509
- .branch-3-6 .wpsc-currency-layers td.remove a,
2510
- .branch-3-6 .wpsc-quantity-discounts td.remove a {
2511
- background: url(xit.gif) no-repeat 0 0;
2512
- display: inline-block;
2513
- margin-top: 7px;
2514
- overflow: hidden;
2515
- text-indent: -999px;
2516
- width: 10px;
2517
- height: 10px;
2518
- }
2519
-
2520
- .branch-3-7 .wpsc-currency-layers td.remove a:hover,
2521
- .branch-3-7 .wpsc-quantity-discounts td.remove a:hover,
2522
- .branch-3-6 .wpsc-currency-layers td.remove a:hover,
2523
- .branch-3-6 .wpsc-quantity-discounts td.remove a:hover {
2524
- background-position: -10px 0;
2525
- }
1
+ /*
2
+ * This is the new WPSC Admin CSS file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ */
5
  ul.variation_checkboxes li {
6
+ margin: 1px 0 3px;
7
  }
 
8
  /* This is the variation meta box stuff need to put it in the correct place - mychelle */
9
+ div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td span{
10
+ display:none;
 
11
  }
12
 
13
+ div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.weight{
14
  width: 81px;
15
  }
16
 
17
+ div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.stock{
18
  width: 110px;
19
  }
20
 
21
+ div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.price{
22
  width: 125px;
23
  }
24
 
25
+ div#wpsc_product_variation_forms table#wpsc_product_list tbody tr td.post-title{
26
  width: 115px;
27
  }
28
 
29
  .wpsc_ie_stock[disabled] {
30
+ background-color:#f6f6f6;
31
  }
32
 
33
  div#wpsc_add_variant_desc,
34
+ div#wpsc_add_variation_desc{
35
  float: left;
36
+ margin:33px 0px 30px 20px;
37
  }
38
 
39
+ div#wpsc_add_variation_desc{
40
+ width:300px;
41
  }
42
 
43
+ div#wpsc_add_variant_desc{
44
+ width:200px;
45
  }
46
 
47
+ div#wpsc_add_variant{
48
  float: left;
49
  max-width: 245px;
50
  }
51
 
52
+ div #add_new_variation{
53
+ float:left;
54
+ width:215px;
55
  }
56
 
57
  input.wpsc_ie_field {
58
  margin-bottom:10px;
59
  }
60
 
61
+ .wpsc_ie_save{
62
+ margin-bottom:5px;
63
  }
64
 
65
+ .wpsc_trackingid_row{
66
+ margin-left:20px;
67
  }
68
 
69
+ ul.children{
70
+ padding-left:5px;
71
  }
72
+ .category_indenter{
73
+ float:left;
74
+ width:auto;
 
75
  }
76
 
 
77
  /**
78
+ *Dashboard Widget CSS
79
+ *
80
+ */
81
+ #leftDashboard{
82
+ width:45%;
83
+ float:left;
84
+ text-align:right;
85
+ border-right:1px #999999 solid;
86
+
87
+ }
88
+ #leftDashboard strong{
89
+ float:left;
 
90
  padding-left: 40px;
91
  }
92
+ #rightDashboard strong{
93
+ float:left;
 
94
  padding-left: 40px;
95
  }
96
+ #rightDashboard{
97
+ width:45%;
98
+ float:right;
99
+ text-align:right;
100
 
 
 
 
 
101
  }
102
+ .pricedisplay, .salespricedisplay{
103
+ /* width:40%; */
104
+ /*float:left;*/
105
+ }
106
+ .dashboardWidgetSpecial{
107
+ font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
108
+ color:#21759B;
109
+ font-size:15px!important;
110
  margin: 5px 0 5px 0;
111
  }
112
+ .dashboardWidget{
113
+ color:#777777;
114
+ padding-left:10px;
 
115
  padding-right: 30px;
 
116
 
 
 
 
117
  }
118
+ span.wpsc_quart_left{
119
+ width:40%;
120
+ float:left;
 
 
 
121
  }
122
+ p.atglance{
123
+ color:#777777;
124
+ font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
125
+ font-size:13px;
126
+ font-style:italic;
127
+ }
128
+ span.wpsc_quart_right{
129
+ width:60%;
130
+ float:right;
131
  text-align: right;
132
  }
133
+ #box span{
 
134
  border-bottom: 1px solid #999999;
135
  }
136
+ p.quarterly{
137
+ color:#21759B;
138
+ font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
139
+ font-size:12px;
 
140
  line-height: 140%;
141
+ margin:5px 0;
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
+ /* end of dashboard widget css */
144
+ /*
145
+ *Display Purchase log Details CSS is HERE
146
+ */
147
+ #purchlogs_customfields{
148
+ clear:both;
149
  }
150
+ th#date{
151
+ width:120px;
 
152
  }
153
+ th#purchid{
154
+ width:60px;
 
155
  }
156
+ th#details{
157
+ width:100px;
 
158
  }
159
+ th#name{
160
+ /* width:220px; */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
+ th#track{
163
+ width:75px;
 
 
164
  }
165
+ th#delete{
166
+ width:60px;
 
167
  }
168
+ th#status{
169
+ width:200px;
 
170
  }
171
+ .google_checkout_logo{
172
+ padding-right:10px;
 
 
 
 
 
 
173
  }
174
+ #wpsc_items_ordered{
175
+ clear:both;
 
176
  }
177
+ #wpsc_items_ordered h3{
178
+ margin-bottom:0em;
 
179
  }
180
+ .wpsc_pushdown_img {
181
+ float:left;
 
 
182
  }
183
+ #wpsc_purchlogitems_links{
184
+ clear:both;
185
 
 
 
 
186
  }
187
+ #wpsc_purchlog_order_status{
188
+ float:right;
189
+ width:250px;
190
  }
191
+ #wpsc_purchlog_order_status .selector{
192
+ margin-top:-.2em;
 
193
  }
194
 
195
+ #wpsc_purchlogitems_links a{
196
+ text-decoration:none;
197
+ line-height:14pt;
198
  }
199
+ #wpsc_purchlogitems_links img{
200
+ padding-top:2px;
201
+ float:left;
202
  }
203
+ #wpsc_shipping_details_box{
204
+ width:45%;
205
+ float:left;
206
+ border:1px #d3d3d3 solid;
207
+ margin:.4em;
208
+ padding:.6em;
209
+ margin-right:5em;
210
  }
211
+ #wpsc_billing_details_box{
212
+ width:35%;
213
+ float:left;
214
+ margin:.4em;
215
+ padding:.6em;
 
216
  }
217
+ #wpsc_purchlog_searchbox{
218
+ width:100%;
219
+ text-align:right;
220
 
 
 
 
 
221
 
 
 
 
222
  }
223
+ /*
224
+ * Display Purchase log Details CSS ends HERE
 
225
  * Display Products CSS starts here
226
+ */
 
227
  .tablenav select[name="bulkAction"] {
228
+ width:100px;
229
  }
230
+ textarea#additional_description{
 
231
  border: 1px solid #dfdfdf;
232
+ /* width:465px !important; */
233
+ }
234
+ .wpsc-separator {
235
+ background:transparent url(../../images/menu-arrows.gif) no-repeat scroll left 5px;
236
+ cursor:w-resize;
237
+ height:21px;
238
+ margin:0;
239
+ padding:0;
240
  }
241
 
242
  #poststuff h3.form_heading {
243
+ font-size:1.1em;
244
  margin: 40px 0px 10px 0px;
245
  padding-left: 0px;
246
  }
247
 
248
  #poststuff h3.form_heading span {
249
+ font-size:0.8em;
250
  }
251
 
252
  div.search-box input#page-search-input {
253
  width: 129px;
254
+
255
  }
256
 
257
+
258
  #wpsc_product_list,
259
  table.widefat {
260
+ width:100%;
261
  }
262
 
263
  table.widefat .column-hidden_alerts {
264
+ display:none;
265
  }
266
 
267
  #wpsc_product_list .column-cb,
268
  table.widefat .column-cb {
269
+ /* width:24px; */
270
  vertical-align: middle;
271
  }
272
+ #wpsc_product_list .column-image, #wpsc_product_list .product-image,
273
+ table.widefat .column-image, table.widefat .product-image {
 
 
 
274
  padding-right: 0px;
275
  width: 42px;
276
  }
277
 
 
 
 
 
 
 
 
278
  #wpsc_product_list .column-categories,
279
+ table.widefat .column-categories{
280
+ /* width: 70px; */
281
  padding-right:18px;
282
  }
283
 
284
  #wpsc_product_list tbody tr td.column-title,
285
  table.widefat tbody tr td.column-title {
286
+ border-right:none;
287
  }
288
 
289
  #wpsc_product_list tbody tr td.product-image img,
290
  table.widefat tbody tr td.product-image img {
291
  margin-top: 4px;
292
+ cursor:move;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  }
294
 
295
+ .newCurrency{
296
+ width:150px;
 
297
  }
298
+ div.wpsc_floatleft{
299
+ width:161px;
300
+ float:left;
 
301
  }
 
302
  div.wpsc_floatleft label {
303
+ line-height: 18px;
304
+ white-space: nowrap;
 
305
  }
306
 
307
+ /* Sortable product styling*/
 
 
 
308
 
309
  table.product_editform {
310
+ width:100%;
311
  }
312
 
313
+
314
  #wpsc_product_list .ui-sortable-helper,
315
  table.widefat .ui-sortable-helper {
316
  width: 410px;
318
  background-color: #FEFEFE;
319
  }
320
 
321
+ #wpsc_product_list .ui-sortable-helper td, #wpsc_product_list .ui-sortable-helper th,
322
+ table.widefat .ui-sortable-helper td, table.widefat .ui-sortable-helper th{
 
 
323
  border-top: 1px solid #DFDFDF;
324
  opacity: .4;
325
  }
326
+ .wpsc-sortable-table-placeholder td, .product-placeholder {
 
 
327
  border-width: 1px;
328
  border-style: dashed;
329
  z-index: 900;
333
  }
334
 
335
  div#poststuff table tr td {
336
+ vertical-align:top;
337
  }
338
 
339
  div#poststuff textarea {
347
 
348
  div.admin_product_name {
349
  position: relative;
350
+
351
+ height: 30px;
352
  background: #ffffff;
353
+
354
  border: 1px solid #dfdfdf;
355
+ -moz-border-radius: 6px;
356
+ -khtml-border-radius: 6px;
357
  -webkit-border-radius: 6px;
358
+ border-radius: 6px;
 
 
359
  }
 
360
  div.admin_product_name input.wpsc_product_name {
361
  border: none;
362
  }
365
  position: absolute;
366
  top: 0px;
367
  right: 0px;
368
+ background:url(../../wpsc-core/images/info_icon.jpg) no-repeat scroll 5px 8px;
369
+ border-left:1px solid #DFDFDF;
370
+ display:block;
371
+ height:100%;
372
+ padding:0px 3px 0px 3px;
373
+ width:18px;
374
  }
375
 
376
+ div#icon_card
377
+ {
378
  float: left;
379
  height: 36px;
380
  margin: 7px 8px 0 0;
382
  background: url(../../wpsc-core/images/icon32.png) no-repeat center center;
383
  }
384
 
 
 
385
  div.admin_product_shorttags {
386
+ width:93%;
387
+ min-width:396px;
388
+ max-width:558px;
389
+
390
  clear: both;
391
  padding: 6px;
392
  font-size: 8pt;
393
+ margin:0 0 0 6px !important;
394
+ border-left:1px solid #DFDFDF;
395
+ border-right:1px solid #DFDFDF;
396
+ border-bottom:1px solid #DFDFDF;
397
+ /* height: 28px; */
398
  display: none;
399
+ _width:396px;
400
  background-color: #ffffff;
401
  }
402
 
403
  #description {
404
+ margin:0;
405
+ /* width:100%; */
406
  }
407
 
408
  h4.product_action_link {
409
+ margin:4px 0px 0px 0px;
410
+ display:block;
411
+ font-weight:bold;
412
+ }
413
+
414
+
415
+
416
+ /* custom meta styling */
417
+ div.product_custom_meta {
418
  display: block;
419
+ width: 100%;
420
+ vertical-align: top;
421
+ }
422
+ div#poststuff div.product_custom_meta input, div#poststuff div.product_custom_meta textarea {
423
+ width: 100%;
424
  }
425
 
426
 
427
+ div.product_custom_meta a.add_more_meta {
428
+ display: block;
429
+ float: left;
430
+ margin-top: 18px;
431
+ margin-left: 4px;
432
+ }
433
+
434
+ div.product_custom_meta a.remove_meta {
435
+ display: block;
436
+ margin-left: 4px;
437
+ }
438
+
439
+
440
+ div.product_custom_meta label {
441
+ display: block;
442
+ width: 170px;
443
+ float: left;
444
+ }
445
 
446
+ div.product_custom_meta label input {
447
+ font-size:13px;
448
+ width: 160px !important;
449
+ margin:1px !important;
450
+ padding:3px !important;
451
+ display: block;
452
+ }
453
+
454
+ div.product_custom_meta br {
455
+ clear: both;
456
+ }
457
+
458
+ /* image form styling */
459
  div.flash-image-uploader {
460
  display: none;
461
  }
464
  position: relative;
465
  border: none;
466
  }
467
+ #wpbody-content div.flash-image-uploader #media-items .progress{
 
468
  position: static;
469
+ margin:0 0 6px;
470
  height: 16px;
471
  }
472
 
473
+
474
+ button#add-product-image {
475
+ float: left;
476
  }
477
 
478
+ div#swfupload_img_indicator {
479
+ float: left;
480
+ height: 20px;
481
+ width: 20px;
482
  display: none;
483
+ }
484
+
485
+ div#swfupload_img_indicator img{
486
+ margin: 4px 2px 2px 4px;
487
+ }
488
+
489
+ ul#gallery_list{
490
+ clear:both;
491
+ list-style-type:none;
492
+ list-style-position: inside;
493
  cursor: pointer;
494
+ min-height:70px;
495
+ _height:70px;
496
+ padding-left:0px;
497
+ margin: 6px 0px 0px 6px;
498
+ }
499
+
500
+ ul#gallery_list li{
501
+ float:left;
502
+ }
503
+
504
+ ul#gallery_list li *{
505
+ z-index:79;
506
+ }
507
+ ul#gallery_list li.first *{
508
+ z-index:80;
509
+ }
510
+ .ui-selected {
511
+ border:2px dashed #969696;
512
  }
513
 
514
+ img.deleteButton {
515
+ display:none;
516
+ position:absolute;
517
+ top:-5px;
518
+ right: -1px;
519
+ width:16px;
520
+ height:16px;
521
+ cursor:pointer;
522
+ }
523
  a.editButton {
524
+ background:#FFFFFF none repeat scroll 0%;
525
+ height:20px;
526
+ display:none;
527
+ position:absolute;
528
+ right:0px;
529
+ top:0px;
530
+ padding-bottom:3px;
531
+ padding-left:3px;
532
+ cursor:pointer;
533
  }
534
 
535
  div.image_settings_box {
536
+ position:absolute;
537
+ width:150px;
538
+ display:none;
539
  margin: -66px 0px 0px 36px;
540
+ _margin: 0px 0px 0px -30px;
541
+ padding-top:2px;
542
+ width:252px;
543
+ z-index:69;
544
+ _z-index:80;
545
  }
546
 
547
  a.thickbox img {
548
+ border:medium none;
549
  }
550
 
551
  img.previewimage {
552
+ cursor:move;
553
+ height:60px;
554
+ margin-right:4px;
555
+ width:60px;
556
  }
557
 
558
  div.lower_settings_box {
559
+ width:234px;
560
+ background-color:white;
561
+ border:1px solid black;
562
+ border-top:1px solid #CCCCCC;
563
+ float:right;
564
  margin: -1px -6px 0px 0px;
565
  padding: 2px 0 0 4px;
566
+ background-color:#EAF3FA;
567
  }
568
 
569
  div.upper_settings_box {
570
+ width:250px;
571
+ background-color:white;
572
+ border:1px solid black;
573
+ padding:3px 1px 2px 5px;
574
  }
575
 
576
  div.upper_image {
577
+ float:left;
578
+ /* border-bottom:1px solid black; */
579
+ padding-left:5px;
580
+ margin-left:-5px;
581
+ _margin-left:-3px;
582
+ margin-right:-7px;
583
+ padding-bottom:4px;
584
+ _padding-bottom:6px;
585
+ _margin-bottom:-2px;
586
  }
587
 
588
+ div.upper_txt{
589
+ padding-left:22px;
590
+ color:#666666;
591
  }
592
 
593
  div.previewimage {
594
+ position:relative;
595
+ }
596
+
597
+ tr.edit_product_image *{
598
+ z-index:80;
599
+ }
600
+
601
+ a.closeimagesettings{
602
+ cursor:pointer;
603
+ margin-left:90px;
604
  }
605
 
606
+ div.browser-image-uploader {
607
+
608
  }
609
 
610
+ div.browser-image-uploader h4{
611
  margin-bottom: 8px;
612
  }
613
 
619
  width: 100%;
620
  }
621
 
622
+ #wpsc_product_category_and_tag_forms table td.itemfirstcol{
623
+ padding-left:3pt;
624
  width: 50%;
625
  }
626
 
627
+ /* variations CSS starts */
628
 
629
+ table.product_variation_listing{
 
 
 
 
630
  margin-bottom: 12px;
631
  }
632
 
633
+ table.product_variation_listing th.variation_name{
634
  color: #71A4C8;
635
  font-style: italic;
636
  text-align: left;
637
  padding-bottom: 1px;
638
  }
639
 
640
+ table.product_variation_grid{
641
  margin-top: 12px;
642
  }
643
 
644
+ table.product_variation_grid th.variation_name{
645
  color: #71A4C8;
646
  font-style: italic;
647
  text-align: left;
651
  div#edit_variations_container {
652
  margin-top: 12px;
653
  }
 
654
  table.product_variation_grid {
655
  border-collapse: collapse;
656
  margin-top: 0px;
657
  }
658
 
659
+ table.product_variation_grid tr td, table.product_variation_grid tr th {
 
660
  border: 1px solid #cccccc;
661
  border-collapse: collapse;
662
  text-align: left;
675
  width: 78px;
676
  }
677
 
678
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th {
 
679
  padding: 4px 0px 4px 10px;
680
  }
681
 
682
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th.variations {
 
683
  width: 300px;
684
  }
685
 
686
+
687
+ table.product_variation_grid tr td input{
688
  padding: 0px 3px 0px 3px;
689
  }
690
 
693
  }
694
 
695
  a.about_this_page_sub {
696
+ text-decoration:underline;
697
  }
698
 
699
+ table.product_variation_grid tr td, table.product_variation_grid tr th {
 
700
  border: 1px solid #cccccc;
701
  border-collapse: collapse;
702
  text-align: left;
711
  padding: 0px !important;
712
  }
713
 
714
+
715
  table.product_variation_grid tr.settings_row td div.variation_settings {
716
  display: none;
717
  border-top: 1px dotted #cccccc;
718
  width: 100%;
719
  min-height: 30px;
720
  padding: 4px 10px;
 
721
 
722
+ }
723
  table.product_variation_grid tr th {
724
  border-bottom: 1px solid #969696;
725
  }
733
  width: 78px;
734
  }
735
 
736
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th {
 
737
  padding: 4px 0px 4px 10px;
738
  }
739
 
740
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th.variations {
 
741
  width: 300px;
742
  }
743
 
744
+
745
+ table.product_variation_grid tr td input{
746
  padding: 0px 3px 0px 3px;
747
  }
748
 
749
+ table.product_variation_grid tr td input.checkbox{
750
  display: block;
751
+ margin:6px auto;
752
  }
753
 
754
  table.product_variation_grid tr.group_boundary td {
772
  height: 16px;
773
  width: 16px;
774
  margin: 4px auto 0px auto;
775
+
776
  }
777
 
778
+ div.variation_settings div.variation_settings_contents{
779
  padding-left: 10px;
780
  }
781
 
782
  div.select_variation_file {
783
  padding-left: 6px;
784
  }
 
785
  div.select_variation_file p {
786
+ margin:0 0 3px;
787
  }
788
 
789
  div.select_variation_file p {
790
+ margin:0 0 3px;
791
  }
792
 
793
  div.select_variation_file p input {
796
  }
797
 
798
  .variation_checkboxes li {
799
+ margin:0;
800
  }
801
 
802
  .variation_checkboxes ul {
803
+ margin-left:30px;
804
  }
805
 
806
  .js .variation_checkboxes .children {
807
+ display:none;
808
  }
809
 
810
  .js .variation_checkboxes .expanded .children {
811
+ display:block;
812
  }
813
 
814
  .variation_checkboxes a.expand {
815
+ background:url(arrows.png) no-repeat left -108px;
816
+ display:inline-block;
817
+ height:15px;
818
+ width:15px;
819
+ text-indent:-999em;
820
+ vertical-align:middle;
821
  }
822
 
823
  .variation_checkboxes .expanded a.expand {
824
+ background-position:left top;
825
  }
826
 
827
  #add-new-variation-set {
828
+ margin-bottom:20px;
829
+ display:none;
830
  }
831
 
832
  #add-new-variation-set p {
833
+ position:relative;
834
  }
835
 
836
  #add-new-variation-set p.howto {
837
+ margin-bottom:16px;
838
  }
839
 
840
  #add-new-variation-set p label.focus {
841
+ color:#666;
842
  }
843
 
844
  #add-new-variation-set p.error label {
845
+ color:red;
846
  }
847
 
848
  #add-new-variation-set p label {
849
+ color:#000;
850
+ cursor:text;
851
+ left:6px;
852
+ position:absolute;
853
+ top:4px;
854
  }
855
 
856
  #add-new-variation-set .text-field {
857
+ width:195px;
858
  }
859
 
860
  .variation-set-prototype {
861
+ display:none;
862
  }
863
+ /* variations CSS ends */
 
864
 
865
  div#side-sortables input[type="file"] {
866
+ width:250px;
867
  }
 
868
  .wpsc_product_downloads_header {
869
  margin: 0 0 5px;
870
  }
 
871
  .select_product_file,
872
  .edit_select_product_file {
873
+ margin-bottom:0;
874
+ margin-top:3px;
875
+ overflow-x:hidden;
876
+ overflow-y:auto;
877
+ position:relative;
878
+ }
 
879
 
880
  span.select_product_note {
881
  margin: 0 0 5px;
887
  top: 2px;
888
  }
889
 
890
+ div#poststuff table tr.wpsc_product_download_row td {
891
+ padding: 6px 7px;
892
+ vertical-align: middle;
893
+ line-height: 16px;
894
+ }
895
+
896
  a.file_delete_button {
897
+ cursor:pointer;
898
+ color:red;
899
  display: block;
900
  }
901
 
902
  a.delete_button {
903
+ border-color:-moz-use-text-color -moz-use-text-color #FF0000;
904
+ border-style:none none solid;
905
+ border-width:medium medium 1px;
906
+ color:#FF0000;
907
+ font-size:11px;
908
+ padding:1px 2px;
909
+ text-decoration:none;
910
+ }
911
+ .greytext{
912
+ color:#666666;
913
+ }
914
+ span.small_italic{
 
 
915
  font-style: italic;
916
  }
917
+ /* Product details form styling ends */
918
+ /*
919
+ * Display Products CSS ends here
920
+ */
921
 
922
+ /*
923
+ * Product Groups styles start here
924
+ */
925
+ td.firstcol div.postbox div.inside{
 
 
 
 
 
 
926
  margin: 0px;
927
  padding: 0px;
928
  }
929
 
930
+ table#productpage{
931
  width: 100%;
932
  clear: both;
933
  border-collapse: collapse;
934
  }
935
 
936
+ table#productpage tr td{
937
  vertical-align: top;
938
+ /* padding: 0px 0px 0px 6px; */
939
  }
940
 
941
+ table#productpage tr td.secondcol{
942
+ /* width: 60%; */
943
+ /* margin-left: 20px; */
944
  padding: 0px 2px 0px 16px;
945
+
946
  }
947
 
948
+
949
  table.category-edit {
950
  border-collapse: collapse;
951
  width: 100%;
958
  width: 450px;
959
  }
960
 
961
+
962
  div.category-image-container {
963
  width: 55px;
964
  height: 30px;
965
+
966
  }
967
 
968
  div.category-image-container img {
969
  float: left;
970
  }
 
971
  div.category-image-container img.category_indenter {
972
  margin-right: 3px;
973
+ width:auto;
974
+ float:left;
975
  }
976
 
 
 
 
 
977
 
 
 
 
 
978
 
 
 
 
979
 
 
 
 
980
 
981
+ div#productform{ display: none; width: 99.5%; }
982
+
983
+ div#edititem27{ display: none; width: 586px; }
984
+
985
+ div#productform table tr td{ height: 11px !important; }
986
+
987
+
988
+
989
+
990
+ div#blank_item{ display: block;}
991
+
992
+ #poststuff div#blank_item h3{
993
  margin-top: 0px;
 
994
 
 
 
995
  }
996
 
997
+ div#additem{ display: none;}
 
 
 
998
 
999
+ div#productform td.itemfirstcol{ padding-left:4px; vertical-align: top; }
1000
+
1001
+
1002
+
1003
+
1004
+ div#productform input.text, div#additem input.text{
1005
+ width:386px;
1006
+ border:1px solid #bbb;
1007
  }
1008
 
1009
+
1010
  table.category_forms {
1011
  width: 100%;
1012
  }
 
1013
  table.category_forms tr td {
1014
  padding: 0px;
1015
  padding-right: 8px;
1016
  }
1017
+ table.category_forms tr td textarea {
 
1018
  width: 386px;
1019
  }
1020
 
1021
+ div#edit_variation_values input.text{width:286px !important;border:1px solid #bbb;}
 
 
 
1022
 
1023
+ input.image_resize{ position: relative; top: 4px; }
 
 
 
1024
 
1025
+ div#additem table.additem input.wpsc_tag{
1026
+ width:180px;
1027
  }
1028
+ div#additem label{
 
1029
  font-style: normal;
1030
  font-size: 0.95em;
1031
  }
1032
 
1033
+
1034
+
1035
+
1036
+
1037
+ .groupItem{
1038
+ border-top:1px solid #bbb;
1039
+ width:385px;
1040
+ height:35px;
1041
  clear: both;
1042
+ /* margin-left:-6px; */
1043
  padding: 0px 0px 4px 0px;
1044
  }
1045
 
1046
+ .groupItem .itemHeader{
1047
+ width:65px;
1048
  line-height: 15px;
1049
  color: #000;
1050
  padding: 4px;
1054
  clear: both;
1055
  }
1056
 
1057
+ .groupItem .itemHeader a{
1058
  margin: 4px 0px 4px 0px;
1059
  font-weight: normal;
1060
  font-size: 11px;
1061
  text-decoration: none;
1062
  }
1063
+ .sortHelper{
 
1064
  border: 3px dashed #666;
1065
  width: auto;
1066
  }
1067
+ .groupWrapper p{
 
1068
  height: 1px;
1069
  overflow: hidden;
1070
  margin: 0;
1071
  padding: 0;
1072
  }
1073
 
1074
+
1075
  table#productpage tr td.secondcol.product_groups_page {
1076
  padding-left: 16px;
1077
  }
1081
  margin-top: 20px;
1082
  }
1083
 
1084
+ td.product_groups_page #additem .inside, td.product_groups_page #productform .inside {
 
1085
  margin: 0px 0px 15px 0px;
1086
  }
1087
 
1088
  div.editing_this_group {
1089
  margin-top: 8px;
1090
  margin-bottom: 8px;
1091
+ /* border-bottom:1px dotted black; */
1092
+ width:100%;
1093
  }
1094
 
1095
  td.product_groups_page h4 {
1096
  margin-bottom: 1ex;
1097
  }
1098
+ #editorcontainer{
1099
+ clear:both;
 
1100
  }
 
1101
  td.product_groups_page td.category_presentation_settings {
1102
  padding-bottom: 1ex;
1103
  }
1104
 
1105
  div.editing_this_group {
1106
+ font-size:8pt;
1107
  }
1108
 
1109
  div.editing_this_group p {
1110
+ padding:4px 4px 4px 8px;
1111
  }
1112
 
1113
  div.editing_this_group dl {
1114
+ padding:4px 4px 4px 8px;
1115
  }
1116
 
1117
+
1118
+ #blank_item a.add_category_link{
1119
  display: block;
1120
  margin: 8px 8px 8px 0px;
1121
  text-decoration: underline;
1125
  margin: 12px 0px 10px 0px;
1126
  }
1127
 
1128
+
1129
  table#wpsc_category_list td div.subcategory img.category_indenter {
1130
  float: left;
1131
  margin: 8px 0px 0px 0px;
1135
  float: left;
1136
  }
1137
 
1138
+
1139
+ label.select_categorisation_group, select#select_categorisation_group, a.add_categorisation_group, a.edit_categorisation_group, #submit_categorisation_form span {
 
 
 
1140
  display: block;
1141
  float: left;
1142
  }
1153
 
1154
  label.select_categorisation_group {
1155
  padding-top: 4px;
1156
+ /* color: #336699; */
1157
  font-size: 11px;
1158
  }
1159
 
1165
  margin-left: 30px;
1166
  }
1167
 
1168
+
1169
+
1170
+ div#add_categorisation, div#edit_categorisation{
1171
  display: none;
1172
  border: 1px solid #BBBBBB;
1173
  padding: 4px;
1174
  margin-top: 6px;
1175
  }
1176
 
1177
+ div#add_categorisation br, div#edit_categorisation br{
 
1178
  clear: both;
1179
  }
1180
 
1181
+
1182
+ div#add_categorisation fieldset, div#edit_categorisation fieldset{
1183
  width: 230px;
1184
  float: left;
1185
  border: none;
1186
  }
1187
 
1188
+ div#add_categorisation fieldset label, div#edit_categorisation fieldset label{
 
1189
  display: block;
1190
  }
1191
 
1192
+ ul.categorisation_links{
1193
  list-style-type: none;
1194
  clear: both;
1195
  padding: 0px;
1196
  }
1197
+ .wpsc_add_new_currency{
1198
+ text-decoration: none;
1199
+ }
1200
+ ul.categorisation_links li{
1201
  display: block;
1202
  float: left;
1203
  list-style-type: none;
1206
  padding: 4px;
1207
  }
1208
 
1209
+ ul.categorisation_links li.selected a{
1210
  color: #D54E21;
1211
  }
1212
 
 
 
 
 
1213
  .multiple-select {
1214
  background: white none repeat scroll 0px 0px;
1215
  border: 1px solid #DFDFDF;
1216
  display: inline-block;
1217
  height: 120px;
1218
+ margin: 10px 0;
1219
  overflow-x: hidden;
1220
  overflow-y: auto;
1221
+ padding: 0px;
1222
  position: relative;
1223
+ width:98%
1224
  }
1225
 
1226
+ table.category_forms a.delete_button {
 
 
 
 
 
 
 
 
1227
  display: block;
1228
  margin: 3px 0px 0px 8px;
1229
  float: left;
1233
  padding: 16px 0px 0px 0px;
1234
  }
1235
 
1236
+ .wpsc_gold_float{
1237
+ min-width:45%;
1238
+ float:left;
1239
+ max-width:450px;
1240
+ _width:450px;
1241
  }
1242
+ .wpsc_gold_side{
1243
+ margin-top:90px;
1244
+ float:right;
1245
+ width:35%;
1246
+ }
1247
+ .wpsc_gold_text{
1248
+ width:70%;
1249
+ float:left;
1250
+ clear:both;
1251
  }
1252
 
1253
+ .wpsc_gold_info{
1254
+ width:30%;
1255
+ float:right;
1256
  text-align: center;
1257
+ font-size:20px;
1258
  }
1259
+ .wpsc_gold_module{
1260
+ width:100%;
1261
+ float:left;
1262
 
 
 
 
1263
  border-bottom: 1px solid #DFDFDF;
1264
  }
1265
+ .wpsc_gold_module strong{
1266
+ width:auto;
1267
+ float:left;
 
1268
  }
1269
+ #visitInstinct{
1270
+ float:right;
1271
+ margin:5px 20px 0 0;
 
1272
  }
1273
 
 
 
 
1274
 
1275
+ #gold_cart_form .postbox p img{
1276
+ padding-bottom:10px;
1277
  }
1278
+ #wpsc_gold_options_outside{
1279
+ width:400px;
1280
+ }
1281
+ #gold_cart_form .postbox p{
1282
  padding-left: 4px;
1283
  }
1284
+ #gold_cart_form .postbox{
1285
+ width:100%;
1286
+ max-width:500px;
 
1287
  }
1288
+ #gold_cart_form .postbox p{
1289
+ padding-left:10px;
 
1290
  }
1291
+ #gold_cart_form .postbox p label{
1292
+ width:80px;
1293
+ float:left;
 
1294
  }
1295
 
1296
  a.admin_download {
1300
  text-decoration: none;
1301
  }
1302
 
1303
+ a.admin_download img{
1304
  margin-right: 3px;
1305
  }
1306
 
1307
+ a.admin_download span{
1308
  text-decoration: underline;
1309
  }
1310
 
1311
+ /*
1312
+ * Product Groups styles end here
1313
+ */
1314
+ .wpsc_td_note{
1315
+ padding-bottom:0 !important;
 
 
1316
  }
1317
 
1318
  .wpsc_purchaselogs_options {
1319
  margin: 0px 0px 8px 0px;
1320
+
1321
  }
1322
 
1323
+
1324
  p.add_new_form_set_forms {
1325
  display: none;
1326
  }
1328
  td.product-image a img.attachment-thumbnail {
1329
  height: 38px;
1330
  width: 38px;
1331
+
1332
  }
1333
 
1334
  #wpsc_product_category_and_tag_forms .tagchecklist {
1335
+ font-size:11px;
1336
  }
1337
 
1338
+ #categorydiv div{
1339
  margin-top: 4px;
1340
  }
1341
 
1345
  font-size: 15px;
1346
  }
1347
 
1348
+ .toplevel_page_wpsc-edit-products .wrap h2
1349
+ {
1350
+ padding-bottom:0px;
1351
+ border-bottom:1px solid #CCC;
1352
  }
1353
+ #post-body #advanced-sortables
1354
+ {
1355
+ margin-right:300px
1356
  }
 
1357
  #media-buttons #add_audio,
1358
  #media-buttons #add_video,
1359
  #media-buttons #add_media {
1360
+ display:none;
1361
  }
 
1362
  .meta-box-sortables-wpec .postbox:hover .handlediv {
1363
  background: transparent url(../../wpsc-core/images/menu-bits.gif) no-repeat scroll 0% -111px;
1364
  }
1365
+ /* Main Flora Style Sheet for jQuery UI ui-datepicker */
1366
+ #ui-datepicker-div, .ui-datepicker-inline {
1367
+ font-family: Arial,Helvetica,sans-serif;
1368
+ font-size: 14px;
1369
+ padding: 0;
1370
+ margin: 0;
1371
+ background: #E0F4D7;
1372
+ width: 185px;
1373
+ }
1374
+ #ui-datepicker-div {
1375
  display: none;
1376
+ border: 1px solid #21759B;
1377
+ z-index: 10;
1378
  }
1379
+ .ui-datepicker-inline {
1380
+ float: left;
1381
+ display: block;
1382
+ border: 0;
1383
  }
1384
+ .ui-datepicker-rtl {
1385
+ direction: rtl;
1386
+ }
1387
+ .ui-datepicker-dialog {
1388
+ padding: 5px !important;
1389
+ border: 4px ridge #fff !important;
1390
+ }
1391
+ button.ui-datepicker-trigger {
1392
+ width: 25px;
1393
+ }
1394
+ img.ui-datepicker-trigger {
1395
+ margin: 2px;
1396
+ vertical-align: middle;
1397
+ }
1398
+ .ui-datepicker-prompt {
1399
+ float: left;
1400
+ padding: 2px;
1401
+ background: #fff;
1402
+ color: #000;
1403
+ }
1404
+ *html .ui-datepicker-prompt {
1405
+ width: 185px;
1406
+ }
1407
+ .ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {
1408
+ clear: both;
1409
+ float: left;
1410
  width: 100%;
1411
+ color: #FFF;
1412
  }
1413
+ .ui-datepicker-control {
1414
+ background: #fff;
1415
+ padding: 2px 0px;
1416
+ display:none;
 
1417
  }
1418
+ .ui-datepicker-links {
1419
+ background: #fff;
1420
+ padding: 2px 0px;
1421
+ }
1422
+ .ui-datepicker-control, .ui-datepicker-links {
1423
+ font-weight: bold;
1424
+ font-size: 80%;
1425
+ letter-spacing: 1px;
1426
+ }
1427
+ .ui-datepicker-links label {
1428
+ padding: 2px 5px;
1429
+ color: #fff;
1430
+ }
1431
+ .ui-datepicker-clear, .ui-datepicker-prev {
1432
+ float: left;
1433
+ width: 34%;
1434
+ }
1435
+ .ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {
1436
+ float: right;
1437
+ text-align: right;
1438
+ }
1439
+ .ui-datepicker-current {
1440
+ float: left;
1441
+ width: 30%;
1442
+ text-align: center;
1443
+ }
1444
+ .ui-datepicker-close, .ui-datepicker-next {
1445
+ float: right;
1446
+ width: 34%;
1447
+ text-align: right;
1448
+ }
1449
+ .ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {
1450
+ float: left;
1451
  text-align: left;
 
 
1452
  }
1453
+ .ui-datepicker-header {
1454
+ padding: 1px 0 3px;
1455
+ background: #fff;
1456
+ text-align: center;
1457
+ font-weight: bold;
1458
+ height: 1.3em;
1459
  }
1460
+ .ui-datepicker-header select {
1461
+ background: #fff;
1462
+ color: #000;
1463
+ border: 0px;
1464
  font-weight: bold;
1465
  }
1466
+ .ui-datepicker {
1467
+ background: #fff;
1468
+ text-align: center;
1469
+ font-size: 100%;
1470
+ }
1471
+ .ui-datepicker a {
1472
+ display: block;
1473
  width: 100%;
1474
  }
1475
+ .ui-datepicker-title-row {
1476
+ background: #fff;
1477
+ color: #000;
1478
  }
1479
+ .ui-datepicker-title-row .ui-datepicker-week-end-cell {
1480
+ background: #fff;
 
 
1481
  }
1482
+ .ui-datepicker-days-row {
1483
+ background: #FFF;
1484
+ color: #666;
 
1485
  }
1486
+ .ui-datepicker-week-col {
1487
+ background: #ededed;
1488
+ color: #000;
1489
  }
1490
+ .ui-datepicker-days-cell {
1491
+ color: #000;
1492
+ border: 1px solid #DDD;
1493
  }
1494
+ .ui-datepicker-days-cell a {
1495
+ display: block;
1496
+ }
1497
+ .ui-datepicker-week-end-cell {
1498
+ background: #EAF2FA;
1499
+ }
1500
+ .ui-datepicker-unselectable {
1501
+ color: #888;
1502
+ }
1503
+ .ui-datepicker-week-over, .ui-datepicker-week-over .ui-datepicker-week-end-cell {
1504
+ background: #B1DB87 !important;
1505
+ }
1506
+ .ui-datepicker-days-cell-over, .ui-datepicker-days-cell-over.ui-datepicker-week-end-cell {
1507
+ background: #FFF !important;
1508
+ border: 1px solid #777;
1509
+ }
1510
+ * html .ui-datepicker-title-row .ui-datepicker-week-end-cell {
1511
+ background: #ddd !important;
1512
+ }
1513
+ * html .ui-datepicker-week-end-cell {
1514
+ background: #ddd !important;
1515
+ border: 1px solid #DDD !important;
1516
+ }
1517
+ * html .ui-datepicker-days-cell-over {
1518
+ background: #FFF !important;
1519
+ border: 1px solid #777 !important;
1520
+ }
1521
+ * html .ui-datepicker-current-day {
1522
+ background: #d3d3d3 !important;
1523
+ }
1524
+ .ui-datepicker-today {
1525
+ background: #dddddd !important;
1526
+ }
1527
+ .ui-datepicker-current-day {
1528
+ background: #d3d3d3 !important;
1529
+ }
1530
+ .ui-datepicker-status {
1531
+ background: #fff;
1532
+ width: 100%;
1533
+ font-size: 80%;
1534
+ text-align: center;
1535
+ }
1536
+ #ui-datepicker-div a, .ui-datepicker-inline a {
1537
+ cursor: pointer;
1538
+ margin: 0;
1539
  padding: 0;
1540
+ background: none;
1541
+ color: #000;
1542
  }
1543
+ .ui-datepicker-inline .ui-datepicker-links a {
1544
+ padding: 0 5px !important;
 
1545
  }
1546
+ .ui-datepicker-control a, .ui-datepicker-links a {
1547
+ padding: 2px 5px !important;
1548
+ color: #000 !important;
1549
+ }
1550
+ .ui-datepicker-title-row a {
1551
+ color: #000 !important;
1552
+ }
1553
+ .ui-datepicker-control a:hover {
1554
+ background: #f1f1f1 !important;
1555
+ color: #333 !important;
1556
+ }
1557
+ .ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {
1558
+ background: #FFF !important;
1559
+ color: #333 !important;
1560
+ }
1561
+ .ui-datepicker-multi .ui-datepicker {
1562
+ /* border: 1px solid #83C948; */
1563
+ }
1564
+ .ui-datepicker-one-month {
1565
  float: left;
1566
+ width: 185px;
1567
+ }
1568
+ .ui-datepicker-new-row {
1569
+ clear: left;
1570
+ }
1571
+ .ui-datepicker-cover {
1572
+ display: none;
1573
+ display: block;
1574
+ position: absolute;
1575
+ z-index: -1;
1576
+ filter: mask();
1577
+ top: -4px;
1578
+ left: -4px;
1579
+ width: 193px;
1580
+ height: 200px;
1581
  }
1582
+ /* marketing / coupon page styling */
1583
 
1584
+ div.modify_coupon{ border: 1px solid #eeeeee; display: none; width: 100%; }
1585
+ table.coupon_data{
1586
+ width: 100%;
1587
+ }
1588
+ table.add-coupon{width:100%;}
1589
+ table.add-coupon tr th{ text-align: left; padding: 2px 5px 0px 5px; border: none;}
1590
+ table.add-coupon tr td{ text-align: left; padding: 2px 5px 2px 5px; border: none;}
1591
+ table.add-coupon tr td p{padding:0;margin:5px;}
1592
+ #table_header{
1593
+ font-size:16px;
1594
+ margin-top:20px;
1595
+ font-weight: bold;
1596
  }
1597
+ table.coupon-list{ width: 100%; }
1598
+ table.coupon-list th{ text-align:left;}
1599
+ table.coupon-list tr.toprow td{ text-align: left; font-weight:bold; }
1600
+
1601
+ table.coupon-list tr td{ padding: 5px 5px 10px 10px; vertical-align: middle;}
1602
 
1603
+ table.coupon-list tr.alt{ background-color: #eeeeee; }
1604
+
1605
+ table.coupon-list tr.alt td{ background-color: #eeeeee; }
1606
+ table.coupon-list tr.coupon_edit td{ padding:0; }
1607
+ td#order_summary_container{ width: 80px; }
1608
+ table.category_forms a.delete_button, span.delete_button {
1609
+ color:#FF0000;
1610
+ display:block;
1611
+ float:left;
1612
+ font-size:11px;
1613
+ margin:3px 0 0 8px;
1614
+ text-decoration:underline;
1615
+ }
1616
+ p span.input_label{
1617
+ font-size:1.2em;
1618
+ width:180px;
1619
+ float:left;
1620
+ }
1621
  a.wpsc_featured_product_toggle {
1622
  display: block;
1623
  height: 18px;
1624
  width: 18px;
1625
+ margin: 4px 0px 0px 6px;
 
 
 
 
1626
  }
1627
 
1628
+ a.wpsc_featured_product_toggle img {
1629
+ display: block;
1630
+ margin: 0px auto 0px auto;
1631
 
 
 
 
1632
  }
1633
 
1634
  div.wpsc_clear {
1642
  position: relative;
1643
  }
1644
 
1645
+
1646
  .wpsc_featured .item_text {
1647
  float: left;
1648
  height: 240px;
1661
  height: 240px;
1662
  width: 340px;
1663
  border: 1px solid #FEFAF1;
1664
+ border-radius: 18px;
1665
+ -moz-border-radius: 18px;
1666
  -webkit-border-radius: 18px;
 
 
1667
  background-repeat: no-repeat;
1668
  }
1669
 
1670
+
1671
  .wpsc_featured .item_text h3 {
1672
  font-size: 1.4em;
1673
  margin: 0px 0px 8px 0px;
1678
  line-height: normal;
1679
  display: block;
1680
  margin: 0px 0px 4px 0px;
1681
+
1682
  }
1683
 
1684
  .wpsc_featured .item_text .wpsc_description {
1685
  font-size: 1em;
1686
+ line-height:24px;
1687
+ display:block;
1688
+ float:left;
1689
  width: auto;
1690
  color: #9B9A96;
1691
+ font-family: Georgia,"Bitstream Charter",serif;
1692
  }
1693
 
1694
  .wpsc_featured .item_text .wpsc_description p {
1695
  margin-bottom: 0px;
1696
  }
1697
 
1698
+
1699
  .wpsc_featured .item_text .wpsc_description a {
1700
+ color:#9B9A96;
1701
  }
1702
 
1703
  ul.wpsc_categories {
1704
  clear: both;
1705
  }
1706
 
1707
+ a.update_variations_action
1708
+ {
1709
+ vertical-align:middle;
1710
  }
 
1711
  #poststuff .inside p.update-variations {
1712
+ display:none;
1713
+ margin-top:1em;
1714
  }
1715
+ #search-products{
1716
+ width:auto;
1717
+ float:right;
 
1718
  }
1719
+ .productnav{
1720
+ height: 30px;
1721
+ margin: 6px 0px 4px;
1722
+ vertical-align: middle;
 
1723
  }
1724
 
1725
  #wpsc_stock_control_forms .edit_stock {
1726
+ margin-top:0.5em;
1727
+ line-height:16px;
1728
  }
 
1729
  #wpsc_stock_control_forms .unpublish_when_none_left,
1730
  #wpsc_stock_control_forms .notify_when_none_left {
1731
+ margin:0.5em 0;
1732
  }
 
1733
  #media-upload form p.help {
1734
+ text-align:left;
1735
+ clear:both;
1736
+ }
1737
+ ul#category_list_li, ul.poll-options {
1738
+ }
1739
+ ul#category_list_li li div,
1740
+ ul#category_list_li li div ul li div {
1741
+ }
1742
+ ul#category_list_li li div div,
1743
+ ul#category_list_li li div ul li div div {
1744
+
1745
+ }
1746
+ ul#category_list_li li div:hover div{
1747
  }
1748
 
1749
+ ul#category_list_li li div ul li div:hover div {
1750
+ }
1751
+ ul#category_list_li li {
1752
+ }
1753
  ul#category_list_li li:hover span.handle {
1754
+ cursor: move;
1755
+ }
1756
+ .edit{
1757
  }
 
1758
  ul#category_list_li li span.handle {
1759
+ float:left;
1760
+
1761
  padding: 5px;
1762
+
1763
  }
1764
 
1765
+ .category_admin_list_img a.row-title{
1766
  text-decoration: none;
1767
  }
1768
 
1769
+
1770
  .category_admin_list_img:hover div.row-actions {
1771
+ visibility:visible;
1772
  }
1773
 
1774
  ul#category_list_li ul {
1775
+ margin-left:15px;
1776
  }
1777
 
1778
  .row-title img {
1779
+ width:30px;
1780
+ float:left;
1781
+ padding-right:10px;
1782
  }
 
1783
  .row-title {
1784
+ margin-right:5px;
1785
  }
 
1786
  body.edit-php form#posts-filter {
1787
+ min-width:830px;
1788
  }
 
1789
  input.wpsc_cat_image_size {
1790
+ width:40px
1791
  }
 
1792
  input.wpsc_cat_box {
1793
+ width:auto;
1794
+ margin:6px;
1795
+ vertical-align:middle;
1796
  }
1797
 
1798
+ .wpsc_ie_field{
1799
+ width:100%;
1800
  }
 
1801
  .wpsc_inline_actions .loading_indicator {
1802
+ position:relative;
1803
+ top:3px;
1804
+ left:2px;
1805
  visibility: hidden;
1806
  }
 
1807
  table.tags th#image {
1808
+ width:60px;
1809
  }
1810
+ /* quick and bulk edit product */
 
 
 
 
 
1811
  #wpbody-content .bulk-edit-row-post fieldset.wpsc-cols {
1812
+ width:49%;
1813
+ margin-top:0;
1814
  }
1815
 
1816
  #wpbody-content .quick-edit-row-post .inline-edit-col-left {
1817
+ width:35%;
1818
  }
1819
 
1820
  .bulk-edit-row-post fieldset.inline-edit-col-right label span.title {
1821
+ padding-right:0.5em;
1822
+ width:auto;
1823
  }
1824
 
1825
  .wpsc-quick-edit {
1826
+ width: 30%;
1827
+ float:left;
1828
  }
1829
 
1830
  textarea.tax_input_product_tag {
1831
+ width:50% !important;
1832
+ height: 95px !important;
1833
  }
1834
 
1835
  ul.wpsc_product_category-checklist {
1836
+ height: 280px;
1837
  }
1838
 
1839
+ span.wpsc-quick-edit{
1840
+ width:77px;
1841
+ display: block;
1842
+ float: left;
1843
  }
1844
+ .wpsc_var_description{
1845
+ margin:20px 0 0 20px !important;
1846
+ color:red;
 
1847
  }
1848
 
1849
  .ajax-loading {
1851
  }
1852
 
1853
  #cart_options .delete {
1854
+ color:#c00;
1855
+ float:right;
1856
  }
 
1857
  #cart_options .delete:hover {
1858
+ color:#D54E21;
1859
  }
1860
 
1861
  .dashboard_page_wpsc-update .wpsc-progress-bar {
1862
+ position:relative;
1863
+ height:20px;
1864
+ width:300px;
1865
+ border:1px solid #3a58cf;
1866
+ margin:-0.75em 0 27px;
1867
  }
1868
 
1869
  .dashboard_page_wpsc-update .wpsc-progress-bar * {
1870
+ position:absolute;
1871
+ left:0;
1872
+ top:0;
1873
+ background:#f9f9f9;
1874
+ font-size:12px;
1875
  }
1876
 
1877
  .dashboard_page_wpsc-update .wpsc-progress-bar .block {
1878
+ background-color:#527dff;
1879
+ z-index:-1;
1880
+ height:20px;
1881
  }
1882
 
1883
  .dashboard_page_wpsc-update .wpsc-progress-bar span {
1884
+ display:block;
1885
+ left:310px;
1886
+ line-height:20px;
1887
+ width:200px;
1888
  }
1889
 
1890
  .dashboard_page_wpsc-update .wpsc-progress-bar .eta {
1891
+ top:22px;
1892
+ line-height:15px;
1893
+ width:100%;
1894
  }
1895
 
1896
+ .downloadables_float{
1897
  float: right;
1898
+ width:80px;
1899
  vertical-align: middle;
1900
+
1901
  }
1902
 
1903
+ .downloadables_headding1{
1904
  display: inline;
1905
+ float:left;
1906
  text-align: left;
1907
  vertical-align: middle;
1908
  width: auto;
1909
  }
1910
 
1911
  img.ajax-feedback-active {
1912
+ vertical-align:middle;
1913
+ visibility:visible;
1914
  }
1915
 
1916
  .dashboard_page_wpsc-purchase-logs .column-id {
1917
+ width:75px;
1918
  }
1919
 
1920
  .dashboard_page_wpsc-purchase-logs .column-amount {
1921
+ width:100px;
1922
  }
1923
 
1924
+ .js table.purchase-logs td.column-status span, table.purchase-logs .column-status select {
1925
+ display:none;
 
1926
  }
1927
 
1928
  .js table.purchase-logs .column-status select {
1929
+ display:inline-block;
1930
+ margin-right:5px;
1931
  }
1932
 
1933
  table.purchase-logs .column-tracking .empty {
1934
+ position:relative;
1935
  }
1936
 
1937
  table.purchase-logs .column-tracking .empty .send-email {
1938
+ display:none;
1939
  }
1940
 
1941
  table.purchase-logs .column-tracking .add {
1942
+ position:absolute;
1943
+ left:6px;
1944
+ top:4px;
1945
  }
1946
 
1947
  table.purchase-logs .column-tracking {
1948
+ width:200px;
1949
  }
1950
 
1951
  table.purchase-logs .column-tracking input[type="text"] {
1952
+ width:180px;
1953
  }
1954
 
1955
  table.purchase-logs .column-tracking a.save {
1956
+ display:none;
1957
+ float:right;
1958
  }
1959
 
1960
  table.purchase-logs .column-tracking a.add {
1961
+ display:none;
1962
+ color:#ccc;
1963
+ cursor:text;
1964
  }
1965
 
1966
  table.purchase-logs .column-tracking .empty a.add {
1967
+ display:inline;
1968
  }
1969
 
1970
  table.purchase-logs .column-tracking .ajax-feedback {
1971
+ display:none;
1972
+ float:right;
1973
+ margin-top:5px;
1974
  }
1975
 
1976
  table.purchase-logs .column-tracking .ajax-feedback-active {
1977
+ display:inline-block;
1978
  }
1979
 
1980
  table.purchase-logs .column-tracking em.sent {
1981
+ color:green;
1982
  }
1983
 
1984
  table.purchase-logs .column-id .delete {
1985
+ color:red;
1986
+ visibility:hidden;
1987
  }
1988
 
1989
  table.purchase-logs tr:hover .column-id .delete {
1990
+ visibility:visible;
1991
  }
1992
 
1993
+ /* Product Variations */
 
 
 
 
1994
  .no-js #wpsc_product_variation_forms iframe {
1995
+ height:300px;
1996
  }
1997
 
1998
  .js #wpsc_product_variation_forms iframe {
1999
+ border:0;
2000
+ margin:0;
2001
+ overflow:hidden;
2002
+ padding:0;
 
 
 
 
 
2003
  }
2004
 
2005
  #wpsc_product_variation_forms iframe {
2006
+ background:transparent;
2007
+ width:100%;
2008
  }
2009
 
2010
  .wpsc-product-variation-iframe {
2011
  min-width: 400px;
 
 
2012
  }
2013
 
2014
  #wpsc-product-variations-wrapper .tablenav.top {
2015
+ margin-top:0;
2016
  }
2017
 
2018
  .wpsc-save-variations-top {
2019
+ float:right;
2020
+ margin:8px 0 5px;
2021
  }
2022
 
2023
  #wpsc-product-variations-wrapper .column-stock input[type="text"],
2025
  #wpsc-product-variations-wrapper .column-price input[type="text"],
2026
  #wpsc-product-variations-wrapper .column-sale_price input[type="text"],
2027
  #wpsc-product-variations-wrapper .column-sku input[type="text"] {
2028
+ width:100%;
2029
+
2030
+ box-sizing:border-box;
2031
+ -o-box-sizing:border-box;
2032
+ -moz-box-sizing:border-box;
2033
+ -webkit-box-sizing:border-box;
2034
  }
2035
 
2036
  #wpsc-product-variations-wrapper .inline-edit-row.column-stock input[type="text"],
2046
  #wpsc-product-variations-wrapper .column-price,
2047
  #wpsc-product-variations-wrapper .column-sale_price,
2048
  #wpsc-product-variations-wrapper .column-sku {
2049
+ text-align:center;
2050
+ width:11%;
2051
  }
2052
 
2053
  #wpsc-product-variations-wrapper .column-stock input,
2055
  #wpsc-product-variations-wrapper .column-price input,
2056
  #wpsc-product-variations-wrapper .column-sale_price input,
2057
  #wpsc-product-variations-wrapper .column-sku input {
2058
+ text-align:right;
2059
  }
2060
 
2061
+ .js #wpsc-product-variations-wrapper tbody .active td, .js #wpsc-product-variations-wrapper tbody .active th {
2062
+ border-bottom-style:dashed;
2063
+ }
2064
+
2065
+ .js #wpsc-product-variations-wrapper tbody td, .js #wpsc-product-variations-wrapper tbody th {
2066
+ border-bottom-style:solid;
2067
  }
2068
 
2069
  #wpsc-product-variations-wrapper div.updated,
2072
  }
2073
 
2074
  .js #wpsc-product-variations-wrapper .wpsc-stock-editor-row {
2075
+ display:none;
2076
  }
2077
 
2078
  #wpsc-product-variations-wrapper .wpsc-stock-editor-row td {
2079
+ border-bottom-style:solid;
2080
  }
2081
 
2082
  #wpsc-product-variations-wrapper {
2084
  }
2085
 
2086
  #wpsc-product-variations-wrapper .submit {
2087
+ margin:0;
2088
+ padding:0;
2089
  }
2090
 
2091
  .wpsc-stock-editor .inside {
2092
+ overflow:hidden;
2093
  }
2094
 
2095
  .wpsc-stock-editor .wpsc-product-shipping-section {
2096
+ display:inline-block;
2097
  vertical-align: top;
2098
+ width:49%;
2099
  }
2100
 
2101
  .wpsc-stock-editor .wpsc-form-field {
2102
+ clear:both;
 
 
 
 
 
 
 
 
2103
  }
2104
 
2105
  .wpsc-stock-editor .wpsc-product-shipping-section input[type="text"] {
2106
+ text-align:right;
2107
+ width:50px;
2108
  }
2109
 
2110
  .wpsc-product-shipping-weight-dimensions label {
2111
+ display:inline-block;
2112
+ min-width:60px;
2113
  }
2114
 
2115
  .wpsc-product-shipping-flat-rate label {
2116
+ display:inline-block;
2117
+ min-width:160px;
2118
  }
2119
 
2120
  .wpsc-stock-editor {
2121
+ overflow:hidden;
2122
  }
2123
 
2124
  .wpsc-stock-editor select {
2125
+ min-width:100px;
2126
  }
2127
 
2128
+ #wpsc_product_variation_forms .inside {
2129
+ background: #fff;
2130
+ padding: 0;
2131
+ margin: 0;
2132
  }
2133
 
2134
+ #wpsc_product_variation_forms {
2135
+ overflow: auto !important;
 
 
2136
  }
2137
 
2138
+ .wpsc-product-variations-tabs {
2139
+ background: #F1F1F1;
2140
+ border-bottom: 1px solid #ccc;
2141
+ padding: 10px 10px 0;
2142
+ margin: 0;
2143
  }
2144
 
2145
  .wpsc-product-variations-tabs li {
2146
+ display: inline-block;
2147
+ margin: 0 4px 2px 0;
2148
  }
2149
 
2150
  .wpsc-product-variations-tabs a {
2151
+ background-color: #fff;
2152
+ border-color: #ccc #ccc #fff;
 
2153
  border-style: solid;
2154
  border-width: 1px 1px 0;
 
2155
  color: #aaa;
2156
  padding: 5px 7px 3px;
2157
  text-decoration: none;
2158
+
2159
+ border-top-left-radius: 3px;
2160
+ border-top-right-radius: 3px;
 
2161
  -webkit-border-top-left-radius: 3px;
2162
+ -webkit-border-top-right-radius: 3px;
2163
+ -moz-border-top-left-radius: 3px;
2164
+ -moz-border-top-right-radius: 3px;
2165
  }
2166
 
2167
  .wpsc-product-variations-tabs a:hover {
2169
  }
2170
 
2171
  .wpsc-product-variations-tabs .active a {
 
2172
  border-bottom-width: 1px;
2173
  color: #333;
2174
+ margin-bottom: 2px;
2175
  }
2176
 
2177
  .wpsc-product-variations-tab-content {
 
2178
  padding: 0 10px;
2179
  }
2180
 
2183
  }
2184
 
2185
  .wpsc-save-product-variations.bottom {
 
 
2186
  padding-bottom: 5px;
2187
  }
 
 
 
2188
 
2189
  .wpsc-product-variation-thumbnail {
2190
  float: left;
2192
  width: 50px;
2193
  }
2194
 
 
 
 
 
 
2195
  .wpsc-product-variation-title {
2196
  margin-left: 60px;
2197
  }
2199
  .compat-field-wpsc_image_size input[type="radio"] {
2200
  width: auto;
2201
  margin-right:5px;
2202
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/arrows.png CHANGED
File without changes
wpsc-admin/css/jquery.ui.datepicker-classic.css DELETED
@@ -1,579 +0,0 @@
1
- /*
2
- * jQuery UI CSS Framework 1.8.16
3
- *
4
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- * http://jquery.org/license
7
- *
8
- * http://docs.jquery.com/UI/Theming/API
9
- *
10
- * Credit goes to Helen Hou-Sandi:
11
- * https://github.com/helenhousandi/wp-admin-jquery-ui
12
- *
13
- */
14
-
15
- /* Layout helpers
16
- ----------------------------------*/
17
- .ui-helper-hidden { display: none; }
18
- .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
19
- .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
20
- .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21
- .ui-helper-clearfix { display: inline-block; }
22
- /* required comment for clearfix to work in Opera \*/
23
- * html .ui-helper-clearfix { height:1%; }
24
- .ui-helper-clearfix { display:block; }
25
- /* end clearfix */
26
- .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
27
-
28
-
29
- /* Interaction Cues
30
- ----------------------------------*/
31
- .ui-state-disabled { cursor: default !important; }
32
-
33
-
34
- /* Icons
35
- ----------------------------------*/
36
-
37
- /* states and images */
38
- .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
39
-
40
-
41
- /* Misc visuals
42
- ----------------------------------*/
43
-
44
- /* Overlays */
45
- .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
46
-
47
-
48
- /*
49
- * jQuery UI CSS Framework 1.8.16
50
- *
51
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
52
- * Dual licensed under the MIT or GPL Version 2 licenses.
53
- * http://jquery.org/license
54
- *
55
- * http://docs.jquery.com/UI/Theming/API
56
- *
57
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=sans-serif&fwDefault=normal&fsDefault=12px&cornerRadius=3px&bgColorHeader=eff8ff&bgTextureHeader=04_highlight_hard.png&bgImgOpacityHeader=75&borderColorHeader=d1e5ee&fcHeader=333333&iconColorHeader=21759b&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=d1e5ee&fcContent=333333&iconColorContent=333333&bgColorDefault=eff8ff&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=75&borderColorDefault=d1e5ee&fcDefault=333333&iconColorDefault=333333&bgColorHover=f7fcfe&bgTextureHover=06_inset_hard.png&bgImgOpacityHover=75&borderColorHover=b8d7e5&fcHover=000000&iconColorHover=333333&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=d1e5ee&fcActive=333333&iconColorActive=333333&bgColorHighlight=ffffe0&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=e6db55&fcHighlight=333333&iconColorHighlight=21759b&bgColorError=ffebe8&bgTextureError=01_flat.png&bgImgOpacityError=95&borderColorError=cc0000&fcError=cc0000&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=3px
58
- */
59
-
60
-
61
- /* Component containers
62
- ----------------------------------*/
63
- .ui-widget { font-family: sans-serif; font-size: 12px; }
64
- .ui-widget .ui-widget { font-size: 1em; }
65
- .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: sans-serif; font-size: 1em; }
66
- .ui-widget-content { border: 1px solid #d1e5ee; background: #ffffff; color: #333333; }
67
- .ui-widget-header { border: 1px solid #d1e5ee; background-color: #f5fafd; background-image: -ms-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -moz-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -o-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -webkit-gradient(linear, left top, left bottom, from(#f7fcfe), to(#eff8ff)); background-image: -webkit-linear-gradient(top, #f7fcfe, #eff8ff); background-image: linear-gradient(top, #f7fcfe, #eff8ff); color: #333333; font-weight: bold; }
68
- .ui-widget-header a { color: #333333; }
69
-
70
- /* Interaction states
71
- ----------------------------------*/
72
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d1e5ee; background-color: #f5fafd; background-image: -ms-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -moz-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -o-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -webkit-gradient(linear, left top, left bottom, from(#f7fcfe), to(#eff8ff)); background-image: -webkit-linear-gradient(top, #f7fcfe, #eff8ff); background-image: linear-gradient(top, #f7fcfe, #eff8ff); font-weight: normal; color: #333333; }
73
- .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #333333; text-decoration: none; }
74
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #b8d7e5; background-color: #f7fcfe; background-image: -ms-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -moz-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -o-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -webkit-gradient(linear, left top, left bottom, from(#eff8ff), to(#f7fcfe)); background-image: -webkit-linear-gradient(top, #eff8ff, #f7fcfe); background-image: linear-gradient(top, #eff8ff, #f7fcfe);; font-weight: normal; color: #000000; }
75
- .ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; }
76
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #d1e5ee; background: #ffffff; font-weight: normal; color: #333333; }
77
- .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #333333; text-decoration: none; }
78
- .ui-widget :active { outline: none; }
79
-
80
- /* Interaction Cues
81
- ----------------------------------*/
82
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #e6db55; background: #ffffe0; color: #333333; }
83
- .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #333333; }
84
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cc0000; background: #ffebe8; color: #cc0000; }
85
- .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc0000; }
86
- .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc0000; }
87
- .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
88
- .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
89
- .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
90
-
91
- /* Icons
92
- ----------------------------------*/
93
-
94
- /* states and images */
95
- .ui-icon { width: 16px; height: 16px; background-image: url(ui-images/ui-icons_333333_256x240.png); }
96
- .ui-widget-content .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
97
- .ui-widget-header .ui-icon {background-image: url(ui-images/ui-icons_999999_256x240.png); }
98
- .ui-state-default .ui-icon { background-image: url(ui-images/ui-icons_333333_256x240.png); }
99
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
100
- .ui-state-active .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
101
- .ui-state-highlight .ui-icon {background-image: url(ui-images/ui-icons_21759b_256x240.png); }
102
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-images/ui-icons_cc0000_256x240.png); }
103
-
104
- /* positioning */
105
- .ui-icon-carat-1-n { background-position: 0 0; }
106
- .ui-icon-carat-1-ne { background-position: -16px 0; }
107
- .ui-icon-carat-1-e { background-position: -32px 0; }
108
- .ui-icon-carat-1-se { background-position: -48px 0; }
109
- .ui-icon-carat-1-s { background-position: -64px 0; }
110
- .ui-icon-carat-1-sw { background-position: -80px 0; }
111
- .ui-icon-carat-1-w { background-position: -96px 0; }
112
- .ui-icon-carat-1-nw { background-position: -112px 0; }
113
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
114
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
115
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
116
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
117
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
118
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
119
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
120
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
121
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
122
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
123
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
124
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
125
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
126
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
127
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
128
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
129
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
130
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
131
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
132
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
133
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
134
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
135
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
136
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
137
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
138
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
139
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
140
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
141
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
142
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
143
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
144
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
145
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
146
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
147
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
148
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
149
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
150
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
151
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
152
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
153
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
154
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
155
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
156
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
157
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
158
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
159
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
160
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
161
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
162
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
163
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
164
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
165
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
166
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
167
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
168
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
169
- .ui-icon-arrow-4 { background-position: 0 -80px; }
170
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
171
- .ui-icon-extlink { background-position: -32px -80px; }
172
- .ui-icon-newwin { background-position: -48px -80px; }
173
- .ui-icon-refresh { background-position: -64px -80px; }
174
- .ui-icon-shuffle { background-position: -80px -80px; }
175
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
176
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
177
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
178
- .ui-icon-folder-open { background-position: -16px -96px; }
179
- .ui-icon-document { background-position: -32px -96px; }
180
- .ui-icon-document-b { background-position: -48px -96px; }
181
- .ui-icon-note { background-position: -64px -96px; }
182
- .ui-icon-mail-closed { background-position: -80px -96px; }
183
- .ui-icon-mail-open { background-position: -96px -96px; }
184
- .ui-icon-suitcase { background-position: -112px -96px; }
185
- .ui-icon-comment { background-position: -128px -96px; }
186
- .ui-icon-person { background-position: -144px -96px; }
187
- .ui-icon-print { background-position: -160px -96px; }
188
- .ui-icon-trash { background-position: -176px -96px; }
189
- .ui-icon-locked { background-position: -192px -96px; }
190
- .ui-icon-unlocked { background-position: -208px -96px; }
191
- .ui-icon-bookmark { background-position: -224px -96px; }
192
- .ui-icon-tag { background-position: -240px -96px; }
193
- .ui-icon-home { background-position: 0 -112px; }
194
- .ui-icon-flag { background-position: -16px -112px; }
195
- .ui-icon-calendar { background-position: -32px -112px; }
196
- .ui-icon-cart { background-position: -48px -112px; }
197
- .ui-icon-pencil { background-position: -64px -112px; }
198
- .ui-icon-clock { background-position: -80px -112px; }
199
- .ui-icon-disk { background-position: -96px -112px; }
200
- .ui-icon-calculator { background-position: -112px -112px; }
201
- .ui-icon-zoomin { background-position: -128px -112px; }
202
- .ui-icon-zoomout { background-position: -144px -112px; }
203
- .ui-icon-search { background-position: -160px -112px; }
204
- .ui-icon-wrench { background-position: -176px -112px; }
205
- .ui-icon-gear { background-position: -192px -112px; }
206
- .ui-icon-heart { background-position: -208px -112px; }
207
- .ui-icon-star { background-position: -224px -112px; }
208
- .ui-icon-link { background-position: -240px -112px; }
209
- .ui-icon-cancel { background-position: 0 -128px; }
210
- .ui-icon-plus { background-position: -16px -128px; }
211
- .ui-icon-plusthick { background-position: -32px -128px; }
212
- .ui-icon-minus { background-position: -48px -128px; }
213
- .ui-icon-minusthick { background-position: -64px -128px; }
214
- .ui-icon-close { background-position: -80px -128px; }
215
- .ui-icon-closethick { background-position: -96px -128px; }
216
- .ui-icon-key { background-position: -112px -128px; }
217
- .ui-icon-lightbulb { background-position: -128px -128px; }
218
- .ui-icon-scissors { background-position: -144px -128px; }
219
- .ui-icon-clipboard { background-position: -160px -128px; }
220
- .ui-icon-copy { background-position: -176px -128px; }
221
- .ui-icon-contact { background-position: -192px -128px; }
222
- .ui-icon-image { background-position: -208px -128px; }
223
- .ui-icon-video { background-position: -224px -128px; }
224
- .ui-icon-script { background-position: -240px -128px; }
225
- .ui-icon-alert { background-position: 0 -144px; }
226
- .ui-icon-info { background-position: -16px -144px; }
227
- .ui-icon-notice { background-position: -32px -144px; }
228
- .ui-icon-help { background-position: -48px -144px; }
229
- .ui-icon-check { background-position: -64px -144px; }
230
- .ui-icon-bullet { background-position: -80px -144px; }
231
- .ui-icon-radio-off { background-position: -96px -144px; }
232
- .ui-icon-radio-on { background-position: -112px -144px; }
233
- .ui-icon-pin-w { background-position: -128px -144px; }
234
- .ui-icon-pin-s { background-position: -144px -144px; }
235
- .ui-icon-play { background-position: 0 -160px; }
236
- .ui-icon-pause { background-position: -16px -160px; }
237
- .ui-icon-seek-next { background-position: -32px -160px; }
238
- .ui-icon-seek-prev { background-position: -48px -160px; }
239
- .ui-icon-seek-end { background-position: -64px -160px; }
240
- .ui-icon-seek-start { background-position: -80px -160px; }
241
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
242
- .ui-icon-seek-first { background-position: -80px -160px; }
243
- .ui-icon-stop { background-position: -96px -160px; }
244
- .ui-icon-eject { background-position: -112px -160px; }
245
- .ui-icon-volume-off { background-position: -128px -160px; }
246
- .ui-icon-volume-on { background-position: -144px -160px; }
247
- .ui-icon-power { background-position: 0 -176px; }
248
- .ui-icon-signal-diag { background-position: -16px -176px; }
249
- .ui-icon-signal { background-position: -32px -176px; }
250
- .ui-icon-battery-0 { background-position: -48px -176px; }
251
- .ui-icon-battery-1 { background-position: -64px -176px; }
252
- .ui-icon-battery-2 { background-position: -80px -176px; }
253
- .ui-icon-battery-3 { background-position: -96px -176px; }
254
- .ui-icon-circle-plus { background-position: 0 -192px; }
255
- .ui-icon-circle-minus { background-position: -16px -192px; }
256
- .ui-icon-circle-close { background-position: -32px -192px; }
257
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
258
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
259
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
260
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
261
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
262
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
263
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
264
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
265
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
266
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
267
- .ui-icon-circle-check { background-position: -208px -192px; }
268
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
269
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
270
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
271
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
272
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
273
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
274
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
275
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
276
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
277
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
278
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
279
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
280
-
281
-
282
- /* Misc visuals
283
- ----------------------------------*/
284
-
285
- /* Corner radius */
286
- .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-left-radius: 3px; }
287
- .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-right-radius: 3px; }
288
- .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
289
- .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; -khtml-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
290
-
291
- /* Overlays */
292
- .ui-widget-overlay { background: #000000; opacity: .6;filter:Alpha(Opacity=60); }
293
- .ui-widget-shadow { box-shadow: 0 0 16px rgba(0, 0, 0, 0.3); }/*
294
- * jQuery UI Resizable 1.8.16
295
- *
296
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
297
- * Dual licensed under the MIT or GPL Version 2 licenses.
298
- * http://jquery.org/license
299
- *
300
- * http://docs.jquery.com/UI/Resizable#theming
301
- */
302
- .ui-resizable { position: relative;}
303
- .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
304
- .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
305
- .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
306
- .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
307
- .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
308
- .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
309
- .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
310
- .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
311
- .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
312
- .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
313
- * jQuery UI Selectable 1.8.16
314
- *
315
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
316
- * Dual licensed under the MIT or GPL Version 2 licenses.
317
- * http://jquery.org/license
318
- *
319
- * http://docs.jquery.com/UI/Selectable#theming
320
- */
321
- .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
322
- /*
323
- * jQuery UI Accordion 1.8.16
324
- *
325
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
326
- * Dual licensed under the MIT or GPL Version 2 licenses.
327
- * http://jquery.org/license
328
- *
329
- * http://docs.jquery.com/UI/Accordion#theming
330
- */
331
- /* IE/Win - Fix animation bug - #4615 */
332
- .ui-accordion { width: 100%; }
333
- .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
334
- .ui-accordion .ui-accordion-li-fix { display: inline; }
335
- .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
336
- .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
337
- .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
338
- .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
339
- .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
340
- .ui-accordion .ui-accordion-content-active { display: block; }
341
- /*
342
- * jQuery UI Autocomplete 1.8.16
343
- *
344
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
345
- * Dual licensed under the MIT or GPL Version 2 licenses.
346
- * http://jquery.org/license
347
- *
348
- * http://docs.jquery.com/UI/Autocomplete#theming
349
- */
350
- .ui-autocomplete { position: absolute; cursor: default; }
351
-
352
- /* workarounds */
353
- * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
354
-
355
- /*
356
- * jQuery UI Menu 1.8.16
357
- *
358
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
359
- * Dual licensed under the MIT or GPL Version 2 licenses.
360
- * http://jquery.org/license
361
- *
362
- * http://docs.jquery.com/UI/Menu#theming
363
- */
364
- .ui-menu {
365
- list-style:none;
366
- padding: 2px;
367
- margin: 0;
368
- display:block;
369
- float: left;
370
- }
371
- .ui-menu .ui-menu {
372
- margin-top: -3px;
373
- }
374
- .ui-menu .ui-menu-item {
375
- margin:0;
376
- padding: 0;
377
- zoom: 1;
378
- float: left;
379
- clear: left;
380
- width: 100%;
381
- }
382
- .ui-menu .ui-menu-item a {
383
- text-decoration:none;
384
- display:block;
385
- padding:.2em .4em;
386
- line-height:1.5;
387
- zoom:1;
388
- }
389
- .ui-menu .ui-menu-item a.ui-state-hover,
390
- .ui-menu .ui-menu-item a.ui-state-active {
391
- font-weight: normal;
392
- margin: -1px;
393
- }
394
- /*
395
- * jQuery UI Button 1.8.16
396
- *
397
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
398
- * Dual licensed under the MIT or GPL Version 2 licenses.
399
- * http://jquery.org/license
400
- *
401
- * http://docs.jquery.com/UI/Button#theming
402
- */
403
- .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
404
- .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
405
- button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
406
- .ui-button-icons-only { width: 3.4em; }
407
- button.ui-button-icons-only { width: 3.7em; }
408
-
409
- /*button text element */
410
- .ui-button .ui-button-text { display: block; line-height: 1.4; }
411
- .ui-button-text-only .ui-button-text { padding: .4em 1em; }
412
- .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
413
- .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
414
- .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
415
- .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
416
- /* no icon support for input elements, provide padding by default */
417
- input.ui-button { padding: .4em 1em; }
418
-
419
- /*button icon element(s) */
420
- .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
421
- .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
422
- .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
423
- .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
424
- .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
425
-
426
- /*button sets*/
427
- .ui-buttonset { margin-right: 7px; }
428
- .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
429
-
430
- /* workarounds */
431
- button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
432
- /*
433
- * jQuery UI Dialog 1.8.16
434
- *
435
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
436
- * Dual licensed under the MIT or GPL Version 2 licenses.
437
- * http://jquery.org/license
438
- *
439
- * http://docs.jquery.com/UI/Dialog#theming
440
- */
441
- .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
442
- .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
443
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
444
- .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
445
- .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
446
- .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
447
- .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
448
- .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
449
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
450
- .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
451
- .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
452
- .ui-draggable .ui-dialog-titlebar { cursor: move; }
453
- /*
454
- * jQuery UI Slider 1.8.16
455
- *
456
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
457
- * Dual licensed under the MIT or GPL Version 2 licenses.
458
- * http://jquery.org/license
459
- *
460
- * http://docs.jquery.com/UI/Slider#theming
461
- */
462
- .ui-slider { position: relative; text-align: left; }
463
- .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
464
- .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
465
-
466
- .ui-slider-horizontal { height: .8em; }
467
- .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
468
- .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
469
- .ui-slider-horizontal .ui-slider-range-min { left: 0; }
470
- .ui-slider-horizontal .ui-slider-range-max { right: 0; }
471
-
472
- .ui-slider-vertical { width: .8em; height: 100px; }
473
- .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
474
- .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
475
- .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
476
- .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
477
- * jQuery UI Tabs 1.8.16
478
- *
479
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
480
- * Dual licensed under the MIT or GPL Version 2 licenses.
481
- * http://jquery.org/license
482
- *
483
- * http://docs.jquery.com/UI/Tabs#theming
484
- */
485
- .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
486
- .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
487
- .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
488
- .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
489
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
490
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
491
- .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
492
- .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
493
- .ui-tabs .ui-tabs-hide { display: none !important; }
494
- /*
495
- * jQuery UI Datepicker 1.8.16
496
- *
497
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
498
- * Dual licensed under the MIT or GPL Version 2 licenses.
499
- * http://jquery.org/license
500
- *
501
- * http://docs.jquery.com/UI/Datepicker#theming
502
- */
503
- .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
504
- .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
505
- .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
506
- .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
507
- .ui-datepicker .ui-datepicker-prev { left:2px; }
508
- .ui-datepicker .ui-datepicker-next { right:2px; }
509
- .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
510
- .ui-datepicker .ui-datepicker-next-hover { right:1px; }
511
- .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
512
- .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
513
- .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
514
- .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
515
- .ui-datepicker select.ui-datepicker-month,
516
- .ui-datepicker select.ui-datepicker-year { width: 49%;}
517
- .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
518
- .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
519
- .ui-datepicker td { border: 0; padding: 1px; }
520
- .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
521
- .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
522
- .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
523
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
524
-
525
- /* with multiple calendars */
526
- .ui-datepicker.ui-datepicker-multi { width:auto; }
527
- .ui-datepicker-multi .ui-datepicker-group { float:left; }
528
- .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
529
- .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
530
- .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
531
- .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
532
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
533
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
534
- .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
535
- .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
536
-
537
- /* RTL support */
538
- .ui-datepicker-rtl { direction: rtl; }
539
- .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
540
- .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
541
- .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
542
- .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
543
- .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
544
- .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
545
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
546
- .ui-datepicker-rtl .ui-datepicker-group { float:right; }
547
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
548
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
549
-
550
- /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
551
- .ui-datepicker-cover {
552
- display: none; /*sorry for IE5*/
553
- display/**/: block; /*sorry for IE5*/
554
- position: absolute; /*must have*/
555
- z-index: -1; /*must have*/
556
- filter: mask(); /*must have*/
557
- top: -4px; /*must have*/
558
- left: -4px; /*must have*/
559
- width: 200px; /*must have*/
560
- height: 200px; /*must have*/
561
- }/*
562
- * jQuery UI Progressbar 1.8.16
563
- *
564
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
565
- * Dual licensed under the MIT or GPL Version 2 licenses.
566
- * http://jquery.org/license
567
- *
568
- * http://docs.jquery.com/UI/Progressbar#theming
569
- */
570
- .ui-progressbar { height:2em; text-align: left; }
571
- .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
572
- .ui-progressbar .ui-widget-header {
573
- background-color: #83B4D8;
574
- background-image: linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
575
- background-image: -o-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
576
- background-image: -moz-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
577
- background-image: -webkit-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
578
- background-image: -ms-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
579
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/jquery.ui.datepicker-fresh.css DELETED
@@ -1,579 +0,0 @@
1
- /*
2
- * jQuery UI CSS Framework 1.8.16
3
- *
4
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- * http://jquery.org/license
7
- *
8
- * http://docs.jquery.com/UI/Theming/API
9
- *
10
- * Credit goes to Helen Hou-Sandi:
11
- * https://github.com/helenhousandi/wp-admin-jquery-ui
12
- *
13
- */
14
-
15
- /* Layout helpers
16
- ----------------------------------*/
17
- .ui-helper-hidden { display: none; }
18
- .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
19
- .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
20
- .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21
- .ui-helper-clearfix { display: inline-block; }
22
- /* required comment for clearfix to work in Opera \*/
23
- * html .ui-helper-clearfix { height:1%; }
24
- .ui-helper-clearfix { display:block; }
25
- /* end clearfix */
26
- .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
27
-
28
-
29
- /* Interaction Cues
30
- ----------------------------------*/
31
- .ui-state-disabled { cursor: default !important; }
32
-
33
-
34
- /* Icons
35
- ----------------------------------*/
36
-
37
- /* states and images */
38
- .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
39
-
40
-
41
- /* Misc visuals
42
- ----------------------------------*/
43
-
44
- /* Overlays */
45
- .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
46
-
47
-
48
- /*
49
- * jQuery UI CSS Framework 1.8.16
50
- *
51
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
52
- * Dual licensed under the MIT or GPL Version 2 licenses.
53
- * http://jquery.org/license
54
- *
55
- * http://docs.jquery.com/UI/Theming/API
56
- *
57
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=sans-serif&fwDefault=normal&fsDefault=12px&cornerRadius=4px&bgColorHeader=ececec&bgTextureHeader=04_highlight_hard.png&bgImgOpacityHeader=75&borderColorHeader=dfdfdf&fcHeader=333333&iconColorHeader=999999&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=dfdfdf&fcContent=333333&iconColorContent=333333&bgColorDefault=ececec&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=75&borderColorDefault=dfdfdf&fcDefault=333333&iconColorDefault=333333&bgColorHover=ececec&bgTextureHover=06_inset_hard.png&bgImgOpacityHover=75&borderColorHover=ccc&fcHover=000000&iconColorHover=333333&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=dfdfdf&fcActive=333333&iconColorActive=333333&bgColorHighlight=ffffe0&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=e6db55&fcHighlight=333333&iconColorHighlight=21759b&bgColorError=ffebe8&bgTextureError=01_flat.png&bgImgOpacityError=95&borderColorError=cc0000&fcError=cc0000&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=3px
58
- */
59
-
60
-
61
- /* Component containers
62
- ----------------------------------*/
63
- .ui-widget { font-family: sans-serif; font-size: 12px; }
64
- .ui-widget .ui-widget { font-size: 1em; }
65
- .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: sans-serif; font-size: 1em; }
66
- .ui-widget-content { border: 1px solid #dfdfdf; background: #ffffff; color: #333333; }
67
- .ui-widget-header { border: 1px solid #dfdfdf; color: #333333; font-weight: bold; background-color: #f1f1f1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); }
68
- .ui-widget-header a { color: #333333; }
69
-
70
- /* Interaction states
71
- ----------------------------------*/
72
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #dfdfdf; background-color: #f1f1f1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); font-weight: normal; color: #333333; }
73
- .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #333333; text-decoration: none; }
74
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #ccc; background-color: #ececec; background-image: -ms-linear-gradient(top, #ececec, #f9f9f9); background-image: -moz-linear-gradient(top, #ececec, #f9f9f9); background-image: -o-linear-gradient(top, #ececec, #f9f9f9); background-image: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#f9f9f9)); background-image: -webkit-linear-gradient(top, #ececec, #f9f9f9); background-image: linear-gradient(top, #ececec, #f9f9f9); font-weight: normal; color: #000000; }
75
- .ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; }
76
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #dfdfdf; background: #ffffff; font-weight: normal; color: #333333; }
77
- .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #333333; text-decoration: none; }
78
- .ui-widget :active { outline: none; }
79
-
80
- /* Interaction Cues
81
- ----------------------------------*/
82
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #e6db55; background: #ffffe0; color: #333333; }
83
- .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #333333; }
84
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cc0000; background: #ffebe8; color: #cc0000; }
85
- .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc0000; }
86
- .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc0000; }
87
- .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
88
- .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
89
- .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
90
-
91
- /* Icons
92
- ----------------------------------*/
93
-
94
- /* states and images */
95
- .ui-icon { width: 16px; height: 16px; background-image: url(ui-images/ui-icons_333333_256x240.png); }
96
- .ui-widget-content .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
97
- .ui-widget-header .ui-icon {background-image: url(ui-images/ui-icons_999999_256x240.png); }
98
- .ui-state-default .ui-icon { background-image: url(ui-images/ui-icons_333333_256x240.png); }
99
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
100
- .ui-state-active .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
101
- .ui-state-highlight .ui-icon {background-image: url(ui-images/ui-icons_21759b_256x240.png); }
102
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-images/ui-icons_cc0000_256x240.png); }
103
-
104
- /* positioning */
105
- .ui-icon-carat-1-n { background-position: 0 0; }
106
- .ui-icon-carat-1-ne { background-position: -16px 0; }
107
- .ui-icon-carat-1-e { background-position: -32px 0; }
108
- .ui-icon-carat-1-se { background-position: -48px 0; }
109
- .ui-icon-carat-1-s { background-position: -64px 0; }
110
- .ui-icon-carat-1-sw { background-position: -80px 0; }
111
- .ui-icon-carat-1-w { background-position: -96px 0; }
112
- .ui-icon-carat-1-nw { background-position: -112px 0; }
113
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
114
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
115
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
116
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
117
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
118
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
119
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
120
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
121
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
122
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
123
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
124
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
125
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
126
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
127
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
128
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
129
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
130
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
131
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
132
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
133
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
134
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
135
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
136
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
137
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
138
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
139
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
140
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
141
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
142
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
143
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
144
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
145
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
146
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
147
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
148
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
149
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
150
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
151
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
152
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
153
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
154
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
155
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
156
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
157
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
158
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
159
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
160
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
161
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
162
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
163
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
164
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
165
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
166
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
167
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
168
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
169
- .ui-icon-arrow-4 { background-position: 0 -80px; }
170
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
171
- .ui-icon-extlink { background-position: -32px -80px; }
172
- .ui-icon-newwin { background-position: -48px -80px; }
173
- .ui-icon-refresh { background-position: -64px -80px; }
174
- .ui-icon-shuffle { background-position: -80px -80px; }
175
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
176
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
177
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
178
- .ui-icon-folder-open { background-position: -16px -96px; }
179
- .ui-icon-document { background-position: -32px -96px; }
180
- .ui-icon-document-b { background-position: -48px -96px; }
181
- .ui-icon-note { background-position: -64px -96px; }
182
- .ui-icon-mail-closed { background-position: -80px -96px; }
183
- .ui-icon-mail-open { background-position: -96px -96px; }
184
- .ui-icon-suitcase { background-position: -112px -96px; }
185
- .ui-icon-comment { background-position: -128px -96px; }
186
- .ui-icon-person { background-position: -144px -96px; }
187
- .ui-icon-print { background-position: -160px -96px; }
188
- .ui-icon-trash { background-position: -176px -96px; }
189
- .ui-icon-locked { background-position: -192px -96px; }
190
- .ui-icon-unlocked { background-position: -208px -96px; }
191
- .ui-icon-bookmark { background-position: -224px -96px; }
192
- .ui-icon-tag { background-position: -240px -96px; }
193
- .ui-icon-home { background-position: 0 -112px; }
194
- .ui-icon-flag { background-position: -16px -112px; }
195
- .ui-icon-calendar { background-position: -32px -112px; }
196
- .ui-icon-cart { background-position: -48px -112px; }
197
- .ui-icon-pencil { background-position: -64px -112px; }
198
- .ui-icon-clock { background-position: -80px -112px; }
199
- .ui-icon-disk { background-position: -96px -112px; }
200
- .ui-icon-calculator { background-position: -112px -112px; }
201
- .ui-icon-zoomin { background-position: -128px -112px; }
202
- .ui-icon-zoomout { background-position: -144px -112px; }
203
- .ui-icon-search { background-position: -160px -112px; }
204
- .ui-icon-wrench { background-position: -176px -112px; }
205
- .ui-icon-gear { background-position: -192px -112px; }
206
- .ui-icon-heart { background-position: -208px -112px; }
207
- .ui-icon-star { background-position: -224px -112px; }
208
- .ui-icon-link { background-position: -240px -112px; }
209
- .ui-icon-cancel { background-position: 0 -128px; }
210
- .ui-icon-plus { background-position: -16px -128px; }
211
- .ui-icon-plusthick { background-position: -32px -128px; }
212
- .ui-icon-minus { background-position: -48px -128px; }
213
- .ui-icon-minusthick { background-position: -64px -128px; }
214
- .ui-icon-close { background-position: -80px -128px; }
215
- .ui-icon-closethick { background-position: -96px -128px; }
216
- .ui-icon-key { background-position: -112px -128px; }
217
- .ui-icon-lightbulb { background-position: -128px -128px; }
218
- .ui-icon-scissors { background-position: -144px -128px; }
219
- .ui-icon-clipboard { background-position: -160px -128px; }
220
- .ui-icon-copy { background-position: -176px -128px; }
221
- .ui-icon-contact { background-position: -192px -128px; }
222
- .ui-icon-image { background-position: -208px -128px; }
223
- .ui-icon-video { background-position: -224px -128px; }
224
- .ui-icon-script { background-position: -240px -128px; }
225
- .ui-icon-alert { background-position: 0 -144px; }
226
- .ui-icon-info { background-position: -16px -144px; }
227
- .ui-icon-notice { background-position: -32px -144px; }
228
- .ui-icon-help { background-position: -48px -144px; }
229
- .ui-icon-check { background-position: -64px -144px; }
230
- .ui-icon-bullet { background-position: -80px -144px; }
231
- .ui-icon-radio-off { background-position: -96px -144px; }
232
- .ui-icon-radio-on { background-position: -112px -144px; }
233
- .ui-icon-pin-w { background-position: -128px -144px; }
234
- .ui-icon-pin-s { background-position: -144px -144px; }
235
- .ui-icon-play { background-position: 0 -160px; }
236
- .ui-icon-pause { background-position: -16px -160px; }
237
- .ui-icon-seek-next { background-position: -32px -160px; }
238
- .ui-icon-seek-prev { background-position: -48px -160px; }
239
- .ui-icon-seek-end { background-position: -64px -160px; }
240
- .ui-icon-seek-start { background-position: -80px -160px; }
241
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
242
- .ui-icon-seek-first { background-position: -80px -160px; }
243
- .ui-icon-stop { background-position: -96px -160px; }
244
- .ui-icon-eject { background-position: -112px -160px; }
245
- .ui-icon-volume-off { background-position: -128px -160px; }
246
- .ui-icon-volume-on { background-position: -144px -160px; }
247
- .ui-icon-power { background-position: 0 -176px; }
248
- .ui-icon-signal-diag { background-position: -16px -176px; }
249
- .ui-icon-signal { background-position: -32px -176px; }
250
- .ui-icon-battery-0 { background-position: -48px -176px; }
251
- .ui-icon-battery-1 { background-position: -64px -176px; }
252
- .ui-icon-battery-2 { background-position: -80px -176px; }
253
- .ui-icon-battery-3 { background-position: -96px -176px; }
254
- .ui-icon-circle-plus { background-position: 0 -192px; }
255
- .ui-icon-circle-minus { background-position: -16px -192px; }
256
- .ui-icon-circle-close { background-position: -32px -192px; }
257
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
258
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
259
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
260
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
261
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
262
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
263
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
264
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
265
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
266
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
267
- .ui-icon-circle-check { background-position: -208px -192px; }
268
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
269
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
270
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
271
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
272
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
273
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
274
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
275
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
276
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
277
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
278
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
279
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
280
-
281
-
282
- /* Misc visuals
283
- ----------------------------------*/
284
-
285
- /* Corner radius */
286
- .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; }
287
- .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
288
- .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
289
- .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
290
-
291
- /* Overlays */
292
- .ui-widget-overlay { background: #000000; opacity: .6;filter:Alpha(Opacity=60); }
293
- .ui-widget-shadow { box-shadow: 0 0 16px rgba(0, 0, 0, 0.3); }/*
294
- * jQuery UI Resizable 1.8.16
295
- *
296
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
297
- * Dual licensed under the MIT or GPL Version 2 licenses.
298
- * http://jquery.org/license
299
- *
300
- * http://docs.jquery.com/UI/Resizable#theming
301
- */
302
- .ui-resizable { position: relative;}
303
- .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
304
- .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
305
- .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
306
- .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
307
- .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
308
- .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
309
- .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
310
- .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
311
- .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
312
- .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
313
- * jQuery UI Selectable 1.8.16
314
- *
315
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
316
- * Dual licensed under the MIT or GPL Version 2 licenses.
317
- * http://jquery.org/license
318
- *
319
- * http://docs.jquery.com/UI/Selectable#theming
320
- */
321
- .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
322
- /*
323
- * jQuery UI Accordion 1.8.16
324
- *
325
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
326
- * Dual licensed under the MIT or GPL Version 2 licenses.
327
- * http://jquery.org/license
328
- *
329
- * http://docs.jquery.com/UI/Accordion#theming
330
- */
331
- /* IE/Win - Fix animation bug - #4615 */
332
- .ui-accordion { width: 100%; }
333
- .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
334
- .ui-accordion .ui-accordion-li-fix { display: inline; }
335
- .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
336
- .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
337
- .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
338
- .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
339
- .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
340
- .ui-accordion .ui-accordion-content-active { display: block; }
341
- /*
342
- * jQuery UI Autocomplete 1.8.16
343
- *
344
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
345
- * Dual licensed under the MIT or GPL Version 2 licenses.
346
- * http://jquery.org/license
347
- *
348
- * http://docs.jquery.com/UI/Autocomplete#theming
349
- */
350
- .ui-autocomplete { position: absolute; cursor: default; }
351
-
352
- /* workarounds */
353
- * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
354
-
355
- /*
356
- * jQuery UI Menu 1.8.16
357
- *
358
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
359
- * Dual licensed under the MIT or GPL Version 2 licenses.
360
- * http://jquery.org/license
361
- *
362
- * http://docs.jquery.com/UI/Menu#theming
363
- */
364
- .ui-menu {
365
- list-style:none;
366
- padding: 2px;
367
- margin: 0;
368
- display:block;
369
- float: left;
370
- }
371
- .ui-menu .ui-menu {
372
- margin-top: -3px;
373
- }
374
- .ui-menu .ui-menu-item {
375
- margin:0;
376
- padding: 0;
377
- zoom: 1;
378
- float: left;
379
- clear: left;
380
- width: 100%;
381
- }
382
- .ui-menu .ui-menu-item a {
383
- text-decoration:none;
384
- display:block;
385
- padding:.2em .4em;
386
- line-height:1.5;
387
- zoom:1;
388
- }
389
- .ui-menu .ui-menu-item a.ui-state-hover,
390
- .ui-menu .ui-menu-item a.ui-state-active {
391
- font-weight: normal;
392
- margin: -1px;
393
- }
394
- /*
395
- * jQuery UI Button 1.8.16
396
- *
397
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
398
- * Dual licensed under the MIT or GPL Version 2 licenses.
399
- * http://jquery.org/license
400
- *
401
- * http://docs.jquery.com/UI/Button#theming
402
- */
403
- .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
404
- .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
405
- button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
406
- .ui-button-icons-only { width: 3.4em; }
407
- button.ui-button-icons-only { width: 3.7em; }
408
-
409
- /*button text element */
410
- .ui-button .ui-button-text { display: block; line-height: 1.4; }
411
- .ui-button-text-only .ui-button-text { padding: .4em 1em; }
412
- .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
413
- .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
414
- .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
415
- .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
416
- /* no icon support for input elements, provide padding by default */
417
- input.ui-button { padding: .4em 1em; }
418
-
419
- /*button icon element(s) */
420
- .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
421
- .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
422
- .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
423
- .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
424
- .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
425
-
426
- /*button sets*/
427
- .ui-buttonset { margin-right: 7px; }
428
- .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
429
-
430
- /* workarounds */
431
- button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
432
- /*
433
- * jQuery UI Dialog 1.8.16
434
- *
435
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
436
- * Dual licensed under the MIT or GPL Version 2 licenses.
437
- * http://jquery.org/license
438
- *
439
- * http://docs.jquery.com/UI/Dialog#theming
440
- */
441
- .ui-dialog { position: fixed; padding: .2em; width: 300px; overflow: hidden; }
442
- .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
443
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
444
- .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
445
- .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
446
- .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
447
- .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
448
- .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
449
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
450
- .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
451
- .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
452
- .ui-draggable .ui-dialog-titlebar { cursor: move; }
453
- /*
454
- * jQuery UI Slider 1.8.16
455
- *
456
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
457
- * Dual licensed under the MIT or GPL Version 2 licenses.
458
- * http://jquery.org/license
459
- *
460
- * http://docs.jquery.com/UI/Slider#theming
461
- */
462
- .ui-slider { position: relative; text-align: left; }
463
- .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
464
- .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
465
-
466
- .ui-slider-horizontal { height: .8em; }
467
- .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
468
- .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
469
- .ui-slider-horizontal .ui-slider-range-min { left: 0; }
470
- .ui-slider-horizontal .ui-slider-range-max { right: 0; }
471
-
472
- .ui-slider-vertical { width: .8em; height: 100px; }
473
- .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
474
- .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
475
- .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
476
- .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
477
- * jQuery UI Tabs 1.8.16
478
- *
479
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
480
- * Dual licensed under the MIT or GPL Version 2 licenses.
481
- * http://jquery.org/license
482
- *
483
- * http://docs.jquery.com/UI/Tabs#theming
484
- */
485
- .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
486
- .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
487
- .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
488
- .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
489
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
490
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
491
- .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
492
- .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
493
- .ui-tabs .ui-tabs-hide { display: none !important; }
494
- /*
495
- * jQuery UI Datepicker 1.8.16
496
- *
497
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
498
- * Dual licensed under the MIT or GPL Version 2 licenses.
499
- * http://jquery.org/license
500
- *
501
- * http://docs.jquery.com/UI/Datepicker#theming
502
- */
503
- .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
504
- .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
505
- .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
506
- .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
507
- .ui-datepicker .ui-datepicker-prev { left:2px; }
508
- .ui-datepicker .ui-datepicker-next { right:2px; }
509
- .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
510
- .ui-datepicker .ui-datepicker-next-hover { right:1px; }
511
- .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
512
- .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
513
- .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
514
- .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
515
- .ui-datepicker select.ui-datepicker-month,
516
- .ui-datepicker select.ui-datepicker-year { width: 49%;}
517
- .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
518
- .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
519
- .ui-datepicker td { border: 0; padding: 1px; }
520
- .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
521
- .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
522
- .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
523
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
524
-
525
- /* with multiple calendars */
526
- .ui-datepicker.ui-datepicker-multi { width:auto; }
527
- .ui-datepicker-multi .ui-datepicker-group { float:left; }
528
- .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
529
- .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
530
- .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
531
- .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
532
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
533
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
534
- .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
535
- .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
536
-
537
- /* RTL support */
538
- .ui-datepicker-rtl { direction: rtl; }
539
- .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
540
- .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
541
- .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
542
- .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
543
- .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
544
- .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
545
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
546
- .ui-datepicker-rtl .ui-datepicker-group { float:right; }
547
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
548
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
549
-
550
- /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
551
- .ui-datepicker-cover {
552
- display: none; /*sorry for IE5*/
553
- display/**/: block; /*sorry for IE5*/
554
- position: absolute; /*must have*/
555
- z-index: -1; /*must have*/
556
- filter: mask(); /*must have*/
557
- top: -4px; /*must have*/
558
- left: -4px; /*must have*/
559
- width: 200px; /*must have*/
560
- height: 200px; /*must have*/
561
- }/*
562
- * jQuery UI Progressbar 1.8.16
563
- *
564
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
565
- * Dual licensed under the MIT or GPL Version 2 licenses.
566
- * http://jquery.org/license
567
- *
568
- * http://docs.jquery.com/UI/Progressbar#theming
569
- */
570
- .ui-progressbar { height:2em; text-align: left; }
571
- .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
572
- .ui-progressbar .ui-widget-header {
573
- background-color: #83B4D8;
574
- background-image: linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
575
- background-image: -o-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
576
- background-image: -moz-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
577
- background-image: -webkit-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
578
- background-image: -ms-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
579
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/loading-small.gif CHANGED
File without changes
wpsc-admin/css/media.css DELETED
@@ -1,26 +0,0 @@
1
- .wpsc-featured-label {
2
- position: absolute;
3
- bottom: 0;
4
- left: 0;
5
- right: 0;
6
- background: #f1f1f1;
7
- background-image: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#e1e1e1));
8
- background-image: -webkit-linear-gradient(top, #f1f1f1, #e1e1e1);
9
- background-image: -moz-linear-gradient(top, #f1f1f1, #e1e1e1);
10
- background-image: -o-linear-gradient(top, #f1f1f1, #e1e1e1);
11
- background-image: linear-gradient(to bottom, #f1f1f1, #e1e1e1);
12
- box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.15 );
13
- font-weight: bold;
14
- text-align: center;
15
- color: rgb(70, 70, 70);
16
- max-height: 100%;
17
- padding: 5px 10px;
18
- outline: 0 none;
19
- opacity: 0.95;
20
- line-height: 1em;
21
- }
22
-
23
- .selection-view .wpsc-featured-label {
24
- font-size:7px;
25
- padding: 2px 0;
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/plus-minus.png ADDED
Binary file
wpsc-admin/css/settingspage.css CHANGED
@@ -12,6 +12,9 @@ th#actions{
12
  th#drag{
13
  width:50px;
14
  }
 
 
 
15
  tr.wpsc_grey{
16
  background-color: #ededed;
17
  }
@@ -19,35 +22,12 @@ td.drag a:hover{
19
  cursor: move;
20
  }
21
 
22
- th.column-type {
23
- width: 9em;
24
- }
25
- #wpsc_checkout_list th.column-type {
26
- width: 9em;
27
  }
28
 
29
  th.column-unique_name {
30
- width: 9em;
31
- }
32
-
33
- th.column-mandatory, th.column-display {
34
- width: 6em;
35
- }
36
-
37
- .widefat th.column-mandatory, td.mandatorycol, .widefat th.column-display, td.displaycol, .widefat th.column-trash, td.trashcol {
38
- text-align:center;
39
- vertical-align: top
40
- }
41
-
42
- #wpsc_checkout_list td.typecol select {
43
- width: 100%;
44
- }
45
-
46
- #wpsc_imported_columns ol {
47
- margin-top: 0;
48
- }
49
- #wpsc_imported_columns .empty {
50
- color: #999;
51
  }
52
 
53
  #checkout_message{
@@ -75,12 +55,16 @@ td.drag a img {
75
  margin-left:4px;
76
  }
77
 
78
- #wpsc_checkout_list .ui-sortable-helper {
79
- margin-left:0;
80
  }
81
 
82
- #wpsc_checkout_list .namecol input {
83
- width: 98%;
 
 
 
 
84
  }
85
 
86
  #wpsc_checkout_list .actionscol .cell-wrapper {
@@ -113,7 +97,7 @@ tr.checkout-placeholder td {
113
  }
114
 
115
  #options_presentation{
116
- margin-right: 370px;
117
  }
118
 
119
  table.wpsc-edit-module-options tr td {
@@ -124,52 +108,20 @@ table.wpsc-edit-module-options tr td {
124
  padding: 0 0 8px 8px;
125
  width:394px;
126
  }
127
- .gateway_settings_form,
128
- .shipping-module-settings-form {
129
- padding: .5em;
130
- }
131
- .widefat .gateway_settings_form td,
132
- .widefat .shipping-module-settings-form td {
133
- border: none;
134
- overflow: initial;
135
- }
136
- .widefat .shipping-module-settings-form td input {
137
- margin-top: -5px;
138
- }
139
- .widefat .shipping-module-settings-form th {
140
- font-family: inherit;
141
- font-size: 12px;
142
- }
143
- .widefat p.description {
144
- color: #666;
145
- }
146
- .widefat .inactive p.description {
147
- margin-left: 0;
148
- }
149
- .gateway_settings_form p.submit,
150
- .shipping-module-settings-form p.submit {
151
- margin-top: 2em;
152
- }
153
-
154
- .gateway_settings input[type=text]{
155
  width: 200px;
156
  }
157
- .edit-payment-module-update,
158
- .edit-shipping-module-update {
159
- float: right;
160
- }
161
-
162
  tr.rate_row td input[type=text]{
163
  width:50px;
164
  }
165
  div.wpsc_newlayer input[type=text]{
166
  width:50px;
167
  }
168
- .gateway_settings textarea{
169
  width:100%;
170
  }
171
- .gateway_settings h4{
172
- margin-bottom:5px;
173
  }
174
 
175
  div#wpsc_shipwire_setting, div#shipping_discount_value {
@@ -189,9 +141,6 @@ table#form_field_table tr td.namecol{ }
189
  table#form_field_table tr *.namecol{ width: 170px; padding-right: 8px; }
190
  table#form_field_table tr *.namecol input{ width: 160px; }
191
 
192
- tr td.namecol{ padding-left: 2em; }
193
- tr.field_type_heading td.namecol { padding-left: 0; }
194
-
195
  table#form_field_table tr *.typecol{ width: 120px; }
196
  table#form_field_table tr *.typecol select{ width: 115px; }
197
 
@@ -239,20 +188,21 @@ table#form_field_table tr th{ padding-left: 0px; padding-right: 0px; }
239
  }
240
 
241
  h3.form_group {
242
- clear: left;
243
  }
244
  h3.form_group a{
245
  color: #000;
246
  }
247
  div.product_and_button_settings {
248
- position: relative;
 
 
249
  }
250
 
251
  div#themes_and_appearance {
252
  border: 1px solid #DFDFDF;
253
  width: 360px;
254
- position: absolute;
255
- left: 45em;
256
  }
257
 
258
  div#themes_and_appearance p {
@@ -341,6 +291,10 @@ a.nav-tab-loading {
341
  margin-right:10px;
342
  }
343
 
 
 
 
 
344
  #wpsc_options .action {
345
  display:none;
346
  }
@@ -367,6 +321,41 @@ a.nav-tab-loading {
367
  opacity:0.3;
368
  }
369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  #wpsc_checkout_list .wpsc-field-options-table {
371
  border-collapse:collapse;
372
  margin-bottom:1em;
@@ -393,7 +382,7 @@ a.nav-tab-loading {
393
  }
394
 
395
  .js #wpsc_checkout_list .edit-options {
396
- display: none;
397
  }
398
 
399
  .js .form-field-options {
@@ -409,7 +398,7 @@ a.nav-tab-loading {
409
  }
410
 
411
  #wpsc_checkout_list .wpsc-field-options-table td .field-option-cell-wrapper {
412
- padding: 2px 0;
413
  }
414
 
415
  #wpsc_checkout_list .wpsc-field-options-table .column-actions {
@@ -432,12 +421,14 @@ div.wpsc_shipping_options, div.wpsc-select-gateway {
432
  }
433
  .wpsc-shipping-actions, .wpsc-gateway-actions {
434
  visibility:hidden;
 
435
  line-height: 16px;
436
  margin:0px 9em 0 0;
437
  float:right;
438
  }
439
- div.wpsc_shipping_options:hover .wpsc-shipping-actions,
440
  div.wpsc-select-gateway:hover .wpsc-gateway-actions {
 
441
  visibility:visible;
442
  }
443
  div.wpsc-select-gateway p, div.wpsc_shipping_options p {
@@ -451,15 +442,3 @@ table.form-table td .updated.shipwire-update {
451
  font-size : 12px;
452
  line-height : 1.6em;
453
  }
454
-
455
- /* tax */
456
-
457
-
458
- .wpsc-tax-bands-row, .wpsc-tax-rates-row {
459
- line-height: 3.2;
460
- }
461
-
462
- .wpsc-tax-bands-row.prototype,
463
- .wpsc-tax-rates-row.prototype {
464
- display: none;
465
- }
12
  th#drag{
13
  width:50px;
14
  }
15
+ th#name {
16
+ width:205px;
17
+ }
18
  tr.wpsc_grey{
19
  background-color: #ededed;
20
  }
22
  cursor: move;
23
  }
24
 
25
+ th.column-type{
26
+ width:150px;
 
 
 
27
  }
28
 
29
  th.column-unique_name {
30
+ width:150px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  #checkout_message{
55
  margin-left:4px;
56
  }
57
 
58
+ th.column-mandatory, th.column-display {
59
+ width: 101px;
60
  }
61
 
62
+ .widefat th.column-mandatory, td.mandatorycol, .widefat th.column-display, td.displaycol, .widefat th.column-trash, td.trashcol {
63
+ text-align:center;
64
+ }
65
+
66
+ #wpsc_checkout_list .ui-sortable-helper {
67
+ margin-left:0;
68
  }
69
 
70
  #wpsc_checkout_list .actionscol .cell-wrapper {
97
  }
98
 
99
  #options_presentation{
100
+ min-width:850px;
101
  }
102
 
103
  table.wpsc-edit-module-options tr td {
108
  padding: 0 0 8px 8px;
109
  width:394px;
110
  }
111
+ td.gateway_settings input[type=text]{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  width: 200px;
113
  }
 
 
 
 
 
114
  tr.rate_row td input[type=text]{
115
  width:50px;
116
  }
117
  div.wpsc_newlayer input[type=text]{
118
  width:50px;
119
  }
120
+ td.gateway_settings textarea{
121
  width:100%;
122
  }
123
+ td.gateway_settings h4{
124
+ margin-top:0;
125
  }
126
 
127
  div#wpsc_shipwire_setting, div#shipping_discount_value {
141
  table#form_field_table tr *.namecol{ width: 170px; padding-right: 8px; }
142
  table#form_field_table tr *.namecol input{ width: 160px; }
143
 
 
 
 
144
  table#form_field_table tr *.typecol{ width: 120px; }
145
  table#form_field_table tr *.typecol select{ width: 115px; }
146
 
188
  }
189
 
190
  h3.form_group {
191
+ clear: both;
192
  }
193
  h3.form_group a{
194
  color: #000;
195
  }
196
  div.product_and_button_settings {
197
+ width: 450px;
198
+ float: left;
199
+
200
  }
201
 
202
  div#themes_and_appearance {
203
  border: 1px solid #DFDFDF;
204
  width: 360px;
205
+ float: left;
 
206
  }
207
 
208
  div#themes_and_appearance p {
291
  margin-right:10px;
292
  }
293
 
294
+ .wpsc-shipping-module-settings-tablerate td .add, .wpsc-shipping-module-settings-weightrate td .add {
295
+ display:none;
296
+ }
297
+
298
  #wpsc_options .action {
299
  display:none;
300
  }
321
  opacity:0.3;
322
  }
323
 
324
+ .js .wpsc-shipping-module-settings-tablerate td a.add:hover,
325
+ .js .wpsc-shipping-module-settings-weightrate td a.add:hover,
326
+ .js #wpsc_checkout_list .actionscol a.add:hover,
327
+ .js .wpsc-field-options-table .column-actions a.add:hover {
328
+ background-position:-20px 0;
329
+ }
330
+
331
+ .js .wpsc-shipping-module-settings-tablerate td a.add:active,
332
+ .js .wpsc-shipping-module-settings-weightrate td a.add:active,
333
+ .js #wpsc_checkout_list .actionscol a.add:active,
334
+ .js .wpsc-field-options-table .column-actions a.add:active {
335
+ background-position:-40px 0;
336
+ }
337
+
338
+ .js .wpsc-shipping-module-settings-tablerate td a.delete:hover,
339
+ .js .wpsc-shipping-module-settings-weightrate td a.delete:hover,
340
+ .js #wpsc_checkout_list .actionscol a.delete:hover,
341
+ .js .wpsc-field-options-table .column-actions a.delete:hover {
342
+ background-position:-20px -20px;
343
+ }
344
+
345
+ .js .wpsc-shipping-module-settings-tablerate td a.delete:active,
346
+ .js .wpsc-shipping-module-settings-weightrate td a.delete:active,
347
+ .js #wpsc_checkout_list .actionscol a.delete:active,
348
+ .js .wpsc-field-options-table .column-actions a.delete:active {
349
+ background-position:-40px -20px;
350
+ }
351
+
352
+ .js .wpsc-shipping-module-settings-tablerate td .delete,
353
+ .js .wpsc-shipping-module-settings-weightrate td .delete,
354
+ .js #wpsc_checkout_list .actionscol .delete,
355
+ .js .wpsc-field-options-table .column-actions .delete {
356
+ background-position:0 -20px;
357
+ }
358
+
359
  #wpsc_checkout_list .wpsc-field-options-table {
360
  border-collapse:collapse;
361
  margin-bottom:1em;
382
  }
383
 
384
  .js #wpsc_checkout_list .edit-options {
385
+ display:none;
386
  }
387
 
388
  .js .form-field-options {
398
  }
399
 
400
  #wpsc_checkout_list .wpsc-field-options-table td .field-option-cell-wrapper {
401
+ padding:7px 0;
402
  }
403
 
404
  #wpsc_checkout_list .wpsc-field-options-table .column-actions {
421
  }
422
  .wpsc-shipping-actions, .wpsc-gateway-actions {
423
  visibility:hidden;
424
+ font-size: 10px;
425
  line-height: 16px;
426
  margin:0px 9em 0 0;
427
  float:right;
428
  }
429
+ div.wpsc_shipping_options:hover .wpsc-shipping-actions,
430
  div.wpsc-select-gateway:hover .wpsc-gateway-actions {
431
+ font-size:10px;
432
  visibility:visible;
433
  }
434
  div.wpsc-select-gateway p, div.wpsc_shipping_options p {
442
  font-size : 12px;
443
  line-height : 1.6em;
444
  }
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/ui-images/ui-icons_21759b_256x240.png DELETED
Binary file
wpsc-admin/css/ui-images/ui-icons_333333_256x240.png DELETED
Binary file
wpsc-admin/css/ui-images/ui-icons_999999_256x240.png DELETED
Binary file
wpsc-admin/css/ui-images/ui-icons_cc0000_256x240.png DELETED
Binary file
wpsc-admin/css/xit.gif DELETED
Binary file
wpsc-admin/db-upgrades/routines/1.php CHANGED
@@ -21,13 +21,14 @@ function _wpsc_fix_checkout_field_limitation() {
21
  }
22
 
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
  }
32
 
33
  function _wpsc_fix_canadian_province_codes() {
@@ -71,62 +72,65 @@ function _wpsc_fix_canadian_province_codes() {
71
  }
72
 
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() {
@@ -139,4 +143,5 @@ function _wpsc_create_south_sudan() {
139
  'continent' => 'africa',
140
  'visible' => 0,
141
  ) );
 
142
  }
21
  }
22
 
23
  function _wpsc_fix_mexico_currency_sign() {
24
+ $country = new WPSC_Country( 'MX', 'isocode' );
25
+ $country->set( array(
26
  'currency' => __( 'Mexican Peso', 'wpsc' ),
27
  'symbol' => __( '$', 'wpsc' ),
28
  'symbol_html' => __( '&#036;', 'wpsc' ),
29
  'has_regions' => '1'
30
  ) );
31
+ $country->save();
32
  }
33
 
34
  function _wpsc_fix_canadian_province_codes() {
72
  }
73
 
74
  function _wpsc_fix_colombia_currency() {
75
+ $country = new WPSC_Country( 'CO', 'isocode' );
76
+ $country->set( array(
77
  'symbol' => __( '$', 'wpsc' ),
78
  'symbol_html' => __( '&#036;', 'wpsc' ),
79
  ) );
80
+ $country->save();
81
  }
82
 
83
  function _wpsc_fix_ukraine_currency() {
84
+ $country = new WPSC_Country( 'UA', 'isocode' );
85
+ $country->set( array(
86
  'code' => __( 'UAH', 'wpsc' ),
87
  'symbol' => __( '₴', 'wpsc' ),
88
  'symbol_html' => __( '&#8372;', 'wpsc' ),
89
  ) );
90
+ $country->save();
91
  }
92
 
93
  function _wpsc_fix_russia_currency() {
94
+ $country = new WPSC_Country( 'RU', 'isocode' );
95
+ $country->set( 'code', __( 'RUB', 'wpsc' ) );
96
+ $country->save();
 
97
  }
98
 
99
  function _wpsc_fix_belarus_currency() {
100
+ $country = new WPSC_Country( 'BY', 'isocode' );
101
+ $country->set( 'code', __( 'BYR', 'wpsc' ) );
102
+ $country->save();
 
103
  }
104
 
105
  function _wpsc_fix_estonia_currency() {
106
+ $country = new WPSC_Country( 'EE', 'isocode' );
107
+ $country->set( array(
108
  'currency' => __( 'Euro', 'wpsc' ),
109
  'symbol' => __( '€', 'wpsc' ),
110
  'symbol_html' => __( '&#8364;', 'wpsc' ),
111
  'code' => __( 'EUR', 'wpsc' )
112
  ) );
113
+ $country->save();
114
  }
115
 
116
  function _wpsc_fix_slovenia_currency() {
117
+ $country = new WPSC_Country( 'SI', 'isocode' );
118
+ $country->set( array(
119
  'currency' => __( 'Euro', 'wpsc' ),
120
  'symbol' => __( '€', 'wpsc' ),
121
  'symbol_html' => __( '&#8364;', 'wpsc' ),
122
  'code' => __( 'EUR', 'wpsc' )
123
  ) );
124
+ $country->save();
125
  }
126
 
127
  function _wpsc_fix_sudan_currency() {
128
+ $country = new WPSC_Country( 'SD', 'isocode' );
129
+ $country->set( array(
130
  'currency' => __( 'Sudanese Pound', 'wpsc' ),
131
  'code' => __( 'SDG', 'wpsc' )
132
  ) );
133
+ $country->save();
134
  }
135
 
136
  function _wpsc_create_south_sudan() {
143
  'continent' => 'africa',
144
  'visible' => 0,
145
  ) );
146
+ $country->save();
147
  }
wpsc-admin/db-upgrades/routines/10.php DELETED
@@ -1,134 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Control database upgrade to version 10
5
- *
6
- * @access private
7
- * @since 3.8.14
8
- *
9
- */
10
- function _wpsc_db_upgrade_10() {
11
- _wpsc_add_region_name_meta();
12
- _wpsc_maybe_create_visitor_tables();
13
- _wpsc_cleanup_visitor_meta_checkout_details();
14
- }
15
-
16
- /**
17
- * 3.8.14 supports country meta and a feature that let's a countries regions be called by the
18
- * proper name. Here we initialize the values.
19
- *
20
- * @access private
21
- * @since 3.8.14
22
- *
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
- /**
33
- * 3.8.14 maintains visitor information in a visitors table, create it
34
- *
35
- * @access private
36
- * @since 3.8.14
37
- *
38
- */
39
- function _wpsc_maybe_create_visitor_tables() {
40
- _wpsc_create_visitor_table();
41
- _wpsc_create_visitor_meta_table();
42
- _wpsc_meta_migrate_anonymous_users();
43
- }
44
-
45
- /**
46
- * starting in 3.8.14 visitors information belongs in the vistor table, not the users table, start
47
- * the migration. This migration could take a very long time so it's done as a cron
48
- *
49
- * @access private
50
- * @since 3.8.14
51
- *
52
- */
53
- function _wpsc_meta_migrate_anonymous_users() {
54
- global $wpdb;
55
-
56
- // get the users table auto increment value, and set the visitor meta auto increment to match.
57
- // we do this so that new customer cookies don't collide with existing customer cookies after
58
- // the migration. Note we can't use max of user id because users may have been deleted.
59
- $sql = 'SHOW TABLE STATUS WHERE NAME = "' . $wpdb->users . '"';
60
- $status = $wpdb->get_results( $sql );
61
-
62
- $wpdb->query( 'ALTER TABLE ' . $wpdb->wpsc_visitors . ' AUTO_INCREMENT = ' . $status[0]->Auto_increment );
63
-
64
- wp_suspend_cache_addition( true );
65
-
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' );
73
-
74
- }
75
-
76
-
77
- /**
78
- * Create the table for visitors
79
- *
80
- * @since 3.8.14
81
- * @access private
82
- *
83
- */
84
- function _wpsc_create_visitor_table() {
85
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
86
- global $wpdb;
87
- global $charset_collate;
88
-
89
- $sql = 'CREATE TABLE IF NOT EXISTS '. $wpdb->wpsc_visitors .' ('
90
- .'id bigint(20) unsigned NOT NULL AUTO_INCREMENT, '
91
- .'user_id bigint(20) unsigned DEFAULT NULL , '
92
- .'last_active timestamp NULL DEFAULT NULL, '
93
- .'expires timestamp NULL DEFAULT NULL, '
94
- .'created timestamp NULL DEFAULT NULL, '
95
- .'PRIMARY KEY ( `id` ), '
96
- .'KEY user_id ( `user_id` ), '
97
- .'KEY expires ( `expires` ), '
98
- .'KEY last_active ( `last_active` ), '
99
- .'KEY created ( `created` ) '
100
- .') '. $charset_collate;
101
-
102
- dbDelta( $sql );
103
-
104
- _wpsc_create_well_known_visitors();
105
- }
106
-
107
- /**
108
- * Create the meta table for visitor meta
109
- *
110
- * @since 3.8.14
111
- * @access private
112
- *
113
- */
114
- function _wpsc_create_visitor_meta_table() {
115
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
116
- global $wpdb;
117
- global $charset_collate;
118
-
119
- $sql = 'CREATE TABLE IF NOT EXISTS '. $wpdb->wpsc_visitormeta .' ('
120
- .'meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, '
121
- .'wpsc_visitor_id bigint(20) unsigned NOT NULL DEFAULT 0 , '
122
- .'meta_key varchar(255) DEFAULT NULL, '
123
- .'meta_value longtext, '
124
- .'meta_timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, '
125
- .'PRIMARY KEY (meta_id), '
126
- .'KEY wpsc_visitor_id (wpsc_visitor_id), '
127
- .'KEY meta_key (meta_key(191)), '
128
- .'KEY meta_value (meta_value(20)), '
129
- .'KEY meta_key_and_value (meta_key(191),meta_value(32)), '
130
- .'KEY meta_timestamp_index ( `meta_timestamp` ) '
131
- .') '. $charset_collate;
132
-
133
- dbDelta( $sql );
134
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/11.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 11
4
- *
5
- * @access private
6
- * @since 3.8.14
7
- *
8
- */
9
- function _wpsc_db_upgrade_11() {
10
- _wpsc_fix_united_kingdom();
11
- _wpsc_set_legacy_country_meta();
12
- }
13
-
14
- /**
15
- * Reset United Kingdom country data to default, hide ISO code 'UK'
16
- *
17
- * @access private
18
- * @since 3.8.14
19
- */
20
- function _wpsc_fix_united_kingdom() {
21
-
22
- $legacy_ok_country_was_visible = true;
23
-
24
- if ( $wpsc_country = WPSC_Countries::get_country( 'UK' ) ) {
25
-
26
- $legacy_ok_country_was_visible = $wpsc_country->is_visible();
27
-
28
- $wpsc_country = new WPSC_Country(
29
- array(
30
- 'visible' => '0',
31
- 'isocode' => 'UK',
32
- )
33
- );
34
-
35
- $wpsc_country->set( '_is_country_legacy', true );
36
- }
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',
49
- 'tax' => '0',
50
- )
51
- );
52
-
53
- //make sure base country is ok after the UK/GB fix
54
- $base_country = get_option( 'base_country', '' );
55
- if ( ! empty( $base_country ) && is_numeric( $base_country ) ) {
56
- $wpsc_country = new WPSC_Country( $base_country );
57
- if ( 'UK' == $wpsc_country->get_isocode() ) {
58
- $wpsc_country = new WPSC_Country( 'GB' );
59
- update_option( 'base_country' , $wpsc_country->get_id() );
60
- }
61
- }
62
-
63
- }
64
-
65
- /**
66
- * Sets meta for countries that no longer exist in their former notation to be considered legacy.
67
- *
68
- * @access private
69
- * @since 3.8.14
70
- */
71
- function _wpsc_set_legacy_country_meta() {
72
- if ( $wpsc_country = WPSC_Countries::get_country( 'YU' ) ) {
73
- $wpsc_country->set( '_is_country_legacy', true );
74
- }
75
-
76
- if ( $wpsc_country = WPSC_Countries::get_country( 'AN' ) ) {
77
- $wpsc_country->set( '_is_country_legacy', true );
78
- }
79
-
80
- if ( $wpsc_country = WPSC_Countries::get_country( 'TP' ) ) {
81
- $wpsc_country->set( '_is_country_legacy', true );
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/12.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 12
4
- *
5
- * @access private
6
- * @since 3.8.14
7
- *
8
- */
9
- function _wpsc_db_upgrade_12() {
10
- _wpsc_fix_billing_country_meta();
11
- _wpsc_fix_shipping_country_meta();
12
- }
13
-
14
- /**
15
- * make sure the billing country meta is stored as individual values not as an array
16
- *
17
- * @access private
18
- * @since 3.8.14
19
- */
20
- function _wpsc_fix_billing_country_meta() {
21
- global $wpdb;
22
-
23
- $sql = 'SELECT * from ' . $wpdb->wpsc_visitormeta . ' WHERE meta_key = "billingcountry"';
24
- $metas = $wpdb->get_results( $sql, OBJECT );
25
-
26
- foreach ( $metas as $meta ) {
27
- $meta_value = maybe_unserialize( $meta->meta_value );
28
- if ( is_array( $meta_value ) ) {
29
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'billingregion', $meta_value[1] );
30
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'billingcountry', $meta_value[0] );
31
- }
32
- }
33
- }
34
-
35
- /**
36
- * make sure the shipping country meta is stored as individual values not as an array
37
- *
38
- * @access private
39
- * @since 3.8.14
40
- */
41
- function _wpsc_fix_shipping_country_meta() {
42
- global $wpdb;
43
-
44
- $sql = 'SELECT * from ' . $wpdb->wpsc_visitormeta . ' WHERE meta_key = "shippingcountry"';
45
- $metas = $wpdb->get_results( $sql, OBJECT );
46
-
47
- foreach ( $metas as $meta ) {
48
- $meta_value = maybe_unserialize( $meta->meta_value );
49
- if ( is_array( $meta_value ) ) {
50
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'shippingregion', $meta_value[1] );
51
- wpsc_update_visitor_meta( $meta->wpsc_visitor_id, 'shippingcountry', $meta_value[0] );
52
- }
53
- }
54
- }
55
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/13.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 13
4
- *
5
- * @access private
6
- * @since 3.8.14
7
- *
8
- */
9
- function _wpsc_db_upgrade_13() {
10
- _wpsc_add_region_label_to_uk();
11
- _wpsc_fix_bad_checkout_form_rows();
12
- }
13
-
14
- /**
15
- * Add the county region label to the uk
16
- *
17
- * @access private
18
- * @since 3.8.14.1
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() {
26
- global $wpdb;
27
-
28
- $rows = $wpdb->get_results( 'SELECT * from '. WPSC_TABLE_CHECKOUT_FORMS . ' WHERE `unique_name` = ""' );
29
-
30
- foreach ( $rows as $index => $row ) {
31
- // look for the unique name to be sure it doesn't already-exist, if it does, make it unique
32
- $new_unique_name = sanitize_title( $row->name );
33
-
34
- $count = $wpdb->get_var( 'SELECT count(*) FROM ' . WPSC_TABLE_CHECKOUT_FORMS . ' WHERE `unique_name` = "' . $new_unique_name .'"' );
35
- $count = intval( $count );
36
- if ( $count ) {
37
- $new_unique_name = sanitize_title( $row->name ) . '-' . ( $count + 1 );
38
- }
39
-
40
- $result = $wpdb->query(
41
- 'UPDATE ' . WPSC_TABLE_CHECKOUT_FORMS
42
- . ' SET `unique_name` = "' . $new_unique_name
43
- . '" WHERE id=' . $row->id
44
- );
45
- }
46
-
47
-
48
- $index = $wpdb->get_results( 'SHOW INDEX FROM `' . WPSC_TABLE_CHECKOUT_FORMS . '` WHERE KEY_NAME = "unique_name"' );
49
-
50
- if ( ! count( $index ) ) {
51
- // Add the new index
52
- $wpdb->query( 'ALTER TABLE `' . WPSC_TABLE_CHECKOUT_FORMS . '` ADD INDEX ( `unique_name` )' );
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/14.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Control database upgrade to version 14
4
- *
5
- * @access private
6
- * @since 3.9.0
7
- *
8
- */
9
- function _wpsc_db_upgrade_14() {
10
- _wpsc_fix_latvia_currency();
11
- }
12
-
13
- /**
14
- * Change Latvian currency to Euro.
15
- *
16
- * @access private
17
- * @since 3.9.0
18
- */
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/2.php CHANGED
@@ -44,16 +44,15 @@ function _wpsc_db_upgrade_2() {
44
  }
45
 
46
  function _wpsc_fix_UK_country_code() {
47
- $country = new WPSC_Country( array(
48
- 'isocode' => 'GB',
49
- 'country', __( 'United Kingdom', 'wpsc' )
50
- ) );
51
  }
52
 
53
  function _wpsc_fix_guernsey_country_code() {
54
- $existing_wpsc_country = new WPSC_Country( 'GF' );
55
- // replace the ISO country code in the existing country
56
- $updated_wpsc_country = new WPSC_Country( array( 'id' => $existing_wpsc_country->get_id(), 'isocode' => 'GG', ) );
57
  }
58
 
59
  function _wpsc_new_country_serbia() {
@@ -66,6 +65,7 @@ function _wpsc_new_country_serbia() {
66
  'continent' => 'europe',
67
  'visible' => '0',
68
  ) );
 
69
  }
70
 
71
  function _wpsc_new_country_montenegro() {
@@ -80,6 +80,7 @@ function _wpsc_new_country_montenegro() {
80
  'continent' => 'europe',
81
  'visible' => '0',
82
  ) );
 
83
  }
84
 
85
  function _wpsc_fix_timor_leste_name() {
@@ -94,6 +95,7 @@ function _wpsc_fix_timor_leste_name() {
94
  'continent' => 'asiapacific',
95
  'visible' => '0',
96
  ) );
 
97
  }
98
 
99
  function _wpsc_new_country_aland_islands() {
@@ -108,6 +110,7 @@ function _wpsc_new_country_aland_islands() {
108
  'continent' => 'europe',
109
  'visible' => '0',
110
  ) );
 
111
  }
112
 
113
  function _wpsc_new_country_saint_barthelemy() {
@@ -122,6 +125,7 @@ function _wpsc_new_country_saint_barthelemy() {
122
  'continent' => 'europe',
123
  'visible' => '0',
124
  ) );
 
125
  }
126
 
127
  function _wpsc_new_country_bonaire_et_al() {
@@ -136,6 +140,7 @@ function _wpsc_new_country_bonaire_et_al() {
136
  'continent' => 'southamerica',
137
  'visible' => '0',
138
  ) );
 
139
  }
140
 
141
  function _wpsc_new_country_curacao() {
@@ -150,6 +155,7 @@ function _wpsc_new_country_curacao() {
150
  'continent' => 'southamerica',
151
  'visible' => '0',
152
  ) );
 
153
  }
154
 
155
  function _wpsc_new_country_saint_martin_french() {
@@ -164,6 +170,7 @@ function _wpsc_new_country_saint_martin_french() {
164
  'continent' => 'southamerica',
165
  'visible' => '0',
166
  ) );
 
167
  }
168
 
169
  function _wpsc_new_country_palestinian_territories() {
@@ -178,14 +185,16 @@ function _wpsc_new_country_palestinian_territories() {
178
  'continent' => 'asiapacific',
179
  'visible' => '0',
180
  ) );
 
181
  }
182
 
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() {
@@ -200,6 +209,7 @@ function _wpsc_new_country_sint_maarten_dutch() {
200
  'continent' => 'southamerica',
201
  'visible' => '0',
202
  ) );
 
203
  }
204
 
205
  function _wpsc_new_country_french_guiana() {
@@ -214,217 +224,226 @@ function _wpsc_new_country_french_guiana() {
214
  'continent' => 'southamerica',
215
  'visible' => '0',
216
  ) );
 
217
  }
218
 
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
  }
227
 
228
  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
  }
283
 
284
  function _wpsc_fix_ghanaian_currency_code() {
285
- $country = new WPSC_Country( array(
286
- 'isocode' => 'GH',
287
  'code' => 'GHS',
288
  ) );
 
289
  }
290
 
291
  function _wpsc_fix_guatemala_currency() {
292
- $country = new WPSC_Country( array(
293
- 'isocode' => 'GT',
294
  'code' => 'GTQ',
295
  ) );
 
296
  }
297
 
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
  }
44
  }
45
 
46
  function _wpsc_fix_UK_country_code() {
47
+ $country = new WPSC_Country( 'GB', 'isocode' );
48
+ $country->set( 'country', __( 'United Kingdom', 'wpsc' ) );
49
+ $country->save();
 
50
  }
51
 
52
  function _wpsc_fix_guernsey_country_code() {
53
+ $country = new WPSC_Country( 'GF', 'isocode' );
54
+ $country->set( 'isocode', 'GG' );
55
+ $country->save();
56
  }
57
 
58
  function _wpsc_new_country_serbia() {
65
  'continent' => 'europe',
66
  'visible' => '0',
67
  ) );
68
+ $country->save();
69
  }
70
 
71
  function _wpsc_new_country_montenegro() {
80
  'continent' => 'europe',
81
  'visible' => '0',
82
  ) );
83
+ $country->save();
84
  }
85
 
86
  function _wpsc_fix_timor_leste_name() {
95
  'continent' => 'asiapacific',
96
  'visible' => '0',
97
  ) );
98
+ $country->save();
99
  }
100
 
101
  function _wpsc_new_country_aland_islands() {
110
  'continent' => 'europe',
111
  'visible' => '0',
112
  ) );
113
+ $country->save();
114
  }
115
 
116
  function _wpsc_new_country_saint_barthelemy() {
125
  'continent' => 'europe',
126
  'visible' => '0',
127
  ) );
128
+ $country->save();
129
  }
130
 
131
  function _wpsc_new_country_bonaire_et_al() {
140
  'continent' => 'southamerica',
141
  'visible' => '0',
142
  ) );
143
+ $country->save();
144
  }
145
 
146
  function _wpsc_new_country_curacao() {
155
  'continent' => 'southamerica',
156
  'visible' => '0',
157
  ) );
158
+ $country->save();
159
  }
160
 
161
  function _wpsc_new_country_saint_martin_french() {
170
  'continent' => 'southamerica',
171
  'visible' => '0',
172
  ) );
173
+ $country->save();
174
  }
175
 
176
  function _wpsc_new_country_palestinian_territories() {
185
  'continent' => 'asiapacific',
186
  'visible' => '0',
187
  ) );
188
+ $country->save();
189
  }
190
 
191
  function _wpsc_update_israeli_new_shekel_symbol() {
192
+ $country = new WPSC_Country( 'IL', 'isocode' );
193
+ $country->set( array(
194
  'symbol' => __( '₪', 'wpsc' ),
195
  'symbol_html' => __( '&#8362;', 'wpsc' ),
196
  ) );
197
+ $country->save();
198
  }
199
 
200
  function _wpsc_new_country_sint_maarten_dutch() {
209
  'continent' => 'southamerica',
210
  'visible' => '0',
211
  ) );
212
+ $country->save();
213
  }
214
 
215
  function _wpsc_new_country_french_guiana() {
224
  'continent' => 'southamerica',
225
  'visible' => '0',
226
  ) );
227
+ $country->save();
228
  }
229
 
230
  function _wpsc_fix_netherlands_antille() {
231
+ $country = new WPSC_Country( 'AN', 'isocode' );
232
+ $country->set( array(
233
  'symbol' => __( 'ƒ', 'wpsc' ),
234
  'symbol_html' => __( '&#402;', 'wpsc' ),
235
  'continent' => 'southamerica',
236
  ) );
237
+ $country->save();
238
  }
239
 
240
  function _wpsc_fix_angola_kwanza() {
241
+ $country = new WPSC_Country( 'AO', 'isocode' );
242
+ $country->set( array(
243
  'code' => 'AOA',
244
  'currency' => __( 'Angolan Kwanza', 'wpsc' ),
245
  'symbol' => __( 'Kz', 'wpsc' ),
246
  'symbol_html' => __( 'Kz', 'wpsc' ),
247
  ) );
248
+ $country->save();
249
  }
250
 
251
  function _wpsc_fix_aruban_florin() {
252
+ $country = new WPSC_Country( 'AW', 'isocode' );
253
+ $country->set( array(
254
  'currency' => __( 'Aruban Florin', 'wpsc' ),
255
  'symbol' => __( 'Afl.', 'wpsc' ),
256
  'symbol_html' => __( 'Afl.', 'wpsc' ),
257
  ) );
258
+ $country->save();
259
  }
260
 
261
  function _wpsc_fix_azerbaijani_manat() {
262
+ $country = new WPSC_Country( 'AZ', 'isocode' );
263
+ $country->set( array(
264
  'currency' => __('Azerbaijani Manat', 'wpsc'),
265
  'code' => 'AZN',
266
  'symbol' => _x( 'm', 'azerbaijani manat symbol', 'wpsc' ),
267
  'symbol_html' => _x( 'm', 'azerbaijani manat symbol html', 'wpsc' ),
268
  ) );
269
+ $country->save();
270
  }
271
 
272
  function _wpsc_fix_cyprus_currency() {
273
+ $country = new WPSC_Country( 'CY', 'isocode' );
274
+ $country->set( array(
275
  'currency' => __( 'Euro', 'wpsc' ),
276
  'symbol' => __( '€', 'wpsc' ),
277
  'symbol_html' => __( '&#8364;', 'wpsc' ),
278
  'code' => __( 'EUR', 'wpsc' ),
279
  ) );
280
+ $country->save();
281
  }
282
 
283
  function _wpsc_fix_republic_of_the_congo() {
284
+ $country = new WPSC_Country( 'CG', 'isocode' );
285
+ $country->set( array(
286
  'country' => __( 'Republic of the Congo', 'wpsc' ),
287
  ) );
288
+ $country->save();
289
  }
290
 
291
  function _wpsc_fix_currency_el_salvador() {
292
+ $country = new WPSC_Country( 'SV', 'isocode' );
293
+ $country->set( array(
294
  'currency' => __( 'US Dollar', 'wpsc' ),
295
  'symbol' => __( '$', 'wpsc' ),
296
  'symbol_html' => __( '&#036', 'wpsc' ),
297
  'code' => 'USD',
298
  ) );
299
+ $country->save();
300
  }
301
 
302
  function _wpsc_fix_ghanaian_currency_code() {
303
+ $country = new WPSC_Country( 'GH', 'isocode' );
304
+ $country->set( array(
305
  'code' => 'GHS',
306
  ) );
307
+ $country->save();
308
  }
309
 
310
  function _wpsc_fix_guatemala_currency() {
311
+ $country = new WPSC_Country( 'GT', 'isocode' );
312
+ $country->set( array(
313
  'code' => 'GTQ',
314
  ) );
315
+ $country->save();
316
  }
317
 
318
  function _wpsc_fix_guinea_bissau_currency() {
319
+ $country = new WPSC_Country( 'GW', 'isocode' );
320
+ $country->set( array(
321
  'currency' => __( 'CFA Franc BEAC', 'wpsc' ),
322
  'code' => __('XAF', 'wpsc'),
323
  ) );
324
+ $country->save();
325
  }
326
 
327
  function _wpsc_fix_madagascar_currency() {
328
+ $country = new WPSC_Country( 'MG', 'isocode' );
329
+ $country->set( array(
330
  'currency' => __( 'Malagasy Ariary', 'wpsc' ),
331
  'code' => __( 'MGA', 'wpsc' ),
332
  ) );
333
+ $country->save();
334
  }
335
 
336
  function _wpsc_fix_malta_currency() {
337
+ $country = new WPSC_Country( 'MT', 'isocode' );
338
+ $country->set( array(
339
  'currency' => __( 'Euro', 'wpsc' ),
340
  'symbol' => __( '€', 'wpsc' ),
341
  'symbol_html' => __( '&#8364;', 'wpsc' ),
342
  'code' => __( 'EUR', 'wpsc' ),
343
  ) );
344
+ $country->save();
345
  }
346
 
347
  function _wpsc_fix_mozambique_currency() {
348
+ $country = new WPSC_Country( 'MZ', 'isocode' );
349
+ $country->set( 'code', __( 'MZN', 'wpsc' ) );
350
+ $country->save();
 
351
  }
352
 
353
  function _wpsc_fix_nicaragua_currency() {
354
+ $country = new WPSC_Country( 'NI', 'isocode' );
355
+ $country->set( 'code', __( 'NIO', 'wpsc' ) );
356
+ $country->save();
 
357
  }
358
 
359
  function _wpsc_fix_romania_currency() {
360
+ $country = new WPSC_Country( 'RO', 'isocode' );
361
+ $country->set( 'currency', __( 'Romanian New Leu', 'wpsc' ) );
362
+ $country->save();
 
363
  }
364
 
365
  function _wpsc_fix_san_marino_currency() {
366
+ $country = new WPSC_Country( 'SM', 'isocode' );
367
+ $country->set( array(
368
  'currency' => __( 'Euro', 'wpsc' ),
369
  'symbol' => __( '€', 'wpsc' ),
370
  'symbol_html' => __( '&#8364;', 'wpsc' ),
371
  'code' => __( 'EUR', 'wpsc' ),
372
  ) );
373
+ $country->save();
374
  }
375
 
376
  function _wpsc_fix_somalia_currency() {
377
+ $country = new WPSC_Country( 'SO', 'isocode' );
378
+ $country->set( 'code', __( 'SOS', 'wpsc' ) );
379
+ $country->save();
 
380
  }
381
 
382
  function _wpsc_fix_suriname_currency() {
383
+ $country = new WPSC_Country( 'SR', 'isocode' );
384
+ $country->set( array(
385
  'currency' => __( 'Surinamese Dollar', 'wpsc' ),
386
  'code' => __( 'SRD', 'wpsc' ),
387
  ) );
388
+ $country->save();
389
  }
390
 
391
  function _wpsc_fix_taiwan_currency() {
392
+ $country = new WPSC_Country( 'TW', 'isocode' );
393
+ $country->set( 'currency', __( 'New Taiwanese Dollar', 'wpsc' ) );
394
+ $country->save();
 
395
  }
396
 
397
  function _wpsc_fix_tajikistan_currency() {
398
+ $country = new WPSC_Country( 'TJ', 'isocode' );
399
+ $country->set( array(
400
  'currency' => __( 'Tajikistan Somoni', 'wpsc' ),
401
  'code' => __( 'TJS', 'wpsc' ),
402
  ) );
403
+ $country->save();
404
  }
405
 
406
  function _wpsc_fix_tunisia_currency() {
407
+ $country = new WPSC_Country( 'TN', 'isocode' );
408
+ $country->set( 'currency', __( 'Tunisian Dollar', 'wpsc' ) );
409
+ $country->save();
 
410
  }
411
 
412
  function _wpsc_fix_turkey_currency() {
413
+ $country = new WPSC_Country( 'TR', 'isocode' );
414
+ $country->set( 'code', __( 'TRY', 'wpsc' ) );
415
+ $country->save();
 
416
  }
417
 
418
  function _wpsc_fix_uganda_currency() {
419
+ $country = new WPSC_Country( 'UG', 'isocode' );
420
+ $country->set( 'code', __( 'UGX', 'wpsc' ) );
421
+ $country->save();
 
422
  }
423
 
424
  function _wpsc_fix_uruguay_currency() {
425
+ $country = new WPSC_Country( 'UY', 'isocode' );
426
+ $country->set( 'code', __( 'UYU', 'wpsc' ) );
427
+ $country->save();
 
428
  }
429
 
430
  function _wpsc_fix_venezuela_currency() {
431
+ $country = new WPSC_Country( 'VE', 'isocode' );
432
+ $country->set( array(
433
  'currency' => __( 'Venezuelan Bolivar Fuerte', 'wpsc' ),
434
  'code' => __( 'VEF', 'wpsc' ),
435
  ) );
436
+ $country->save();
437
  }
438
 
439
  function _wpsc_fix_zimbabwe_currency() {
440
+ $country = new WPSC_Country( 'ZW', 'isocode' );
441
+ $country->set( array(
442
  'currency' => __( 'US Dollar', 'wpsc' ),
443
  'symbol' => __( '$', 'wpsc' ),
444
  'symbol_html' => __( '&#036', 'wpsc' ),
445
  'code' => 'USD',
446
  'continent' => 'asiapacific',
447
  ) );
448
+ $country->save();
449
  }
wpsc-admin/db-upgrades/routines/3.php CHANGED
@@ -5,14 +5,18 @@ function _wpsc_db_upgrade_3() {
5
  }
6
 
7
  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
  }
5
  }
6
 
7
  function _wpsc_maybe_create_UK() {
8
+ $country = new WPSC_Country( 'GB', 'isocode' );
9
+ if ( ! $country->exists() ) {
10
+ $country->set( array(
11
+ 'id' => 138,
12
+ 'country' => __( 'United Kingdom', 'wpsc' ),
13
+ 'currency' => __( 'Pound Sterling', 'wpsc' ),
14
+ 'symbol' => __( '£', 'wpsc' ),
15
+ 'symbol_html' => __( '&#163;', 'wpsc' ),
16
+ 'code' => __( 'GBP', 'wpsc' ),
17
+ 'continent' => 'europe',
18
+ ) );
19
+
20
+ $country->save();
21
+ }
22
  }
wpsc-admin/db-upgrades/routines/4.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_4() {
4
- _wpsc_maybe_update_submitted_form_data_value();
5
- _wpsc_maybe_update_user_log_file();
6
- }
7
-
8
- function _wpsc_maybe_update_submitted_form_data_value() {
9
- global $wpdb;
10
- $wpdb->query( 'ALTER TABLE ' . WPSC_TABLE_SUBMITTED_FORM_DATA . ' MODIFY value LONGTEXT;' );
11
- }
12
-
13
- function _wpsc_maybe_update_user_log_file() {
14
- $hashes = array(
15
- '3.8' => '1526bcf18869f9ea2f4061f528a1a21a',
16
- '3.8.4' => '1d17c7fb086e2afcf942ca497629b4c9',
17
- '3.8.8' => 'f9549ba1b1956c78f96b1551ab965c13',
18
- '3.8.9' => '4d0bcba88d211147399e79661cf3b41d',
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 ) ) {
37
- //We now know that they've moved the file, but haven't actually changed anything. We can safely overwrite the file with the new core file.
38
- @ copy( $file, path_join( get_stylesheet_directory(), 'wpsc-user-log.php' ) );
39
- } else {
40
- //This means they have indeed changed the file. We need to add a notice letting them know about the issue and how to fix it.
41
- update_option( '_wpsc_3811_user_log_notice', '1' );
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/5.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_5() {
4
- _wpsc_maybe_update_product_meta_array_keys();
5
- }
6
-
7
- /**
8
- * Rename old _wpsc_* product metadata array keys so they no longer include the '_wpsc_' prefix
9
- * See https://github.com/wp-e-commerce/WP-e-Commerce/issues/492 for details
10
- */
11
- function _wpsc_maybe_update_product_meta_array_keys() {
12
- global $wpdb;
13
-
14
- $product_ids = $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_wpsc_product_metadata' AND meta_value LIKE '%_wpsc_%'" );
15
-
16
- foreach ( $product_ids as $product_id ) {
17
- $metadata_needs_saving = false;
18
- $product_metadata = get_post_meta( $product_id, '_wpsc_product_metadata', true );
19
- if ( is_array( $product_metadata ) ) {
20
- foreach ( $product_metadata as $meta_key => $meta_value ) {
21
- if ( '_wpsc_' === substr( $meta_key, 0, 6 ) ) {
22
- /*
23
- Typical meta keys that need renaming are:
24
- wpsc_url_name
25
- _wpsc_sku
26
- _wpsc_dimensions
27
- _wpsc_engraved
28
- _wpsc_can_have_uploaded_image
29
- _wpsc_unpublish_oos
30
- */
31
- $new_meta_key = substr( $meta_key, 6 );
32
-
33
- // remove the old (_wpsc_ prefixed) metadata from the array
34
- unset ( $product_metadata[ $meta_key ] );
35
- $metadata_needs_saving = true;
36
-
37
- // If metadata doesn't already exist with the new non-prefixed key, add it to the array
38
- // This check ensures that we don't overwrite newer product metadata
39
- if ( ! isset( $product_metadata[ $new_meta_key ] ) ) {
40
- $product_metadata[ $new_meta_key ] = $meta_value;
41
- }
42
- }
43
- }
44
- }
45
- if ( $metadata_needs_saving ) {
46
- update_post_meta( $product_id, '_wpsc_product_metadata', $product_metadata );
47
- }
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/6.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-init.php' );
3
-
4
- function _wpsc_db_upgrade_6() {
5
- _wpsc_maybe_create_meta_tables();
6
- }
7
-
8
- function _wpsc_maybe_create_meta_tables() {
9
-
10
- _wpsc_create_cart_item_meta_table();
11
- _wpsc_meta_migrate_wpsc_cart_item();
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/7.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_7() {
4
- _wpsc_migrate_user_meta();
5
- }
6
-
7
- function _wpsc_migrate_user_meta() {
8
- global $wpdb;
9
-
10
- $sql = "
11
- SELECT *
12
- FROM {$wpdb->usermeta}
13
- WHERE
14
- meta_key LIKE '_wpsc_%customer_profile';
15
- ";
16
-
17
- $results = $wpdb->get_results( $sql );
18
-
19
- foreach ( $results as $row ) {
20
- preg_match( '/_wpsc_(.*)customer_profile/', $row->meta_key, $matches );
21
- $blog_prefix = $matches[1];
22
-
23
- $profile = maybe_unserialize( $row->meta_value );
24
-
25
- foreach ( $profile as $key => $value ) {
26
- $internal_key = "{$blog_prefix}_wpsc_{$key}";
27
- $current_value = get_user_meta( $row->user_id, $internal_key, true );
28
-
29
- if ( $current_value === '' && $value ) {
30
- update_user_meta( $row->user_id, $internal_key, $value );
31
- }
32
- }
33
-
34
- delete_user_meta( $row->user_id, $row->meta_key );
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/8.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_8() {
4
- _wpsc_fix_bulgaria_currency();
5
- }
6
-
7
- function _wpsc_fix_bulgaria_currency() {
8
- $country = new WPSC_Country( array(
9
- 'isocode' => 'BG',
10
- 'code' => __( 'BGN', 'wpsc' ),
11
- ) );
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/9.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-init.php' );
4
-
5
- function _wpsc_db_upgrade_9() {
6
- _wpsc_maybe_create_purchase_meta_tables();
7
- }
8
-
9
- function _wpsc_maybe_create_purchase_meta_tables() {
10
-
11
- _wpsc_create_purchase_meta_table();
12
- _wpsc_meta_migrate_wpsc_purchase();
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/upgrade.php CHANGED
@@ -14,12 +14,12 @@
14
  * @since 3.8.9
15
  */
16
  function _wpsc_maybe_upgrade() {
17
- $current_db_ver = (int) get_option( 'wpsc_db_version', 0 );
18
 
19
  if ( ! _wpsc_needs_upgrade() )
20
  return;
21
 
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 ) )
@@ -28,24 +28,18 @@ function _wpsc_maybe_upgrade() {
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',
47
  'http://vaultpress.com/',
48
- 'http://ithemes.com/member/go.php?r=45982&i=l44'
49
  );
50
  ?>
51
  <div id="wpsc-upgrade-warning" class="updated">
@@ -55,7 +49,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 +59,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">
@@ -75,13 +69,12 @@ function _wpsc_upgrade_display_successful() {
75
  }
76
 
77
  function _wpsc_action_admin_notices_db_upgrade() {
78
- if ( ! empty( $_GET['wpsc_db_upgrade_successful'] ) ) {
79
  _wpsc_upgrade_display_successful();
80
- } elseif ( _wpsc_is_db_upgrade_page() ) {
81
  _wpsc_upgrade_display_backup_warning();
82
- } elseif ( _wpsc_needs_upgrade() ) {
83
  _wpsc_upgrade_display_prompt();
84
- }
85
  }
86
  add_action( 'admin_notices', '_wpsc_action_admin_notices_db_upgrade' );
87
 
@@ -150,6 +143,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
- }
14
  * @since 3.8.9
15
  */
16
  function _wpsc_maybe_upgrade() {
17
+ $current_db_ver = get_option( 'wpsc_db_version', 0 );
18
 
19
  if ( ! _wpsc_needs_upgrade() )
20
  return;
21
 
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 ) )
28
  if ( ! function_exists( '_wpsc_db_upgrade_' . $i ) )
29
  continue;
30
 
 
 
31
  call_user_func( '_wpsc_db_upgrade_' . $i );
32
  update_option( 'wpsc_db_version', $i );
 
33
  }
 
 
 
34
  }
35
 
36
  function _wpsc_upgrade_display_backup_warning() {
37
+ $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">Backup Buddy</a> to regularly backup your WordPress installation.', 'wpsc' );
38
  $message = sprintf(
39
  $message,
40
  'http://codex.wordpress.org/WordPress_Backups',
41
  'http://vaultpress.com/',
42
+ 'http://ithemes.com/purchase/backupbuddy/'
43
  );
44
  ?>
45
  <div id="wpsc-upgrade-warning" class="updated">
49
  }
50
 
51
  function _wpsc_upgrade_display_prompt() {
52
+ $message = __( '<strong>WP e-Commerce %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>');
53
  $message = sprintf( $message, WPSC_VERSION, admin_url( '?page=wpsc-db-upgrade' ) );
54
  ?>
55
  <div id="wpsc-upgrade-warning" class="error">
59
  }
60
 
61
  function _wpsc_upgrade_display_successful() {
62
+ $message = __( 'WP e-Commerce has been successfully updated to %s. Enjoy!', 'wpsc' );
63
  $message = sprintf( $message, WPSC_VERSION );
64
  ?>
65
  <div id="wpsc-upgrade-warning" class="updated">
69
  }
70
 
71
  function _wpsc_action_admin_notices_db_upgrade() {
72
+ if ( ! empty( $_GET['wpsc_db_upgrade_successful'] ) )
73
  _wpsc_upgrade_display_successful();
74
+ elseif ( _wpsc_is_db_upgrade_page() )
75
  _wpsc_upgrade_display_backup_warning();
76
+ elseif ( _wpsc_needs_upgrade() )
77
  _wpsc_upgrade_display_prompt();
 
78
  }
79
  add_action( 'admin_notices', '_wpsc_action_admin_notices_db_upgrade' );
80
 
143
  }
144
 
145
  function _wpsc_callback_display_db_upgrade_page() {
146
+ $update_title = sprintf( __( 'Your database needs to be upgraded before you can use WP e-Commerce %s', 'wpsc' ), WPSC_VERSION );
147
  include( 'views/main.php' );
148
+ }
wpsc-admin/db-upgrades/views/main.php CHANGED
@@ -1,6 +1,6 @@
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>
1
  <div class="wrap">
2
  <div id="icon-tools" class="icon32"><br></div>
3
+ <h2><?php esc_html_e( 'WP e-Commerce 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>
wpsc-admin/display-coupon-add.php DELETED
@@ -1,133 +0,0 @@
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>
7
-
8
- <?php do_action( 'wpsc_coupon_add_top' ); ?>
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>
123
-
124
- <?php do_action( 'wpsc_coupon_add_bottom' ); ?>
125
-
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>
133
- </div><!--end .wrap-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/display-coupon-edit.php DELETED
@@ -1,182 +0,0 @@
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();
16
- /* jQuery datepicker selector */
17
- if (typeof jQuery('.pickdate').datepicker != "undefined") {
18
- jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' });
19
- }
20
- </script>
21
- <form name='edit_coupon' method="post" action="<?php echo admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ); ?>">
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>
62
- </tr>
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(
125
- array(
126
- 'property' => '',
127
- 'logic' => '',
128
- 'value' => '',
129
- )
130
- );
131
- foreach ( $conditions as $key => $condition ) :
132
- ?>
133
- <div class='coupon-condition'>
134
- <?php
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>
182
- </div><!--end .wrap-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/display-coupons.php CHANGED
@@ -2,17 +2,9 @@
2
 
3
  function wpsc_display_coupons_page() {
4
  global $wpdb;
 
5
 
6
-
7
- /**
8
- * Update / create code that will be abstracted to its own class at some point
9
- */
10
-
11
- if ( isset( $_POST ) && is_array( $_POST ) && ! empty( $_POST ) ) {
12
-
13
- if ( isset( $_POST['add_coupon'] ) && (!isset( $_POST['is_edit_coupon'] ) || !($_POST['is_edit_coupon'] == 'true')) ) {
14
-
15
- check_admin_referer( 'wpsc_coupon', 'wpsc-coupon-add' );
16
 
17
  $coupon_code = $_POST['add_coupon_code'];
18
  $discount = (double)$_POST['add_discount'];
@@ -20,20 +12,20 @@ function wpsc_display_coupons_page() {
20
  $use_once = (int)(bool)$_POST['add_use-once'];
21
  $every_product = (int)(bool)$_POST['add_every_product'];
22
  $is_active = (int)(bool)$_POST['add_active'];
23
- $start_date = ! empty( $_POST['add_start'] ) ? date( 'Y-m-d', strtotime( $_POST['add_start'] ) ) . " 00:00:00" : null;
24
- $end_date = ! empty( $_POST['add_end'] ) ? date( 'Y-m-d', strtotime( $_POST['add_end'] ) ) . " 23:59:59" : null;
25
  $rules = $_POST['rules'];
26
- $new_rules = array();
27
 
28
  foreach ( $rules as $key => $rule ) {
29
  foreach ( $rule as $k => $r ) {
30
- $new_rules[$k][$key] = $r;
31
  }
32
  }
33
 
34
- foreach ( $new_rules as $key => $rule ) {
35
- if ( '' == $rule['value'] )
36
- unset( $new_rules[$key] );
 
37
  }
38
 
39
  $insert = $wpdb->insert(
@@ -48,110 +40,425 @@ function wpsc_display_coupons_page() {
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
 
71
- // update an existing coupon
72
  if ( isset( $_POST['is_edit_coupon'] ) && ($_POST['is_edit_coupon'] == 'true') && !(isset( $_POST['delete_condition'] )) && !(isset( $_POST['submit_condition'] )) ) {
73
 
74
- check_admin_referer( 'wpsc_coupon', 'wpsc-coupon-edit' );
75
 
76
- $rules = isset( $_POST['rules'] ) ? $_POST['rules'] : array();
77
- $new_rules = array();
 
 
78
 
79
- foreach ( $rules as $key => $rule ) {
80
- foreach ( $rule as $k => $r ) {
81
- $new_rules[$k][$key] = $r;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
  }
 
84
 
85
- foreach ( $new_rules as $key => $rule ) {
86
- if ( '' == $rule['value'] )
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
 
126
- /**
127
- * Load the selected view
128
- */
129
-
130
- if( isset( $_GET['wpsc-action'] ) && $_GET['wpsc-action'] == 'add_coupon' ) {
131
- // load the coupon add screen
132
- include( dirname( __FILE__ ) . '/display-coupon-add.php' );
133
-
134
- } elseif( isset( $_GET['wpsc-action'] ) && $_GET['wpsc-action'] == 'edit_coupon' ) {
135
- // load the coupon add screen
136
- include( dirname( __FILE__ ) . '/display-coupon-edit.php' );
137
-
138
- } else {
139
- require_once WPSC_FILE_PATH . '/wpsc-admin/includes/coupon-list-table-class.php';
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 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
-
147
- <input type="hidden" name="post_type" value="wpsc-product" />
148
- <input type="hidden" name="page" value="wpsc-edit-coupons" />
149
-
150
- <?php $coupons_table->views() ?>
151
- <?php $coupons_table->display() ?>
152
- </form>
153
- <?php do_action( 'wpsc_coupons_page_bottom' ); ?>
154
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  <?php
156
- } // end view check
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
 
 
2
 
3
  function wpsc_display_coupons_page() {
4
  global $wpdb;
5
+ if ( isset( $_POST ) && is_array( $_POST ) && !empty( $_POST ) ) {
6
 
7
+ if ( isset( $_POST['add_coupon'] ) && ($_POST['add_coupon'] == 'true') && (!isset( $_POST['is_edit_coupon'] ) || !($_POST['is_edit_coupon'] == 'true')) ) {
 
 
 
 
 
 
 
 
 
8
 
9
  $coupon_code = $_POST['add_coupon_code'];
10
  $discount = (double)$_POST['add_discount'];
12
  $use_once = (int)(bool)$_POST['add_use-once'];
13
  $every_product = (int)(bool)$_POST['add_every_product'];
14
  $is_active = (int)(bool)$_POST['add_active'];
15
+ $start_date = date( 'Y-m-d', strtotime( $_POST['add_start'] ) ) . " 00:00:00";
16
+ $end_date = date( 'Y-m-d', strtotime( $_POST['add_end'] ) ) . " 00:00:00";
17
  $rules = $_POST['rules'];
 
18
 
19
  foreach ( $rules as $key => $rule ) {
20
  foreach ( $rule as $k => $r ) {
21
+ $new_rule[$k][$key] = $r;
22
  }
23
  }
24
 
25
+ foreach ( $new_rule as $key => $rule ) {
26
+ if ( '' == $rule['value'] ) {
27
+ unset( $new_rule[$key] );
28
+ }
29
  }
30
 
31
  $insert = $wpdb->insert(
40
  'every_product' => $every_product,
41
  'start' => $start_date,
42
  'expiry' => $end_date,
43
+ 'condition' => serialize( $new_rule )
44
  ),
45
  array(
46
  '%s',
47
  '%f',
48
+ '%d',
49
  '%s',
50
  '%s',
51
  '%s',
52
  '%s',
53
  '%s',
54
  '%s',
55
+ '%s'
 
56
  )
57
  );
58
  if ( $insert )
59
+ echo "<div class='updated'><p align='center'>" . esc_html__( 'Thanks, the coupon has been added.', 'wpsc' ) . "</p></div>";
60
 
61
  }
62
 
 
63
  if ( isset( $_POST['is_edit_coupon'] ) && ($_POST['is_edit_coupon'] == 'true') && !(isset( $_POST['delete_condition'] )) && !(isset( $_POST['submit_condition'] )) ) {
64
 
65
+ foreach ( (array)$_POST['edit_coupon'] as $coupon_id => $coupon_data ) {
66
 
67
+ $coupon_id = (int)$coupon_id;
68
+ $coupon_data['start'] = get_gmt_from_date( $coupon_data['start'] . " 00:00:00" );
69
+ $coupon_data['expiry'] = get_gmt_from_date( $coupon_data['expiry'] . " 23:59:59" );
70
+ $check_values = $wpdb->get_row( $wpdb->prepare( "SELECT `id`, `coupon_code`, `value`, `is-percentage`, `use-once`, `active`, `start`, `expiry`,`every_product` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = %d", $coupon_id ), ARRAY_A );
71
 
72
+ // Sort both arrays to make sure that if they contain the same stuff,
73
+ // that they will compare to be the same, may not need to do this, but what the heck
74
+ if ( $check_values != null )
75
+ ksort( $check_values );
76
+
77
+ ksort( $coupon_data );
78
+
79
+ if ( $check_values != $coupon_data ) {
80
+
81
+ $insert_array = array();
82
+
83
+ foreach ( $coupon_data as $coupon_key => $coupon_value ) {
84
+ if ( ($coupon_key == "submit_coupon") || ($coupon_key == "delete_coupon") )
85
+ continue;
86
+
87
+ if ( isset( $check_values[$coupon_key] ) && $coupon_value != $check_values[$coupon_key] )
88
+ $insert_array[] = "`$coupon_key` = '$coupon_value'";
89
+
90
+ }
91
+
92
+ if ( isset( $check_values['every_product'] ) && $coupon_data['add_every_product'] != $check_values['every_product'] )
93
+ $insert_array[] = "`every_product` = '$coupon_data[add_every_product]'";
94
+
95
+ if ( count( $insert_array ) > 0 )
96
+ $wpdb->query( $wpdb->prepare( "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET " . implode( ", ", $insert_array ) . " WHERE `id` = %d LIMIT 1;", $coupon_id ) );
97
+
98
+ unset( $insert_array );
99
+ $rules = $_POST['rules'];
100
+
101
+ foreach ( (array)$rules as $key => $rule ) {
102
+ foreach ( $rule as $k => $r ) {
103
+ $new_rule[$k][$key] = $r;
104
+ }
105
+ }
106
+
107
+ foreach ( (array)$new_rule as $key => $rule ) {
108
+ if ( $rule['value'] == '' ) {
109
+ unset( $new_rule[$key] );
110
+ }
111
+ }
112
+
113
+ $conditions = $wpdb->get_var( $wpdb->prepare( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = %d LIMIT 1", $_POST['coupon_id'] ) );
114
+ $conditions = unserialize( $conditions );
115
+ $new_cond = array();
116
+
117
+ if ( $_POST['rules']['value'][0] != '' ) {
118
+ $new_cond['property'] = $_POST['rules']['property'][0];
119
+ $new_cond['logic'] = $_POST['rules']['logic'][0];
120
+ $new_cond['value'] = $_POST['rules']['value'][0];
121
+ $conditions [] = $new_cond;
122
+ }
123
+
124
+ $wpdb->update(
125
+ WPSC_TABLE_COUPON_CODES,
126
+ array(
127
+ 'condition' => serialize( $conditions ),
128
+
129
+ ),
130
+ array(
131
+ 'id' => $_POST['coupon_id']
132
+ ),
133
+ '%s',
134
+ '%d'
135
+ );
136
  }
137
  }
138
+ }
139
 
140
+ if ( isset( $_POST['delete_condition'] ) ) {
141
+
142
+ $conditions = $wpdb->get_var( $wpdb->prepare( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = %d LIMIT 1", $_POST['coupon_id'] ) );
143
+ $conditions = unserialize( $conditions );
144
+
145
+ unset( $conditions[(int)$_POST['delete_condition']] );
146
 
147
+ $wpdb->update(
148
  WPSC_TABLE_COUPON_CODES,
149
  array(
150
+ 'condition' => serialize( $conditions ),
151
+
 
 
 
 
 
 
 
 
152
  ),
 
153
  array(
154
+ 'id' => $_POST['coupon_id']
 
 
 
 
 
 
 
 
 
155
  ),
156
+ '%s',
157
+ '%d'
158
+ );
159
+ }
160
+
161
+ if ( isset( $_POST['submit_condition'] ) ) {
162
+ $conditions = $wpdb->get_var( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1" );
163
+ $conditions = unserialize( $conditions );
164
+
165
+ $new_cond = array();
166
+ $new_cond['property'] = $_POST['rules']['property'][0];
167
+ $new_cond['logic'] = $_POST['rules']['logic'][0];
168
+ $new_cond['value'] = $_POST['rules']['value'][0];
169
+ $conditions[] = $new_cond;
170
+
171
+ $wpdb->update(
172
+ WPSC_TABLE_COUPON_CODES,
173
+ array(
174
+ 'condition' => serialize( $conditions )
175
+ ),
176
+ array(
177
+ 'id' => $_POST['coupon_id']
178
+ ),
179
+ '%s',
180
+ '%d'
181
+ );
182
 
 
 
 
183
  }
184
  }
185
 
186
+ $currency_data = $wpdb->get_row( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . esc_attr( get_option( 'currency_type' ) ) . "' LIMIT 1", ARRAY_A );
187
+ $currency_sign = ! empty( $currency_data['symbol'] ) ? $currency_data['symbol_html'] : $currency_data['code'];
188
+
189
+ ?>
190
+
191
+ <script type='text/javascript'>
192
+ jQuery(".pickdate").datepicker();
193
+ /* jQuery datepicker selector */
194
+ if (typeof jQuery('.pickdate').datepicker != "undefined") {
195
+ jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' });
196
+ }
197
+ </script>
198
+
199
+ <div class="wrap">
200
+ <h2>
201
+ <?php esc_html_e( 'Coupons', 'wpsc' ); ?>
202
+ <a href="#" id="add_coupon_box_link" class="add_item_link button add-new-h2" onClick="return show_status_box( 'add_coupon_box', 'add_coupon_box_link' );">
203
+ <?php esc_html_e( 'Add New', 'wpsc' ); ?>
204
+ </a>
205
+ </h2>
206
+
207
+ <table style="width: 100%;">
208
+ <tr>
209
+ <td id="coupon_data">
210
+ <div id='add_coupon_box' class='modify_coupon' >
211
+ <form name='add_coupon' method='post' action=''>
212
+ <table class='add-coupon' >
213
+ <tr>
214
+ <th><?php esc_html_e( 'Coupon Code', 'wpsc' ); ?></th>
215
+ <th><?php esc_html_e( 'Discount', 'wpsc' ); ?></th>
216
+ <th><?php esc_html_e( 'Start', 'wpsc' ); ?></th>
217
+ <th><?php esc_html_e( 'Expiry', 'wpsc' ); ?></th>
218
+ </tr>
219
+ <tr>
220
+ <td>
221
+ <input type='text' value='' name='add_coupon_code' />
222
+ </td>
223
+ <td>
224
+ <input type='text' value='' size='3' name='add_discount' />
225
+ <select name='add_discount_type'>
226
+ <option value='0' ><?php echo esc_html( $currency_sign ) ?></option>
227
+ <option value='1' ><?php _ex( '%', 'Percentage sign as discount type in coupons page', 'wpsc' ); ?></option>
228
+ <option value='2' ><?php esc_html_e( 'Free shipping', 'wpsc' ); ?></option>
229
+ </select>
230
+ </td>
231
+ <td>
232
+ <input type='text' class='pickdate' size='11' value="<?php echo date('Y-m-d'); ?>" name='add_start' />
233
+ </td>
234
+ <td>
235
+ <input type='text' class='pickdate' size='11' name='add_end' value="<?php echo (date('Y')+1) . date('-m-d') ; ?>">
236
+ </td>
237
+ <td>
238
+ <input type='hidden' value='true' name='add_coupon' />
239
+ <input type='submit' value='<?php esc_attr_e( 'Add Coupon', 'wpsc' ); ?>' name='submit_coupon' class='button-primary' />
240
+ </td>
241
+ </tr>
242
+
243
+ <tr>
244
+ <td colspan='3' scope="row">
245
+ <p>
246
+ <span class='input_label'><?php esc_html_e( 'Active', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_active' />
247
+ <input type='checkbox' value='1' checked='checked' name='add_active' />
248
+ <span class='description'><?php esc_html_e( 'Activate coupon on creation.', 'wpsc' ) ?></span>
249
+ </p>
250
+ </td>
251
+ </tr>
252
+
253
+ <tr>
254
+ <td colspan='3' scope="row">
255
+ <p>
256
+ <span class='input_label'><?php esc_html_e( 'Use Once', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_use-once' />
257
+ <input type='checkbox' value='1' name='add_use-once' />
258
+ <span class='description'><?php esc_html_e( 'Deactivate coupon after it has been used.', 'wpsc' ) ?></span>
259
+ </p>
260
+ </td>
261
+ </tr>
262
+
263
+ <tr>
264
+ <td colspan='3' scope="row">
265
+ <p>
266
+ <span class='input_label'><?php esc_html_e( 'Apply On All Products', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_every_product' />
267
+ <input type="checkbox" value="1" name='add_every_product'/>
268
+ <span class='description'><?php esc_html_e( 'This coupon affects each product at checkout.', 'wpsc' ) ?></span>
269
+ </p>
270
+ </td>
271
+ </tr>
272
+
273
+ <tr><td colspan='3'><span id='table_header'><?php esc_html_e( 'Conditions', 'wpsc' ); ?></span></td></tr>
274
+ <tr>
275
+ <td colspan="8">
276
+ <div class='coupon_condition' >
277
+ <div class='first_condition'>
278
+ <select class="ruleprops" name="rules[property][]">
279
+ <option value="item_name" rel="order"><?php esc_html_e( 'Item name', 'wpsc' ); ?></option>
280
+ <option value="item_quantity" rel="order"><?php esc_html_e( 'Item quantity', 'wpsc' ); ?></option>
281
+ <option value="total_quantity" rel="order"><?php esc_html_e( 'Total quantity', 'wpsc' ); ?></option>
282
+ <option value="subtotal_amount" rel="order"><?php esc_html_e( 'Subtotal amount', 'wpsc' ); ?></option>
283
+ <?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
284
+ </select>
285
+
286
+ <select name="rules[logic][]">
287
+ <option value="equal"><?php esc_html_e( 'Is equal to', 'wpsc' ); ?></option>
288
+ <option value="greater"><?php esc_html_e( 'Is greater than', 'wpsc' ); ?></option>
289
+ <option value="less"><?php esc_html_e( 'Is less than', 'wpsc' ); ?></option>
290
+ <option value="contains"><?php esc_html_e( 'Contains', 'wpsc' ); ?></option>
291
+ <option value="not_contain"><?php esc_html_e( 'Does not contain', 'wpsc' ); ?></option>
292
+ <option value="begins"><?php esc_html_e( 'Begins with', 'wpsc' ); ?></option>
293
+ <option value="ends"><?php esc_html_e( 'Ends with', 'wpsc' ); ?></option>
294
+ <option value="category"><?php esc_html_e( 'In Category', 'wpsc' ); ?></option>
295
+ </select>
296
+
297
+ <span><input type="text" name="rules[value][]"/></span>
298
+ <script>
299
+ var coupon_number=1;
300
+ function add_another_property(this_button){
301
+ var new_property='<div class="coupon_condition">\n'+
302
+ '<div> \n'+
303
+ '<select class="ruleprops" name="rules[property][]"> \n'+
304
+ '<option value="item_name" rel="order"><?php echo esc_js( __( 'Item name', 'wpsc' ) ); ?></option> \n'+
305
+ '<option value="item_quantity" rel="order"><?php echo esc_js( __( 'Item quantity', 'wpsc' ) ); ?></option>\n'+
306
+ '<option value="total_quantity" rel="order"><?php echo esc_js( __( 'Total quantity', 'wpsc' ) ); ?></option>\n'+
307
+ '<option value="subtotal_amount" rel="order"><?php echo esc_js( __( 'Subtotal amount', 'wpsc' ) ); ?></option>\n'+
308
+ '<?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>'+
309
+ '</select> \n'+
310
+ '<select name="rules[logic][]"> \n'+
311
+ '<option value="equal"><?php echo esc_js( __( 'Is equal to', 'wpsc' ) ); ?></option> \n'+
312
+ '<option value="greater"><?php echo esc_js( __( 'Is greater than', 'wpsc' ) ); ?></option> \n'+
313
+ '<option value="less"><?php echo esc_js( __( 'Is less than', 'wpsc' ) ); ?></option> \n'+
314
+ '<option value="contains"><?php echo esc_js( __( 'Contains', 'wpsc' ) ); ?></option> \n'+
315
+ '<option value="not_contain"><?php echo esc_js( __( 'Does not contain', 'wpsc' ) ); ?></option> \n'+
316
+ '<option value="begins"><?php echo esc_js( __( 'Begins with', 'wpsc' ) ); ?></option> \n'+
317
+ '<option value="ends"><?php echo esc_js( __( 'Ends with', 'wpsc' ) ); ?></option> \n'+
318
+ '</select> \n'+
319
+ '<span> \n'+
320
+ '<input type="text" name="rules[value][]"/> \n'+
321
+ '</span> \n'+
322
+ '<img height="16" width="16" class="delete" alt="<?php esc_attr_e( 'Delete', 'wpsc' ); ?>" src="<?php echo WPSC_CORE_IMAGES_URL; ?>/cross.png" onclick="jQuery(this).parent().remove();"/></div> \n'+
323
+ '</div> ';
324
+
325
+ jQuery('#coupon_data .coupon_condition :last').after(new_property);
326
+ coupon_number++;
327
+ }
328
+ </script>
329
+ </div>
330
+ </div>
331
+ </tr>
332
+
333
+ <tr>
334
+ <td>
335
+ <a class="wpsc_coupons_condition_add" onclick="add_another_property(jQuery(this));">
336
+ <?php esc_html_e( 'Add New Condition', 'wpsc' ); ?>
337
+ </a>
338
+ </td>
339
+ </tr>
340
+ </table>
341
+ </form>
342
+ </div>
343
+ </td>
344
+ </tr>
345
+ </table>
346
+
347
  <?php
348
+ $columns = array(
349
+ 'coupon_code' => __( 'Coupon Code', 'wpsc' ),
350
+ 'discount' => __( 'Discount', 'wpsc' ),
351
+ 'start' => __( 'Start', 'wpsc' ),
352
+ 'expiry' => __( 'Expiry', 'wpsc' ),
353
+ 'active' => __( 'Active', 'wpsc' ),
354
+ 'apply_on_prods' => __( 'Apply On All Products', 'wpsc' ),
355
+ 'edit' => __( 'Edit', 'wpsc' )
356
+ );
357
+ register_column_headers( 'display-coupon-details', $columns );
358
+ ?>
359
+
360
+ <table class="coupon-list widefat" cellspacing="0">
361
+ <thead>
362
+ <tr>
363
+ <?php print_column_headers( 'display-coupon-details' ); ?>
364
+ </tr>
365
+ </thead>
366
+
367
+ <tfoot>
368
+ <tr>
369
+ <?php print_column_headers( 'display-coupon-details', false ); ?>
370
+ </tr>
371
+ </tfoot>
372
+
373
+ <tbody>
374
+ <?php
375
+ $i = 0;
376
+ $coupon_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` ", ARRAY_A );
377
+
378
+ foreach ( (array)$coupon_data as $coupon ) {
379
+ $alternate = "";
380
+ $i++;
381
+ if ( ($i % 2) != 0 ) {
382
+ $alternate = "class='alt'";
383
+ }
384
+
385
+ $start = get_date_from_gmt( $coupon['start'], 'd/m/Y' );
386
+ $expiry = get_date_from_gmt( $coupon['expiry'], 'd/m/Y' );
387
+
388
+ echo "<tr $alternate>\n\r";
389
+
390
+ echo " <td>\n\r";
391
+ echo esc_attr( $coupon['coupon_code'] );
392
+ echo " </td>\n\r";
393
+
394
+ echo " <td>\n\r";
395
+ if ( $coupon['is-percentage'] == 1 )
396
+ echo esc_attr( $coupon['value'] ) . "%";
397
+
398
+ else if ( $coupon['is-percentage'] == 2 )
399
+ _e( 'Free Shipping', 'wpsc' );
400
+
401
+ else
402
+ echo wpsc_currency_display( esc_attr( $coupon['value'] ) );
403
+
404
+ echo " </td>\n\r";
405
+
406
+ echo " <td>\n\r";
407
+ echo $start;
408
+ echo " </td>\n\r";
409
+
410
+ echo " <td>\n\r";
411
+ echo $expiry;
412
+ echo " </td>\n\r";
413
+
414
+ echo " <td>\n\r";
415
+ switch ( $coupon['active'] ) {
416
+ case 1:
417
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
418
+ break;
419
+
420
+ case 0: default:
421
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
422
+ break;
423
+ }
424
+ echo " </td>\n\r";
425
+
426
+ echo " <td>\n\r";
427
+ switch ( $coupon['every_product'] ) {
428
+ case 1:
429
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
430
+ break;
431
+
432
+ case 0: default:
433
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
434
+ break;
435
+ }
436
+
437
+ echo " </td>\n\r";
438
+ echo " <td>\n\r";
439
+ echo "<a title='" . esc_attr( $coupon['coupon_code'] ). "' href='#' rel='" . $coupon['id'] . "' class='wpsc_edit_coupon' >" . esc_html__( 'Edit', 'wpsc' ) . "</a>";
440
+ echo " </td>\n\r";
441
+ echo " </tr>\n\r";
442
+ echo " <tr class='coupon_edit'>\n\r";
443
+ echo " <td colspan='7' style='padding-left:0px;'>\n\r";
444
+ echo " <div id='coupon_box_" . $coupon['id'] . "' class='displaynone modify_coupon' >\n\r";
445
+ coupon_edit_form( $coupon );
446
+ echo " </div>\n\r";
447
+ echo " </td>\n\r";
448
+ echo " </tr>\n\r";
449
+ }
450
+ ?>
451
+ </tbody>
452
+ </table>
453
+
454
+ <p style='margin: 10px 0px 5px 0px;'>
455
+ <?php _e( '<strong>Note:</strong> Due to a current PayPal limitation, when a purchase is made using a coupon we cannot send a detailed list of items through for processing. Instead we send the total amount of the purchase so the customer will see your shop name and the total within PayPal.', 'wpsc' ); ?>
456
+ </p>
457
+
458
+ </div>
459
+
460
+ <?php
461
+
462
  }
463
+
464
+ ?>
wpsc-admin/display-debug.page.php CHANGED
@@ -8,18 +8,11 @@
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">
@@ -46,11 +39,11 @@ function wpsc_debug_page() {
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) ) {
@@ -350,4 +343,6 @@ function wpsc_mass_resize_thumbnails_and_clean_images() {
350
  }
351
  }
352
  $wpdb->query( "DELETE FROM `" . WPSC_TABLE_PRODUCT_IMAGES . "` WHERE `product_id` IN('0')" );
353
- }
 
 
8
  *
9
  * @package wp-e-commerce
10
  * @since 3.7
 
 
 
 
 
 
 
11
  */
12
  function wpsc_debug_page() {
13
  if ( !current_user_can('manage_options') )
14
  wp_die("You don't look like an administrator.");
15
+ global $wpdb;
16
  $fixpage = admin_url( 'admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs' );
17
  ?>
18
  <div class="wrap">
39
  <a href='<?php echo $fixpage; ?>'>Fix Purchaselogs</a>
40
  </li>
41
  <li>
42
+ <a href='<?php echo wp_nonce_url("?wpsc_admin_action=update_page_urls"); ?>' ><?php _e('Update Page URLs', 'wpsc'); ?></a>
43
  </li>
44
  <li>
45
  <a href='<?php echo wp_nonce_url("?wpsc_admin_action=clean_categories"); ?>'><?php _e('Fix Product Group Permalinks', 'wpsc'); ?></a>
46
+ </li>
47
  </ul>
48
  <?php
49
  if ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && (constant( 'WPSC_ADD_DEBUG_PAGE' ) == true) ) {
343
  }
344
  }
345
  $wpdb->query( "DELETE FROM `" . WPSC_TABLE_PRODUCT_IMAGES . "` WHERE `product_id` IN('0')" );
346
+ }
347
+
348
+ ?>
wpsc-admin/display-items.page.php CHANGED
@@ -11,6 +11,7 @@
11
 
12
  require_once(WPSC_FILE_PATH . '/wpsc-admin/includes/products.php');
13
 
 
14
  /**
15
  * wpsc_additional_column_names function.
16
  *
@@ -25,23 +26,18 @@ function wpsc_additional_column_names( $columns ){
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
  }
40
-
41
- /**
42
- * @param array $columns The array of sortable columns
43
- * @return array
44
- */
45
  function wpsc_additional_sortable_column_names( $columns ){
46
 
47
  $columns['stock'] = 'stock';
@@ -57,12 +53,8 @@ function wpsc_additional_sortable_column_names( $columns ){
57
  *
58
  * @since 3.8.9
59
  * @access private
60
- *
61
  * @param object $post Post object
62
  * @param int $post_id Post ID
63
- *
64
- * @uses wpsc_the_product_thumbnail() Prints URL to the product thumbnail
65
- * @uses esc_url() Makes sure we have a safe URL
66
  */
67
  function _wpsc_manage_products_column_image( $post, $post_id ) {
68
  $src = wpsc_the_product_thumbnail( false, false, $post_id, 'manage-products' );
@@ -79,17 +71,9 @@ add_action( 'wpsc_manage_products_column_image', '_wpsc_manage_products_column_i
79
  *
80
  * @since 3.8.9
81
  * @access private
82
- *
83
  * @param object $post Post object
84
  * @param int $post_id Post ID
85
  * @param boolean $has_variations Whether the product has variations
86
- *
87
- * @uses esc_html_e() Safe HTML with translation
88
- * @uses get_post_meta() Gets post meta given key and post_id
89
- * @uses maybe_unserialize() Unserialize value only if it was serialized.
90
- * @uses wpsc_convert_weight() Does weight conversions
91
- * @uses esc_html() Makes sure things are safe
92
- * @uses wpsc_weight_unit_display() Gets weight unit for display
93
  */
94
  function _wpsc_manage_products_column_weight( $post, $post_id, $has_variations ) {
95
  if( $has_variations ) {
@@ -117,7 +101,22 @@ function _wpsc_manage_products_column_weight( $post, $post_id, $has_variations )
117
 
118
  $unit = $product_data['meta']['_wpsc_product_metadata']['weight_unit'];
119
 
120
- echo $weight . wpsc_weight_unit_display( $unit );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  echo '<div id="inline_' . $post->ID . '_weight" class="hidden">' . esc_html( $weight ) . '</div>';
122
  }
123
  add_action( 'wpsc_manage_products_column_weight', '_wpsc_manage_products_column_weight', 10, 3 );
@@ -127,14 +126,9 @@ add_action( 'wpsc_manage_products_column_weight', '_wpsc_manage_products_column_
127
  *
128
  * @since 3.8.9
129
  * @access private
130
- *
131
  * @param object $post Post Object
132
  * @param int $post_id Post ID
133
  * @param boolean $has_variations Whether the product has variations
134
- *
135
- * @uses get_post_meta() Gets post meta given key and post_id
136
- * @uses wpsc_variations_stock_remaining() Gets remaining stock level for given post_id
137
- * @uses esc_html() Because we need safe HTML right???
138
  */
139
  function _wpsc_manage_products_column_stock( $post, $post_id, $has_variations ) {
140
  $stock = get_post_meta( $post->ID, '_wpsc_stock', true );
@@ -158,29 +152,21 @@ add_action( 'wpsc_manage_products_column_stock', '_wpsc_manage_products_column_s
158
  *
159
  * @since 3.8.9
160
  * @access private
161
- *
162
- * @param object $post Post object
163
- * @param int $post_id Post ID
164
- * @param boolean $has_variations Whether the product has variations
165
- *
166
- * @uses get_post_meta() Gets post meta given key and post_id
167
- * @uses wpsc_currency_display() Returns the currency after dealing with how the user wants it to be displayed
168
- * @uses wpsc_product_variation_price_from() Gets the lowest variation price for the given post_id
169
  */
170
  function _wpsc_manage_products_column_price( $post, $post_id, $has_variations ) {
171
  $price = get_post_meta( $post->ID, '_wpsc_price', true );
172
  $has_var = '1';
173
  if( ! $has_variations ) {
174
  echo wpsc_currency_display( $price );
175
- echo '<div id="inline_' . $post->ID . '_price" class="hidden">' . trim( $price ) . '</div>';
176
  $has_var = '0';
177
  }
178
  else
179
- echo wpsc_product_variation_price_from( $post->ID, array(
180
- 'only_normal_price' => true,
181
- 'from_text' => '%s+'
182
- ) );
183
- echo '<input type="hidden" value="' . $has_var . '" id="inline_' . $post->ID . '_has_var" />';
184
  }
185
  add_action( 'wpsc_manage_products_column_price', '_wpsc_manage_products_column_price', 10, 3 );
186
 
@@ -189,14 +175,9 @@ add_action( 'wpsc_manage_products_column_price', '_wpsc_manage_products_column_p
189
  *
190
  * @since 3.8.9
191
  * @access private
192
- *
193
- * @param object $post Post object
194
- * @param int $post_id Post ID
195
- * @param boolean $has_variations Whether the product has variations
196
- *
197
- * @uses get_post_meta() Gets post meta given key and post_id
198
- * @uses wpsc_currency_display() Returns currency after taking user display options in to account
199
- * @uses wpsc_product_variation_price_from() Gets the lowest variation price for the given post_id
200
  */
201
  function _wpsc_manage_products_column_sale_price( $post, $post_id, $has_variations ) {
202
  $price = get_post_meta( $post->ID, '_wpsc_special_price', true );
@@ -204,7 +185,7 @@ function _wpsc_manage_products_column_sale_price( $post, $post_id, $has_variatio
204
  echo wpsc_currency_display( $price );
205
  echo '<div id="inline_' . $post->ID . '_sale_price" class="hidden">' . $price . '</div>';
206
  } else
207
- echo wpsc_product_variation_price_from( $post->ID, array( 'from_text' => '%s+' ) );
208
  }
209
  add_action( 'wpsc_manage_products_column_sale_price', '_wpsc_manage_products_column_sale_price', 10, 3 );
210
 
@@ -213,12 +194,8 @@ add_action( 'wpsc_manage_products_column_sale_price', '_wpsc_manage_products_col
213
  *
214
  * @since 3.8.9
215
  * @access private
216
- *
217
  * @param object $post Post object
218
  * @param int $post_id Post ID
219
- *
220
- * @uses get_post_meta() Gets post meta given key and post_id
221
- * @uses esc_html() Escapes the stuff inside
222
  */
223
  function _wpsc_manage_products_column_sku( $post, $post_id ) {
224
  $sku = get_post_meta( $post->ID, '_wpsc_sku', true );
@@ -235,13 +212,8 @@ add_action( 'wpsc_manage_products_column_sku', '_wpsc_manage_products_column_sku
235
  *
236
  * @since 3.8.9
237
  * @access private
238
- *
239
  * @param object $post Post object
240
  * @param int $post_id Post ID
241
- *
242
- * @uses get_the_product_category() Gets the category for the given post_id
243
- * @uses esc_html() Makes sure we have safe HTML
244
- * @uses sanitize_term_field() Cleanse the field value in the term based on the context.
245
  */
246
  function _wpsc_manage_products_column_cats( $post, $post_id ) {
247
  $categories = get_the_product_category( $post->ID );
@@ -261,25 +233,20 @@ add_action( 'wpsc_manage_products_column_cats', '_wpsc_manage_products_column_ca
261
  *
262
  * @since 3.8.9
263
  * @access private
264
- *
265
  * @param object $post Post object
266
  * @param int $post_id Post ID
267
- *
268
- * @uses get_option() Gets option from the WordPress database
269
- * @uses _e() Displays the returned translated text from translate()
270
  */
271
  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>
282
- <?php
 
 
 
 
 
 
283
  }
284
  add_action( 'wpsc_manage_products_column_featured', '_wpsc_manage_products_column_featured', 10, 2 );
285
 
@@ -288,11 +255,8 @@ add_action( 'wpsc_manage_products_column_featured', '_wpsc_manage_products_colum
288
  *
289
  * @since 3.8.9
290
  * @access private
291
- *
292
  * @param object $post Post object
293
  * @param int $post_id Post ID
294
- *
295
- * @uses apply_filters() Calls 'wpsc_product_alert'
296
  */
297
  function _wpsc_manage_products_column_hidden_alerts( $post, $post_id ) {
298
  $product_alert = apply_filters( 'wpsc_product_alert', array( false, '' ), $post );
@@ -314,19 +278,14 @@ add_action( 'wpsc_manage_products_column_hidden_alerts', '_wpsc_manage_products_
314
 
315
 
316
  /**
317
- * Adds extra data to post columns
318
  *
319
  * @access public
320
- *
321
  * @param (array) $column
322
  * @return void
323
- *
324
  * @todo Need to check titles / alt tags ( I don't think thumbnails have any in this code )
325
  * @desc Switch function to generate columns the right way...no more UI hacking!
326
  *
327
- * @uses get_post() Gets post object from provided post_id
328
- * @uses wpsc_product_has_children() Checks if a product has variations or not
329
- * @uses do_action() Calls 'wpsc_manage_products_column_$column'
330
  */
331
  function wpsc_additional_column_data( $column, $post_id ) {
332
  $post = get_post( $post_id );
@@ -336,10 +295,6 @@ function wpsc_additional_column_data( $column, $post_id ) {
336
  do_action( "wpsc_manage_products_column_{$column}", $post, $post_id, $is_parent );
337
  }
338
 
339
- /**
340
- * @param array $vars Array of query vars
341
- * @return array $vars Our modified vars
342
- */
343
  function wpsc_column_sql_orderby( $vars ) {
344
  if ( ! isset( $vars['post_type'] ) || 'wpsc-product' != $vars['post_type'] || ! isset( $vars['orderby'] ) )
345
  return $vars;
@@ -386,12 +341,6 @@ function wpsc_column_sql_orderby( $vars ) {
386
 
387
  return $vars;
388
  }
389
-
390
- /**
391
- *
392
- * @uses get_taxonomy() Retrieves the taxonomy object of $taxonomy.
393
- * @uses wpsc_cats_restrict_manage_posts_print_terms() @todo docs
394
- */
395
  function wpsc_cats_restrict_manage_posts() {
396
  global $typenow;
397
 
@@ -413,15 +362,7 @@ function wpsc_cats_restrict_manage_posts() {
413
  }
414
  }
415
 
416
- /**
417
- * @todo docs
418
- * @param $taxonomy
419
- * @param int $parent
420
- * @param int $level
421
- *
422
- * @uses get_terms() Retrieve the terms in a given taxonomy or list of taxonomies.
423
- */
424
- function wpsc_cats_restrict_manage_posts_print_terms( $taxonomy, $parent = 0, $level = 0 ) {
425
  $prefix = str_repeat( '&nbsp;&nbsp;&nbsp;' , $level );
426
  $terms = get_terms( $taxonomy, array( 'parent' => $parent, 'hide_empty' => false ) );
427
  if( !($terms instanceof WP_Error) && !empty($terms) )
@@ -432,12 +373,13 @@ function wpsc_cats_restrict_manage_posts_print_terms( $taxonomy, $parent = 0, $l
432
  }
433
 
434
  /**
 
435
  * Restrict the products page to showing only parent products and not variations.
436
- *
437
  * @since 3.8
438
  */
 
439
  function wpsc_no_minors_allowed( $vars ) {
440
- $current_screen = get_current_screen();
441
 
442
  if( $current_screen->post_type != 'wpsc-product' )
443
  return $vars;
@@ -452,53 +394,19 @@ function wpsc_no_minors_allowed( $vars ) {
452
  *
453
  * Only sorts columns on edit.php page.
454
  * @since 3.8.8
455
- *
456
- * @uses add_filter()
457
  */
 
458
  function wpsc_sortable_column_load() {
459
  add_filter( 'request', 'wpsc_no_minors_allowed' );
460
  add_filter( 'request', 'wpsc_column_sql_orderby', 8 );
461
  }
462
 
463
- /**
464
- * Product List Exclude Child Categories
465
- *
466
- * When filtering the product list by category in the admin this ensures that
467
- * only products in the selected category are shown, not any of it's sub-categories.
468
- *
469
- * @param object $query WP_Query
470
- *
471
- * @uses get_current_screen()
472
- */
473
- function wpsc_product_list_exclude_child_categories( $query ) {
474
-
475
- if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ! $query->is_main_query() )
476
- return;
477
-
478
- if ( 'edit-wpsc-product' == get_current_screen()->id ) {
479
- $wpsc_product_category = $query->get( 'wpsc_product_category' );
480
- if ( ! empty( $wpsc_product_category ) ) {
481
- $category_query = array(
482
- 'taxonomy' => 'wpsc_product_category',
483
- 'field' => 'slug',
484
- 'terms' => array( $wpsc_product_category ),
485
- 'include_children' => false,
486
- 'operator' => 'IN'
487
- );
488
- $query->set( 'tax_query', array( $category_query ) );
489
- $query->tax_query->queries = $query->get( 'tax_query' );
490
- }
491
- }
492
- }
493
-
494
- add_action( 'pre_get_posts', 'wpsc_product_list_exclude_child_categories', 15 );
495
-
496
- add_action( 'load-edit.php' , 'wpsc_sortable_column_load' );
497
- add_action( 'restrict_manage_posts' , 'wpsc_cats_restrict_manage_posts' );
498
- add_action( 'manage_wpsc-product_posts_custom_column' , 'wpsc_additional_column_data', 10, 2 );
499
  add_filter( 'manage_edit-wpsc-product_sortable_columns', 'wpsc_additional_sortable_column_names' );
500
- add_filter( 'manage_edit-wpsc-product_columns' , 'wpsc_additional_column_names' );
501
- add_filter( 'manage_wpsc-product_posts_columns' , 'wpsc_additional_column_names' );
502
 
503
 
504
 
@@ -506,72 +414,42 @@ add_filter( 'manage_wpsc-product_posts_columns' , 'wpsc_additional_column
506
  * wpsc_update_featured_products function.
507
  *
508
  * @access public
 
509
  * @return void
510
- *
511
- * @uses check_admin_referer() Makes sure that a user was referred from another admin page.
512
- * @uses get_option() Gets option from the WordPress database
513
- * @uses update_option() Updates an option in the WordPress database
514
- * @uses wp_redirect() Redirects to another page.
515
- * @uses wp_get_referer() Retrieve referer from '_wp_http_referer' or HTTP referer.
516
  */
517
  function wpsc_update_featured_products() {
518
- if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) &&
519
- ! ( isset( $_REQUEST['wpsc_admin_action'] ) &&
520
- ( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) ) )
521
- return;
522
-
523
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update_featured_product' !== $_REQUEST['action'] )
524
- return;
525
-
526
- $product_id = absint( $_REQUEST['product_id'] );
527
-
528
- if ( ! DOING_AJAX )
529
- check_admin_referer( 'feature_product_' . $product_id );
530
-
531
  $status = get_option( 'sticky_products' );
532
 
533
- $new_status = ! in_array( $product_id, $status );
534
 
535
  if ( $new_status ) {
 
536
  $status[] = $product_id;
537
  } else {
538
  $status = array_diff( $status, array( $product_id ) );
539
  $status = array_values( $status );
540
  }
 
541
 
542
- $update = update_option( 'sticky_products', $status );
543
-
544
- do_action( 'wpsc_after_featured_product_update', $update, $status );
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'
552
- );
553
-
554
- echo json_encode( $json_response );
555
-
556
  exit();
557
  }
558
  wp_redirect( wp_get_referer() );
559
- exit;
560
  }
561
 
562
- add_filter( 'page_row_actions','wpsc_action_row', 10, 2 );
563
 
564
- /**
565
- * @param $actions
566
- * @param $post
567
- * @return mixed
568
- *
569
- * @uses admin_url() Gets the WordPress admin url
570
- * @uses add_query_arg() Adds a query arg to url
571
- * @uses esc_url() Makes sure the URL is safe, we like safe
572
- * @uses esc_html_x() Displays translated string with gettext context
573
- */
574
- function wpsc_action_row( $actions, $post ) {
575
 
576
  if ( $post->post_type != "wpsc-product" )
577
  return $actions;
@@ -583,5 +461,6 @@ function wpsc_action_row( $actions, $post ) {
583
  return $actions;
584
  }
585
 
586
- add_action( 'wp_ajax_update_featured_product', 'wpsc_update_featured_products' );
587
- add_action( 'admin_init' , 'wpsc_update_featured_products' );
 
11
 
12
  require_once(WPSC_FILE_PATH . '/wpsc-admin/includes/products.php');
13
 
14
+
15
  /**
16
  * wpsc_additional_column_names function.
17
  *
26
  $columns['cb'] = '<input type="checkbox" />';
27
  $columns['image'] = '';
28
  $columns['title'] = __('Name', 'wpsc');
29
+ $columns['weight'] = __('Weight', 'wpsc');
30
  $columns['stock'] = __('Stock', 'wpsc');
31
  $columns['price'] = __('Price', 'wpsc');
32
+ $columns['sale_price'] = __('Sale Price', 'wpsc');
33
  $columns['SKU'] = __('SKU', 'wpsc');
 
34
  $columns['cats'] = __('Categories', 'wpsc');
35
+ $columns['featured'] = __('Featured', 'wpsc');
36
  $columns['hidden_alerts'] = '';
37
  $columns['date'] = __('Date', 'wpsc');
38
 
39
  return $columns;
40
  }
 
 
 
 
 
41
  function wpsc_additional_sortable_column_names( $columns ){
42
 
43
  $columns['stock'] = 'stock';
53
  *
54
  * @since 3.8.9
55
  * @access private
 
56
  * @param object $post Post object
57
  * @param int $post_id Post ID
 
 
 
58
  */
59
  function _wpsc_manage_products_column_image( $post, $post_id ) {
60
  $src = wpsc_the_product_thumbnail( false, false, $post_id, 'manage-products' );
71
  *
72
  * @since 3.8.9
73
  * @access private
 
74
  * @param object $post Post object
75
  * @param int $post_id Post ID
76
  * @param boolean $has_variations Whether the product has variations
 
 
 
 
 
 
 
77
  */
78
  function _wpsc_manage_products_column_weight( $post, $post_id, $has_variations ) {
79
  if( $has_variations ) {
101
 
102
  $unit = $product_data['meta']['_wpsc_product_metadata']['weight_unit'];
103
 
104
+ switch( $unit ) {
105
+ case "pound":
106
+ $unit = __(" lbs.", "wpsc");
107
+ break;
108
+ case "ounce":
109
+ $unit = __(" oz.", "wpsc");
110
+ break;
111
+ case "gram":
112
+ $unit = __(" g", "wpsc");
113
+ break;
114
+ case "kilograms":
115
+ case "kilogram":
116
+ $unit = __(" kgs.", "wpsc");
117
+ break;
118
+ }
119
+ echo $weight.$unit;
120
  echo '<div id="inline_' . $post->ID . '_weight" class="hidden">' . esc_html( $weight ) . '</div>';
121
  }
122
  add_action( 'wpsc_manage_products_column_weight', '_wpsc_manage_products_column_weight', 10, 3 );
126
  *
127
  * @since 3.8.9
128
  * @access private
 
129
  * @param object $post Post Object
130
  * @param int $post_id Post ID
131
  * @param boolean $has_variations Whether the product has variations
 
 
 
 
132
  */
133
  function _wpsc_manage_products_column_stock( $post, $post_id, $has_variations ) {
134
  $stock = get_post_meta( $post->ID, '_wpsc_stock', true );
152
  *
153
  * @since 3.8.9
154
  * @access private
155
+ * @param object $post Post object
156
+ * @param int $post_id Post ID
157
+ * @param boolean $has_variations Whether the product has variations
 
 
 
 
 
158
  */
159
  function _wpsc_manage_products_column_price( $post, $post_id, $has_variations ) {
160
  $price = get_post_meta( $post->ID, '_wpsc_price', true );
161
  $has_var = '1';
162
  if( ! $has_variations ) {
163
  echo wpsc_currency_display( $price );
164
+ echo '<div id="inline_' . $post->ID . '_price" class="hidden">' . trim($price) . '</div>';
165
  $has_var = '0';
166
  }
167
  else
168
+ echo wpsc_product_variation_price_available( $post->ID ).'+';
169
+ echo '<input type="hidden" value="'.$has_var.'" id="inline_' . $post->ID . '_has_var" />';
 
 
 
170
  }
171
  add_action( 'wpsc_manage_products_column_price', '_wpsc_manage_products_column_price', 10, 3 );
172
 
175
  *
176
  * @since 3.8.9
177
  * @access private
178
+ * @param object $post Post object
179
+ * @param int $post_id Post ID
180
+ * @param boolean $has_variations Whether the product has variations
 
 
 
 
 
181
  */
182
  function _wpsc_manage_products_column_sale_price( $post, $post_id, $has_variations ) {
183
  $price = get_post_meta( $post->ID, '_wpsc_special_price', true );
185
  echo wpsc_currency_display( $price );
186
  echo '<div id="inline_' . $post->ID . '_sale_price" class="hidden">' . $price . '</div>';
187
  } else
188
+ echo wpsc_product_variation_price_available( $post->ID ).'+';
189
  }
190
  add_action( 'wpsc_manage_products_column_sale_price', '_wpsc_manage_products_column_sale_price', 10, 3 );
191
 
194
  *
195
  * @since 3.8.9
196
  * @access private
 
197
  * @param object $post Post object
198
  * @param int $post_id Post ID
 
 
 
199
  */
200
  function _wpsc_manage_products_column_sku( $post, $post_id ) {
201
  $sku = get_post_meta( $post->ID, '_wpsc_sku', true );
212
  *
213
  * @since 3.8.9
214
  * @access private
 
215
  * @param object $post Post object
216
  * @param int $post_id Post ID
 
 
 
 
217
  */
218
  function _wpsc_manage_products_column_cats( $post, $post_id ) {
219
  $categories = get_the_product_category( $post->ID );
233
  *
234
  * @since 3.8.9
235
  * @access private
 
236
  * @param object $post Post object
237
  * @param int $post_id Post ID
 
 
 
238
  */
239
  function _wpsc_manage_products_column_featured( $post, $post_id ) {
240
  $featured_product_url = wp_nonce_url( "index.php?wpsc_admin_action=update_featured_product&amp;product_id=$post->ID", 'feature_product_' . $post->ID);
 
 
 
 
 
 
 
241
  ?>
242
+ <a class="wpsc_featured_product_toggle featured_toggle_<?php echo $post->ID; ?>" href='<?php echo $featured_product_url; ?>' >
243
+ <?php if ( in_array( $post->ID, (array)get_option( 'sticky_products' ) ) ) : ?>
244
+ <img class='gold-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/gold-star.gif' alt='<?php _e( 'Unmark as Featured', 'wpsc' ); ?>' title='<?php _e( 'Unmark as Featured', 'wpsc' ); ?>' />
245
+ <?php else: ?>
246
+ <img class='grey-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/grey-star.gif' alt='<?php _e( 'Mark as Featured', 'wpsc' ); ?>' title='<?php _e( 'Mark as Featured', 'wpsc' ); ?>' />
247
+ <?php endif; ?>
248
+ </a>
249
+ <?php
250
  }
251
  add_action( 'wpsc_manage_products_column_featured', '_wpsc_manage_products_column_featured', 10, 2 );
252
 
255
  *
256
  * @since 3.8.9
257
  * @access private
 
258
  * @param object $post Post object
259
  * @param int $post_id Post ID
 
 
260
  */
261
  function _wpsc_manage_products_column_hidden_alerts( $post, $post_id ) {
262
  $product_alert = apply_filters( 'wpsc_product_alert', array( false, '' ), $post );
278
 
279
 
280
  /**
281
+ * wpsc_additional_column_data.
282
  *
283
  * @access public
 
284
  * @param (array) $column
285
  * @return void
 
286
  * @todo Need to check titles / alt tags ( I don't think thumbnails have any in this code )
287
  * @desc Switch function to generate columns the right way...no more UI hacking!
288
  *
 
 
 
289
  */
290
  function wpsc_additional_column_data( $column, $post_id ) {
291
  $post = get_post( $post_id );
295
  do_action( "wpsc_manage_products_column_{$column}", $post, $post_id, $is_parent );
296
  }
297
 
 
 
 
 
298
  function wpsc_column_sql_orderby( $vars ) {
299
  if ( ! isset( $vars['post_type'] ) || 'wpsc-product' != $vars['post_type'] || ! isset( $vars['orderby'] ) )
300
  return $vars;
341
 
342
  return $vars;
343
  }
 
 
 
 
 
 
344
  function wpsc_cats_restrict_manage_posts() {
345
  global $typenow;
346
 
362
  }
363
  }
364
 
365
+ function wpsc_cats_restrict_manage_posts_print_terms($taxonomy, $parent = 0, $level = 0){
 
 
 
 
 
 
 
 
366
  $prefix = str_repeat( '&nbsp;&nbsp;&nbsp;' , $level );
367
  $terms = get_terms( $taxonomy, array( 'parent' => $parent, 'hide_empty' => false ) );
368
  if( !($terms instanceof WP_Error) && !empty($terms) )
373
  }
374
 
375
  /**
376
+ * wpsc no minors allowed
377
  * Restrict the products page to showing only parent products and not variations.
 
378
  * @since 3.8
379
  */
380
+
381
  function wpsc_no_minors_allowed( $vars ) {
382
+ global $current_screen;
383
 
384
  if( $current_screen->post_type != 'wpsc-product' )
385
  return $vars;
394
  *
395
  * Only sorts columns on edit.php page.
396
  * @since 3.8.8
 
 
397
  */
398
+
399
  function wpsc_sortable_column_load() {
400
  add_filter( 'request', 'wpsc_no_minors_allowed' );
401
  add_filter( 'request', 'wpsc_column_sql_orderby', 8 );
402
  }
403
 
404
+ add_action( 'load-edit.php', 'wpsc_sortable_column_load' );
405
+ add_action( 'restrict_manage_posts', 'wpsc_cats_restrict_manage_posts' );
406
+ add_action( 'manage_wpsc-product_posts_custom_column', 'wpsc_additional_column_data', 10, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  add_filter( 'manage_edit-wpsc-product_sortable_columns', 'wpsc_additional_sortable_column_names' );
408
+ add_filter( 'manage_edit-wpsc-product_columns', 'wpsc_additional_column_names' );
409
+ add_filter( 'manage_wpsc-product_posts_columns', 'wpsc_additional_column_names' );
410
 
411
 
412
 
414
  * wpsc_update_featured_products function.
415
  *
416
  * @access public
417
+ * @todo Should be refactored to e
418
  * @return void
 
 
 
 
 
 
419
  */
420
  function wpsc_update_featured_products() {
421
+ $is_ajax = (int)(bool)$_POST['ajax'];
422
+ $product_id = absint( $_GET['product_id'] );
423
+ check_admin_referer( 'feature_product_' . $product_id );
 
 
 
 
 
 
 
 
 
 
424
  $status = get_option( 'sticky_products' );
425
 
426
+ $new_status = (in_array( $product_id, $status )) ? false : true;
427
 
428
  if ( $new_status ) {
429
+
430
  $status[] = $product_id;
431
  } else {
432
  $status = array_diff( $status, array( $product_id ) );
433
  $status = array_values( $status );
434
  }
435
+ update_option( 'sticky_products', $status );
436
 
437
+ if ( $is_ajax == true ) {
438
+ if ( $new_status == true ) : ?>
439
+ jQuery('.featured_toggle_<?php echo $product_id; ?>').html("<img class='gold-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/gold-star.gif' alt='<?php esc_attr_e( 'Unmark as Featured', 'wpsc' ); ?>' title='<?php esc_attr_e( 'Unmark as Featured', 'wpsc' ); ?>' />");
440
+ <?php else: ?>
441
+ jQuery('.featured_toggle_<?php echo $product_id; ?>').html("<img class='grey-star' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/grey-star.gif' alt='<?php esc_attr_e( 'Mark as Featured', 'wpsc' ); ?>' title='<?php esc_attr_e( 'Mark as Featured', 'wpsc' ); ?>' />");
442
+ <?php
443
+ endif;
 
 
 
 
 
 
 
444
  exit();
445
  }
446
  wp_redirect( wp_get_referer() );
447
+ exit();
448
  }
449
 
450
+ add_filter( 'page_row_actions','my_action_row', 10, 2 );
451
 
452
+ function my_action_row( $actions, $post ) {
 
 
 
 
 
 
 
 
 
 
453
 
454
  if ( $post->post_type != "wpsc-product" )
455
  return $actions;
461
  return $actions;
462
  }
463
 
464
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) )
465
+ add_action( 'admin_init', 'wpsc_update_featured_products' );
466
+
wpsc-admin/display-options-settings.page.php CHANGED
@@ -54,7 +54,7 @@ function wpsc_settings_page_update_notification() {
54
  if ( ! isset( $message ) )
55
  _e( 'Settings successfully updated.', 'wpsc' );
56
 
57
- $_SERVER['REQUEST_URI'] = 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>
59
 
60
  <?php
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>
59
 
60
  <?php
wpsc-admin/display-sales-logs.php CHANGED
@@ -8,441 +8,381 @@
8
  * @since 3.8.8
9
  */
10
 
11
- class WPSC_Purchase_Log_Page {
12
- private $list_table;
13
- private $output;
14
- public $log_id = 0;
15
-
16
- public function __construct() {
17
- $controller = 'default';
18
- $controller_method = 'controller_default';
19
-
20
- // If individual purchase log, setup ID and action links.
21
- if ( isset( $_REQUEST['id'] ) && is_numeric( $_REQUEST['id'] ) ) {
22
- $this->log_id = (int) $_REQUEST['id'];
23
- }
24
-
25
- if ( isset( $_REQUEST['c'] ) && method_exists( $this, 'controller_' . $_REQUEST['c'] ) ) {
26
- $controller = $_REQUEST['c'];
27
- $controller_method = 'controller_' . $controller;
28
- } elseif ( isset( $_REQUEST['id'] ) && is_numeric( $_REQUEST['id'] ) ) {
29
- $controller = 'item_details';
30
- $controller_method = 'controller_item_details';
31
- }
32
-
33
- $this->$controller_method();
34
- }
35
-
36
- private function needs_update() {
37
- global $wpdb;
38
-
39
- if ( get_option( '_wpsc_purchlogs_3.8_updated' ) )
40
- return false;
41
-
42
- $c = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE plugin_version IN ('3.6', '3.7')" );
43
- if ( $c > 0 )
44
- return true;
45
-
46
- update_option( '_wpsc_purchlogs_3.8_updated', true );
47
- return false;
48
- }
49
-
50
- public function controller_upgrade_purchase_logs_3_7() {
51
- add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_7' ) );
52
- }
53
-
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
- }
77
-
78
- public function display_upgrade_purchase_logs_3_7() {
79
- global $wpdb;
80
- $numChanged = 0;
81
- $numQueries = 0;
82
- $purchlog = "SELECT DISTINCT id FROM `".WPSC_TABLE_PURCHASE_LOGS."` LIMIT 1";
83
- $id = $wpdb->get_var($purchlog);
84
- $usersql = "SELECT DISTINCT `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.value, `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` LEFT JOIN `".WPSC_TABLE_SUBMITTED_FORM_DATA."` ON `".WPSC_TABLE_CHECKOUT_FORMS."`.id = `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.`form_id` WHERE `".WPSC_TABLE_SUBMITTED_FORM_DATA."`.log_id=".$id." ORDER BY `".WPSC_TABLE_CHECKOUT_FORMS."`.`checkout_order`" ;
85
- $formfields = $wpdb->get_results($usersql);
86
-
87
- if(count($formfields) < 1){
88
- $usersql = "SELECT DISTINCT `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` != 'heading'";
89
- $formfields = $wpdb->get_results($usersql);
90
- }
91
-
92
- if(isset($_POST)){
93
- foreach($_POST as $key=>$value){
94
- if($value != '-1'){
95
- $complete = $wpdb->update(
96
- WPSC_TABLE_CHECKOUT_FORMS,
97
- array(
98
  'unique_name' => $value
99
- ),
100
- array(
101
  'id' => $key
102
- ),
103
- '%s',
104
- '%d'
105
- );
106
- }
107
- $numChanged++;
108
- $numQueries ++;
109
- }
110
-
111
- $sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
112
- $wpdb->query($sql);
113
-
114
- add_option('wpsc_purchaselogs_fixed',true);
115
- }
116
-
117
- include( 'includes/purchase-logs-page/upgrade.php' );
118
- }
119
-
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' ), remove_query_arg( 'c' ) ); ?></p>
126
- </div>
127
- </div>
128
- <?php
129
- }
130
-
131
- public function controller_upgrade_purchase_logs_3_8() {
132
- if ( $this->needs_update() )
133
- wpsc_update_purchase_logs();
134
-
135
- add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_8' ) );
136
- }
137
-
138
- function purchase_logs_pagination() {
139
- global $wpdb, $purchlogitem;
140
- ?>
141
- <span class='tablenav'><span class='tablenav-pages'><span class='pagination-links'>
142
- <?php
143
- $href = "#";
144
- $disabled = "disabled";
145
- if ( $this->log_id > 1 ) {
146
- $href = $this->get_purchase_log_url( ( $this->log_id - 1 ) );
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();
154
- $href = "#";
155
- $disabled = "disabled";
156
- if ( $max_purchase_id > $this->log_id ) {
157
- $href = $this->get_purchase_log_url( ( $this->log_id + 1 ) );
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
165
- }
166
-
167
- function purchase_logs_checkout_fields(){
168
- global $purchlogitem;
169
-
170
- if ( ! empty( $purchlogitem->additional_fields ) ) {
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 ) {
178
- $value['value'] = maybe_unserialize ( $value['value'] );
179
- if ( is_array( $value['value'] ) ) {
180
- ?>
181
- <p><strong><?php echo $value['name']; ?> :</strong> <?php echo implode( stripslashes( $value['value'] ), ',' ); ?></p>
182
- <?php
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>
190
- <?php
191
- }
192
- }
193
- ?>
194
- </div>
195
- </div>
196
- </div>
197
- <?php
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'] ) );
221
- }
222
- } ?>
223
- </div>
224
- </div>
225
- </div>
226
- <?php
227
- }
228
- }
229
-
230
- private function purchase_log_cart_items() {
231
- while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item(); ?>
232
- <tr>
233
- <td><?php echo wpsc_purchaselog_details_name(); ?></td> <!-- NAME! -->
234
- <td><?php echo wpsc_purchaselog_details_SKU(); ?></td> <!-- SKU! -->
235
- <td><?php echo wpsc_purchaselog_details_quantity(); ?></td> <!-- QUANTITY! -->
236
- <td>
237
- <?php
238
  echo wpsc_currency_display( wpsc_purchaselog_details_price() );
239
  do_action( 'wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id() );
240
- ?>
241
  </td> <!-- PRICE! -->
242
- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_shipping() ); ?></td> <!-- SHIPPING! -->
243
- <?php if( wpec_display_product_tax() ): ?>
244
- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_tax() ); ?></td> <!-- TAX! -->
245
- <?php endif; ?>
246
- <!-- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_discount() ); ?></td> --> <!-- DISCOUNT! -->
247
- <td class="amount"><?php echo wpsc_currency_display( wpsc_purchaselog_details_total() ); ?></td> <!-- TOTAL! -->
248
- </tr>
249
- <?php
250
- do_action( 'wpsc_additional_sales_item_info', wpsc_purchaselog_details_id() );
251
- endwhile;
252
- }
253
-
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;
261
-
262
- // TODO: seriously get rid of all these badly coded purchaselogs.class.php functions in 4.0
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;
291
-
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
-
310
- register_column_headers( 'wpsc_purchase_log_item_details', $columns );
311
-
312
- if ( file_exists( get_stylesheet_directory() . '/wpsc-packing-slip.php' ) ) {
313
- $packing_slip_file = get_stylesheet_directory() . '/wpsc-packing-slip.php';
314
- } else {
315
- $packing_slip_file = 'includes/purchase-logs-page/packing-slip.php';
316
- }
317
-
318
- $packing_slip_file = apply_filters( 'wpsc_packing_packing_slip_path', $packing_slip_file );
319
-
320
- include( $packing_slip_file );
321
-
322
- exit;
323
- }
324
-
325
- public function controller_default() {
326
- //Create an instance of our package class...
327
- $this->list_table = new WPSC_Purchase_Log_List_Table();
328
- $this->process_bulk_action();
329
- $this->list_table->prepare_items();
330
- add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_list_table' ) );
331
- }
332
-
333
- public function display_purchase_log() {
334
- if ( wpec_display_product_tax() )
335
- $cols = 5;
336
- else
337
- $cols = 4;
338
- $receipt_sent = ! empty( $_GET['sent'] );
339
- $receipt_not_sent = isset( $_GET['sent'] ) && ! $_GET['sent'];
340
- include( 'includes/purchase-logs-page/item-details.php' );
341
- }
342
-
343
- public function download_csv() {
344
- $_REQUEST['rss_key'] = 'key';
345
- wpsc_purchase_log_csv();
346
- }
347
-
348
- public function process_bulk_action() {
349
- global $wpdb;
350
- $current_action = $this->list_table->current_action();
351
-
352
- do_action( 'wpsc_sales_log_process_bulk_action', $current_action );
353
-
354
- if ( ! $current_action || ( 'download_csv' != $current_action && empty( $_REQUEST['post'] ) ) ) {
355
- if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
356
- wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'action2' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
357
- exit;
358
- }
359
-
360
- unset( $_REQUEST['post'] );
361
- return;
362
- }
363
-
364
- if ( 'download_csv' == $current_action ) {
365
- $this->download_csv();
366
- exit;
367
- }
368
-
369
- $sendback = remove_query_arg( array(
370
- '_wpnonce',
371
- '_wp_http_referer',
372
- 'action',
373
- 'action2',
374
- 'confirm',
375
- 'post',
376
- 'last_paged'
377
- ) );
378
-
379
- if ( 'delete' == $current_action ) {
380
-
381
- // delete action
382
- if ( empty( $_REQUEST['confirm'] ) ) {
383
- $this->list_table->disable_search_box();
384
- $this->list_table->disable_bulk_actions();
385
- $this->list_table->disable_sortable();
386
- $this->list_table->disable_month_filter();
387
- $this->list_table->disable_views();
388
- $this->list_table->set_per_page(0);
389
- add_action( 'wpsc_purchase_logs_list_table_before', array( $this, 'action_list_table_before' ) );
390
- return;
391
- } else {
392
- if ( empty( $_REQUEST['post'] ) )
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'],
405
- 'deleted' => count( $_REQUEST['post'] ),
406
- ), $sendback );
407
-
408
- }
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 );
416
-
417
- $sendback = add_query_arg( array(
418
- 'updated' => count( $_REQUEST['post'] ),
419
- ), $sendback );
420
- }
421
-
422
- wp_redirect( $sendback );
423
- exit;
424
- }
425
-
426
- public function action_list_table_before() {
427
- include( 'includes/purchase-logs-page/bulk-delete-confirm.php' );
428
- }
429
-
430
- public function display_list_table() {
431
- if ( ! empty( $this->output ) ) {
432
- echo $this->output;
433
- return;
434
- }
435
-
436
- include( 'includes/purchase-logs-page/list-table.php' );
437
- }
438
-
439
- private function get_purchase_log_url( $id ) {
440
- $location = add_query_arg( array(
441
- 'page' => 'wpsc-purchase-logs',
442
- 'c' => 'item_details',
443
- 'id' => $id,
444
- ), admin_url( 'index.php' ) );
445
- return $location;
446
- }
447
-
448
  }
8
  * @since 3.8.8
9
  */
10
 
11
+
12
+
13
+ class WPSC_Purchase_Log_Page
14
+ {
15
+ private $list_table;
16
+ private $output;
17
+
18
+ public function __construct() {
19
+ $controller = 'default';
20
+ $controller_method = 'controller_default';
21
+
22
+ if ( isset( $_REQUEST['c'] ) && method_exists( $this, 'controller_' . $_REQUEST['c'] ) ) {
23
+ $controller = $_REQUEST['c'];
24
+ $controller_method = 'controller_' . $controller;
25
+ }
26
+
27
+ $this->$controller_method();
28
+ }
29
+
30
+ private function needs_update() {
31
+ global $wpdb;
32
+
33
+ if ( get_option( '_wpsc_purchlogs_3.8_updated' ) )
34
+ return false;
35
+
36
+ $c = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE plugin_version IN ('3.6', '3.7')" );
37
+ if ( $c > 0 )
38
+ return true;
39
+
40
+ update_option( '_wpsc_purchlogs_3.8_updated', true );
41
+ return false;
42
+ }
43
+
44
+ public function controller_upgrade_purchase_logs_3_7() {
45
+ add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_7' ) );
46
+ }
47
+
48
+ private function purchase_logs_fix_options( $id ) {
49
+ ?>
50
+ <select name='<?php echo $id; ?>'>
51
+ <option value='-1'><?php echo esc_html_x( 'Select an Option', 'Dropdown default when called in uniquename dropdown', 'wpsc' ); ?>'</option>
52
+ <option value='billingfirstname'><?php esc_html_e( 'Billing First Name', 'wpsc' ); ?></option>
53
+ <option value='billinglastname'><?php esc_html_e( 'Billing Last Name', 'wpsc' ); ?></option>
54
+ <option value='billingaddress'><?php esc_html_e( 'Billing Address', 'wpsc' ); ?></option>
55
+ <option value='billingcity'><?php esc_html_e( 'Billing City', 'wpsc' ); ?></option>
56
+ <option value='billingstate'><?php esc_html_e( 'Billing State', 'wpsc' ); ?></option>
57
+ <option value='billingcountry'><?php esc_html_e( 'Billing Country', 'wpsc' ); ?></option>
58
+ <option value='billingemail'><?php esc_html_e( 'Billing Email', 'wpsc' ); ?></option>
59
+ <option value='billingphone'><?php esc_html_e( 'Billing Phone', 'wpsc' ); ?></option>
60
+ <option value='billingpostcode'><?php esc_html_e( 'Billing Post Code', 'wpsc' ); ?></option>
61
+ <option value='shippingfirstname'><?php esc_html_e( 'Shipping First Name', 'wpsc' ); ?></option>
62
+ <option value='shippinglastname'><?php esc_html_e( 'Shipping Last Name', 'wpsc' ); ?></option>
63
+ <option value='shippingaddress'><?php esc_html_e( 'Shipping Address', 'wpsc' ); ?></option>
64
+ <option value='shippingcity'><?php esc_html_e( 'Shipping City', 'wpsc' ); ?></option>
65
+ <option value='shippingstate'><?php esc_html_e( 'Shipping State', 'wpsc' ); ?></option>
66
+ <option value='shippingcountry'><?php esc_html_e( 'Shipping Country', 'wpsc' ); ?></option>
67
+ <option value='shippingpostcode'><?php esc_html_e( 'Shipping Post Code', 'wpsc' ); ?></option>
68
+ </select>
69
+ <?php
70
+ }
71
+
72
+ public function display_upgrade_purchase_logs_3_7() {
73
+ global $wpdb;
74
+ $numChanged = 0;
75
+ $numQueries = 0;
76
+ $purchlog = "SELECT DISTINCT id FROM `".WPSC_TABLE_PURCHASE_LOGS."` LIMIT 1";
77
+ $id = $wpdb->get_var($purchlog);
78
+ $usersql = "SELECT DISTINCT `".WPSC_TABLE_SUBMITED_FORM_DATA."`.value, `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` LEFT JOIN `".WPSC_TABLE_SUBMITED_FORM_DATA."` ON `".WPSC_TABLE_CHECKOUT_FORMS."`.id = `".WPSC_TABLE_SUBMITED_FORM_DATA."`.`form_id` WHERE `".WPSC_TABLE_SUBMITED_FORM_DATA."`.log_id=".$id." ORDER BY `".WPSC_TABLE_CHECKOUT_FORMS."`.`checkout_order`" ;
79
+ $formfields = $wpdb->get_results($usersql);
80
+
81
+ if(count($formfields) < 1){
82
+ $usersql = "SELECT DISTINCT `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` != 'heading'";
83
+ $formfields = $wpdb->get_results($usersql);
84
+ }
85
+
86
+ if(isset($_POST)){
87
+ foreach($_POST as $key=>$value){
88
+ if($value != '-1'){
89
+ $complete = $wpdb->update(
90
+ WPSC_TABLE_CHECKOUT_FORMS,
91
+ array(
 
 
 
 
 
 
92
  'unique_name' => $value
93
+ ),
94
+ array(
95
  'id' => $key
96
+ ),
97
+ '%s',
98
+ '%d'
99
+ );
100
+ }
101
+ $numChanged++;
102
+ $numQueries ++;
103
+ }
104
+
105
+ $sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
106
+ $wpdb->query($sql);
107
+
108
+ add_option('wpsc_purchaselogs_fixed',true);
109
+ }
110
+
111
+ include( 'includes/purchase-logs-page/upgrade.php' );
112
+ }
113
+
114
+ public function display_upgrade_purchase_logs_3_8() {
115
+ ?>
116
+ <div class="wrap">
117
+ <h2><?php echo esc_html( __('Sales', 'wpsc') ); ?> </h2>
118
+ <div class="updated">
119
+ <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>
120
+ </div>
121
+ </div>
122
+ <?php
123
+ }
124
+
125
+ public function controller_upgrade_purchase_logs_3_8() {
126
+ if ( $this->needs_update() )
127
+ wpsc_update_purchase_logs();
128
+
129
+ add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_upgrade_purchase_logs_3_8' ) );
130
+ }
131
+
132
+ function purchase_logs_checkout_fields(){
133
+ global $purchlogitem;
134
+
135
+ if ( ! empty($purchlogitem->additional_fields ) ) {
136
+ ?>
137
+ <div class="metabox-holder">
138
+ <div id="custom_checkout_fields" class="postbox">
139
+ <h3 class='hndle'><?php esc_html_e( 'Additional Checkout Fields' , 'wpsc' ); ?></h3>
140
+ <div class='inside'>
141
+ <?php
142
+ foreach( (array) $purchlogitem->additional_fields as $value ) {
143
+ $value['value'] = maybe_unserialize ($value['value'] );
144
+ if( is_array( $value['value'] ) ) {
145
+ ?>
146
+ <p><strong><?php echo $value['name']; ?> :</strong> <?php echo implode( stripslashes( $value['value'] ), ',' ); ?></p>
147
+ <?php
148
+ }else{
149
+ ?>
150
+ <p><strong><?php echo $value['name']; ?> :</strong> <?php echo stripslashes( $value['value'] ); ?></p>
151
+ <?php
152
+ }
153
+ }
154
+ ?>
155
+ </div>
156
+ </div>
157
+ </div>
158
+ <?php
159
+ }
160
+ }
161
+
162
+ private function purchase_log_custom_fields(){
163
+ if( wpsc_purchlogs_has_customfields() ){?>
164
+ <div class='metabox-holder'>
165
+ <div id='purchlogs_customfields' class='postbox'>
166
+ <h3 class='hndle'><?php esc_html_e( 'Users Custom Fields' , 'wpsc' ); ?></h3>
167
+ <div class='inside'>
168
+ <?php $messages = wpsc_purchlogs_custommessages(); ?>
169
+ <?php $files = wpsc_purchlogs_customfiles(); ?>
170
+ <?php if(count($files) > 0){ ?>
171
+ <h4><?php esc_html_e( 'Cart Items with Custom Files' , 'wpsc' ); ?>:</h4>
172
+ <?php
173
+ foreach($files as $file){
174
+ echo $file;
175
+ }
176
+ }?>
177
+ <?php if(count($messages) > 0){ ?>
178
+ <h4><?php esc_html_e( 'Cart Items with Custom Messages' , 'wpsc' ); ?>:</h4>
179
+ <?php
180
+ foreach($messages as $message){
181
+ echo esc_html( $message );
182
+ }
183
+ } ?>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ <?php
188
+ }
189
+ }
190
+
191
+ private function purchase_log_cart_items() {
192
+ while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item(); ?>
193
+ <tr>
194
+ <td><?php echo wpsc_purchaselog_details_name(); ?></td> <!-- NAME! -->
195
+ <td><?php echo wpsc_purchaselog_details_SKU(); ?></td> <!-- SKU! -->
196
+ <td><?php echo wpsc_purchaselog_details_quantity(); ?></td> <!-- QUANTITY! -->
197
+ <td>
198
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  echo wpsc_currency_display( wpsc_purchaselog_details_price() );
200
  do_action( 'wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id() );
201
+ ?>
202
  </td> <!-- PRICE! -->
203
+ <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_shipping() ); ?></td> <!-- SHIPPING! -->
204
+ <?php if( wpec_display_product_tax() ): ?>
205
+ <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_tax() ); ?></td> <!-- TAX! -->
206
+ <?php endif; ?>
207
+ <!-- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_discount() ); ?></td> --> <!-- DISCOUNT! -->
208
+ <td class="amount"><?php echo wpsc_currency_display( wpsc_purchaselog_details_total() ); ?></td> <!-- TOTAL! -->
209
+ </tr>
210
+ <?php
211
+ endwhile;
212
+ }
213
+
214
+ public function controller_item_details() {
215
+ if ( ! isset( $_REQUEST['id'] ) )
216
+ die( __( 'Invalid sales log ID', 'wpsc' ) );
217
+
218
+ global $purchlogitem;
219
+
220
+ $this->log_id = (int) $_REQUEST['id'];
221
+
222
+ // TODO: seriously get rid of all these badly coded purchaselogs.class.php functions in 4.0
223
+ $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
224
+
225
+ $columns = array(
226
+ 'title' => __( 'Name', 'wpsc' ),
227
+ 'sku' => __( 'SKU', 'wpsc' ),
228
+ 'quantity' => __( 'Quantity','wpsc' ),
229
+ 'price' => __( 'Price', 'wpsc' ),
230
+ 'shipping' => __( 'Item Shipping', 'wpsc'),
231
+ );
232
+
233
+ if ( wpec_display_product_tax() ) {
234
+ $columns['tax'] = __( 'Item Tax', 'wpsc' );
235
+ }
236
+
237
+ $columns['total'] = __( 'Item Total','wpsc' );
238
+
239
+ register_column_headers( 'wpsc_purchase_log_item_details', $columns );
240
+
241
+ add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_purchase_log' ) );
242
+ }
243
+
244
+ public function controller_packing_slip() {
245
+ if ( ! isset( $_REQUEST['id'] ) )
246
+ die( __( 'Invalid sales log ID', 'wpsc' ) );
247
+
248
+ global $purchlogitem;
249
+
250
+ $this->log_id = (int) $_REQUEST['id'];
251
+
252
+ $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
253
+
254
+ $columns = array(
255
+ 'title' => __( 'Item Name','wpsc' ),
256
+ 'sku' => __( 'SKU','wpsc' ),
257
+ 'quantity' => __( 'Quantity','wpsc' ),
258
+ 'price' => __( 'Price','wpsc' ),
259
+ 'shipping' => __( 'Item Shipping','wpsc'),
260
+ );
261
+
262
+ if ( wpec_display_product_tax() ) {
263
+ $columns['tax'] = __( 'Item Tax', 'wpsc' );
264
+ }
265
+
266
+ $columns['total'] = __( 'Item Total','wpsc' );
267
+
268
+ $cols = count( $columns ) - 2;
269
+
270
+ register_column_headers( 'wpsc_purchase_log_item_details', $columns );
271
+
272
+ include( 'includes/purchase-logs-page/packing-slip.php' );
273
+ exit;
274
+ }
275
+
276
+ public function controller_default() {
277
+ //Create an instance of our package class...
278
+ $this->list_table = new WPSC_Purchase_Log_List_Table();
279
+ $this->process_bulk_action();
280
+ $this->list_table->prepare_items();
281
+ add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_list_table' ) );
282
+ }
283
+
284
+ public function display_purchase_log() {
285
+ if ( wpec_display_product_tax() )
286
+ $cols = 5;
287
+ else
288
+ $cols = 4;
289
+ $receipt_sent = ! empty( $_GET['sent'] );
290
+ $receipt_not_sent = isset( $_GET['sent'] ) && ! $_GET['sent'];
291
+ include( 'includes/purchase-logs-page/item-details.php' );
292
+ }
293
+
294
+ public function download_csv() {
295
+ $_REQUEST['rss_key'] = 'key';
296
+ wpsc_purchase_log_csv();
297
+ }
298
+
299
+ public function process_bulk_action() {
300
+ global $wpdb;
301
+ $current_action = $this->list_table->current_action();
302
+
303
+ do_action( 'wpsc_sales_log_process_bulk_action', $current_action );
304
+
305
+ if ( ! $current_action || ( 'download_csv' != $current_action && empty( $_REQUEST['post'] ) ) ) {
306
+ if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
307
+ wp_redirect( esc_url( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'action2' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) ) );
308
+ exit;
309
+ }
310
+
311
+ unset( $_REQUEST['post'] );
312
+ return;
313
+ }
314
+
315
+ if ( 'download_csv' == $current_action ) {
316
+ $this->download_csv();
317
+ exit;
318
+ }
319
+
320
+ $sendback = remove_query_arg( array(
321
+ '_wpnonce',
322
+ '_wp_http_referer',
323
+ 'action',
324
+ 'action2',
325
+ 'confirm',
326
+ 'post',
327
+ 'last_paged'
328
+ ) );
329
+
330
+ if ( 'delete' == $current_action ) {
331
+
332
+ // delete action
333
+ if ( empty( $_REQUEST['confirm'] ) ) {
334
+ $this->list_table->disable_search_box();
335
+ $this->list_table->disable_bulk_actions();
336
+ $this->list_table->disable_sortable();
337
+ $this->list_table->disable_month_filter();
338
+ $this->list_table->disable_views();
339
+ $this->list_table->set_per_page(0);
340
+ add_action( 'wpsc_purchase_logs_list_table_before', array( $this, 'action_list_table_before' ) );
341
+ return;
342
+ } else {
343
+ if ( empty( $_REQUEST['post'] ) )
344
+ return;
345
+
346
+ $ids = array_map( 'intval', $_REQUEST['post'] );
347
+ $in = implode( ', ', $ids );
348
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE id IN ($in)" );
349
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_CLAIMED_STOCK . " WHERE cart_id IN ($in)" );
350
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid IN ($in)" );
351
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " WHERE log_id IN ($in)" );
352
+
353
+ $sendback = add_query_arg( array(
354
+ 'paged' => $_REQUEST['last_paged'],
355
+ 'deleted' => count( $_REQUEST['post'] ),
356
+ ), $sendback );
357
+
358
+ }
359
+ }
360
+
361
+ // change status actions
362
+ if ( is_numeric( $current_action ) && $current_action < 7 && ! empty( $_REQUEST['post'] ) ) {
363
+
364
+ foreach ( $_REQUEST['post'] as $id )
365
+ wpsc_purchlog_edit_status( $id, $current_action );
366
+
367
+ $sendback = add_query_arg( array(
368
+ 'updated' => count( $_REQUEST['post'] ),
369
+ ), $sendback );
370
+ }
371
+
372
+ wp_redirect( esc_url( $sendback ) );
373
+ exit;
374
+ }
375
+
376
+ public function action_list_table_before() {
377
+ include( 'includes/purchase-logs-page/bulk-delete-confirm.php' );
378
+ }
379
+
380
+ public function display_list_table() {
381
+ if ( ! empty( $this->output ) ) {
382
+ echo $this->output;
383
+ return;
384
+ }
385
+
386
+ include( 'includes/purchase-logs-page/list-table.php' );
387
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  }
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,9 +48,13 @@ 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
 
@@ -60,7 +64,7 @@ function wpsc_display_update_page() {
60
  ?>
61
 
62
  <div class="wrap">
63
- <h2><?php esc_html_e( 'Update WP eCommerce', 'wpsc' ); ?> </h2>
64
  <br />
65
  <?php
66
  if ( isset( $_REQUEST['run_updates'] ) ) :
@@ -81,7 +85,7 @@ function wpsc_display_update_page() {
81
  $wpsc_update->run( $function, $message );
82
  }
83
 
84
- echo '<br /><br /><strong>' . esc_html__( 'WP eCommerce updated successfully!', 'wpsc' ) . '</strong><br />';
85
  if( '' != get_option('permalink_structure')){ ?>
86
  <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>
87
  <?php
@@ -94,7 +98,7 @@ function wpsc_display_update_page() {
94
  else:
95
 
96
 
97
- 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' );
98
  ?> <br />
99
  <br />
100
  <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>
@@ -102,7 +106,7 @@ function wpsc_display_update_page() {
102
 
103
  <form action="" method="post" id="setup">
104
  <input type="hidden" name="run_updates" value="true" id="run_updates">
105
- <p class="step"><input type="submit" class="button" value="<?php esc_attr_e( 'Update WP eCommerce', 'wpsc' ); ?>" name="Submit"></p>
106
  </form>
107
  <?php
108
  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 e-Commerce 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
  }
49
  }
50
 
51
+ if ( version_compare( PHP_VERSION, '5.0.0', '<' ) ) {
52
+ add_action( 'admin_notices', 'wpsc_display_php_version_notice' );
53
+ }
54
+
55
  function wpsc_display_php_version_notice() {
56
  ?>
57
+ <div id='wpsc-warning' class='error fade'><p><?php printf( __( 'You are using PHP %s. WP e-Commerce %s requires PHP 5.0 or above. Please contact your hosting provider for further assistance.', 'wpsc' ), PHP_VERSION, WPSC_VERSION ); ?></p></div>
58
  <?php
59
  }
60
 
64
  ?>
65
 
66
  <div class="wrap">
67
+ <h2><?php esc_html_e( 'Update WP e-Commerce', 'wpsc' ); ?> </h2>
68
  <br />
69
  <?php
70
  if ( isset( $_REQUEST['run_updates'] ) ) :
85
  $wpsc_update->run( $function, $message );
86
  }
87
 
88
+ echo '<br /><br /><strong>' . esc_html__( 'WP e-Commerce updated successfully!', 'wpsc' ) . '</strong><br />';
89
  if( '' != get_option('permalink_structure')){ ?>
90
  <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>
91
  <?php
98
  else:
99
 
100
 
101
+ esc_html_e( 'Your WP e-Commerce database needs to be updated for WP e-Commerce 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' );
102
  ?> <br />
103
  <br />
104
  <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>
106
 
107
  <form action="" method="post" id="setup">
108
  <input type="hidden" name="run_updates" value="true" id="run_updates">
109
+ <p class="step"><input type="submit" class="button" value="<?php esc_attr_e( 'Update WP e-Commerce', 'wpsc' ); ?>" name="Submit"></p>
110
  </form>
111
  <?php
112
  endif;
wpsc-admin/display-upgrades.page.php CHANGED
@@ -6,72 +6,166 @@ function wpsc_display_upgrades_page() {
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
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  <div class='wrap'>
8
  <div class='metabox-holder wpsc_gold_side'>
9
+ <strong><?php esc_html_e( 'WP e-Commerce Upgrades', 'wpsc' ); ?></strong><br />
10
+ <span><?php esc_html_e( 'Add more functionality to your e-Commerce site. Prices may be subject to change.', 'wpsc' ); ?><input type='button' class='button-primary' onclick='window.open ("http://getshopped.org/extend/premium-upgrades/","mywindow");' value='<?php esc_html_e( 'Buy Now', 'wpsc' ); ?>' id='visitInstinct' name='visitInstinct' /></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  <br />
13
  <div class='wpsc_gold_module'>
14
  <br />
15
+ <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/gold-cart-plugin/" target="_blank"><strong><?php esc_html_e( 'Gold Cart', 'wpsc' ); ?></strong></a>
16
  <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>
17
+ <span class='wpsc_gold_info'><?php esc_html_e( '$40', 'wpsc' ); ?></span>
18
  </div>
19
 
20
  <div class='wpsc_gold_module'>
21
  <br />
22
+ <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/dropshop-2010/" target="_blank"><strong><?php esc_html_e( 'DropShop', 'wpsc' ); ?></strong></a>
23
+ <p class='wpsc_gold_text'><?php esc_html_e( 'Impress your customers with our AJAX powered DropShop that lets your customers drag and drop products into their shopping cart', 'wpsc' ); ?></p>
24
+ <span class='wpsc_gold_info'><?php esc_html_e( '$100', 'wpsc' ); ?></span>
25
+ </div>
26
+
27
+ <div class='wpsc_gold_module'>
28
+ <br />
29
+ <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/member-access-plugin/" target="_blank"><strong><?php esc_html_e( 'Members Access Plugin', 'wpsc' ); ?></strong></a>
30
  <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>
31
+ <span class='wpsc_gold_info'><?php esc_html_e( '$49', 'wpsc' ); ?></span>
32
  </div>
33
 
34
  <div class='wpsc_gold_module'>
35
  <br />
36
+ <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/product-slider-2010/" target="_blank"><strong><?php esc_html_e( 'Product Slider', 'wpsc' ); ?> </strong></a>
37
+ <p class='wpsc_gold_text'><?php esc_html_e( 'Display your products in a new and fancy way using the "Product Slider" module.', 'wpsc' ); ?></p>
38
+ <span class='wpsc_gold_info'><?php esc_html_e( '$45', 'wpsc' ); ?></span>
39
  </div>
40
 
41
  <div class='wpsc_gold_module'>
42
  <br />
43
+ <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/nextgen-gallery-buy-now1/" target="_blank"><strong><?php esc_html_e( 'NextGen Gallery Buy Now Buttons', 'wpsc' ); ?> </strong></a>
44
+ <p class='wpsc_gold_text'><?php esc_html_e( 'Make your Online photo gallery into an e-Commerce solution.', 'wpsc' ); ?></p>
45
+ <span class='wpsc_gold_info'><?php esc_html_e( '$10', 'wpsc' ); ?></span>
46
  </div>
47
+
48
  <div class='wpsc_gold_module'>
49
  <br />
50
+ <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/jplayer-mp3-player/" target="_blank"><strong><?php esc_html_e( 'JPlayer - MP3 Plugin', 'wpsc' ); ?> </strong></a>
51
+ <p class='wpsc_gold_text'><?php esc_html_e( 'JPlayer is a Plugin that provides a Javascript powered MP3 player to each product. This is very similar to our alternative MP3 Player except that it uses CSS and Javascript to customize the look and feel of the player making it much easier for you to style it also comes with a range of skins.', 'wpsc' ); ?></p>
52
+ <span class='wpsc_gold_info'><?php esc_html_e( '$40', 'wpsc' ); ?></span>
53
+ </div>
54
+ <div class='wpsc_gold_module'>
55
+ <br />
56
+ <a href="http://getshopped.org/extend/premium-upgrades/premium-upgrades/fedex-shipping-module/" target="_blank"><strong><?php esc_html_e( 'FedEx Plugin', 'wpsc' ); ?> </strong></a>
57
  <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>
58
+ <span class='wpsc_gold_info'><?php esc_html_e( '$40', 'wpsc' ); ?></span>
59
+ </div>
60
+ <div class='wpsc_gold_module'>
61
+ <br />
62
+ <a href="http://www.bravenewcode.com/store/plugins/piggy/?utm_source=affiliate-6331&amp;utm_medium=affiliates&amp;utm_campaign=wpec" target="_blank"><strong><?php esc_html_e( 'Piggy', 'wpsc' ); ?> </strong></a>
63
+ <p class='wpsc_gold_text'><?php esc_html_e( 'Your WP E-Commerce sales, in your pocket. Piggy is a web-app that provides mobile access to view sales data for your WP E-Commerce powered WordPress website. Works on iOS and Android.', 'wpsc' ); ?></p>
64
+ <span class='wpsc_gold_info'><?php esc_html_e( '$39', 'wpsc' ); ?></span>
65
  </div>
66
+
67
  </div>
68
 
69
+ <h2><?php esc_html_e( 'Upgrades', 'wpsc' ); ?></h2>
70
+ <div class='wpsc_gold_float'>
71
+ <p><?php esc_html_e( 'Enter your API Username and API Key below.', 'wpsc' ); ?></p>
72
+ <p><a href="http://docs.getshopped.org/category/extending-your-store/premium-plugins/gold-cart/"><?php esc_html_e( 'For more information visit our documentation page.', 'wpsc' ); ?></a></p>
73
+
74
+ <div class='metabox-holder'>
75
+ <form method='post' id='gold_cart_form' action=''>
76
+
77
+ <?php
78
+ if ( defined( 'WPSC_GOLD_MODULE_PRESENT' ) && ( true == WPSC_GOLD_MODULE_PRESENT ) ) {
79
+ do_action( 'wpsc_gold_module_activation_forms' );
80
+ } else {
81
+ ?>
82
+
83
+ <div id='wpsc_gold_options_outside'>
84
+ <div class='form-wrap' >
85
+ <p>
86
+ <?php esc_html_e( "You don't have any Upgrades yet!", 'wpsc' ); ?>
87
+ </p>
88
+ </div>
89
+
90
+ <h2><?php _e( 'API Key Reset', 'wpsc' ); ?></h2>
91
+ <div class='form-wrap' >
92
+ <p>
93
+ <?php esc_html_e( 'Enter your API name and key to release it from an old site that you no longer use.', 'wpsc' ); ?> <br /><br />
94
+ </p>
95
+ </div>
96
+ </div>
97
+
98
+ <div class='postbox'>
99
+ <h3 class='hndle'><?php esc_html_e( 'API Key Reset', 'wpsc' ); ?></h3>
100
+ <p>
101
+ <label for='activation_name'><?php esc_html_e( 'Name:', 'wpsc' ); ?></label>
102
+ <input class='text' type='text' size='40' value='<?php echo get_option( 'activation_name' ); ?>' name='activation_name' id='activation_name' />
103
+ </p>
104
+ <p>
105
+ <label for='activation_key'><?php esc_html_e( 'API Key:', 'wpsc' ); ?></label>
106
+ <input class='text' type='text' size='40' value='<?php echo get_option( 'activation_key' ); ?>' name='activation_key' id='activation_key' />
107
+ </p>
108
+ <p>
109
+ <input type='hidden' value='true' name='reset_api_key' />
110
+ <input type='submit' class='button-primary' value='<?php esc_html_e( 'Reset API Key', 'wpsc' ); ?>' name='submit_values' />
111
+ </p>
112
+ </div>
113
+
114
+ <?php } ?>
115
+ </form>
116
+ <?php do_meta_boxes('wpsc_upgrade_page', 'top', true); ?>
117
+ </div>
118
+ </div>
119
  </div>
120
 
121
  <?php
122
  }
123
+
124
+ function wpsc_reset_api_key() {
125
+ if ( isset( $_POST['reset_api_key'] ) && ( $_POST['reset_api_key'] == 'true' ) ) {
126
+ if ( $_POST['activation_name'] != null ) {
127
+ $target = "http://instinct.co.nz/wp-goldcart-api/api_register.php?name=" . $_POST['activation_name'] . "&key=" . $_POST['activation_key'] . "&url=" . get_option( 'siteurl' ) . "";
128
+
129
+ $remote_access_fail = false;
130
+ $useragent = 'WP e-Commerce plugin';
131
+
132
+ $activation_name = urlencode( $_POST['activation_name'] );
133
+ $activation_key = urlencode( $_POST['activation_key'] );
134
+ $activation_state = update_option( 'activation_state', "false" );
135
+
136
+ $siteurl = urlencode( get_option( 'siteurl' ) );
137
+ $request = '';
138
+
139
+ $http_request = "GET /wp-goldcart-api/api_register.php?name=$activation_name&key=&url=$siteurl HTTP/1.0\r\n";
140
+ $http_request .= "Host: instinct.co.nz\r\n";
141
+ $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option( 'blog_charset' ) . "\r\n";
142
+ $http_request .= "Content-Length: " . strlen( $request ) . "\r\n";
143
+ $http_request .= "User-Agent: $useragent\r\n";
144
+ $http_request .= "\r\n";
145
+ $http_request .= $request;
146
+
147
+ $response = '';
148
+
149
+ if ( false != ( $fs = @fsockopen( 'instinct.co.nz', 80, $errno, $errstr, 10 ) ) ) {
150
+ fwrite( $fs, $http_request );
151
+
152
+ while ( !feof( $fs ) )
153
+ $response .= fgets( $fs, 1160 ); // One TCP-IP packet
154
+
155
+ fclose( $fs );
156
+ }
157
+
158
+ $response = explode( "\r\n\r\n", $response, 2 );
159
+ $returned_value = (int)trim( $response[1] );
160
+
161
+ update_option( 'activation_name', '' );
162
+ update_option( 'activation_key', '' );
163
+
164
+ echo "<div class='updated'><p align='center'>" . esc_html__( 'Your API key has been Reset', 'wpsc' ) . "</p></div>";
165
+ }
166
+ }
167
+ }
168
+
169
+ add_action( 'wpsc_gold_module_activation', 'wpsc_reset_api_key' );
170
+
171
+ ?>
wpsc-admin/includes/coupon-list-table-class.php DELETED
@@ -1,478 +0,0 @@
1
- <?php
2
- /**
3
- * Coupon WP List Table Class
4
- *
5
- * @package WP e-Commerce
6
- * @subpackage Coupon List Table Class
7
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
- * @since 3.8.10
9
- */
10
-
11
-
12
- // Exit if accessed directly
13
- if ( ! defined( 'ABSPATH' ) ) exit;
14
-
15
-
16
- // Load WP_List_Table if not loaded
17
- if ( ! class_exists( 'WP_List_Table' ) ) {
18
- require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
19
- }
20
-
21
- /**
22
- * WPSC Coupon Codes Table Class
23
- *
24
- * Renders the Coupons table on the Coupons page
25
- *
26
- * @access private
27
- * @since 3.8.10
28
- */
29
-
30
- class WPSC_Coupons_List_Table extends WP_List_Table {
31
-
32
-
33
- /**
34
- * Number of results to show per page
35
- *
36
- * @since 3.8.10
37
- */
38
- private $per_page = 30;
39
-
40
- private $total_count;
41
- private $active_count;
42
- private $inactive_count;
43
- private $statuses;
44
-
45
-
46
- /**
47
- * Get things started
48
- *
49
- * @access private
50
- * @since 3.8.10
51
- * @return void
52
- */
53
-
54
- public function __construct(){
55
- global $status, $page;
56
-
57
- parent::__construct( array(
58
- 'singular' => 'coupon',
59
- 'plural' => 'coupons',
60
- 'ajax' => false
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();
70
- $this->count_coupons();
71
- }
72
-
73
-
74
- /**
75
- * Retrieve the view types
76
- *
77
- * @access private
78
- * @since 3.8.10
79
- * @return array
80
- */
81
-
82
- public function get_views() {
83
- $base = admin_url('edit.php?post_type=wpsc-product&page=wpsc-edit-coupons');
84
-
85
- $current = isset( $_GET['status'] ) ? $_GET['status'] : 'all';
86
- $total_count = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
87
- $active_count = '&nbsp;<span class="count">(' . $this->active_count . ')</span>';
88
- $inactive_count = '&nbsp;<span class="count">(' . $this->inactive_count . ')</span>';
89
-
90
- $views = array(
91
- 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( 'status', $base ), $current === 'all' || $current == '' ? ' class="current"' : '', __('All', 'wpsc') . $total_count ),
92
- 'active' => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( 'status', '1', $base ), $current === '1' ? ' class="current"' : '', __('Active', 'wpsc') . $active_count ),
93
- 'inactive' => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( 'status', '0', $base ), $current === '0' ? ' class="current"' : '', __('Inactive', 'wpsc') . $inactive_count ),
94
- );
95
-
96
- return $views;
97
- }
98
-
99
-
100
- /**
101
- * Retrieve the table columnds
102
- *
103
- * @access private
104
- * @since 3.8.10
105
- * @return array
106
- */
107
-
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;
119
- }
120
-
121
-
122
- /**
123
- * Render most columns
124
- *
125
- * @access private
126
- * @param array $item Contains all the data of the discount code
127
- * @param string $column_name The name of the column
128
- * @since 3.8.10
129
- * @return string
130
- */
131
-
132
- protected function column_default( $item, $column_name ) {
133
- switch( $column_name ){
134
- case 'start' :
135
-
136
- if( ! empty( $item[ 'start'] ) && '0000-00-00 00:00:00' != $item['start'] ) {
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;
144
-
145
- case 'expiry' :
146
-
147
- if( ! empty( $item[ 'expiry'] ) && '0000-00-00 00:00:00' != $item['expiry'] ) {
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;
155
-
156
- default:
157
- return $item[ $column_name ];
158
- }
159
- }
160
-
161
- /**
162
- * Render the Name Column
163
- *
164
- * @access private
165
- * @param array $item Contains all the data of the discount code
166
- * @since 3.8.10
167
- * @return string
168
- */
169
- protected function column_coupon( $item ) {
170
-
171
- $base = admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons&wpsc-action=edit_coupon&coupon=' . $item['ID'] );
172
-
173
- $coupon = '<strong><a href="' . add_query_arg( array( 'wpsc-action' => 'edit_coupon', 'coupon' => $item['ID'] ) ) . '">' . esc_html( $item['coupon'] ) . '</a></strong>';
174
-
175
- $row_actions = array();
176
-
177
- $row_actions['edit'] = '<a href="' . 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="' . add_query_arg( array( 'wpsc-action' => 'deactivate_coupon', 'coupon' => $item['ID'] ) ) . '">' . __( 'Deactivate', 'wpsc' ) . '</a>';
181
- else
182
- $row_actions['activate'] = '<a href="' . add_query_arg( array( 'wpsc-action' => 'activate_coupon', 'coupon' => $item['ID'] ) ) . '">' . __( 'Activate', 'wpsc' ) . '</a>';
183
-
184
- $row_actions['delete'] = '<a href="' . 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
-
188
- return $coupon . $this->row_actions( $row_actions );
189
- }
190
-
191
-
192
- /**
193
- * Render the checkbox column
194
- *
195
- * @access private
196
- * @since 3.8.10
197
- * @return string
198
- */
199
-
200
- protected function column_cb( $item ) {
201
- return sprintf(
202
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
203
- /*$1%s*/ $this->_args['singular'],
204
- /*$2%s*/ $item['ID']
205
- );
206
- }
207
-
208
-
209
- /**
210
- * Render the Status Column
211
- *
212
- * @access private
213
- * @param array $item Contains all the data of the discount code
214
- * @since 3.8.10
215
- * @return string
216
- */
217
-
218
- protected function column_status( $item ) {
219
- if ( ! array_key_exists( $item['status'], $this->statuses ) )
220
- $item['status'] = 'unknown';
221
-
222
- $column = '<span class="wpsc-coupon-status wpsc-coupon-status-%1$s">%2$s</a>';
223
- $column = sprintf( $column, $item['status'], $this->statuses[$item['status']] );
224
-
225
- return $column;
226
- }
227
-
228
-
229
- /**
230
- * Render the Discount Column
231
- *
232
- * @access private
233
- * @param array $item Contains all the data of the discount code
234
- * @since 3.8.10
235
- * @return string
236
- */
237
-
238
- protected function column_discount( $item ) {
239
- switch( $item['type'] ) {
240
- case 0:
241
- return wpsc_currency_display( $item['discount'] );
242
- break;
243
- case 1:
244
- return $item['discount'] . '%';
245
- break;
246
- case 2:
247
- return __( 'Free shipping', 'wpsc' );
248
- break;
249
- }
250
- }
251
-
252
-
253
- /**
254
- * Retrieve the bulk actions
255
- *
256
- * @access private
257
- * @since 3.8.10
258
- * @return array
259
- */
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;
269
- }
270
-
271
-
272
- /**
273
- * Process the bulk actions
274
- *
275
- * @access private
276
- * @since 3.8.10
277
- * @return void
278
- */
279
-
280
- public function process_bulk_action() {
281
-
282
- global $wpdb;
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
- }
310
-
311
-
312
- /**
313
- * Process single actions
314
- *
315
- * @access private
316
- * @since 3.8.10
317
- * @return void
318
- */
319
- public function process_single_actions() {
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
-
369
- /**
370
- * Retrieve the discount code counts
371
- *
372
- * @access private
373
- * @since 3.8.10
374
- * @return array
375
- */
376
- public function count_coupons() {
377
-
378
- global $wpdb;
379
-
380
- // retrieve all discounts here
381
- $this->active_count = $wpdb->get_var( "SELECT COUNT(id) AS count FROM " . WPSC_TABLE_COUPON_CODES . " WHERE active=1;" );
382
- $this->inactive_count = $wpdb->get_var( "SELECT COUNT(id) AS count FROM " . WPSC_TABLE_COUPON_CODES . " WHERE active=0;" );
383
- $this->total_count = $this->active_count + $this->inactive_count;
384
- }
385
-
386
-
387
- /**
388
- * Retrieve all the data for all the discount codes
389
- *
390
- * @access private
391
- * @since 3.8.10
392
- * @return array
393
- */
394
- public function coupons_data() {
395
-
396
- global $wpdb;
397
-
398
- $coupons_data = array();
399
-
400
- if ( isset( $_GET['paged'] ) ) $page = $_GET['paged']; else $page = 1;
401
-
402
- $per_page = $this->per_page;
403
- $offset = ( $page - 1 ) * $this->per_page;
404
-
405
- $status = isset( $_GET['status'] ) ? absint( $_GET['status'] ) : false;
406
- $where = $status !== false ? "WHERE active = $status" : '';
407
-
408
- $order = isset( $_GET['order'] ) && strtoupper( $_GET['order'] ) === 'ASC' ? 'ASC' : 'DESC';
409
- $limit = " LIMIT $offset,$per_page;";
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;
427
- }
428
-
429
-
430
- /**
431
- * Setup the final data for the table
432
- *
433
- * @access private
434
- * @since 3.8.10
435
- * @return array
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;
461
- case '0':
462
- $total_items = $this->inactive_count;
463
- break;
464
- case 'any':
465
- $total_items = $this->total_count;
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,
474
- 'total_pages' => ceil( $total_items / $per_page )
475
- )
476
- );
477
- }
478
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/display-items-functions.php CHANGED
@@ -7,7 +7,6 @@
7
  */
8
 
9
  global $wpsc_product_defaults;
10
-
11
  $wpsc_product_defaults = array(
12
  'id' => '0',
13
  'name' => '',
@@ -34,28 +33,32 @@ $wpsc_product_defaults = array(
34
  'no_shipping' => '0',
35
  'thumbnail_image' => '',
36
  'thumbnail_state' => '1',
37
- 'meta' => array(
 
38
  'external_link' => NULL,
39
  'external_link_text' => NULL,
40
  'external_link_target' => NULL,
41
  'merchant_notes' => NULL,
42
  'sku' => NULL,
43
- 'engraved' => '0',
44
  'can_have_uploaded_image' => '0',
45
- 'table_rate_price' => array(
46
- 'quantity' => array(
 
 
47
  0 => '',
48
  ),
49
- 'table_price' => array(
 
50
  0 => '',
51
  ),
52
  ),
53
  ),
54
  );
 
55
 
56
  function wpsc_redirect_variation_update( $location, $post_id ) {
57
  global $post;
58
-
59
  if ( $post->post_parent > 0 && 'wpsc-product' == $post->post_type )
60
  wp_redirect( admin_url( 'post.php?post='.$post->post_parent.'&action=edit' ) );
61
  else
@@ -64,266 +67,199 @@ function wpsc_redirect_variation_update( $location, $post_id ) {
64
  }
65
 
66
  add_filter( 'redirect_post_location', 'wpsc_redirect_variation_update', 10, 2 );
67
-
 
 
 
 
 
 
 
 
 
68
  function wpsc_price_control_forms() {
69
  global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
70
-
71
- $product_data = get_post_custom( $post->ID );
72
  $product_data['meta'] = maybe_unserialize( $product_data );
73
 
74
- foreach ( $product_data['meta'] as $meta_key => $meta_value ) {
75
  $product_data['meta'][$meta_key] = $meta_value[0];
76
- }
77
 
78
  $product_meta = array();
 
 
79
 
80
- if ( ! empty( $product_data['_wpsc_product_metadata'] ) ) {
81
- $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
82
- }
83
-
84
- if ( isset( $product_data['meta']['_wpsc_currency'] ) ) {
85
  $product_alt_currency = maybe_unserialize( $product_data['meta']['_wpsc_currency'] );
86
- }
87
 
88
- if ( ! isset( $product_data['meta']['_wpsc_table_rate_price'] ) ) {
89
  $product_data['meta']['_wpsc_table_rate_price'] = $wpsc_product_defaults['meta']['table_rate_price'];
90
  }
91
-
92
  if ( isset( $product_meta['_wpsc_table_rate_price'] ) ) {
93
- $product_meta['table_rate_price']['state'] = 1;
94
- $product_meta['table_rate_price'] += $product_meta['_wpsc_table_rate_price'];
95
  $product_data['meta']['_wpsc_table_rate_price'] = $product_meta['_wpsc_table_rate_price'];
96
  }
97
 
98
 
99
- if ( ! isset( $product_data['meta']['_wpsc_is_donation'] ) ) {
100
  $product_data['meta']['_wpsc_is_donation'] = $wpsc_product_defaults['donation'];
101
- }
102
 
103
- if ( ! isset( $product_meta['table_rate_price']['state'] ) ) {
104
  $product_meta['table_rate_price']['state'] = null;
105
- }
106
 
107
- if ( ! isset( $product_meta['table_rate_price']['quantity'] ) ) {
108
  $product_meta['table_rate_price']['quantity'] = $wpsc_product_defaults['meta']['table_rate_price']['quantity'][0];
109
- }
110
 
111
- if ( ! isset( $product_data['meta']['_wpsc_price'] ) ) {
112
  $product_data['meta']['_wpsc_price'] = $wpsc_product_defaults['price'];
113
- }
114
 
115
- if ( ! isset( $product_data['special'] ) ) {
116
  $product_data['special'] = $wpsc_product_defaults['special'];
117
- }
118
 
119
- if ( ! isset( $product_data['meta']['_wpsc_special_price'] ) ) {
120
  $product_data['meta']['_wpsc_special_price'] = $wpsc_product_defaults['special_price'];
121
- }
122
-
123
- $product_data['meta']['_wpsc_special_price'] = wpsc_format_number( $product_data['meta']['_wpsc_special_price'] );
124
-
125
- if ( ! isset( $product_data['meta']['_wpsc_price'] ) ) {
126
- $product_data['meta']['_wpsc_price'] = 0;
127
- }
128
-
129
- $product_data['meta']['_wpsc_price'] = wpsc_format_number( $product_data['meta']['_wpsc_price'] );
130
 
131
  $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
132
-
133
- /* Get country name and symbol */
134
- $currency_type = get_option( 'currency_type' );
135
- $country = new WPSC_Country( $currency_type );
136
-
137
- $ct_code = $country->get_currency_code(); // Country currency code
138
- $ct_symb = $country->get_currency_symbol(); // Country symbol
139
-
140
- $price = $product_data['meta']['_wpsc_price'];
141
- $sale_price = $product_data['meta']['_wpsc_special_price'];
142
-
143
- $wp_38 = version_compare( $GLOBALS['wp_version'], '3.8', '>=' );
144
-
145
- $currency_delete_class = $wp_38 ? ' dashicons dashicons-dismiss' : '';
146
- $currency_delete_text = $wp_38 ? '' : 'x';
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. */ ?>
154
- <input type="hidden" id="product_id" name="product_id" value="<?php echo $post->ID; ?>" />
155
-
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;"
168
- name="meta[_wpsc_price]"
169
- value="<?php echo esc_attr( $price ); ?>" />
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;"
177
- value="<?php echo esc_attr( $sale_price ); ?>"
178
- name='meta[_wpsc_special_price]' />
179
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
- <div class="wpsc-currency-layers">
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>
190
- <?php
191
- if ( isset( $product_alt_currency ) && is_array( $product_alt_currency ) ) :
192
- $i = 0;
193
- foreach ( $product_alt_currency as $iso => $alt_price ) :
194
- $i++;
195
- ?>
196
- <tr class="wpsc_additional_currency">
197
- <td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>" rel="<?php echo $iso; ?>"><?php echo $currency_delete_text; ?></a></td>
198
- <td>
199
- <select name="newCurrency[]" class="newCurrency">
200
- <?php foreach ( $currency_data as $currency ) : ?>
201
- <option value="<?php echo absint( $currency['id'] ); ?>" <?php selected( $iso, $currency['isocode'] ); ?>>
202
- <?php echo esc_html( $currency['country'] ); ?> (<?php echo esc_html( $currency['currency'] ); ?>)
203
- </option>
204
- <?php endforeach; ?>
205
- </select>
206
- </td>
207
- <td><input class="newCurrPrice text" size="8" name="newCurrPrice[]" value="<?php echo esc_attr( $alt_price ); ?>" /></td>
208
- </tr>
209
- <?php
210
- endforeach;
211
- endif;
212
- ?>
213
- <tr id="wpsc_currency_row_template" class="template hidden">
214
- <td class="remove"><a href="#" class="wpsc_delete_currency_layer<?php echo $currency_delete_class; ?>"><?php echo $currency_delete_text; ?></a></td>
215
- <td>
216
- <select name="newCurrency[]" class="newCurrency">
217
- <?php foreach ( (array) $currency_data as $currency ) { ?>
218
- <option value="<?php echo absint( $currency['id'] ); ?>">
219
- <?php echo esc_html( $currency['country'] ); ?>
220
- </option>
221
- <?php } ?>
222
- </select>
223
- </td>
224
- <td><input class="newCurrPrice text" size="8" name="newCurrPrice[]" value="0.00" /></td>
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
-
232
- <div class="wpsc-quantity-discounts">
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>
242
- <?php
243
- if ( count( $product_meta['table_rate_price']['quantity'] ) > 0 ) {
244
- foreach ( (array) $product_meta['table_rate_price']['quantity'] as $key => $quantity ) {
245
- if ( $quantity != '' ) {
246
- $table_price = number_format( $product_meta['table_rate_price']['table_price'][ $key ], 2, '.', '' );
247
- ?>
248
- <tr>
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>
256
- </tr>
257
- <?php
258
- }
259
- }
260
- }
261
- ?>
262
- <tr id="wpsc_quantity_discount_row_template" class="template hidden">
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;
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  }
284
  function wpsc_stock_control_forms() {
285
  global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
286
 
287
- $product_data = get_post_custom( $post->ID );
288
  $product_data['meta'] = maybe_unserialize( $product_data );
289
 
290
- foreach ( $product_data['meta'] as $meta_key => $meta_value ) {
291
  $product_data['meta'][$meta_key] = $meta_value[0];
292
- }
293
 
294
  $product_meta = array();
295
-
296
- if ( ! empty( $product_data['_wpsc_product_metadata'] ) ) {
297
  $product_meta = maybe_unserialize( $product_data["_wpsc_product_metadata"][0] );
298
- }
299
 
300
  // this is to make sure after upgrading to 3.8.9, products will have
301
  // "notify_when_none_left" enabled by default if "unpublish_when_none_left"
302
  // is enabled.
303
- if ( ! isset( $product_meta['notify_when_none_left'] ) ) {
304
  $product_meta['notify_when_none_left'] = 0;
305
-
306
- if ( ! empty( $product_meta['unpublish_when_none_left'] ) ) {
307
  $product_meta['notify_when_none_left'] = 1;
308
- }
309
  }
310
 
311
- if ( ! isset( $product_meta['unpublish_when_none_left'] ) ) {
312
  $product_meta['unpublish_when_none_left'] = '';
313
- }
314
-
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;
322
- }
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 +269,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'] ) ) {?>
@@ -342,45 +278,31 @@ function wpsc_stock_control_forms() {
342
  <div class='edit_stock' style='display: none;'><?php
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'] ); ?>'
354
- class='stock_limit_quantity' />
355
- </div>
356
-
357
  <?php
358
- $remaining_quantity = wpsc_get_remaining_quantity( $post->ID );
359
- $reserved_quantity = $product_data['meta']['_wpsc_stock'] - $remaining_quantity;
360
- if ( $reserved_quantity ) {
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 { ?>
@@ -390,14 +312,11 @@ function wpsc_stock_control_forms() {
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
395
  }
396
-
397
- wp_nonce_field( 'update', 'wpsc_product_stock_nonce' );
398
-
399
  }
400
-
401
  function wpsc_product_taxes_forms() {
402
  global $post, $wpdb, $wpsc_product_defaults;
403
  $product_data = get_post_custom( $post->ID );
@@ -434,7 +353,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'] ) {
@@ -444,37 +363,26 @@ function wpsc_product_taxes_forms() {
444
  //add taxable amount only for exclusive tax
445
  if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) {
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'] ) ) {
454
  $taxable_amount_input_settings['value'] = $product_meta['wpec_taxes_taxable_amount'];
455
-
456
- if ( ! empty( $product_meta['wpec_taxes_taxable_amount'] ) )
457
- $taxable_amount_input_settings['value'] = wpsc_format_number(
458
- $taxable_amount_input_settings['value']
459
- );
460
  }
461
  }// if
462
 
463
- $output = '<a name="wpsc_tax"></a>';
464
- $output .= '<p>'.$wpec_taxes_controller->wpec_taxes_build_input( $taxable_checkbox_settings ).'</p>';
465
- $output .= '<p>'.$wpec_taxes_controller->wpec_taxes_display_tax_bands( $band_select_settings, $wpec_taxes_band ).'</p>';
466
- $output .= '<p>';
467
- $output .= ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) ? $wpec_taxes_controller->wpec_taxes_build_input( $taxable_amount_input_settings ) : '';
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;
475
-
476
- wp_nonce_field( 'update', 'wpsc_product_tax_nonce' );
477
-
478
  }
479
 
480
  function wpsc_product_variation_forms() {
@@ -484,10 +392,8 @@ function wpsc_product_variation_forms() {
484
  }
485
 
486
  function _wpsc_get_product_variation_form_url( $id = false ) {
487
- if ( ! $id ) {
488
  $id = get_the_ID();
489
- }
490
-
491
  return admin_url( 'admin-ajax.php?action=wpsc_product_variations_table&product_id=' . $id . '&_wpnonce=' . wp_create_nonce( 'wpsc_product_variations_table' ) );
492
  }
493
 
@@ -495,118 +401,6 @@ function wpsc_product_shipping_forms_metabox() {
495
  wpsc_product_shipping_forms();
496
  }
497
 
498
- /**
499
- * Dimension Units
500
- *
501
- * @since 3.8.13
502
- *
503
- * @return array List of valid dimension units.
504
- */
505
- function wpsc_dimension_units() {
506
- return array(
507
- 'in' => __( 'inches', 'wpsc' ),
508
- 'cm' => __( 'cm', 'wpsc' ),
509
- 'meter' => __( 'meters', 'wpsc' )
510
- );
511
- }
512
-
513
- /**
514
- * Weight Units
515
- *
516
- * @since 3.8.13
517
- *
518
- * @return array List of valid weight 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
-
529
- /**
530
- * Weight Unit Display
531
- *
532
- * Returns a weight unit abbreviation for display.
533
- *
534
- * @since 3.8.13
535
- *
536
- * @param string $unit Weight unit.
537
- * @return string Weight unit string.
538
- */
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
- }
553
-
554
- /**
555
- * Validate Dimension Unit
556
- *
557
- * Returns a valid dimensions unit.
558
- * If the unit is not set or invalid it will be filtered using 'wpsc_default_dimension_unit'
559
- * so that an alternative default unit can be set.
560
- *
561
- * @since 3.8.13
562
- *
563
- * @param string $unit Dimension unit.
564
- * @return string Dimension unit string.
565
- *
566
- * @uses wpsc_default_dimension_unit
567
- */
568
- function wpsc_validate_dimension_unit( $unit = '' ) {
569
-
570
- $default_unit = apply_filters( 'wpsc_default_dimension_unit', $unit );
571
-
572
- if ( empty( $unit ) && array_key_exists( $default_unit, wpsc_dimension_units() ) ) {
573
- $unit = $default_unit;
574
- }
575
-
576
- return $unit;
577
- }
578
-
579
- /**
580
- * Validate Weight Unit
581
- *
582
- * Returns a valid weight unit.
583
- * If the unit is not set or invalid it will be filtered using 'wpsc_default_weight_unit'
584
- * so that an alternative default unit can be set.
585
- *
586
- * @since 3.8.13
587
- *
588
- * @param string $unit Weight unit.
589
- * @return string Weight unit string.
590
- *
591
- * @uses wpsc_default_weight_unit
592
- */
593
- function wpsc_validate_weight_unit( $unit = '' ) {
594
-
595
- $default_unit = apply_filters( 'wpsc_default_weight_unit', $unit );
596
-
597
- if ( empty( $unit ) && array_key_exists( $default_unit, wpsc_weight_units() ) ) {
598
- $unit = $default_unit;
599
- }
600
-
601
- return $unit;
602
- }
603
-
604
- /**
605
- * Product Shipping Forms
606
- *
607
- * @uses wpsc_validate_weight_unit()
608
- * @uses wpsc_validate_dimension_unit()
609
- */
610
  function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'meta[_wpsc_product_metadata]', $bulk = false ) {
611
  if ( ! $product )
612
  $product_id = get_the_ID();
@@ -618,21 +412,23 @@ function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'me
618
  $meta = array();
619
 
620
  $defaults = array(
621
- 'weight' => '',
622
- 'weight_unit' => wpsc_validate_weight_unit(),
623
- 'demension_unit' => wpsc_validate_dimension_unit(),
624
- 'dimensions' => array(),
625
- 'shipping' => array(),
626
- 'no_shipping' => '',
627
  'display_weight_as' => '',
628
  );
629
  $dimensions_defaults = array(
 
 
 
630
  'height' => 0,
631
- 'width' => 0,
632
  'length' => 0,
633
  );
634
  $shipping_defaults = array(
635
- 'local' => '',
636
  'international' => '',
637
  );
638
  $meta = array_merge( $defaults, $meta );
@@ -642,75 +438,90 @@ function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'me
642
  extract( $meta, EXTR_SKIP );
643
 
644
  foreach ( $shipping as $key => &$val ) {
645
- $val = wpsc_format_number( $val );
646
- }
647
 
648
  $weight = wpsc_convert_weight( $weight, 'pound', $weight_unit );
649
 
650
- $dimension_units = wpsc_dimension_units();
651
- $weight_units = wpsc_weight_units();
 
 
 
 
 
 
 
 
 
 
652
 
653
- // Why we need this????
654
  $measurements = $dimensions;
655
  $measurements['weight'] = $weight;
656
  $measurements['weight_unit'] = $weight_unit;
657
- // End why
658
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  ?>
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]">
678
- <?php foreach ( $weight_units as $unit => $unit_label ): ?>
679
- <option value="<?php echo esc_attr( $unit ); ?>" <?php if ( ! $bulk ) selected( $unit, $measurements['weight_unit'] ); ?>><?php echo esc_html( $unit_label ); ?></option>
 
680
  <?php endforeach; ?>
681
  </select>
682
- </span>
683
- </p>
684
- <!-- END WEIGHT INPUT -->
685
-
686
- <!-- DIMENSIONS INPUT -->
687
- <p class="wpsc-form-field">
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;
695
- <input placeholder="H" type="text" id="wpsc-product-shipping-height" name="<?php echo esc_attr( $field_name_prefix ); ?>[dimensions][height]" value="<?php if ( !$bulk && $dimensions['height']>0 ) echo esc_attr( wpsc_format_number( $dimensions['height'] ) ); ?>" />
696
- <select id="wpsc-product-shipping-dimensions-unit" name="<?php echo $field_name_prefix; ?>[dimension_unit]">
697
- <?php foreach ( $dimension_units as $unit => $unit_label ): ?>
698
- <option value="<?php echo esc_attr( $unit ); ?>" <?php if ( ! $bulk && isset( $meta['dimension_unit'] ) ) selected( $unit, $meta['dimension_unit'] ); // Dirty code ?>><?php echo esc_html( $unit_label ); ?></option>
699
- <?php endforeach; ?>
700
- </select>
701
- </span>
702
- </p>
703
- <!-- END DEMENSION INPUT -->
704
-
705
  </div>
706
 
707
- <?php
708
- $currency_type = get_option( 'currency_type' );
709
- $country = new WPSC_Country( $currency_type );
710
-
711
- $ct_symb = $country->get_currency_symbol_html();
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">
@@ -718,38 +529,27 @@ function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'me
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']; ?>" />
724
- </span>
725
  </p>
726
  <p class="wpsc-form-field">
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']; ?>" />
734
- </span>
735
  </p>
736
  </div>
737
  </div>
738
- <?php
739
-
740
- wp_nonce_field( 'update', 'wpsc_product_shipping_nonce' );
741
-
742
  }
743
 
744
- /**
745
- * Product Custom Metadata Form
746
- *
747
- * @global $post Instance of WP_Post.
748
- * @global $wpdb Instance of wpdb.
749
- */
750
  function wpsc_product_advanced_forms() {
 
 
751
 
752
- global $post, $wpdb;
 
 
753
 
754
  $delete_nonce = _wpsc_create_ajax_nonce( 'remove_product_meta' );
755
 
@@ -765,201 +565,187 @@ function wpsc_product_advanced_forms() {
765
  ORDER BY
766
  LOWER(meta_key)", ARRAY_A
767
  );
 
 
768
 
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;
792
- foreach ( (array) $custom_fields as $custom_field ) {
793
- $i = $custom_field['meta_id'];
794
- $alternate = ! $alternate;
795
-
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
- }
803
 
804
- // Template for new metadata input
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
818
  }
819
-
820
- /**
821
- * Display Product External Link Meta Box Form Fields.
822
- *
823
- * @global $post Instance of WP_Post.
824
- */
825
  function wpsc_product_external_link_forms() {
826
 
827
- global $post;
 
 
 
 
 
828
 
829
  // Get External Link Values
830
- $product_meta = get_post_meta( $post->ID, '_wpsc_product_metadata', true );
831
- $product_meta = wp_parse_args( $product_meta, array(
832
- 'external_link' => '',
833
- 'external_link_text' => '',
834
- 'external_link_target' => ''
835
- ) );
836
 
837
- ?>
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' );
875
 
876
- }
877
 
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
  }
 
 
 
 
885
 
886
- /**
887
- * We really need to either bake this functionality in for 3.9.0 or rip it out into Gold Cart or something else.
888
- * So not awesome to have this exposed and unusable.
889
- *
890
- * @param WP_Post $post Product
891
- * @return void
892
- */
893
- function wpsc_product_gallery( $post ) {
894
- // pull the old iframe source for non JS users
895
- $upload_iframe_src = esc_url( get_upload_iframe_src( 'image', $post->ID ) );
896
- // get our gallery image IDs if present
897
- $images = wpsc_get_admin_product_gallery( $post->ID );
898
- // begin HTML output
899
- $output = '<div id="wpsc_product_gallery">';
900
- $output .= '<ul>';
901
- // check for images before beginngin loop
902
- if ( $images ) {
903
- // now loop images
904
- foreach ( $images as $image_id ) {
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
-
924
- // include a nonce for verification
925
- $output .= wp_nonce_field( 'wpec_product_gallery_nonce', 'wpec_product_gallery_nonce', false, false );
926
-
927
- // echo the gallery output
928
- echo $output;
929
  }
930
-
931
-
932
  function wpsc_product_download_forms() {
933
  global $post, $wpdb, $wpsc_product_defaults;
934
  $product_data = get_post_custom( $post->ID );
935
  $output = '';
936
- $product_data['meta'] = array();
937
-
938
  if ( !empty( $product_data['_wpsc_product_metadata'] ) )
939
- $product_data['meta'] = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
940
 
941
  $upload_max = wpsc_get_max_upload_size();
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>
952
 
953
  <?php
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(
964
  'post_type' => 'wpsc-preview-file',
965
  'post_parent' => $post->ID,
@@ -967,136 +753,65 @@ function wpsc_product_download_forms() {
967
  'post_status' => 'all'
968
  );
969
 
970
- $preview_files = (array) get_posts( $args );
971
 
972
- foreach ( $preview_files as $preview ) {
973
  echo $preview->post_title . '<br />';
974
- }
975
-
976
  ?>
977
- <br />
978
- <?php
979
  }
980
-
981
  $output = apply_filters( 'wpsc_downloads_metabox', $output );
982
  }
983
-
 
 
 
984
  /**
985
- * Product Personalization Form
986
- *
987
- * @global $post Instance of WP_Post.
988
  */
989
- function wpsc_product_personalization_forms() {
990
-
991
- global $post;
992
-
993
- $product_meta = get_post_meta( $post->ID, '_wpsc_product_metadata', true );
994
- $product_meta = wp_parse_args( $product_meta, array(
995
- 'engraved' => 0,
996
- 'can_have_uploaded_image' => 0
997
- ) );
998
-
999
- ?>
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' );
1015
 
 
 
 
1016
  }
 
 
 
 
 
1017
 
1018
- function wpsc_product_delivery_forms(){
1019
- $has_variations = wpsc_product_has_variations( get_post()->ID );
1020
 
1021
- $show_if_variation = $has_variations ? 'display: block;' : 'display:none;';
1022
- ?>
1023
- <em id="wpsc_product_delivery_metabox_live_title" class="wpsc_metabox_live_title">
1024
- <p></p>
1025
- </em>
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;">
1035
- <?php
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>
1043
-
1044
- <div id="wpsc_product_delivery-download" class="tabs-panel" style="display:none;">
1045
- <?php wpsc_product_download_forms(); ?>
1046
- </div>
1047
-
1048
- <div id="wpsc_product_delivery-external_link" class="tabs-panel" style="display: none;">
1049
- <?php wpsc_product_external_link_forms(); ?>
1050
- </div>
1051
- </div>
1052
- <?php
1053
  }
1054
-
1055
- function wpsc_product_details_forms(){
1056
- ?>
1057
- <em id="wpsc_product_details_metabox_live_title" class="wpsc_metabox_live_title">
1058
- <p></p>
1059
- </em>
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;">
1070
- <?php wpsc_product_gallery( get_post() ); ?>
1071
- </div>
1072
-
1073
- <div id="wpsc_product_details-desc" class="tabs-panel" style="display: none;">
1074
- <?php wpsc_additional_desc(); ?>
1075
- </div>
1076
-
1077
- <div id="wpsc_product_details-personalization" class="tabs-panel" style="display: none;">
1078
- <?php wpsc_product_personalization_forms(); ?>
1079
- </div>
1080
-
1081
- <div id="wpsc_product_details-meta" class="tabs-panel" style="display: none;">
1082
- <?php wpsc_product_advanced_forms(); ?>
1083
- </div>
1084
- </div>
1085
- <?php
1086
- }
1087
-
1088
  function wpsc_form_multipart_encoding() {
1089
  echo ' enctype="multipart/form-data"';
1090
  }
1091
 
1092
  add_action( 'post_edit_form_tag', 'wpsc_form_multipart_encoding' );
1093
 
 
 
 
 
 
1094
  /*
1095
  * Modifications to Media Gallery
1096
  */
1097
 
 
 
 
 
 
 
1098
  add_filter( 'attachment_fields_to_edit', 'wpsc_attachment_fields', 11, 2 );
1099
  add_filter( 'attachment_fields_to_save', 'wpsc_save_attachment_fields', 9, 2 );
 
1100
  add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
1101
 
1102
  /*
@@ -1111,7 +826,7 @@ add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
1111
  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' );
@@ -1119,6 +834,28 @@ function wpsc_filter_gettex_with_context( $translation, $text, $context, $domain
1119
  return $translation;
1120
  }
1121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1122
  function wpsc_attachment_fields( $form_fields, $post ) {
1123
  $out = '';
1124
 
@@ -1127,8 +864,7 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1127
  else
1128
  $parent_post = get_post( $post->post_parent );
1129
 
1130
- // check if post is set before accessing
1131
- if ( isset( $parent_post ) && $parent_post->post_type == "wpsc-product" ) {
1132
 
1133
  //Unfortunate hack, as I'm not sure why the From Computer tab doesn't process filters the same way the Gallery does
1134
  ob_start();
@@ -1221,118 +957,185 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1221
 
1222
  }
1223
  function wpsc_save_attachment_fields( $post, $attachment ) {
1224
-
1225
- if ( isset( $attachment['wpsc_custom_thumb_w'] ) ) {
1226
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_w', $attachment['wpsc_custom_thumb_w'] );
1227
- }
1228
 
1229
- if ( isset( $attachment['wpsc_custom_thumb_h'] ) ) {
1230
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_h', $attachment['wpsc_custom_thumb_h'] );
1231
- }
1232
 
1233
- if ( isset( $attachment['wpsc_image_size'] ) ) {
1234
  update_post_meta( $post['ID'], '_wpsc_selected_image_size', $attachment['wpsc_image_size'] );
1235
- }
1236
 
1237
  return $post;
1238
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1239
 
1240
  /**
1241
- * Save Product Quick Edit Box
1242
- *
1243
- * Saves input for the various meta in the quick edit boxes.
1244
  *
1245
- * @todo UI.
1246
- * @todo Data validation / sanitization / security.
1247
- * @todo AJAX should probably return weight unit.
1248
- *
1249
- * @return int $post_id Post ID.
1250
  */
1251
- function wpsc_save_quickedit_box( $post_id ) {
1252
 
 
1253
  global $doaction;
1254
 
1255
- // Only save product if saving (not autosaving) via AJAX.
1256
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || get_post_type( $post_id ) != 'wpsc-product' ) {
1257
  return;
1258
- }
1259
 
1260
- $bulk = isset( $doaction ) && $doaction == 'edit';
1261
 
1262
- // Map post field to meta key.
1263
  $custom_fields = array(
1264
- 'weight' => 'product_metadata',
1265
- 'stock' => 'stock',
1266
- 'price' => 'price',
1267
  'sale_price' => 'special_price',
1268
- 'sku' => 'sku'
1269
  );
1270
 
1271
- // Get product variations (if any).
1272
- $children = get_children( array(
1273
- 'post_parent' => $post_id,
1274
- 'post_type' => 'wpsc-product',
1275
- 'post_status' => 'inherit'
1276
- ) );
1277
- $is_parent = (bool) $children;
1278
-
1279
  foreach ( $custom_fields as $post_key => $meta_key ) {
1280
-
1281
- // Don't update if field is not set or we're bulk updating and the field is left blank.
1282
- if ( ! isset( $_REQUEST[ $post_key ] ) || ( $bulk && empty( $_REQUEST[ $post_key ] ) ) ) {
 
1283
  continue;
1284
  }
1285
 
1286
- // Don't update if the product has variations and the field is one of the defined custom fields (unless overridden).
1287
- $override_variant = isset( $_REQUEST[ $post_key . '_variant' ] ) && $_REQUEST[ $post_key . '_variant' ] == 'on';
1288
- if ( $is_parent && ! $override_variant && in_array( $post_key, array_keys( $custom_fields ) ) ) {
1289
- continue;
1290
  }
1291
 
1292
- // Select single product or variation IDs.
1293
- if ( $is_parent && count( $children ) > 0 ) {
1294
- $products = wp_list_pluck( $children, 'ID' );
1295
- } else {
1296
- $products = array( $post_id );
1297
- }
1298
-
1299
- foreach ( $products as $post_id ) {
1300
- $value = $_REQUEST[ $post_key ];
1301
-
1302
- // Validate custom field values
1303
  switch ( $post_key ) {
1304
-
1305
  case 'weight':
1306
  $product_meta = get_post_meta( $post_id, '_wpsc_product_metadata', true );
1307
- if ( ! is_array( $product_meta ) ) {
1308
  $product_meta = array();
1309
- }
 
 
1310
 
1311
- // Draft products don't have product metadata set yet
1312
- $weight_unit = isset( $product_meta['weight_unit'] ) ? $product_meta['weight_unit'] : 'pound';
1313
- $weight = wpsc_convert_weight( $value, $weight_unit, 'pound', true );
1314
 
1315
- if ( isset( $product_meta['weight'] ) ) {
1316
- unset( $product_meta['weight'] );
1317
- }
1318
-
1319
- $product_meta['weight'] = $weight;
1320
 
1321
  $value = $product_meta;
1322
  break;
1323
 
1324
  case 'stock':
1325
- if ( ! is_numeric( $value ) ) {
1326
  $value = '';
1327
- }
1328
  break;
1329
 
1330
  case 'sku':
1331
- if ( $value == __( 'N/A', 'wpsc' ) ) {
1332
  $value = '';
1333
- }
1334
  break;
1335
-
1336
  }
1337
 
1338
  update_post_meta( $post_id, "_wpsc_{$meta_key}", $value );
@@ -1340,7 +1143,6 @@ function wpsc_save_quickedit_box( $post_id ) {
1340
  }
1341
 
1342
  return $post_id;
1343
-
1344
  }
1345
 
1346
  /**
@@ -1360,60 +1162,60 @@ function wpsc_quick_edit_boxes( $col_name, $_screen_post_type = null ) {
1360
  ?>
1361
 
1362
  <fieldset class="inline-edit-col-left wpsc-cols">
1363
- <div class="inline-edit-col">
1364
- <div class="inline-edit-group">
1365
  <?php
1366
  switch ( $col_name ) :
1367
  case 'SKU' :
1368
  ?>
1369
- <label style="max-width: 85%" class="alignleft">
1370
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'SKU:', 'wpsc' ); ?> </span>
1371
- <input type="text" name="sku" class="wpsc_ie_sku" />
1372
  <input type="checkbox" name="sku_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1373
 
1374
- </label>
1375
- <?php
1376
  break;
1377
  case 'weight' :
1378
  ?>
1379
- <label style="max-width: 85%" class="alignleft">
1380
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Weight:', 'wpsc' ); ?> </span>
1381
- <input type="text" name="weight" class="wpsc_ie_weight" />
1382
  <input type="checkbox" name="weight_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1383
- </label>
1384
- <?php
1385
  break;
1386
  case 'stock' :
1387
  ?>
1388
- <label style="max-width: 85%" class="alignleft">
1389
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Stock:', 'wpsc' ); ?> </span>
1390
- <input type="text" name="stock" class="wpsc_ie_stock" />
1391
  <input type="checkbox" name="stock_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1392
- </label>
1393
- <?php
1394
  break;
1395
  case 'price' :
1396
  ?>
1397
- <label style="max-width: 85%" class="alignleft">
1398
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Price:', 'wpsc' ); ?> </span>
1399
- <input type="text" name="price" class="wpsc_ie_price" />
1400
  <input type="checkbox" name="price_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1401
- </label>
1402
- <?php
1403
  break;
1404
  case 'sale_price' :
1405
  ?>
1406
- <label style="max-width: 85%" class="alignleft">
1407
- <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Sale Price:', 'wpsc' ); ?> </span>
1408
- <input type="text" name="sale_price" class="wpsc_ie_sale_price" />
1409
  <input type="checkbox" name="sale_price_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1410
- </label>
1411
- <?php
1412
  break;
1413
  endswitch;
1414
  ?>
1415
- </div>
1416
- </div>
1417
  </fieldset>
1418
  <?php
1419
  }
@@ -1467,13 +1269,13 @@ function variation_price_field( $variation ) {
1467
  } else{
1468
  ?>
1469
  <tr class="form-field">
1470
- <th scope="row" valign="top">
1471
  <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wpsc' ); ?></label>
1472
- </th>
1473
- <td>
1474
  <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1475
  <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>
1476
- </td>
1477
  </tr>
1478
  <?php
1479
  }
@@ -1535,11 +1337,12 @@ add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field_check' );
1535
 
1536
  /**
1537
  * @todo - Should probably refactor this at some point - very procedural,
1538
- * WAY too many foreach loops for my liking :) But it does the trick
1539
  *
1540
  * @param <type> $term_id
1541
  */
1542
  function save_term_prices( $term_id ) {
 
1543
  // First - Saves options from input
1544
  if ( isset( $_POST['variation_price'] ) || isset( $_POST["apply_to_current"] ) ) {
1545
 
@@ -1554,6 +1357,16 @@ function save_term_prices( $term_id ) {
1554
  // Second - If box was checked, let's then check whether or not it was flat, differential, or percentile, then let's apply the pricing to every product appropriately
1555
  if ( isset( $_POST["apply_to_current"] ) ) {
1556
 
 
 
 
 
 
 
 
 
 
 
1557
  //Now, find all products with this term_id, update their pricing structure (terms returned include only parents at this point, we'll grab relevent children soon)
1558
  $products_to_mod = get_objects_in_term( $term_id, "wpsc-variation" );
1559
  $product_parents = array( );
@@ -1614,91 +1427,4 @@ function wpsc_delete_variations( $postid ) {
1614
  wp_delete_post( $variation->ID, true );
1615
  }
1616
  }
1617
- add_action( 'before_delete_post', 'wpsc_delete_variations' );
1618
-
1619
-
1620
- /**
1621
- * fetch the items for display inside the admin product gallery
1622
- * differs from the original `wpsc_get_product_gallery` in that
1623
- * it only checks the postmeta for an actual gallery generated by
1624
- * the user instead of pulling all attachments
1625
- *
1626
- * @since 3.8.14.2
1627
- *
1628
- * @param integer $product_id the product ID of the product
1629
- * @return array $gallery the attachment IDs of the gallery if present
1630
- */
1631
- function wpsc_get_admin_product_gallery( $product_id = 0 ) {
1632
-
1633
- // grab our meta from the DB
1634
- $gallery = get_post_meta( $product_id, '_wpsc_product_gallery', true );
1635
-
1636
- // no custom gallery was created, so return nothing
1637
- if ( ! $gallery ) {
1638
- return;
1639
- }
1640
-
1641
- // now make sure the IDs present are actual attachments
1642
- // by looping and unsetting them
1643
- //
1644
- // may want to add a MIME type check here, but not sure
1645
- // if that would cause issues if people use non-images
1646
- // in their galleries
1647
- foreach( $gallery as $key => $image_id ) {
1648
- if ( get_post_type( $image_id ) !== 'attachment' ) {
1649
- unset( $gallery[$key] );
1650
- }
1651
- }
1652
-
1653
- // somehow everything in the gallery
1654
- // was not an attachment, so bail
1655
- if ( empty( $gallery ) ) {
1656
- return;
1657
- }
1658
-
1659
- // send it back
1660
- return $gallery;
1661
-
1662
- }
1663
-
1664
- /**
1665
- * save our gallery IDs on post save
1666
- *
1667
- * @since 3.8.14.2
1668
- * @param integer $product_id the post ID being passed
1669
- * @return void
1670
- */
1671
- function wpsc_new_gallery_save( $product_id = 0 ) {
1672
-
1673
- // do our nonce check. ALWAYS A NONCE CHECK
1674
- if ( ! isset( $_POST['wpsc_product_gallery_nonce'] ) || ! wp_verify_nonce( $_POST['wpsc_product_gallery_nonce'], 'wpsc_product_gallery_nonce' ) ) {
1675
- return $product_id;
1676
- }
1677
-
1678
- // set an empty array for the image IDs
1679
- $image_ids = array();
1680
-
1681
- // ok. we have image IDs to work with. do some filtering
1682
- if ( ! empty( $_POST['wpsc-product-gallery-imgs'] ) ) {
1683
- // make sure our IDs are set to an array
1684
- $image_ids = (array) $_POST['wpsc-product-gallery-imgs'];
1685
- // ensure nothing non-numeric got added in
1686
- $image_ids = wp_parse_id_list( $image_ids );
1687
- // filter out any empty items
1688
- $image_ids = array_filter( $image_ids );
1689
- }
1690
-
1691
- // now if we have image IDs left after filtering, save them
1692
- // if not, delete the meta key
1693
- if ( ! empty( $image_ids ) ) {
1694
- update_post_meta( $product_id, '_wpsc_product_gallery', $image_ids );
1695
- } else {
1696
- delete_post_meta( $product_id, '_wpsc_product_gallery' );
1697
- }
1698
-
1699
- // add an action for after the gallery being saved
1700
- // passing the post ID and the image IDs
1701
- do_action( 'wpsc_after_gallery_save', $product_id, $image_ids );
1702
-
1703
- }
1704
- add_action( 'wpsc_edit_product', 'wpsc_new_gallery_save' );
7
  */
8
 
9
  global $wpsc_product_defaults;
 
10
  $wpsc_product_defaults = array(
11
  'id' => '0',
12
  'name' => '',
33
  'no_shipping' => '0',
34
  'thumbnail_image' => '',
35
  'thumbnail_state' => '1',
36
+ 'meta' =>
37
+ array(
38
  'external_link' => NULL,
39
  'external_link_text' => NULL,
40
  'external_link_target' => NULL,
41
  'merchant_notes' => NULL,
42
  'sku' => NULL,
43
+ 'engrave' => '0',
44
  'can_have_uploaded_image' => '0',
45
+ 'table_rate_price' =>
46
+ array(
47
+ 'quantity' =>
48
+ array(
49
  0 => '',
50
  ),
51
+ 'table_price' =>
52
+ array(
53
  0 => '',
54
  ),
55
  ),
56
  ),
57
  );
58
+ add_action( 'admin_head', 'wpsc_css_header' );
59
 
60
  function wpsc_redirect_variation_update( $location, $post_id ) {
61
  global $post;
 
62
  if ( $post->post_parent > 0 && 'wpsc-product' == $post->post_type )
63
  wp_redirect( admin_url( 'post.php?post='.$post->post_parent.'&action=edit' ) );
64
  else
67
  }
68
 
69
  add_filter( 'redirect_post_location', 'wpsc_redirect_variation_update', 10, 2 );
70
+ function wpsc_css_header() {
71
+ global $post_type;
72
+ ?>
73
+ <style type="text/css">
74
+ <?php if ( isset( $_GET['post_type'] ) && ( 'wpsc-product' == $_GET['post_type'] ) || ( !empty( $post_type ) && 'wpsc-product' == $post_type ) ) : ?>
75
+ #icon-edit { background:transparent url('<?php echo WPSC_CORE_IMAGES_URL.'/icon32.png';?>') no-repeat; }
76
+ <?php endif; ?>
77
+ </style>
78
+ <?php
79
+ }
80
  function wpsc_price_control_forms() {
81
  global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
82
+ $product_data = get_post_custom( $post->ID );
 
83
  $product_data['meta'] = maybe_unserialize( $product_data );
84
 
85
+ foreach ( $product_data['meta'] as $meta_key => $meta_value )
86
  $product_data['meta'][$meta_key] = $meta_value[0];
 
87
 
88
  $product_meta = array();
89
+ if ( !empty( $product_data["_wpsc_product_metadata"] ) )
90
+ $product_meta = maybe_unserialize( $product_data["_wpsc_product_metadata"][0] );
91
 
92
+ if ( isset( $product_data['meta']['_wpsc_currency'] ) )
 
 
 
 
93
  $product_alt_currency = maybe_unserialize( $product_data['meta']['_wpsc_currency'] );
 
94
 
95
+ if ( !isset( $product_data['meta']['_wpsc_table_rate_price'] ) ) {
96
  $product_data['meta']['_wpsc_table_rate_price'] = $wpsc_product_defaults['meta']['table_rate_price'];
97
  }
 
98
  if ( isset( $product_meta['_wpsc_table_rate_price'] ) ) {
99
+ $product_meta['table_rate_price']['state'] = 1;
100
+ $product_meta['table_rate_price'] += $product_meta['_wpsc_table_rate_price'];
101
  $product_data['meta']['_wpsc_table_rate_price'] = $product_meta['_wpsc_table_rate_price'];
102
  }
103
 
104
 
105
+ if ( !isset( $product_data['meta']['_wpsc_is_donation'] ) )
106
  $product_data['meta']['_wpsc_is_donation'] = $wpsc_product_defaults['donation'];
 
107
 
108
+ if ( !isset( $product_meta['table_rate_price']['state'] ) )
109
  $product_meta['table_rate_price']['state'] = null;
 
110
 
111
+ if ( !isset( $product_meta['table_rate_price']['quantity'] ) )
112
  $product_meta['table_rate_price']['quantity'] = $wpsc_product_defaults['meta']['table_rate_price']['quantity'][0];
 
113
 
114
+ if ( !isset( $product_data['meta']['_wpsc_price'] ) )
115
  $product_data['meta']['_wpsc_price'] = $wpsc_product_defaults['price'];
 
116
 
117
+ if ( !isset( $product_data['special'] ) )
118
  $product_data['special'] = $wpsc_product_defaults['special'];
 
119
 
120
+ if ( !isset( $product_data['meta']['_wpsc_special_price'] ) )
121
  $product_data['meta']['_wpsc_special_price'] = $wpsc_product_defaults['special_price'];
 
 
 
 
 
 
 
 
 
122
 
123
  $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  ?>
125
+ <input type="hidden" id="parent_post" name="parent_post" value="<?php echo $post->post_parent; ?>" />
126
+ <?php /* Lots of tedious work is avoided with this little line. */ ?>
127
+ <input type="hidden" id="product_id" name="product_id" value="<?php echo $post->ID; ?>" />
128
+
129
+ <?php /* Check product if a product has variations */ ?>
130
+ <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
131
+ <?php $price = wpsc_product_variation_price_available( $post->ID ); ?>
132
+ <p><?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>
133
+ <p><?php printf( __( 'Price: %s and above.' , 'wpsc' ) , $price ); ?></p>
 
 
 
 
134
  <?php else: ?>
135
 
136
+ <div class='wpsc_floatleft' style="width:85px;">
137
+ <label><?php esc_html_e( 'Price', 'wpsc' ); ?>:</label><br />
138
+ <input type='text' class='text' size='10' name='meta[_wpsc_price]' value='<?php echo ( isset($product_data['meta']['_wpsc_price']) ) ? number_format( (float)$product_data['meta']['_wpsc_price'], 2, '.', '' ) : '0.00'; ?>' />
 
 
 
 
139
  </div>
140
+ <div class='wpsc_floatleft' style='display:<?php if ( ( $product_data['special'] == 1 ) ? 'block' : 'none'
141
+ ); ?>; width:85px; margin-left:30px;'>
142
+ <label for='add_form_special'><?php esc_html_e( 'Sale Price', 'wpsc' ); ?>:</label>
143
+ <div id='add_special'>
144
+ <input type='text' size='10' value='<?php echo ( isset($product_data['meta']['_wpsc_special_price']) ) ? number_format( (float)$product_data['meta']['_wpsc_special_price'], 2, '.', '' ) : '0.00' ; ?>' name='meta[_wpsc_special_price]' />
145
+ </div>
 
 
146
  </div>
147
+ <br style="clear:both" />
148
+ <br style="clear:both" />
149
+ <a href='#' class='wpsc_add_new_currency'><?php esc_html_e( '+ New Currency', 'wpsc' ); ?></a>
150
+ <br />
151
+ <!-- add new currency layer -->
152
+ <div class='new_layer'>
153
+ <label for='newCurrency[]'><?php esc_html_e( 'Currency type', 'wpsc' ); ?>:</label><br />
154
+ <select name='newCurrency[]' class='newCurrency' style='width:42%'>
155
+ <?php
156
+ foreach ( (array)$currency_data as $currency ) {?>
157
+ <option value='<?php echo $currency['id']; ?>' >
158
+ <?php echo htmlspecialchars( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)
159
+ </option> <?php
160
+ } ?>
161
+ </select>
162
+ <?php esc_html_e( 'Price', 'wpsc' ); ?> :
163
+ <input type='text' class='text' size='8' name='newCurrPrice[]' value='0.00' style='display:inline' />
164
+ <a href='' class='wpsc_delete_currency_layer'><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/cross.png' /></a>
165
+
166
+ </div> <!-- close new_layer -->
167
+ <?php
168
+ if ( isset( $product_alt_currency ) && is_array( $product_alt_currency ) ) :
169
+ $i = 0;
170
+ foreach ( $product_alt_currency as $iso => $alt_price ) {
171
+ $i++; ?>
172
+ <div class='wpsc_additional_currency'>
173
+ <label for='newCurrency[]'><?php esc_html_e( 'Currency type', 'wpsc' ); ?>:</label><br />
174
+ <select name='newCurrency[]' class='newCurrency' style='width:42%'> <?php
175
+ foreach ( $currency_data as $currency ) {
176
+ if ( $iso == $currency['isocode'] )
177
+ $selected = "selected='selected'";
178
+ else
179
+ $selected = ""; ?>
180
+ <option value='<?php echo $currency['id']; ?>' <?php echo $selected; ?> >
181
+ <?php echo htmlspecialchars( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)
182
+ </option> <?php
183
+ } ?>
184
+ </select>
185
+ <?php esc_html_e( 'Price:', 'wpsc' ); ?> <input type='text' class='text' size='8' name='newCurrPrice[]' value='<?php echo $alt_price; ?>' style=' display:inline' />
186
+ <a href='' class='wpsc_delete_currency_layer' rel='<?php echo $iso; ?>'><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/cross.png' /></a></div>
187
+ <?php }
188
 
189
+ endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
+ echo "<br style='clear:both' />
192
+ <br/><input id='add_form_donation' type='checkbox' name='meta[_wpsc_is_donation]' value='yes' " . ( isset($product_data['meta']['_wpsc_is_donation']) && ( $product_data['meta']['_wpsc_is_donation'] == 1 ) ? 'checked="checked"' : '' ) . " />&nbsp;<label for='add_form_donation'>" . __( 'This is a donation, checking this box populates the donations widget.', 'wpsc' ) . "</label>";
193
+ ?>
194
+ <br /><br /> <input type='checkbox' value='1' name='table_rate_price[state]' id='table_rate_price' <?php echo ( ( isset($product_meta['table_rate_price']['state']) && (bool)$product_meta['table_rate_price']['state'] == true ) ? 'checked=\'checked\'' : '' ); ?> />
195
+ <label for='table_rate_price'><?php esc_html_e( 'Table Rate Price', 'wpsc' ); ?></label>
196
+ <div id='table_rate'>
197
+ <a class='add_level' style='cursor:pointer;'><?php esc_html_e( '+ Add level', 'wpsc' ); ?></a><br />
198
+ <br style='clear:both' />
199
+ <table>
200
+ <tr>
201
+ <th><?php esc_html_e( 'Quantity In Cart', 'wpsc' ); ?></th>
202
+ <th colspan='2'><?php esc_html_e( 'Discounted Price', 'wpsc' ); ?></th>
203
+ </tr>
204
+ <?php
205
+ if ( count( $product_meta['table_rate_price']['quantity'] ) > 0 ) {
206
+ foreach ( (array)$product_meta['table_rate_price']['quantity'] as $key => $quantity ) {
207
+ if ( $quantity != '' ) {
208
+ $table_price = number_format( $product_meta['table_rate_price']['table_price'][$key], 2, '.', '' );
209
+ ?>
210
+ <tr>
211
+ <td>
212
+ <input type="text" size="5" value="<?php echo $quantity; ?>" name="table_rate_price[quantity][]"/><span class='description'><?php esc_html_e( 'and above', 'wpsc' ); ?></span>
213
+ </td>
214
+ <td>
215
+ <input type="text" size="10" value="<?php echo $table_price; ?>" name="table_rate_price[table_price][]" />
216
+ </td>
217
+ <td><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/cross.png" class="remove_line" /></td>
218
+ </tr>
219
+ <?php
220
+ }
221
+ }
222
+ }
223
+ ?>
224
+ <tr>
225
+ <td><input type="text" size="5" value="" name="table_rate_price[quantity][]"/><span class='description'><?php esc_html_e( 'and above', 'wpsc' ); ?></span> </td>
226
+ <td><input type='text' size='10' value='' name='table_rate_price[table_price][]'/></td>
227
+ </tr>
228
+ </table>
229
+ </div>
230
+ <?php endif; ?>
231
+ <?php
232
  }
233
  function wpsc_stock_control_forms() {
234
  global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
235
 
236
+ $product_data = get_post_custom( $post->ID );
237
  $product_data['meta'] = maybe_unserialize( $product_data );
238
 
239
+ foreach ( $product_data['meta'] as $meta_key => $meta_value )
240
  $product_data['meta'][$meta_key] = $meta_value[0];
 
241
 
242
  $product_meta = array();
243
+ if ( !empty( $product_data["_wpsc_product_metadata"] ) )
 
244
  $product_meta = maybe_unserialize( $product_data["_wpsc_product_metadata"][0] );
 
245
 
246
  // this is to make sure after upgrading to 3.8.9, products will have
247
  // "notify_when_none_left" enabled by default if "unpublish_when_none_left"
248
  // is enabled.
249
+ if ( !isset( $product_meta['notify_when_none_left'] ) ) {
250
  $product_meta['notify_when_none_left'] = 0;
251
+ if ( ! empty( $product_meta['unpublish_when_none_left'] ) )
 
252
  $product_meta['notify_when_none_left'] = 1;
 
253
  }
254
 
255
+ if ( !isset( $product_meta['unpublish_when_none_left'] ) )
256
  $product_meta['unpublish_when_none_left'] = '';
 
 
 
 
 
 
 
 
 
 
257
 
258
  if ( ! empty( $product_meta['unpublish_when_none_left'] ) && ! isset( $product_meta['notify_when_none_left'] ) )
259
+
260
  ?>
261
+
262
+ <label for="wpsc_sku"><abbr title="<?php esc_attr_e( 'Stock Keeping Unit', 'wpsc' ); ?>"><?php esc_html_e( 'SKU:', 'wpsc' ); ?></abbr></label>
263
  <?php
264
  if ( !isset( $product_data['meta']['_wpsc_sku'] ) )
265
  $product_data['meta']['_wpsc_sku'] = $wpsc_product_defaults['meta']['sku']; ?><br />
269
  if ( !isset( $product_data['meta']['_wpsc_stock'] ) )
270
  $product_data['meta']['_wpsc_stock'] = ''; ?>
271
  <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]' />
272
+ <label for='add_form_quantity_limited' class='small'><?php esc_html_e( 'I have limited stock for this Product', 'wpsc' ); ?></label>
273
  <?php
274
  if ( $post->ID > 0 ) {
275
  if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {?>
278
  <div class='edit_stock' style='display: none;'><?php
279
  } ?>
280
  <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
281
+ <?php $stock = wpsc_variations_stock_remaining( $post->ID ); ?>
282
+ <p><?php esc_html_e( 'This Product has variations, to edit the quantity please use the Variation Controls below.' , 'wpsc' ); ?></p>
283
  <p><?php printf( _n( "%s variant item in stock.", "%s variant items in stock.", $stock, 'wpsc' ), $stock ); ?></p>
284
  <?php else: ?>
285
+ <label for="stock_limit_quantity"><?php esc_html_e( 'Quantity:', 'wpsc' ); ?></label>
286
+ <input type='text' id="stock_limit_quantity" name='meta[_wpsc_stock]' size='3' value='<?php echo $product_data['meta']['_wpsc_stock']; ?>' class='stock_limit_quantity' />
287
+ <?php
288
+ $remaining_quantity = wpsc_get_remaining_quantity( $post->ID );
289
+ $reserved_quantity = $product_data['meta']['_wpsc_stock'] - $remaining_quantity;
290
+ if($reserved_quantity): ?>
291
+ <p><em>
 
292
  <?php
293
+ printf(_n('%s of them is reserved for pending or recently completed orders.', '%s of them are reserved for pending or recently completed orders.', $reserved_quantity, 'wpsc'), $reserved_quantity);
 
 
 
 
 
 
 
 
 
294
  ?>
295
+ </em></p>
296
+ <?php endif; ?>
297
  <?php endif; ?>
 
 
298
  <div class='notify_when_none_left'>
299
+ <input type='checkbox' id="notify_when_oos" name='meta[_wpsc_product_metadata][notify_when_none_left]' class='notify_when_oos'<?php checked( $product_meta['notify_when_none_left'] ); ?> />
300
+ <label for="notify_when_oos"><?php esc_html_e( 'Notify site owner if stock runs out', 'wpsc' ); ?></label>
 
 
301
  </div>
302
  <div class='unpublish_when_none_left'>
303
+ <input type='checkbox' id="unpublish_when_oos" name='meta[_wpsc_product_metadata][unpublish_when_none_left]' class='unpublish_when_oos'<?php checked( $product_meta['unpublish_when_none_left'] ); ?> />
304
+ <label for="unpublish_when_oos"><?php esc_html_e( 'Unpublish this Product if stock runs out', 'wpsc' ); ?></label>
305
+ <p><em><?php esc_html_e( 'If stock runs out, this Product will not be available on the shop unless you untick this box or add more stock.', 'wpsc' ); ?></em></p>
 
 
306
  </div>
307
  </div> <?php
308
  } else { ?>
312
  <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' ); ?>
313
  <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' ); ?>
314
  </div>
315
+ </div><?php
 
316
  }
317
+ ?>
318
+ <?php
 
319
  }
 
320
  function wpsc_product_taxes_forms() {
321
  global $post, $wpdb, $wpsc_product_defaults;
322
  $product_data = get_post_custom( $post->ID );
353
  'type' => 'checkbox',
354
  'id' => 'wpec_taxes_taxable',
355
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable]',
356
+ 'label' => __( 'This product is not taxable.', 'wpsc' )
357
  );
358
 
359
  if ( isset( $product_meta['wpec_taxes_taxable'] ) && 'on' == $product_meta['wpec_taxes_taxable'] ) {
363
  //add taxable amount only for exclusive tax
364
  if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) {
365
  $taxable_amount_input_settings = array(
366
+ 'id' => 'wpec_taxes_taxable_amount',
367
+ 'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable_amount]',
368
+ 'label' => __( 'Taxable Amount', 'wpsc' ),
369
  'description' => __( 'Taxable amount in your currency, not percentage of price.', 'wpsc' ),
370
  );
371
 
372
  if ( isset( $product_meta['wpec_taxes_taxable_amount'] ) ) {
373
  $taxable_amount_input_settings['value'] = $product_meta['wpec_taxes_taxable_amount'];
 
 
 
 
 
374
  }
375
  }// if
376
 
377
+ ?> <a name="wpsc_tax"></a>
378
+ <p><?php echo $wpec_taxes_controller->wpec_taxes_display_tax_bands( $band_select_settings, $wpec_taxes_band ); ?></p>
379
+ <p>
380
+ <?php if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ): ?>
381
+ <?php echo $wpec_taxes_controller->wpec_taxes_build_input( $taxable_amount_input_settings );?>
382
+ <?php endif;?>
383
+ </p>
384
+ <p><?php echo $wpec_taxes_controller->wpec_taxes_build_input( $taxable_checkbox_settings ); ?></p>
385
+ <?php
 
 
 
 
 
 
386
  }
387
 
388
  function wpsc_product_variation_forms() {
392
  }
393
 
394
  function _wpsc_get_product_variation_form_url( $id = false ) {
395
+ if ( ! $id )
396
  $id = get_the_ID();
 
 
397
  return admin_url( 'admin-ajax.php?action=wpsc_product_variations_table&product_id=' . $id . '&_wpnonce=' . wp_create_nonce( 'wpsc_product_variations_table' ) );
398
  }
399
 
401
  wpsc_product_shipping_forms();
402
  }
403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  function wpsc_product_shipping_forms( $product = false, $field_name_prefix = 'meta[_wpsc_product_metadata]', $bulk = false ) {
405
  if ( ! $product )
406
  $product_id = get_the_ID();
412
  $meta = array();
413
 
414
  $defaults = array(
415
+ 'weight' => '',
416
+ 'weight_unit' => '',
417
+ 'dimensions' => array(),
418
+ 'shipping' => array(),
419
+ 'no_shipping' => '',
 
420
  'display_weight_as' => '',
421
  );
422
  $dimensions_defaults = array(
423
+ 'height_unit' => '',
424
+ 'width_unit' => '',
425
+ 'length_unit' => '',
426
  'height' => 0,
427
+ 'width' => 0,
428
  'length' => 0,
429
  );
430
  $shipping_defaults = array(
431
+ 'local' => '',
432
  'international' => '',
433
  );
434
  $meta = array_merge( $defaults, $meta );
438
  extract( $meta, EXTR_SKIP );
439
 
440
  foreach ( $shipping as $key => &$val ) {
441
+ $val = number_format( (float) $val, 2 );
442
+ }
443
 
444
  $weight = wpsc_convert_weight( $weight, 'pound', $weight_unit );
445
 
446
+ $dimension_units = array(
447
+ 'in' => __( 'inches', 'wpsc' ),
448
+ 'cm' => __( 'cm', 'wpsc' ),
449
+ 'meter' => __( 'meters', 'wpsc' )
450
+ );
451
+
452
+ $weight_units = array(
453
+ 'pound' => __( 'pounds', 'wpsc' ),
454
+ 'ounce' => __( 'ounces', 'wpsc' ),
455
+ 'gram' => __( 'grams', 'wpsc' ),
456
+ 'kilogram' => __( 'kilograms', 'wpsc' )
457
+ );
458
 
 
459
  $measurements = $dimensions;
460
  $measurements['weight'] = $weight;
461
  $measurements['weight_unit'] = $weight_unit;
 
462
 
463
+ $measurement_fields = array(
464
+ array(
465
+ 'name' => 'weight',
466
+ 'prefix' => '',
467
+ 'label' => __( 'Weight', 'wpsc' ),
468
+ 'value' => $weight,
469
+ 'units' => $weight_units,
470
+ ),
471
+ array(
472
+ 'name' => 'height',
473
+ 'prefix' => '[dimensions]',
474
+ 'label' => __( 'Height', 'wpsc' ),
475
+ 'value' => $dimensions['height'],
476
+ 'units' => $dimension_units,
477
+ ),
478
+ array(
479
+ 'name' => 'width',
480
+ 'prefix' => '[dimensions]',
481
+ 'label' => __( 'Width', 'wpsc' ),
482
+ 'value' => $dimensions['width'],
483
+ 'units' => $dimension_units,
484
+ ),
485
+ array(
486
+ 'name' => 'length',
487
+ 'prefix' => '[dimensions]',
488
+ 'label' => __( 'Length', 'wpsc' ),
489
+ 'value' => $dimensions['length'],
490
+ 'units' => $dimension_units,
491
+ ),
492
+ );
493
  ?>
494
  <div class="wpsc-stock-editor<?php if ( $bulk ) echo ' wpsc-bulk-edit' ?>">
495
  <p class="wpsc-form-field">
496
+ <label><?php esc_html_e( 'Disregard Shipping for this Product', 'wpsc' ); ?></label>&nbsp;&nbsp;
497
+ <label><input type="radio" name="<?php echo $field_name_prefix ?>[no_shipping]" value="1" <?php checked( $no_shipping && ! $bulk ); ?> /> <?php echo esc_html_x( 'Yes', 'disregard shipping', 'wpsc' ); ?></label>&nbsp;&nbsp;
498
+ <label><input type="radio" name="<?php echo $field_name_prefix ?>[no_shipping]" value="0" <?php checked( ! $no_shipping && ! $bulk ); ?> /> <?php echo esc_html_x( 'No', 'disregard shipping', 'wpsc' ); ?></label>&nbsp;&nbsp;
499
  </p>
500
 
501
  <div class="wpsc-product-shipping-section wpsc-product-shipping-weight-dimensions">
502
+ <p><strong><?php esc_html_e( 'Weight and Dimensions', 'wpsc' ); ?></strong></p>
503
+ <?php
504
+ foreach ( $measurement_fields as $field ):
505
+ ?>
506
+ <p class="wpsc-form-field">
507
+ <?php if ( $bulk ): ?>
508
+ <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][measurements][<?php echo $field['name'] ?>]" value="1" />
509
+ <?php endif ?>
510
+ <label for="wpsc-product-shipping-<?php echo $field['name']; ?>"><?php echo esc_html( $field['label'] ); ?></label>
511
+ <span class="wpsc-product-shipping-input">
512
+ <input type="text" id="wpsc-product-shipping-<?php echo $field['name']; ?>" name="<?php echo $field_name_prefix . $field['prefix'] . '[' . $field['name'] . ']'; ?>" value="<?php if ( ! $bulk ) echo esc_attr( $field['value'] ); ?>" />
513
+ <select name="<?php echo $field_name_prefix . $field['prefix'] . '[' . $field['name'] . '_unit]'; ?>">
514
+ <?php foreach ( $field['units'] as $unit => $unit_label ): ?>
515
+ <option value="<?php echo $unit; ?>" <?php if ( ! $bulk ) selected( $unit, $measurements[$field['name'] . '_unit'] ); ?>><?php echo esc_html( $unit_label ); ?></option>
516
  <?php endforeach; ?>
517
  </select>
518
+ </span>
519
+ </p>
520
+ <?php
521
+ endforeach;
522
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
  </div>
524
 
 
 
 
 
 
 
 
525
  <div class="wpsc-product-shipping-section wpsc-product-shipping-flat-rate">
526
  <p><strong><?php esc_html_e( 'Flat Rate Settings', 'wpsc' ); ?></strong></p>
527
  <p class="wpsc-form-field">
529
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][local]" value="1" />
530
  <?php endif; ?>
531
  <label for="wpsc-product-shipping-flatrate-local"><?php esc_html_e( 'Local Shipping Fee', 'wpsc' ); ?></label>
532
+ <input type="text" id="wpsc-product-shipping-flatrate-local" name="<?php echo $field_name_prefix; ?>[shipping][local]" value="<?php if ( ! $bulk ) echo $shipping['local']; ?>" />
 
 
 
533
  </p>
534
  <p class="wpsc-form-field">
535
  <?php if ( $bulk ): ?>
536
  <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][international]" value="1" />
537
  <?php endif; ?>
538
  <label for="wpsc-product-shipping-flatrate-international"><?php esc_html_e( 'International Shipping Fee', 'wpsc' ); ?></label>
539
+ <input type="text" id="wpsc-product-shipping-flatrate-international" name="<?php echo $field_name_prefix; ?>[shipping][international]" value="<?php if ( ! $bulk ) echo $shipping['international']; ?>" />
 
 
 
540
  </p>
541
  </div>
542
  </div>
543
+ <?php
 
 
 
544
  }
545
 
 
 
 
 
 
 
546
  function wpsc_product_advanced_forms() {
547
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
548
+ $product_data = get_post_custom( $post->ID );
549
 
550
+ $product_data['meta'] = $product_meta = array();
551
+ if ( !empty( $product_data['_wpsc_product_metadata'] ) )
552
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
553
 
554
  $delete_nonce = _wpsc_create_ajax_nonce( 'remove_product_meta' );
555
 
565
  ORDER BY
566
  LOWER(meta_key)", ARRAY_A
567
  );
568
+ if( !isset( $product_meta['engraved'] ) )
569
+ $product_meta['engraved'] = '';
570
 
571
+ if( !isset( $product_meta['can_have_uploaded_image'] ) )
572
+ $product_meta['can_have_uploaded_image'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
 
574
+ ?>
 
 
 
 
 
575
 
576
+ <table>
577
+ <tr>
578
+ <td colspan='2' class='itemfirstcol'>
579
+ <strong><?php esc_html_e( 'Custom Meta', 'wpsc' ); ?>:</strong><br />
580
+ <a href='#' class='add_more_meta' onclick="return add_more_meta(this)"><?php esc_html_e( '+ Add Custom Meta', 'wpsc' );?> </a><br /><br />
581
 
582
+ <?php
583
+ foreach ( (array)$custom_fields as $custom_field ) {
584
+ $i = $custom_field['meta_id'];
585
 
586
+ ?>
587
+ <div class='product_custom_meta' id='custom_meta_<?php echo $i; ?>'>
588
+ <?php esc_html_e( 'Name', 'wpsc' ); ?>
589
+ <input type='text' class='text' value='<?php echo $custom_field['meta_key']; ?>' name='custom_meta[<?php echo $i; ?>][name]' id='custom_meta_name_<?php echo $i; ?>'>
590
+ <?php esc_html_e( 'Value', 'wpsc' ); ?>
591
+ <textarea class='text' name='custom_meta[<?php echo $i; ?>][value]' id='custom_meta_value_<?php echo $i; ?>'><?php echo esc_textarea( $custom_field['meta_value'] ); ?></textarea>
592
+ <a href='#' data-nonce="<?php echo esc_attr( $delete_nonce ); ?>" class='remove_meta' onclick='return remove_meta(this, <?php echo $i; ?>)'><?php esc_html_e( 'Delete', 'wpsc' ); ?></a>
593
+ <br />
594
+ </div>
595
+ <?php
596
+ }
597
+ ?>
598
+ <div class='product_custom_meta'>
599
+ <?php esc_html_e( 'Name', 'wpsc' ); ?>: <br />
600
+ <input type='text' name='new_custom_meta[name][]' value='' class='text'/><br />
601
+ <?php esc_html_e( 'Description', 'wpsc' ); ?>: <br />
602
+ <textarea name='new_custom_meta[value][]' cols='40' rows='10' class='text' ></textarea>
603
+ <br />
604
+ </div>
605
+ </td>
606
+ </tr>
607
+ <tr>
608
+ <td class='itemfirstcol' colspan='2'><br /> <strong><?php esc_html_e( 'Merchant Notes:', 'wpsc' ); ?></strong><br />
609
+
610
+ <textarea cols='40' rows='3' name='meta[_wpsc_product_metadata][merchant_notes]' id='merchant_notes'><?php
611
+ if ( isset( $product_meta['merchant_notes'] ) )
612
+ echo esc_textarea( trim( $product_meta['merchant_notes'] ) );
613
+ ?></textarea>
614
+ <small><?php esc_html_e( 'These notes are only available here.', 'wpsc' ); ?></small>
615
+ </td>
616
+ </tr>
617
+ <tr>
618
+ <td class='itemfirstcol' colspan='2'><br />
619
+ <strong><?php esc_html_e( 'Personalisation Options', 'wpsc' ); ?>:</strong><br />
620
+ <input type='hidden' name='meta[_wpsc_product_metadata][engraved]' value='0' />
621
+ <input type='checkbox' name='meta[_wpsc_product_metadata][engraved]' <?php echo ( ( $product_meta['engraved'] == true ) ? 'checked="checked"' : '' ); ?> id='add_engrave_text' />
622
+ <label for='add_engrave_text'><?php esc_html_e( 'Users can personalize this Product by leaving a message on single product page', 'wpsc' ); ?></label>
623
+ <br />
624
+ </td>
625
+ </tr>
626
+ <tr>
627
+ <td class='itemfirstcol' colspan='2'>
628
+ <input type='hidden' name='meta[_wpsc_product_metadata][can_have_uploaded_image]' value='0' />
629
+ <input type='checkbox' name='meta[_wpsc_product_metadata][can_have_uploaded_image]' <?php echo ( $product_meta['can_have_uploaded_image'] == true ) ? 'checked="checked"' : ''; ?> id='can_have_uploaded_image' />
630
+ <label for='can_have_uploaded_image'> <?php esc_html_e( 'Users can upload images on single product page to purchase logs.', 'wpsc' ); ?> </label>
631
+ <br />
632
+ </td>
633
+ </tr>
634
+ <?php
635
+ if ( get_option( 'payment_gateway' ) == 'google' ) {
636
+ ?>
637
+ <tr>
638
+ <td class='itemfirstcol' colspan='2'>
639
 
640
+ <input type='checkbox' <?php echo $product_meta['google_prohibited']; ?> name='meta[_wpsc_product_metadata][google_prohibited]' id='add_google_prohibited' /> <label for='add_google_prohibited'>
641
+ <?php esc_html_e( 'Prohibited <a href="http://checkout.google.com/support/sell/bin/answer.py?answer=75724">by Google?</a>', 'wpsc' ); ?>
642
+ </label><br />
643
+ </td>
644
+ </tr>
645
+ <?php
646
+ }
647
+ do_action( 'wpsc_add_advanced_options', $post->ID );
648
+ ?>
649
+ <tr>
650
+ <td class='itemfirstcol' colspan='2'><br />
651
+ <strong><?php esc_html_e( 'Enable Comments', 'wpsc' ); ?>:</strong><br />
652
+ <select name='meta[_wpsc_product_metadata][enable_comments]'>
653
+ <option value='' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '' ) ? 'selected' : '' ); ?> ><?php esc_html_e( 'Use Default', 'wpsc' ); ?></option>
654
+ <option value='1' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '1' ) ? 'selected' : '' ); ?> ><?php esc_html_e( 'Yes', 'wpsc' ); ?></option>
655
+ <option value='0' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '0' ) ? 'selected' : '' ); ?> ><?php esc_html_e( 'No', 'wpsc' ); ?></option>
656
+ </select>
657
+ <br/><?php esc_html_e( 'Allow users to comment on this Product.', 'wpsc' ); ?>
658
+ </td>
659
+ </tr>
660
+ </table>
661
+ <?php
662
  }
 
 
 
 
 
 
663
  function wpsc_product_external_link_forms() {
664
 
665
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
666
+ $product_data = get_post_custom( $post->ID );
667
+
668
+ $product_data['meta'] = $product_meta = array();
669
+ if ( !empty( $product_data['_wpsc_product_metadata'] ) )
670
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
671
 
672
  // Get External Link Values
673
+ $external_link_value = isset( $product_meta['external_link'] ) ? $product_meta['external_link'] : '';
674
+ $external_link_text_value = isset( $product_meta['external_link_text'] ) ? $product_meta['external_link_text'] : '';
675
+ $external_link_target_value = isset( $product_meta['external_link_target'] ) ? $product_meta['external_link_target'] : '';
676
+ $external_link_target_value_selected[$external_link_target_value] = ' selected="selected"';
677
+ if ( !isset( $external_link_target_value_selected['_self'] ) ) $external_link_target_value_selected['_self'] = '';
678
+ if ( !isset( $external_link_target_value_selected['_blank'] ) ) $external_link_target_value_selected['_blank'] = '';
679
 
680
+ ?>
681
+ <p><?php esc_html_e( 'If this product is for sale on another website enter the link here. For instance if your product is an MP3 file for sale on iTunes you could put the link here. This option overrides the buy now and add to cart links and takes you to the site linked here. You can also customise the Buy Now text and choose to open the link in a new window.', 'wpsc' ); ?>
682
+ <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
683
+ <tbody>
684
+ <tr class="form-field">
685
+ <th valign="top" scope="row"><label for="external_link"><?php esc_html_e( 'External Link', 'wpsc' ); ?></label></th>
686
+ <td><input type="text" name="meta[_wpsc_product_metadata][external_link]" id="external_link" value="<?php esc_attr_e( $external_link_value ); ?>" size="50" style="width: 95%"></td>
687
+ </tr>
688
+ <tr class="form-field">
689
+ <th valign="top" scope="row"><label for="external_link_text"><?php esc_html_e( 'External Link Text', 'wpsc' ); ?></label></th>
690
+ <td><input type="text" name="meta[_wpsc_product_metadata][external_link_text]" id="external_link_text" value="<?php esc_attr_e( $external_link_text_value ); ?>" size="50" style="width: 95%"></td>
691
+ </tr>
692
+ <tr class="form-field">
693
+ <th valign="top" scope="row"><label for="external_link_target"><?php esc_html_e( 'External Link Target', 'wpsc' ); ?></label></th>
694
+ <td>
695
+ <select id="external_link_target" name="meta[_wpsc_product_metadata][external_link_target]">
696
+ <option value=""><?php _ex( 'Default (set by theme)', 'External product link target', 'wpsc' ); ?></option>
697
+ <option value="_self" <?php echo $external_link_target_value_selected['_self'] ; ?>><?php esc_html_e( 'Open link in the same window', 'wpsc' ); ?></option>
698
+ <option value="_blank" <?php echo $external_link_target_value_selected['_blank'] ; ?>><?php esc_html_e( 'Open link in a new window', 'wpsc' ); ?></option>
699
+ </select>
700
+ </td>
701
+ </tr>
702
+ </tbody>
703
+ </table>
704
+ <?php
705
+ }
706
+ function wpsc_product_image_forms() {
 
 
 
 
 
 
 
 
 
707
 
708
+ global $post;
709
 
710
+ edit_multiple_image_gallery( $post );
711
 
 
712
  ?>
 
 
 
713
 
714
+ <p><strong <?php if ( isset( $display ) ) echo $display; ?>><a href="media-upload.php?parent_page=wpsc-edit-products&amp;post_id=<?php echo $post->ID; ?>&amp;type=image&amp;tab=gallery&amp;TB_iframe=1&amp;width=640&amp;height=566" class="thickbox" title="<?php esc_attr_e( 'Manage Product Images', 'wpsc' ); ?>"><?php esc_html_e( 'Manage Product Images', 'wpsc' ); ?></a></strong></p>
715
+ <?php
716
  }
717
+ function wpsc_additional_desc() {
718
+ ?>
719
+ <textarea name='additional_description' id='additional_description' cols='40' rows='5' ><?php echo esc_textarea( get_post_field( 'post_excerpt', get_the_ID() ) ); ?></textarea>
720
+ <?php
721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
  }
 
 
723
  function wpsc_product_download_forms() {
724
  global $post, $wpdb, $wpsc_product_defaults;
725
  $product_data = get_post_custom( $post->ID );
726
  $output = '';
727
+ $product_data['meta'] = $product_meta = array();
 
728
  if ( !empty( $product_data['_wpsc_product_metadata'] ) )
729
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
730
 
731
  $upload_max = wpsc_get_max_upload_size();
732
  ?>
733
  <?php echo wpsc_select_product_file( $post->ID ); ?>
734
+ <h4><a href="admin.php?wpsc_admin_action=product_files_existing&amp;product_id=<?php echo $post->ID; ?>" class="thickbox" title="<?php echo esc_attr( sprintf( __( 'Select all downloadable files for %s', 'wpsc' ), $post->post_title ) ); ?>"><?php esc_html_e( 'Select from existing files', 'wpsc' ); ?></a></h4>
735
+ <a name="wpsc_downloads"></a>
736
+ <h4><?php esc_html_e( 'Upload New File', 'wpsc' ); ?>:</h4>
737
+ <input type='file' name='file' value='' /><br /><?php esc_html_e( 'Max Upload Size ', 'wpsc' ); ?>:<span><?php echo $upload_max; ?></span><span><?php esc_html_e( ' - Choose your file, then update this product to save the download.', 'wpsc' ); ?></span><br /><br />
 
 
 
 
738
 
739
  <?php
740
  if ( function_exists( "make_mp3_preview" ) || function_exists( "wpsc_media_player" ) ) {
741
  ?>
742
+ <br />
743
+ <h4><?php esc_html_e( 'Select an MP3 file to upload as a preview', 'wpsc' ) ?></h4>
744
+ <input type='file' name='preview_file' value='' /><br />
745
 
746
+ <h4><?php esc_html_e( 'Your preview for this product', 'wpsc' ) ?>:</h4>
747
 
748
+ <?php
749
  $args = array(
750
  'post_type' => 'wpsc-preview-file',
751
  'post_parent' => $post->ID,
753
  'post_status' => 'all'
754
  );
755
 
756
+ $preview_files = (array)get_posts( $args );
757
 
758
+ foreach ($preview_files as $preview)
759
  echo $preview->post_title . '<br />';
 
 
760
  ?>
761
+ <br />
762
+ <?php
763
  }
 
764
  $output = apply_filters( 'wpsc_downloads_metabox', $output );
765
  }
766
+ function wpsc_product_label_forms() {
767
+ _deprecated_function( __FUNCTION__, '3.8' );
768
+ return false;
769
+ }
770
  /**
771
+ * Adding function to change text for media buttons
 
 
772
  */
773
+ function change_context( $context ) {
774
+ global $current_screen;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
775
 
776
+ if ( $current_screen->id != 'wpsc-product' )
777
+ return $context;
778
+ return __( 'Upload Image%s', 'wpsc' );
779
  }
780
+ function change_link( $link ) {
781
+ global $post_ID, $current_screen;
782
+ $current_screen = get_current_screen();
783
+ if ( $current_screen && $current_screen->id != 'wpsc-product' )
784
+ return $link;
785
 
786
+ $uploading_iframe_ID = $post_ID;
787
+ $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
788
 
789
+ return $media_upload_iframe_src . "&amp;type=image&parent_page=wpsc-edit-products";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
791
  function wpsc_form_multipart_encoding() {
792
  echo ' enctype="multipart/form-data"';
793
  }
794
 
795
  add_action( 'post_edit_form_tag', 'wpsc_form_multipart_encoding' );
796
 
797
+ if ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) ) {
798
+ add_filter( 'media_buttons_context', 'change_context' );
799
+ add_filter( 'image_upload_iframe_src', "change_link" );
800
+ }
801
+
802
  /*
803
  * Modifications to Media Gallery
804
  */
805
 
806
+ if ( ( isset( $_REQUEST['parent_page'] ) && ( $_REQUEST['parent_page'] == 'wpsc-edit-products' ) ) ) {
807
+ add_filter( 'media_upload_tabs', 'wpsc_media_upload_tab_gallery', 12 );
808
+ add_filter( 'media_upload_form_url', 'wpsc_media_upload_url', 9, 1 );
809
+ add_action( 'admin_head', 'wpsc_gallery_css_mods' );
810
+ }
811
+ add_filter( 'gettext', 'wpsc_filter_delete_text', 12 , 3 );
812
  add_filter( 'attachment_fields_to_edit', 'wpsc_attachment_fields', 11, 2 );
813
  add_filter( 'attachment_fields_to_save', 'wpsc_save_attachment_fields', 9, 2 );
814
+ add_filter( 'gettext', 'wpsc_filter_feature_image_text', 12, 3 );
815
  add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
816
 
817
  /*
826
  function wpsc_filter_gettex_with_context( $translation, $text, $context, $domain ) {
827
 
828
  if ( 'Taxonomy Parent' == $context && 'Parent' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ) {
829
+ $translations = &get_translations_for_domain( $domain );
830
  return $translations->translate( 'Variation Set', 'wpsc' );
831
  //this will never happen, this is here only for gettext to pick up the translation
832
  return __( 'Variation Set', 'wpsc' );
834
  return $translation;
835
  }
836
 
837
+ /*
838
+ * This filter translates string before it is displayed
839
+ * specifically for the words 'Use as featured image' with 'Use as Product Thumbnail' when the user is selecting a Product Thumbnail
840
+ * using media gallery.
841
+ *
842
+ * @param $translation The current translation
843
+ * @param $text The text being translated
844
+ * @param $domain The domain for the translation
845
+ * @return string The translated / filtered text.
846
+ */
847
+ function wpsc_filter_feature_image_text( $translation, $text, $domain ) {
848
+ if ( 'Use as featured image' == $text && isset( $_REQUEST['post_id'] ) ) {
849
+ $post = get_post( $_REQUEST['post_id'] );
850
+ if ( $post->post_type != 'wpsc-product' ) return $translation;
851
+ $translations = &get_translations_for_domain( $domain );
852
+ return $translations->translate( 'Use as Product Thumbnail', 'wpsc' );
853
+ //this will never happen, this is here only for gettexr to pick up the translation
854
+ return __( 'Use as Product Thumbnail', 'wpsc' );
855
+ }
856
+
857
+ return $translation;
858
+ }
859
  function wpsc_attachment_fields( $form_fields, $post ) {
860
  $out = '';
861
 
864
  else
865
  $parent_post = get_post( $post->post_parent );
866
 
867
+ if ( $parent_post->post_type == "wpsc-product" ) {
 
868
 
869
  //Unfortunate hack, as I'm not sure why the From Computer tab doesn't process filters the same way the Gallery does
870
  ob_start();
957
 
958
  }
959
  function wpsc_save_attachment_fields( $post, $attachment ) {
960
+ if ( isset ( $attachment['wpsc_custom_thumb_w'] ) )
 
961
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_w', $attachment['wpsc_custom_thumb_w'] );
 
962
 
963
+ if ( isset ( $attachment['wpsc_custom_thumb_h'] ) )
964
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_h', $attachment['wpsc_custom_thumb_h'] );
 
965
 
966
+ if ( isset ( $attachment['wpsc_image_size'] ) )
967
  update_post_meta( $post['ID'], '_wpsc_selected_image_size', $attachment['wpsc_image_size'] );
 
968
 
969
  return $post;
970
  }
971
+ function wpsc_media_upload_url( $form_action_url ) {
972
+
973
+ $form_action_url = esc_url( add_query_arg( array( 'parent_page'=>'wpsc-edit-products' ) ) );
974
+
975
+ return $form_action_url;
976
+
977
+ }
978
+ function wpsc_gallery_css_mods() {
979
+
980
+ print '<style type="text/css">
981
+ #gallery-settings *{
982
+ display:none;
983
+ }
984
+ a.wp-post-thumbnail {
985
+ color:green;
986
+ }
987
+ #media-upload a.del-link {
988
+ color:red;
989
+ }
990
+ #media-upload a.wp-post-thumbnail {
991
+ margin-left:0px;
992
+ }
993
+ td.savesend input.button {
994
+ display:none;
995
+ }
996
+ </style>';
997
+ print '
998
+ <script type="text/javascript">
999
+ jQuery(function(){
1000
+ jQuery("td.A1B1").each(function(){
1001
+
1002
+ var target = jQuery(this).next();
1003
+ jQuery("p > input.button", this).appendTo(target);
1004
+
1005
+ });
1006
+
1007
+ jQuery("a.wp-post-thumbnail").each(function(){
1008
+ var product_image = jQuery(this).text();
1009
+ if (product_image == "' . __( 'Use as featured image' ) . '") {
1010
+ jQuery(this).text("' . __( 'Use as Product Thumbnail', 'wpsc' ) . '");
1011
+ }
1012
+ });
1013
+ });
1014
+
1015
+ </script>';
1016
+ }
1017
+ function wpsc_media_upload_tab_gallery( $tabs ) {
1018
+
1019
+ unset( $tabs['gallery'] );
1020
+ $tabs['gallery'] = __( 'Product Image Gallery', 'wpsc' );
1021
+
1022
+ return $tabs;
1023
+ }
1024
+ function wpsc_filter_delete_text( $translation, $text, $domain ) {
1025
+
1026
+ if ( 'Delete' == $text && isset( $_REQUEST['post_id'] ) && isset( $_REQUEST['parent_page'] ) ) {
1027
+ $translations = &get_translations_for_domain( $domain );
1028
+ return $translations->translate( 'Trash' ) ;
1029
+ }
1030
+ return $translation;
1031
+ }
1032
+ function edit_multiple_image_gallery( $post ) {
1033
+ global $wpdb;
1034
+ //Make sure thumbnail isn't duplicated
1035
+ $siteurl = site_url();
1036
+
1037
+ if ( $post->ID > 0 ) {
1038
+ if ( has_post_thumbnail( $post->ID ) )
1039
+ echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
1040
+
1041
+ $args = array(
1042
+ 'post_type' => 'attachment',
1043
+ 'numberposts' => -1,
1044
+ 'post_status' => null,
1045
+ 'post_parent' => $post->ID,
1046
+ 'orderby' => 'menu_order',
1047
+ 'order' => 'ASC'
1048
+ );
1049
+
1050
+ $attached_images = (array)get_posts( $args );
1051
+
1052
+ if ( count( $attached_images ) > 0 ) {
1053
+ foreach ( $attached_images as $images ) {
1054
+ $attached_image = wp_get_attachment_image( $images->ID, 'admin-product-thumbnails' );
1055
+ echo $attached_image. '&nbsp;';
1056
+ }
1057
+ }
1058
+
1059
+ }
1060
+ }
1061
 
1062
  /**
1063
+ * wpsc_save_quickedit_box function
1064
+ * Saves input for the various meta in the quick edit boxes
 
1065
  *
1066
+ * @todo UI
1067
+ * @todo Data validation / sanitization / security
1068
+ * @todo AJAX should probably return weight unit
1069
+ * @return $post_id (int) Post ID
 
1070
  */
 
1071
 
1072
+ function wpsc_save_quickedit_box( $post_id ) {
1073
  global $doaction;
1074
 
1075
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || get_post_type( $post_id ) != 'wpsc-product' )
 
1076
  return;
 
1077
 
1078
+ $bulk = isset( $doaction ) && $doaction =='edit';
1079
 
 
1080
  $custom_fields = array(
1081
+ 'weight' => 'product_metadata',
1082
+ 'stock' => 'stock',
1083
+ 'price' => 'price',
1084
  'sale_price' => 'special_price',
1085
+ 'sku' => 'sku',
1086
  );
1087
 
1088
+ $args = array(
1089
+ 'post_parent' => $post_id,
1090
+ 'post_type' => 'wpsc-product',
1091
+ 'post_status' => 'inherit'
1092
+ );
1093
+ $children = get_children($args);
1094
+ $is_parent = (bool)$children;
 
1095
  foreach ( $custom_fields as $post_key => $meta_key ) {
1096
+ $overideVariant = isset($_REQUEST[$post_key.'_variant']) && $_REQUEST[$post_key.'_variant'] == 'on';
1097
+ // don't update if we're bulk updating and the field is left blank, or if the product has children and the field is one of those fields defined below (unles overridden)
1098
+ if ( ! isset( $_REQUEST[$post_key] ) || ( $bulk && empty( $_REQUEST[$post_key] ) ) ||
1099
+ ( $is_parent && in_array( $post_key, array( 'weight', 'stock', 'price', 'special_price' )) && !$overideVariant ) ){
1100
  continue;
1101
  }
1102
 
1103
+ if($is_parent && count($children) >0){
1104
+ $products = $children;
1105
+ }else{
1106
+ $products = array($post_id);
1107
  }
1108
 
1109
+ foreach($products as $product){
1110
+ $value = $_REQUEST[$post_key];
1111
+ if($is_parent) $post_id = $product->ID;
1112
+ else $post_id = $product;
 
 
 
 
 
 
 
1113
  switch ( $post_key ) {
 
1114
  case 'weight':
1115
  $product_meta = get_post_meta( $post_id, '_wpsc_product_metadata', true );
1116
+ if ( ! is_array( $product_meta ) )
1117
  $product_meta = array();
1118
+ // draft products don't have product metadata set yet
1119
+ $weight_unit = isset( $product_meta["weight_unit"] ) ? $product_meta["weight_unit"] : 'pound';
1120
+ $weight = wpsc_convert_weight( $value, $weight_unit, "pound", true );
1121
 
1122
+ if ( isset( $product_meta["weight"] ) )
1123
+ unset( $product_meta["weight"] );
 
1124
 
1125
+ $product_meta["weight"] = $weight;
 
 
 
 
1126
 
1127
  $value = $product_meta;
1128
  break;
1129
 
1130
  case 'stock':
1131
+ if ( ! is_numeric( $value ) )
1132
  $value = '';
 
1133
  break;
1134
 
1135
  case 'sku':
1136
+ if ( $value == __( 'N/A', 'wpsc' ) )
1137
  $value = '';
 
1138
  break;
 
1139
  }
1140
 
1141
  update_post_meta( $post_id, "_wpsc_{$meta_key}", $value );
1143
  }
1144
 
1145
  return $post_id;
 
1146
  }
1147
 
1148
  /**
1162
  ?>
1163
 
1164
  <fieldset class="inline-edit-col-left wpsc-cols">
1165
+ <div class="inline-edit-col">
1166
+ <div class="inline-edit-group">
1167
  <?php
1168
  switch ( $col_name ) :
1169
  case 'SKU' :
1170
  ?>
1171
+ <label style="max-width: 85%" class="alignleft">
1172
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'SKU:', 'wpsc' ); ?> </span>
1173
+ <input type="text" name="sku" class="wpsc_ie_sku" />
1174
  <input type="checkbox" name="sku_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1175
 
1176
+ </label>
1177
+ <?php
1178
  break;
1179
  case 'weight' :
1180
  ?>
1181
+ <label style="max-width: 85%" class="alignleft">
1182
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Weight:', 'wpsc' ); ?> </span>
1183
+ <input type="text" name="weight" class="wpsc_ie_weight" />
1184
  <input type="checkbox" name="weight_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1185
+ </label>
1186
+ <?php
1187
  break;
1188
  case 'stock' :
1189
  ?>
1190
+ <label style="max-width: 85%" class="alignleft">
1191
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Stock:', 'wpsc' ); ?> </span>
1192
+ <input type="text" name="stock" class="wpsc_ie_stock" />
1193
  <input type="checkbox" name="stock_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1194
+ </label>
1195
+ <?php
1196
  break;
1197
  case 'price' :
1198
  ?>
1199
+ <label style="max-width: 85%" class="alignleft">
1200
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Price:', 'wpsc' ); ?> </span>
1201
+ <input type="text" name="price" class="wpsc_ie_price" />
1202
  <input type="checkbox" name="price_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1203
+ </label>
1204
+ <?php
1205
  break;
1206
  case 'sale_price' :
1207
  ?>
1208
+ <label style="max-width: 85%" class="alignleft">
1209
+ <span class="checkbox-title wpsc-quick-edit"><?php esc_html_e( 'Sale Price:', 'wpsc' ); ?> </span>
1210
+ <input type="text" name="sale_price" class="wpsc_ie_sale_price" />
1211
  <input type="checkbox" name="sale_price_variant"> <span><?php esc_html_e( 'Update Variants', 'wpsc');?></span>
1212
+ </label>
1213
+ <?php
1214
  break;
1215
  endswitch;
1216
  ?>
1217
+ </div>
1218
+ </div>
1219
  </fieldset>
1220
  <?php
1221
  }
1269
  } else{
1270
  ?>
1271
  <tr class="form-field">
1272
+ <th scope="row" valign="top">
1273
  <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wpsc' ); ?></label>
1274
+ </th>
1275
+ <td>
1276
  <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1277
  <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>
1278
+ </td>
1279
  </tr>
1280
  <?php
1281
  }
1337
 
1338
  /**
1339
  * @todo - Should probably refactor this at some point - very procedural,
1340
+ * WAY too many foreach loops for my liking :) But it does the trick
1341
  *
1342
  * @param <type> $term_id
1343
  */
1344
  function save_term_prices( $term_id ) {
1345
+
1346
  // First - Saves options from input
1347
  if ( isset( $_POST['variation_price'] ) || isset( $_POST["apply_to_current"] ) ) {
1348
 
1357
  // Second - If box was checked, let's then check whether or not it was flat, differential, or percentile, then let's apply the pricing to every product appropriately
1358
  if ( isset( $_POST["apply_to_current"] ) ) {
1359
 
1360
+ //Check for flat, percentile or differential
1361
+ $var_price_type = '';
1362
+
1363
+ if ( flat_price( $_POST["variation_price"] ) )
1364
+ $var_price_type = 'flat';
1365
+ elseif ( differential_price( $_POST["variation_price"] ) )
1366
+ $var_price_type = 'differential';
1367
+ elseif ( percentile_price( $_POST["variation_price"] ) )
1368
+ $var_price_type = 'percentile';
1369
+
1370
  //Now, find all products with this term_id, update their pricing structure (terms returned include only parents at this point, we'll grab relevent children soon)
1371
  $products_to_mod = get_objects_in_term( $term_id, "wpsc-variation" );
1372
  $product_parents = array( );
1427
  wp_delete_post( $variation->ID, true );
1428
  }
1429
  }
1430
+ add_action( 'delete_post', 'wpsc_delete_variations' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-functions.php CHANGED
@@ -7,7 +7,7 @@
7
  */
8
 
9
  function wpsc_get_max_upload_size(){
10
- return size_format( wp_max_upload_size() );
11
  }
12
 
13
  /**
@@ -18,37 +18,26 @@ function wpsc_get_max_upload_size(){
18
  * @return nothing
19
  */
20
  function wpsc_admin_submit_product( $post_ID, $post ) {
 
21
 
22
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_type != 'wpsc-product' ) {
23
- return;
24
- }
25
 
26
  //Type-casting ( not so much sanitization, which would be good to do )
27
- $post_data = stripslashes_deep( $_POST );
28
  $product_id = $post_ID;
29
-
30
- $post_data['additional_description'] = isset( $post_data['additional_description'] ) ? $post_data['additional_description'] : '';
31
-
32
- if ( ! isset( $post_data['meta'] ) && isset( $_POST['meta'] ) ) {
33
- $post_data['meta'] = (array) $_POST['meta'];
34
- }
35
-
36
-
37
  if ( isset( $post_data['meta']['_wpsc_price'] ) )
38
  $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
39
-
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
-
47
- // Update donation setting
48
- if ( isset( $post_data['wpsc_product_pricing_nonce'] ) && wp_verify_nonce( $post_data['wpsc_product_pricing_nonce'], 'update' ) ) {
49
- $post_data['meta']['_wpsc_is_donation'] = isset( $post_data['meta']['_wpsc_is_donation'] ) ? 1 : 0;
50
- }
51
-
52
  if ( ! isset( $post_data['meta']['_wpsc_limited_stock'] ) ){
53
  $post_data['meta']['_wpsc_stock'] = false;
54
  } else {
@@ -56,77 +45,41 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
56
  }
57
 
58
  unset($post_data['meta']['_wpsc_limited_stock']);
59
- if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
 
 
60
  if(!isset($post_data['special'])) $post_data['special'] = '';
 
61
 
 
 
62
  $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
63
  $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
64
-
65
- // Update Stock Options
66
- if ( isset( $_POST['wpsc_product_stock_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_stock_nonce'], 'update' ) ) {
67
-
68
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
69
- 'notify_when_none_left' => 0,
70
- 'unpublish_when_none_left' => 0
71
- ) );
72
- $post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'] );
73
- $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] );
74
-
75
- }
76
-
77
- // Update shipping setting
78
- if ( isset( $_POST['wpsc_product_shipping_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_shipping_nonce'], 'update' ) ) {
79
-
80
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
81
- 'no_shipping' => 0
82
- ) );
83
- $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] );
84
-
85
- }
86
 
87
  // Product Weight
88
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
89
 
90
  if ( isset( $post_data['meta']['_wpsc_product_metadata']['weight'] ) ) {
91
- $weight = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['weight'] );
92
- $weight = wpsc_convert_weight( $weight, $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
93
- $post_data['meta']['_wpsc_product_metadata']['weight'] = $weight;
94
  $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
95
  }
96
 
97
- if ( isset( $post_data['meta']['_wpsc_product_metadata']['dimensions'] ) ) {
98
- $dimensions =& $post_data['meta']['_wpsc_product_metadata']['dimensions'];
99
- foreach ( $dimensions as $key => $value ) {
100
- if ( ! in_array( $key, array( 'height', 'width', 'length' ) ) )
101
- continue;
102
 
103
- $dimensions[$key] = wpsc_string_to_float( $value );
104
- }
 
 
105
  }
106
 
107
- // Update the table rate prices (quantity discounts)
108
- if ( isset( $post_data['wpsc-update-quantity-discounts'] ) && wp_verify_nonce( $post_data['wpsc-update-quantity-discounts'], 'update-options' ) ) {
109
- $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = isset( $post_data['table_rate_price'] ) ? $post_data['table_rate_price'] : array();
110
-
111
- // If table_rate_price is empty, set empty table rate price arrays
112
- if ( empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] ) ) {
113
- $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = array();
114
- $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = array();
115
- }
116
-
117
- // Remove any rates with no quantity or price
118
- if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] ) ) {
119
- foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] as $key => $value ) {
120
- if ( empty( $value ) ) {
121
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][ $key ] );
122
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][ $key ] );
123
- }
124
- }
125
- foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value ) {
126
- if ( empty( $value ) ) {
127
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][ $key ] );
128
- unset( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][ $key ] );
129
- }
130
  }
131
  }
132
  }
@@ -136,67 +89,14 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
136
  $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] );
137
  }
138
 
139
- // Update product taxes
140
- if ( isset( $_POST['wpsc_product_tax_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_tax_nonce'], 'update' ) ) {
141
-
142
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
143
- 'wpec_taxes_taxable_amount' => '',
144
- 'wpec_taxes_taxable' => ''
145
- ) );
146
- if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable_amount'] ) ) {
147
- $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable_amount'] = wpsc_string_to_float($post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable_amount'] );
148
- }
149
- $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable'] = $post_data['meta']['_wpsc_product_metadata']['wpec_taxes_taxable'];
150
-
151
- }
152
-
153
- // External Link Options
154
- if ( isset( $_POST['wpsc_product_external_link_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_external_link_nonce'], 'update' ) ) {
155
-
156
- // Parse post meta to ensure default values
157
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
158
- 'external_link' => '',
159
- 'external_link_text' => '',
160
- 'external_link_target' => ''
161
- ) );
162
-
163
- }
164
-
165
  // Advanced Options
166
- if ( isset( $_POST['wpsc_product_personalization_nonce'] ) && wp_verify_nonce( $_POST['wpsc_product_personalization_nonce'], 'update' ) ) {
167
-
168
- // Parse post meta to ensure default values (especially checkboxes)
169
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], array(
170
- 'engraved' => 0,
171
- 'can_have_uploaded_image' => 0
172
- ) );
173
-
174
- $post_data['meta']['_wpsc_product_metadata']['engraved'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['engraved'] );
175
- $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = absint( (bool) $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] );
176
-
177
- }
178
-
179
- if ( ! isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
180
  $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
181
 
182
- // Fill in any missing meta values with existing values.
183
- $post_data['meta'] = wp_parse_args( $post_data['meta'], array(
184
- '_wpsc_is_donation' => get_product_meta( $product_id, 'is_donation', true )
185
- ) );
186
-
187
- // Fill in any missing product meta values with existing values.
188
- $default_meta_values = wp_parse_args( get_product_meta( $product_id, 'product_metadata', true ), array(
189
- 'notify_when_none_left' => 0,
190
- 'unpublish_when_none_left' => 0,
191
- 'no_shipping' => 0,
192
- 'external_link' => '',
193
- 'external_link_text' => '',
194
- 'external_link_target' => '',
195
- 'engraved' => 0,
196
- 'can_have_uploaded_image' => 0
197
- ) );
198
-
199
- $post_data['meta']['_wpsc_product_metadata'] = wp_parse_args( $post_data['meta']['_wpsc_product_metadata'], $default_meta_values );
200
 
201
  $post_data['files'] = $_FILES;
202
 
@@ -227,40 +127,37 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
227
  'thumbnail_state' => null
228
  );
229
 
230
- foreach ( $product_columns as $column => $default ) {
231
- if ( ! isset( $post_data[ $column ] ) ) {
232
- $post_data[ $column ] = '';
 
 
 
 
 
233
  }
234
  }
235
-
236
  // if we succeed, we can do further editing (todo - if_wp_error)
237
 
238
  // if we have no categories selected, assign one.
239
- if ( isset( $post_data['tax_input']['wpsc_product_category'] ) && count( $post_data['tax_input']['wpsc_product_category'] ) == 1 && $post_data['tax_input']['wpsc_product_category'][0] == 0){
240
  $post_data['tax_input']['wpsc_product_category'][1] = wpsc_add_product_category_default($product_id);
241
- }
242
 
 
243
  // and the meta
244
  wpsc_update_product_meta($product_id, $post_data['meta']);
245
 
246
  // and the custom meta
247
  wpsc_update_custom_meta($product_id, $post_data);
248
 
249
-
250
- // Update the alternative currencies
251
- if ( isset( $post_data['wpsc-update-currency-layers'] ) && wp_verify_nonce( $post_data['wpsc-update-currency-layers'], 'update-options' ) ) {
252
-
253
- // Clear currencies before re-saving to make sure deleted currencies are removed
254
- update_product_meta( $product_id, 'currency', array() );
255
-
256
- if ( ! empty( $post_data['newCurrency'] ) ) {
257
- foreach( (array) $post_data['newCurrency'] as $key =>$value ) {
258
- wpsc_update_alt_product_currency( $product_id, $value, $post_data['newCurrPrice'][ $key ] );
259
- }
260
  }
261
  }
262
 
263
- if ( isset( $post_data['files']['file'] ) && $post_data['files']['file']['tmp_name'] != '' ) {
264
  wpsc_item_process_file($product_id, $post_data['files']['file']);
265
  } else {
266
  if (!isset($post_data['select_product_file'])) $post_data['select_product_file'] = null;
@@ -290,11 +187,10 @@ function wpsc_pre_update( $data , $postarr ) {
290
  $data['post_status'] = 'inherit';
291
  }
292
 
293
- if ( ! empty( $postarr['meta'] ) && ( ! isset( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] ) || $postarr['meta']['_wpsc_product_metadata']['enable_comments'] == 0 || empty( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] ) ) ) {
294
- $data["comment_status"] = "closed";
295
- } else {
296
- $data["comment_status"] = "open";
297
- }
298
 
299
  //Can anyone explain to me why this is here?
300
  if ( isset( $sku ) && ( $sku != '' ) )
@@ -303,7 +199,7 @@ function wpsc_pre_update( $data , $postarr ) {
303
  return $data;
304
  }
305
  add_filter( 'wp_insert_post_data','wpsc_pre_update', 99, 2 );
306
- add_action( 'save_post', 'wpsc_admin_submit_product', 5, 2 );
307
  add_action( 'admin_notices', 'wpsc_admin_submit_notices' );
308
 
309
  /**
@@ -370,6 +266,7 @@ function wpsc_sanitise_product_forms($post_data = null) {
370
 
371
  $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
372
  $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
 
373
  if (!isset($post_data['meta']['_wpsc_is_donation'])) $post_data['meta']['_wpsc_is_donation'] = '';
374
  $post_data['meta']['_wpsc_is_donation'] = (int)(bool)$post_data['meta']['_wpsc_is_donation'];
375
  $post_data['meta']['_wpsc_stock'] = (int)$post_data['meta']['_wpsc_stock'];
@@ -441,9 +338,14 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
441
  );
442
 
443
 
444
- foreach ( $product_columns as $column => $default ) {
445
- if ( ! isset( $post_data[ $column ] ) ) {
446
- $post_data[ $column ] = '';
 
 
 
 
 
447
  }
448
  }
449
 
@@ -470,7 +372,13 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
470
  }else {
471
  unstick_post($product_id);
472
  }
473
-
 
 
 
 
 
 
474
  $adding = true;
475
 
476
  // if we succeed, we can do further editing
@@ -512,7 +420,7 @@ function term_id_price($term_id, $parent_price) {
512
  }
513
 
514
  if (strchr($price, '-') ) {
515
- $positive = false;
516
  } else {
517
  $positive = true;
518
  }
@@ -559,7 +467,7 @@ function wpsc_determine_variation_price( $variation_id, $term_ids = false ) {
559
  $price = (float) get_product_meta( $variation->post_parent, 'price', true );
560
 
561
  if ( ! $term_ids )
562
- $term_ids = wpsc_get_product_terms( $variation_id, 'wpsc-variation', 'term_id' );
563
 
564
  $term_price_arr = get_option( 'term_prices' );
565
  foreach ( $term_ids as $term_id ) {
@@ -604,7 +512,7 @@ function wpsc_edit_product_variations($product_id, $post_data) {
604
  if (!isset($post_data['edit_var_val']))
605
  $post_data['edit_var_val'] = '';
606
 
607
- $variations = (array) $post_data['edit_var_val'];
608
 
609
  // Generate the arrays for variation sets, values and combinations
610
  $wpsc_combinator = new wpsc_variation_combinator($variations);
@@ -618,11 +526,10 @@ function wpsc_edit_product_variations($product_id, $post_data) {
618
  // Retrieve the array containing the combinations of each variation set to be associated with this product.
619
  $combinations = $wpsc_combinator->return_combinations();
620
 
621
- $product_terms = wpsc_get_product_terms( $product_id, 'wpsc-variation' );
622
 
623
  $variation_sets_and_values = array_merge($variation_sets, $variation_values);
624
  $variation_sets_and_values = apply_filters('wpsc_edit_product_variation_sets_and_values', $variation_sets_and_values, $product_id);
625
-
626
  wp_set_object_terms($product_id, $variation_sets_and_values, 'wpsc-variation');
627
 
628
  $parent_id = $_REQUEST['product_id'];
@@ -717,8 +624,6 @@ function wpsc_edit_product_variations($product_id, $post_data) {
717
  $currently_associated_vars[] = $current->term_id;
718
  }
719
 
720
- $posted_terms = array();
721
-
722
  foreach ($posted_term as $term=>$val) {
723
  $posted_terms[] = $term;
724
  if(is_array($val)) {
@@ -727,20 +632,14 @@ function wpsc_edit_product_variations($product_id, $post_data) {
727
  }
728
  }
729
  }
730
-
731
  if(!empty($currently_associated_vars)){
732
  $term_ids_to_delete = array();
733
  $term_ids_to_delete = array_diff($currently_associated_vars, $posted_terms);
734
  }
735
-
736
- if(isset($_REQUEST["post_ID"])) {
737
  $post_id = $_REQUEST["post_ID"];
738
- } elseif(isset($_REQUEST["product_id"])) {
739
  $post_id = $_REQUEST["product_id"];
740
- } else {
741
- return;
742
- }
743
-
744
  if(!empty($term_ids_to_delete) && (isset($_REQUEST["product_id"]) || isset($post_id))) {
745
  $post_ids_to_delete = array();
746
 
@@ -774,8 +673,6 @@ function wpsc_edit_product_variations($product_id, $post_data) {
774
  }
775
  }
776
  }
777
- _wpsc_refresh_parent_product_terms( $parent_id );
778
-
779
  }
780
 
781
  function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
@@ -830,14 +727,14 @@ function wpsc_ajax_toggle_publish() {
830
 
831
  function wpsc_update_custom_meta($product_id, $post_data) {
832
 
833
- if ( isset( $post_data['new_custom_meta'] ) && $post_data['new_custom_meta'] != null ) {
834
  foreach((array)$post_data['new_custom_meta']['name'] as $key => $name) {
835
  $value = $post_data['new_custom_meta']['value'][(int)$key];
836
  if(($name != '') && ($value != '')) {
837
  add_post_meta($product_id, $name, $value);
838
  }
839
  }
840
- }
841
 
842
  if (!isset($post_data['custom_meta'])) $post_data['custom_meta'] = '';
843
  if($post_data['custom_meta'] != null) {
@@ -856,40 +753,44 @@ function wpsc_update_custom_meta($product_id, $post_data) {
856
  * @param array the file array from $_FILES
857
  * @param array the preview file array from $_FILES
858
  */
859
- function wpsc_item_process_file( $product_id, $submitted_file, $preview_file = null ) {
860
-
861
- add_filter( 'upload_dir', 'wpsc_modify_upload_directory' );
862
-
863
- $time = current_time( 'mysql' );
864
 
865
- if ( $post = get_post( $product_id ) ) {
 
866
  if ( substr( $post->post_date, 0, 4 ) > 0 )
867
  $time = $post->post_date;
868
  }
869
 
870
- $file = wp_handle_upload( $submitted_file, array( 'test_form' => false ), $time );
871
-
872
- if ( isset( $file['error'] ) ) {
873
  return new WP_Error( 'upload_error', $file['error'] );
874
- }
875
 
876
- $name_parts = pathinfo( $file['file'] );
 
 
 
 
 
 
 
877
 
878
  // Construct the attachment array
879
  $attachment = array(
880
- 'post_mime_type' => $file['type'],
881
- 'guid' => $file['url'],
882
- 'post_parent' => $product_id,
883
- 'post_title' => $name_parts['basename'],
884
- 'post_content' => '',
885
- 'post_type' => 'wpsc-product-file',
886
- 'post_status' => 'inherit'
887
  );
888
 
889
  // Save the data
890
- wp_insert_post( $attachment );
891
-
892
- remove_filter( 'upload_dir', 'wpsc_modify_upload_directory' );
893
  }
894
 
895
  function wpsc_modify_upload_directory($input) {
@@ -931,8 +832,7 @@ function wpsc_item_reassign_file($product_id, $selected_files) {
931
  'post_status' => 'any'
932
  );
933
 
934
- $attached_files = (array) get_posts( $args );
935
- $attached_files_by_file = array();
936
 
937
  foreach($attached_files as $key => $attached_file) {
938
  $attached_files_by_file[$attached_file->post_title] = $attached_files[$key];
7
  */
8
 
9
  function wpsc_get_max_upload_size(){
10
+ return wp_convert_bytes_to_hr( wp_max_upload_size() );
11
  }
12
 
13
  /**
18
  * @return nothing
19
  */
20
  function wpsc_admin_submit_product( $post_ID, $post ) {
21
+ global $current_screen, $wpdb;
22
 
23
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || empty( $current_screen ) || $current_screen->id != 'wpsc-product' || $post->post_type != 'wpsc-product' || empty( $_POST['meta'] ) )
24
+ return $post_ID;
 
25
 
26
  //Type-casting ( not so much sanitization, which would be good to do )
27
+ $post_data = stripslashes_deep( $_POST );
28
  $product_id = $post_ID;
29
+ $post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
30
+ $post_meta['meta'] = (array)$_POST['meta'];
 
 
 
 
 
 
31
  if ( isset( $post_data['meta']['_wpsc_price'] ) )
32
  $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
 
33
  if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
34
  $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
35
+ if($post_data['meta']['_wpsc_sku'] == __('N/A', 'wpsc'))
 
36
  $post_data['meta']['_wpsc_sku'] = '';
37
+ if( isset( $post_data['meta']['_wpsc_is_donation'] ) )
38
+ $post_data['meta']['_wpsc_is_donation'] = 1;
39
+ else
40
+ $post_data['meta']['_wpsc_is_donation'] = 0;
 
 
 
41
  if ( ! isset( $post_data['meta']['_wpsc_limited_stock'] ) ){
42
  $post_data['meta']['_wpsc_stock'] = false;
43
  } else {
45
  }
46
 
47
  unset($post_data['meta']['_wpsc_limited_stock']);
48
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'] = 0;
49
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = '';
50
+ if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
51
  if(!isset($post_data['special'])) $post_data['special'] = '';
52
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['no_shipping'])) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = '';
53
 
54
+ $post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'];
55
+ $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
56
  $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
57
  $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
58
+ $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['no_shipping'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  // Product Weight
61
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
62
 
63
  if ( isset( $post_data['meta']['_wpsc_product_metadata']['weight'] ) ) {
64
+ $weight = wpsc_convert_weight($post_data['meta']['_wpsc_product_metadata']['weight'], $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
65
+ $post_data['meta']['_wpsc_product_metadata']['weight'] = wpsc_string_to_float( $weight );
 
66
  $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
67
  }
68
 
69
+ // table rate price
70
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = isset( $post_data['table_rate_price'] ) ? $post_data['table_rate_price'] : array();
 
 
 
71
 
72
+ // if table_rate_price is unticked, wipe the table rate prices
73
+ if ( empty( $post_data['table_rate_price']['state'] ) ) {
74
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = array();
75
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = array();
76
  }
77
 
78
+ if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] ) ) {
79
+ foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value ){
80
+ if(empty($value)){
81
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][$key]);
82
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][$key]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
  }
85
  }
89
  $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] );
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  // Advanced Options
93
+ $post_data['meta']['_wpsc_product_metadata']['engraved'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['engraved'];
94
+ $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'];
95
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
 
 
 
 
 
 
 
 
 
 
 
96
  $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
97
 
98
+ $post_data['meta']['_wpsc_product_metadata']['enable_comments'] = $post_data['meta']['_wpsc_product_metadata']['enable_comments'];
99
+ $post_data['meta']['_wpsc_product_metadata']['merchant_notes'] = $post_data['meta']['_wpsc_product_metadata']['merchant_notes'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
  $post_data['files'] = $_FILES;
102
 
127
  'thumbnail_state' => null
128
  );
129
 
130
+ foreach($product_columns as $column => $default)
131
+ {
132
+ if (!isset($post_data[$column])) $post_data[$column] = '';
133
+
134
+ if($post_data[$column] !== null) {
135
+ $update_values[$column] = $post_data[$column];
136
+ } else if(($update != true) && ($default !== null)) {
137
+ $update_values[$column] = ($default);
138
  }
139
  }
 
140
  // if we succeed, we can do further editing (todo - if_wp_error)
141
 
142
  // if we have no categories selected, assign one.
143
+ if( isset( $post_data['tax_input']['wpsc_product_category'] ) && count( $post_data['tax_input']['wpsc_product_category'] ) == 1 && $post_data['tax_input']['wpsc_product_category'][0] == 0){
144
  $post_data['tax_input']['wpsc_product_category'][1] = wpsc_add_product_category_default($product_id);
 
145
 
146
+ }
147
  // and the meta
148
  wpsc_update_product_meta($product_id, $post_data['meta']);
149
 
150
  // and the custom meta
151
  wpsc_update_custom_meta($product_id, $post_data);
152
 
153
+ //and the alt currency
154
+ if ( ! empty( $post_data['newCurrency'] ) ) {
155
+ foreach( (array) $post_data['newCurrency'] as $key =>$value ){
156
+ wpsc_update_alt_product_currency( $product_id, $value, $post_data['newCurrPrice'][$key] );
 
 
 
 
 
 
 
157
  }
158
  }
159
 
160
+ if($post_data['files']['file']['tmp_name'] != '') {
161
  wpsc_item_process_file($product_id, $post_data['files']['file']);
162
  } else {
163
  if (!isset($post_data['select_product_file'])) $post_data['select_product_file'] = null;
187
  $data['post_status'] = 'inherit';
188
  }
189
 
190
+ if ( !empty( $postarr['meta'] ) && ( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] == 0 || empty( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] ) ) )
191
+ $data["comment_status"] = "closed";
192
+ else
193
+ $data["comment_status"] = "open";
 
194
 
195
  //Can anyone explain to me why this is here?
196
  if ( isset( $sku ) && ( $sku != '' ) )
199
  return $data;
200
  }
201
  add_filter( 'wp_insert_post_data','wpsc_pre_update', 99, 2 );
202
+ add_action( 'save_post', 'wpsc_admin_submit_product', 10, 2 );
203
  add_action( 'admin_notices', 'wpsc_admin_submit_notices' );
204
 
205
  /**
266
 
267
  $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
268
  $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
269
+ $post_data['meta']['_wpsc_sku'] = $post_data['meta']['_wpsc_sku'];
270
  if (!isset($post_data['meta']['_wpsc_is_donation'])) $post_data['meta']['_wpsc_is_donation'] = '';
271
  $post_data['meta']['_wpsc_is_donation'] = (int)(bool)$post_data['meta']['_wpsc_is_donation'];
272
  $post_data['meta']['_wpsc_stock'] = (int)$post_data['meta']['_wpsc_stock'];
338
  );
339
 
340
 
341
+ foreach($product_columns as $column => $default)
342
+ {
343
+ if (!isset($post_data[$column])) $post_data[$column] = '';
344
+
345
+ if($post_data[$column] !== null) {
346
+ $update_values[$column] = $post_data[$column];
347
+ } else if(($update != true) && ($default !== null)) {
348
+ $update_values[$column] = $default;
349
  }
350
  }
351
 
372
  }else {
373
  unstick_post($product_id);
374
  }
375
+ if ($product_id == 0 ) {
376
+ if ( $wp_error ) {
377
+ return new WP_Error('db_insert_error', __( 'Could not insert product into the database', 'wpsc' ), $wpdb->last_error);
378
+ } else {
379
+ return 0;
380
+ }
381
+ }
382
  $adding = true;
383
 
384
  // if we succeed, we can do further editing
420
  }
421
 
422
  if (strchr($price, '-') ) {
423
+ $negative = true;
424
  } else {
425
  $positive = true;
426
  }
467
  $price = (float) get_product_meta( $variation->post_parent, 'price', true );
468
 
469
  if ( ! $term_ids )
470
+ $term_ids = wp_get_object_terms( $variation_id, 'wpsc-variation', array( 'fields' => 'ids' ) );
471
 
472
  $term_price_arr = get_option( 'term_prices' );
473
  foreach ( $term_ids as $term_id ) {
512
  if (!isset($post_data['edit_var_val']))
513
  $post_data['edit_var_val'] = '';
514
 
515
+ $variations = (array)$post_data['edit_var_val'];
516
 
517
  // Generate the arrays for variation sets, values and combinations
518
  $wpsc_combinator = new wpsc_variation_combinator($variations);
526
  // Retrieve the array containing the combinations of each variation set to be associated with this product.
527
  $combinations = $wpsc_combinator->return_combinations();
528
 
529
+ $product_terms = wp_get_object_terms($product_id, 'wpsc-variation');
530
 
531
  $variation_sets_and_values = array_merge($variation_sets, $variation_values);
532
  $variation_sets_and_values = apply_filters('wpsc_edit_product_variation_sets_and_values', $variation_sets_and_values, $product_id);
 
533
  wp_set_object_terms($product_id, $variation_sets_and_values, 'wpsc-variation');
534
 
535
  $parent_id = $_REQUEST['product_id'];
624
  $currently_associated_vars[] = $current->term_id;
625
  }
626
 
 
 
627
  foreach ($posted_term as $term=>$val) {
628
  $posted_terms[] = $term;
629
  if(is_array($val)) {
632
  }
633
  }
634
  }
 
635
  if(!empty($currently_associated_vars)){
636
  $term_ids_to_delete = array();
637
  $term_ids_to_delete = array_diff($currently_associated_vars, $posted_terms);
638
  }
639
+ if(isset($_REQUEST["post_ID"]))
 
640
  $post_id = $_REQUEST["post_ID"];
641
+ elseif(isset($_REQUEST["product_id"]))
642
  $post_id = $_REQUEST["product_id"];
 
 
 
 
643
  if(!empty($term_ids_to_delete) && (isset($_REQUEST["product_id"]) || isset($post_id))) {
644
  $post_ids_to_delete = array();
645
 
673
  }
674
  }
675
  }
 
 
676
  }
677
 
678
  function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
727
 
728
  function wpsc_update_custom_meta($product_id, $post_data) {
729
 
730
+ if($post_data['new_custom_meta'] != null) {
731
  foreach((array)$post_data['new_custom_meta']['name'] as $key => $name) {
732
  $value = $post_data['new_custom_meta']['value'][(int)$key];
733
  if(($name != '') && ($value != '')) {
734
  add_post_meta($product_id, $name, $value);
735
  }
736
  }
737
+ }
738
 
739
  if (!isset($post_data['custom_meta'])) $post_data['custom_meta'] = '';
740
  if($post_data['custom_meta'] != null) {
753
  * @param array the file array from $_FILES
754
  * @param array the preview file array from $_FILES
755
  */
756
+ function wpsc_item_process_file($product_id, $submitted_file, $preview_file = null) {
757
+ global $wpdb;
758
+ add_filter('upload_dir', 'wpsc_modify_upload_directory');
759
+ $overrides = array('test_form'=>false);
 
760
 
761
+ $time = current_time('mysql');
762
+ if ( $post = get_post($product_id) ) {
763
  if ( substr( $post->post_date, 0, 4 ) > 0 )
764
  $time = $post->post_date;
765
  }
766
 
767
+ $file = wp_handle_upload($submitted_file, $overrides, $time);
768
+ if ( isset($file['error']) )
 
769
  return new WP_Error( 'upload_error', $file['error'] );
 
770
 
771
+ $name_parts = pathinfo($file['file']);
772
+ $name = $name_parts['basename'];
773
+
774
+ $url = $file['url'];
775
+ $type = $file['type'];
776
+ $file = $file['file'];
777
+ $title = $name;
778
+ $content = '';
779
 
780
  // Construct the attachment array
781
  $attachment = array(
782
+ 'post_mime_type' => $type,
783
+ 'guid' => $url,
784
+ 'post_parent' => $product_id,
785
+ 'post_title' => $title,
786
+ 'post_content' => $content,
787
+ 'post_type' => "wpsc-product-file",
788
+ 'post_status' => 'inherit'
789
  );
790
 
791
  // Save the data
792
+ $id = wp_insert_post($attachment, $file, $product_id);
793
+ remove_filter('upload_dir', 'wpsc_modify_upload_directory');
 
794
  }
795
 
796
  function wpsc_modify_upload_directory($input) {
832
  'post_status' => 'any'
833
  );
834
 
835
+ $attached_files = (array)get_posts($args);
 
836
 
837
  foreach($attached_files as $key => $attached_file) {
838
  $attached_files_by_file[$attached_file->post_title] = $attached_files[$key];
wpsc-admin/includes/product-variation-list-table.class.php CHANGED
@@ -3,12 +3,8 @@
3
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
4
  require_once( ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php' );
5
 
6
- /**
7
- * Product Variation List Table class
8
- *
9
- * @package wp-e-commerce
10
- */
11
- class WPSC_Product_Variation_List_Table extends WP_List_Table {
12
  private $product_id;
13
  private $object_terms_cache = array();
14
  private $args = array();
@@ -42,9 +38,10 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
42
 
43
  $per_page = $this->get_items_per_page( 'edit_wpsc-product-variations_per_page' );
44
  $per_page = apply_filters( 'edit_wpsc_product_variations_per_page', $per_page );
 
45
  $this->args = array(
46
  'post_type' => 'wpsc-product',
47
- 'orderby' => 'menu_order title',
48
  'post_parent' => $this->product_id,
49
  'post_status' => 'publish, inherit',
50
  'numberposts' => -1,
@@ -172,14 +169,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="' . $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="' . $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 +194,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='" . $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='" . $delete_link . "'>" . __( 'Trash' ) . "</a>";
203
  }
204
 
205
  if ( $force_delete )
206
- $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . $delete_link . "'>" . __( 'Delete Permanently' ) . "</a>";
207
  }
208
 
209
  return $actions;
@@ -211,28 +208,14 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
211
 
212
  public function column_title( $item ) {
213
  $title = implode( ', ', $this->object_terms_cache[$item->ID] );
214
- $thumbnail = wpsc_the_product_thumbnail( false, false, $item->ID, 'manage-products' );
215
  $show_edit_link = apply_filters( 'wpsc_show_product_variations_edit_action', true, $item );
216
 
217
- $nonce = wp_create_nonce( "wpsc_ajax_get_variation_gallery_{$item->ID}" );
218
- $save_gallery_nonce = wp_create_nonce( "wpsc_ajax_update_gallery_{$item->ID}" );
219
- $get_gallery_nonce = wp_create_nonce( "wpsc_ajax_get_gallery_{$item->ID}" );
220
-
221
  if ( ! $thumbnail )
222
  $thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
223
  ?>
224
  <div class="wpsc-product-variation-thumbnail">
225
- <a
226
- target="_blank"
227
- data-featured-nonce="<?php echo esc_attr( wp_create_nonce( "update-post_{$item->ID}" ) ); ?>"
228
- data-nonce="<?php echo esc_attr( $nonce ); ?>"
229
- data-save-gallery-nonce="<?php echo esc_attr( $save_gallery_nonce ); ?>"
230
- data-get-gallery-nonce="<?php echo esc_attr( $get_gallery_nonce ); ?>"
231
- data-image-id="<?php echo get_post_thumbnail_id( $item->ID ); ?>"
232
- data-id="<?php echo $item->ID; ?>"
233
- data-title="<?php echo esc_attr( $title ); ?>"
234
- href="<?php echo esc_url( admin_url( 'media-upload.php?post_id=' . $item->ID . '&width=640&height=566&product_variation=1' ) ) ?>"
235
- >
236
  <img id="wpsc-variation-thumbnail-<?php echo $item->ID; ?>" src="<?php echo esc_url( $thumbnail ); ?>" alt="" />
237
  </a>
238
  </div>
@@ -241,7 +224,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
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 ): ?>
246
  </a>
247
  <?php endif; ?>
@@ -251,25 +234,15 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
251
  <?php
252
  }
253
 
254
- /**
255
- * Stock Column
256
- *
257
- * @uses get_product_meta Get product meta data.
258
- *
259
- * @param object $item Product
260
- */
261
  public function column_stock( $item ) {
262
  $stock = get_product_meta( $item->ID, 'stock', true );
263
- if ( is_numeric( $stock ) )
264
- $stock = absint( $stock );
265
  ?>
266
- <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][stock]" value="<?php echo esc_attr( $stock ); ?>" />
267
  <?php
268
  }
269
 
270
  public function column_price( $item ) {
271
  $price = get_product_meta( $item->ID, 'price', true );
272
- $price = wpsc_format_number( $price );
273
  ?>
274
  <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][price]" value="<?php echo esc_attr( $price ); ?>" />
275
  <?php
@@ -277,8 +250,6 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
277
 
278
  public function column_sale_price( $item ) {
279
  $sale_price = get_product_meta( $item->ID, 'special_price', true );
280
- if ( is_numeric( $sale_price ) )
281
- $sale_price = wpsc_format_number( $sale_price );
282
  ?>
283
  <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][sale_price]" value="<?php echo esc_attr( $sale_price ); ?>">
284
  <?php
@@ -296,7 +267,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
296
  if ( ! $meta || ! isset( $meta['wpec_taxes_taxable_amount'] ) )
297
  $tax = '';
298
  else
299
- $tax = wpsc_format_number( $meta['wpec_taxes_taxable_amount'] );
300
  ?>
301
  <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][product_metadata][wpec_taxes_taxable_amount]" value="<?php echo esc_attr( $tax ); ?>" />
302
  <?php
@@ -418,7 +389,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
418
  <div id="message" class="updated"><p>
419
  <?php
420
  echo join( ' ', $messages ); unset( $messages );
421
- $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] );
422
  echo '</p></div>';
423
  }
424
 
@@ -443,7 +414,7 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
443
  return $actions;
444
  }
445
 
446
- public function bulk_actions( $which = '' ) {
447
  $screen = get_current_screen();
448
 
449
  if ( is_null( $this->_actions ) ) {
@@ -507,11 +478,11 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
507
  $avail_post_stati = get_available_post_statuses( 'wpsc-product' );
508
  $post_type_object = get_post_type_object( 'wpsc-product' );
509
  $post_type = $post_type_object->name;
510
- $url_base = add_query_arg( array(
511
  'action' => 'wpsc_product_variations_table',
512
  'product_id' => $_REQUEST['product_id'],
513
  '_wpnonce' => wp_create_nonce( 'wpsc_product_variations_table' ),
514
- ), admin_url( 'admin-ajax.php' ) );
515
 
516
  if ( !empty($locked_post_status) )
517
  return array();
@@ -672,4 +643,4 @@ class WPSC_Product_Variation_List_Table extends WP_List_Table {
672
  }
673
  ?></div><?php
674
  }
675
- }
3
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
4
  require_once( ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php' );
5
 
6
+ class WPSC_Product_Variation_List_Table extends WP_List_Table
7
+ {
 
 
 
 
8
  private $product_id;
9
  private $object_terms_cache = array();
10
  private $args = array();
38
 
39
  $per_page = $this->get_items_per_page( 'edit_wpsc-product-variations_per_page' );
40
  $per_page = apply_filters( 'edit_wpsc_product_variations_per_page', $per_page );
41
+
42
  $this->args = array(
43
  'post_type' => 'wpsc-product',
44
+ 'orderby' => 'menu_order post_title',
45
  'post_parent' => $this->product_id,
46
  'post_status' => 'publish, inherit',
47
  'numberposts' => -1,
169
  'post' => $item->ID,
170
  'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
171
  ) );
172
+ $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>';
173
  } elseif ( in_array( $item->post_status, array( 'publish', 'inherit' ) ) ) {
174
  $hide_url = add_query_arg( array(
175
  'bulk_action' => 'hide',
176
  'post' => $item->ID,
177
  'bulk_action_nonce' => wp_create_nonce( 'wpsc_product_variations_bulk_action' ),
178
  ) );
179
+ $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>';
180
  }
181
 
182
  if ( current_user_can( $post_type_object->cap->delete_post, $item->ID ) ) {
194
  $restore_url
195
  );
196
  $restore_url = wp_nonce_url( $restore_url, 'untrash-post_' . $item->ID );
197
+ $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . esc_url( $restore_url ) . "'>" . __( 'Restore' ) . "</a>";
198
  } elseif ( EMPTY_TRASH_DAYS ) {
199
+ $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Trash' ) . "</a>";
200
  }
201
 
202
  if ( $force_delete )
203
+ $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . esc_url( $delete_link ) . "'>" . __( 'Delete Permanently' ) . "</a>";
204
  }
205
 
206
  return $actions;
208
 
209
  public function column_title( $item ) {
210
  $title = implode( ', ', $this->object_terms_cache[$item->ID] );
211
+ $thumbnail = wpsc_the_product_thumbnail( 50, 50, $item->ID, '' );
212
  $show_edit_link = apply_filters( 'wpsc_show_product_variations_edit_action', true, $item );
213
 
 
 
 
 
214
  if ( ! $thumbnail )
215
  $thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
216
  ?>
217
  <div class="wpsc-product-variation-thumbnail">
218
+ <a data-title="<?php echo esc_attr( $title ); ?>" href="<?php echo esc_url( admin_url( 'media-upload.php?post_id=' . $item->ID . '&TB_iframe=1&width=640&height=566&product_variation=1' ) ) ?>">
 
 
 
 
 
 
 
 
 
 
219
  <img id="wpsc-variation-thumbnail-<?php echo $item->ID; ?>" src="<?php echo esc_url( $thumbnail ); ?>" alt="" />
220
  </a>
221
  </div>
224
  <?php if ( $show_edit_link ): ?>
225
  <a target="_blank" href="<?php echo esc_url( get_edit_post_link( $item->ID, true ) ); ?>" title="<?php esc_attr_e( __( 'Edit this item' ), 'wpsc' ); ?>">
226
  <?php endif; ?>
227
+ <?php echo esc_html( $title ); ?>
228
  <?php if ( $show_edit_link ): ?>
229
  </a>
230
  <?php endif; ?>
234
  <?php
235
  }
236
 
 
 
 
 
 
 
 
237
  public function column_stock( $item ) {
238
  $stock = get_product_meta( $item->ID, 'stock', true );
 
 
239
  ?>
240
+ <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][stock]" value="<?php echo esc_attr( $stock ); ?>" />
241
  <?php
242
  }
243
 
244
  public function column_price( $item ) {
245
  $price = get_product_meta( $item->ID, 'price', true );
 
246
  ?>
247
  <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][price]" value="<?php echo esc_attr( $price ); ?>" />
248
  <?php
250
 
251
  public function column_sale_price( $item ) {
252
  $sale_price = get_product_meta( $item->ID, 'special_price', true );
 
 
253
  ?>
254
  <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][sale_price]" value="<?php echo esc_attr( $sale_price ); ?>">
255
  <?php
267
  if ( ! $meta || ! isset( $meta['wpec_taxes_taxable_amount'] ) )
268
  $tax = '';
269
  else
270
+ $tax = (float) $meta['wpec_taxes_taxable_amount'];
271
  ?>
272
  <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][product_metadata][wpec_taxes_taxable_amount]" value="<?php echo esc_attr( $tax ); ?>" />
273
  <?php
389
  <div id="message" class="updated"><p>
390
  <?php
391
  echo join( ' ', $messages ); unset( $messages );
392
+ $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] ) );
393
  echo '</p></div>';
394
  }
395
 
414
  return $actions;
415
  }
416
 
417
+ public function bulk_actions() {
418
  $screen = get_current_screen();
419
 
420
  if ( is_null( $this->_actions ) ) {
478
  $avail_post_stati = get_available_post_statuses( 'wpsc-product' );
479
  $post_type_object = get_post_type_object( 'wpsc-product' );
480
  $post_type = $post_type_object->name;
481
+ $url_base = esc_url( add_query_arg( array(
482
  'action' => 'wpsc_product_variations_table',
483
  'product_id' => $_REQUEST['product_id'],
484
  '_wpnonce' => wp_create_nonce( 'wpsc_product_variations_table' ),
485
+ ), admin_url( 'admin-ajax.php' ) ) );
486
 
487
  if ( !empty($locked_post_status) )
488
  return array();
643
  }
644
  ?></div><?php
645
  }
646
+ }
wpsc-admin/includes/product-variations-manage.page.php CHANGED
File without changes
wpsc-admin/includes/product-variations-page.class.php CHANGED
@@ -1,15 +1,10 @@
1
  <?php
2
 
3
- /**
4
- * The Product Variations page class in the WordPress admin
5
- *
6
- * @package wp-e-commerce
7
- */
8
-
9
- class WPSC_Product_Variations_Page {
10
  private $list_table;
11
  private $parent_id;
12
- private $current_tab;
13
  private $post;
14
 
15
  public function __construct() {
@@ -18,18 +13,8 @@ class WPSC_Product_Variations_Page {
18
  $this->parent_id = absint( $_REQUEST['product_id'] );
19
  set_current_screen();
20
 
21
- if ( ! empty( $_REQUEST['tab'] ) ) {
22
  $this->current_tab = $_REQUEST['tab'];
23
- } else {
24
- $args = array(
25
- 'post_parent' => $this->parent_id,
26
- 'post_type' => 'wpsc-product',
27
- 'post_status' => 'any');
28
-
29
- $number_of_variations = count(get_children($args));
30
-
31
- $this->current_tab = ($number_of_variations > 0) ? 'manage' : 'setup';
32
- }
33
  }
34
 
35
  private function merge_meta_deep( $original, $updated ) {
@@ -39,7 +24,7 @@ class WPSC_Product_Variations_Page {
39
  if ( ! isset( $updated[$key] ) )
40
  continue;
41
 
42
- if ( isset( $original[$key] ) && is_array( $original[$key] ) ) {
43
  $original[$key] = $this->merge_meta_deep( $original[$key] , $updated[$key] );
44
  } else {
45
  $original[$key] = $updated[$key];
@@ -52,49 +37,30 @@ class WPSC_Product_Variations_Page {
52
  return $original;
53
  }
54
 
55
- /* */
56
  private function save_variation_meta( $id, $data ) {
57
-
58
  $product_meta = get_product_meta( $id, 'product_metadata', true );
59
-
60
- if ( ! is_array( $product_meta ) ) {
61
- $product_meta = array();
62
- }
63
-
64
  $product_meta = $this->merge_meta_deep( $product_meta, $data['product_metadata'] );
65
 
66
  // convert to pound to maintain backward compat with shipping modules
67
- if ( isset( $data['product_metadata']['weight'] ) || isset( $data['product_metadata']['weight_unit'] ) ) {
68
  $product_meta['weight'] = wpsc_convert_weight( $product_meta['weight'], $product_meta['weight_unit'], 'pound', true );
69
- }
70
 
71
  update_product_meta( $id, 'product_metadata', $product_meta );
72
 
73
- if ( isset( $data['price'] ) ) {
74
- update_product_meta( $id, 'price', wpsc_string_to_float( $data['price'] ) );
75
- }
76
-
77
- if ( isset( $data['sale_price'] ) ) {
78
 
79
- $sale_price = wpsc_string_to_float( $data['sale_price'] );
 
80
 
81
- if ( is_numeric( $sale_price ) ) {
82
- update_product_meta( $id, 'special_price', wpsc_string_to_float( $data['sale_price'] ) );
83
- } else {
84
- update_product_meta( $id, 'special_price', '' );
85
- }
86
- }
87
-
88
- if ( isset( $data['sku'] ) ) {
89
  update_product_meta( $id, 'sku', $data['sku'] );
90
- }
91
 
92
  if ( isset( $data['stock'] ) ) {
93
- if ( is_numeric( $data['stock'] ) ) {
94
- update_product_meta( $id, 'stock', (int) $data['stock'] );
95
- } else {
96
  update_product_meta( $id, 'stock', '' );
97
- }
98
  }
99
  }
100
 
@@ -107,18 +73,13 @@ class WPSC_Product_Variations_Page {
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. */
112
  foreach ( $_REQUEST['wpsc_variations'] as $id => $data ) {
113
- if ( ! isset( $data['product_metadata']['no_shipping'] ) ) {
114
- $data['product_metadata']['no_shipping'] = '';
115
- }
116
  $this->save_variation_meta( $id, $data );
117
  }
118
  }
119
 
120
  public function display() {
121
- global $title, $hook_suffix, $wp_locale, $pagenow, $wp_version, $is_iphone,
122
  $current_site, $update_title, $total_update_count, $parent_file;
123
 
124
  $current_screen = get_current_screen();
@@ -134,8 +95,6 @@ class WPSC_Product_Variations_Page {
134
  wp_enqueue_script( 'jquery-color' );
135
  wp_enqueue_script( 'utils' );
136
  wp_enqueue_script( 'jquery-query' );
137
- wp_enqueue_media( array( 'post' => absint( $_REQUEST['product_id'] ) ) );
138
-
139
 
140
  $callback = "callback_tab_{$this->current_tab}";
141
  if ( ! is_callable( array( $this, "callback_tab_{$this->current_tab}" ) ) )
@@ -152,12 +111,11 @@ class WPSC_Product_Variations_Page {
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">';
157
  foreach ( $tabs as $tab => $title ) {
158
- $class = ( $tab == $this->current_tab ) ? ' class="tabs"' : '';
159
  $item = '<li' . $class . '>';
160
- $item .= '<a href="' . add_query_arg( 'tab', $tab ) . '">' . esc_html( $title ) . '</a></li> ';
161
  echo $item;
162
  }
163
  echo '</ul>';
@@ -189,7 +147,7 @@ class WPSC_Product_Variations_Page {
189
  '_wp_http_referer',
190
  'updated',
191
  ) );
192
- wp_redirect( add_query_arg( 'tab', 'manage', $sendback ) );
193
  exit;
194
  }
195
 
@@ -217,7 +175,7 @@ class WPSC_Product_Variations_Page {
217
 
218
  $trashed++;
219
  }
220
- return add_query_arg( array( 'trashed' => $trashed, 'ids' => join( ',', $post_ids ) ) );
221
  }
222
 
223
  public function process_bulk_action_untrash( $post_ids ) {
@@ -232,7 +190,7 @@ class WPSC_Product_Variations_Page {
232
 
233
  $untrashed++;
234
  }
235
- return add_query_arg( 'untrashed', $untrashed );
236
  }
237
 
238
  public function process_bulk_action_delete( $post_ids ) {
@@ -253,7 +211,7 @@ class WPSC_Product_Variations_Page {
253
  }
254
  $deleted++;
255
  }
256
- return add_query_arg( 'deleted', $deleted );
257
  }
258
 
259
  public function process_bulk_action_hide( $post_ids ) {
@@ -265,7 +223,7 @@ class WPSC_Product_Variations_Page {
265
  ) );
266
  $updated ++;
267
  }
268
- return add_query_arg( 'updated', $updated );
269
  }
270
 
271
  public function process_bulk_action_show( $post_ids ) {
@@ -277,7 +235,7 @@ class WPSC_Product_Variations_Page {
277
  ) );
278
  $updated ++;
279
  }
280
- return add_query_arg( 'updated', $updated );
281
  }
282
 
283
  private function save_bulk_edited_items() {
@@ -313,18 +271,12 @@ class WPSC_Product_Variations_Page {
313
  unset( $data['product_metadata']['weight_unit'] );
314
  }
315
 
316
- if ( empty( $fields['measurements']['dimensions'] ) ) {
317
- foreach ( array( 'height', 'width', 'length' ) as $field ) {
318
  unset( $data['product_metadata']['dimensions'][$field] );
319
  unset( $data['product_metadata']['dimensions'][$field . '_unit'] );
320
- }
321
- } else {
322
- foreach ( array( 'height', 'width', 'length' ) as $field ) {
323
- $data['product_metadata']['dimensions'][$field . '_unit'] = "cm";
324
  }
325
  }
326
-
327
- unset( $data['product_metadata']['dimensions_unit'] );
328
  }
329
 
330
  unset( $data['post'] );
@@ -345,7 +297,7 @@ class WPSC_Product_Variations_Page {
345
  'last_paged'
346
  ), $sendback );
347
  $sendback = add_query_arg( 'updated', count( $ids ), $sendback );
348
- wp_redirect( $sendback );
349
  exit;
350
  }
351
 
@@ -389,7 +341,7 @@ class WPSC_Product_Variations_Page {
389
  _wpsc_refresh_parent_product_terms( $this->parent_id );
390
  _wpsc_add_refresh_variation_parent_term_hooks();
391
  if ( $current_action != 'edit' ) {
392
- wp_redirect( $sendback );
393
  exit;
394
  }
395
  }
@@ -420,4 +372,4 @@ function _wpsc_admin_html_begin() {
420
  <head>
421
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
422
  <?php
423
- }
1
  <?php
2
 
3
+ class WPSC_Product_Variations_Page
4
+ {
 
 
 
 
 
5
  private $list_table;
6
  private $parent_id;
7
+ private $current_tab = 'manage';
8
  private $post;
9
 
10
  public function __construct() {
13
  $this->parent_id = absint( $_REQUEST['product_id'] );
14
  set_current_screen();
15
 
16
+ if ( ! empty( $_REQUEST['tab'] ) )
17
  $this->current_tab = $_REQUEST['tab'];
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
  private function merge_meta_deep( $original, $updated ) {
24
  if ( ! isset( $updated[$key] ) )
25
  continue;
26
 
27
+ if ( is_array( $original[$key] ) ) {
28
  $original[$key] = $this->merge_meta_deep( $original[$key] , $updated[$key] );
29
  } else {
30
  $original[$key] = $updated[$key];
37
  return $original;
38
  }
39
 
 
40
  private function save_variation_meta( $id, $data ) {
 
41
  $product_meta = get_product_meta( $id, 'product_metadata', true );
 
 
 
 
 
42
  $product_meta = $this->merge_meta_deep( $product_meta, $data['product_metadata'] );
43
 
44
  // convert to pound to maintain backward compat with shipping modules
45
+ if ( isset( $data['product_metadata']['weight'] ) || isset( $data['product_metadata']['weight_unit'] ) )
46
  $product_meta['weight'] = wpsc_convert_weight( $product_meta['weight'], $product_meta['weight_unit'], 'pound', true );
 
47
 
48
  update_product_meta( $id, 'product_metadata', $product_meta );
49
 
50
+ if ( isset( $data['price'] ) )
51
+ update_product_meta( $id, 'price', (float) $data['price'] );
 
 
 
52
 
53
+ if ( isset( $data['sale_price'] ) )
54
+ update_product_meta( $id, 'special_price', $data['sale_price'] );
55
 
56
+ if ( isset( $data['sku'] ) )
 
 
 
 
 
 
 
57
  update_product_meta( $id, 'sku', $data['sku'] );
 
58
 
59
  if ( isset( $data['stock'] ) ) {
60
+ if ( is_numeric( $data['stock'] ) )
61
+ update_product_meta( $id, 'stock', absint( $data['stock'] ) );
62
+ else
63
  update_product_meta( $id, 'stock', '' );
 
64
  }
65
  }
66
 
73
  if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
74
  wp_die( __( 'Cheatin&#8217; uh?' ) );
75
 
 
 
76
  foreach ( $_REQUEST['wpsc_variations'] as $id => $data ) {
 
 
 
77
  $this->save_variation_meta( $id, $data );
78
  }
79
  }
80
 
81
  public function display() {
82
+ global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version, $is_iphone,
83
  $current_site, $update_title, $total_update_count, $parent_file;
84
 
85
  $current_screen = get_current_screen();
95
  wp_enqueue_script( 'jquery-color' );
96
  wp_enqueue_script( 'utils' );
97
  wp_enqueue_script( 'jquery-query' );
 
 
98
 
99
  $callback = "callback_tab_{$this->current_tab}";
100
  if ( ! is_callable( array( $this, "callback_tab_{$this->current_tab}" ) ) )
111
  'manage' => _x( 'Manage', 'manage product variations', 'wpsc' ),
112
  'setup' => __( 'Setup', 'wpsc' ),
113
  );
114
+ echo '<ul class="wpsc-product-variations-tabs">';
 
115
  foreach ( $tabs as $tab => $title ) {
116
+ $class = ( $tab == $this->current_tab ) ? ' class="active"' : '';
117
  $item = '<li' . $class . '>';
118
+ $item .= '<a href="' . esc_url( add_query_arg( 'tab', $tab ) ) . '">' . esc_html( $title ) . '</a></li>';
119
  echo $item;
120
  }
121
  echo '</ul>';
147
  '_wp_http_referer',
148
  'updated',
149
  ) );
150
+ wp_redirect( esc_url( add_query_arg( 'tab', 'manage', $sendback ) ) );
151
  exit;
152
  }
153
 
175
 
176
  $trashed++;
177
  }
178
+ return esc_url( add_query_arg( array( 'trashed' => $trashed, 'ids' => join( ',', $post_ids ) ) ) );
179
  }
180
 
181
  public function process_bulk_action_untrash( $post_ids ) {
190
 
191
  $untrashed++;
192
  }
193
+ return esc_url( add_query_arg( 'untrashed', $untrashed ) );
194
  }
195
 
196
  public function process_bulk_action_delete( $post_ids ) {
211
  }
212
  $deleted++;
213
  }
214
+ return esc_url( add_query_arg( 'deleted', $deleted ) );
215
  }
216
 
217
  public function process_bulk_action_hide( $post_ids ) {
223
  ) );
224
  $updated ++;
225
  }
226
+ return esc_url( add_query_arg( 'updated', $updated ) );
227
  }
228
 
229
  public function process_bulk_action_show( $post_ids ) {
235
  ) );
236
  $updated ++;
237
  }
238
+ return esc_url( add_query_arg( 'updated', $updated ) );
239
  }
240
 
241
  private function save_bulk_edited_items() {
271
  unset( $data['product_metadata']['weight_unit'] );
272
  }
273
 
274
+ foreach ( array( 'height', 'width', 'length' ) as $field ) {
275
+ if ( empty( $fields['measurements'][$field] ) ) {
276
  unset( $data['product_metadata']['dimensions'][$field] );
277
  unset( $data['product_metadata']['dimensions'][$field . '_unit'] );
 
 
 
 
278
  }
279
  }
 
 
280
  }
281
 
282
  unset( $data['post'] );
297
  'last_paged'
298
  ), $sendback );
299
  $sendback = add_query_arg( 'updated', count( $ids ), $sendback );
300
+ wp_redirect( esc_url( $sendback ) );
301
  exit;
302
  }
303
 
341
  _wpsc_refresh_parent_product_terms( $this->parent_id );
342
  _wpsc_add_refresh_variation_parent_term_hooks();
343
  if ( $current_action != 'edit' ) {
344
+ wp_redirect( esc_url( $sendback ) );
345
  exit;
346
  }
347
  }
372
  <head>
373
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
374
  <?php
375
+ }
wpsc-admin/includes/product-variations-setup.page.php CHANGED
@@ -14,7 +14,7 @@
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
 
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( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
18
  </p>
19
  </div>
20
 
wpsc-admin/includes/product-variations.page.php CHANGED
@@ -30,23 +30,13 @@ var userSettings = {
30
  }
31
  </style>
32
  </head>
33
- <?php
34
-
35
- $admin_body_class = ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
36
- $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
37
- $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
38
- $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
39
-
40
- ?>
41
- <body class="no-js wp-admin wp-core-ui wpsc-product-variation-iframe<?php echo $admin_body_class; ?>">
42
  <script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
43
 
44
- <div id="post-body">
45
- <div id="wpsc-product-variations-wrapper" class="categorydiv wpsc-categorydiv">
46
- <?php $this->display_tabs(); ?>
47
- <div class="wpsc-product-variations-tab-content tabs-panel">
48
- <?php $this->display_current_tab(); ?>
49
- </div>
50
  </div>
51
  </div>
52
 
30
  }
31
  </style>
32
  </head>
33
+ <body class="no-js wp-admin wp-core-ui wpsc-product-variation-iframe">
 
 
 
 
 
 
 
 
34
  <script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
35
 
36
+ <div id="wpsc-product-variations-wrapper">
37
+ <?php $this->display_tabs(); ?>
38
+ <div class="wpsc-product-variations-tab-content">
39
+ <?php $this->display_current_tab(); ?>
 
 
40
  </div>
41
  </div>
42
 
wpsc-admin/includes/products.php CHANGED
File without changes
wpsc-admin/includes/purchase-log-action-links.php DELETED
@@ -1,482 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Purchase Log Action Links Class
5
- *
6
- * Manages and displays a links of action links when editing a puchase log.
7
- *
8
- * @package wp-e-commerce
9
- * @since 3.9.0
10
- *
11
- * @link https://github.com/wp-e-commerce/WP-e-Commerce/pull/1562
12
- */
13
- class WPSC_Purchase_Log_Action_Links {
14
-
15
- /**
16
- * Purchase Log ID.
17
- *
18
- * @since 3.9.0
19
- * @access private
20
- * @var int
21
- */
22
- protected $log_id;
23
-
24
- /**
25
- * An array of WPSC_Purchase_Log_Action_Link objects.
26
- *
27
- * @since 3.9.0
28
- * @access private
29
- * @var array
30
- */
31
- protected $links;
32
-
33
- /**
34
- * Setup all action links.
35
- *
36
- * @since 3.9.0
37
- *
38
- * @param int $log_id Purchase log ID.
39
- */
40
- public function __construct( $log_id ) {
41
-
42
- $this->log_id = absint( $log_id );
43
-
44
- // Create and validate links.
45
- $this->_create_links();
46
- $this->_validate_links();
47
-
48
- }
49
-
50
- /**
51
- * Create Action Links
52
- *
53
- * Packing slip and email receipt links are available by default.
54
- * Action links are filterable via the 'wpsc_purchlogitem_links' filter which passes the purchase log ID.
55
- * Delete and back links are always required and added after the filter.
56
- *
57
- * @since 3.9.0
58
- * @access private
59
- */
60
- private function _create_links() {
61
-
62
- // Add default links.
63
- if ( wpsc_purchlogs_have_downloads_locked() != false ) {
64
- $this->links[] = $this->get_downloads_lock_link();
65
- }
66
- $this->links[] = $this->get_packing_slip_link();
67
- $this->links[] = $this->get_email_receipt_link();
68
-
69
- // Filter action links.
70
- $this->links = apply_filters( 'wpsc_purchlogitem_links', $this->links, $this->log_id );
71
-
72
- // Add delete and back links.
73
- $this->links[] = $this->_get_delete_link();
74
- $this->links[] = $this->_get_back_link();
75
-
76
- }
77
-
78
- /**
79
- * Validate Links
80
- *
81
- * Validates all links are WPSC_Purchase_Log_Action_Link objects.
82
- *
83
- * @since 3.9.0
84
- * @access private
85
- */
86
- private function _validate_links() {
87
-
88
- $this->links = array_map( array( $this, '_validate_link' ), $this->links );
89
- $this->links = array_filter( $this->links );
90
-
91
- }
92
-
93
- /**
94
- * Validate Link
95
- *
96
- * Validates a WPSC_Purchase_Log_Action_Link object.
97
- *
98
- * @since 3.9.0
99
- * @access private
100
- *
101
- * @todo Check that the WPSC_Purchase_Log_Action_Link ID is unique and reject if not - maybe not here.
102
- *
103
- * @param WPSC_Purchase_Log_Action_Link $action_link Action link object.
104
- * @return WPSC_Purchase_Log_Action_Link|boolean If valid, the action link object, otherwise false.
105
- */
106
- private function _validate_link( $action_link ) {
107
-
108
- if ( is_a( $action_link, 'WPSC_Purchase_Log_Action_Link' ) ) {
109
- return $action_link;
110
- }
111
-
112
- return false;
113
-
114
- }
115
-
116
- /**
117
- * Downloads Lock Action Link
118
- *
119
- * @since 3.9.0
120
- * @access private
121
- *
122
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
123
- */
124
- private function get_downloads_lock_link() {
125
-
126
- return new WPSC_Purchase_Log_Action_Link( 'downloads_lock', wpsc_purchlogs_have_downloads_locked(), $this->log_id, array(
127
- 'ajax' => true,
128
- 'dashicon' => 'dashicons-lock'
129
- ) );
130
-
131
- }
132
-
133
- /**
134
- * View Packing Slip Action Link
135
- *
136
- * @since 3.9.0
137
- * @access private
138
- *
139
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
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
147
- ) ) ),
148
- 'dashicon' => 'dashicons-format-aside',
149
- 'attributes' => array(
150
- 'target' => 'wpsc_packing_slip'
151
- )
152
- ) );
153
-
154
- }
155
-
156
- /**
157
- * Resend Email Receipt Action Link
158
- *
159
- * @since 3.9.0
160
- * @access private
161
- *
162
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
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
- ) );
170
-
171
- }
172
-
173
- /**
174
- * Delete Action Link
175
- *
176
- * @since 3.9.0
177
- * @access private
178
- *
179
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
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
-
190
- }
191
-
192
- /**
193
- * Back Action Link
194
- *
195
- * @since 3.9.0
196
- * @access private
197
- *
198
- * @return WPSC_Purchase_Log_Action_Link Instance of an action link object.
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
- ) );
206
-
207
- }
208
-
209
- /**
210
- * Display Link List Items
211
- *
212
- * @since 3.9.0
213
- *
214
- * Outputs action links as a series of list item tags to be included in an HTML list.
215
- */
216
- public function display_link_list_items() {
217
-
218
- foreach ( $this->links as $link ) {
219
- echo '<li>' . $link->get_link_display() . '</li>';
220
- }
221
-
222
- }
223
-
224
- }
225
-
226
- /**
227
- * Purchase Log Action Link Class
228
- *
229
- * Creates, styles and handles a purchase log action link.
230
- *
231
- * @since 3.9.0
232
- */
233
- class WPSC_Purchase_Log_Action_Link {
234
-
235
- /**
236
- * Action Link ID.
237
- *
238
- * @since 3.9.0
239
- * @access private
240
- * @var string
241
- */
242
- private $id;
243
-
244
- /**
245
- * Action Link Title Text.
246
- *
247
- * @since 3.9.0
248
- * @access private
249
- * @var string
250
- */
251
- private $title;
252
-
253
- /**
254
- * Purchase Log ID.
255
- *
256
- * @since 3.9.0
257
- * @access private
258
- * @var int
259
- */
260
- private $log_id;
261
-
262
- /**
263
- * Action Link Settings.
264
- *
265
- * @since 3.9.0
266
- * @access private
267
- * @var array
268
- */
269
- private $args;
270
-
271
- /**
272
- * Define the action link.
273
- *
274
- * @since 3.9.0
275
- *
276
- * @param string $id Action link ID (will be sanitized).
277
- * @param string $title Link text.
278
- * @param array $args Action link settings.
279
- */
280
- public function __construct( $id, $title, $log_id, $args = array() ) {
281
-
282
- $this->id = sanitize_key( $id );
283
- $this->title = $title;
284
- $this->log_id = absint( $log_id );
285
- $this->args = $this->_validate_settings( $args );
286
-
287
- }
288
-
289
- /**
290
- * Validate Settings
291
- *
292
- * Checks settings and adds defaults where required.
293
- *
294
- * The 'attributes' setting allows additional attributes to be added to the link tag if required.
295
- * 'title' and 'href' attributes are removed as these are created via the 'url' and 'description' settings.
296
- *
297
- * Any class attributes are added to the 'wpsc-purchlog-action-{$id}' class we generate.
298
- *
299
- * @since 3.9.0
300
- * @access private
301
- *
302
- * @param array $args Supplied settings.
303
- * @return array Validated settings.
304
- */
305
- private function _validate_settings( $args ) {
306
-
307
- $args = wp_parse_args( $args, array(
308
- 'url' => '',
309
- 'description' => '',
310
- 'dashicon' => '',
311
- 'attributes' => array(),
312
- 'ajax' => false
313
- ) );
314
-
315
- // Use title if no description.
316
- if ( empty( $args['description'] ) ) {
317
- $args['description'] = $this->title;
318
- }
319
-
320
- // Use default arrow dashicon if none specified.
321
- if ( empty( $args['dashicon'] ) ) {
322
- $args['dashicon'] = 'dashicons-arrow-right-alt';
323
- }
324
-
325
- // Remove href and title attributes.
326
- if ( is_array( $args['attributes'] ) ) {
327
- if ( array_key_exists( 'title', $args['attributes'] ) ) {
328
- unset( $args['attributes']['title'] );
329
- }
330
- if ( array_key_exists( 'href', $args['attributes'] ) ) {
331
- unset( $args['attributes']['href'] );
332
- }
333
- } else {
334
- $args['attributes'] = array();
335
- }
336
-
337
- // Add class and append any extra classes.
338
- if ( ! array_key_exists( 'class', $args['attributes'] ) ) {
339
- $args['attributes']['class'] = '';
340
- }
341
- $args['attributes']['class'] = 'wpsc-purchlog-action-link ' . trim( $this->get_html_class() . ' ' . $args['attributes']['class'] );
342
-
343
- // Add AJAX class
344
- if ( $args['ajax'] ) {
345
- $args['attributes']['class'] .= ' is-ajax';
346
- }
347
-
348
- return $args;
349
-
350
- }
351
-
352
- /**
353
- * Get HTML Class
354
- *
355
- * @since 3.9.0
356
- *
357
- * @return string Action link class.
358
- */
359
- public function get_html_class() {
360
-
361
- return 'wpsc-purchlog-action-link-' . sanitize_html_class( $this->id );
362
-
363
- }
364
-
365
- /**
366
- * Get Link Display
367
- *
368
- * @since 3.9.0
369
- *
370
- * @return string HTML action link.
371
- */
372
- public function get_link_display() {
373
-
374
- return sprintf( '<a href="%s" title="%s" %s>%s%s</a>',
375
- esc_attr( $this->get_link_url() ),
376
- esc_attr( $this->args['description'] ),
377
- $this->_get_link_attributes_string(),
378
- $this->_get_dashicon_display(),
379
- esc_html( $this->title )
380
- );
381
-
382
- }
383
-
384
- /**
385
- * Get Link URL
386
- *
387
- * Returns the custom URL if specified.
388
- * Otherwise returns a callback URL.
389
- *
390
- * @since 3.9.0
391
- *
392
- * @return string URL.
393
- */
394
- public function get_link_url() {
395
-
396
- // Custom URL
397
- if ( ! empty( $this->args['url'] ) ) {
398
- return $this->args['url'];
399
- }
400
-
401
- // Callback URL
402
- $url = add_query_arg( array( 'wpsc_purchase_log_action' => $this->id, 'id' => $this->log_id ) );
403
- $url = wp_nonce_url( $url, 'wpsc_purchase_log_action_' . $this->id );
404
-
405
- return $url;
406
-
407
- }
408
-
409
- /**
410
- * Get Link Attributes String
411
- *
412
- * @since 3.9.0
413
- * @access private
414
- *
415
- * @return string Link attributes HTML.
416
- */
417
- private function _get_link_attributes_string() {
418
-
419
- $atts = array();
420
- foreach ( $this->args['attributes'] as $att => $val ) {
421
- $att_key = sanitize_html_class( $att );
422
-
423
- // Don't override attributes that we set elsewhere
424
- if ( in_array( $att_key, array( 'href', 'title' ) ) ) {
425
- continue;
426
- }
427
-
428
- $atts[] = $att_key . '="' . esc_attr( $val ) . '"';
429
- }
430
-
431
- // Data attributes for JS/AJAX
432
- $atts[] = 'data-purchase-log-action="' . esc_attr( $this->id ) . '"';
433
- $atts[] = 'data-nonce="' . esc_attr( wp_create_nonce( 'wpsc_purchase_log_action_ajax_' . $this->id ) ) . '"';
434
-
435
- return implode( ' ', $atts );
436
-
437
- }
438
-
439
- /**
440
- * Get Dashicon Display
441
- *
442
- * @since 3.9.0
443
- * @access private
444
- *
445
- * @return string Dashicon HTML element.
446
- */
447
- private function _get_dashicon_display() {
448
-
449
- return '<span class="dashicons ' . $this->_sanitize_html_classes( $this->args['dashicon'] ) . '"></span>';
450
-
451
- }
452
-
453
- /**
454
- * Sanitize HTML Classes
455
- *
456
- * Handles sanitizing multiple classes provided as a string.
457
- *
458
- * @since 3.9.0
459
- * @access private
460
- *
461
- * @param string|array $classes Classes.
462
- * @return string Santized classes.
463
- */
464
- private function _sanitize_html_classes( $classes ) {
465
-
466
- // Convert multiple classes string to an array.
467
- if ( ! is_array( $classes ) && strpos( $classes, ' ' ) !== false ) {
468
- $classes = explode( ' ', $classes );
469
- }
470
-
471
- // Sanitize and return multiple classes.
472
- if ( is_array( $classes ) ) {
473
- $classes = array_map( 'sanitize_html_class', $classes );
474
- return implode( ' ', $classes );
475
- }
476
-
477
- // Sanitize single class.
478
- return sanitize_html_class( $classes );
479
-
480
- }
481
-
482
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/purchase-log-list-table-class.php CHANGED
@@ -5,7 +5,8 @@
5
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6
  require_once( ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php' );
7
 
8
- class WPSC_Purchase_Log_List_Table extends WP_List_Table {
 
9
  private $search_box = true;
10
  private $bulk_actions = true;
11
  private $sortable = true;
@@ -20,9 +21,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
20
 
21
  public function __construct( $args = array() ) {
22
  $args['plural'] = 'purchase-logs';
23
-
24
- $this->set_per_page( $this->set_purchase_logs_per_page_by_user() );
25
-
26
  parent::__construct( $args );
27
 
28
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
@@ -49,14 +47,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
49
  $this->views = false;
50
  }
51
 
52
- private function set_purchase_logs_per_page_by_user() {
53
-
54
- $per_page = get_user_meta( get_current_user_id(), 'wpsc_purchases_per_page', true );
55
-
56
- return empty( $per_page ) || $per_page < 1 ? 20 : $per_page;
57
- }
58
-
59
- // Override the default Purchase Logs Per Page
60
  public function set_per_page( $per_page ) {
61
  $this->per_page = (int) $per_page;
62
  }
@@ -75,42 +65,32 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
75
  $joins = array();
76
  $where = array( '1 = 1' );
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;
84
  $selects = array( 'p.id', 'p.totalprice AS amount', 'p.processed AS status', 'p.track_id', 'p.date' );
85
  $selects[] = '
86
  (
87
- SELECT SUM(quantity) FROM ' . WPSC_TABLE_CART_CONTENTS . ' AS c
88
  WHERE c.purchaseid = p.id
89
  ) AS item_count';
90
 
91
  $search_terms = empty( $_REQUEST['s'] ) ? array() : explode( ' ', $_REQUEST['s'] );
92
- $search_sql = array();
93
-
94
  foreach ( $checkout_fields as $field ) {
95
- $table_as = 's' . $i;
96
  $select_as = str_replace('billing', '', $field->unique_name );
97
  $selects[] = $table_as . '.value AS ' . $select_as;
98
- $joins[] = $wpdb->prepare( "LEFT OUTER JOIN " . WPSC_TABLE_SUBMITTED_FORM_DATA . " AS {$table_as} ON {$table_as}.log_id = p.id AND {$table_as}.form_id = %d", $field->id );
99
 
100
  // build search term queries for first name, last name, email
101
  foreach ( $search_terms as $term ) {
 
 
 
102
 
103
- if ( version_compare( $GLOBALS['wp_version'], '4.0', '>=' ) ) {
104
- $escaped_term = esc_sql( like_escape( $term ) );
105
- } else {
106
- $escaped_term = esc_sql( $wpdb->esc_like( $term ) );
107
- }
108
-
109
- if ( ! array_key_exists( $term, $search_sql ) ) {
110
- $search_sql[ $term ] = array();
111
- }
112
-
113
- $search_sql[ $term ][] = $table_as . ".value LIKE '%" . $escaped_term . "%'";
114
  }
115
 
116
  $i++;
@@ -118,10 +98,10 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
118
 
119
  // combine query phrases into a single query string
120
  foreach ( $search_terms as $term ) {
121
- $search_sql[ $term ][] = "p.track_id = '" . esc_sql( $term ) . "'";
122
  if ( is_numeric( $term ) )
123
- $search_sql[ $term ][] = 'p.id = ' . esc_sql( $term );
124
- $search_sql[ $term ] = '(' . implode( ' OR ', $search_sql[ $term ] ) . ')';
125
  }
126
  $search_sql = implode( ' AND ', array_values( $search_sql ) );
127
 
@@ -145,29 +125,27 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
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
 
154
  $orderby = empty( $_REQUEST['orderby'] ) ? 'p.id' : 'p.' . $_REQUEST['orderby'];
155
- $order = empty( $_REQUEST['order'] ) ? 'DESC' : $_REQUEST['order'];
156
 
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
164
  {$this->joins}
165
  WHERE {$this->where}
166
  ORDER BY {$orderby} {$order}
167
  {$limit}
168
- " );
169
-
170
- $this->items = apply_filters( 'wpsc_manage_purchase_logs_items', $wpdb->get_results( $purchase_log_sql ) );
171
  if ( $this->per_page ) {
172
  $total_items = $wpdb->get_var( "SELECT FOUND_ROWS()" );
173
 
@@ -177,8 +155,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
177
  ) );
178
  }
179
 
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
  }
@@ -186,7 +163,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
186
  $total_sql = "
187
  SELECT SUM(totalprice)
188
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
189
- {$this->joins}
190
  WHERE {$total_where}
191
  ";
192
 
@@ -209,13 +185,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
209
  return $this->search_box;
210
  }
211
 
212
- /**
213
- * Define the columns in our list table. You can add/amend this list using
214
- * WordPress core filter manage_{screen}_columns, specifically
215
- * manage_dashboard_page_wpsc-purchase-logs_columns.
216
- *
217
- * @return array[string]string List of column headings
218
- */
219
  public function get_columns() {
220
  return array(
221
  'cb' => '<input type="checkbox" />',
@@ -224,17 +193,10 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
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
 
231
- /**
232
- * Define the columns in the table which are sortable. You can add/amend
233
- * this list using the WordPress core filter manage_{screen}_sortable_columns
234
- * Specifically: manage_dashboard_page_wpsc-purchase-logs_sortable_columns
235
- * *
236
- * @return array[string]string List of sortable column IDs and corresponding db column of the item
237
- */
238
  public function get_sortable_columns() {
239
  if ( ! $this->sortable )
240
  return array();
@@ -243,7 +205,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
243
  'date' => 'id',
244
  'status' => 'processed',
245
  'amount' => 'totalprice',
246
- ) ;
247
  }
248
 
249
  private function get_months() {
@@ -259,7 +221,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
259
  $sql = "
260
  SELECT DISTINCT YEAR(FROM_UNIXTIME(date)) AS year, MONTH(FROM_UNIXTIME(date)) AS month
261
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
262
- {$this->joins}
263
  WHERE {$this->where_no_filter}
264
  ORDER BY date DESC
265
  ";
@@ -315,7 +276,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
315
  'all' => sprintf(
316
  '<a href="%s" %s>%s</a>',
317
  esc_url( $all_href ),
318
- $all_class,
319
  $all_text
320
  ),
321
  );
@@ -341,7 +302,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
341
  $views[$status] = sprintf(
342
  '<a href="%s" %s>%s</a>',
343
  esc_url( $href ),
344
- $class,
345
  $text
346
  );
347
  }
@@ -349,7 +310,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
349
  return $views;
350
  }
351
 
352
- public function months_dropdown( $post_type = '' ) {
353
  global $wp_locale;
354
 
355
  $m = isset( $_REQUEST['m'] ) ? $_REQUEST['m'] : 0;
@@ -430,36 +391,15 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
430
  'c' => 'item_details',
431
  'id' => $item->id,
432
  ), $location );
433
- return $location;
434
  }
435
 
436
  public function column_customer( $item ) {
437
-
438
- $name = '';
439
-
440
- if ( isset( $item->firstname ) ) {
441
- $name .= $item->firstname;
442
- }
443
-
444
- if ( isset( $item->lastname ) ) {
445
- $name .= ' ' . $item->lastname;
446
- }
447
-
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 ) ) : ?>
461
- <small><?php echo make_clickable( $item->email ); ?></small>
462
- <?php endif; ?>
463
  <?php
464
  }
465
 
@@ -475,7 +415,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
475
  'updated',
476
  'deleted',
477
  ), $location );
478
- return $location;
479
  }
480
 
481
  public function column_id( $item ) {
@@ -510,13 +450,13 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
510
 
511
  public function column_default( $item, $column_name ) {
512
  $default = isset( $item->$column_name ) ? $item->$column_name : '';
513
- $output = apply_filters( 'wpsc_manage_purchase_logs_custom_column', $default, $column_name, $item );
514
  return $output;
515
  }
516
 
517
  public function column_status( $item ) {
518
  global $wpsc_purchlog_statuses;
519
- $dropdown_options = '';
520
  $current_status = false;
521
  foreach ( $wpsc_purchlog_statuses as $status ) {
522
  $selected = '';
@@ -531,7 +471,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
531
  echo '<select class="wpsc-purchase-log-status" data-log-id="' . $item->id . '">';
532
  echo $dropdown_options;
533
  echo '</select>';
534
- echo '<img src="' . esc_url( wpsc_get_ajax_spinner() ) . '" class="ajax-feedback" title="" alt="" />';
535
  }
536
 
537
  public function column_tracking( $item ) {
@@ -542,7 +482,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
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
@@ -570,4 +510,4 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
570
 
571
  parent::search_box( $text, $input_id );
572
  }
573
- }
5
  require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
6
  require_once( ABSPATH . 'wp-admin/includes/class-wp-posts-list-table.php' );
7
 
8
+ class WPSC_Purchase_Log_List_Table extends WP_List_Table
9
+ {
10
  private $search_box = true;
11
  private $bulk_actions = true;
12
  private $sortable = true;
21
 
22
  public function __construct( $args = array() ) {
23
  $args['plural'] = 'purchase-logs';
 
 
 
24
  parent::__construct( $args );
25
 
26
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
47
  $this->views = false;
48
  }
49
 
 
 
 
 
 
 
 
 
50
  public function set_per_page( $per_page ) {
51
  $this->per_page = (int) $per_page;
52
  }
65
  $joins = array();
66
  $where = array( '1 = 1' );
67
 
68
+ if ( isset( $_REQUEST['post'] ) )
69
+ $where[] = 'p.id IN (' . implode( ', ', $_REQUEST['post'] ) . ')';
 
 
70
 
71
  $i = 1;
72
  $selects = array( 'p.id', 'p.totalprice AS amount', 'p.processed AS status', 'p.track_id', 'p.date' );
73
  $selects[] = '
74
  (
75
+ SELECT COUNT(*) FROM ' . WPSC_TABLE_CART_CONTENTS . ' AS c
76
  WHERE c.purchaseid = p.id
77
  ) AS item_count';
78
 
79
  $search_terms = empty( $_REQUEST['s'] ) ? array() : explode( ' ', $_REQUEST['s'] );
80
+ $search_sql = array();
 
81
  foreach ( $checkout_fields as $field ) {
82
+ $table_as = 's' . $i;
83
  $select_as = str_replace('billing', '', $field->unique_name );
84
  $selects[] = $table_as . '.value AS ' . $select_as;
85
+ $joins[] = $wpdb->prepare( "LEFT OUTER JOIN " . WPSC_TABLE_SUBMITED_FORM_DATA . " AS {$table_as} ON {$table_as}.log_id = p.id AND {$table_as}.form_id = %d", $field->id );
86
 
87
  // build search term queries for first name, last name, email
88
  foreach ( $search_terms as $term ) {
89
+ $escaped_term = esc_sql( like_escape( $term ) );
90
+ if ( ! array_key_exists( $term, $search_sql ) )
91
+ $search_sql[$term] = array();
92
 
93
+ $search_sql[$term][] = $table_as . ".value LIKE '%" . $escaped_term . "%'";
 
 
 
 
 
 
 
 
 
 
94
  }
95
 
96
  $i++;
98
 
99
  // combine query phrases into a single query string
100
  foreach ( $search_terms as $term ) {
101
+ $search_sql[$term][] = "p.track_id = '" . esc_sql( $term ) . "'";
102
  if ( is_numeric( $term ) )
103
+ $search_sql[$term][] = 'p.id = ' . esc_sql( $term );
104
+ $search_sql[$term] = '(' . implode( ' OR ', $search_sql[$term] ) . ')';
105
  }
106
  $search_sql = implode( ' AND ', array_values( $search_sql ) );
107
 
125
  $where[] = "MONTH(FROM_UNIXTIME(date)) = " . esc_sql( $month );
126
  }
127
 
128
+ $selects = implode( ', ', $selects );
129
+ $this->joins = implode( ' ', $joins );
130
+ $this->where = implode( ' AND ', $where );
 
131
  $limit = ( $this->per_page !== 0 ) ? "LIMIT {$offset}, {$this->per_page}" : '';
132
 
133
  $orderby = empty( $_REQUEST['orderby'] ) ? 'p.id' : 'p.' . $_REQUEST['orderby'];
134
+ $order = empty( $_REQUEST['order'] ) ? 'DESC' : $_REQUEST['order'];
135
 
136
+ $orderby = esc_sql( $orderby );
137
+ $order = esc_sql( $order );
138
 
139
+ $submitted_data_log = WPSC_TABLE_SUBMITED_FORM_DATA;
140
+ $purchase_log_sql = "
141
  SELECT SQL_CALC_FOUND_ROWS {$selects}
142
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
143
  {$this->joins}
144
  WHERE {$this->where}
145
  ORDER BY {$orderby} {$order}
146
  {$limit}
147
+ ";
148
+ $this->items = $wpdb->get_results( $purchase_log_sql );
 
149
  if ( $this->per_page ) {
150
  $total_items = $wpdb->get_var( "SELECT FOUND_ROWS()" );
151
 
155
  ) );
156
  }
157
 
158
+ $total_where = $this->where;
 
159
  if ( $this->status == 'all' ) {
160
  $total_where .= ' AND p.processed IN (2, 3, 4) ';
161
  }
163
  $total_sql = "
164
  SELECT SUM(totalprice)
165
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
 
166
  WHERE {$total_where}
167
  ";
168
 
185
  return $this->search_box;
186
  }
187
 
 
 
 
 
 
 
 
188
  public function get_columns() {
189
  return array(
190
  'cb' => '<input type="checkbox" />',
193
  'amount' => __( 'Amount', 'wpsc' ),
194
  'status' => _x( 'Status', 'sales log list table column', 'wpsc' ),
195
  'date' => __( 'Date', 'wpsc' ),
196
+ 'tracking' => __( 'Tracking ID', 'wpsc' ),
197
+ );
198
  }
199
 
 
 
 
 
 
 
 
200
  public function get_sortable_columns() {
201
  if ( ! $this->sortable )
202
  return array();
205
  'date' => 'id',
206
  'status' => 'processed',
207
  'amount' => 'totalprice',
208
+ );
209
  }
210
 
211
  private function get_months() {
221
  $sql = "
222
  SELECT DISTINCT YEAR(FROM_UNIXTIME(date)) AS year, MONTH(FROM_UNIXTIME(date)) AS month
223
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
 
224
  WHERE {$this->where_no_filter}
225
  ORDER BY date DESC
226
  ";
276
  'all' => sprintf(
277
  '<a href="%s" %s>%s</a>',
278
  esc_url( $all_href ),
279
+ sanitize_html_class( $all_class ),
280
  $all_text
281
  ),
282
  );
302
  $views[$status] = sprintf(
303
  '<a href="%s" %s>%s</a>',
304
  esc_url( $href ),
305
+ sanitize_html_class( $class ),
306
  $text
307
  );
308
  }
310
  return $views;
311
  }
312
 
313
+ public function months_dropdown() {
314
  global $wp_locale;
315
 
316
  $m = isset( $_REQUEST['m'] ) ? $_REQUEST['m'] : 0;
391
  'c' => 'item_details',
392
  'id' => $item->id,
393
  ), $location );
394
+ return esc_url( $location );
395
  }
396
 
397
  public function column_customer( $item ) {
398
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  <strong>
400
+ <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( $item->firstname . ' ' . $item->lastname ); ?></a>
401
  </strong><br />
402
+ <small><?php echo make_clickable( $item->email ); ?></small>
 
 
 
403
  <?php
404
  }
405
 
415
  'updated',
416
  'deleted',
417
  ), $location );
418
+ return esc_url( $location );
419
  }
420
 
421
  public function column_id( $item ) {
450
 
451
  public function column_default( $item, $column_name ) {
452
  $default = isset( $item->$column_name ) ? $item->$column_name : '';
453
+ $output = apply_filters( 'wpsc_manage_purchase_logs_custom_column', $default, $column_name, $item );
454
  return $output;
455
  }
456
 
457
  public function column_status( $item ) {
458
  global $wpsc_purchlog_statuses;
459
+ $dropdown_options = array();
460
  $current_status = false;
461
  foreach ( $wpsc_purchlog_statuses as $status ) {
462
  $selected = '';
471
  echo '<select class="wpsc-purchase-log-status" data-log-id="' . $item->id . '">';
472
  echo $dropdown_options;
473
  echo '</select>';
474
+ echo '<img src="' . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . '" class="ajax-feedback" title="" alt="" />';
475
  }
476
 
477
  public function column_tracking( $item ) {
482
  <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wpsc' ); ?></a>
483
  <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
484
  <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wpsc' ); ?></a>
485
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
486
  <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wpsc' ); ?></a></small>
487
  </div>
488
  <?php
510
 
511
  parent::search_box( $text, $input_id );
512
  }
513
+ }
wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php CHANGED
File without changes
wpsc-admin/includes/purchase-logs-page/item-details.php CHANGED
@@ -2,9 +2,8 @@
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>
@@ -17,71 +16,50 @@
17
 
18
  <div id='post-body'>
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 } ?>
54
- </blockquote>
55
- <?php do_action( 'wpsc_shipping_details_bottom', $this->log_id ); ?>
56
  </div>
57
  <?php endif ?>
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'>
@@ -102,26 +80,26 @@
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>
@@ -137,29 +115,43 @@
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>
145
  </div>
 
146
 
147
  <?php $this->purchase_logs_checkout_fields(); ?>
148
- <?php do_action( 'wpsc_purchlogitem_metabox_end', $this->log_id ); ?>
149
 
150
  </div>
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
158
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-action-links.php' );
159
- $action_links = new WPSC_Purchase_Log_Action_Links( $this->log_id );
160
- $action_links->display_link_list_items();
161
- ?>
162
- </ul>
 
 
 
 
 
163
  </div>
 
164
 
165
  </div>
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; ?></span>
6
+ </h2>
 
7
  <?php if ( $receipt_sent ): ?>
8
  <div class="updated">
9
  <p><?php esc_html_e( 'Receipt has been resent successfully.', 'wpsc' ); ?></p>
16
 
17
  <div id='post-body'>
18
  <?php if ( wpsc_has_purchlog_shipping() ): ?>
 
19
  <div id='wpsc_shipping_details_box'>
20
+ <h3><?php esc_html_e( 'Shipping Details', 'wpsc' ); ?></h3>
21
+ <h4><?php esc_html_e( 'Shipping Address', 'wpsc' ); ?></h4>
22
+ <p><strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong></p>
23
+ <p>
24
+ <?php echo wpsc_display_purchlog_shipping_address(); ?><br />
25
+ <?php echo wpsc_display_purchlog_shipping_city(); ?><br />
26
+ <?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?><br />
27
+ <?php echo wpsc_display_purchlog_shipping_country(); ?><br />
28
+ </p>
29
+ <h4><?php esc_html_e( 'Shipping Options', 'wpsc' ); ?></h4>
30
+ <p>
31
+ <?php esc_html_e( 'Shipping Method:', 'wpsc' ); ?> <?php echo wpsc_display_purchlog_shipping_method(); ?><br />
32
+ <?php esc_html_e( 'Shipping Option:', 'wpsc' ); ?> <?php echo wpsc_display_purchlog_shipping_option(); ?><br />
33
+ <?php if( wpsc_purchlogs_has_tracking() ) : ?>
34
+ <?php esc_html_e( 'Tracking ID:', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackid(); ?><br />
35
+ <?php esc_html_e( 'Shipping Status:', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackstatus(); ?><br />
36
+ <?php esc_html_e( 'Track History:', 'wpsc' ); ?> <?php echo wpsc_purchlogitem_trackhistory(); ?>
37
+ <?php endif; ?>
38
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  </div>
40
  <?php endif ?>
41
 
42
  <div id='wpsc_billing_details_box'>
43
+ <?php do_action( 'wpsc_billing_details_top' ); ?>
44
  <h3><?php esc_html_e( 'Billing Details', 'wpsc' ); ?></h3>
45
+ <p><strong><?php esc_html_e( 'Purchase Log Date:', 'wpsc' ); ?> </strong><?php echo wpsc_purchaselog_details_date(); ?> </p>
46
+ <p><strong><?php esc_html_e( 'Purchase Number:', 'wpsc' ); ?> </strong><?php echo wpsc_purchaselog_details_purchnumber(); ?> </p>
47
+ <p><strong><?php esc_html_e( 'Buyers Name:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_buyers_name(); ?></p>
48
+ <p>
49
+ <strong><?php esc_html_e( 'Address:', 'wpsc' ); ?> </strong><br />
50
+ <?php echo wpsc_display_purchlog_buyers_address(); ?><br />
51
+ <?php echo wpsc_display_purchlog_buyers_city(); ?><br />
52
+ <?php echo wpsc_display_purchlog_buyers_state_and_postcode(); ?><br />
53
+ <?php echo wpsc_display_purchlog_buyers_country(); ?><br />
54
+ </p>
55
+
56
+ <p><strong><?php esc_html_e( 'Phone:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_buyers_phone(); ?></p>
57
+ <p><strong><?php esc_html_e( 'Email:', 'wpsc' ); ?> </strong><a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=<?php echo rawurlencode( sprintf( __( 'Message from %s', 'wpsc' ), site_url() ) ); ?>"><?php echo wpsc_display_purchlog_buyers_email(); ?></a></p>
58
+ <p><strong><?php esc_html_e( 'Payment Method:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?></p>
59
+ <?php if(wpsc_display_purchlog_display_howtheyfoundus()) : ?>
60
+ <p><strong><?php esc_html_e( 'How User Found Us:', 'wpsc' ); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?></p>
61
+ <?php endif; ?>
62
+ <?php do_action( 'wpsc_billing_details_bottom'); ?>
 
 
 
 
 
63
  </div>
64
 
65
  <div id='wpsc_items_ordered'>
80
  <?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
81
  <?php endif; ?>
82
  </td>
83
+ <th><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
84
  <td><?php echo wpsc_display_purchlog_discount(); ?></td>
85
  </tr>
86
 
87
  <?php if( ! wpec_display_product_tax() ): ?>
88
  <tr>
89
  <td colspan='<?php echo $cols; ?>'></td>
90
+ <th><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
91
  <td><?php echo wpsc_display_purchlog_taxes(); ?></td>
92
  </tr>
93
  <?php endif; ?>
94
 
95
  <tr>
96
  <td colspan='<?php echo $cols; ?>'></td>
97
+ <th><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
98
  <td><?php echo wpsc_display_purchlog_shipping(); ?></td>
99
  </tr>
100
  <tr>
101
  <td colspan='<?php echo $cols; ?>'></td>
102
+ <th><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
103
  <td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
104
  </tr>
105
  </tbody>
115
  <input type='hidden' name='wpsc_admin_action' value='purchlogs_update_notes' />
116
  <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' ); ?>" />
117
  <input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
118
+ <p>
119
+ <textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php
120
+ if ( isset( $_POST['purchlog_notes'] ) ) {
121
+ echo esc_textarea( stripslashes( $_POST['purchlog_notes'] ) );
122
+ } else {
123
+ echo wpsc_display_purchlog_notes();
124
+ }
125
+ ?></textarea>
126
+ </p>
127
+ <p><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></p>
128
  </form>
129
  </div>
130
  </div>
131
  </div>
132
+ <!-- End Order Notes (by Ben) -->
133
 
134
  <?php $this->purchase_logs_checkout_fields(); ?>
 
135
 
136
  </div>
137
  </div>
138
 
139
+ <div id='wpsc_purchlogitems_links'>
140
  <h3><?php esc_html_e( 'Actions', 'wpsc' ); ?></h3>
141
  <?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
142
+ <?php if ( wpsc_purchlogs_have_downloads_locked() != false ): ?>
143
+ <img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/lock_open.png' alt='<?php _e( 'clear lock icon', 'wpsc' ); ?>' />&ensp;<a href='<?php echo $_SERVER['REQUEST_URI'].'&amp;wpsc_admin_action=clear_locks'; ?>'><?php echo wpsc_purchlogs_have_downloads_locked(); ?></a><br /><br class='small' />
144
+ <?php endif; ?>
145
+ <img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/printer.png' alt='<?php _e( 'printer icon', 'wpsc' ); ?>' />&ensp;<a target="_blank" href='<?php echo esc_url( add_query_arg( 'c', 'packing_slip' ) ); ?>'><?php esc_html_e( 'View Packing Slip', 'wpsc' ); ?></a>
146
+ <br /><br class='small' />
147
+ <img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/email_go.png' alt='<?php _e( 'email icon', 'wpsc' ); ?>' />&ensp;<a href='<?php echo esc_url( add_query_arg( 'email_buyer_id', $this->log_id ) ); ?>'><?php esc_html_e('Resend Receipt to Buyer', 'wpsc'); ?></a>
148
+
149
+ <br /><br class='small' />
150
+ <a class='submitdelete' title='<?php echo esc_attr(__( 'Remove this log', 'wpsc' )); ?>' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&amp;purchlog_id=".$this->log_id, 'delete_purchlog_' .$this->log_id); ?>' onclick="if ( confirm(' <?php echo 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;"><img src='<?php echo WPSC_CORE_IMAGES_URL . "/cross.png"; ?>' alt='<?php _e( 'delete icon', 'wpsc' ); ?>' /> &nbsp;<?php _e('Remove this record', 'wpsc') ?></a>
151
+
152
+ <br /><br class='small' />&emsp;&ensp; <a href='<?php echo esc_attr( wp_get_referer() ); ?>'><?php _e('Go Back', 'wpsc'); ?></a>
153
+ <br /><br />
154
  </div>
155
+ <br />
156
 
157
  </div>
wpsc-admin/includes/purchase-logs-page/list-table.php CHANGED
@@ -24,11 +24,11 @@
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' ), 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, add_query_arg( 'c', 'upgrade_purchase_logs_3_8' ) ); ?></span></div>
32
  <?php endif; ?>
33
 
34
  <form id="purchase-logs-search" method-"get" action="">
@@ -74,10 +74,18 @@
74
  <?php do_action( 'wpsc_purchase_logs_list_table_after' ); ?>
75
  </form>
76
 
 
 
 
 
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>
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 e-Commerce 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 e-Commerce %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="">
74
  <?php do_action( 'wpsc_purchase_logs_list_table_after' ); ?>
75
  </form>
76
 
77
+ <?php
78
+ $piggy_url = 'http://www.bravenewcode.com/store/plugins/piggy/?utm_source=affiliate-6331&utm_medium=affiliates&utm_campaign=wpec#1';
79
+ ?>
80
+
81
  <p>
82
  <a class='admin_download' href='<?php echo esc_url( add_query_arg( 'action', 'download_csv' ) ); ?>' >
83
  <img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/download.gif' alt='' title='' />
84
  <span><?php _e( 'Download CSV', 'wpsc' ); ?></span>
85
  </a>
86
+ <a target="_blank" class='admin_download' href='<?php echo esc_url( $piggy_url) ; ?>'>
87
+ <img class='wpsc_pushdown_img' src='<?php echo esc_url( WPSC_CORE_IMAGES_URL ); ?>/mobile.png' alt='' title='' />
88
+ <span><?php _e( 'Mobile Sales App', 'wpsc' ); ?></span>
89
+ </a>
90
  </p>
91
  </div>
wpsc-admin/includes/purchase-logs-page/packing-slip.php CHANGED
@@ -104,7 +104,6 @@
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>
110
  <tbody>
@@ -113,7 +112,6 @@
113
  <td><?php echo wpsc_purchaselog_details_purchnumber(); ?></td>
114
  <td><?php echo wpsc_display_purchlog_shipping_method(); ?></td>
115
  <td><?php echo wpsc_display_purchlog_paymentmethod(); ?></td>
116
- <?php wpsc_purchaselog_order_summary(); ?>
117
  </tr>
118
  </tbody>
119
  </table>
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
  </tr>
108
  </thead>
109
  <tbody>
112
  <td><?php echo wpsc_purchaselog_details_purchnumber(); ?></td>
113
  <td><?php echo wpsc_display_purchlog_shipping_method(); ?></td>
114
  <td><?php echo wpsc_display_purchlog_paymentmethod(); ?></td>
 
115
  </tr>
116
  </tbody>
117
  </table>
wpsc-admin/includes/purchase-logs-page/upgrade.php CHANGED
@@ -4,10 +4,10 @@
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' ), 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'>
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 e-Commerce 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'>
wpsc-admin/includes/save-data.functions.php CHANGED
@@ -12,17 +12,14 @@ function wpsc_ajax_set_variation_order(){
12
  $parent_id = $_POST['parent_id'];
13
 
14
  $result = true;
15
- foreach( $sort_order as $key => $value ) {
16
-
17
- if ( empty( $value ) ) {
18
  continue;
19
- }
20
 
21
  $value = preg_replace( '/[^0-9]/', '', $value );
22
 
23
- if ( ! wpsc_update_meta( $value, 'sort_order', $key, 'wpsc_variation' ) ) {
24
  $result = false;
25
- }
26
  }
27
  }
28
 
@@ -41,13 +38,13 @@ function wpsc_ajax_set_category_order(){
41
  $parent_id = $_POST['parent_id'];
42
 
43
  $result = true;
44
- foreach ( $sort_order as $key=>$value ){
45
  if ( empty( $value ) )
46
  continue;
47
 
48
  $value = preg_replace( '/[^0-9]/', '', $value );
49
 
50
- if ( ! wpsc_update_meta( $value, 'sort_order', $key, 'wpsc_category' ) )
51
  $result = false;
52
  }
53
  }
@@ -68,42 +65,39 @@ add_action( 'edited_wpsc_product_category', 'wpsc_save_category_set', 10 , 2 );
68
  */
69
 
70
  function wpsc_custom_category_columns( $columns ) {
71
- // Doing it this funny way to ensure that image stays in far left, even if other items are added via plugin.
72
- unset( $columns["cb"] );
73
 
74
- $custom_array = array(
75
- 'cb' => '<input type="checkbox" />',
76
- 'image' => __( 'Image', 'wpsc' )
77
- );
78
 
79
- $columns = array_merge( $custom_array, $columns );
80
 
81
- return $columns;
82
  }
83
-
84
  /**
85
- * Custom Category Column Data
86
- *
87
- * Adds images to the custom category column.
88
- *
89
- * @param string $string Column output.
90
- * @param string $column_name Column name.
91
- * @param string $term_id Term ID.
92
- * @return string Updated column output.
93
  */
 
94
  function wpsc_custom_category_column_data( $string, $column_name, $term_id ) {
95
- if ( 'image' == $column_name ) {
96
- $term = get_term_by( 'id', $term_id, 'wpsc_product_category' );
97
- $image = wpsc_get_categorymeta( $term_id, 'image' );
 
 
 
 
 
 
 
 
 
98
 
99
- $format = '<img src="%s" title="%s" alt="%2$s" width="30" height="30" />';
100
- if ( ! empty( $image ) ) {
101
- $string = sprintf( $format, WPSC_CORE_IMAGES_URL . $image, esc_attr( $term->name ) );
102
- } else {
103
- $string = sprintf( $format, WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif', esc_attr( $term->name ) );
104
- }
105
- }
106
- return $string;
107
  }
108
 
109
  /**
@@ -112,36 +106,28 @@ function wpsc_custom_category_column_data( $string, $column_name, $term_id ) {
112
  * for use in other list functions
113
  * @param int $parent_id
114
  */
115
- function wpsc_admin_get_category_array( $parent_id = null ){
116
- global $wpdb;
117
-
118
- $orderedList = array();
119
-
120
- if ( ! isset( $parent_id ) )
121
- $parent_id = 0;
122
-
123
- $category_list = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $parent_id );
124
-
125
- if ( ! is_array( $category_list ) ) {
126
- return false;
127
- }
128
-
129
- foreach ( $category_list as $category ) {
130
- $category_order = wpsc_get_categorymeta( $category->term_id, 'order' );
131
- $category_image = wpsc_get_categorymeta( $category->term_id, 'image' );
132
-
133
- if ( ! isset( $category_order ) || $category_order == 0 )
134
- $category_order = ( count( $orderedList ) + 1 );
135
- print "<!-- setting category Order number to " . $category_order . "-->";
136
- $orderedList[$category_order]['id'] = $category->term_id;
137
- $orderedList[$category_order]['name'] = $category->name;
138
- $orderedList[$category_order]['image'] = $category_image;
139
- $orderedList[$category_order]['parent_id'] = $parent_id;
140
- $orderedList[$category_order]['children'] = wpsc_admin_get_category_array( $category->term_id );
141
- }
142
-
143
- ksort( $orderedList );
144
- return $orderedList;
145
  }
146
 
147
  /**
@@ -154,110 +140,145 @@ function wpsc_admin_category_forms_add() {
154
  $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
155
  ?>
156
 
157
- <h3><?php esc_html_e('Advanced Store Settings', 'wpsc'); ?></h3>
158
- <h4><?php esc_html_e('Presentation Settings', 'wpsc'); ?></h4>
159
- <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wpsc' ); ?></p>
160
- <div style="margin: 15px 0 15px 0">
161
- <label for='image'><?php esc_html_e( 'Category Image' , 'wpsc' ); ?></label>
162
- <input type='file' name='image' value='' />
163
- </div>
164
- <div class="form-field">
165
- <label for='display_type'><?php esc_html_e( 'Product Display', 'wpsc' ); ?></label>
166
- <select name='display_type'>
167
- <option value='default'<?php checked( $display_type, 'default' ); ?>><?php esc_html_e('Default View', 'wpsc'); ?></option>
168
- <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>
169
- <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>
170
- </select>
171
- </div>
172
- <?php if ( function_exists( "getimagesize" ) ) : ?>
173
- <div class="form-field">
174
- <?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?>
175
- <fieldset class="wpsc-width-height-fields">
176
- <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?></span></legend>
177
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
178
- <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">
179
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
180
- <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">
181
- </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  </div>
183
- <?php endif;?>
184
-
185
- <!-- START OF TARGET MARKET SELECTION -->
186
- <?php
187
 
 
 
 
 
188
  $category_id = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
- if ( isset( $_GET['tag_ID'] ) ) {
191
- $category_id = absint( $_GET['tag_ID'] );
 
 
 
 
 
 
 
 
 
 
192
  }
 
 
193
 
194
- $countrylist = WPSC_Countries::get_countries_array( true, true );
195
- $selectedCountries = wpsc_get_meta( $category_id, 'target_market', 'wpsc_category' );
196
- ?>
197
- <h4><?php esc_html_e( 'Restrict to Target Markets', 'wpsc' )?></h4>
198
- <div class='form-field'>
199
- <?php if ( wpsc_is_suhosin_enabled() ) : ?>
200
- <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>
201
- <?php else: ?>
202
- <div class='multiple-select-container'>
203
- <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 />
204
- <div id='resizeable' class='ui-widget-content multiple-select'>
205
- <?php foreach( $countrylist as $country ): ?>
206
- <?php if ( in_array( $country['id'], (array)$selectedCountries ) ): ?>
207
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
208
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
209
- <?php else: ?>
210
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
211
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
212
- <?php endif; ?>
213
- <?php endforeach; ?>
214
- </div>
215
- </div>
216
- <span class='wpscsmall description'><?php esc_html_e( 'Select the markets you are selling this category to.', 'wpsc' ); ?><span>
217
- <?php endif; ?>
218
  </div>
 
219
 
220
- <!-- Checkout settings -->
221
- <h4><?php esc_html_e( 'Checkout Settings', 'wpsc' ); ?></h4>
222
-
223
- <?php
224
- if ( ! isset( $category['term_id'] ) ) $category['term_id'] = '';
225
- $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
226
- ?>
227
- <div class='form-field'>
228
- <label for="use_additional_form_set"><?php esc_html_e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
229
- <select name='use_additional_form_set'>
230
- <option value=''><?php esc_html_e( 'None', 'wpsc' ); ?></option>
231
  <?php
232
- $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
233
- unset( $checkout_sets[0] );
234
-
235
- foreach ( (array)$checkout_sets as $key => $value ) {
236
- $selected_state = "";
237
- if ( $used_additonal_form_set == $key )
238
- $selected_state = "selected='selected'";
239
- ?>
240
- <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo esc_html( $value ); ?></option>
241
- <?php
242
- }
243
- ?>
244
- </select>
245
- </div>
246
-
247
- <?php $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' ); ?>
248
- <div>
249
- <label><?php esc_html_e( 'Address to calculate shipping with', 'wpsc' ); ?></label>
250
- <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>
251
- <label><input type="radio" value="1" name="uses_billing_address" <?php checked( $uses_billing_address, 1 ); ?> /> <?php esc_html_e( 'Billing Address', 'wpsc' ); ?></label>
252
- <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wpsc' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  </div>
 
254
 
255
- <table class="category_forms">
256
- <tr>
257
 
258
- </tr>
259
- </table>
260
- <?php
261
  }
262
 
263
  /**
@@ -280,190 +301,178 @@ function wpsc_admin_category_forms_edit() {
280
  $category_name = '';
281
  $category = array();
282
 
283
- $category_id = absint( $_REQUEST["tag_ID"] );
284
- $category = get_term( $category_id, 'wpsc_product_category', ARRAY_A );
285
- $category['nice-name'] = wpsc_get_categorymeta( $category['term_id'], 'nice-name' );
286
- $category['description'] = wpsc_get_categorymeta( $category['term_id'], 'description' );
287
- $category['image'] = wpsc_get_categorymeta( $category['term_id'], 'image' );
288
- $category['fee'] = wpsc_get_categorymeta( $category['term_id'], 'fee' );
289
- $category['active'] = wpsc_get_categorymeta( $category['term_id'], 'active' );
290
- $category['order'] = wpsc_get_categorymeta( $category['term_id'], 'order' );
291
- $category['display_type'] = wpsc_get_categorymeta( $category['term_id'], 'display_type' );
292
- $category['image_height'] = wpsc_get_categorymeta( $category['term_id'], 'image_height' );
293
- $category['image_width'] = wpsc_get_categorymeta( $category['term_id'], 'image_width' );
294
- $category['use_additional_form_set'] = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
 
295
 
296
  ?>
297
 
298
- <tr>
299
- <td colspan="2">
300
- <h3><?php esc_html_e( 'Advanced Store Settings', 'wpsc' ); ?></h3>
301
- <h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h4>
302
- <p class='description'><?php esc_html_e( 'These settings override the general presentation settings found in Settings &gt; Store &gt; Presentation.', 'wpsc' ); ?></p>
303
- </td>
304
- </tr>
305
 
 
 
306
 
307
  <tr class="form-field">
308
- <th scope="row" valign="top">
309
- <label for="display_type"><?php esc_html_e( 'Catalog View', 'wpsc' ); ?></label>
310
- </th>
311
- <td>
312
- <?php
313
- $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
314
- ?>
315
- <select name='display_type'>
316
- <option value='default'<?php selected( $display_type, 'default' ); ?>><?php esc_html_e( 'Default View', 'wpsc' ); ?></option>
317
- <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>
318
- <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>
319
- </select><br />
320
- </td>
 
321
  </tr>
322
- <tr class="form-field">
323
- <th scope="row" valign="top">
324
- <label for="image"><?php esc_html_e( 'Category Image', 'wpsc' ); ?></label>
325
- </th>
326
- <td>
327
- <?php
328
- $category_image = wpsc_category_image( $category['term_id'] );
329
- if ( $category_image )
330
- echo '<p><img src=' . esc_url( $category_image ) . ' alt="' . esc_attr( $category['name'] ) . '" title="' . esc_attr( $category['name'] ) . '" class="wpsc_category_image" /></p>';
331
- ?>
332
- <input type='file' name='image' value='' /><br />
333
- <label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php esc_html_e( 'Delete Image', 'wpsc' ); ?></label><br/>
334
- <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>
335
- </td>
336
  </tr>
337
- <?php if ( function_exists( "getimagesize" ) ) : ?>
338
- <tr class="form-field">
339
- <th scope="row" valign="top">
340
- <label for="image"><?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?></label>
341
- </th>
342
- <td>
343
- <fieldset class="wpsc-width-height-fields">
344
- <legend class="screen-reader-text"><span><?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?></span></legend>
345
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
346
- <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">
347
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
348
- <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">
349
- </fieldset>
350
- </td>
351
- </tr>
352
- <?php endif; // 'getimagesize' condition ?>
353
-
354
-
355
- <tr>
356
- <td colspan="2"><h4><?php esc_html_e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h4></td>
357
  </tr>
358
-
359
- <tr class="form-field">
360
- <th scope="row" valign="top">
361
- <label for="image"><?php esc_html_e( 'Display Category Shortcode', 'wpsc' ); ?></label>
362
- </th>
363
- <td>
364
- <code>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</code><br />
365
- <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>
366
- </td>
367
- </tr>
368
- <tr class="form-field">
369
- <th scope="row" valign="top">
370
- <label for="image"><?php esc_html_e( 'Display Category Template Tag', 'wpsc' ); ?></label>
371
- </th>
372
- <td>
373
- <code>&lt;?php echo wpsc_display_products_page( array( 'category_url_name' => '<?php echo $category["slug"]; ?>' ) ); ?&gt;</code><br />
374
- <span class="description"><?php esc_html_e( 'Template tags are used to display a particular category or group within your theme / template.', 'wpsc' ); ?></span>
375
- </td>
376
- </tr>
377
-
378
- <!-- START OF TARGET MARKET SELECTION -->
379
-
380
  <tr>
381
- <td colspan="2">
382
- <h4><?php esc_html_e( 'Target Market Restrictions', 'wpsc' ); ?></h4>
383
- </td>
 
 
 
 
 
 
 
 
384
  </tr>
385
- <?php
386
- $countrylist = WPSC_Countries::get_countries_array( true, true );
387
- $selectedCountries = wpsc_get_meta( $category_id,'target_market','wpsc_category' );
388
- ?>
389
- <tr>
390
- <th scope="row" valign="top">
391
- <label for="image"><?php esc_html_e( 'Target Markets', 'wpsc' ); ?></label>
392
- </th>
393
- <td>
394
- <?php if ( wpsc_is_suhosin_enabled() ) : ?>
395
- <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>
396
- <?php else : ?>
397
- <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 />
398
- <div id='resizeable' class='ui-widget-content multiple-select'>
399
- <?php foreach( $countrylist as $country ) {
400
- if ( in_array( $country['id'], (array)$selectedCountries ) ) {
401
- ?>
402
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' checked='<?php echo $country['visible']; ?>' />
403
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
404
- <?php
405
- } else {
406
- ?>
407
- <input type='checkbox' name='countrylist2[]' id='countrylist2-<?php echo $country['id']; ?>' value='<?php echo $country['id']; ?>' />
408
- <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
409
- <?php
410
- }
411
- } ?>
412
- </div>
413
- <?php endif; ?><br />
414
- <span class="description"><?php esc_html_e( 'Select the markets you are selling this category to.', 'wpsc' ); ?></span>
415
- </td>
416
  </tr>
417
 
418
- <!-- Checkout settings -->
419
-
420
- <tr>
421
- <td colspan="2">
422
- <h4><?php esc_html_e( 'Checkout Settings', 'wpsc' ); ?></h4>
423
- </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  </tr>
425
- <?php
426
- if ( !isset( $category['term_id'] ) )
427
- $category['term_id'] = '';
428
-
429
- $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
430
- $checkout_sets = get_option('wpsc_checkout_form_sets');
431
- unset($checkout_sets[0]);
432
- $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' );
433
- ?>
434
- <tr class="form-field">
435
- <th scope="row" valign="top">
436
- <label for="image"><?php esc_html_e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
437
- </th>
438
- <td>
439
- <select name='use_additional_form_set'>
440
- <option value=''><?php esc_html_e( 'None', 'wpsc' ); ?></option>
441
- <?php
442
- foreach( (array) $checkout_sets as $key => $value ) {
443
- $selected_state = "";
444
- if ( $used_additonal_form_set == $key ) {
445
- $selected_state = "selected='selected'";
446
- } ?>
447
- <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo esc_html( $value ); ?></option>
448
- <?php
449
- }
450
- ?>
451
- </select>
452
- </td>
 
 
 
 
 
 
453
  </tr>
454
 
455
- <tr class="form-field">
456
- <th scope="row" valign="top">
457
- <label><?php esc_html_e( 'Address to calculate shipping with', 'wpsc' ); ?></label>
458
- </th>
459
- <td>
460
- <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 />
461
- <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>
462
- <p class='description'><?php esc_html_e( 'Products in this category will use the address specified to calculate shipping costs.', 'wpsc' ); ?></p>
463
- </td>
464
  </tr>
465
 
466
- <?php
467
  }
468
 
469
  /**
@@ -471,14 +480,14 @@ function wpsc_admin_category_forms_edit() {
471
  * @param nothing
472
  * @return nothing
473
  */
474
- function wpsc_save_category_set( $category_id, $tt_id ) {
475
  global $wpdb;
476
 
477
- if ( ! empty( $_POST ) ) {
478
  /* Image Processing Code*/
479
- if ( ! empty( $_FILES['image'] ) && preg_match( "/\.(gif|jp(e)*g|png){1}$/i", $_FILES['image']['name'] ) ) {
480
- if ( function_exists( "getimagesize" ) ) {
481
- if ( isset( $_POST['width'] ) && ( (int) $_POST['width'] > 10 && (int) $_POST['width'] < 512 ) && ( (int)$_POST['height'] > 10 && (int)$_POST['height'] < 512 ) ) {
482
  $width = (int) $_POST['width'];
483
  $height = (int) $_POST['height'];
484
  image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), $width, $height, 'image' );
@@ -498,75 +507,72 @@ function wpsc_save_category_set( $category_id, $tt_id ) {
498
  $image = '';
499
  }
500
  //Good to here
501
- if ( isset( $_POST['tag_ID'] ) ) {
502
- //Editing
503
- $category_id = (int) $_POST['tag_ID'];
504
- $category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
505
- $url_name = $category->slug;
506
-
507
- }
508
- if ( isset( $_POST['deleteimage'] ) && $_POST['deleteimage'] == 1 ) {
509
- wpsc_delete_categorymeta( $category_id, 'image' );
510
- } else if ( $image != '' ) {
511
- wpsc_update_categorymeta( $category_id, 'image', $image );
512
  }
513
 
514
- if ( ! empty( $_POST['height'] ) && is_numeric( $_POST['height'] ) && ! empty( $_POST['width'] ) && is_numeric( $_POST['width'] ) && $image == null ) {
515
- $imagedata = wpsc_get_categorymeta( $category_id, 'image' );
516
- if ( $imagedata != null ) {
517
- $height = (int) $_POST['height'];
518
- $width = (int) $_POST['width'];
519
- $imagepath = WPSC_CATEGORY_DIR . $imagedata;
520
  $image_output = WPSC_CATEGORY_DIR . $imagedata;
521
- image_processing( $imagepath, $image_output, $width, $height );
522
  }
523
  }
524
 
525
- wpsc_update_categorymeta( $category_id, 'fee', '0' );
526
- wpsc_update_categorymeta( $category_id, 'active', '1' );
527
- wpsc_update_categorymeta( $category_id, 'order', '0' );
528
 
529
- if ( isset( $_POST['display_type'] ) ) {
530
- wpsc_update_categorymeta( $category_id, 'display_type', esc_sql( stripslashes( $_POST['display_type'] ) ) );
531
- }
532
 
533
- if ( isset( $_POST['image_height'] ) ) {
534
- wpsc_update_categorymeta( $category_id, 'image_height', (int) $_POST['image_height'] );
535
- }
536
 
537
- if ( isset( $_POST['image_width'] ) ) {
538
- wpsc_update_categorymeta( $category_id, 'image_width', (int) $_POST['image_width'] );
539
- }
540
 
541
  if ( ! empty( $_POST['use_additional_form_set'] ) ) {
542
- wpsc_update_categorymeta( $category_id, 'use_additional_form_set', $_POST['use_additional_form_set'] );
 
543
  } else {
544
- wpsc_delete_categorymeta( $category_id, 'use_additional_form_set' );
545
  }
546
 
547
  if ( ! empty( $_POST['uses_billing_address'] ) ) {
548
- wpsc_update_categorymeta( $category_id, 'uses_billing_address', 1 );
549
  $uses_additional_forms = true;
550
  } else {
551
- wpsc_update_categorymeta( $category_id, 'uses_billing_address', 0 );
552
  $uses_additional_forms = false;
553
  }
554
 
555
- if ( ! empty( $_POST['countrylist2'] ) && ( $category_id > 0 ) ) {
556
- $AllSelected = false;
557
- $countryList = $wpdb->get_col( "SELECT `id` FROM `" . WPSC_TABLE_CURRENCY_LIST . "`" );
558
 
559
- if ( $AllSelected != true ){
560
- $posted_countries = array_map( 'intval', $_POST['countrylist2'] );
561
- $unselectedCountries = array_diff( $countryList, $posted_countries );
562
  //find the countries that are selected
563
- $selectedCountries = array_intersect( $countryList, $posted_countries );
564
- wpsc_update_categorymeta( $category_id, 'target_market', $selectedCountries );
565
  }
566
 
567
- } elseif ( ! isset( $_POST['countrylist2'] ) ){
568
- wpsc_update_categorymeta( $category_id, 'target_market', '' );
569
- $AllSelected = true;
570
  }
571
 
572
  }
12
  $parent_id = $_POST['parent_id'];
13
 
14
  $result = true;
15
+ foreach( $sort_order as $key=>$value ){
16
+ if ( empty( $value ) )
 
17
  continue;
 
18
 
19
  $value = preg_replace( '/[^0-9]/', '', $value );
20
 
21
+ if( !wpsc_update_meta( $value, 'sort_order', $key, 'wpsc_variation' ) )
22
  $result = false;
 
23
  }
24
  }
25
 
38
  $parent_id = $_POST['parent_id'];
39
 
40
  $result = true;
41
+ foreach( $sort_order as $key=>$value ){
42
  if ( empty( $value ) )
43
  continue;
44
 
45
  $value = preg_replace( '/[^0-9]/', '', $value );
46
 
47
+ if( !wpsc_update_meta( $value, 'sort_order', $key, 'wpsc_category' ) )
48
  $result = false;
49
  }
50
  }
65
  */
66
 
67
  function wpsc_custom_category_columns( $columns ) {
68
+ // Doing it this funny way to ensure that image stays in far left, even if other items are added via plugin.
69
+ unset( $columns["cb"] );
70
 
71
+ $custom_array = array(
72
+ 'cb' => '<input type="checkbox" />',
73
+ 'image' => __( 'Image', 'wpsc' )
74
+ );
75
 
76
+ $columns = array_merge( $custom_array, $columns );
77
 
78
+ return $columns;
79
  }
 
80
  /**
81
+ * wpsc_custom_category_column_data
82
+ * Adds images to the custom category column
83
+ * @param (array) column_name | column name
84
+ * @return nada
 
 
 
 
85
  */
86
+
87
  function wpsc_custom_category_column_data( $string, $column_name, $term_id ) {
88
+ global $wpdb;
89
+
90
+ $image = wpsc_get_categorymeta( $term_id, 'image' );
91
+ $name = get_term_by( 'id', $term_id, 'wpsc_product_category' );
92
+ $name = $name->name;
93
+
94
+ if( !empty( $image ) )
95
+ $image = "<img src=\"".WPSC_CATEGORY_URL . $image . "\" title='" . esc_attr( $name ) . "' alt='" . esc_attr( $name ) . "' width='30' height='30' />";
96
+ else
97
+ $image = "<img src='" . WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif' title='" . esc_attr( $name ) . "' alt='" . esc_attr( $name ) . "' width='30' height='30' />";
98
+
99
+ return $image;
100
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
  /**
106
  * for use in other list functions
107
  * @param int $parent_id
108
  */
109
+ function wpsc_admin_get_category_array($parent_id = null){
110
+ global $wpdb;
111
+ $orderedList = array();
112
+ if(!isset($parent_id)) $parent_id = 0;
113
+ $category_list = get_terms('wpsc_product_category','hide_empty=0&parent='.$parent_id);
114
+ if(!is_array($category_list)){
115
+ return false;
116
+ }
117
+ foreach($category_list as $category){
118
+ $category_order = wpsc_get_categorymeta($category->term_id, 'order');
119
+ $category_image = wpsc_get_categorymeta($category->term_id, 'image');
120
+ if(!isset($category_order) || $category_order == 0) $category_order = (count($orderedList) +1);
121
+ print "<!-- setting category Order number to ".$category_order."-->";
122
+ $orderedList[$category_order]['id'] = $category->term_id;
123
+ $orderedList[$category_order]['name'] = $category->name;
124
+ $orderedList[$category_order]['image'] = $category_image;
125
+ $orderedList[$category_order]['parent_id'] = $parent_id;
126
+ $orderedList[$category_order]['children'] = wpsc_admin_get_category_array($category->term_id);
127
+ }
128
+
129
+ ksort($orderedList);
130
+ return($orderedList);
 
 
 
 
 
 
 
 
131
  }
132
 
133
  /**
140
  $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
141
  ?>
142
 
143
+ <h3><?php esc_html_e('Advanced Settings', 'wpsc'); ?></h3>
144
+
145
+ <div id="poststuff" class="postbox">
146
+ <h3 class="hndle"><?php esc_html_e('Presentation Settings', 'wpsc'); ?></h3>
147
+
148
+ <div class="inside">
149
+ <tr>
150
+ <td>
151
+ <label for='image'><?php esc_html_e( 'Category Image' , 'wpsc' ); ?></label>
152
+ </td>
153
+ <td>
154
+ <input type='file' name='image' value='' /><br /><br />
155
+ </td>
156
+ </tr>
157
+ <tr>
158
+ <td>
159
+ <?php esc_html_e( 'Catalog View', 'wpsc' ); ?>
160
+ </td>
161
+ <td>
162
+ <select name='display_type'>
163
+ <option value='default'<?php checked( $display_type, 'default' ); ?>><?php esc_html_e('Default View', 'wpsc'); ?></option>
164
+ <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>
165
+ <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>
166
+ </select><br /><br />
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <td>
171
+ <span class='small'><?php esc_html_e('To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc'); ?></span><br /><br />
172
+ </td>
173
+ </tr>
174
+
175
+ <?php if(function_exists("getimagesize")) { ?>
176
+ <tr>
177
+ <td>
178
+ <?php esc_html_e('Thumbnail&nbsp;Size', 'wpsc'); ?>
179
+ </td>
180
+ <td>
181
+ <?php esc_html_e('Width', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_width'])) echo $category['image_width']; ?>' name='image_width' size='6'/>
182
+ <?php esc_html_e('Height', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_height'])) echo $category['image_height']; ?>' name='image_height' size='6'/><br/>
183
+ </td>
184
+ </tr>
185
+ <?php
186
+ }
187
+ ?>
188
  </div>
189
+ </div>
 
 
 
190
 
191
+ <!-- START OF TARGET MARKET SELECTION -->
192
+ <div id="poststuff" class="postbox">
193
+ <h3 class="hndle"><?php esc_html_e( 'Target Market Restrictions', 'wpsc' ); ?></h3>
194
+ <div class="inside"><?php
195
  $category_id = '';
196
+ if (isset($_GET["tag_ID"])) $category_id = $_GET["tag_ID"];
197
+ $countrylist = $wpdb->get_results("SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A);
198
+ $selectedCountries = wpsc_get_meta($category_id,'target_market','wpsc_category');
199
+ $output = '';
200
+ $output .= " <tr>\n\r";
201
+ $output .= " <td>\n\r";
202
+ $output .= esc_html__( 'Target Markets', 'wpsc' ).":\n\r";
203
+ $output .= " </td>\n\r";
204
+ $output .= " <td>\n\r";
205
+
206
+ if(@extension_loaded('suhosin')) {
207
+ $output .= "<em>".esc_html__( "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.
208
+ ",'wpsc' )."</em>";
209
 
210
+ } else {
211
+ $output .= "<span>" . esc_html__( 'Select', 'wpsc' ) . " <a href='' class='wpsc_select_all'>" . esc_html__( 'All', 'wpsc' ) . "</a>&nbsp; <a href='' class='wpsc_select_none'>" . esc_html__( 'None', 'wpsc' ) . "</a></span><br />";
212
+ $output .= " <div id='resizeable' class='ui-widget-content multiple-select'>\n\r";
213
+ foreach($countrylist as $country){
214
+ if(in_array($country['id'], (array)$selectedCountries)){
215
+ $output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />\n\r";
216
+ } else {
217
+ $output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />\n\r";
218
+ }
219
+ }
220
+ $output .= " </div><br /><br />";
221
+ $output .= " <span class='wpscsmall description'>" . esc_html__( 'Select the markets you are selling this category to.', 'wpsc' ) . "<span>\n\r";
222
  }
223
+ $output .= " </td>\n\r";
224
+ $output .= " </tr>\n\r";
225
 
226
+ echo $output;
227
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  </div>
229
+ </div>
230
 
231
+ <!-- Checkout settings -->
232
+ <div id="poststuff" class="postbox">
233
+ <h3 class="hndle"><?php esc_html_e( 'Checkout Settings', 'wpsc' ); ?></h3>
234
+ <div class="inside">
235
+ <table class='category_forms'>
 
 
 
 
 
 
236
  <?php
237
+ if (!isset($category['term_id'])) $category['term_id'] = '';
238
+ $used_additonal_form_set = wpsc_get_categorymeta($category['term_id'], 'use_additional_form_set'); ?>
239
+ <tr>
240
+ <td>
241
+ <?php esc_html_e( 'This category requires additional checkout form fields', 'wpsc' ); ?>
242
+ </td>
243
+ <td>
244
+ <select name='use_additional_form_set'>
245
+ <option value=''><?php esc_html_e( 'None', 'wpsc' ); ?></option>
246
+ <?php
247
+ $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
248
+ unset($checkout_sets[0]);
249
+
250
+ foreach((array)$checkout_sets as $key => $value) {
251
+ $selected_state = "";
252
+ if($used_additonal_form_set == $key)
253
+ $selected_state = "selected='selected'";
254
+ ?>
255
+ <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo esc_html( $value ); ?></option>
256
+ <?php
257
+ }
258
+ ?>
259
+ </select>
260
+ </td>
261
+ </tr>
262
+ <?php $uses_billing_address = (bool)wpsc_get_categorymeta($category['term_id'], 'uses_billing_address'); ?>
263
+ <tr>
264
+ <td>
265
+ <?php esc_html_e( 'Products in this category use the billing address to calculate shipping', 'wpsc' ); ?>
266
+ </td>
267
+ <td>
268
+ <input type='radio' value='1' name='uses_billing_address' <?php echo (($uses_billing_address == true) ? "checked='checked'" : ""); ?> /><?php esc_html_e( 'Yes', 'wpsc' ); ?>
269
+ <input type='radio' value='0' name='uses_billing_address' <?php echo (($uses_billing_address != true) ? "checked='checked'" : ""); ?> /><?php esc_html_e( 'No', 'wpsc' ); ?>
270
+ </td>
271
+ </tr>
272
+ </table>
273
  </div>
274
+ </div>
275
 
276
+ <table class="category_forms">
277
+ <tr>
278
 
279
+ </tr>
280
+ </table>
281
+ <?php
282
  }
283
 
284
  /**
301
  $category_name = '';
302
  $category = array();
303
 
304
+ $category_id = absint( $_REQUEST["tag_ID"] );
305
+ $category = get_term($category_id, 'wpsc_product_category', ARRAY_A);
306
+ $category['nice-name'] = wpsc_get_categorymeta($category['term_id'], 'nice-name');
307
+ $category['description'] = wpsc_get_categorymeta($category['term_id'], 'description');
308
+ $category['image'] = wpsc_get_categorymeta($category['term_id'], 'image');
309
+ $category['fee'] = wpsc_get_categorymeta($category['term_id'], 'fee');
310
+ $category['active'] = wpsc_get_categorymeta($category['term_id'], 'active');
311
+ $category['order'] = wpsc_get_categorymeta($category['term_id'], 'order');
312
+ $category['display_type'] = wpsc_get_categorymeta($category['term_id'], 'display_type');
313
+ $category['image_height'] = wpsc_get_categorymeta($category['term_id'], 'image_height');
314
+ $category['image_width'] = wpsc_get_categorymeta($category['term_id'], 'image_width');
315
+ $category['use_additional_form_set'] = wpsc_get_categorymeta($category['term_id'], 'use_additional_form_set');
316
+
317
 
318
  ?>
319
 
320
+ <tr>
321
+ <td colspan="2">
322
+ <h3><?php esc_html_e( 'Advanced Settings', 'wpsc' ); ?></h3>
 
 
 
 
323
 
324
+ </td>
325
+ </tr>
326
 
327
  <tr class="form-field">
328
+ <th scope="row" valign="top">
329
+ <label for="display_type"><?php esc_html_e( 'Catalog View', 'wpsc' ); ?></label>
330
+ </th>
331
+ <td>
332
+ <?php
333
+ $display_type = isset( $category['display_type'] ) ? $category['display_type'] : '';
334
+ ?>
335
+ <select name='display_type'>
336
+ <option value='default'<?php checked( $display_type, 'default' ); ?>><?php esc_html_e( 'Default View', 'wpsc' ); ?></option>
337
+ <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>
338
+ <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>
339
+ </select><br />
340
+ <span class="description"><?php esc_html_e( 'To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc' ); ?></span>
341
+ </td>
342
  </tr>
343
+ <tr class="form-field">
344
+ <th scope="row" valign="top">
345
+ <label for="image"><?php esc_html_e( 'Category Image', 'wpsc' ); ?></label>
346
+ </th>
347
+ <td>
348
+ <input type='file' name='image' value='' /><br />
349
+ <label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php esc_html_e( 'Delete Image', 'wpsc' ); ?></label><br/>
350
+ <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>
351
+ </td>
 
 
 
 
 
352
  </tr>
353
+ <?php if( function_exists( "getimagesize" ) ) : ?>
354
+ <tr class="form-field">
355
+ <th scope="row" valign="top">
356
+ <label for="image"><?php esc_html_e( 'Thumbnail Size', 'wpsc' ); ?></label>
357
+ </th>
358
+ <td>
359
+ <?php esc_html_e( 'Width', 'wpsc' ); ?> <input type='text' class="wpsc_cat_image_size" value='<?php if (isset($category['image_width'])) echo $category['image_width']; ?>' name='image_width' size='6' />
360
+ <?php esc_html_e( 'Height', 'wpsc' ); ?> <input type='text' class="wpsc_cat_image_size" value='<?php if (isset($category['image_height'])) echo $category['image_height']; ?>' name='image_height' size='6' /><br/>
361
+ </td>
 
 
 
 
 
 
 
 
 
 
 
362
  </tr>
363
+ <?php endif; // 'getimagesize' condition ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  <tr>
365
+ <td colspan="2"><h3><?php esc_html_e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h3></td>
366
+ </tr>
367
+
368
+ <tr class="form-field">
369
+ <th scope="row" valign="top">
370
+ <label for="image"><?php esc_html_e( 'Display Category Shortcode', 'wpsc' ); ?>:</label>
371
+ </th>
372
+ <td>
373
+ <span>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</span><br />
374
+ <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>
375
+ </td>
376
  </tr>
377
+ <tr class="form-field">
378
+ <th scope="row" valign="top">
379
+ <label for="image"><?php esc_html_e( 'Display Category Template Tag', 'wpsc' ); ?>:</label>
380
+ </th>
381
+ <td>
382
+ <span>&lt;?php echo wpsc_display_products_page( array( 'category_url_name'=>'<?php echo $category["slug"]; ?>' ) ); ?&gt;</span><br />
383
+ <span class="description"><?php esc_html_e( 'Template tags are used to display a particular category or group within your theme / template.', 'wpsc' ); ?></span>
384
+ </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  </tr>
386
 
387
+ <!-- START OF TARGET MARKET SELECTION -->
388
+
389
+ <tr>
390
+ <td colspan="2">
391
+ <h3><?php esc_html_e( 'Target Market Restrictions', 'wpsc' ); ?></h3>
392
+ </td>
393
+ </tr>
394
+ <?php
395
+ $countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A );
396
+ $selectedCountries = wpsc_get_meta( $category_id,'target_market','wpsc_category' );
397
+ ?>
398
+ <tr class="form-field">
399
+ <th scope="row" valign="top">
400
+ <label for="image"><?php esc_html_e( 'Target Markets', 'wpsc' ); ?>:</label>
401
+ </th>
402
+ <td>
403
+ <?php
404
+ if ( wpsc_is_suhosin_enabled() ) :
405
+ ?>
406
+ <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>
407
+
408
+ <?php
409
+ else :
410
+ ?>
411
+ <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 />
412
+ <div id='resizeable' class='ui-widget-content multiple-select'>
413
+ <?php
414
+ foreach( $countrylist as $country ) {
415
+ if( in_array( $country['id'], (array)$selectedCountries ) )
416
+ echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />";
417
+ else
418
+ echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />";
419
+ }
420
+ ?>
421
+ </div>
422
+ <?php
423
+ endif;
424
+ ?><br />
425
+ <span class="description"><?php esc_html_e( 'Select the markets you are selling this category to.', 'wpsc' ); ?></span>
426
+ </td>
427
  </tr>
428
+ <!-- Checkout settings -->
429
+
430
+ <tr>
431
+ <td colspan="2">
432
+ <h3><?php esc_html_e( 'Checkout Settings', 'wpsc' ); ?></h3>
433
+ </td>
434
+ </tr>
435
+ <?php
436
+ if ( !isset( $category['term_id'] ) )
437
+ $category['term_id'] = '';
438
+ $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
439
+ $checkout_sets = get_option('wpsc_checkout_form_sets');
440
+ unset($checkout_sets[0]);
441
+ $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' );
442
+ ?>
443
+ <tr class="form-field">
444
+ <th scope="row" valign="top">
445
+ <label for="image"><?php esc_html_e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
446
+ </th>
447
+ <td>
448
+ <select name='use_additional_form_set'>
449
+ <option value=''><?php esc_html_e( 'None', 'wpsc' ); ?></option>
450
+ <?php
451
+ foreach( (array) $checkout_sets as $key => $value ) {
452
+ $selected_state = "";
453
+ if( $used_additonal_form_set == $key )
454
+ $selected_state = "selected='selected'";
455
+ ?>
456
+ <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo esc_html( $value ); ?></option>
457
+ <?php
458
+ }
459
+ ?>
460
+ </select><br />
461
+ </td>
462
  </tr>
463
 
464
+ <tr class="form-field">
465
+ <th scope="row" valign="top">
466
+ <label for="image"><?php esc_html_e( 'Products in this category use the billing address to calculate shipping', 'wpsc' ); ?></label>
467
+ </th>
468
+ <td>
469
+ <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( 'Yes', 'wpsc' ); ?>
470
+ <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( 'No', 'wpsc' ); ?>
471
+ <br />
472
+ </td>
473
  </tr>
474
 
475
+ <?php
476
  }
477
 
478
  /**
480
  * @param nothing
481
  * @return nothing
482
  */
483
+ function wpsc_save_category_set($category_id, $tt_id) {
484
  global $wpdb;
485
 
486
+ if( !empty( $_POST ) ) {
487
  /* Image Processing Code*/
488
+ if( !empty( $_FILES['image'] ) && preg_match( "/\.(gif|jp(e)*g|png){1}$/i", $_FILES['image']['name'] ) ) {
489
+ if( function_exists( "getimagesize" ) ) {
490
+ if( isset( $_POST['width'] ) && ( (int) $_POST['width'] > 10 && (int) $_POST['width'] < 512 ) && ((int)$_POST['height'] > 10 && (int)$_POST['height'] < 512) ) {
491
  $width = (int) $_POST['width'];
492
  $height = (int) $_POST['height'];
493
  image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), $width, $height, 'image' );
507
  $image = '';
508
  }
509
  //Good to here
510
+ if( isset( $_POST['tag_ID'] ) ) {
511
+ //Editing
512
+ $category_id= $_POST['tag_ID'];
513
+ $category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
514
+ $url_name=$category->slug;
515
+
516
+ }
517
+ if(isset($_POST['deleteimage']) && $_POST['deleteimage'] == 1) {
518
+ wpsc_delete_categorymeta($category_id, 'image');
519
+ } else if($image != '') {
520
+ wpsc_update_categorymeta($category_id, 'image', $image);
521
  }
522
 
523
+ if ( !empty( $_POST['height'] ) && is_numeric( $_POST['height'] ) && !empty( $_POST['width'] ) && is_numeric( $_POST['width'] ) && $image == null ) {
524
+ $imagedata = wpsc_get_categorymeta($category_id, 'image');
525
+ if($imagedata != null) {
526
+ $height = $_POST['height'];
527
+ $width = $_POST['width'];
528
+ $imagepath = WPSC_CATEGORY_DIR . $imagedata;
529
  $image_output = WPSC_CATEGORY_DIR . $imagedata;
530
+ image_processing($imagepath, $image_output, $width, $height);
531
  }
532
  }
533
 
534
+ wpsc_update_categorymeta($category_id, 'fee', '0');
535
+ wpsc_update_categorymeta($category_id, 'active', '1');
536
+ wpsc_update_categorymeta($category_id, 'order', '0');
537
 
538
+ if ( isset( $_POST['display_type'] ) )
539
+ wpsc_update_categorymeta($category_id, 'display_type',esc_sql(stripslashes($_POST['display_type'])));
 
540
 
541
+ if ( isset( $_POST['image_height'] ) )
542
+ wpsc_update_categorymeta( $category_id, 'image_height', absint( $_POST['image_height'] ) );
 
543
 
544
+ if ( isset( $_POST['image_width'] ) )
545
+ wpsc_update_categorymeta( $category_id, 'image_width', absint($_POST['image_width'] ) );
 
546
 
547
  if ( ! empty( $_POST['use_additional_form_set'] ) ) {
548
+ wpsc_update_categorymeta($category_id, 'use_additional_form_set', $_POST['use_additional_form_set']);
549
+ //exit('<pre>'.print_r($_POST,1).'</pre>');
550
  } else {
551
+ wpsc_delete_categorymeta($category_id, 'use_additional_form_set');
552
  }
553
 
554
  if ( ! empty( $_POST['uses_billing_address'] ) ) {
555
+ wpsc_update_categorymeta($category_id, 'uses_billing_address', 1);
556
  $uses_additional_forms = true;
557
  } else {
558
+ wpsc_update_categorymeta($category_id, 'uses_billing_address', 0);
559
  $uses_additional_forms = false;
560
  }
561
 
562
+ if( ! empty( $_POST['countrylist2'] ) && ($category_id > 0)){
563
+ $AllSelected = false;
564
+ $countryList = $wpdb->get_col("SELECT `id` FROM `".WPSC_TABLE_CURRENCY_LIST."`");
565
 
566
+ if($AllSelected != true){
567
+ $unselectedCountries = array_diff($countryList, $_POST['countrylist2']);
 
568
  //find the countries that are selected
569
+ $selectedCountries = array_intersect($countryList, $_POST['countrylist2']);
570
+ wpsc_update_categorymeta( $category_id, 'target_market', $selectedCountries);
571
  }
572
 
573
+ } elseif ( ! isset($_POST['countrylist2'] ) ){
574
+ wpsc_update_categorymeta( $category_id, 'target_market','');
575
+ $AllSelected = true;
576
  }
577
 
578
  }
wpsc-admin/includes/settings-tabs/admin.php CHANGED
@@ -1,12 +1,7 @@
1
  <?php
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>
@@ -14,7 +9,7 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
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>
19
  </tr>
20
  <?php
@@ -67,7 +62,7 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
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>
@@ -150,4 +145,4 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
150
  </table>
151
  <?php
152
  }
153
- }
1
  <?php
2
 
3
+ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab
4
+ {
 
 
 
 
 
5
  public function display() {
6
  ?>
7
  <h3><?php esc_html_e( 'Admin Settings', 'wpsc' ); ?></h3>
9
  <tr>
10
  <th scope="row"><?php esc_html_e( 'Max downloads per file', 'wpsc' ); ?>: </th>
11
  <td>
12
+ <input type='text' size='10' value='<?php echo esc_attr( get_option('max_downloads') ); ?>' name='wpsc_options[max_downloads]' />
13
  </td>
14
  </tr>
15
  <?php
62
  <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 />
63
 
64
  <span class="wpscsmall description">
65
+ <?php esc_html_e( 'Warning: Disabling this exposes your site to greater possibility of malicious files being uploaded, we recommend installing the Fileinfo extention for PHP rather than disabling this.', 'wpsc' ); ?>
66
  </span>
67
  </td>
68
  </tr>
145
  </table>
146
  <?php
147
  }
148
+ }
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;
@@ -12,16 +13,16 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
12
  public function __construct() {
13
  global $wpdb;
14
 
15
- $this->require_register = get_option( 'require_register', 0 );
16
  $this->shipping_same_as_billing = get_option( 'shippingsameasbilling', 0 );
17
- $this->force_ssl = get_option( 'wpsc_force_ssl', 0 );
18
- $this->checkout_sets = get_option( 'wpsc_checkout_form_sets' );
19
- $this->current_checkout_set = empty( $_GET['checkout_set'] ) ? 0 : (int) $_GET['checkout_set'];
20
- $this->field_types = get_option( 'wpsc_checkout_form_fields' );
21
- $this->user_field_types = array('text','textarea','heading','select','radio','checkbox');
22
 
23
  if ( ! isset( $this->checkout_sets[$this->current_checkout_set] ) ) {
24
- wp_redirect( remove_query_arg( 'checkout_set' ) );
25
  exit;
26
  }
27
 
@@ -77,7 +78,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
77
  }
78
 
79
  if ( isset( $_POST['checkout_set'] ) ) {
80
- $_SERVER['REQUEST_URI'] = add_query_arg( 'checkout_set', $_POST['checkout_set'] );
81
  }
82
 
83
  if ( ! isset( $_POST['form_name'] ) && ! isset( $_POST['new_field_name'] ) )
@@ -131,8 +132,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
131
  $value = $_POST['form_options'][$field_id]['value'][$key];
132
  if ( $label === '' && $value === '')
133
  continue;
134
- $label = sanitize_text_field( $label );
135
- $options[$label] = sanitize_text_field( $value );
136
  }
137
  $data['options'] = serialize( $options );
138
  $data_format[] = '%s';
@@ -163,7 +163,6 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
163
  'active' => empty( $_POST['new_field_display'][$key] ) ? 0 : 1,
164
  'mandatory' => empty( $_POST['new_field_mandatory'][$key] ) ? 0 : 1,
165
  'checkout_set' => $this->current_checkout_set,
166
- 'unique_name' => sanitize_title( $name ),
167
  );
168
 
169
  $data_format = array(
@@ -171,8 +170,6 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
171
  '%s', // type
172
  '%s', // active
173
  '%s', // mandatory
174
- '%s', // checkout set
175
- '%s', // unique name
176
  );
177
 
178
  if ( isset( $new_field_orders[$key] ) ) {
@@ -269,12 +266,13 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
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="" />
273
  </div>
274
  </td>
275
  <td class="namecol">
276
  <div class="cell-wrapper">
277
- <input type="text" name="new_field_name[<?php echo $new_field_id; ?>]" value="" /><br />
 
278
  </div>
279
  </td>
280
  <td class="typecol">
@@ -289,7 +287,6 @@ 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 +300,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>
@@ -333,8 +330,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>
@@ -357,44 +354,53 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
357
  do_action( 'wpsc_checkout_form_fields_page' );
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>
@@ -436,19 +442,25 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
436
  <?php $this->prototype_field( 'new' ); ?>
437
  <?php else: ?>
438
  <?php foreach ( $this->form_fields as $form_field ): ?>
439
-
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="" />
447
  </div>
448
  </td>
449
  <td class="namecol">
450
  <div class="cell-wrapper">
451
  <input type="text" name="form_name[<?php echo esc_attr( $form_field->id ); ?>]" value="<?php echo esc_attr( $form_field->name ); ?>" />
 
 
 
 
 
 
 
452
  </div>
453
  </td>
454
  <td class="typecol">
@@ -479,16 +491,9 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
479
 
480
  <td class="uniquenamecol">
481
  <div class="cell-wrapper">
482
- <?php if ( $form_field->type != 'heading' && ! empty( $form_field->unique_name ) ): ?>
483
- <small><?php echo esc_html( $form_field->unique_name ); ?></small>
484
- <?php endif ?>
485
- <?php
486
- $style = '';
487
- if ( in_array( $form_field->type, array( 'select', 'radio', 'checkbox' ) ) ) {
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 +511,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;
13
  public function __construct() {
14
  global $wpdb;
15
 
16
+ $this->require_register = get_option( 'require_register', 0 );
17
  $this->shipping_same_as_billing = get_option( 'shippingsameasbilling', 0 );
18
+ $this->force_ssl = get_option( 'wpsc_force_ssl', 0 );
19
+ $this->checkout_sets = get_option( 'wpsc_checkout_form_sets' );
20
+ $this->current_checkout_set = empty( $_GET['checkout_set'] ) ? 0 : (int) $_GET['checkout_set'];
21
+ $this->field_types = get_option( 'wpsc_checkout_form_fields' );
22
+ $this->user_field_types = array('text','textarea','heading','select','radio','checkbox');
23
 
24
  if ( ! isset( $this->checkout_sets[$this->current_checkout_set] ) ) {
25
+ wp_redirect( esc_url( remove_query_arg( 'checkout_set' ) ) );
26
  exit;
27
  }
28
 
78
  }
79
 
80
  if ( isset( $_POST['checkout_set'] ) ) {
81
+ $_SERVER['REQUEST_URI'] = esc_url( add_query_arg( 'checkout_set', $_POST['checkout_set'] ) );
82
  }
83
 
84
  if ( ! isset( $_POST['form_name'] ) && ! isset( $_POST['new_field_name'] ) )
132
  $value = $_POST['form_options'][$field_id]['value'][$key];
133
  if ( $label === '' && $value === '')
134
  continue;
135
+ $options[$label] = $value;
 
136
  }
137
  $data['options'] = serialize( $options );
138
  $data_format[] = '%s';
163
  'active' => empty( $_POST['new_field_display'][$key] ) ? 0 : 1,
164
  'mandatory' => empty( $_POST['new_field_mandatory'][$key] ) ? 0 : 1,
165
  'checkout_set' => $this->current_checkout_set,
 
166
  );
167
 
168
  $data_format = array(
170
  '%s', // type
171
  '%s', // active
172
  '%s', // mandatory
 
 
173
  );
174
 
175
  if ( isset( $new_field_orders[$key] ) ) {
266
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
267
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
268
  </a>
269
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
270
  </div>
271
  </td>
272
  <td class="namecol">
273
  <div class="cell-wrapper">
274
+ <input type="text" name="new_field_name[<?php echo $new_field_id; ?>]" value="" />
275
+ <a class="edit-options" href="#"><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
276
  </div>
277
  </td>
278
  <td class="typecol">
287
  </div>
288
  </td>
289
  <td class="uniquenamecol">
 
290
  </td>
291
  <td class="displaycol">
292
  <div class="cell-wrapper">
300
  </td>
301
  <td class="actionscol">
302
  <div class="cell-wrapper">
303
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#"><?php esc_html_e( 'Delete', 'wpsc' ); ?></a>
304
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#"><?php esc_html_e( 'Add', 'wpsc' ); ?></a>
305
  </div>
306
  </td>
307
  </tr>
330
  </td>
331
  <td class="column-actions">
332
  <div class="field-option-cell-wrapper">
333
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#"><?php esc_html_e( 'Delete', 'wpsc' ); ?></a>
334
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#"><?php esc_html_e( 'Add', 'wpsc' ); ?></a>
335
  </div>
336
  </td>
337
  </tr>
354
  do_action( 'wpsc_checkout_form_fields_page' );
355
  ?>
356
 
357
+ <div class='metabox-holder' style='width:95%;'>
358
+ <div class='postbox'>
359
+ <input type='hidden' name='checkout_submits' value='true' />
360
+ <h3 class='hndle'><?php esc_html_e( 'Misc Checkout Options' , 'wpsc' ); ?></h3>
361
+ <div class='inside'>
362
+ <table>
363
+ <tr>
364
+ <td><?php esc_html_e('Users must register before checking out', 'wpsc'); ?>:</td>
365
+ <td>
366
+ <input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php checked( $this->require_register, 1 ); ?> />
367
+ <label for='require_register1'><?php _e( 'Yes', 'wpsc' );?></label> &nbsp;
368
+ <input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php checked( $this->require_register, 0 ); ?> />
369
+ <label for='require_register2'><?php _e( 'No', 'wpsc' );?></label>
370
+ </td>
371
+ <td>
372
+ <a title='<?php esc_attr_e( 'If yes then you must also turn on the wordpress option "Any one can register"', 'wpsc' ); ?>' class='flag_email' href='#' ><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/help.png' alt='' /> </a>
373
+ </td>
374
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
+ <tr>
377
+ <td scope="row"><?php esc_html_e('Enable Shipping Same as Billing Option', 'wpsc' ); ?>:</td>
378
+ <td>
379
+ <input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php checked( $this->shipping_same_as_billing, 1 ); ?> />
380
+ <label for='shippingsameasbilling1'><?php _e( 'Yes', 'wpsc' );?></label> &nbsp;
381
+ <input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php checked( $this->shipping_same_as_billing, 0 ); ?> />
382
+ <label for='shippingsameasbilling2'><?php _e( 'No', 'wpsc' );?></label>
383
+ </td>
384
+ </tr>
385
+ <tr>
386
+ <td><?php _e('Force users to use SSL', 'wpsc'); ?>:</td>
387
+ <td>
388
+ <input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php checked( $this->force_ssl, 1 ); ?> />
389
+ <label for='wpsc_force_ssl1'><?php _e( 'Yes', 'wpsc' );?></label> &nbsp;
390
+ <input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php checked( $this->force_ssl, 0 ); ?> />
391
+ <label for='wpsc_force_ssl2'><?php _e( 'No', 'wpsc' );?></label>
392
+ </td>
393
+ <td>
394
+ <a title='<?php esc_html_e( 'This can cause warnings for your users if you do not have a properly configured SSL certificate', 'wpsc' );?>' class='flag_email' href='#' ><img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/help.png' alt='' /> </a>
395
+ </td>
396
+ </tr>
397
+ </table>
398
+ </div>
399
+ </div>
400
+ </div>
401
 
402
+ <h3><?php esc_html_e( 'Form Fields', 'wpsc' ); ?></h3>
403
+ <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 buyers address, and name...', 'wpsc' );?></p>
404
 
405
  <p>
406
  <label for='wpsc_form_set'><?php esc_html_e( 'Select a Form Set' , 'wpsc' ); ?>:</label>
442
  <?php $this->prototype_field( 'new' ); ?>
443
  <?php else: ?>
444
  <?php foreach ( $this->form_fields as $form_field ): ?>
445
+ <tr data-field-id="<?php echo esc_attr( $form_field->id ); ?>" id="checkout_<?php echo esc_attr( $form_field->id ); ?>" class="checkout_form_field">
 
446
  <td class="drag">
447
  <div class="cell-wrapper">
448
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
449
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
450
  </a>
451
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
452
  </div>
453
  </td>
454
  <td class="namecol">
455
  <div class="cell-wrapper">
456
  <input type="text" name="form_name[<?php echo esc_attr( $form_field->id ); ?>]" value="<?php echo esc_attr( $form_field->name ); ?>" />
457
+ <a
458
+ class="edit-options" href="#"
459
+ <?php
460
+ if ( in_array( $form_field->type, array( 'select', 'radio', 'checkbox' ) ) )
461
+ echo 'style="display:inline;"';
462
+ ?>
463
+ ><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
464
  </div>
465
  </td>
466
  <td class="typecol">
491
 
492
  <td class="uniquenamecol">
493
  <div class="cell-wrapper">
494
+ <?php if ( $form_field->type != 'heading' && ! empty( $form_field->unique_name ) ): ?>
495
+ <small><?php echo esc_html( $form_field->unique_name ); ?></small>
496
+ <?php endif ?>
 
 
 
 
 
 
 
497
  </div>
498
  </td>
499
  <td class="displaycol">
511
  <td class="actionscol">
512
  <div class="cell-wrapper">
513
  <?php if ( ! $this->is_field_default( $form_field ) ): ?>
514
+ <a tabindex="-1" title="<?php esc_attr_e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#"><?php esc_html_e( 'Delete', 'wpsc' ); ?></a>
515
  <?php else: ?>
516
+ <span title="<?php _e( 'Cannot Delete Default Fields', 'wpsc' ); ?>" class="action delete"><?php esc_html_e( 'Delete', 'wpsc' ); ?></span>
517
  <?php endif; ?>
518
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#"><?php esc_html_e( 'Add', 'wpsc' ); ?></a>
519
  </div>
520
  </td>
521
  </tr>
wpsc-admin/includes/settings-tabs/gateway.php CHANGED
@@ -1,170 +1,180 @@
1
  <?php
2
 
3
- class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
 
4
  private $active_gateways;
5
  private $gateway_names;
6
 
7
  public function __construct() {
8
- if ( isset( $_REQUEST['payment_gateway_id'] ) ) {
9
  update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', $_REQUEST['payment_gateway_id'] );
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
  }
18
 
19
  private function get_gateway_form( $selected_gateway ) {
20
- return apply_filters( 'wpsc_settings_gateway_form', array(), $selected_gateway );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  private function get_gateway_settings_url( $gateway ) {
24
  $location = isset( $_REQUEST['current_url'] ) ? $_REQUEST['current_url'] : $_SERVER['REQUEST_URI'];
25
- $gateway = ! empty( $gateway ) ? $gateway : '';
26
-
27
- return add_query_arg( array(
28
  'tab' => 'gateway',
29
  'page' => 'wpsc-settings',
30
- 'payment_gateway_id' => $gateway
31
  ), $location );
 
32
  }
33
 
34
- public function display_payment_gateway_settings_form( $selected_gateway = null ) {
35
- if ( ! $selected_gateway ) {
36
- $selected_gateway = (string) get_user_option( 'wpsc_settings_selected_payment_gateway', get_current_user_id() );
37
- }
 
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
  }
46
-
47
  ?>
48
- <div id="gateway_settings_<?php echo esc_attr( $selected_gateway ); ?>_form" class='gateway_settings_form'>
 
 
 
49
  <table class='form-table'>
50
- <tbody>
51
- <?php echo $payment_data['form_fields']; ?>
52
- <tr><td colspan="2">
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>
61
- </tbody>
62
  </table>
 
 
 
63
  </div>
 
64
  <?php
65
  }
66
 
67
  public function display() {
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 ) {
100
- $checked = in_array( $gateway['id'], $this->active_gateways );
101
-
102
- $active = $checked ? 'active' : 'inactive';
103
- $hidden = $force ? '' : "style='display: none;'";
104
-
105
- $edithidden = $hidden;
106
-
107
- $payment_gateway_names = get_option( 'payment_gateway_names' );
108
- $display_name = isset( $payment_gateway_names[ $gateway['id'] ] ) ? $payment_gateway_names[ $gateway['id'] ] : '' ;
109
- $gateway_data = false;
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>
124
- </td>
125
- <td class="plugin-description">
126
- <?php echo esc_html( $display_name ); ?>
127
- </td>
128
- </tr>
129
- <tr id="wpsc_gateway_settings_<?php echo esc_attr( $gateway['id'] ); ?>" data-gateway-id="<?php echo esc_attr( $gateway['id'] ); ?>" class='gateway_settings <?php echo $active; ?>' <?php echo $hidden; ?> >
130
- <td colspan="3" id="wpsc_gateway_settings_<?php echo esc_attr( $gateway['id'] ); ?>_container">
131
- <?php if ( $force ) {
132
- $this->display_payment_gateway_settings_form( $gateway['id'] );
133
- } ?>
134
- </td>
135
- </tr>
136
-
137
- <?php
138
- }
139
-
140
- private function gateway_list() {
141
-
142
- $gateways = apply_filters( 'wpsc_settings_get_gateways', array() );
143
-
144
- usort( $gateways, apply_filters( 'wpsc_settings_get_gateways_sort_callback', array( $this, 'gateway_usort_callback' ), $gateways, $this ) );
145
-
146
- $selected_gateway = (string) get_user_option( 'wpsc_settings_selected_payment_gateway', get_current_user_id() );
147
-
148
- foreach ( $gateways as $gateway ) {
149
- $this->gateway_list_item( $gateway, $selected_gateway === $gateway['id'] );
150
- }
151
- }
152
-
153
- /**
154
- * Usort callback used to order gateways by their name.
155
- *
156
- * @param array $a A gateway array.
157
- * @param array $b A different gateway array.
158
- *
159
- * @since 3.9.0
160
- *
161
- * @return bool True if $b should be ordered after $a based on its name.
162
- */
163
- private function gateway_usort_callback( $a, $b ) {
164
- return $a['name'] > $b['name'];
165
- }
166
 
167
- public function callback_submit_options() {
168
- do_action( 'wpsc_submit_gateway_options' );
169
  }
170
  }
1
  <?php
2
 
3
+ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab
4
+ {
5
  private $active_gateways;
6
  private $gateway_names;
7
 
8
  public function __construct() {
9
+ if ( isset( $_REQUEST['payment_gateway_id'] ) )
10
  update_user_option( get_current_user_id(), 'wpsc_settings_selected_payment_gateway', $_REQUEST['payment_gateway_id'] );
11
+
 
 
12
  $this->active_gateways = get_option( 'custom_gateway_options' );
13
  $this->gateway_names = get_option( 'payment_gateway_names' );
 
 
14
  }
15
 
16
  private function get_gateway_form( $selected_gateway ) {
17
+ global $nzshpcrt_gateways;
18
+
19
+ $payment_gateway_names = get_option('payment_gateway_names');
20
+ $return = false;
21
+ $selected_gateway_data = false;
22
+ foreach ( $nzshpcrt_gateways as $gateway ) {
23
+ if ( $gateway['internalname'] == $selected_gateway ) {
24
+ $selected_gateway_data = $gateway;
25
+ break;
26
+ }
27
+ }
28
+
29
+ if ( $selected_gateway_data ) {
30
+ if ( array_key_exists( $selected_gateway, $payment_gateway_names ) ) {
31
+ $display_name = $payment_gateway_names[$selected_gateway];
32
+ } elseif ( ! empty( $selected_gateway_data['display_name'] ) ) {
33
+ $display_name = $selected_gateway_data['display_name'];
34
+ } else {
35
+ switch($selected_gateway_data['payment_type']) {
36
+ case "paypal";
37
+ $display_name = __( 'PayPal', 'wpsc' );
38
+ break;
39
+
40
+ case "manual_payment":
41
+ $display_name = __( 'Manual Payment', 'wpsc' );
42
+ break;
43
+
44
+ case "google_checkout":
45
+ $display_name = __( 'Google Checkout', 'wpsc' );
46
+ break;
47
+
48
+ case "credit_card":
49
+ default:
50
+ $display_name = __( 'Credit Card', 'wpsc' );
51
+ break;
52
+ }
53
+ }
54
+
55
+ ob_start();
56
+ ?>
57
+ <tr>
58
+ <td><?php esc_html_e( 'Display Name', 'wpsc' ); ?></td>
59
+ <td>
60
+ <input type="text" name="user_defined_name[<?php echo esc_attr( $selected_gateway ); ?>]" value="<?php echo esc_html( $display_name ); ?>" /><br />
61
+ <small><?php esc_html_e( 'The text that people see when making a purchase.', 'wpsc' ); ?></small>
62
+ </td>
63
+ </tr>
64
+ <?php
65
+ $output = ob_get_clean();
66
+ $return = array(
67
+ 'name' => $selected_gateway_data['name'],
68
+ 'form_fields' => $output . $selected_gateway_data['form'](),
69
+ );
70
+ }
71
+
72
+ return $return;
73
  }
74
 
75
  private function get_gateway_settings_url( $gateway ) {
76
  $location = isset( $_REQUEST['current_url'] ) ? $_REQUEST['current_url'] : $_SERVER['REQUEST_URI'];
77
+ $location = add_query_arg( array(
 
 
78
  'tab' => 'gateway',
79
  'page' => 'wpsc-settings',
80
+ 'payment_gateway_id' => $gateway,
81
  ), $location );
82
+ return esc_url( $location );
83
  }
84
 
85
+ public function display_payment_gateway_settings_form() {
86
+ $selected_gateway = (string) get_user_option( 'wpsc_settings_selected_payment_gateway', get_current_user_id() );
87
+ if ( empty( $selected_gateway ) && ! empty( $this->active_gateways ) )
88
+ $selected_gateway = $this->active_gateways[0];
89
+
90
  $payment_data = $this->get_gateway_form( $selected_gateway );
91
  if ( ! $payment_data ) {
92
  $payment_data = array(
93
+ 'name' => __( 'Edit Gateway Settings', 'wpsc' ),
94
+ 'form_fields' => __( 'Modify a payment gateway settings by clicking "Edit" link on the left.', 'wpsc' ),
 
95
  );
96
  }
 
97
  ?>
98
+ <td id='wpsc-payment-gateway-settings-panel' class='wpsc-module-settings' rowspan='2'>
99
+ <div class='postbox'>
100
+ <h3 class='hndle'><?php echo $payment_data['name']; ?></h3>
101
+ <div class='inside'>
102
  <table class='form-table'>
103
+ <?php echo $payment_data['form_fields']; ?>
 
 
 
 
 
 
 
 
 
 
 
104
  </table>
105
+ <div class='submit'>
106
+ <input type='submit' value='<?php _e( 'Update &raquo;', 'wpsc' ) ?>' />
107
+ </div>
108
  </div>
109
+ </td>
110
  <?php
111
  }
112
 
113
  public function display() {
114
  global $wpdb, $nzshpcrt_gateways;
115
+ $payment_gateway_names = get_option( 'payment_gateway_names' );
116
+ if ( empty( $nzshpcrt_gateways ) )
117
+ $nzshpcrt_gateways = nzshpcrt_get_gateways();
118
  ?>
119
 
120
+ <div class='metabox-holder'>
121
+ <input type='hidden' name='gateway_submits' value='true' />
122
+ <input type='hidden' name='wpsc_gateway_settings' value='gateway_settings' />
123
+ <?php
124
+ if ( get_option( 'custom_gateway' ) == 1 ) {
125
+ $custom_gateway_hide = "style='display:block;'";
126
+ $custom_gateway1 = 'checked="checked"';
127
+ } else {
128
+ $custom_gateway_hide = "style='display:none;'";
129
+ $custom_gateway2 = 'checked="checked"';
130
+ }
131
+ ?>
132
+ <table id='wpsc-payment-gateway-settings' class='wpsc-edit-module-options'>
133
  <tr>
134
+ <td>
135
+ <div class='postbox'>
136
+ <h3 class='hndle'><?php _e( 'Select Payment Gateways', 'wpsc' ); ?></h3>
137
+ <div class='inside'>
138
+ <p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wpsc' ); ?></p>
139
+ <br />
140
+ <?php
141
+ $selected_gateways = get_option( 'custom_gateway_options' );
142
+ foreach ( $nzshpcrt_gateways as $gateway ) {
143
+ if ( isset( $gateway['admin_name'] ) )
144
+ $gateway['name'] = $gateway['admin_name'];
145
+ ?>
146
+
147
+ <div class="wpsc-select-gateway">
148
+ <div class='wpsc-gateway-actions'>
149
+ <span class="edit">
150
+ <a class='edit-payment-module' data-gateway-id="<?php echo esc_attr( $gateway['internalname'] ); ?>" title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wpsc' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['internalname'] ) ); ?>'><?php esc_html_e( 'Edit', 'wpsc' ); ?></a>
151
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
152
+ </span>
153
+ </div>
154
+ <p>
155
+ <input name='wpsc_options[custom_gateway_options][]' <?php checked( in_array( $gateway['internalname'], (array) $selected_gateways ) ); ?> type='checkbox' value='<?php echo esc_attr( $gateway['internalname'] ); ?>' id='<?php echo esc_attr( $gateway['internalname'] ); ?>_id' />
156
+ <label for='<?php echo esc_attr( $gateway['internalname'] ); ?>_id'><?php echo esc_attr( $gateway['name'] ); ?></label>
157
+ </p>
158
+ </div>
159
+ <?php }
160
+ ?>
161
+ <div class='submit gateway_settings'>
162
+ <input type='submit' value='<?php esc_attr_e( 'Update &raquo;', 'wpsc' ) ?>' name='updateoption' />
163
+ </div>
164
+ </div>
165
+ </div>
166
+
167
+ <h4><?php _e( 'We Recommend', 'wpsc' ); ?></h4>
168
+ <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> <br /><br />
169
+ <a style="border-bottom:none;" href="http://checkout.google.com/sell/?promo=seinstinct" target="_blank"><img src="https://checkout.google.com/buyer/images/google_checkout.gif" border="0" alt="<?php esc_attr_e( 'Sign up for Google Checkout', 'wpsc' ); ?>" /></a>
170
+
171
+ </td>
172
+
173
+ <?php $this->display_payment_gateway_settings_form(); ?>
174
  </tr>
175
+ </table>
176
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
+ <?php
 
179
  }
180
  }
wpsc-admin/includes/settings-tabs/general.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
- class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
 
3
  private $regions = array();
4
 
5
  public function __construct() {
@@ -41,7 +42,7 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
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(
@@ -53,154 +54,146 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
53
  ?>
54
  <span id='wpsc-base-region-drop-down'>
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
-
62
  <?php
63
- /* START OF TARGET MARKET SELECTION */
64
- $countrylist = WPSC_Countries::get_countries_array( true, true );
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') , add_query_arg( array( 'selected_all' => 'all' ) ), 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
- ?>
96
- </td>
97
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
- <?php
100
- $stock_keeping_time = wpsc_get_stock_keeping_time();
101
- $stock_keeping_interval = wpsc_get_stock_keeping_interval();
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
-
118
- <?php
119
- $hierarchical_category = get_option( 'product_category_hierarchical_url', 0 );
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>
148
- </tr>
149
-
150
- <?php
151
- $currency_data = $wpdb->get_row( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . esc_attr( get_option( 'currency_type' ) ) . "' LIMIT 1", ARRAY_A );
152
-
153
- if ( $currency_data['symbol'] != '' ) {
154
- $currency_sign = esc_attr( $currency_data['symbol_html'] );
155
- } else {
156
- $currency_sign = esc_attr( $currency_data['code'] );
157
- }
158
-
159
- $currency_sign_location = esc_attr( get_option( 'currency_sign_location' ) );
160
- $csl1 = "";
161
- $csl2 = "";
162
- $csl3 = "";
163
- $csl4 = "";
164
- switch ( $currency_sign_location ) {
165
- case 1:
166
- $csl1 = "checked='checked'";
167
- break;
168
 
169
- case 2:
170
- $csl2 = "checked='checked'";
171
- break;
172
 
173
- case 3:
174
- $csl3 = "checked='checked'";
175
- break;
176
 
177
- case 4:
178
- $csl4 = "checked='checked'";
179
- break;
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>
204
  <?php
205
  }
206
- } // end class
1
  <?php
2
+ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab
3
+ {
4
  private $regions = array();
5
 
6
  public function __construct() {
42
  <h3><?php echo esc_html_e( 'General Settings', 'wpsc' ); ?></h3>
43
  <table class='wpsc_options form-table'>
44
  <tr>
45
+ <th scope="row"><?php esc_html_e( 'Base Country/Region', 'wpsc' ); ?>: </th>
46
  <td>
47
  <?php
48
  wpsc_country_dropdown( array(
54
  ?>
55
  <span id='wpsc-base-region-drop-down'>
56
  <?php $this->display_region_drop_down(); ?>
57
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
58
  </span>
59
+ <br /><?php esc_html_e( 'Select your primary business location.', 'wpsc' ); ?>
60
  </td>
61
  </tr>
 
62
  <?php
63
+ /* START OF TARGET MARKET SELECTION */
64
+ $countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ", ARRAY_A );
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
82
+ foreach ( (array)$countrylist as $country ) {
83
+ if ( $country['visible'] == 1 ) {
84
+ ?>
85
+ <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' checked='checked' /> <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
86
+ <?php } else {
87
+ ?>
88
+ <input type='checkbox' id="countrylist2-<?php echo $country['id']; ?>" name='countrylist2[]' value='<?php echo $country['id']; ?>' /> <label for="countrylist2-<?php echo $country['id']; ?>"><?php esc_html_e( $country['country'] ); ?></label><br />
89
+ <?php }
90
+ } ?>
91
+ </div><br />
92
+ <?php esc_html_e( 'Select the markets you are selling products to.' , 'wpsc');
 
93
  }
94
+ ?>
95
+ </td>
96
+ </tr>
97
+ <?php
98
+ $stock_keeping_time = get_option( 'wpsc_stock_keeping_time', 1 );
99
+ $stock_keeping_interval = get_option( 'wpsc_stock_keeping_interval', 'day' );
100
+ ?>
101
+ <tr>
102
+ <th scope="row">
103
+ <label for="wpsc-stock-keeping-time"><?php esc_html_e( 'Keep stock in cart for', 'wpsc' ); ?>:</label>
104
+ </th>
105
+ <td>
106
+ <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 ); ?>" />
107
+ <select name="wpsc_options[wpsc_stock_keeping_interval]">
108
+ <option value="hour" <?php selected( 'hour', $stock_keeping_interval ); ?>><?php echo _n( 'hour', 'hours', $stock_keeping_time, 'wpsc' ); ?></option>
109
+ <option value="day" <?php selected( 'day', $stock_keeping_interval ); ?>><?php echo _n( 'day', 'days', $stock_keeping_time, 'wpsc' ) ?></option>
110
+ <option value="week" <?php selected( 'week', $stock_keeping_interval ); ?>><?php echo _n( 'week', 'weeks', $stock_keeping_time, 'wpsc' ) ?></option>
111
+ </select><br />
112
+ <?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' ) ?>
113
+ </td>
114
+ </tr>
115
+ <?php $hierarchical_category = get_option( 'product_category_hierarchical_url', 0 ); ?>
116
+ <tr>
117
+ <th scope="row">
118
+ <?php _e( 'Use Hierarchical Product Category URL', 'wpsc' ); ?>:
119
+ </th>
120
+ <td>
121
+ <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;
122
+ <label><input type="radio" <?php checked( $hierarchical_category, 0 ); ?>name="wpsc_options[product_category_hierarchical_url]" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label><br />
123
+ <?php _e( 'When Hierarchical Product Category URL is enabled, parent product categories are also included in the product URL.<br />For example: example.com/products-page/parent-cat/sub-cat/product-name', 'wpsc' ); ?>
124
+ </td>
125
+ </tr>
126
+ </table>
127
 
128
+ <h3 class="form_group"><?php esc_html_e( 'Currency Settings', 'wpsc' ); ?>:</h3>
129
+ <table class='wpsc_options form-table'>
130
+ <tr>
131
+ <th scope="row"><?php esc_html_e( 'Currency Type', 'wpsc' ); ?>:</th>
 
 
 
 
132
  <td>
133
+ <select name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
134
+ <?php
135
+ $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
136
+ $currency_type = esc_attr( get_option( 'currency_type' ) );
137
+ foreach ( $currency_data as $currency ) {
138
+ ?>
139
+ <option value='<?php echo $currency['id']; ?>' <?php selected( $currency['id'], $currency_type ); ?>><?php esc_html_e( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)</option>
140
+ <?php
141
+ }
142
+ $currency_data = $wpdb->get_row( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . esc_attr( get_option( 'currency_type' ) ) . "' LIMIT 1", ARRAY_A );
143
+ if ( $currency_data['symbol'] != '' ) {
144
+ $currency_sign = esc_attr( $currency_data['symbol_html'] );
145
+ } else {
146
+ $currency_sign = esc_attr( $currency_data['code'] );
147
+ }
148
+ ?>
149
  </select>
 
150
  </td>
151
  </tr>
 
 
 
 
152
  <tr>
153
+ <th scope="row"><?php esc_html_e( 'Currency Sign Location', 'wpsc' ); ?>:</th>
154
+ <td>
155
+ <?php
156
+ $currency_sign_location = esc_attr( get_option( 'currency_sign_location' ) );
157
+ $csl1 = "";
158
+ $csl2 = "";
159
+ $csl3 = "";
160
+ $csl4 = "";
161
+ switch ( $currency_sign_location ) {
162
+ case 1:
163
+ $csl1 = "checked ='checked'";
164
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
+ case 2:
167
+ $csl2 = "checked ='checked'";
168
+ break;
169
 
170
+ case 3:
171
+ $csl3 = "checked ='checked'";
172
+ break;
173
 
174
+ case 4:
175
+ $csl4 = "checked ='checked'";
176
+ break;
177
+ } ?>
178
+ <input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
179
+ <label for='csl1'><?php _ex( '100', 'Currency sign location - option 1', 'wpsc' ); ?><span id='cslchar1'><?php echo $currency_sign; ?></span></label> &nbsp;
180
+ <input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
181
+ <label for='csl2'><?php _ex( '100', 'Currency sign location - option 2', 'wpsc' ); ?> <span id='cslchar2'><?php echo $currency_sign; ?></span></label> &nbsp;
182
+ <input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
183
+ <label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span><?php _ex( '100', 'Currency sign location - option 3', 'wpsc' ); ?></label> &nbsp;
184
+ <input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
185
+ <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> <?php _ex( '100', 'Currency sign location - option 4', 'wpsc' ); ?></label>
186
+ </td>
187
+ </tr>
188
+ <tr>
189
+ <th scope="row"><?php esc_html_e( 'Thousands and decimal separators', 'wpsc' ); ?>:</th>
190
+ <td>
191
+ <?php esc_html_e( 'Thousands separator', 'wpsc' ); ?>: <input name="wpsc_options[wpsc_thousands_separator]" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_thousands_separator' ) ); ?>" /> <br />
192
+ <?php esc_html_e( 'Decimal separator', 'wpsc' ); ?>: <input name="wpsc_options[wpsc_decimal_separator]" type="text" maxlength="1" size="1" value="<?php echo esc_attr( get_option( 'wpsc_decimal_separator' ) ); ?>" /> <br />
193
+ <?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
194
+ </td>
195
+ </tr>
196
+ </table>
 
 
 
 
197
  <?php
198
  }
199
+ }
wpsc-admin/includes/settings-tabs/import.php CHANGED
@@ -1,40 +1,22 @@
1
  <?php
2
 
3
- class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
4
-
5
- private $file = false;
6
- private $step = 1;
7
- private $display_data = array();
8
- private $completed = false;
9
- private $default_fields = array();
10
 
11
  public function __construct() {
12
-
13
  parent::__construct();
14
 
15
  $file = get_transient( 'wpsc_settings_tab_import_file' );
16
-
17
- if ( $file ) {
18
  $this->file = $file;
19
- }
20
 
21
  $this->step = empty( $_REQUEST['step'] ) ? 1 : (int) $_REQUEST['step'];
22
-
23
- if ( $this->step < 1 || $this->step > 3 ) {
24
  $this->step = 1;
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 ) {
40
  case 2:
@@ -50,7 +32,6 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
50
 
51
  private function prepare_import_columns() {
52
  $this->hide_update_message();
53
-
54
  ini_set( 'auto_detect_line_endings', 1 );
55
  $handle = @fopen( $this->file, 'r' );
56
 
@@ -59,73 +40,49 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
59
  return;
60
  }
61
 
62
- $rows = array();
63
-
64
- while ( count( $rows ) < 5 && ( false !== ( $data = fgetcsv( $handle ) ) ) ) {
65
- array_push( $rows, $data );
66
- }
67
-
68
- $sample_row_data = array();
69
-
70
- foreach ( $rows as $row => $columns ) {
71
- foreach ( $columns as $column => $data ) {
72
-
73
- if ( ! isset( $sample_row_data[ $column ] ) ) {
74
- $sample_row_data[ $column ] = array();
75
- }
76
-
77
- array_push( $sample_row_data[ $column ], $data );
78
- }
79
- }
80
-
81
  $categories = get_terms( 'wpsc_product_category', 'hide_empty=0' );
82
 
83
  $this->display_data = array(
84
- 'sample_row_data' => $sample_row_data,
85
- 'categories' => $categories,
86
  );
87
  }
88
 
89
  private function reset_state() {
90
  delete_transient( 'wpsc_settings_tab_import_file' );
91
- $this->file = false;
92
- $this->completed = false;
93
  $this->display_data = array();
94
  }
95
 
96
  private function import_data() {
97
  ini_set( 'auto_detect_line_endings', 1 );
98
-
99
- $handle = @fopen( $this->file, 'r' );
100
-
101
  if ( ! $handle ) {
102
  $this->reset_state();
103
  return;
104
  }
105
 
106
- $length = filesize( $this->file );
107
 
108
  $column_map = array_flip( $_POST['value_name'] );
109
-
110
  extract( $column_map, EXTR_SKIP );
111
 
112
- $record_count = 0;
113
-
114
  while ( $row = @fgetcsv( $handle, $length, ',' ) ) {
115
-
116
  $product = array(
117
- 'post_title' => isset( $row[ $column_name ] ) ? $row[ $column_name ] : '',
118
- 'content' => isset( $row[ $column_description ] ) ? $row[ $column_description ] : '',
119
- 'price' => isset( $row[ $column_price ] ) ? str_replace( '$', '', $row[ $column_price ] ) : 0,
120
- 'weight' => isset( $row[ $column_weight ] ) ? $row[ $column_weight] : '',
121
- 'weight_unit' => isset( $row[ $column_weight_unit ] ) ? $row[ $column_weight_unit ] : '',
122
- 'additional_description' => isset( $row[ $column_additional_description ] ) ? $row[ $column_additional_description ] : '',
123
  'pnp' => null,
124
  'international_pnp' => null,
125
  'file' => null,
126
  'image' => '0',
127
- 'quantity_limited' => isset( $row[ $column_quantity_limited ] ) ? $row[ $column_quantity_limited ] : '',
128
- 'quantity' => isset( $row[ $column_quantity ] ) ? $row[ $column_quantity ] : null,
129
  'special' => null,
130
  'special_price' => null,
131
  'display_frontpage' => null,
@@ -148,29 +105,16 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
148
  )
149
  );
150
 
151
- $product = apply_filters( 'wpsc_product_import_row', $product, $row, $this );
152
-
153
- if ( empty( $product['post_title'] ) && apply_filters( 'wpsc_product_import_require_title', true, $product, $row, $this ) ) {
154
- continue;
155
- }
156
-
157
  $product = wpsc_sanitise_product_forms( $product );
158
-
159
  // status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
160
  $product['post_status'] = $_POST['post_status'];
161
-
162
  $product_id = wpsc_insert_product( $product );
163
-
164
- if ( (int) $_POST['category'] > 0 ) {
165
- wp_set_object_terms( $product_id , array( (int) $_POST['category'] ) , 'wpsc_product_category' );
166
- }
167
-
168
- $record_count += 1;
169
  }
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() {
@@ -185,9 +129,8 @@ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab {
185
  }
186
  }
187
 
188
- if ( $this->completed ) {
189
  return array( 'step' => 1 );
190
- }
191
 
192
  return array( 'step' => $this->step + 1 );
193
  }
@@ -195,159 +138,73 @@ 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>
217
- <?php foreach ($sample_data as $datum) : ?>
218
- <li>
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; ?>
226
- </ol>
227
- </td>
228
- <td>
229
- <p>
230
- <select name='value_name[<?php echo $key; ?>]'>
231
- <?php
232
- $i = 0;
233
- foreach ( $this->default_fields as $value => $label ) :
234
- ?>
235
- <option <?php selected( $key, $i ); ?> value='<?php echo esc_attr( $value ); ?>'><?php echo esc_html( $label ); ?></option>
236
- <?php
237
- $i++;
238
- endforeach;
239
- ?>
240
  </select>
241
- </p>
242
- </td>
243
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
283
- private function num_to_alphacolumn($n) {
284
- // from http://stackoverflow.com/questions/3302857/algorithm-to-get-the-excel-like-column-name-of-a-number
285
-
286
- for( $r = ""; $n >= 0; $n = intval( $n / 26 ) - 1 ) {
287
- $r = chr( $n % 26 + 0x41) . $r;
288
- }
289
-
290
- return $r;
291
- }
292
-
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>
349
- </table>
350
-
351
  <?php
352
  }
353
 
1
  <?php
2
 
3
+ class WPSC_Settings_Tab_Import extends WPSC_Settings_Tab
4
+ {
5
+ private $file = false;
6
+ private $step = 1;
7
+ private $display_data = array();
8
+ private $completed = false;
 
9
 
10
  public function __construct() {
 
11
  parent::__construct();
12
 
13
  $file = get_transient( 'wpsc_settings_tab_import_file' );
14
+ if ( $file )
 
15
  $this->file = $file;
 
16
 
17
  $this->step = empty( $_REQUEST['step'] ) ? 1 : (int) $_REQUEST['step'];
18
+ if ( $this->step < 1 || $this->step > 3 )
 
19
  $this->step = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  switch ( $this->step ) {
22
  case 2:
32
 
33
  private function prepare_import_columns() {
34
  $this->hide_update_message();
 
35
  ini_set( 'auto_detect_line_endings', 1 );
36
  $handle = @fopen( $this->file, 'r' );
37
 
40
  return;
41
  }
42
 
43
+ $first_row = @fgetcsv( $handle );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  $categories = get_terms( 'wpsc_product_category', 'hide_empty=0' );
45
 
46
  $this->display_data = array(
47
+ 'columns' => $first_row,
48
+ 'categories' => $categories,
49
  );
50
  }
51
 
52
  private function reset_state() {
53
  delete_transient( 'wpsc_settings_tab_import_file' );
54
+ $this->file = false;
55
+ $this->completed = false;
56
  $this->display_data = array();
57
  }
58
 
59
  private function import_data() {
60
  ini_set( 'auto_detect_line_endings', 1 );
61
+ $handle = @fopen( $this->file, 'r' );
 
 
62
  if ( ! $handle ) {
63
  $this->reset_state();
64
  return;
65
  }
66
 
67
+ $length = filesize( $this->file );
68
 
69
  $column_map = array_flip( $_POST['value_name'] );
 
70
  extract( $column_map, EXTR_SKIP );
71
 
 
 
72
  while ( $row = @fgetcsv( $handle, $length, ',' ) ) {
 
73
  $product = array(
74
+ 'post_title' => isset( $row[$column_name] ) ? $row[$column_name] : '',
75
+ 'content' => isset( $row[$column_description] ) ? $row[$column_description] : '',
76
+ 'additional_description' => isset( $row[$column_additional_description] ) ? $row[$column_additional_description] : '',
77
+ 'price' => isset( $row[$column_price] ) ? str_replace( '$', '', $row[$column_price] ) : 0,
78
+ 'weight' => isset( $row[$column_weight] ) ? $row[$column_weight] : '',
79
+ 'weight_unit' => isset( $row[$column_weight_unit] ) ? $row[$column_weight_unit] : '',
80
  'pnp' => null,
81
  'international_pnp' => null,
82
  'file' => null,
83
  'image' => '0',
84
+ 'quantity_limited' => isset( $row[$column_quantity_limited] ) ? $row[$column_quantity_limited] : '',
85
+ 'quantity' => isset( $row[$column_quantity] ) ? $row[$column_quantity] : null,
86
  'special' => null,
87
  'special_price' => null,
88
  'display_frontpage' => null,
105
  )
106
  );
107
 
 
 
 
 
 
 
108
  $product = wpsc_sanitise_product_forms( $product );
 
109
  // status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
110
  $product['post_status'] = $_POST['post_status'];
 
111
  $product_id = wpsc_insert_product( $product );
112
+ wp_set_object_terms( $product_id , array( (int)$_POST['category'] ) , 'wpsc_product_category' );
 
 
 
 
 
113
  }
114
 
115
  $this->reset_state();
116
  $this->completed = true;
117
+ add_settings_error( 'wpsc-settings', 'settings_updated', __( 'CSV file imported.', 'wpsc' ), 'updated' );
118
  }
119
 
120
  public function callback_submit_options() {
129
  }
130
  }
131
 
132
+ if ( $this->completed )
133
  return array( 'step' => 1 );
 
134
 
135
  return array( 'step' => $this->step + 1 );
136
  }
138
  private function display_imported_columns() {
139
  extract( $this->display_data );
140
  ?>
141
+ <p><?php esc_html_e( 'For each column, select the field it corresponds to in \'Belongs to\'. You can upload as many products as you like.', 'wpsc' ); ?></p>
142
+ <div class='metabox-holder' style='width:90%'>
143
+ <div style='width:100%;' class='postbox'>
144
+ <h3 class='hndle'><?php esc_html_e( 'Product Status' , 'wpsc' ); ?></h3>
145
+ <div class='inside'>
146
+ <table>
147
+ <tr>
148
+ <td style='width:80%;'>
149
+ <?php esc_html_e( 'Select if you would like to import your products in as Drafts or Publish them right away.' , 'wpsc' ); ?>
150
+ <br />
151
+ </td>
152
+ <td>
153
+ <select name='post_status'>
154
+ <option value='publish'><?php esc_html_e( 'Publish', 'wpsc' ); ?></option>
155
+ <option value='draft' ><?php esc_html_e( 'Draft' , 'wpsc' ); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  </select>
157
+ </td>
158
+ </tr>
159
+ </table>
160
+ </div>
161
+ </div>
162
+ <?php foreach ( $columns as $key => $datum ): ?>
163
+ <div style='width:100%;' class='postbox'>
164
+ <h3 class='hndle'><?php printf( __('Column (%s)', 'wpsc' ), ( $key + 1 ) ); ?></h3>
165
+ <div class='inside'>
166
+ <table>
167
+ <tr>
168
+ <td style='width:80%;'>
169
+ <?php echo $datum; ?>
170
+ <br />
171
+ </td>
172
+ <td>
173
+ <select name='value_name[<?php echo $key; ?>]'>
174
+ <option <?php selected( $key, 0 ); ?> value='column_name' ><?php esc_html_e( 'Product Name' , 'wpsc' ); ?></option>
175
+ <option <?php selected( $key, 1 ); ?> value='column_description' ><?php esc_html_e( 'Description' , 'wpsc' ); ?></option>
176
+ <option <?php selected( $key, 2 ); ?> value='column_additional_description'><?php esc_html_e( 'Additional Description', 'wpsc' ); ?></option>
177
+ <option <?php selected( $key, 3 ); ?> value='column_price' ><?php esc_html_e( 'Price' , 'wpsc' ); ?></option>
178
+ <option <?php selected( $key, 4 ); ?> value='column_sku' ><?php esc_html_e( 'SKU' , 'wpsc' ); ?></option>
179
+ <option <?php selected( $key, 5 ); ?> value='column_weight' ><?php esc_html_e( 'Weight' , 'wpsc' ); ?></option>
180
+ <option <?php selected( $key, 6 ); ?> value='column_weight_unit' ><?php esc_html_e( 'Weight Unit' , 'wpsc' ); ?></option>
181
+ <option <?php selected( $key, 7 ); ?> value='column_quantity' ><?php esc_html_e( 'Stock Quantity' , 'wpsc' ); ?></option>
182
+ <option <?php selected( $key, 8 ); ?> value='column_quantity_limited' ><?php esc_html_e( 'Stock Quantity Limit' , 'wpsc' ); ?></option>
183
+ </select>
184
+ </td>
185
+ </tr>
186
+ </table>
187
+ </div>
188
+ </div>
189
+ <?php endforeach; ?>
190
+ <label for='category'><?php esc_html_e( 'Please select a category you would like to place all products from this CSV into' , 'wpsc' ); ?>:</label>
191
+ <select id='category' name='category'>
192
+ <?php foreach ( $categories as $category ): ?>
193
+ <option value="<?php echo $category->term_id; ?>"><?php echo esc_html( $category->name ); ?></option>
194
  <?php endforeach; ?>
195
+ </select>
196
+ <input type="hidden" name="step" value="3" />
197
+ <input type='submit' value='<?php echo esc_html_x( 'Continue', 'import csv', 'wpsc' ); ?>' class='button-primary'>
198
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  <?php
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
202
  private function display_default() {
203
  extract( $this->display_data );
204
  ?>
205
+ <?php _e( '<p>You can import your products from a comma delimited text file.</p><p>An example of a csv import file would look like this: </p><p>Description, Additional Description, Product Name, Price, SKU, weight, weight unit, stock quantity, is limited quantity</p>', 'wpsc' ); ?>
206
+ <input type='file' name='csv_file' />
 
 
 
 
 
 
 
 
 
 
 
207
  <?php submit_button( esc_html_x( 'Upload', 'import csv', 'wpsc' ) ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  <?php
209
  }
210
 
wpsc-admin/includes/settings-tabs/marketing.php CHANGED
@@ -20,191 +20,111 @@ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
20
  }
21
 
22
  public function display() {
23
- $this->marketing_settings_form();
24
- $this->rss_address_settings_form();
25
- $this->google_merch_center_settings_form();
26
- $this->google_analytics_integration_settings_form();
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
- public function marketing_settings_form() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  $wpsc_also_bought = get_option( 'wpsc_also_bought' );
32
  $wpsc_also_bought1 = '';
33
 
34
  if ( '1' == $wpsc_also_bought )
35
- $wpsc_also_bought1 = "checked='checked'";
36
 
37
  $wpsc_share_this = get_option( 'wpsc_share_this' );
38
  $wpsc_share_this1 = '';
39
 
40
  if ( '1' == $wpsc_share_this )
41
- $wpsc_share_this1 = "checked='checked'";
42
 
43
  $facebook_like = get_option( 'wpsc_facebook_like' );
44
  $facebook_like1 = '';
45
  if ( 'on' == $facebook_like )
46
- $facebook_like1 = "checked='checked'";
47
 
48
  $display_find_us = get_option( 'display_find_us' );
49
  $display_find_us1 = '';
50
 
51
  if ( '1' == $display_find_us )
52
- $display_find_us1 = "checked='checked'";
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>
102
- <?php
103
  }
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( '/' ) ); ?>
117
- <a href="<?php echo esc_url( $rss_url ); ?>"><code><?php echo esc_url( $rss_url ); ?></code></a>
118
- </td>
119
- </tr>
120
- </table>
121
  <?php
122
  }
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( '/' ) ); ?>
136
- <a href="<?php echo esc_url( $google_feed_url ); ?>"><code><?php echo esc_url( $google_feed_url ); ?></code></a>
137
- </td>
138
- </tr>
139
- </table>
140
- <?php
141
- }
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
  }
20
  }
21
 
22
  public function display() {
23
+ ?>
24
+ <div class='metabox-holder'>
25
+ <?php
26
+ add_meta_box( 'wpsc_marketing_settings', __( 'Marketing Section', 'wpsc' ), array( $this, 'marketing_meta_box' ), 'wpsc' );
27
+ add_meta_box( 'wpsc_rss_address', __( 'RSS Address', 'wpsc' ), array( $this, 'rss_address_meta_box' ), 'wpsc' );
28
+ add_meta_box( 'wpsc_google_merch_center', __( 'Google Merchant Centre / Google Product Search', 'wpsc' ), array( $this, 'google_merch_center_meta_box' ), 'wpsc' );
29
+ add_meta_box( 'wpsc_google_analytics_integration', __( 'Google Analytics', 'wpsc' ), array( $this, 'google_analytics_integration' ), 'wpsc' );
30
+
31
+ do_meta_boxes( 'wpsc', 'advanced', null );
32
+ ?>
33
+
34
+ </div>
35
+ <?php
36
  }
37
 
38
+ public function google_analytics_integration() {
39
+ ?>
40
+ <input type='hidden' name='change-settings' value='true' />
41
+ <p>
42
+ <span class='input_label'><?php _e( 'Disable Google Analytics tracking', 'wpsc' ); ?></span>
43
+ <input value='1' <?php checked( '1', get_option( 'wpsc_ga_disable_tracking' ) ); ?> type='checkbox' name='wpsc_ga_disable_tracking' />
44
+ <span class='description'><?php _e( 'If, for whatever reason, you decide you do not want any tracking, disable it.', 'wpsc' ); ?></span>
45
+ </p><br />
46
+ <p class="wpsc_ga_currently_tracking">
47
+ <span class='input_label'><?php _e( 'Currently tracking Google Analytics', 'wpsc' ); ?></span>
48
+ <input value='1' <?php checked( '1', get_option( 'wpsc_ga_currently_tracking' ) ); ?> type='checkbox' name='wpsc_ga_currently_tracking' />
49
+ <span class='description'><?php _e( 'If you have already manually placed your Google Analytics tracking code in your theme, or have another plugin handling it, check this box.', 'wpsc' ); ?></span>
50
+ </p><br />
51
+ <p class="wpsc_ga_advanced">
52
+ <span class='input_label'><?php _e( 'Advanced', 'wpsc' ); ?></span>
53
+ <input value='1' <?php checked( '1', get_option( 'wpsc_ga_advanced' ) ); ?> type='checkbox' name='wpsc_ga_advanced' /><br />
54
+ <span 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' ); ?></span>
55
+ </p><br />
56
+ <p class='wpsc_ga_tracking_id'>
57
+ <span class='input_label'><?php _e( 'Tracking ID', 'wpsc' ); ?></span>
58
+ <input value="<?php echo esc_attr( get_option( 'wpsc_ga_tracking_id' ) ); ?>" type='text' name='wpsc_ga_tracking_id' />
59
+ <span class='description'><?php _e( 'Enter your tracking ID here.', 'wpsc' ); ?></span>
60
+ </p><br />
61
+ <?php
62
+ }
63
+
64
+ public function marketing_meta_box() {
65
 
66
  $wpsc_also_bought = get_option( 'wpsc_also_bought' );
67
  $wpsc_also_bought1 = '';
68
 
69
  if ( '1' == $wpsc_also_bought )
70
+ $wpsc_also_bought1 = "checked ='checked'";
71
 
72
  $wpsc_share_this = get_option( 'wpsc_share_this' );
73
  $wpsc_share_this1 = '';
74
 
75
  if ( '1' == $wpsc_share_this )
76
+ $wpsc_share_this1 = "checked ='checked'";
77
 
78
  $facebook_like = get_option( 'wpsc_facebook_like' );
79
  $facebook_like1 = '';
80
  if ( 'on' == $facebook_like )
81
+ $facebook_like1 = "checked ='checked'";
82
 
83
  $display_find_us = get_option( 'display_find_us' );
84
  $display_find_us1 = '';
85
 
86
  if ( '1' == $display_find_us )
87
+ $display_find_us1 = "checked ='checked'"; ?>
88
+ <input type='hidden' name='change-settings' value='true' />
89
+ <p>
90
+ <span class='input_label'><?php esc_html_e( 'Display Cross Sales', 'wpsc' ); ?></span>
91
+ <input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
92
+ <span class='description'><?php esc_html_e( 'Adds the \'Users who bought this also bought\' item to the single products page.', 'wpsc' ); ?></span>
93
+ </p><br />
94
+ <p>
95
+ <span class='input_label'><?php esc_html_e( 'Show Share This (Social Bookmarks)', 'wpsc' ); ?></span>
96
+ <input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
97
+ <span class='description'> <?php esc_html_e( 'Adds the \'Share this link\' item to the single products page.', 'wpsc' ); ?></span>
98
+ </p><br />
99
+ <p>
100
+ <span class='input_label'> <?php esc_html_e( 'Display How Customer Found Us Survey', 'wpsc' ) ?></span>
101
+ <input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
102
+ <span class='description'> <?php esc_html_e( 'Adds the \'How did you find out about us\' drop-down option at checkout.', 'wpsc' ) ?></span>
103
+ </p><br />
104
+ <p>
105
+ <span class='input_label'> <?php esc_html_e( 'Display Facebook Like', 'wpsc' ) ?></span>
106
+ <input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
107
+ <input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
108
+ <span class='description'> <?php esc_html_e( 'Adds the Facebook Like button on your single products page.', 'wpsc' ) ?></span>
109
+ </p><br />
110
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
112
 
113
+ public function rss_address_meta_box() {
114
  ?>
115
+ <p><?php esc_html_e( 'People can use this RSS feed to keep up to date with your product list.', 'wpsc' ); ?></p>
116
+ <p><?php esc_html_e( 'RSS Feed Address', 'wpsc' ) ?> : <?php echo get_bloginfo( 'url' ) . "/index.php?rss=true&amp;action=product_list"; ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
117
  <?php
118
  }
119
 
120
+ function google_merch_center_meta_box() {
121
  ?>
122
+ <p><?php esc_html_e( 'To import your products into <a href="http://www.google.com/merchants/" 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' ); ?></p>
123
+
124
+ <?php $google_feed_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list', 'xmlformat' => 'google' ), home_url( '/' ) ); ?>
125
+
126
+ <a href="<?php echo esc_url( $google_feed_url ); ?>"><?php echo esc_url( $google_feed_url ); ?></a>
 
 
 
 
 
 
 
 
 
 
 
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  <?php
129
  }
 
130
  }
wpsc-components/theme-engine-v1/classes/settings-tab-presentation.php → wpsc-admin/includes/settings-tabs/presentation.php RENAMED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
- class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
 
4
  public function __construct() {
5
  $this->page_title = __( 'General Settings', 'wpsc' );
6
  }
@@ -129,7 +130,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
129
 
130
  </p>
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>
@@ -179,11 +180,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
179
  public function display() {
180
  ?>
181
  <div class='product_and_button_settings'>
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>
@@ -378,6 +376,9 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
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'>
@@ -460,7 +461,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
  ?>
@@ -470,7 +471,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
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]' />
@@ -606,7 +607,7 @@ 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>
@@ -959,12 +960,9 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
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>
@@ -972,25 +970,17 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
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>
996
  <tr>
1
  <?php
2
 
3
+ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab
4
+ {
5
  public function __construct() {
6
  $this->page_title = __( 'General Settings', 'wpsc' );
7
  }
130
 
131
  </p>
132
  <p>
133
+ <?php _e( 'WP e-Commerce provides you the ability to move your theme files to a safe place for theming control.
134
 
135
  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' ); ?>
136
  </p>
180
  public function display() {
181
  ?>
182
  <div class='product_and_button_settings'>
 
 
 
183
  <h3 class="form_group"><?php esc_html_e( 'Button Settings', 'wpsc' ); ?></h3>
184
+ <table class='wpsc_options form-table'>
185
  <tr>
186
  <th scope="row"><?php esc_html_e( 'Button Type', 'wpsc' ); ?>:</th>
187
  <td>
376
  </table>
377
  </div>
378
 
379
+ <?php $this->theme_metabox(); ?>
380
+
381
+ <div style='clear:both;'></div>
382
 
383
  <h3 class="form_group"><?php esc_html_e( 'Product Page Settings', 'wpsc' ); ?></h3>
384
  <table class='wpsc_options form-table'>
461
  <?php
462
  if ( ! function_exists( 'product_display_grid' ) ) {
463
  ?>
464
+ <a href='http://getshopped.org/extend/premium-upgrades'><?php esc_html_e( 'Purchase unavailable options', 'wpsc' ); ?></a>
465
  <?php
466
  }
467
  ?>
471
  <tr id="wpsc-grid-settings">
472
  <th scope="row"><?php esc_html_e( 'Grid view settings:', 'wpsc' ) ?></th>
473
  <td>
474
+ <input type='text' name='wpsc_options[grid_number_per_row]' id='grid_number_per_row' size='1' value='<?php esc_attr_e( get_option( 'grid_number_per_row' ) ); ?>' />
475
  <label for='grid_number_per_row'><?php esc_html_e( 'Products Per Row', 'wpsc' ); ?></label><br />
476
 
477
  <input type='hidden' value='0' name='wpsc_options[show_images_only]' />
607
  break;
608
  }
609
  ?>
610
+ <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> &nbsp;
611
  <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>
612
  </td>
613
  </tr>
960
  <tr>
961
  <th scope="row"><?php esc_html_e( 'Default Product Thumbnail Size', 'wpsc' ); ?>:</th>
962
  <td>
963
+ <?php esc_html_e( 'Width', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[product_image_width]' class='wpsc_prod_thumb_option' value='<?php esc_attr_e( get_option( 'product_image_width' ) ); ?>' />
964
+ <?php esc_html_e( 'Height', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[product_image_height]' class='wpsc_prod_thumb_option' value='<?php esc_attr_e( get_option( 'product_image_height' ) ); ?>' />
965
+
 
 
 
966
  </td>
967
  </tr>
968
  <tr>
970
  <?php esc_html_e( 'Default Product Category Thumbnail Size', 'wpsc' ); ?>:
971
  </th>
972
  <td>
973
+ <?php esc_html_e( 'Width', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[category_image_width]' value='<?php esc_attr_e( get_option( 'category_image_width' ) ); ?>' />
974
+ <?php esc_html_e( 'Height', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[category_image_height]' value='<?php esc_attr_e( get_option( 'category_image_height' ) ); ?>' />
 
 
 
 
975
  </td>
976
  </tr>
977
  <tr>
978
  <th scope="row">
979
+ <?php esc_html_e( 'Single Product Image Size', 'wpsc' ); ?>:
980
  </th>
981
  <td>
982
+ <?php esc_html_e( 'Width', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[single_view_image_width]' value='<?php esc_attr_e( get_option( 'single_view_image_width' ) ); ?>' />
983
+ <?php esc_html_e( 'Height', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[single_view_image_height]' value='<?php esc_attr_e( get_option( 'single_view_image_height' ) ); ?>' />
 
 
 
 
984
  </td>
985
  </tr>
986
  <tr>
wpsc-admin/includes/settings-tabs/shipping.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
- class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
 
3
  public function __construct() {
4
  parent::__construct();
5
 
@@ -46,56 +47,52 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
46
 
47
  $shipadd = 0;
48
  foreach ( $wpsc_shipping_modules as $shipping ) {
49
- foreach ( (array) $_POST['custom_shipping_options'] as $shippingoption ) {
50
- if ( $shipping->getInternalName() == $shippingoption ) {
51
  $shipadd++;
52
  }
53
  }
54
  }
55
 
56
- if ( isset( $_POST['wpsc_options']['shipping_discount_value'] ) ) {
57
- update_option( 'shipping_discount_value', wpsc_string_to_float( $_POST['wpsc_options']['shipping_discount_value'] ) );
58
- }
59
-
60
- if ( ! get_option( 'do_not_use_shipping' ) && ! get_option( 'custom_shipping_options' ) && ! ( bool ) get_option( 'shipwire' ) ) {
61
  update_option( 'do_not_use_shipping', '1' );
62
  return array( 'shipping_disabled' => 1 );
63
  } else {
64
- $_SERVER['REQUEST_URI'] = remove_query_arg( 'shipping_disabled' );
65
  }
66
  }
67
 
68
- public function display_shipping_module_settings_form( $selected_module_id = null ) {
69
  global $wpsc_shipping_modules;
70
- if ( ! $selected_module_id ) {
71
- $selected_module_id = (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() );
72
- }
73
-
74
  $found_selected_module = array_key_exists( $selected_module_id, $wpsc_shipping_modules );
75
-
76
  if ( $found_selected_module ) {
77
  $selected_module = $wpsc_shipping_modules[$selected_module_id];
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>
98
- </div>
 
 
99
  <?php
100
  }
101
 
@@ -104,10 +101,10 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
104
  $location = add_query_arg( array(
105
  'tab' => 'shipping',
106
  'page' => 'wpsc-settings',
107
- 'shipping_module_id' => $shipping->getInternalName(),
108
  ), $location );
109
  $location .= '#wpsc-shipping-module-options';
110
- return $location;
111
  }
112
 
113
  public function display() {
@@ -118,229 +115,218 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
118
  if ( empty( $module ) )
119
  continue;
120
 
121
- if ( isset( $module->is_external ) && $module->is_external ) {
122
  $external_shipping_modules[$key] = $module;
123
- } else {
124
  $internal_shipping_modules[$key] = $module;
125
- }
126
  }
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' />
134
- <table class='form-table'>
135
- <?php
136
- /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
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
175
- switch ( get_option( 'shipwire' ) ) {
176
- case 1:
177
- $shipwire_settings = '';
178
- break;
179
-
180
- case 0:
181
- default:
182
- $shipwire_settings = 'style="display: none;"';
183
- break;
184
- }
185
- ?>
186
- <tr id='wpsc_shipwire_setting' <?php echo $shipwire_settings; ?>>
187
- <th>&nbsp;</th>
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>
209
- </table>
210
- </td>
211
- </tr>
212
- <?php
213
- $currency_data = WPSC_Countries::get_currency_data( get_option( 'currency_type' ), true );
214
- if ( $currency_data['symbol'] != '' ) {
215
- $currency_sign = $currency_data['symbol_html'];
216
- } else {
217
- $currency_sign = $currency_data['code'];
218
- }
219
- ?>
220
- <tr>
221
- <th><?php _e( 'Free Shipping Discount', 'wpsc' ); ?></th>
222
- <td>
223
- <?php
224
- if ( get_option( 'shipping_discount' ) == 1 ) {
225
- $shipping_discount_settings = 'style=\'display: block;\'';
226
- } else {
227
- $shipping_discount_settings = '';
228
- }
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>
236
- <tr>
237
- <td>&nbsp;</td>
238
- <td colspan="2">
239
- <?php
240
- $value = wpsc_format_number( get_option( 'shipping_discount_value' ) );
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>
274
- <?php
275
- foreach ( $internal_shipping_modules as $shipping ) {
276
- $force = ( $shipping->getInternalName() === (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() ) );
277
- $this->shipping_list_item( $shipping, $force );
278
- }
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>
304
- <?php
305
- foreach ( $external_shipping_modules as $shipping ) {
306
- $force = ( $shipping->getInternalName() === (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() ) );
307
- $this->shipping_list_item( $shipping, $force );
308
- }
309
- ?>
310
- </tbody>
311
- </table>
312
- <?php
313
- }
314
-
315
- private function shipping_list_item ( $shipping, $force ) {
316
  //get shipping options that are selected
317
  $selected_shippings = get_option( 'custom_shipping_options' );
 
 
 
 
 
318
 
319
- $shipping->checked = is_object( $shipping ) && in_array( $shipping->getInternalName(), (array) $selected_shippings );
320
- $shipping->active = $shipping->checked ? 'active' : 'inactive';
321
- $shipping->hidden = $force ? '' : "style='display: none;'";
322
- $shipping->disabled = isset( $shipping->requires_curl ) && $shipping->requires_curl && ! function_exists( 'curl_init' ) ;
323
 
324
- ?>
325
- <tr class="wpsc-select-shipping <?php echo $shipping->active; ?>" data-shipping-id="<?php echo esc_attr( $shipping->getInternalName() ); ?>" id="shipping_list_item_<?php echo $shipping->getInternalName();?>">
326
- <th scope="row" class="check-column">
327
- <input name='custom_shipping_options[]' <?php disabled( $shipping->disabled ); ?> <?php checked( $shipping->checked ); ?> type='checkbox' value='<?php echo $shipping->getInternalName(); ?>' id='<?php echo $shipping->getInternalName(); ?>_id' />
328
- </th>
329
- <td class="plugin-title">
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>
337
- </td>
338
- </tr>
339
- <tr id="wpsc_shipping_settings_<?php echo esc_attr( $shipping->getInternalName() ); ?>" data-shipping-id="<?php echo esc_attr( $shipping->getInternalName() ); ?>" class='wpsc-select-shipping <?php echo $shipping->active; ?>' <?php echo $shipping->hidden; ?> >
340
- <td colspan="3" id="wpsc_shipping_settings_<?php echo esc_attr( $shipping->getInternalName() ); ?>_container">
341
- <?php $this->display_shipping_module_settings_form( $shipping->getInternalName() ); ?>
342
- </td>
343
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  <?php
345
  }
346
- }
1
  <?php
2
+ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab
3
+ {
4
  public function __construct() {
5
  parent::__construct();
6
 
47
 
48
  $shipadd = 0;
49
  foreach ( $wpsc_shipping_modules as $shipping ) {
50
+ foreach ( (array)$_POST['custom_shipping_options'] as $shippingoption ) {
51
+ if ( $shipping->internal_name == $shippingoption ) {
52
  $shipadd++;
53
  }
54
  }
55
  }
56
 
57
+ if ( ! get_option( 'do_not_use_shipping' ) && ! get_option( 'custom_shipping_options' ) ) {
 
 
 
 
58
  update_option( 'do_not_use_shipping', '1' );
59
  return array( 'shipping_disabled' => 1 );
60
  } else {
61
+ $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( 'shipping_disabled' ) );
62
  }
63
  }
64
 
65
+ public function display_shipping_module_settings_form() {
66
  global $wpsc_shipping_modules;
67
+ $classes = array( 'wpsc-module-settings' );
68
+ $selected_module_id = (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() );
 
 
69
  $found_selected_module = array_key_exists( $selected_module_id, $wpsc_shipping_modules );
 
70
  if ( $found_selected_module ) {
71
  $selected_module = $wpsc_shipping_modules[$selected_module_id];
72
+ $title = $selected_module->name;
73
+ $content = $selected_module->getForm();
74
+ $classes[] = 'wpsc-shipping-module-settings-' . $selected_module_id;
75
  } else {
76
  $title = __( 'Edit Shipping Module Settings', 'wpsc' );
77
  $content = __( 'To configure a shipping module select one on the left.', 'wpsc' );
78
  }
79
+ $classes = implode( ' ', $classes );
80
  ?>
81
+ <td id="wpsc-shipping-module-settings" class="<?php echo esc_attr( $classes ); ?>" rowspan='2'>
82
+ <div class='postbox'>
83
+ <h3 class='hndle'><?php echo esc_html( $title ); ?></h3>
84
+ <div class='inside'>
85
+ <table class='form-table'>
86
+ <?php echo $content; ?>
87
+ </table>
88
+ <?php if ( $found_selected_module ): ?>
89
+ <p class="submit">
90
+ <input type="submit" value="<?php _e( 'Update &raquo;', 'wpsc' ); ?>" />
91
+ </p>
92
+ <?php endif; ?>
93
+ </div>
94
+ </div>
95
+ </td>
96
  <?php
97
  }
98
 
101
  $location = add_query_arg( array(
102
  'tab' => 'shipping',
103
  'page' => 'wpsc-settings',
104
+ 'shipping_module_id' => $shipping->internal_name,
105
  ), $location );
106
  $location .= '#wpsc-shipping-module-options';
107
+ return esc_url( $location );
108
  }
109
 
110
  public function display() {
115
  if ( empty( $module ) )
116
  continue;
117
 
118
+ if ( isset( $module->is_external ) && $module->is_external )
119
  $external_shipping_modules[$key] = $module;
120
+ else
121
  $internal_shipping_modules[$key] = $module;
 
122
  }
123
 
124
+ $currency_data = $wpdb->get_row( $wpdb->prepare( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id` = %d LIMIT 1", get_option( 'currency_type' ) ), ARRAY_A );
125
+ if ( $currency_data['symbol'] != '' ) {
126
+ $currency_sign = $currency_data['symbol_html'];
127
+ } else {
128
+ $currency_sign = $currency_data['code'];
129
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  //get shipping options that are selected
131
  $selected_shippings = get_option( 'custom_shipping_options' );
132
+ ?>
133
+ <div class="metabox-holder">
134
+ <input type='hidden' name='shipping_submits' value='true' />
135
+ <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
136
+ <input type='hidden' name='wpsc_admin_action' value='submit_options' />
137
 
138
+ <?php
 
 
 
139
 
140
+ if ( get_option( 'custom_gateway' ) == 1 ) {
141
+ $custom_gateway_hide = "style='display:block;'";
142
+ $custom_gateway1 = 'checked="checked"';
143
+ } else {
144
+ $custom_gateway_hide = "style='display:none;'";
145
+ $custom_gateway2 = 'checked="checked"';
146
+ }
147
+ /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
148
+ wpsc_settings_page_update_notification(); ?>
149
+ <div class='postbox'>
150
+ <h3 class='hndle'><?php esc_html_e( 'General Settings', 'wpsc' ); ?></h3>
151
+ <div class='inside'>
152
+
153
+ <table class='wpsc_options form-table'>
154
+ <tr>
155
+ <th scope="row">
156
+ <?php _e( 'Use Shipping', 'wpsc' ); ?>:
157
+ </th>
158
+ <td>
159
+ <?php
160
+ $do_not_use_shipping = get_option( 'do_not_use_shipping' );
161
+ $do_not_use_shipping1 = "";
162
+ $do_not_use_shipping2 = "";
163
+ if( $do_not_use_shipping )
164
+ $do_not_use_shipping1 = "checked ='checked'";
165
+ else
166
+ $do_not_use_shipping2 = "checked ='checked'";
167
+ ?>
168
+ <input type='radio' value='0' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping2' <?php echo $do_not_use_shipping2; ?> /> <label for='do_not_use_shipping2'><?php _e( 'Yes', 'wpsc' ); ?></label>&nbsp;
169
+ <input type='radio' value='1' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping1' <?php echo $do_not_use_shipping1; ?> /> <label for='do_not_use_shipping1'><?php _e( 'No', 'wpsc' ); ?></label><br />
170
+ <?php esc_html_e( 'If you are only selling digital downloads, you should select no to disable the shipping on your site.', 'wpsc' ); ?>
171
+ </td>
172
+ </tr>
173
+
174
+ <tr>
175
+ <th><?php esc_html_e( 'Base City:', 'wpsc' ); ?></th>
176
+ <td>
177
+ <input type='text' name='wpsc_options[base_city]' value='<?php esc_attr_e( get_option( 'base_city' ) ); ?>' />
178
+ <br /><?php esc_html_e( 'Please provide for more accurate rates', 'wpsc' ); ?>
179
+ </td>
180
+ </tr>
181
+ <tr>
182
+ <th><?php esc_html_e( 'Base Zipcode/Postcode:', 'wpsc' ); ?></th>
183
+ <td>
184
+ <input type='text' name='wpsc_options[base_zipcode]' value='<?php esc_attr_e( get_option( 'base_zipcode' ) ); ?>' />
185
+ <br /><?php esc_html_e( 'If you are based in America then you need to set your own Zipcode for UPS and USPS to work. This should be the Zipcode for your Base of Operations.', 'wpsc' ); ?>
186
+ </td>
187
+ </tr>
188
+ <tr>
189
+ <th scope="row">
190
+ <?php _e( 'Shipwire Settings', 'wpsc' ); ?><span style='color: red;'></span> :
191
+ </th>
192
+ <?php
193
+ switch ( get_option( 'shipwire' ) ) {
194
+ case 1:
195
+ $shipwire_settings = 'style=\'display: block;\'';
196
+ break;
197
+
198
+ case 0:
199
+ default:
200
+ $shipwire_settings = '';
201
+ break;
202
+ }
203
+ ?>
204
+ <td>
205
+ <input type='radio' onclick='jQuery("#wpsc_shipwire_setting").show()' value='1' name='wpsc_options[shipwire]' id='shipwire1' <?php checked( '1', get_option( 'shipwire' ) ); ?> /> <label for='shipwire1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
206
+ <input type='radio' onclick='jQuery("#wpsc_shipwire_setting").hide()' value='0' name='wpsc_options[shipwire]' id='shipwire2' <?php checked( '0', get_option( 'shipwire' ) ); ?> /> <label for='shipwire2'><?php _e( 'No', 'wpsc' ); ?></label>
207
+ <div id='wpsc_shipwire_setting' <?php echo $shipwire_settings; ?>>
208
+ <table>
209
+ <tr><td><?php esc_html_e( 'Shipwire Email', 'wpsc' ); ?> :</td><td> <input type="text" name='wpsc_options[shipwireemail]' value="<?php esc_attr_e( get_option( 'shipwireemail' ) ); ?>" /></td></tr>
210
+ <tr><td><?php esc_html_e( 'Shipwire Password', 'wpsc' ); ?> :</td><td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php esc_attr_e( get_option( 'shipwirepassword' ) ); ?>" /></td></tr>
211
+ <tr><td>
212
+ <a class="shipwire_sync button"><?php esc_html_e( 'Update Tracking and Inventory', 'wpsc' ); ?></a>
213
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
214
+ </td></tr>
215
+ </table>
216
+ </div>
217
+ </td>
218
+ </tr>
219
+ <tr>
220
+ <th scope="row">
221
+ <?php _e( 'Enable Free Shipping Discount', 'wpsc' ); ?>
222
+ </th>
223
+ <td>
224
+ <?php
225
+ if ( get_option( 'shipping_discount' ) == 1 ) {
226
+ $selected2 = '';
227
+ $selected1 = 'checked="checked"';
228
+ $shipping_discount_settings = 'style=\'display: block;\'';
229
+ } else {
230
+ $selected2 = 'checked="checked"';
231
+ $selected1 = '';
232
+ $shipping_discount_settings = '';
233
+ }
234
+ ?>
235
+ <input type='radio' onclick='jQuery("#shipping_discount_value").show()' value='1' name='wpsc_options[shipping_discount]' id='shipping_discount1' <?php echo $selected1; ?> /> <label for='shipping_discount1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
236
+ <input type='radio' onclick='jQuery("#shipping_discount_value").hide()' value='0' name='wpsc_options[shipping_discount]' id='shipping_discount2' <?php echo $selected2; ?> /> <label for='shipping_discount2'><?php _e( 'No', 'wpsc' ); ?></label>
237
+
238
+ </td>
239
+ </tr>
240
+ <tr>
241
+ <td>&nbsp;</td>
242
+ <td colspan="2">
243
+ <?php
244
+ $value = esc_attr( get_option( 'shipping_discount_value' ) );
245
+ ?>
246
+ <div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
247
+
248
+ <?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, $value ); ?>
249
+ </div>
250
+ </td>
251
+ </tr>
252
+ </table>
253
+ </div>
254
+ </div>
255
+ <table id='wpsc-shipping-module-options' class='wpsc-edit-module-options'>
256
+ <tr>
257
+ <td class='select_gateway'>
258
+ <a name="gateway_options"></a>
259
+ <div class='postbox'>
260
+ <h3 class='hndle'><?php _e( 'Shipping Modules', 'wpsc' ) ?></h3>
261
+ <div class='inside'>
262
+
263
+ <p>
264
+ <?php _e( 'To enable shipping in WP e-Commerce you must select which shipping methods you want to enable on your site.<br /> If you want to use fixed-price shipping options like "Pickup - $0, Overnight - $10, Same day - $20, etc." you can download a WordPress plugin from plugins directory for <a href="http://wordpress.org/extend/plugins/wp-e-commerce-fixed-rate-shipping/">Simple shipping</a>. It will appear in the list as "Fixed rate".', 'wpsc' ); ?>
265
+ </p>
266
+ <br />
267
+ <p>
268
+ <strong><?php _e( 'Internal Shipping Calculators', 'wpsc' ); ?></strong>
269
+ </p>
270
+ <?php
271
+ foreach ( $internal_shipping_modules as $shipping ) {
272
+
273
+ $shipping->checked = '';
274
+ if ( is_object( $shipping ) && in_array( $shipping->getInternalName(), (array)$selected_shippings ) )
275
+ $shipping->checked = ' checked = "checked" ';
276
+ ?>
277
+
278
+ <div class='wpsc_shipping_options'>
279
+ <div class='wpsc-shipping-actions'>
280
+ <span class="edit">
281
+ <a class='edit-shipping-module' data-module-id="<?php echo $shipping->internal_name; ?>" title="<?php esc_attr_e( 'Edit this Shipping Module', 'wpsc' ); ?>" href='<?php echo esc_url( $this->get_shipping_module_url( $shipping ) ); ?>' style="cursor:pointer;"><?php _ex( 'Edit', 'Shipping modules link to individual settings', 'wpsc' ); ?></a>
282
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
283
+ </span>
284
+ </div>
285
+
286
+ <p><input name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'> <?php echo $shipping->name; ?></label></p>
287
+ </div>
288
+ <?php } ?>
289
+ <br />
290
+ <p>
291
+ <strong><?php _e( 'External Shipping Calculators', 'wpsc' ); ?></strong>
292
+ <?php if ( ! function_exists( 'curl_init' ) ) {
293
+ ?>
294
+ <br /><span style='color: red; font-size:8pt; line-height:10pt;'><?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' ); ?></span>
295
+ <?php } ?>
296
+ </p>
297
+ <?php
298
+ // print the internal shipping methods
299
+ foreach ( $external_shipping_modules as $shipping ) {
300
+ $disabled = '';
301
+ if ( isset( $shipping->requires_curl ) && $shipping->requires_curl && ! function_exists( 'curl_init' ) ) {
302
+ $disabled = "disabled='disabled'";
303
+ }
304
+ $shipping->checked = '';
305
+ if ( in_array( $shipping->getInternalName(), (array)$selected_shippings ) )
306
+ $shipping->checked = " checked='checked' ";
307
+ ?>
308
+ <div class='wpsc_shipping_options'>
309
+ <div class="wpsc-shipping-actions">
310
+ <span class="edit">
311
+ <a class='edit-shipping-module' data-module-id="<?php echo $shipping->internal_name; ?>" title="<?php esc_attr_e( 'Edit this Shipping Module', 'wpsc' ); ?>" href='<?php echo esc_url( $this->get_shipping_module_url( $shipping ) ); ?>' style="cursor:pointer;"><?php _ex( 'Edit', 'Shipping modules link to individual settings', 'wpsc' ); ?></a>
312
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
313
+ </span>
314
+ </div>
315
+ <p><input <?php echo $disabled; ?> name='custom_shipping_options[]' <?php echo $shipping->checked; ?> type='checkbox' value='<?php echo $shipping->internal_name; ?>' id='<?php echo $shipping->internal_name; ?>_id' /><label for='<?php echo $shipping->internal_name; ?>_id'> <?php echo $shipping->name; ?></label></p>
316
+ </div>
317
+ <?php } ?>
318
+ <p class="submit">
319
+ <input type='hidden' value='true' name='update_gateways' />
320
+ <input type="submit" value="<?php _e( 'Update &raquo;', 'wpsc' ); ?>" />
321
+ </p>
322
+ </div>
323
+ </div>
324
+ </td>
325
+
326
+ <?php $this->display_shipping_module_settings_form(); ?>
327
+ </tr>
328
+ </table>
329
+ </div>
330
  <?php
331
  }
332
+ }
wpsc-admin/includes/settings-tabs/taxes.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
- class WPSC_Settings_Tab_Taxes extends WPSC_Settings_Tab {
 
4
  public function __construct() {
5
  }
6
 
@@ -74,148 +75,174 @@ class WPSC_Settings_Tab_Taxes extends WPSC_Settings_Tab {
74
  $wpec_taxes_controller = new wpec_taxes_controller;
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
124
- $checked = ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'billing_address' ? 'checked="checked"' : '' );
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  $tax_rates = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_rates();
163
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'rates', 'prototype', array( 'row_class' => 'prototype' ) );
164
- if ( count( $tax_rates ) === 0 ) {
165
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'rates', 0, null );
166
- }
167
  $tax_rate_count = 0;
168
- if ( ! empty( $tax_rates ) ) {
169
  foreach ( $tax_rates as $tax_rate ) {
170
- // OLD: echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_rate_count, $tax_rate );
171
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'rates', $tax_rate_count, $tax_rate );
172
  $tax_rate_count++;
173
- }
174
- }
175
- ?>
176
- </tbody>
177
- </table>
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
200
- $tax_bands = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_bands();
201
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'bands', 'prototype', array( 'row_class' => 'prototype' ) );
202
- if ( count( $tax_bands ) === 0 ) {
203
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'bands', 0, null );
204
- }
205
- $tax_band_count = 0;
206
- if ( ! empty( $tax_bands ) ) {
207
- foreach ( $tax_bands as $tax_band ) {
208
- // OLD: echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_band_count, $tax_band, 'bands' );
209
- echo $wpec_taxes_controller->wpsc_build_taxes_row( 'bands', $tax_band_count, $tax_band );
210
- $tax_band_count++;
211
- }
212
- }
213
- ?>
214
-
215
- </tbody>
216
- </table>
217
- </div>
218
- </div><!--wpec-taxes-bands-container-->
219
  <?php
220
  }
221
  }
1
  <?php
2
 
3
+ class WPSC_Settings_Tab_Taxes extends WPSC_Settings_Tab
4
+ {
5
  public function __construct() {
6
  }
7
 
75
  $wpec_taxes_controller = new wpec_taxes_controller;
76
  $wpec_taxes_options = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_options();
77
 
78
+ ?>
79
+ <h3><?php esc_html_e( 'Tax Settings', 'wpsc' ); ?></h3>
80
+ <p>
 
 
 
 
81
  <label for='wpec_taxes_enabled'>
82
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_enabled'] ) {
83
+ echo 'checked="checked"';
84
+ } ?> type="checkbox" id='wpec_taxes_enabled' name='wpsc_options[wpec_taxes_enabled]' />
85
+ <?php esc_html_e( 'Turn tax on', 'wpsc' ); ?>
86
+ </label>
87
+ </p>
88
+ <p>
89
+ <label for='wpec_taxes_inprice1'>
90
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'exclusive' ) {
91
+ echo 'checked="checked"';
92
+ } ?> type="radio" value='exclusive' id='wpec_taxes_inprice1' name='wpsc_options[wpec_taxes_inprice]' />
93
+ <?php esc_html_e( 'Product prices are tax exclusive - add tax to the price during checkout', 'wpsc' ); ?>
94
+ </label>
95
+ </p>
96
+ <p>
97
+ <label for='wpec_taxes_inprice2'>
98
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_inprice'] == 'inclusive' ) {
99
+ echo 'checked="checked"';
100
+ } ?> type="radio" value='inclusive' id='wpec_taxes_inprice2' name='wpsc_options[wpec_taxes_inprice]' />
101
+ <?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' ); ?>
102
+ </label>
103
+ </p>
104
+ <h4><?php esc_html_e( 'Product Specific Tax', 'wpsc' ); ?></h4>
105
+ <p>
106
+ <label for='wpec_taxes_product_1'>
107
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'add' ) {
108
+ echo 'checked="checked"';
109
+ } ?> type="radio" value='add' id='wpec_taxes_product_1' name='wpsc_options[wpec_taxes_product]' />
110
+ <?php esc_html_e( 'Add per product tax to tax percentage if product has a specific tax rate', 'wpsc' ); ?>
111
+ </label>
112
+ </p>
113
+ <p>
114
+ <label for='wpec_taxes_product_2'>
115
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_product'] == 'replace' ) {
116
+ echo 'checked="checked"';
117
+ } ?> type="radio" value='replace' id='wpec_taxes_product_2' name='wpsc_options[wpec_taxes_product]' />
118
+ <?php esc_html_e( 'Replace tax percentage with product specific tax rate', 'wpsc' ); ?>
119
+ </label>
120
+ </p>
121
+
122
+ <h4><?php _e( 'Tax Logic', 'wpsc' ); ?></h4>
123
+ <p>
124
+ <label for='wpec_taxes_logic_1'>
125
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' ) {
126
+ echo 'checked="checked"';
127
+ } ?> type="radio" value='billing_shipping' id='wpec_taxes_logic_1' name='wpsc_options[wpec_taxes_logic]' />
128
+ <?php esc_html_e( 'Apply tax when Billing and Shipping Country is the same as Tax Rate', 'wpsc' ); ?>
129
+ </label>
130
+ <div id='billing_shipping_preference_container' style='margin-left: 20px;'>
131
+ <p>
132
+ <label for='wpec_billing_preference'>
133
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'billing_address' ) {
134
+ echo 'checked="checked"';
135
+ } ?> type="radio" value='billing_address' id='wpec_billing_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
136
+ <?php esc_html_e( 'Apply tax to Billing Address', 'wpsc' ); ?>
137
+ </label>
138
+ </p>
139
+ <p>
140
  <label for='wpec_shipping_preference'>
141
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing_shipping' && $wpec_taxes_options['wpec_billing_shipping_preference'] == 'shipping_address' ) {
142
+ echo 'checked="checked"';
143
+ } ?> type="radio" value='shipping_address' id='wpec_shipping_preference' name='wpsc_options[wpec_billing_shipping_preference]' />
144
+ <?php esc_html_e( 'Apply tax to Shipping Address', 'wpsc' ); ?>
145
  </label>
146
+ </p>
147
+ </div>
148
+ </p>
149
+ <p>
150
  <label for='wpec_taxes_logic_2'>
151
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'billing' ) {
152
+ echo 'checked="checked"';
153
+ } ?> type="radio" value='billing' id='wpec_taxes_logic_2' name='wpsc_options[wpec_taxes_logic]' />
154
+ <?php esc_html_e( 'Apply tax when Billing Country is the same as Tax Rate', 'wpsc' ); ?>
155
+ </label>
156
+ </p>
157
+ <p>
158
+ <label for='wpec_taxes_logic_3'>
159
+ <input <?php if ( $wpec_taxes_options['wpec_taxes_logic'] == 'shipping' ) {
160
+ echo 'checked="checked"';
161
+ } ?> type="radio" value='shipping' id='wpec_taxes_logic_3' name='wpsc_options[wpec_taxes_logic]' />
162
+ <?php esc_html_e( 'Apply tax when Shipping Country is the same as Tax Rate', 'wpsc' ); ?>
163
+ </label>
164
+ </p>
165
+ <div id='metabox-holder' class="metabox-holder">
166
+ <div id='wpec-taxes-rates-container' class='postbox'>
167
+ <h3 class='hndle' style='cursor: default'><?php esc_html_e( 'Tax Rates', 'wpsc' ); ?></h3>
168
+ <div id='wpec-taxes-rates' class='inside'>
169
+ <!--Start Taxes Output-->
170
+ <?php
171
+ /**
172
+ * Add New Tax Rate - should add another paragraph with the
173
+ * another key specified for the input array
174
+ * Delete - Should remove the given paragraph from the page
175
+ * and either ajax delete it from the DB or mark it for
176
+ * deletion and process it after the changes are made.
177
+ * Selecting a Country - should automatically populate the
178
+ * regions select box. Selecting a different country should
179
+ * remove the region select box. If the user selects a
180
+ * different country with regions it shouldn't matter because
181
+ * the code should automatically add the region select in.
182
+ * - Allow users to define tax for entire country even if regions exist.
183
+ * Shipping Tax - needs to be per region or per tax rate.
184
+ * Remove the setting from the main Tax Settings area.
185
+ * Constraints -
186
+ * 1. Should not allow a user to add more than one
187
+ * tax rate for the same area.
188
+ * 2. If a country tax rate is specified and then a region tax
189
+ * rate, the region tax rate takes precedence.
190
+ * */
191
+
192
+ /**
193
+ * Removed Shipping Restriction on Included tax - 01-20-2011
194
+ * //if tax is included warn about shipping
195
+ * if ( $wpec_taxes_controller->wpec_taxes_isincluded() ) {
196
+ * echo '<p>' . __( 'Note: Tax is not applied to shipping when product prices are tax inclusive.' ) . '</p>';
197
+ * }// if
198
+ **/
199
+
200
+ //get current tax rates
201
+ // TODO: Refactor to get rid of the need for wpec_taxes_build_form(). It's a horribly written function.
202
  $tax_rates = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_rates();
 
 
 
 
203
  $tax_rate_count = 0;
204
+ if ( !empty( $tax_rates ) ) {
205
  foreach ( $tax_rates as $tax_rate ) {
206
+ echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_rate_count, $tax_rate );
 
207
  $tax_rate_count++;
208
+ }// foreach
209
+ }// if
210
+ ?>
211
+ <!--End Taxes Output-->
212
+ <p id="wpsc-add-tax-rates">
213
+ <a href="#"><?php esc_html_e( 'Add New Tax Rate', 'wpsc' ); ?></a>
214
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
215
+ </p>
 
 
 
 
 
 
 
 
216
  </div>
217
+ </div>
218
+ <div id='wpec-taxes-bands-container' class='postbox'>
219
+ <h3 class='hndle' style='cursor: default'><?php esc_html_e( 'Tax Bands', 'wpsc' ); ?></h3>
220
+ <div id='wpec-taxes-bands' class='inside'>
221
+
222
+ <?php
223
+ echo '<p>' . __( 'Note: Tax Bands are special tax rules you can create and apply on a per-product basis. <br /> Please visit the product page to apply your Tax Band.', 'wpsc' ) . '</p>';
224
+
225
+ //echo message regarding inclusive tax
226
+ if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) {
227
+ echo '<p>' . __( 'Note: Tax Bands do not take affect when product prices are tax exclusive.', 'wpsc' ) . '</p>';
228
+ }// if
229
+
230
+ $tax_bands = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_bands();
231
+ $tax_band_count = 0;
232
+ if ( !empty( $tax_bands ) ) {
233
+ foreach ( $tax_bands as $tax_band ) {
234
+ echo $wpec_taxes_controller->wpec_taxes_build_form( $tax_band_count, $tax_band, 'bands' );
235
+ $tax_band_count++;
236
+ }// foreach
237
+ }// if
238
+ ?>
239
+ <p id="wpsc-add-tax-bands">
240
+ <a href="#"><?php _e( 'Add New Tax Band', 'wpsc' ); ?></a>
241
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
242
+ </p>
243
+ </div>
244
+ </div><!--wpec-taxes-bands-container-->
245
+ </div><!--metabox-holder-->
246
  <?php
247
  }
248
  }
wpsc-admin/includes/tax_and_shipping.php CHANGED
@@ -1,10 +1,4 @@
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' );
@@ -63,4 +57,4 @@ $base_region = get_option('base_region');
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
  global $wpdb;
3
  $changes_made = false;
4
  $country_isocode = preg_match( "/[a-zA-Z]{2,4}/", $_GET['isocode'] ) ? $_GET['isocode'] : get_option( 'base_country' );
57
  <input type='hidden' name='wpsc_admin_action' value='change_region_tax' />
58
  <input class='button-secondary' type='submit' name='submit' value='<?php esc_attr_e( 'Save Changes', 'wpsc' );?>' />
59
  </form>
60
+ </div>
wpsc-admin/includes/updating-functions.php CHANGED
@@ -6,7 +6,8 @@
6
  * @since 3.8
7
  */
8
 
9
- class WPSC_Update {
 
10
  private static $instance;
11
  private $timeout;
12
  private $script_start;
@@ -46,7 +47,7 @@ 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 = apply_filters( 'wpsc_update_terminate_location', $location );
50
  ?>
51
  <script type="text/javascript">
52
  location.href = "<?php echo $location; ?>"
@@ -57,20 +58,19 @@ class WPSC_Update {
57
  }
58
 
59
  public function run( $function, $message = '' ) {
60
-
61
- if ( $message ) {
62
  echo "<p>{$message}</p>";
63
- }
64
 
65
  if ( empty( $this->stages[$function] ) ) {
66
  call_user_func( 'wpsc_' . $function );
67
- $this->stages[ $function ] = true;
68
- set_transient( 'wpsc_update_progress', $this->stages, WEEK_IN_SECONDS );
69
  }
70
  }
71
  }
72
 
73
- class WPSC_Update_Progress {
 
74
  private $milestone;
75
  private $start;
76
  private $count;
@@ -113,13 +113,12 @@ class WPSC_Update_Progress {
113
  $location = add_query_arg( 'eta', $this->eta, $location );
114
  else
115
  $location = remove_query_arg( 'eta', $location );
116
- return $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
@@ -183,8 +182,7 @@ 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
@@ -425,7 +423,7 @@ function wpsc_convert_products_to_posts() {
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
 
430
  $product_post_values['menu_order'] = $product['order'];
431
 
@@ -446,7 +444,7 @@ function wpsc_convert_products_to_posts() {
446
  WHERE `product_id` = %d
447
  AND `meta_value` != ''", $product['id'] );
448
 
449
- $product_meta = $wpdb->get_results( $product_meta_sql, ARRAY_A );
450
 
451
  $post_data = array();
452
 
@@ -732,7 +730,7 @@ function wpsc_convert_variation_combinations() {
732
  $post_data['_wpsc_product_metadata']['display_weight_as'] = $variation_item->weight_unit;
733
  $post_data['_wpsc_product_metadata']['weight_unit'] = $variation_item->weight_unit;
734
 
735
- // Parts of the code (eg wpsc_product_variation_price_from() make the assumption that these meta keys exist
736
  $post_data['_wpsc_special_price'] = 0;
737
  $post_data['_wpsc_sku'] = '';
738
 
@@ -865,8 +863,8 @@ function wpsc_update_database() {
865
  $has_taxes = ($value["Field"] == "wpec_taxes_total" || $value["Field"] == "wpec_taxes_rate") ? true: false;
866
  }
867
  if (!$has_taxes) {
868
- $add_fields = $wpdb->query( "ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_total decimal(11,2)" );
869
- $add_fields = $wpdb->query( "ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_rate decimal(11,2)" );
870
  }
871
  }
872
  /*
6
  * @since 3.8
7
  */
8
 
9
+ class WPSC_Update
10
+ {
11
  private static $instance;
12
  private $timeout;
13
  private $script_start;
47
  do_action( 'wpsc_update_timeout_terminate' );
48
  $location = remove_query_arg( array( 'start_over', 'eta', 'current_percent' ) );
49
  $location = add_query_arg( 'run_updates', 1, $location );
50
+ $location = esc_url( apply_filters( 'wpsc_update_terminate_location', $location ) );
51
  ?>
52
  <script type="text/javascript">
53
  location.href = "<?php echo $location; ?>"
58
  }
59
 
60
  public function run( $function, $message = '' ) {
61
+ if ( $message )
 
62
  echo "<p>{$message}</p>";
 
63
 
64
  if ( empty( $this->stages[$function] ) ) {
65
  call_user_func( 'wpsc_' . $function );
66
+ $this->stages[$function] = true;
67
+ set_transient( 'wpsc_update_progress', $this->stages, 604800 );
68
  }
69
  }
70
  }
71
 
72
+ class WPSC_Update_Progress
73
+ {
74
  private $milestone;
75
  private $start;
76
  private $count;
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
  if ( $this->eta == 0 )
123
  _e( 'Under a minute', 'wpsc' );
124
  else
182
  $processed = $i - $count + 1;
183
  $eta = floor( ( $total - $i ) * ( $now - $start ) / ( $processed * 60 ) );
184
  echo '<div class="eta">';
185
+ _e( 'Estimated time left:', 'wpsc' ) . ' ';
 
186
  if ( $eta == 0 )
187
  _e( 'Under a minute', 'wpsc' );
188
  else
423
  $product['order'] = $wpdb->get_var( $wpdb->prepare( "
424
  SELECT order FROM " . WPSC_TABLE_PRODUCT_ORDER . "
425
  WHERE product_id = %d
426
+ " ), $product['id'] );
427
 
428
  $product_post_values['menu_order'] = $product['order'];
429
 
444
  WHERE `product_id` = %d
445
  AND `meta_value` != ''", $product['id'] );
446
 
447
+ $product_meta = $wpdb->get_results( $product_meta_sql, ARRAY_A);
448
 
449
  $post_data = array();
450
 
730
  $post_data['_wpsc_product_metadata']['display_weight_as'] = $variation_item->weight_unit;
731
  $post_data['_wpsc_product_metadata']['weight_unit'] = $variation_item->weight_unit;
732
 
733
+ // Parts of the code (eg wpsc_product_variation_price_available() make the assumption that these meta keys exist
734
  $post_data['_wpsc_special_price'] = 0;
735
  $post_data['_wpsc_sku'] = '';
736
 
863
  $has_taxes = ($value["Field"] == "wpec_taxes_total" || $value["Field"] == "wpec_taxes_rate") ? true: false;
864
  }
865
  if (!$has_taxes) {
866
+ $add_fields = $wpdb->query($wpdb->prepare("ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_total decimal(11,2)"));
867
+ $add_fields = $wpdb->query($wpdb->prepare("ALTER TABLE ".WPSC_TABLE_PURCHASE_LOGS." ADD wpec_taxes_rate decimal(11,2)"));
868
  }
869
  }
870
  /*
wpsc-admin/includes/walker-variation-checklist.php CHANGED
@@ -10,28 +10,20 @@ class WPSC_Walker_Variation_Checklist extends Walker_Category_Checklist {
10
  $this->highlighted = $highlighted;
11
  }
12
 
13
- public function start_el( &$output, $category, $depth = 0, $args = array(), $current_object_id = 0 ) {
14
- extract( $args );
15
-
16
- if ( empty( $taxonomy ) ) {
17
  $taxonomy = 'category';
18
- }
19
-
20
- if ( empty( $selected_cats ) ) {
21
- $selected_cats = array();
22
- }
23
 
24
- $checked = in_array( $category->term_id, $selected_cats );
25
  $input_class = ( $depth === 0 ) ? ' class="variation-set"' : '';
26
- $li_classes = array( 'wpsc-variation-checklist-item' );
27
-
28
  if ( $depth === 0 && wpsc_is_doing_ajax( 'add_variation_set' ) ) {
29
  $li_classes[] = 'ajax';
30
  $li_classes[] = 'expanded';
31
  } elseif ( in_array( $category->term_id, $this->highlighted ) ) {
32
  $li_classes[] = 'ajax';
33
  }
34
-
35
  ob_start();
36
  ?>
37
  <li id="<?php echo esc_attr( $taxonomy ); ?>-<?php echo $category->term_id; ?>" class="<?php echo implode( ' ', $li_classes ); ?>">
@@ -49,7 +41,7 @@ class WPSC_Walker_Variation_Checklist extends Walker_Category_Checklist {
49
  id="in-<?php echo esc_attr( $taxonomy ) . '-' . $category->term_id; ?>"
50
  <?php checked( $checked, true ); disabled( empty( $args['disabled'] ), false ); ?>
51
  />
52
- <?php echo esc_html( apply_filters( 'wpsc_variation_name', $category->name, $category ) ); ?>
53
  </label>
54
  <?php
55
  $output .= ob_get_clean();
10
  $this->highlighted = $highlighted;
11
  }
12
 
13
+ public function start_el(&$output, $category, $depth, $args) {
14
+ extract($args);
15
+ if ( empty($taxonomy) )
 
16
  $taxonomy = 'category';
 
 
 
 
 
17
 
18
+ $checked = in_array( $category->term_id, $selected_cats );
19
  $input_class = ( $depth === 0 ) ? ' class="variation-set"' : '';
20
+ $li_classes = array( 'wpsc-variation-checklist-item' );
 
21
  if ( $depth === 0 && wpsc_is_doing_ajax( 'add_variation_set' ) ) {
22
  $li_classes[] = 'ajax';
23
  $li_classes[] = 'expanded';
24
  } elseif ( in_array( $category->term_id, $this->highlighted ) ) {
25
  $li_classes[] = 'ajax';
26
  }
 
27
  ob_start();
28
  ?>
29
  <li id="<?php echo esc_attr( $taxonomy ); ?>-<?php echo $category->term_id; ?>" class="<?php echo implode( ' ', $li_classes ); ?>">
41
  id="in-<?php echo esc_attr( $taxonomy ) . '-' . $category->term_id; ?>"
42
  <?php checked( $checked, true ); disabled( empty( $args['disabled'] ), false ); ?>
43
  />
44
+ <?php echo esc_html( $category->name ); ?>
45
  </label>
46
  <?php
47
  $output .= ob_get_clean();
wpsc-admin/init.php CHANGED
@@ -1,11 +1,7 @@
1
  <?php
2
- function wpsc_ajax_sales_quarterly() {
3
-
4
- if ( ! wpsc_is_store_admin() ) {
5
- return;
6
- }
7
 
8
- $lastdate = sanitize_text_field( $_POST['add_start'] );
 
9
  $date = preg_split( '/-/', $lastdate );
10
  if ( !isset( $date[0] ) )
11
  $date[0] = 0;
@@ -33,7 +29,7 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action']
33
 
34
  function wpsc_delete_file() {
35
  $product_id = absint( $_REQUEST['product_id'] );
36
- $file_name = basename( $_REQUEST['file_name'] );
37
  check_admin_referer( 'delete_file_' . $file_name );
38
 
39
  _wpsc_delete_file( $product_id, $file_name );
@@ -70,10 +66,6 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action']
70
  */
71
  function wpsc_duplicate_product() {
72
 
73
- if ( ! wpsc_is_store_admin() ) {
74
- return;
75
- }
76
-
77
  // Get the original post
78
  $id = absint( $_GET['product'] );
79
  $post = get_post( $id );
@@ -84,7 +76,7 @@ function wpsc_duplicate_product() {
84
 
85
  $duplicated = true;
86
  $sendback = wp_get_referer();
87
- $sendback = add_query_arg( 'duplicated', (int) $duplicated, $sendback );
88
 
89
  wp_redirect( $sendback );
90
  exit();
@@ -97,19 +89,13 @@ if ( isset( $_GET['wpsc_admin_action'] ) && ( $_GET['wpsc_admin_action'] == 'dup
97
  add_action( 'admin_init', 'wpsc_duplicate_product' );
98
 
99
  function wpsc_purchase_log_csv() {
100
-
101
- if ( ! wpsc_is_store_admin() ) {
102
- return;
103
- }
104
-
105
  global $wpdb, $wpsc_gateways;
106
  get_currentuserinfo();
107
  $count = 0;
108
-
109
- if ( 'key' == $_REQUEST['rss_key'] ) {
110
  if ( isset( $_REQUEST['start_timestamp'] ) && isset( $_REQUEST['end_timestamp'] ) ) {
111
  $start_timestamp = $_REQUEST['start_timestamp'];
112
- $end_timestamp = $_REQUEST['end_timestamp'];
113
  $start_end_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` BETWEEN '%d' AND '%d' ORDER BY `date` DESC";
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 );
@@ -138,42 +124,32 @@ function wpsc_purchase_log_csv() {
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
 
153
  $output = '';
154
 
155
- foreach ( (array) $form_data as $form_field ) {
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
- }
163
-
164
- foreach ( (array) $data as $purchase ) {
165
  $form_headers = '';
166
  $output .= "\"" . $purchase['id'] . "\","; //Purchase ID
167
  $output .= "\"" . $purchase['totalprice'] . "\","; //Purchase Total
168
- foreach ( (array) $form_data as $form_field ) {
169
- $collected_data_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` = '" . $purchase['id'] . "' AND `form_id` = '" . $form_field['id'] . "' LIMIT 1";
 
170
  $collected_data = $wpdb->get_results( $collected_data_sql, ARRAY_A );
171
  $collected_data = $collected_data[0];
172
-
173
- if ( ( 'billingstate' == $form_field['unique_name'] || 'shippingstate' == $form_field['unique_name'] ) && is_numeric( $collected_data['value'] ) )
174
- $output .= "\"" . wpsc_get_state_by_id( $collected_data['value'], 'code' ) . "\","; // get form fields
175
- else
176
- $output .= "\"" . str_replace( array( "\r", "\r\n", "\n" ), ' ', $collected_data['value'] ) . "\","; // get form fields
177
  }
178
 
179
  if ( isset( $wpsc_gateways[$purchase['gateway']] ) && isset( $wpsc_gateways[$purchase['gateway']]['display_name'] ) )
@@ -190,50 +166,34 @@ function wpsc_purchase_log_csv() {
190
  $cartsql = "SELECT `prodid`, `quantity`, `name` FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase['id'] . "";
191
  $cart = $wpdb->get_results( $cartsql, ARRAY_A );
192
 
193
- if ( $count < count( $cart ) )
194
  $count = count( $cart );
195
-
196
- $items = count( $cart );
197
- $i = 1;
198
-
199
  // Go through all products in cart and display quantity and sku
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
-
207
- if ( $items <= 1 )
208
- $output .= "\"" . $skuvalue . "\"" ;
209
- elseif ( $items > 1 && $i != $items )
210
- $output .= "\"" . $skuvalue . "\"," ;
211
- else
212
- $output .= "\"" . $skuvalue . "\"" ;
213
-
214
- $i++;
215
  }
216
-
217
  $output .= "\n"; // terminates the row/line in the CSV file
218
  }
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 ) . '",';
228
- $form_headers = '"' . implode( '","', $form_headers_array ) . '",';
229
- $headers2 = '"' . implode( '","', $headers2_array ) . '",';
230
- $headers3 = '"' . implode( '","', $headers3 ) . '"';
231
 
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' );
238
  header( 'Content-Disposition: inline; filename="' . $csv_name . '"' );
239
  echo $headers . "\n". $output;
@@ -249,11 +209,6 @@ if ( isset( $_GET['purchase_log_csv'] ) && ( 'true' == $_GET['purchase_log_csv']
249
  add_action( 'admin_init', 'wpsc_purchase_log_csv' );
250
 
251
  function wpsc_admin_sale_rss() {
252
-
253
- if ( ! wpsc_is_store_admin() ) {
254
- return;
255
- }
256
-
257
  global $wpdb;
258
  if ( ($_GET['rss'] == "true") && ($_GET['rss_key'] == 'key') && ($_GET['action'] == "purchase_log") ) {
259
  $sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date`!='' ORDER BY `date` DESC";
@@ -264,13 +219,13 @@ 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";
@@ -288,212 +243,89 @@ function wpsc_admin_sale_rss() {
288
  }
289
  }
290
 
291
- if ( isset( $_GET['action'] ) && ( 'purchase_log' == $_GET['action'] ) ) {
292
  add_action( 'admin_init', 'wpsc_admin_sale_rss' );
293
- }
294
-
295
- /**
296
- * Do Purchase Log Actions
297
- *
298
- * All purchase log actions are capability and nonce checked before calling
299
- * the relevent 'wpsc_purchase_log_action-{wpsc_purchase_log_action}' hook.
300
- *
301
- * @since 3.9.0
302
- */
303
- function wpsc_do_purchase_log_actions() {
304
-
305
- if ( ! wpsc_is_store_admin() ) {
306
- return;
307
- }
308
-
309
- if ( isset( $_GET['wpsc_purchase_log_action'] ) && isset( $_GET['id'] ) && isset( $_GET['_wpnonce'] ) ) {
310
- $wpsc_purchase_log_action = sanitize_key( $_GET['wpsc_purchase_log_action'] );
311
 
312
- if ( wp_verify_nonce( $_GET['_wpnonce'], 'wpsc_purchase_log_action_' . $wpsc_purchase_log_action ) ) {
313
-
314
- do_action( 'wpsc_purchase_log_action-' . $wpsc_purchase_log_action, absint( $_GET['id'] ) );
315
-
316
- }
317
- }
318
-
319
- }
320
- add_action( 'admin_init', 'wpsc_do_purchase_log_actions' );
321
-
322
- /**
323
- * Handle clear downloads lock purchase log action
324
- *
325
- * The 'wpsc_purchase_log_action-downloads_lock' action hook which calls this function is nonce and capability checked
326
- * in wpsc_do_purchase_log_actions() before triggering do_action( 'wpsc_purchase_log_action-downloads_lock' ).
327
- *
328
- * @since 3.9.0
329
- *
330
- * @param int $log_id Purchase log ID.
331
- */
332
- function wpsc_purchase_log_action_downloads_lock( $log_id ) {
333
-
334
- wpsc_purchlog_clear_download_items( $log_id );
335
-
336
- // Redirect back to purchase logs list
337
- $sendback = wp_get_referer();
338
- $sendback = add_query_arg( 'cleared', 1, $sendback );
339
- wp_redirect( $sendback );
340
  exit();
341
-
342
  }
343
- add_action( 'wpsc_purchase_log_action-downloads_lock', 'wpsc_purchase_log_action_downloads_lock' );
 
 
344
 
345
- /**
346
- * Handle delete purchase log action
347
- *
348
- * The 'wpsc_purchase_log_action-delete' action hook which calls this function is nonce and capability checked
349
- * in wpsc_do_purchase_log_actions() before triggering do_action( 'wpsc_purchase_log_action-delete' ).
350
- *
351
- * @since 3.9.0
352
- *
353
- * @param int $log_id Purchase log ID.
354
- */
355
- function wpsc_purchase_log_action_delete( $log_id ) {
356
-
357
- $log = new WPSC_Purchase_Log( $log_id );
358
- $deleted = $log->delete();
359
-
360
- // Redirect back to purchase logs list
361
- $sendback = wp_get_referer();
362
- $sendback = remove_query_arg( array( 'c', 'id' ), $sendback );
363
- $sendback = add_query_arg( 'deleted', absint( $deleted ), $sendback );
364
- wp_redirect( $sendback );
365
- exit();
366
-
367
- }
368
- add_action( 'wpsc_purchase_log_action-delete', 'wpsc_purchase_log_action_delete' );
369
 
370
  /**
371
- * Handle email receipt purchase log action
372
- *
373
- * The 'wpsc_purchase_log_action-email_receipt' action hook which calls this function is nonce and capability checked
374
- * in wpsc_do_purchase_log_actions() before triggering do_action( 'wpsc_purchase_log_action-email_receipt' ).
375
- *
376
- * @since 3.9.0
377
- *
378
- * @param int $log_id Purchase log ID.
379
  */
380
- function wpsc_purchase_log_action_email_receipt( $log_id ) {
381
-
382
- $sent = wpsc_purchlog_resend_email( $log_id );
383
-
384
- // Redirect back to purchase logs list
385
- $sendback = wp_get_referer();
386
- $sendback = add_query_arg( 'sent', absint( $sent ), $sendback );
387
- wp_redirect( $sendback );
388
- exit();
389
-
390
- }
391
- add_action( 'wpsc_purchase_log_action-email_receipt', 'wpsc_purchase_log_action_email_receipt' );
392
-
393
- /**
394
- * Resend Purchase Log Email
395
- *
396
- * @param int|string $log_id Required. Purchase log ID (empty string is deprecated).
397
- * @return boolean Sent successfully.
398
- */
399
- function wpsc_purchlog_resend_email( $log_id = '' ) {
400
-
401
- if ( ! wpsc_is_store_admin() ) {
402
- return;
403
- }
404
-
405
  global $wpdb;
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 = add_query_arg( 'sent', 0, wp_get_referer() );
413
- wp_redirect( $sendback );
414
- exit();
415
-
416
  }
417
 
418
- $log_id = absint( $log_id );
419
-
420
- if ( $log_id > 0 ) {
421
-
422
- $wpec_taxes_controller = new wpec_taxes_controller();
423
-
424
- if ( is_numeric( $log_id ) ) {
425
- $purchase_log = new WPSC_Purchase_Log( $log_id );
426
- return wpsc_send_customer_email( $purchase_log );
427
- }
428
-
429
- }
430
 
431
- return false;
 
432
 
 
 
433
  }
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
- /**
441
- * Clear Purchase Log Download Locks
442
- *
443
- * @param string $log_id Required. Purchase log ID (empty string is deprecated).
444
- * @return boolean
445
- */
446
- function wpsc_purchlog_clear_download_items( $log_id = '' ) {
447
-
448
- if ( ! wpsc_is_store_admin() ) {
449
- return;
450
- }
451
-
452
  global $wpdb;
 
 
 
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
-
460
- $log_id = absint( $log_id );
461
-
462
- if ( $log_id > 0 ) {
463
-
464
- $downloadable_items = (array) $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `purchid` = %d", $log_id ), ARRAY_A );
465
-
466
- $wpdb->update( WPSC_TABLE_DOWNLOAD_STATUS, array( 'ip_number' => '' ), array( 'purchid' => $log_id ), '%s', '%d' );
467
 
468
  $email_form_field = $wpdb->get_var( "SELECT `id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1" );
469
- $email_address = $wpdb->get_var( $wpdb->prepare( "SELECT `value` FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` = %d AND `form_id` = '{$email_form_field}' LIMIT 1", $log_id ) );
470
-
471
- foreach ( $downloadable_items as $downloadable_item ) {
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
 
479
- }
480
 
481
- return false;
482
 
 
 
 
 
 
 
483
  }
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
491
  function wpsc_purchlog_bulk_modify() {
492
-
493
- if ( ! wpsc_is_store_admin() ) {
494
- return;
495
- }
496
-
497
  if ( $_POST['purchlog_multiple_status_change'] != -1 ) {
498
  if ( is_numeric( $_POST['purchlog_multiple_status_change'] ) && $_POST['purchlog_multiple_status_change'] != 'delete' ) {
499
  foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
@@ -503,12 +335,8 @@ function wpsc_purchlog_bulk_modify() {
503
  } elseif ( $_POST['purchlog_multiple_status_change'] == 'delete' ) {
504
  foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
505
 
506
- $log = new WPSC_Purchase_Log( $purchlogid );
507
- $deleted_log = $log->delete();
508
- if ( $deleted_log ) {
509
- $deleted++;
510
- }
511
-
512
  }
513
  }
514
  }
@@ -525,7 +353,7 @@ function wpsc_purchlog_bulk_modify() {
525
  if ( isset( $_POST['view_purchlogs_by_status'] ) ) {
526
  $sendback = add_query_arg( 'view_purchlogs_by_status', $_POST['view_purchlogs_by_status'], $sendback );
527
  }
528
- wp_redirect( $sendback );
529
  exit();
530
  }
531
 
@@ -533,57 +361,74 @@ if ( isset( $_REQUEST['wpsc_admin_action2'] ) && ($_REQUEST['wpsc_admin_action2'
533
  add_action( 'admin_init', 'wpsc_purchlog_bulk_modify' );
534
  }
535
 
536
- /**
537
- * Update Purchase Log Notes
538
- *
539
- * @param int $purchlog_id Purchase log ID.
540
- * @param string $purchlog_notes Notes.
541
- */
542
- function wpsc_purchlogs_update_notes( $purchlog_id = 0, $purchlog_notes = '' ) {
543
- if ( isset( $_POST['wpsc_purchlogs_update_notes_nonce'] ) && wp_verify_nonce( $_POST['wpsc_purchlogs_update_notes_nonce'], 'wpsc_purchlogs_update_notes' ) ) {
544
- if ( 0 == $purchlog_id && isset( $_POST['purchlog_id'] ) && '' == $purchlog_notes ) {
545
  $purchlog_id = absint( $_POST['purchlog_id'] );
546
  $purchlog_notes = stripslashes( $_POST['purchlog_notes'] );
547
  }
548
-
549
- if ( $purchlog_id > 0 ) {
550
- $purchase_log = new WPSC_Purchase_Log( $purchlog_id );
551
- $purchase_log->set( 'notes', $purchlog_notes );
552
- $purchase_log->save();
553
- }
554
- }
555
- }
556
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && $_REQUEST['wpsc_admin_action'] == 'purchlogs_update_notes' ) {
 
 
 
 
 
 
 
 
 
557
  add_action( 'admin_init', 'wpsc_purchlogs_update_notes' );
558
- }
559
 
560
- /**
561
- * Delete a purchase log
562
- *
563
- * @deprecated Use WPSC_Purchase_Log->delete() instead.
564
- *
565
- * @param int|string $purchlog_id Required. Purchase log ID (empty string is deprecated).
566
- * @return boolean Deleted successfully.
567
- */
568
- function wpsc_delete_purchlog( $purchlog_id = '' ) {
569
 
 
 
570
  global $wpdb;
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
 
578
- $log = new WPSC_Purchase_Log( $purchlog_id );
 
 
579
 
580
- return $log->delete();
581
 
 
 
 
 
 
 
 
 
 
582
  }
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() {
@@ -613,7 +458,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
  }
@@ -647,16 +492,13 @@ add_action( 'update_option_users_can_register', '_wpsc_action_update_option_user
647
  * @return nothing
648
  */
649
  function wpsc_update_page_urls( $auto = false ) {
650
-
651
- if ( ! wpsc_is_store_admin() ) {
652
- return;
653
- }
654
 
655
  wpsc_update_permalink_slugs();
656
  wpsc_core_load_page_titles();
657
  wpsc_register_post_types();
658
 
659
- if ( ! $auto ) {
660
  $sendback = wp_get_referer();
661
  if ( isset( $updated ) )
662
  $sendback = add_query_arg( 'updated', $updated, $sendback );
@@ -664,7 +506,7 @@ function wpsc_update_page_urls( $auto = false ) {
664
  if ( isset( $_SESSION['wpsc_settings_curr_page'] ) )
665
  $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
666
 
667
- wp_redirect( $sendback );
668
  exit();
669
  }
670
  }
@@ -673,11 +515,6 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action']
673
 
674
  //change the regions tax settings
675
  function wpsc_change_region_tax() {
676
-
677
- if ( ! wpsc_is_store_admin() ) {
678
- return;
679
- }
680
-
681
  global $wpdb;
682
  if ( is_array( $_POST['region_tax'] ) ) {
683
  foreach ( $_POST['region_tax'] as $region_id => $tax ) {
@@ -709,10 +546,6 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action']
709
  function wpsc_product_files_existing() {
710
  //List all product_files, with checkboxes
711
 
712
- if ( ! wpsc_is_store_admin() ) {
713
- return;
714
- }
715
-
716
  $product_id = absint( $_GET["product_id"] );
717
  $file_list = wpsc_uploaded_files();
718
 
@@ -730,7 +563,7 @@ function wpsc_product_files_existing() {
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;
735
  foreach ( (array)$file_list as $file ) {
736
  $num++;
@@ -761,6 +594,70 @@ function wpsc_product_files_existing() {
761
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'product_files_existing') )
762
  add_action( 'admin_init', 'wpsc_product_files_existing' );
763
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
764
  function wpsc_update_variations() {
765
  $product_id = absint( $_POST["product_id"] );
766
  $product_type_object = get_post_type_object('wpsc-product');
@@ -768,7 +665,7 @@ function wpsc_update_variations() {
768
  return;
769
 
770
  //Setup postdata
771
- $post_data = array();
772
  $post_data['edit_var_val'] = isset( $_POST['edit_var_val'] ) ? $_POST["edit_var_val"] : '';
773
 
774
  //Add or delete variations
@@ -811,19 +708,27 @@ function wpsc_delete_variation_set() {
811
  'variation_id'
812
  ), $sendback );
813
 
814
- wp_redirect( $sendback );
815
  exit();
816
  }
817
 
818
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-variation-set' == $_REQUEST['wpsc_admin_action'] ) )
819
  add_action( 'admin_init', 'wpsc_delete_variation_set' );
820
 
821
- function wpsc_backup_theme() {
 
 
822
 
823
- if ( ! wpsc_is_store_admin() ) {
824
- return;
825
- }
 
 
 
 
 
826
 
 
827
  $wp_theme_path = get_stylesheet_directory();
828
  wpsc_recursive_copy( $wp_theme_path, WPSC_THEME_BACKUP_DIR );
829
  $_SESSION['wpsc_themes_backup'] = true;
@@ -851,7 +756,7 @@ function wpsc_delete_coupon(){
851
  $sendback = add_query_arg( 'deleted', $deleted, $sendback );
852
 
853
  $sendback = remove_query_arg( array( 'deleteid', 'wpsc_admin_action' ), $sendback );
854
- wp_redirect( $sendback );
855
  exit();
856
  }
857
 
1
  <?php
 
 
 
 
 
2
 
3
+ function wpsc_ajax_sales_quarterly() {
4
+ $lastdate = $_POST['add_start'];
5
  $date = preg_split( '/-/', $lastdate );
6
  if ( !isset( $date[0] ) )
7
  $date[0] = 0;
29
 
30
  function wpsc_delete_file() {
31
  $product_id = absint( $_REQUEST['product_id'] );
32
+ $file_name = basename( $_REQUEST['file_name'] );
33
  check_admin_referer( 'delete_file_' . $file_name );
34
 
35
  _wpsc_delete_file( $product_id, $file_name );
66
  */
67
  function wpsc_duplicate_product() {
68
 
 
 
 
 
69
  // Get the original post
70
  $id = absint( $_GET['product'] );
71
  $post = get_post( $id );
76
 
77
  $duplicated = true;
78
  $sendback = wp_get_referer();
79
+ $sendback = esc_url( add_query_arg( 'duplicated', (int)$duplicated, $sendback ) );
80
 
81
  wp_redirect( $sendback );
82
  exit();
89
  add_action( 'admin_init', 'wpsc_duplicate_product' );
90
 
91
  function wpsc_purchase_log_csv() {
 
 
 
 
 
92
  global $wpdb, $wpsc_gateways;
93
  get_currentuserinfo();
94
  $count = 0;
95
+ if ( 'key' == $_REQUEST['rss_key'] && current_user_can( 'manage_options' ) ) {
 
96
  if ( isset( $_REQUEST['start_timestamp'] ) && isset( $_REQUEST['end_timestamp'] ) ) {
97
  $start_timestamp = $_REQUEST['start_timestamp'];
98
+ $end_timestamp = $_REQUEST['end_timestamp'];
99
  $start_end_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` BETWEEN '%d' AND '%d' ORDER BY `date` DESC";
100
  $start_end_sql = apply_filters( 'wpsc_purchase_log_start_end_csv', $start_end_sql );
101
  $data = $wpdb->get_results( $wpdb->prepare( $start_end_sql, $start_timestamp, $end_timestamp ), ARRAY_A );
124
 
125
  $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `type` != 'heading' ORDER BY `checkout_order` DESC;";
126
  $form_data = $wpdb->get_results( $form_sql, ARRAY_A );
127
+ $csv = 'Purchase ID, Price, Firstname, Lastname, Email, Order Status, Data, ';
128
 
129
  $headers_array = array(
130
+ _x( 'Purchase ID', 'purchase log csv headers', 'wpsc' ),
131
  _x( 'Purchase Total', 'purchase log csv headers', 'wpsc' ),
132
  );
133
  $headers2_array = array(
134
  _x( 'Payment Gateway', 'purchase log csv headers', 'wpsc' ),
135
+ _x( 'Payment Status', 'purchase log csv headers', 'wpsc' ),
136
+ _x( 'Purchase Date', 'purchase log csv headers', 'wpsc' ),
137
  );
138
  $form_headers_array = array();
139
+ $headers3_array = array();
140
 
141
  $output = '';
142
 
143
+ foreach ( (array)$data as $purchase ) {
 
 
 
 
 
 
 
 
 
144
  $form_headers = '';
145
  $output .= "\"" . $purchase['id'] . "\","; //Purchase ID
146
  $output .= "\"" . $purchase['totalprice'] . "\","; //Purchase Total
147
+ foreach ( (array)$form_data as $form_field ) {
148
+ $form_headers_array[] = $form_field['unique_name'];
149
+ $collected_data_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` = '" . $purchase['id'] . "' AND `form_id` = '" . $form_field['id'] . "' LIMIT 1";
150
  $collected_data = $wpdb->get_results( $collected_data_sql, ARRAY_A );
151
  $collected_data = $collected_data[0];
152
+ $output .= "\"" . $collected_data['value'] . "\","; // get form fields
 
 
 
 
153
  }
154
 
155
  if ( isset( $wpsc_gateways[$purchase['gateway']] ) && isset( $wpsc_gateways[$purchase['gateway']]['display_name'] ) )
166
  $cartsql = "SELECT `prodid`, `quantity`, `name` FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase['id'] . "";
167
  $cart = $wpdb->get_results( $cartsql, ARRAY_A );
168
 
169
+ if( $count < count( $cart ) )
170
  $count = count( $cart );
 
 
 
 
171
  // Go through all products in cart and display quantity and sku
172
+ foreach ( (array)$cart as $item ) {
173
  $skuvalue = get_product_meta( $item['prodid'], 'sku', true );
174
  if( empty( $skuvalue ) )
175
  $skuvalue = __( 'N/A', 'wpsc' );
176
  $output .= "\"" . $item['quantity'] . "\",";
177
+ $output .= "\"" . str_replace( '"', '\"', $item['name'] ) . "\"";
178
+ $output .= "," . $skuvalue."," ;
 
 
 
 
 
 
 
 
179
  }
 
180
  $output .= "\n"; // terminates the row/line in the CSV file
181
  }
182
  // Get the most number of products and create a header for them
183
+ $headers3 = "";
184
  for( $i = 0; $i < $count; $i++ ){
185
  $headers3[] = _x( 'Quantity', 'purchase log csv headers', 'wpsc' );
186
  $headers3[] = _x( 'Product Name', 'purchase log csv headers', 'wpsc' );
187
  $headers3[] = _x( 'SKU', 'purchase log csv headers', 'wpsc' );
188
  }
189
 
190
+ $headers = '"' . implode( '","', $headers_array ) . '"';
191
+ $form_headers = '"' . implode( '","', $form_headers_array ) . '"';
192
+ $headers2 = '"' . implode( '","', $headers2_array ) . '"';
193
+ $headers3 = '"' . implode( '","', $headers3_array ) . '"';
194
 
195
  $headers = apply_filters( 'wpsc_purchase_log_csv_headers', $headers . $form_headers . $headers2 . $headers3, $data, $form_data );
196
+ $output = apply_filters( 'wpsc_purchase_log_csv_output', $output, $data, $form_data );
 
 
 
197
  header( 'Content-Type: text/csv' );
198
  header( 'Content-Disposition: inline; filename="' . $csv_name . '"' );
199
  echo $headers . "\n". $output;
209
  add_action( 'admin_init', 'wpsc_purchase_log_csv' );
210
 
211
  function wpsc_admin_sale_rss() {
 
 
 
 
 
212
  global $wpdb;
213
  if ( ($_GET['rss'] == "true") && ($_GET['rss_key'] == 'key') && ($_GET['action'] == "purchase_log") ) {
214
  $sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date`!='' ORDER BY `date` DESC";
219
  $output .= "<?xml version='1.0'?>\n\r";
220
  $output .= "<rss version='2.0'>\n\r";
221
  $output .= " <channel>\n\r";
222
+ $output .= " <title>" . _x( 'WP e-Commerce Product Log', 'admin rss product feed', 'wpsc' ) . "</title>\n\r";
223
+ $output .= " <link>" . get_option( 'siteurl' ) . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php</link>\n\r";
224
+ $output .= " <description>" . _x( 'This is the WP e-Commerce Product Log RSS feed', 'admin rss product feed', 'wpsc' ) . "</description>\n\r";
225
+ $output .= " <generator>" . _x( 'WP e-Commerce Plugin', 'admin rss product feed', 'wpsc' ) . "</generator>\n\r";
226
 
227
  foreach ( (array)$purchase_log as $purchase ) {
228
+ $purchase_link = get_option( 'siteurl' ) . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php&amp;purchaseid=" . $purchase['id'];
229
  $purchase_title = _x( 'Purchase # %d', 'admin rss product feed', 'wpsc' );
230
  $purchase_title = sprintf( $purchase_title, $purchase['id'] );
231
  $output .= " <item>\n\r";
243
  }
244
  }
245
 
246
+ if ( isset( $_GET['action'] ) && ( 'purchase_log' == $_GET['action'] ) )
247
  add_action( 'admin_init', 'wpsc_admin_sale_rss' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
+ function wpsc_display_invoice() {
250
+ $purchase_id = (int)$_REQUEST['purchaselog_id'];
251
+ add_action('wpsc_packing_slip', 'wpsc_packing_slip');
252
+ do_action('wpsc_before_packing_slip', $purchase_id);
253
+ do_action('wpsc_packing_slip', $purchase_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  exit();
 
255
  }
256
+ //other actions are here
257
+ if ( isset( $_GET['display_invoice'] ) && ( 'true' == $_GET['display_invoice'] ) )
258
+ add_action( 'admin_init', 'wpsc_display_invoice', 0 );
259
 
260
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc_display_invoice' == $_REQUEST['wpsc_admin_action'] ) )
261
+ add_action( 'admin_init', 'wpsc_display_invoice' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
  /**
264
+ * Purchase log ajax code starts here
 
 
 
 
 
 
 
265
  */
266
+ function wpsc_purchlog_resend_email() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  global $wpdb;
268
+ $log_id = $_REQUEST['email_buyer_id'];
269
+ $wpec_taxes_controller = new wpec_taxes_controller();
270
+ if ( is_numeric( $log_id ) ) {
271
+ $purchase_log = new WPSC_Purchase_Log( $log_id );
272
+ $sent = wpsc_send_customer_email( $purchase_log );
 
 
 
 
 
273
  }
274
 
275
+ $sendback = wp_get_referer();
 
 
 
 
 
 
 
 
 
 
 
276
 
277
+ if ( isset( $sent ) )
278
+ $sendback = add_query_arg( 'sent', $sent, $sendback );
279
 
280
+ wp_redirect( esc_url( $sendback ) );
281
+ exit();
282
  }
283
 
 
284
  if ( isset( $_REQUEST['email_buyer_id'] ) && is_numeric( $_REQUEST['email_buyer_id'] ) ) {
285
+ add_action( 'admin_init', 'wpsc_purchlog_resend_email' );
286
  }
287
 
288
+ function wpsc_purchlog_clear_download_items() {
 
 
 
 
 
 
 
 
 
 
 
289
  global $wpdb;
290
+ if ( is_numeric( $_GET['purchaselog_id'] ) ) {
291
+ $purchase_id = (int)$_GET['purchaselog_id'];
292
+ $downloadable_items = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `purchid` IN ('$purchase_id')", ARRAY_A );
293
 
294
+ $clear_locks_sql = "UPDATE`" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `ip_number` = '' WHERE `purchid` IN ('$purchase_id')";
295
+ $wpdb->query( $clear_locks_sql );
296
+ $cleared = true;
 
 
 
 
 
 
 
 
 
 
297
 
298
  $email_form_field = $wpdb->get_var( "SELECT `id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1" );
299
+ $email_address = $wpdb->get_var( "SELECT `value` FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id`='{$purchase_id}' AND `form_id` = '{$email_form_field}' LIMIT 1" );
300
+
301
+ foreach ( (array)$downloadable_items as $downloadable_item ) {
302
+ $download_links .= esc_url( add_query_arg(
303
+ 'downloadid',
304
+ $downloadable_item['uniqueid'],
305
+ home_url()
306
+ ) ) . "\n";
307
  }
308
 
 
309
 
310
+ 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' ) . "" );
311
 
 
312
 
313
+ $sendback = wp_get_referer();
314
 
315
+ if ( isset( $cleared ) ) {
316
+ $sendback = add_query_arg( 'cleared', $cleared, $sendback );
317
+ }
318
+ wp_redirect( $sendback );
319
+ exit();
320
+ }
321
  }
322
 
 
323
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clear_locks') ) {
324
+ add_action( 'admin_init', 'wpsc_purchlog_clear_download_items' );
325
  }
326
 
327
  //bulk actions for purchase log
328
  function wpsc_purchlog_bulk_modify() {
 
 
 
 
 
329
  if ( $_POST['purchlog_multiple_status_change'] != -1 ) {
330
  if ( is_numeric( $_POST['purchlog_multiple_status_change'] ) && $_POST['purchlog_multiple_status_change'] != 'delete' ) {
331
  foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
335
  } elseif ( $_POST['purchlog_multiple_status_change'] == 'delete' ) {
336
  foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
337
 
338
+ wpsc_delete_purchlog( $purchlogid );
339
+ $deleted++;
 
 
 
 
340
  }
341
  }
342
  }
353
  if ( isset( $_POST['view_purchlogs_by_status'] ) ) {
354
  $sendback = add_query_arg( 'view_purchlogs_by_status', $_POST['view_purchlogs_by_status'], $sendback );
355
  }
356
+ wp_redirect( esc_url( $sendback ) );
357
  exit();
358
  }
359
 
361
  add_action( 'admin_init', 'wpsc_purchlog_bulk_modify' );
362
  }
363
 
364
+ /* Start Order Notes (by Ben) */
365
+ function wpsc_purchlogs_update_notes( $purchlog_id = '', $purchlog_notes = '' ) {
366
+ global $wpdb;
367
+ if ( wp_verify_nonce( $_POST['wpsc_purchlogs_update_notes_nonce'], 'wpsc_purchlogs_update_notes' ) ) {
368
+ if ( ($purchlog_id == '') && ($purchlog_notes == '') ) {
 
 
 
 
369
  $purchlog_id = absint( $_POST['purchlog_id'] );
370
  $purchlog_notes = stripslashes( $_POST['purchlog_notes'] );
371
  }
372
+ $wpdb->update(
373
+ WPSC_TABLE_PURCHASE_LOGS,
374
+ array(
375
+ 'notes' => $purchlog_notes
376
+ ),
377
+ array(
378
+ 'id' => $purchlog_id
379
+ ),
380
+ array(
381
+ '%s'
382
+ ),
383
+ array(
384
+ '%d'
385
+ )
386
+ );
387
+ }
388
+ }
389
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'purchlogs_update_notes' ) )
390
  add_action( 'admin_init', 'wpsc_purchlogs_update_notes' );
 
391
 
392
+ /* End Order Notes (by Ben) */
 
 
 
 
 
 
 
 
393
 
394
+ //delete a purchase log
395
+ function wpsc_delete_purchlog( $purchlog_id='' ) {
396
  global $wpdb;
397
+ $deleted = 0;
 
398
  if ( $purchlog_id == '' ) {
399
+ $purchlog_id = absint( $_GET['purchlog_id'] );
400
+ check_admin_referer( 'delete_purchlog_' . $purchlog_id );
401
+ }
402
+
403
+ if ( is_numeric( $purchlog_id ) ) {
404
+ $delete_log_form_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='$purchlog_id'";
405
+ $cart_content = $wpdb->get_results( $delete_log_form_sql, ARRAY_A );
406
+ }
407
+
408
+ $purchlog_status = $wpdb->get_var( $wpdb->prepare( "SELECT `processed` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`= %d", $purchlog_id ) );
409
+ if ( $purchlog_status == 5 || $purchlog_status == 1 ) {
410
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_CLAIMED_STOCK . "` WHERE `cart_id` = %d AND `cart_submitted` = '1'", $purchlog_id ) );
411
  }
412
 
413
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid` = %d", $purchlog_id ) );
414
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` IN (%d)", $purchlog_id ) );
415
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = %d LIMIT 1", $purchlog_id ) );
416
 
417
+ $deleted = 1;
418
 
419
+ if ( is_numeric( $_GET['purchlog_id'] ) ) {
420
+ $sendback = wp_get_referer();
421
+ $sendback = remove_query_arg( array( 'c', 'id' ), $sendback );
422
+ if ( isset( $deleted ) ) {
423
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
424
+ }
425
+ wp_redirect( esc_url( $sendback ) );
426
+ exit();
427
+ }
428
  }
429
 
430
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'delete_purchlog') ) {
431
+ add_action( 'admin_init', 'wpsc_delete_purchlog' );
 
432
  }
433
 
434
  function wpsc_update_option_product_category_hierarchical_url() {
458
  function _wpsc_action_update_option_require_register( $old_value, $new_value ) {
459
  if ( $new_value == 1 && ! get_option( 'users_can_register' ) ) {
460
  update_option( 'users_can_register', 1 );
461
+ $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 e-Commerce has enabled that setting for you automatically.', 'wpsc' );
462
  $message = sprintf( $message, admin_url( 'options-general.php' ) );
463
  add_settings_error( 'require_register', 'users_can_register_turned_on', $message, 'updated' );
464
  }
492
  * @return nothing
493
  */
494
  function wpsc_update_page_urls( $auto = false ) {
495
+ global $wpdb;
 
 
 
496
 
497
  wpsc_update_permalink_slugs();
498
  wpsc_core_load_page_titles();
499
  wpsc_register_post_types();
500
 
501
+ if( ! $auto ){
502
  $sendback = wp_get_referer();
503
  if ( isset( $updated ) )
504
  $sendback = add_query_arg( 'updated', $updated, $sendback );
506
  if ( isset( $_SESSION['wpsc_settings_curr_page'] ) )
507
  $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
508
 
509
+ wp_redirect( esc_url( $sendback ) );
510
  exit();
511
  }
512
  }
515
 
516
  //change the regions tax settings
517
  function wpsc_change_region_tax() {
 
 
 
 
 
518
  global $wpdb;
519
  if ( is_array( $_POST['region_tax'] ) ) {
520
  foreach ( $_POST['region_tax'] as $region_id => $tax ) {
546
  function wpsc_product_files_existing() {
547
  //List all product_files, with checkboxes
548
 
 
 
 
 
549
  $product_id = absint( $_GET["product_id"] );
550
  $file_list = wpsc_uploaded_files();
551
 
563
 
564
  $output = "<span class='admin_product_notes select_product_note '>" . esc_html__( 'Choose a downloadable file for this product:', 'wpsc' ) . "</span><br>";
565
  $output .= "<form method='post' class='product_upload'>";
566
+ $output .= "<div class='ui-widget-content multiple-select select_product_file'>";
567
  $num = 0;
568
  foreach ( (array)$file_list as $file ) {
569
  $num++;
594
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'product_files_existing') )
595
  add_action( 'admin_init', 'wpsc_product_files_existing' );
596
 
597
+ //change the gateway settings
598
+ function wpsc_gateway_settings() {
599
+ //To update options
600
+ if ( isset( $_POST['wpsc_options'] ) ) {
601
+ foreach ( $_POST['wpsc_options'] as $key => $value ) {
602
+ if ( $value != get_option( $key ) ) {
603
+ update_option( $key, $value );
604
+ }
605
+ }
606
+ unset( $_POST['wpsc_options'] );
607
+ }
608
+
609
+ if ( isset( $_POST['user_defined_name'] ) && is_array( $_POST['user_defined_name'] ) ) {
610
+ $payment_gateway_names = get_option( 'payment_gateway_names' );
611
+
612
+ if ( !is_array( $payment_gateway_names ) ) {
613
+ $payment_gateway_names = array( );
614
+ }
615
+ $payment_gateway_names = array_merge( $payment_gateway_names, (array)$_POST['user_defined_name'] );
616
+ update_option( 'payment_gateway_names', $payment_gateway_names );
617
+ }
618
+ $custom_gateways = get_option( 'custom_gateway_options' );
619
+
620
+ $nzshpcrt_gateways = nzshpcrt_get_gateways();
621
+ foreach ( $nzshpcrt_gateways as $gateway ) {
622
+ if ( in_array( $gateway['internalname'], $custom_gateways ) ) {
623
+ if ( isset( $gateway['submit_function'] ) ) {
624
+ call_user_func_array( $gateway['submit_function'], array( ) );
625
+ $changes_made = true;
626
+ }
627
+ }
628
+ }
629
+ if ( (isset( $_POST['payment_gw'] ) && $_POST['payment_gw'] != null ) ) {
630
+ update_option( 'payment_gateway', $_POST['payment_gw'] );
631
+ }
632
+ }
633
+ if ( isset( $_REQUEST['wpsc_gateway_settings'] ) && ($_REQUEST['wpsc_gateway_settings'] == 'gateway_settings') )
634
+ add_action( 'admin_init', 'wpsc_gateway_settings' );
635
+
636
+ function wpsc_google_shipping_settings() {
637
+ if ( isset( $_POST['submit'] ) ) {
638
+ foreach ( (array)$_POST['google_shipping'] as $key => $country ) {
639
+ if ( $country == 'on' ) {
640
+ $google_shipping_country[] = $key;
641
+ $updated++;
642
+ }
643
+ }
644
+ update_option( 'google_shipping_country', $google_shipping_country );
645
+ $sendback = wp_get_referer();
646
+ $sendback = remove_query_arg( 'googlecheckoutshipping', $sendback );
647
+
648
+ if ( isset( $updated ) ) {
649
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
650
+ }
651
+
652
+ wp_redirect( esc_url( $sendback ) );
653
+ exit();
654
+ }
655
+ }
656
+
657
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'google_shipping_settings') ) {
658
+ add_action( 'admin_init', 'wpsc_google_shipping_settings' );
659
+ }
660
+
661
  function wpsc_update_variations() {
662
  $product_id = absint( $_POST["product_id"] );
663
  $product_type_object = get_post_type_object('wpsc-product');
665
  return;
666
 
667
  //Setup postdata
668
+ $post_data = array( );
669
  $post_data['edit_var_val'] = isset( $_POST['edit_var_val'] ) ? $_POST["edit_var_val"] : '';
670
 
671
  //Add or delete variations
708
  'variation_id'
709
  ), $sendback );
710
 
711
+ wp_redirect( esc_url( $sendback ) );
712
  exit();
713
  }
714
 
715
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-variation-set' == $_REQUEST['wpsc_admin_action'] ) )
716
  add_action( 'admin_init', 'wpsc_delete_variation_set' );
717
 
718
+ function wpsc_force_flush_theme_transients() {
719
+ // Flush transients
720
+ wpsc_flush_theme_transients( true );
721
 
722
+ // Bounce back
723
+ $sendback = wp_get_referer();
724
+ wp_redirect( $sendback );
725
+
726
+ exit();
727
+ }
728
+ if ( isset( $_REQUEST['wpsc_flush_theme_transients'] ) && ( $_REQUEST['wpsc_flush_theme_transients'] == 'true' ) )
729
+ add_action( 'admin_init', 'wpsc_force_flush_theme_transients' );
730
 
731
+ function wpsc_backup_theme() {
732
  $wp_theme_path = get_stylesheet_directory();
733
  wpsc_recursive_copy( $wp_theme_path, WPSC_THEME_BACKUP_DIR );
734
  $_SESSION['wpsc_themes_backup'] = true;
756
  $sendback = add_query_arg( 'deleted', $deleted, $sendback );
757
 
758
  $sendback = remove_query_arg( array( 'deleteid', 'wpsc_admin_action' ), $sendback );
759
+ wp_redirect( esc_url( $sendback ) );
760
  exit();
761
  }
762
 
wpsc-admin/js/admin.js CHANGED
@@ -10,21 +10,21 @@
10
  data['wpsc_action'] = data['action'];
11
  data['action'] = 'wpsc_ajax';
12
 
13
- return $.post( ajaxurl, data, handler, 'json' );
14
  };
15
 
16
  /**
17
  * Wrapper for $.get. Takes care of the 'wpsc_action' and 'action' data arguments.
18
  *
19
  * @since 3.8.9
20
- * @param {object} data Data to pass to the AJAX destination
21
  * @param {function} handler Response handler
22
  */
23
  $.wpsc_get = function(data, handler) {
24
  data['wpsc_action'] = data['action'];
25
  data['action'] = 'wpsc_ajax';
26
 
27
- return $.get( ajaxurl, data, handler, 'json' );
28
  };
29
 
30
  if( pagenow == 'edit-wpsc_product_category' ) {
@@ -36,18 +36,20 @@
36
  parent_id: 0
37
  };
38
 
39
- jQuery.post( ajaxurl, data );
40
  }
41
 
42
  var submit_handlers = [];
43
 
44
  var disable_ajax_submit = function() {
45
  var t = $('#submit');
46
-
 
 
47
  if (t.data('events'))
48
  submit_handlers = t.data('events').click;
49
- t.off('click');
50
- t.on('click', function() {
51
  var form = $(this).parents('form');
52
  if (! validateForm( form ) )
53
  return false;
@@ -56,17 +58,13 @@
56
 
57
  var restore_ajax_submit = function() {
58
  var t = $('#submit');
59
- t.off('click');
60
  $.each(submit_handlers, function(index, obj) {
61
- t.on('click', obj.handler);
62
  });
63
  };
64
 
65
  $(function(){
66
- if ( 'undefined' === typeof WPSC_Term_List_Levels ) {
67
- return;
68
- }
69
-
70
  var table = $('body.edit-tags-php .wp-list-table');
71
  table.find('tbody tr').each(function(){
72
  var t = $(this),
@@ -80,7 +78,7 @@
80
 
81
  $('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
82
 
83
- $('[name="image"]').on('change', function() {
84
  var t = $(this);
85
 
86
  if (t.val())
@@ -102,7 +100,7 @@
102
  });
103
  }
104
 
105
- $(document).on( 'click', 'form input.prdfil', function(){
106
  var t = $(this);
107
  var post_data = {
108
  'select_product_file[]' : [],
@@ -127,11 +125,11 @@
127
  find('p:even').removeClass('alt').end().
128
  find('p:odd').addClass('alt');
129
  });
130
- return false;
131
  });
132
 
133
  // delete upload
134
- $(document).on( 'click', '.file_delete_button', function(){
135
  var t = $(this),
136
  post_values = {
137
  action : 'delete_file',
@@ -156,29 +154,14 @@
156
 
157
  return false;
158
  });
 
159
 
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
-
166
  jQuery('td.hidden_alerts img').each(function(){
167
  var t = jQuery(this);
168
  t.appendTo(t.parents('tr').find('td.column-title strong'));
169
  });
170
 
171
-
172
- jQuery( '#stock_limit_quantity' ).change( function(){
173
- wpsc_push_v2t( '#stock_limit_quantity', '#wpsc_product_stock_metabox_live_title > p > span' );
174
- });
175
-
176
- jQuery( 'em.wpsc_metabox_live_title' ).each( function( i, v ) {
177
- var $em = jQuery( this ), $parent = $em.parents( 'div.postbox' ), $h3 = $parent.find( 'h3' );
178
- $em.appendTo( $h3 );
179
-
180
- });
181
-
182
  /* Coupon edit functionality */
183
  jQuery('.modify_coupon').hide();
184
  jQuery('.wpsc_edit_coupon').click(function(){
@@ -195,78 +178,141 @@ jQuery(document).ready(function($){
195
  });
196
  jQuery("form[name='add_coupon']").submit(function() {
197
  var title = jQuery("form[name='add_coupon'] input[name='add_coupon_code']").val();
198
- if ( title === '' ) {
199
  jQuery('<div id="notice" class="error"><p>' + wpsc_adminL10n.empty_coupon + '</p></div>').insertAfter('div.wrap > h2').delay(2500).hide(350);
200
  return false;
201
  }
202
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
- /*
205
- Alternative Currencies
206
- Trigger and handle UI events for adding and removing currency layers.
207
- */
208
-
209
- var currencyRowTemplate = jQuery( '.wpsc-currency-layers tr.template' ).remove().removeClass( 'template hidden' ).removeAttr( 'id' );
 
 
 
210
 
211
- // Hide table if empty
212
- if ( jQuery( '.wpsc-currency-layers tbody tr' ).length === 0 ) {
213
- jQuery( '.wpsc-currency-layers table' ).hide();
214
- }
 
 
 
 
 
215
 
216
- // Add new currency layer
217
- jQuery( '.wpsc-currency-layers' ).on( 'click', 'a.wpsc_add_new_currency', function( e ) {
218
- jQuery( this ).siblings( 'table' ).show();
219
- jQuery( '.wpsc-currency-layers tbody' ).append( currencyRowTemplate.clone() );
220
- e.preventDefault();
221
- });
222
 
223
- // Delete currency layer in admin product page
224
- jQuery( '.wpsc-currency-layers' ).on( 'click', 'a.wpsc_delete_currency_layer', function( e ) {
225
- var currencyRow = jQuery( this ).closest( 'tr' );
226
- currencyRow.find( 'input' ).val( '' );
227
- currencyRow.find( 'select' ).val( '' );
228
- if ( currencyRow.siblings().length === 0 ) {
229
- currencyRow.closest( 'table' ).hide();
230
- }
231
- currencyRow.remove();
232
- e.preventDefault();
233
  });
234
 
235
- /*
236
- Quantity Discounts
237
- Trigger and handle UI events for adding and removing quantity dicounts.
238
- */
239
-
240
- var qtyRowTemplate = jQuery( '.wpsc-quantity-discounts tr.template' ).remove().removeClass( 'template hidden' ).removeAttr( 'id' );
241
 
242
- // Hide table if empty
243
- if ( jQuery( '.wpsc-quantity-discounts tbody tr' ).length === 0 ) {
244
- jQuery( '.wpsc-quantity-discounts table' ).hide();
245
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
- // Add new row to rate table
248
- jQuery( '.wpsc-quantity-discounts' ).on( 'click', '.add_level', function( e ) {
249
- jQuery( this ).siblings( 'table' ).show();
250
- added = jQuery( '.wpsc-quantity-discounts tbody' ).append( qtyRowTemplate.clone() );
251
- e.preventDefault();
 
 
 
 
252
  });
253
 
254
- // Remove a row from rate table
255
- jQuery( '.wpsc-quantity-discounts' ).on( 'click', '.remove_line', function( e ) {
256
- var qtyRow = jQuery( this ).closest( 'tr' );
257
- qtyRow.find( 'input' ).val( '' );
258
- if ( qtyRow.siblings().length === 0 ) {
259
- qtyRow.closest( 'table' ).hide();
260
- }
261
- qtyRow.remove();
262
- e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  });
264
 
265
- /*
266
- As far as I can tell, WP provides no good way of unsetting elements in the bulk edit area...
267
- tricky jQuery action will do for now....not ideal whatsoever, nor eternally stable.
268
- */
269
- if( pagenow == 'edit-wpsc-product' ) {
270
  jQuery('.inline-edit-password-input').closest('.inline-edit-group').css('display', 'none');
271
  var vcl = jQuery('.inline-edit-col input[name="tax_input[wpsc-variation][]"]').css('display', 'none');
272
  vcl.each(function(){
@@ -277,10 +323,10 @@ jQuery(document).ready(function($){
277
  jQuery('#bulk-edit select[name=post_parent]').closest('fieldset').css('display', 'none');
278
  jQuery('.inline-edit-col select[name=post_parent]').parent().css('display', 'none');
279
  jQuery('.inline-edit-status').parent().css('display', 'none');
280
- }
281
- if( wpsc_adminL10n.dragndrop_set == "true" && typenow == "wpsc-product" && adminpage == "edit-php" ) {
282
- // this makes the product list table sortable
283
- jQuery('table.widefat:not(.tags)').sortable({
284
  update: function(event, ui) {
285
  var category_id = jQuery('select#wpsc_product_category option:selected').val(),
286
  product_order = jQuery('table.widefat').sortable( 'toArray' ),
@@ -299,57 +345,229 @@ jQuery(document).ready(function($){
299
  axis: 'y',
300
  containment: 'table.widefat tbody',
301
  placeholder: 'product-placeholder',
302
- cursor: 'move',
303
- cancel: 'tr.inline-edit-wpsc-product'
304
- });
305
  }
306
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  var limited_stock_checkbox = jQuery('input.limited_stock_checkbox');
308
  var toggle_stock_fields = function(checked) {
309
  jQuery('div.edit_stock').toggle(checked);
310
  jQuery('th.column-stock input, td.stock input').each(function(){
311
  this.disabled = ! checked;
312
  });
313
- };
314
 
315
  if (limited_stock_checkbox.size() > 0) {
316
  toggle_stock_fields(limited_stock_checkbox.is(':checked'));
317
  }
318
 
319
  // show or hide the stock input forms
320
- limited_stock_checkbox.on('click', function () {
321
  toggle_stock_fields(limited_stock_checkbox.is(':checked'));
322
  });
323
 
324
- jQuery("#custom_tax_checkbox").on( 'click', function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  if (this.checked) {
326
  jQuery("#custom_tax").show();
327
  } else {
328
  jQuery("#custom_tax input").val('');
329
  jQuery("#custom_tax").hide();
330
  }
 
331
  });
332
 
333
- jQuery( '.wpsc_featured_product_toggle' ).on( 'click', function(){
334
- post_values = {
335
- product_id : jQuery( this ).parents( 'tr' ).attr( 'id' ).replace( 'post-', '' ),
336
- action : 'update_featured_product'
337
- };
338
 
339
- jQuery.post( ajaxurl, post_values, function( response ) {
340
- jQuery( '.featured_toggle_' + response.product_id ).html( "<img class='" + response.color + "' src='" + response.image + "' alt='" + response.text + "' title='" + response.text + "' />" );
341
- }, 'json' );
342
 
343
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  });
345
 
346
  // Fill in values when inline editor appears.
347
- // This should be done properly so we don't need livequery here - see http://codex.wordpress.org/Plugin_API/Action_Reference/quick_edit_custom_box
348
  jQuery('.inline-editor').livequery(function() {
349
  var id = jQuery(this).attr('id');
350
- id = id.replace(/^edit-/, '');
351
 
352
- if ( ! id || ! parseInt( id, 10 ) ) {
353
  return;
354
  }
355
 
@@ -365,235 +583,64 @@ jQuery(document).ready(function($){
365
  jQuery(this).find('.wpsc_ie_sale_price').val(sale_price);
366
  jQuery(this).find('.wpsc_ie_sku').val(sku);
367
  });
368
-
369
- jQuery( 'div.coupon-condition' ).each( function( index, value ){
370
- if( jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).length !== 0 ) {
371
- margin = jQuery( 'select.ruleprops', jQuery( this ) ).offset().left - jQuery( this ).offset().left;
372
- margin = parseInt( margin, 10 ) - 1;
373
- jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).css( 'margin-left', '-' + margin + 'px' );
374
- }
375
- });
376
-
377
- jQuery( '.coupon-conditions' ).on( 'click', '.wpsc-button-plus', function() {
378
- var parent = jQuery( this ).closest( '.coupon-condition' ),
379
- conditions_count = jQuery( '.coupon-condition' ).size(),
380
- prototype = parent.clone();
381
-
382
- var operator_box = jQuery('<select/>',{name:'rules[operator][]'});
383
-
384
- if ( jQuery( 'select[name="rules[operator][]"]', prototype ).length === 0 ) {
385
- operator_box.append("<option value='and'>" + wpsc_adminL10n.coupons_compare_and + "</option>");
386
- operator_box.append("<option value='or'>" + wpsc_adminL10n.coupons_compare_or + "</option>");
387
- prototype.prepend(operator_box);
388
- }
389
-
390
- prototype.find('select').val('');
391
- prototype.find('input').val('');
392
- prototype.css( { 'opacity' : '0' } );
393
- prototype.insertAfter(parent);
394
-
395
- margin = jQuery( 'select.ruleprops', prototype ).offset().left - prototype.offset().left;
396
- margin = parseInt( margin, 10 ) - 1;
397
- prototype.find('input').focus();
398
-
399
- prototype.animate( { opacity: 1, 'margin-left': '-' + margin + 'px', height: 'show' }, 150 );
400
-
401
- return false;
402
- });
403
-
404
- jQuery('.coupon-conditions').on( 'click', '.wpsc-button-minus', function() {
405
- var parent = jQuery(this).closest('.coupon-condition'),
406
- conditions_count = jQuery('.coupon-condition').size(),
407
- prototype;
408
-
409
- if ( jQuery( this ).index( jQuery( '.wpsc-button-minus' ) ) === 0 )
410
- return false;
411
-
412
- if (conditions_count == 1) {
413
- prototype = parent.clone();
414
- prototype.find('select').val('');
415
- prototype.find('input').val('');
416
- prototype.hide();
417
- jQuery('.coupon-conditions').find('td').prepend(prototype);
418
- parent.slideUp(150, function(){
419
- prototype.slideDown(150);
420
- parent.remove();
421
- });
422
-
423
- return false;
424
- }
425
-
426
- parent.slideUp(150, function(){
427
- parent.remove();
428
- });
429
-
430
- return false;
431
- });
432
-
433
- jQuery( '#wpsc_product_details_forms .category-tabs a, #wpsc_product_delivery_forms .category-tabs a' ).click(function(event){
434
- var $this = jQuery(this), href = $this.attr('href');
435
-
436
- $this.closest('ul').find('li').removeClass('tabs');
437
- $this.closest('li').addClass('tabs');
438
- $this.closest('div').find('.tabs-panel').hide();
439
- jQuery(href).show();
440
- event.preventDefault();
441
- });
442
-
443
- // Meta table
444
- var meta_inp_tem = jQuery('#wpsc_new_meta_template').remove().removeAttr('id');
445
-
446
- jQuery('#wpsc_add_custom_meta').click(function(){
447
- if ( jQuery( 'tr.no-meta' ).is( ':visible' ) ) {
448
- jQuery( 'tr.no-meta' ).hide();
449
- }
450
-
451
- jQuery('#wpsc_product_meta_table tbody').append(meta_inp_tem.clone());
452
- event.preventDefault();
453
- });
454
-
455
- // Init delivery metabox live title
456
- if (jQuery('#wpsc_product_delivery_forms').length > 0){
457
- jQuery('#wpsc_product_delivery_forms input, #wpsc_product_delivery_forms select').change(wpsc_update_delivery_metabox_live_title);
458
- wpsc_update_delivery_metabox_live_title();
459
- }
460
-
461
- // Init product details metabox live title
462
- if (jQuery('#wpsc_product_details_forms').length > 0){
463
- jQuery('#wpsc_product_details_forms a').click(wpsc_update_product_details_metabox_live_title);
464
- wpsc_update_product_details_metabox_live_title();
465
- }
466
-
467
- wpsc_update_price_live_preview();
468
  });
469
 
 
 
 
 
470
 
471
- // Remove new/empty custom meta input row
472
- function wpsc_remove_empty_meta(caller){
473
- jQuery(caller).closest('tr').remove();
474
-
475
- wpsc_update_product_details_metabox_live_title();
476
-
477
- if ( ! jQuery( '#wpsc_product_meta_table tbody tr' ).not( '.no-meta' ).length ) {
478
- jQuery( 'tr.no-meta' ).show();
479
- }
480
-
481
- event.preventDefault();
482
  }
483
 
484
  // function for removing custom meta
485
- function wpsc_remove_custom_meta(caller, meta_id) {
486
- var post_data = {
487
- action : 'remove_product_meta',
488
- 'meta_id' : meta_id,
489
- nonce : jQuery(caller).data('nonce')
490
- };
491
-
492
- var response_handler = function(response) {
493
- if (! response.is_successful) {
494
- alert(response.error.messages.join("\n"));
495
- return;
496
- }
497
- jQuery(caller).closest('tr').remove();
498
- };
 
499
 
500
  jQuery.wpsc_post(post_data, response_handler);
501
- wpsc_update_product_details_metabox_live_title();
502
-
503
- if ( ! jQuery( '#wpsc_product_meta_table tbody tr' ).not( '.no-meta' ).length ) {
504
- jQuery( 'tr.no-meta' ).show();
505
- }
506
-
507
- event.preventDefault();
508
- }
509
-
510
- // Copy value of caller to target text
511
- function wpsc_push_v2t(caller, target_slt){
512
- jQuery(target_slt).text(jQuery(caller).val());
513
- }
514
-
515
- function wpsc_update_price_live_preview(){
516
- var price = jQuery('#wpsc_price').val();
517
- var sale_price = jQuery('#wpsc_sale_price').val();
518
-
519
- if (sale_price > 0){
520
- jQuery('#wpsc_product_price_metabox_live_title>p>span').text(sale_price);
521
- jQuery('#wpsc_product_price_metabox_live_title>del>span').text(price);
522
- jQuery('#wpsc_product_price_metabox_live_title>del').show();
523
- } else {
524
- jQuery('#wpsc_product_price_metabox_live_title>p>span').text(price);
525
- jQuery('#wpsc_product_price_metabox_live_title>del').hide();
526
- }
527
  }
528
 
529
- // Compose and update live title for shipping metabox
530
- function wpsc_update_delivery_metabox_live_title(){
531
-
532
- if ( ! jQuery('#wpsc_product_delivery_forms').length ) {
533
- return;
534
- }
535
-
536
- var weight = jQuery('#wpsc-product-shipping-weight').val();
537
- var weight_unit = jQuery('#wpsc-product-shipping-weight-unit').val();
538
- var length = jQuery('#wpsc-product-shipping-length').val();
539
- var width = jQuery('#wpsc-product-shipping-width').val();
540
- var height = jQuery('#wpsc-product-shipping-height').val();
541
- var dimensions_unit = jQuery('#wpsc-product-shipping-dimensions-unit').val();
542
- var number_of_downloads = jQuery('.wpsc_product_download_row').length;
543
-
544
- var vol = Math.round( ( length * width * height ) * 100) / 100; // Round up to two decimal
545
- var downloads_name = ( number_of_downloads !== 1 ) ? wpsc_adminL10n.meta_downloads_plural : wpsc_adminL10n.meta_downloads_singular;
546
- var output = '';
547
 
548
- if ( jQuery( '.wpsc-product-shipping-section' ).length ) {
549
- output += weight + ' ' + weight_unit + ', ' + vol + ' ' + dimensions_unit + '<sup>3</sup>, ';
 
 
 
 
 
 
 
 
 
 
 
 
550
  }
551
-
552
- output += number_of_downloads + downloads_name;
553
-
554
- jQuery( '#wpsc_product_delivery_metabox_live_title > p' ).html( output );
555
  }
556
 
557
- function wpsc_update_product_details_metabox_live_title(){
558
- if (jQuery('#wpsc_product_details_forms').length <= 0) return;
559
-
560
- var number_of_photos = jQuery('#wpsc_product_gallery img').length;
561
- var number_of_meta = jQuery('#wpsc_product_meta_table tbody tr').not('.no-meta').length;
562
-
563
- var output = number_of_photos + ' images, ';
564
- output += number_of_meta + ' metadata';
565
-
566
- jQuery('#wpsc_product_details_metabox_live_title>p').html(output);
567
  }
568
 
569
- function wpsc_update_product_gallery_tab(obj){
570
- var output, url;
571
-
572
- output = '<div id="wpsc_product_gallery">';
573
- output += '<ul>';
574
-
575
- for (var i = 0; i < obj.length; i++) {
576
-
577
- if ( 'undefined' !== typeof obj[i].sizes.thumbnail ) {
578
- url = obj[i].sizes.thumbnail.url;
579
- } else {
580
- url = obj[i].sizes.full.url;
581
- }
582
-
583
- output += '<li>';
584
- output += '<img src="' + url + '">';
585
- output += '<input type="hidden" name="wpsc-product-gallery-imgs[]" value="' + obj[i].id + '">';
586
-
587
- output += '</li>';
588
- }
589
-
590
- output += '</ul>';
591
- output += '<div class="clear"></div>';
592
- output += '</div>';
593
-
594
- jQuery('#wpsc_product_gallery').replaceWith(output);
595
- wpsc_update_product_details_metabox_live_title();
596
- }
597
 
598
  var prevElement = null;
599
  var prevOption = null;
@@ -602,11 +649,11 @@ function hideOptionElement(id, option) {
602
  if (prevOption == option) {
603
  return;
604
  }
605
- if (prevElement !== null) {
606
  prevElement.style.display = "none";
607
  }
608
 
609
- if (id === null) {
610
  prevElement = null;
611
  } else {
612
  prevElement = document.getElementById(id);
@@ -625,8 +672,81 @@ function hideelement(id) {
625
  }
626
  }
627
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
628
  function getcurrency(id) {
629
- //ajax.post("index.php",gercurrency,"wpsc_admin_action=change_currency&currencyid="+id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
  }
631
 
632
  function hideelement1(id, item_value) {
@@ -648,4 +768,25 @@ function show_status_box(id,image_id) {
648
  document.getElementById(image_id).src = wpsc_adminL10n.wpsc_core_images_url + '/icon_window_expand.gif';
649
  }
650
  return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  }
10
  data['wpsc_action'] = data['action'];
11
  data['action'] = 'wpsc_ajax';
12
 
13
+ $.post(ajaxurl, data, handler, 'json');
14
  };
15
 
16
  /**
17
  * Wrapper for $.get. Takes care of the 'wpsc_action' and 'action' data arguments.
18
  *
19
  * @since 3.8.9
20
+ * @param {object} data Data to pass to the AJAX destination
21
  * @param {function} handler Response handler
22
  */
23
  $.wpsc_get = function(data, handler) {
24
  data['wpsc_action'] = data['action'];
25
  data['action'] = 'wpsc_ajax';
26
 
27
+ $.get(ajaxurl, data, handler, 'json');
28
  };
29
 
30
  if( pagenow == 'edit-wpsc_product_category' ) {
36
  parent_id: 0
37
  };
38
 
39
+ jQuery.post(ajaxurl, data);
40
  }
41
 
42
  var submit_handlers = [];
43
 
44
  var disable_ajax_submit = function() {
45
  var t = $('#submit');
46
+ console.log(t);
47
+ console.log(t.data('events'));
48
+ console.log(t.data('events').click);
49
  if (t.data('events'))
50
  submit_handlers = t.data('events').click;
51
+ t.unbind('click');
52
+ t.bind('click', function() {
53
  var form = $(this).parents('form');
54
  if (! validateForm( form ) )
55
  return false;
58
 
59
  var restore_ajax_submit = function() {
60
  var t = $('#submit');
61
+ t.unbind('click');
62
  $.each(submit_handlers, function(index, obj) {
63
+ t.bind('click', obj.handler);
64
  });
65
  };
66
 
67
  $(function(){
 
 
 
 
68
  var table = $('body.edit-tags-php .wp-list-table');
69
  table.find('tbody tr').each(function(){
70
  var t = $(this),
78
 
79
  $('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
80
 
81
+ $('[name="image"]').bind('change', function() {
82
  var t = $(this);
83
 
84
  if (t.val())
100
  });
101
  }
102
 
103
+ $(document).delegate('form input.prdfil', 'click', function(){
104
  var t = $(this);
105
  var post_data = {
106
  'select_product_file[]' : [],
125
  find('p:even').removeClass('alt').end().
126
  find('p:odd').addClass('alt');
127
  });
128
+ event.preventDefault();
129
  });
130
 
131
  // delete upload
132
+ $(document).delegate('.file_delete_button', 'click', function(){
133
  var t = $(this),
134
  post_values = {
135
  action : 'delete_file',
154
 
155
  return false;
156
  });
157
+ })(jQuery);
158
 
159
+ jQuery(document).ready(function(){
 
 
 
 
 
160
  jQuery('td.hidden_alerts img').each(function(){
161
  var t = jQuery(this);
162
  t.appendTo(t.parents('tr').find('td.column-title strong'));
163
  });
164
 
 
 
 
 
 
 
 
 
 
 
 
165
  /* Coupon edit functionality */
166
  jQuery('.modify_coupon').hide();
167
  jQuery('.wpsc_edit_coupon').click(function(){
178
  });
179
  jQuery("form[name='add_coupon']").submit(function() {
180
  var title = jQuery("form[name='add_coupon'] input[name='add_coupon_code']").val();
181
+ if ( title == '') {
182
  jQuery('<div id="notice" class="error"><p>' + wpsc_adminL10n.empty_coupon + '</p></div>').insertAfter('div.wrap > h2').delay(2500).hide(350);
183
  return false;
184
  }
185
  });
186
+ //Animateedit products columns
187
+ jQuery('.wpsc-separator').livequery(function(){
188
+ jQuery(this).click(function(){
189
+ if(jQuery('#wpsc-col-left').css('width') == '20px'){
190
+ left_col_width = '50%';
191
+ right_col_width = '48%';
192
+
193
+ }else{
194
+ left_col_width = '20px';
195
+ right_col_width = '95%';
196
+ }
197
+ if(left_col_width == '50%'){
198
+ jQuery('.tablenav').show();
199
+ jQuery('#posts-filter').show();
200
+ }else{
201
+ jQuery('.tablenav').hide();
202
+ jQuery('#posts-filter').hide();
203
 
204
+ }
205
+ //jQuery(this).css('background-position','0');
206
+ jQuery('#wpsc-col-left').animate(
207
+ {
208
+ width : left_col_width
209
+ },
210
+ 50,
211
+ function(){
212
+ //On complete
213
 
214
+ }
215
+ );
216
+ jQuery('#wpsc-col-right').animate(
217
+ {
218
+ width : right_col_width
219
+ },
220
+ 50,
221
+ function(){
222
+ //On complete
223
 
224
+ }
225
+ );
226
+ });
 
 
 
227
 
 
 
 
 
 
 
 
 
 
 
228
  });
229
 
230
+ //new currency JS in admin product page
231
+ jQuery('div.new_layer').livequery(function(){
232
+ jQuery(this).hide();
 
 
 
233
 
234
+ });
235
+ var firstclick = true
236
+ jQuery('a.wpsc_add_new_currency').livequery(function(){
237
+ jQuery(this).click(function(event){
238
+ if(firstclick == true){
239
+ jQuery('div.new_layer').show();
240
+ html = jQuery('div.new_layer').html();
241
+ firstclick = false;
242
+ }else{
243
+ jQuery('div.new_layer').after('<div>'+html+'</div>');
244
+ }
245
+ event.preventDefault();
246
+ });
247
+ });
248
+ //delete currency layer in admin product page
249
+ jQuery('a.wpsc_delete_currency_layer').livequery(function(){
250
+ jQuery(this).click(function(event){
251
+ jQuery(this).prev('input').val('');
252
+ jQuery(this).prev('select').val('');
253
+ jQuery(this).parent('div:first').hide();
254
+ event.preventDefault();
255
+ });
256
+ });
257
 
258
+ //delete currency layer in admin product page
259
+ jQuery('a.wpsc_mass_resize').livequery(function(){
260
+ jQuery(this).click(function(event){
261
+ this_href = jQuery(this).attr('href');
262
+ parent_element = jQuery(this).parent();
263
+ extra_parameters = jQuery("input[type='text']", parent_element).serialize();
264
+ window.location = this_href+"&"+extra_parameters;
265
+ return false;
266
+ });
267
  });
268
 
269
+ jQuery('#wpsc_product_list .wpsc_ie_save').live('click', function(){
270
+ jQuery(this).parents('tr:first').find('.loading_indicator').css('visibility', 'visible');
271
+ var id =jQuery(this).parents('tr:first').find('.wpsc_ie_id').val();
272
+ var title = jQuery(this).parents('tr:first').find('.wpsc_ie_title').val();
273
+ var weight = jQuery(this).parents('tr:first').find('.wpsc_ie_weight').val();
274
+ var stock = jQuery(this).parents('tr:first').find('.wpsc_ie_stock').val();
275
+ var price = jQuery(this).parents('tr:first').find('.wpsc_ie_price').val();
276
+ var special_price = jQuery(this).parents('tr:first').find('.wpsc_ie_special_price').val();
277
+ var sku = jQuery(this).parents('tr:first').find('.wpsc_ie_sku').val();
278
+ //post stuff
279
+ var data = {
280
+ action: 'wpsc_ie_save',
281
+ id: id,
282
+ title: title,
283
+ weight: weight,
284
+ stock: stock,
285
+ price: price,
286
+ special_price: special_price,
287
+ sku: sku
288
+ };
289
+
290
+ jQuery.post(ajaxurl, data, function(response) {
291
+ response = eval(response);
292
+ if(response.error){
293
+ alert(response.error);
294
+ jQuery('#post-' + response.id + ' a.row-title, #post-' + response.id + ' td > span').show();
295
+ jQuery('#post-' + response.id + ' td input.wpsc_ie_field, #post-' + response.id + ' td .wpsc_inline_actions').show();
296
+ jQuery('#post-' + response.id + ' .loading_indicator').css('visibility', 'hidden');
297
+ }
298
+ else{
299
+ jQuery('#post-' + response.id + ' .post-title a.row-title').text(response.title);
300
+ jQuery('#post-' + response.id + ' .column-weight span').text(response.weight);
301
+ jQuery('#post-' + response.id + ' .column-stock span').text(response.stock);
302
+ jQuery('#post-' + response.id + ' .column-SKU span').text(response.sku);
303
+
304
+ jQuery('#post-' + response.id + ' .column-price .pricedisplay').html(jQuery(response.price).text());
305
+ jQuery('#post-' + response.id + ' .column-sale_price .pricedisplay').html(jQuery(response.special_price).text());
306
+
307
+ jQuery('#post-' + response.id + ' a.row-title, #post-' + response.id + ' td > span').hide();
308
+ jQuery('#post-' + response.id + ' td input.wpsc_ie_field, #post-' + response.id + ' td .wpsc_inline_actions').show();
309
+ jQuery('#post-' + response.id + ' .loading_indicator').css('visibility', 'hidden');
310
+ }
311
+ });
312
  });
313
 
314
+ //As far as I can tell, WP provides no good way of unsetting elements in the bulk edit area...tricky jQuery action will do for now....not ideal whatsoever, nor eternally stable.
315
+ if( pagenow == 'edit-wpsc-product' ) {
 
 
 
316
  jQuery('.inline-edit-password-input').closest('.inline-edit-group').css('display', 'none');
317
  var vcl = jQuery('.inline-edit-col input[name="tax_input[wpsc-variation][]"]').css('display', 'none');
318
  vcl.each(function(){
323
  jQuery('#bulk-edit select[name=post_parent]').closest('fieldset').css('display', 'none');
324
  jQuery('.inline-edit-col select[name=post_parent]').parent().css('display', 'none');
325
  jQuery('.inline-edit-status').parent().css('display', 'none');
326
+ }
327
+ if( wpsc_adminL10n.dragndrop_set == "true" && typenow == "wpsc-product" && adminpage == "edit-php" ) {
328
+ // this makes the product list table sortable
329
+ jQuery('table.widefat:not(.tags)').sortable({
330
  update: function(event, ui) {
331
  var category_id = jQuery('select#wpsc_product_category option:selected').val(),
332
  product_order = jQuery('table.widefat').sortable( 'toArray' ),
345
  axis: 'y',
346
  containment: 'table.widefat tbody',
347
  placeholder: 'product-placeholder',
348
+ cursor: 'move',
349
+ cancel: 'tr.inline-edit-wpsc-product'
350
+ });
351
  }
352
 
353
+ // this helps show the links in the product list table, it is partially done using CSS, but that breaks in IE6
354
+ jQuery("tr.product-edit").hover(
355
+ function() {
356
+ jQuery(".wpsc-row-actions", this).css("visibility", "visible");
357
+ },
358
+ function() {
359
+ jQuery(".wpsc-row-actions", this).css("visibility", "hidden");
360
+ }
361
+ );
362
+
363
+ jQuery("div.admin_product_name a.shorttag_toggle").livequery(function(){
364
+ jQuery(this).toggle(
365
+ function () {
366
+ jQuery("div.admin_product_shorttags", jQuery(this).parents("table.product_editform")).css('display', 'block');
367
+ return false;
368
+ },
369
+ function () {
370
+ //jQuery("div#admin_product_name a.shorttag_toggle").toggleClass('toggled');
371
+ jQuery("div.admin_product_shorttags", jQuery(this).parents("table.product_editform")).css('display', 'none');
372
+ return false;
373
+ }
374
+ );
375
+ });
376
+ jQuery('.editinline').live('click', function(){
377
+ setTimeout('editinline_get_id()',200);
378
+
379
+ });
380
+
381
+ jQuery('a.add_variation_item_form').livequery(function(){
382
+ jQuery(this).click(function() {
383
+ form_field_container = jQuery(this).siblings('#variation_values');
384
+ form_field = jQuery("div.variation_value", form_field_container).eq(0).clone();
385
+
386
+ jQuery('input.text',form_field).attr('name','new_variation_values[]');
387
+ jQuery('input.text',form_field).val('');
388
+ jQuery('input.variation_values_id',form_field).remove();
389
+
390
+ jQuery(form_field_container).append(form_field);
391
+ return false;
392
+ });
393
+ });
394
+
395
+
396
+ jQuery('div.variation_value a.delete_variation_value').livequery(function(){
397
+ jQuery(this).click( function() {
398
+ element_count = jQuery("#variation_values div").size();
399
+
400
+ if(element_count > 1) {
401
+
402
+ parent_element = jQuery(this).parent("div.variation_value");
403
+ variation_value_id = jQuery("input.variation_values_id", parent_element).val();
404
+
405
+ delete_url = jQuery(this).attr('href');
406
+ post_values = "remove_variation_value=true&variation_value_id="+variation_value_id;
407
+ jQuery.post( delete_url, "ajax=true", function(returned_data) {
408
+ jQuery("#variation_row_"+returned_data).fadeOut('fast', function() {
409
+ jQuery(this).remove();
410
+ });
411
+ });
412
+ }
413
+ return false;
414
+ });
415
+ });
416
+
417
+
418
+ jQuery("#add-product-image").click(function(){
419
+ swfu.selectFiles();
420
+ });
421
+
422
+
423
+ jQuery('a.closeimagesettings').livequery(function(){
424
+ jQuery(this).click( function() {
425
+ jQuery('.image_settings_box').hide();
426
+ });
427
+ });
428
+
429
+ setTimeout(bulkedit_edit_tags_hack, 1000);
430
+
431
+
432
+ jQuery("#gallery_list").livequery(function(){
433
+ jQuery(this).sortable({
434
+ revert: false,
435
+ placeholder: "ui-selected",
436
+ start: function(e,ui) {
437
+ jQuery('#image_settings_box').hide();
438
+ jQuery('a.editButton').hide();
439
+ jQuery('img.deleteButton').hide();
440
+ jQuery('ul#gallery_list').children('li').removeClass('first');
441
+ },
442
+ stop:function (e,ui) {
443
+ jQuery('ul#gallery_list').children('li:first').addClass('first');
444
+ },
445
+ update: function (e,ui){
446
+ input_set = jQuery.makeArray(jQuery("#gallery_list li:not(.ui-sortable-helper) input.image-id"));
447
+ //console.log(input_set);
448
+ set = new Array();
449
+ for( var i in input_set) {
450
+ set[i] = jQuery(input_set[i]).val();
451
+ }
452
+
453
+ order = set.join(',');
454
+ product_id = jQuery('#product_id').val();
455
+
456
+ postVars = "product_id="+product_id+"&order="+order;
457
+ jQuery.post( 'index.php?wpsc_admin_action=rearrange_images', postVars, function(returned_data) {
458
+ eval(returned_data);
459
+ jQuery('#gallery_image_'+image_id).children('a.editButton').remove();
460
+ jQuery('#gallery_image_'+image_id).children('div.image_settings_box').remove();
461
+ jQuery('#gallery_image_'+image_id).append(image_menu);
462
+ });
463
+
464
+ },
465
+ 'opacity':0.5
466
+ });
467
+ });
468
+
469
  var limited_stock_checkbox = jQuery('input.limited_stock_checkbox');
470
  var toggle_stock_fields = function(checked) {
471
  jQuery('div.edit_stock').toggle(checked);
472
  jQuery('th.column-stock input, td.stock input').each(function(){
473
  this.disabled = ! checked;
474
  });
475
+ }
476
 
477
  if (limited_stock_checkbox.size() > 0) {
478
  toggle_stock_fields(limited_stock_checkbox.is(':checked'));
479
  }
480
 
481
  // show or hide the stock input forms
482
+ limited_stock_checkbox.bind('click', function () {
483
  toggle_stock_fields(limited_stock_checkbox.is(':checked'));
484
  });
485
 
486
+
487
+ jQuery("#table_rate_price").livequery(function(){
488
+ if (!this.checked) {
489
+ jQuery("#table_rate").hide();
490
+ }
491
+ jQuery(this).click( function() {
492
+ if (this.checked) {
493
+ jQuery("#table_rate").show();
494
+ } else {
495
+ jQuery("#table_rate").hide();
496
+ }
497
+ });
498
+ });
499
+
500
+ jQuery("#custom_tax_checkbox").livequery(function(){
501
+ jQuery(this).click( function() {
502
  if (this.checked) {
503
  jQuery("#custom_tax").show();
504
  } else {
505
  jQuery("#custom_tax input").val('');
506
  jQuery("#custom_tax").hide();
507
  }
508
+ });
509
  });
510
 
511
+ jQuery(".add_level").livequery(function(){
512
+ jQuery(this).click(function() {
513
+ added = jQuery(this).parent().children('table').append('<tr><td><input type="text" size="10" value="" name="table_rate_price[quantity][]"/> and above</td><td><input type="text" size="10" value="" name="table_rate_price[table_price][]"/></td></tr>');
514
+ });
515
+ });
516
 
 
 
 
517
 
518
+ jQuery(".remove_line").livequery(function(){
519
+ jQuery(this).click(function() {
520
+ jQuery(this).parent().parent('tr').remove();
521
+ });
522
+ });
523
+
524
+ // hover for gallery view
525
+ jQuery("div.previewimage").livequery(function(){
526
+ jQuery(this).hover(
527
+ function () {
528
+ jQuery(this).children('img.deleteButton').show();
529
+ if(jQuery('div.image_settings_box').css('display')!='block')
530
+ jQuery(this).children('a.editButton').show();
531
+ },
532
+ function () {
533
+ jQuery(this).children('img.deleteButton').hide();
534
+ jQuery(this).children('a.editButton').hide();
535
+ }
536
+ );
537
+ });
538
+
539
+
540
+ // display image editing menu
541
+ jQuery("a.editButton").livequery(function(){
542
+ jQuery(this).click( function(){
543
+ jQuery(this).hide();
544
+ jQuery('div.image_settings_box').show('fast');
545
+ });
546
+ });
547
+ // hide image editing menu
548
+ jQuery("a.closeimagesettings").livequery(function(){
549
+ jQuery(this).click(function (e) {
550
+ jQuery("div#image_settings_box").hide();
551
+ });
552
+ });
553
+
554
+ jQuery('.wpsc_featured_product_toggle').livequery(function(){
555
+ jQuery(this).click(function(event){
556
+ target_url = jQuery(this).attr('href');
557
+ post_values = "ajax=true";
558
+ jQuery.post(target_url, post_values, function(returned_data){
559
+ eval(returned_data);
560
+ });
561
+ return false;
562
+ });
563
  });
564
 
565
  // Fill in values when inline editor appears.
 
566
  jQuery('.inline-editor').livequery(function() {
567
  var id = jQuery(this).attr('id');
568
+ id = id.replace(/^edit-/, '');
569
 
570
+ if (!id || !parseInt(id)) {
571
  return;
572
  }
573
 
583
  jQuery(this).find('.wpsc_ie_sale_price').val(sale_price);
584
  jQuery(this).find('.wpsc_ie_sku').val(sku);
585
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
586
  });
587
 
588
+ // function for adding more custom meta
589
+ function add_more_meta(e) {
590
+ var current_meta_forms = jQuery(e).parent().children("div.product_custom_meta:last"), // grab the form container
591
+ new_meta_forms = current_meta_forms.clone(); // clone the form container
592
 
593
+ new_meta_forms.find('input, textarea').val('');
594
+ current_meta_forms.after(new_meta_forms); // append it after the container of the clicked element
595
+ return false;
 
 
 
 
 
 
 
 
596
  }
597
 
598
  // function for removing custom meta
599
+ function remove_meta(e, meta_id) {
600
+ var t = jQuery(e),
601
+ current_meta_form = t.parent("div.product_custom_meta"), // grab the form container
602
+ post_data = {
603
+ action : 'remove_product_meta',
604
+ 'meta_id' : meta_id,
605
+ nonce : t.data('nonce')
606
+ },
607
+ response_handler = function(response) {
608
+ if (! response.is_successful) {
609
+ alert(response.error.messages.join("\n"));
610
+ return;
611
+ }
612
+ jQuery("div#custom_meta_"+meta_id).remove();
613
+ };
614
 
615
  jQuery.wpsc_post(post_data, response_handler);
616
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  }
618
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
 
620
+ // function for switching the state of the image upload forms
621
+ function wpsc_upload_switcher(target_state) {
622
+ switch(target_state) {
623
+ case 'flash':
624
+ jQuery("div.browser-image-uploader").css("display","none");
625
+ jQuery("div.flash-image-uploader").css("display","block");
626
+ jQuery.post( 'index.php?admin=true', "admin=true&ajax=true&save_image_upload_state=true&image_upload_state=1", function(returned_data) { });
627
+ break;
628
+
629
+ case 'browser':
630
+ jQuery("div.flash-image-uploader").css("display","none");
631
+ jQuery("div.browser-image-uploader").css("display","block");
632
+ jQuery.post( 'index.php?admin=true', "admin=true&ajax=true&save_image_upload_state=true&image_upload_state=0", function(returned_data) { });
633
+ break;
634
  }
 
 
 
 
635
  }
636
 
637
+ // function for switching the state of the extra resize forms
638
+ function image_resize_extra_forms(option) {
639
+ container = jQuery(option).parent();
640
+ jQuery("div.image_resize_extra_forms").css('display', 'none');
641
+ jQuery("div.image_resize_extra_forms",container).css('display', 'block');
 
 
 
 
 
642
  }
643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
 
645
  var prevElement = null;
646
  var prevOption = null;
649
  if (prevOption == option) {
650
  return;
651
  }
652
+ if (prevElement != null) {
653
  prevElement.style.display = "none";
654
  }
655
 
656
+ if (id == null) {
657
  prevElement = null;
658
  } else {
659
  prevElement = document.getElementById(id);
672
  }
673
  }
674
 
675
+ /*
676
+ * Modified copy of the wordpress edToolbar function that does the same job, it uses document.write, we cannot.
677
+ */
678
+ function wpsc_edToolbar() {
679
+ //document.write('<div id="ed_toolbar">');
680
+ output = '';
681
+ for (i = 0; i < edButtons.length; i++) {
682
+ output += wpsc_edShowButton(edButtons[i], i);
683
+ }
684
+ output += '<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />';
685
+ output += '<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />';
686
+ // edShowLinks(); // disabled by default
687
+ //document.write('</div>');
688
+ jQuery('div#ed_toolbar').html(output);
689
+ }
690
+
691
+
692
+ /*
693
+ * Modified copy of the wordpress edShowButton function that does the same job, it uses document.write, we cannot.
694
+ */
695
+
696
+ function wpsc_edShowButton(button, i) {
697
+ if (button.id == 'ed_img') {
698
+ output = '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />';
699
+ }
700
+ else if (button.id == 'ed_link') {
701
+ output = '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />';
702
+ }
703
+ else {
704
+ output = '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '" />';
705
+ }
706
+ return output;
707
+ }
708
+
709
+
710
+
711
+ function fillcategoryform(catid) {
712
+ post_values = 'ajax=true&admin=true&catid='+catid;
713
+ jQuery.post( 'index.php', post_values, function(returned_data) {
714
+ jQuery('#formcontent').html( returned_data );
715
+ jQuery('form.edititem').css('display', 'block');
716
+ jQuery('#additem').css('display', 'none');
717
+ jQuery('#blank_item').css('display', 'none');
718
+ jQuery('#productform').css('display', 'block');
719
+ jQuery("#loadingindicator_span").css('visibility','hidden');
720
+ });
721
+ }
722
+
723
+ function submit_status_form(id) {
724
+ document.getElementById(id).submit();
725
+ }
726
+
727
  function getcurrency(id) {
728
+ //ajax.post("index.php",gercurrency,"wpsc_admin_action=change_currency&currencyid="+id);
729
+ }
730
+
731
+ function showadd_categorisation_form() {
732
+ if(jQuery('div_categorisation').css('display') != 'block') {
733
+ jQuery('div#add_categorisation').css('display', 'block');
734
+ jQuery('div#edit_categorisation').css('display', 'none');
735
+ } else {
736
+ jQuery('div#add_categorisation').css('display', 'none');
737
+ }
738
+ return false;
739
+ }
740
+
741
+
742
+ function showedit_categorisation_form() {
743
+ if(jQuery('div#edit_categorisation').css('display') != 'block') {
744
+ jQuery('div#edit_categorisation').css('display', 'block');
745
+ jQuery('div#add_categorisation').css('display', 'none');
746
+ } else {
747
+ jQuery('div#edit_categorisation').css('display', 'none');
748
+ }
749
+ return false;
750
  }
751
 
752
  function hideelement1(id, item_value) {
768
  document.getElementById(image_id).src = wpsc_adminL10n.wpsc_core_images_url + '/icon_window_expand.gif';
769
  }
770
  return false;
771
+ }
772
+
773
+ function editinline_get_id(){
774
+ id = jQuery('.inline-edit-row').attr('id');
775
+ id = id.replace('edit-','');
776
+ has_var = jQuery('#inline_'+id+'_has_var').val();
777
+ if( has_var == '1'){
778
+ jQuery(".wpsc-cols").css('display', 'none');
779
+ jQuery(".wpsc-cols:first").text(wpsc_adminL10n.bulk_edit_no_vars)
780
+ .addClass('wpsc_var_description')
781
+ .css('display','block');
782
+ }else{
783
+ jQuery(".wpsc-cols").css('display', 'block');
784
+ }
785
+
786
+
787
+ }
788
+
789
+ // inline-edit-post.dev.js prepend tag edit textarea into the last fieldset. We need to undo that
790
+ function bulkedit_edit_tags_hack() {
791
+ jQuery('<fieldset class="inline-edit-col-right"><div class="inline-edit-col"></div></fieldset>').insertBefore('#bulk-edit .wpsc-cols:first').find('.inline-edit-col').append(jQuery('#bulk-edit .inline-edit-tags'));
792
  }
wpsc-admin/js/ajax.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2005 Timothy R. Morgan
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ // IN THE SOFTWARE.
20
+ // mini/ajax.js - http://timmorgan.org/mini
21
+ // var fvd = 0;
22
+ function ajax_item(e){if(typeof e=='string')e=document.getElementById(e);return e};
23
+ function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
24
+
25
+ ajax={};
26
+ ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
27
+ ajax.serialize=function(f)
28
+ {
29
+ var g=function(n)
30
+ {
31
+ return f.getElementsByTagName(n)
32
+ };
33
+ var nv=function(e)
34
+ {
35
+ if(e.name)
36
+ {
37
+ return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);
38
+ } else {return '';}
39
+ };
40
+ var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');
41
+ };
42
+
43
+ ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseText)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
44
+ ajax.get=function(url,func){ajax.send(url,func,'GET')};
45
+ ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText};
46
+ ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
47
+ ajax.update=function(url,elm){var e=ajax_item(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
48
+ ajax.submit=function(url,elm,frm){var e=ajax_item(elm);var f=function(r){e.innerHTML=r};ajax.post(url,f,ajax.serialize(frm))};
wpsc-admin/js/dimensions.js ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
4
+ *
5
+ * $LastChangedDate$
6
+ * $Rev$
7
+ */
8
+
9
+ jQuery.fn._height = jQuery.fn.height;
10
+ jQuery.fn._width = jQuery.fn.width;
11
+
12
+ /**
13
+ * If used on document, returns the document's height (innerHeight)
14
+ * If used on window, returns the viewport's (window) height
15
+ * See core docs on height() to see what happens when used on an element.
16
+ *
17
+ * @example $("#testdiv").height()
18
+ * @result 200
19
+ *
20
+ * @example $(document).height()
21
+ * @result 800
22
+ *
23
+ * @example $(window).height()
24
+ * @result 400
25
+ *
26
+ * @name height
27
+ * @type Object
28
+ * @cat Plugins/Dimensions
29
+ */
30
+ jQuery.fn.height = function() {
31
+ if ( this[0] == window )
32
+ return self.innerHeight ||
33
+ jQuery.boxModel && document.documentElement.clientHeight ||
34
+ document.body.clientHeight;
35
+
36
+ if ( this[0] == document )
37
+ return Math.max( document.body.scrollHeight, document.body.offsetHeight );
38
+
39
+ return this._height(arguments[0]);
40
+ };
41
+
42
+ /**
43
+ * If used on document, returns the document's width (innerWidth)
44
+ * If used on window, returns the viewport's (window) width
45
+ * See core docs on height() to see what happens when used on an element.
46
+ *
47
+ * @example $("#testdiv").width()
48
+ * @result 200
49
+ *
50
+ * @example $(document).width()
51
+ * @result 800
52
+ *
53
+ * @example $(window).width()
54
+ * @result 400
55
+ *
56
+ * @name width
57
+ * @type Object
58
+ * @cat Plugins/Dimensions
59
+ */
60
+ jQuery.fn.width = function() {
61
+ if ( this[0] == window )
62
+ return self.innerWidth ||
63
+ jQuery.boxModel && document.documentElement.clientWidth ||
64
+ document.body.clientWidth;
65
+
66
+ if ( this[0] == document )
67
+ return Math.max( document.body.scrollWidth, document.body.offsetWidth );
68
+
69
+ return this._width(arguments[0]);
70
+ };
71
+
72
+ /**
73
+ * Returns the inner height value (without border) for the first matched element.
74
+ * If used on document, returns the document's height (innerHeight)
75
+ * If used on window, returns the viewport's (window) height
76
+ *
77
+ * @example $("#testdiv").innerHeight()
78
+ * @result 800
79
+ *
80
+ * @name innerHeight
81
+ * @type Number
82
+ * @cat Plugins/Dimensions
83
+ */
84
+ jQuery.fn.innerHeight = function() {
85
+ return this[0] == window || this[0] == document ?
86
+ this.height() :
87
+ this.css('display') != 'none' ?
88
+ this[0].offsetHeight - (parseInt(this.css("borderTopWidth")) || 0) - (parseInt(this.css("borderBottomWidth")) || 0) :
89
+ this.height() + (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
90
+ };
91
+
92
+ /**
93
+ * Returns the inner width value (without border) for the first matched element.
94
+ * If used on document, returns the document's Width (innerWidth)
95
+ * If used on window, returns the viewport's (window) width
96
+ *
97
+ * @example $("#testdiv").innerWidth()
98
+ * @result 1000
99
+ *
100
+ * @name innerWidth
101
+ * @type Number
102
+ * @cat Plugins/Dimensions
103
+ */
104
+ jQuery.fn.innerWidth = function() {
105
+ return this[0] == window || this[0] == document ?
106
+ this.width() :
107
+ this.css('display') != 'none' ?
108
+ this[0].offsetWidth - (parseInt(this.css("borderLeftWidth")) || 0) - (parseInt(this.css("borderRightWidth")) || 0) :
109
+ this.height() + (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
110
+ };
111
+
112
+ /**
113
+ * Returns the outer height value (including border) for the first matched element.
114
+ * Cannot be used on document or window.
115
+ *
116
+ * @example $("#testdiv").outerHeight()
117
+ * @result 1000
118
+ *
119
+ * @name outerHeight
120
+ * @type Number
121
+ * @cat Plugins/Dimensions
122
+ */
123
+ jQuery.fn.outerHeight = function() {
124
+ return this[0] == window || this[0] == document ?
125
+ this.height() :
126
+ this.css('display') != 'none' ?
127
+ this[0].offsetHeight :
128
+ this.height() + (parseInt(this.css("borderTopWidth")) || 0) + (parseInt(this.css("borderBottomWidth")) || 0)
129
+ + (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
130
+ };
131
+
132
+ /**
133
+ * Returns the outer width value (including border) for the first matched element.
134
+ * Cannot be used on document or window.
135
+ *
136
+ * @example $("#testdiv").outerWidth()
137
+ * @result 1000
138
+ *
139
+ * @name outerWidth
140
+ * @type Number
141
+ * @cat Plugins/Dimensions
142
+ */
143
+ jQuery.fn.outerWidth = function() {
144
+ return this[0] == window || this[0] == document ?
145
+ this.width() :
146
+ this.css('display') != 'none' ?
147
+ this[0].offsetWidth :
148
+ this.height() + (parseInt(this.css("borderLeftWidth")) || 0) + (parseInt(this.css("borderRightWidth")) || 0)
149
+ + (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
150
+ };
151
+
152
+ /**
153
+ * Returns how many pixels the user has scrolled to the right (scrollLeft).
154
+ * Works on containers with overflow: auto and window/document.
155
+ *
156
+ * @example $("#testdiv").scrollLeft()
157
+ * @result 100
158
+ *
159
+ * @name scrollLeft
160
+ * @type Number
161
+ * @cat Plugins/Dimensions
162
+ */
163
+ jQuery.fn.scrollLeft = function() {
164
+ if ( this[0] == window || this[0] == document )
165
+ return self.pageXOffset ||
166
+ jQuery.boxModel && document.documentElement.scrollLeft ||
167
+ document.body.scrollLeft;
168
+
169
+ return this[0].scrollLeft;
170
+ };
171
+
172
+ /**
173
+ * Returns how many pixels the user has scrolled to the bottom (scrollTop).
174
+ * Works on containers with overflow: auto and window/document.
175
+ *
176
+ * @example $("#testdiv").scrollTop()
177
+ * @result 100
178
+ *
179
+ * @name scrollTop
180
+ * @type Number
181
+ * @cat Plugins/Dimensions
182
+ */
183
+ jQuery.fn.scrollTop = function() {
184
+ if ( this[0] == window || this[0] == document )
185
+ return self.pageYOffset ||
186
+ jQuery.boxModel && document.documentElement.scrollTop ||
187
+ document.body.scrollTop;
188
+
189
+ return this[0].scrollTop;
190
+ };
191
+
192
+ /**
193
+ * Returns the location of the element in pixels from the top left corner of the viewport.
194
+ *
195
+ * For accurate readings make sure to use pixel values for margins, borders and padding.
196
+ *
197
+ * @example $("#testdiv").offset()
198
+ * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
199
+ *
200
+ * @example $("#testdiv").offset({ scroll: false })
201
+ * @result { top: 90, left: 90 }
202
+ *
203
+ * @example var offset = {}
204
+ * $("#testdiv").offset({ scroll: false }, offset)
205
+ * @result offset = { top: 90, left: 90 }
206
+ *
207
+ * @name offset
208
+ * @param Object options A hash of options describing what should be included in the final calculations of the offset.
209
+ * The options include:
210
+ * margin: Should the margin of the element be included in the calculations? True by default.
211
+ * If set to false the margin of the element is subtracted from the total offset.
212
+ * border: Should the border of the element be included in the calculations? True by default.
213
+ * If set to false the border of the element is subtracted from the total offset.
214
+ * padding: Should the padding of the element be included in the calculations? False by default.
215
+ * If set to true the padding of the element is added to the total offset.
216
+ * scroll: Should the scroll offsets of the parent elements be included in the calculations?
217
+ * True by default. When true, it adds the total scroll offsets of all parents to the
218
+ * total offset and also adds two properties to the returned object, scrollTop and
219
+ * scrollLeft. If set to false the scroll offsets of parent elements are ignored.
220
+ * If scroll offsets are not needed, set to false to get a performance boost.
221
+ * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
222
+ * chain will not be broken and the result will be assigned to this object.
223
+ * @type Object
224
+ * @cat Plugins/Dimensions
225
+ * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
226
+ */
227
+ jQuery.fn.offset = function(options, returnObject) {
228
+ var x = 0, y = 0, elem = this[0], parent = this[0], absparent=false, relparent=false, op, sl = 0, st = 0, options = jQuery.extend({ margin: true, border: true, padding: false, scroll: true }, options || {});
229
+ do {
230
+ if(parent == null)
231
+ {
232
+ // fix by Thomas Howard , stops some javascript errors with an unknown original cause, somehow parent sometimes ends up empty
233
+ return null;
234
+ }
235
+ x += parent.offsetLeft || 0;
236
+ y += parent.offsetTop || 0;
237
+
238
+ // Mozilla and IE do not add the border
239
+ if (jQuery.browser.mozilla || jQuery.browser.msie) {
240
+ // get borders
241
+ var bt = parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
242
+ var bl = parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
243
+
244
+ // add borders to offset
245
+ x += bl;
246
+ y += bt;
247
+
248
+ // Mozilla removes the border if the parent has overflow property other than visible
249
+ if (jQuery.browser.mozilla && parent != elem && jQuery.css(parent, 'overflow') != 'visible') {
250
+ x += bl;
251
+ y += bt;
252
+ }
253
+
254
+ // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
255
+ if (jQuery.css(parent, 'position') == 'absolute') absparent = true;
256
+ // IE does not include the border on the body if an element is position static and without an absolute or relative parent
257
+ if (jQuery.css(parent, 'position') == 'relative') relparent = true;
258
+ }
259
+
260
+ if (options.scroll) {
261
+ // Need to get scroll offsets in-between offsetParents
262
+ op = parent.offsetParent;
263
+ do {
264
+ sl += parent.scrollLeft || 0;
265
+ st += parent.scrollTop || 0;
266
+
267
+ parent = parent.parentNode;
268
+
269
+ // Mozilla removes the border if the parent has overflow property other than visible
270
+ if (jQuery.browser.mozilla && parent != elem && parent != op && jQuery.css(parent, 'overflow') != 'visible') {
271
+ x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
272
+ y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
273
+ }
274
+ } while (op && parent != op);
275
+ } else
276
+ parent = parent.offsetParent;
277
+
278
+ if (parent && (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html')) {
279
+ // Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
280
+ if ((jQuery.browser.safari || (jQuery.browser.msie && jQuery.boxModel)) && jQuery.css(elem, 'position') != 'absolute') {
281
+ x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;
282
+ y += parseInt(jQuery.css(parent, 'marginTop')) || 0;
283
+ }
284
+ // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
285
+ // IE does not include the border on the body if an element is positioned static and without an absolute or relative parent
286
+ if ( (jQuery.browser.mozilla && !absparent) ||
287
+ (jQuery.browser.msie && jQuery.css(elem, 'position') == 'static' && (!relparent || !absparent)) ) {
288
+ x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
289
+ y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
290
+ }
291
+ break; // Exit the loop
292
+ }
293
+ } while (parent);
294
+
295
+ if ( !options.margin) {
296
+ x -= parseInt(jQuery.css(elem, 'marginLeft')) || 0;
297
+ y -= parseInt(jQuery.css(elem, 'marginTop')) || 0;
298
+ }
299
+
300
+ // Safari and Opera do not add the border for the element
301
+ if ( options.border && (jQuery.browser.safari || jQuery.browser.opera) ) {
302
+ x += parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
303
+ y += parseInt(jQuery.css(elem, 'borderTopWidth')) || 0;
304
+ } else if ( !options.border && !(jQuery.browser.safari || jQuery.browser.opera) ) {
305
+ x -= parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
306
+ y -= parseInt(jQuery.css(elem, 'borderTopWidth')) || 0;
307
+ }
308
+
309
+ if ( options.padding ) {
310
+ x += parseInt(jQuery.css(elem, 'paddingLeft')) || 0;
311
+ y += parseInt(jQuery.css(elem, 'paddingTop')) || 0;
312
+ }
313
+
314
+ // Opera thinks offset is scroll offset for display: inline elements
315
+ if (options.scroll && jQuery.browser.opera && jQuery.css(elem, 'display') == 'inline') {
316
+ sl -= elem.scrollLeft || 0;
317
+ st -= elem.scrollTop || 0;
318
+ }
319
+
320
+ var returnValue = options.scroll ? { top: y - st, left: x - sl, scrollTop: st, scrollLeft: sl }
321
+ : { top: y, left: x };
322
+
323
+ if (returnObject) { jQuery.extend(returnObject, returnValue); return this; }
324
+ else { return returnValue; }
325
+ };
wpsc-admin/js/jquery-ui.js ADDED
@@ -0,0 +1 @@
 
1
+ eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(6(C){C.f={1w:{1l:6(E,F,H){8 G=C.f[E].2N;1z(8 D 6J H){G.2K[D]=G.2K[D]||[];G.2K[D].25([F,H[D]])}},1F:6(D,F,E){8 H=D.2K[F];5(!H){e}1z(8 G=0;G<H.U;G++){5(D.b[H[G][0]]){H[G][1].2E(D.i,E)}}}},3t:{},h:6(D){5(C.f.3t[D]){e C.f.3t[D]}8 E=C(\'<2m 52="f-6I">\').1b(D).h({W:"1r",7:"-4S",c:"-4S",3m:"43"}).1T("1e");C.f.3t[D]=!!((!(/2f|6F/).1h(E.h("1R"))||(/^[1-9]/).1h(E.h("q"))||(/^[1-9]/).1h(E.h("r"))||!(/4O/).1h(E.h("6K"))||!(/6L|6P\\(0, 0, 0, 0\\)/).1h(E.h("6O"))));6u{C("1e").4R(0).53(E.4R(0))}7f(F){}e C.f.3t[D]},74:6(D){C(D).1P("3v","54").h("4N","4O")},71:6(D){C(D).1P("3v","6Q").h("4N","")},5P:6(G,E){8 D=/7/.1h(E||"7")?"14":"13",F=o;5(G[D]>0){e z}G[D]=1;F=G[D]>0?z:o;G[D]=0;e F}};8 B=C.4a.1y;C.4a.1y=6(){C("*",4).1l(4).1N("1y");e B.2E(4,5n)};6 A(E,F,G){8 D=C[E][F].4C||[];D=(3s D=="41"?D.49(/,?\\s+/):D);e(C.3q(G,D)!=-1)}C.2k=6(E,D){8 F=E.49(".")[0];E=E.49(".")[1];C.4a[E]=6(J){8 H=(3s J=="41"),I=5I.2N.5N.1F(5n,1);5(H&&A(F,E,J)){8 G=C.v(4[0],E);e(G?G[J].2E(G,I):1U)}e 4.1n(6(){8 K=C.v(4,E);5(H&&K&&C.32(K[J])){K[J].2E(K,I)}11{5(!H){C.v(4,E,6g C[F][E](4,J))}}})};C[F][E]=6(I,H){8 G=4;4.2o=E;4.5k=F+"-"+E;4.b=C.2c({},C.2k.2v,C[F][E].2v,H);4.i=C(I).1X("2Y."+E,6(L,J,K){e G.2Y(J,K)}).1X("45."+E,6(K,J){e G.45(J)}).1X("1y",6(){e G.2i()});4.3f()};C[F][E].2N=C.2c({},C.2k.2N,D)};C.2k.2N={3f:6(){},2i:6(){4.i.2n(4.2o)},45:6(D){e 4.b[D]},2Y:6(D,E){4.b[D]=E;5(D=="12"){4.i[E?"1b":"1B"](4.5k+"-12")}},4z:6(){4.2Y("12",o)},4u:6(){4.2Y("12",z)}};C.2k.2v={12:o};C.f.3C={4b:6(){8 D=4;4.i.1X("6e."+4.2o,6(E){e D.58(E)});5(C.1O.2u){4.57=4.i.1P("3v");4.i.1P("3v","54")}4.68=o},44:6(){4.i.21("."+4.2o);(C.1O.2u&&4.i.1P("3v",4.57))},58:6(F){(4.27&&4.3k(F));4.3L=F;8 E=4,G=(F.6a==1),D=(3s 4.b.38=="41"?C(F.26).3w().1l(F.26).28(4.b.38).U:o);5(!G||D||!4.42(F)){e z}4.3J=!4.b.39;5(!4.3J){4.6b=3p(6(){E.3J=z},4.b.39)}5(4.4k(F)&&4.4i(F)){4.27=(4.33(F)!==o);5(!4.27){F.6c();e z}}4.4c=6(H){e E.5h(H)};4.4j=6(H){e E.3k(H)};C(l).1X("59."+4.2o,4.4c).1X("5a."+4.2o,4.4j);e o},5h:6(D){5(C.1O.2u&&!D.6d){e 4.3k(D)}5(4.27){4.2p(D);e o}5(4.4k(D)&&4.4i(D)){4.27=(4.33(4.3L,D)!==o);(4.27?4.2p(D):4.3k(D))}e!4.27},3k:6(D){C(l).21("59."+4.2o,4.4c).21("5a."+4.2o,4.4j);5(4.27){4.27=o;4.2O(D)}e o},4k:6(D){e(1m.3u(1m.1V(4.3L.1G-D.1G),1m.1V(4.3L.1L-D.1L))>=4.b.3y)},4i:6(D){e 4.3J},33:6(D){},2p:6(D){},2O:6(D){},42:6(D){e z}};C.f.3C.2v={38:1k,3y:1,39:0}})(3h);(6(A){A.2k("f.17",A.2c({},A.f.3C,{3f:6(){8 B=4.b;5(B.k=="4g"&&!(/(18|1r|1Z)/).1h(4.i.h("W"))){4.i.h("W","18")}4.i.1b("f-17");(B.12&&4.i.1b("f-17-12"));4.4b()},33:6(F){8 H=4.b;5(4.k||H.12||A(F.26).5e(".f-6f-30")){e o}8 C=!4.b.30||!A(4.b.30,4.i).U?z:o;A(4.b.30,4.i).3l("*").4M().1n(6(){5(4==F.26){C=z}});5(!C){e o}5(A.f.1A){A.f.1A.4P=4}4.k=A.32(H.k)?A(H.k.2E(4.i[0],[F])):(H.k=="2W"?4.i.2W():4.i);5(!4.k.3w("1e").U){4.k.1T((H.1T=="n"?4.i[0].1J:H.1T))}5(4.k[0]!=4.i[0]&&!(/(1Z|1r)/).1h(4.k.h("W"))){4.k.h("W","1r")}4.1c={c:(Z(4.i.h("4W"),10)||0),7:(Z(4.i.h("4X"),10)||0)};4.1K=4.k.h("W");4.d=4.i.d();4.d={7:4.d.7-4.1c.7,c:4.d.c-4.1c.c};4.d.t={c:F.1G-4.d.c,7:F.1L-4.d.7};4.X=4.k.X();8 B=4.X.d();5(4.X[0]==l.1e&&A.1O.6m){B={7:0,c:0}}4.d.n={7:B.7+(Z(4.X.h("2I"),10)||0),c:B.c+(Z(4.X.h("2H"),10)||0)};8 E=4.i.W();4.d.18=4.1K=="18"?{7:E.7-(Z(4.k.h("7"),10)||0)+4.X[0].14,c:E.c-(Z(4.k.h("c"),10)||0)+4.X[0].13}:{7:0,c:0};4.1D=4.2D(F);4.V={r:4.k.2C(),q:4.k.2B()};5(H.1s){5(H.1s.c!=1U){4.d.t.c=H.1s.c+4.1c.c}5(H.1s.3r!=1U){4.d.t.c=4.V.r-H.1s.3r+4.1c.c}5(H.1s.7!=1U){4.d.t.7=H.1s.7+4.1c.7}5(H.1s.3T!=1U){4.d.t.7=4.V.q-H.1s.3T+4.1c.7}}5(H.m){5(H.m=="n"){H.m=4.k[0].1J}5(H.m=="l"||H.m=="1H"){4.m=[0-4.d.18.c-4.d.n.c,0-4.d.18.7-4.d.n.7,A(H.m=="l"?l:1H).r()-4.d.18.c-4.d.n.c-4.V.r-4.1c.c-(Z(4.i.h("3X"),10)||0),(A(H.m=="l"?l:1H).q()||l.1e.1J.3W)-4.d.18.7-4.d.n.7-4.V.q-4.1c.7-(Z(4.i.h("3V"),10)||0)]}5(!(/^(l|1H|n)$/).1h(H.m)){8 D=A(H.m)[0];8 G=A(H.m).d();4.m=[G.c+(Z(A(D).h("2H"),10)||0)-4.d.18.c-4.d.n.c,G.7+(Z(A(D).h("2I"),10)||0)-4.d.18.7-4.d.n.7,G.c+1m.3u(D.4U,D.2M)-(Z(A(D).h("2H"),10)||0)-4.d.18.c-4.d.n.c-4.V.r-4.1c.c-(Z(4.i.h("3X"),10)||0),G.7+1m.3u(D.3W,D.2R)-(Z(A(D).h("2I"),10)||0)-4.d.18.7-4.d.n.7-4.V.q-4.1c.7-(Z(4.i.h("3V"),10)||0)]}}4.19("1M",F);4.V={r:4.k.2C(),q:4.k.2B()};5(A.f.1A&&!H.3Q){A.f.1A.4Q(4,F)}4.k.1b("f-17-40");4.2p(F);e z},1I:6(C,D){5(!D){D=4.W}8 B=C=="1r"?1:-1;e{7:(D.7+4.d.18.7*B+4.d.n.7*B-(4.1K=="1Z"||(4.1K=="1r"&&4.X[0]==l.1e)?0:4.X[0].14)*B+(4.1K=="1Z"?A(l).14():0)*B+4.1c.7*B),c:(D.c+4.d.18.c*B+4.d.n.c*B-(4.1K=="1Z"||(4.1K=="1r"&&4.X[0]==l.1e)?0:4.X[0].13)*B+(4.1K=="1Z"?A(l).13():0)*B+4.1c.c*B)}},2D:6(E){8 F=4.b;8 B={7:(E.1L-4.d.t.7-4.d.18.7-4.d.n.7+(4.1K=="1Z"||(4.1K=="1r"&&4.X[0]==l.1e)?0:4.X[0].14)-(4.1K=="1Z"?A(l).14():0)),c:(E.1G-4.d.t.c-4.d.18.c-4.d.n.c+(4.1K=="1Z"||(4.1K=="1r"&&4.X[0]==l.1e)?0:4.X[0].13)-(4.1K=="1Z"?A(l).13():0))};5(!4.1D){e B}5(4.m){5(B.c<4.m[0]){B.c=4.m[0]}5(B.7<4.m[1]){B.7=4.m[1]}5(B.c>4.m[2]){B.c=4.m[2]}5(B.7>4.m[3]){B.7=4.m[3]}}5(F.1q){8 D=4.1D.7+1m.3U((B.7-4.1D.7)/F.1q[1])*F.1q[1];B.7=4.m?(!(D<4.m[1]||D>4.m[3])?D:(!(D<4.m[1])?D-F.1q[1]:D+F.1q[1])):D;8 C=4.1D.c+1m.3U((B.c-4.1D.c)/F.1q[0])*F.1q[0];B.c=4.m?(!(C<4.m[0]||C>4.m[2])?C:(!(C<4.m[0])?C-F.1q[0]:C+F.1q[0])):C}e B},2p:6(B){4.W=4.2D(B);4.1C=4.1I("1r");4.W=4.19("29",B)||4.W;5(!4.b.2t||4.b.2t!="y"){4.k[0].2h.c=4.W.c+"2F"}5(!4.b.2t||4.b.2t!="x"){4.k[0].2h.7=4.W.7+"2F"}5(A.f.1A){A.f.1A.29(4,B)}e o},2O:6(C){8 D=o;5(A.f.1A&&!4.b.3Q){8 D=A.f.1A.5A(4,C)}5((4.b.24=="6o"&&!D)||(4.b.24=="6p"&&D)||4.b.24===z){8 B=4;A(4.k).3b(4.1D,Z(4.b.24,10)||3Z,6(){B.19("1E",C);B.2w()})}11{4.19("1E",C);4.2w()}e o},2w:6(){4.k.1B("f-17-40");5(4.b.k!="4g"&&!4.2Z){4.k.1y()}4.k=1k;4.2Z=o},2K:{},4f:6(B){e{k:4.k,W:4.W,3N:4.1C,b:4.b}},19:6(C,B){A.f.1w.1F(4,C,[B,4.4f()]);5(C=="29"){4.1C=4.1I("1r")}e 4.i.1N(C=="29"?C:"29"+C,[B,4.4f()],4.b[C])},2i:6(){5(!4.i.v("17")){e}4.i.2n("17").21(".17").1B("f-17");4.44()}}));A.2c(A.f.17,{2v:{1T:"n",2t:o,38:":5s",39:0,3y:1,k:"4g"}});A.f.1w.1l("17","1R",{1M:6(D,C){8 B=A("1e");5(B.h("1R")){C.b.2G=B.h("1R")}B.h("1R",C.b.1R)},1E:6(C,B){5(B.b.2G){A("1e").h("1R",B.b.2G)}}});A.f.1w.1l("17","1t",{1M:6(D,C){8 B=A(C.k);5(B.h("1t")){C.b.2S=B.h("1t")}B.h("1t",C.b.1t)},1E:6(C,B){5(B.b.2S){A(B.k).h("1t",B.b.2S)}}});A.f.1w.1l("17","1v",{1M:6(D,C){8 B=A(C.k);5(B.h("1v")){C.b.2U=B.h("1v")}B.h("1v",C.b.1v)},1E:6(C,B){5(B.b.2U){A(B.k).h("1v",B.b.2U)}}});A.f.1w.1l("17","3M",{1M:6(C,B){A(B.b.3M===z?"6k":B.b.3M).1n(6(){A(\'<2m 52="f-17-3M" 2h="6i: #62;"></2m>\').h({r:4.2M+"2F",q:4.2R+"2F",W:"1r",1v:"0.6j",1t:5w}).h(A(4).d()).1T("1e")})},1E:6(C,B){A("2m.6q").1n(6(){4.1J.53(4)})}});A.f.1w.1l("17","1Y",{1M:6(D,C){8 E=C.b;8 B=A(4).v("17");E.1p=E.1p||20;E.1o=E.1o||20;B.1j=6(F){3E{5(/2f|1Y/.1h(F.h("2e"))||(/2f|1Y/).1h(F.h("2e-y"))){e F}F=F.n()}35(F[0].1J);e A(l)}(4);B.1f=6(F){3E{5(/2f|1Y/.1h(F.h("2e"))||(/2f|1Y/).1h(F.h("2e-x"))){e F}F=F.n()}35(F[0].1J);e A(l)}(4);5(B.1j[0]!=l&&B.1j[0].2s!="2r"){B.2Q=B.1j.d()}5(B.1f[0]!=l&&B.1f[0].2s!="2r"){B.2L=B.1f.d()}},29:6(D,C){8 E=C.b;8 B=A(4).v("17");5(B.1j[0]!=l&&B.1j[0].2s!="2r"){5((B.2Q.7+B.1j[0].2R)-D.1L<E.1p){B.1j[0].14=B.1j[0].14+E.1o}5(D.1L-B.2Q.7<E.1p){B.1j[0].14=B.1j[0].14-E.1o}}11{5(D.1L-A(l).14()<E.1p){A(l).14(A(l).14()-E.1o)}5(A(1H).q()-(D.1L-A(l).14())<E.1p){A(l).14(A(l).14()+E.1o)}}5(B.1f[0]!=l&&B.1f[0].2s!="2r"){5((B.2L.c+B.1f[0].2M)-D.1G<E.1p){B.1f[0].13=B.1f[0].13+E.1o}5(D.1G-B.2L.c<E.1p){B.1f[0].13=B.1f[0].13-E.1o}}11{5(D.1G-A(l).13()<E.1p){A(l).13(A(l).13()-E.1o)}5(A(1H).r()-(D.1G-A(l).13())<E.1p){A(l).13(A(l).13()+E.1o)}}}});A.f.1w.1l("17","4m",{1M:6(D,C){8 B=A(4).v("17");B.2A=[];A(C.b.4m===z?".f-17":C.b.4m).1n(6(){8 F=A(4);8 E=F.d();5(4!=B.i[0]){B.2A.25({1g:4,r:F.2C(),q:F.2B(),7:E.7,c:E.c})}})},29:6(J,N){8 I=A(4).v("17");8 L=N.b.5Z||20;8 D=N.3N.c,C=D+I.V.r,P=N.3N.7,O=P+I.V.q;1z(8 H=I.2A.U-1;H>=0;H--){8 E=I.2A[H].c,B=E+I.2A[H].r,R=I.2A[H].7,M=R+I.2A[H].q;5(!((E-L<D&&D<B+L&&R-L<P&&P<M+L)||(E-L<D&&D<B+L&&R-L<O&&O<M+L)||(E-L<C&&C<B+L&&R-L<P&&P<M+L)||(E-L<C&&C<B+L&&R-L<O&&O<M+L))){3g}5(N.b.5c!="5M"){8 K=1m.1V(R-O)<=20;8 Q=1m.1V(M-P)<=20;8 G=1m.1V(E-C)<=20;8 F=1m.1V(B-D)<=20;5(K){N.W.7=I.1I("18",{7:R-I.V.q,c:0}).7}5(Q){N.W.7=I.1I("18",{7:M,c:0}).7}5(G){N.W.c=I.1I("18",{7:0,c:E-I.V.r}).c}5(F){N.W.c=I.1I("18",{7:0,c:B}).c}}5(N.b.5c!="5K"){8 K=1m.1V(R-P)<=20;8 Q=1m.1V(M-O)<=20;8 G=1m.1V(E-D)<=20;8 F=1m.1V(B-C)<=20;5(K){N.W.7=I.1I("18",{7:R,c:0}).7}5(Q){N.W.7=I.1I("18",{7:M-I.V.q,c:0}).7}5(G){N.W.c=I.1I("18",{7:0,c:E}).c}5(F){N.W.c=I.1I("18",{7:0,c:B-I.V.r}).c}}}}});A.f.1w.1l("17","5d",{1M:6(D,C){8 B=A(4).v("17");B.3x=[];A(C.b.5d).1n(6(){5(A.v(4,"15")){8 E=A.v(4,"15");B.3x.25({p:E,5l:E.b.24});E.3Y();E.19("4T",D,B)}})},1E:6(D,C){8 B=A(4).v("17");A.1n(B.3x,6(){5(4.p.2X){4.p.2X=0;B.2Z=z;4.p.2Z=o;5(4.5l){4.p.b.24=z}4.p.2O(D);4.p.i.1N("5X",[D,A.2c(4.p.f(),{5f:B.i})],4.p.b.5H);4.p.b.k=4.p.b.4l}11{4.p.19("5D",D,B)}})},29:6(F,E){8 D=A(4).v("17"),B=4;8 C=6(K){8 H=K.c,J=H+K.r,I=K.7,G=I+K.q;e(H<(4.1C.c+4.d.t.c)&&(4.1C.c+4.d.t.c)<J&&I<(4.1C.7+4.d.t.7)&&(4.1C.7+4.d.t.7)<G)};A.1n(D.3x,6(G){5(C.1F(D,4.p.1S)){5(!4.p.2X){4.p.2X=1;4.p.Y=A(B).2W().1T(4.p.i).v("15-1g",z);4.p.b.4l=4.p.b.k;4.p.b.k=6(){e E.k[0]};F.26=4.p.Y[0];4.p.42(F,z);4.p.33(F,z,z);4.p.d.t.7=D.d.t.7;4.p.d.t.c=D.d.t.c;4.p.d.n.c-=D.d.n.c-4.p.d.n.c;4.p.d.n.7-=D.d.n.7-4.p.d.n.7;D.19("5Y",F)}5(4.p.Y){4.p.2p(F)}}11{5(4.p.2X){4.p.2X=0;4.p.2Z=z;4.p.b.24=o;4.p.2O(F,z);4.p.b.k=4.p.b.4l;4.p.Y.1y();5(4.p.1d){4.p.1d.1y()}D.19("60",F)}}})}});A.f.1w.1l("17","2P",{1M:6(D,B){8 C=A.5U(A(B.b.2P.5Q)).22(6(F,E){e(Z(A(F).h("1t"),10)||B.b.2P.3d)-(Z(A(E).h("1t"),10)||B.b.2P.3d)});A(C).1n(6(E){4.2h.1t=B.b.2P.3d+E});4[0].2h.1t=B.b.2P.3d+C.U}})})(3h);(6(B){6 A(E,D){8 C=B.1O.4F&&B.1O.5R<5S;5(E.5j&&!C){e E.5j(D)}5(E.5i){e!!(E.5i(D)&16)}35(D=D.1J){5(D==E){e z}}e o}B.2k("f.15",B.2c({},B.f.3C,{3f:6(){8 C=4.b;4.1S={};4.i.1b("f-15");4.4J();4.2a=4.u.U?(/c|3r/).1h(4.u[0].1g.h("70")):o;5(!(/(18|1r|1Z)/).1h(4.i.h("W"))){4.i.h("W","18")}4.d=4.i.d();4.4b()},2K:{},f:6(C){e{k:(C||4)["k"],1d:(C||4)["1d"]||B([]),W:(C||4)["W"],3N:(C||4)["1C"],b:4.b,i:4.i,1g:(C||4)["Y"],5f:C?C.i:1k}},19:6(F,E,C,D){B.f.1w.1F(4,F,[E,4.f(C)]);5(!D){4.i.1N(F=="22"?F:"22"+F,[E,4.f(C)],4.b[F])}},5G:6(E){8 C=(B.32(4.b.u)?4.b.u.1F(4.i):B(4.b.u,4.i)).3B(".f-15-k");8 D=[];E=E||{};C.1n(6(){8 F=(B(4).1P(E.6S||"2y")||"").6U(E.5o||(/(.+)[-=4o](.+)/));5(F){D.25((E.51||F[1])+"[]="+(E.51&&E.5o?F[1]:F[2]))}});e D.5b("&")},5E:6(C){8 D=(B.32(4.b.u)?4.b.u.1F(4.i):B(4.b.u,4.i)).3B(".f-15-k");8 E=[];D.1n(6(){E.25(B(4).1P(C||"2y"))});e E},4E:6(J){8 E=4.1C.c,D=E+4.V.r,I=4.1C.7,H=I+4.V.q;8 F=J.c,C=F+J.r,K=J.7,G=K+J.q;5(4.b.3c=="4V"||4.b.6W||(4.b.3c=="4n"&&4.V[4.2a?"r":"q"]>J[4.2a?"r":"q"])){e(I+4.d.t.7>K&&I+4.d.t.7<G&&E+4.d.t.c>F&&E+4.d.t.c<C)}11{e(F<E+(4.V.r/2)&&D-(4.V.r/2)<C&&K<I+(4.V.q/2)&&H-(4.V.q/2)<G)}},5u:6(J){8 E=4.1C.c,D=E+4.V.r,I=4.1C.7,H=I+4.V.q;8 F=J.c,C=F+J.r,K=J.7,G=K+J.q;5(4.b.3c=="4V"||(4.b.3c=="4n"&&4.V[4.2a?"r":"q"]>J[4.2a?"r":"q"])){5(!(I+4.d.t.7>K&&I+4.d.t.7<G&&E+4.d.t.c>F&&E+4.d.t.c<C)){e o}5(4.2a){5(E+4.d.t.c>F&&E+4.d.t.c<F+J.r/2){e 2}5(E+4.d.t.c>F+J.r/2&&E+4.d.t.c<C){e 1}}11{5(I+4.d.t.7>K&&I+4.d.t.7<K+J.q/2){e 2}5(I+4.d.t.7>K+J.q/2&&I+4.d.t.7<G){e 1}}}11{5(!(F<E+(4.V.r/2)&&D-(4.V.r/2)<C&&K<I+(4.V.q/2)&&H-(4.V.q/2)<G)){e o}5(4.2a){5(D>F&&E<F){e 2}5(E<C&&D>C){e 1}}11{5(H>K&&I<K){e 1}5(I<G&&H>G){e 2}}}e o},4J:6(){4.3Y();4.3P()},3Y:6(){4.u=[];4.w=[4];8 D=4.u;8 C=4;8 F=[[B.32(4.b.u)?4.b.u.1F(4.i,1k,{b:4.b,1g:4.Y}):B(4.b.u,4.i),4]];5(4.b.4d){1z(8 G=4.b.4d.U-1;G>=0;G--){8 I=B(4.b.4d[G]);1z(8 E=I.U-1;E>=0;E--){8 H=B.v(I[E],"15");5(H&&!H.b.12){F.25([B.32(H.b.u)?H.b.u.1F(H.i):B(H.b.u,H.i),H]);4.w.25(H)}}}}1z(8 G=F.U-1;G>=0;G--){F[G][0].1n(6(){B.v(4,"15-1g",F[G][1]);D.25({1g:B(4),p:F[G][1],r:0,q:0,c:0,7:0})})}},3P:6(D){5(4.X){8 C=4.X.d();4.d.n={7:C.7+4.3i.7,c:C.c+4.3i.c}}1z(8 F=4.u.U-1;F>=0;F--){5(4.u[F].p!=4.3n&&4.3n&&4.u[F].1g[0]!=4.Y[0]){3g}8 E=4.b.4I?B(4.b.4I,4.u[F].1g):4.u[F].1g;5(!D){4.u[F].r=E[0].2M;4.u[F].q=E[0].2R}8 G=E.d();4.u[F].c=G.c;4.u[F].7=G.7}5(4.b.48&&4.b.48.5p){4.b.48.5p.1F(4)}11{1z(8 F=4.w.U-1;F>=0;F--){8 G=4.w[F].i.d();4.w[F].1S.c=G.c;4.w[F].1S.7=G.7;4.w[F].1S.r=4.w[F].i.2C();4.w[F].1S.q=4.w[F].i.2B()}}},2i:6(){4.i.1B("f-15 f-15-12").2n("15").21(".15");4.44();1z(8 C=4.u.U-1;C>=0;C--){4.u[C].1g.2n("15-1g")}},4h:6(E){8 C=E||4,F=C.b;5(F.1d.5J==7c){8 D=F.1d;F.1d={i:6(){e B("<2m></2m>").1b(D)[0]},34:6(G,H){H.h(G.d()).h({r:G.2C(),q:G.2B()})}}}C.1d=B(F.1d.i.1F(C.i,C.Y)).1T("1e").h({W:"1r"});F.1d.34.1F(C.i,C.Y,C.1d)},5B:6(F){1z(8 D=4.w.U-1;D>=0;D--){5(4.4E(4.w[D].1S)){5(!4.w[D].1S.2z){5(4.3n!=4.w[D]){8 I=76;8 H=1k;8 E=4.1C[4.w[D].2a?"c":"7"];1z(8 C=4.u.U-1;C>=0;C--){5(!A(4.w[D].i[0],4.u[C].1g[0])){3g}8 G=4.u[C][4.w[D].2a?"c":"7"];5(1m.1V(G-E)<I){I=1m.1V(G-E);H=4.u[C]}}5(!H&&!4.b.5z){3g}5(4.1d){4.1d.1y()}5(4.w[D].b.1d){4.w[D].4h(4)}11{4.1d=1k}4.3n=4.w[D];H?4.3O(F,H,1k,z):4.3O(F,1k,4.w[D].i,z);4.19("46",F);4.w[D].19("46",F,4)}4.w[D].19("2z",F,4);4.w[D].1S.2z=1}}11{5(4.w[D].1S.2z){4.w[D].19("5C",F,4);4.w[D].1S.2z=0}}}},42:6(G,F){5(4.b.12||4.b.4s=="78"){e o}4.3Y();8 E=1k,D=4,C=B(G.26).3w().1n(6(){5(B.v(4,"15-1g")==D){E=B(4);e o}});5(B.v(G.26,"15-1g")==D){E=B(G.26)}5(!E){e o}5(4.b.30&&!F){8 H=o;B(4.b.30,E).3l("*").4M().1n(6(){5(4==G.26){H=z}});5(!H){e o}}4.Y=E;e z},33:6(H,F,C){8 J=4.b;4.3n=4;4.3P();4.k=3s J.k=="6"?B(J.k.2E(4.i[0],[H,4.Y])):4.Y.2W();5(!4.k.3w("1e").U){B(J.1T!="n"?J.1T:4.Y[0].1J)[0].5q(4.k[0])}4.k.h({W:"1r",2w:"6B"}).1b("f-15-k");4.1c={c:(Z(4.Y.h("4W"),10)||0),7:(Z(4.Y.h("4X"),10)||0)};4.d=4.Y.d();4.d={7:4.d.7-4.1c.7,c:4.d.c-4.1c.c};4.d.t={c:H.1G-4.d.c,7:H.1L-4.d.7};4.X=4.k.X();8 D=4.X.d();4.3i={7:(Z(4.X.h("2I"),10)||0),c:(Z(4.X.h("2H"),10)||0)};4.d.n={7:D.7+4.3i.7,c:D.c+4.3i.c};4.1D=4.2D(H);4.4e={37:4.Y.37()[0],n:4.Y.n()[0]};4.V={r:4.k.2C(),q:4.k.2B()};5(J.1d){4.4h()}4.19("1M",H);4.V={r:4.k.2C(),q:4.k.2B()};5(J.1s){5(J.1s.c!=1U){4.d.t.c=J.1s.c}5(J.1s.3r!=1U){4.d.t.c=4.V.r-J.1s.3r}5(J.1s.7!=1U){4.d.t.7=J.1s.7}5(J.1s.3T!=1U){4.d.t.7=4.V.q-J.1s.3T}}5(J.m){5(J.m=="n"){J.m=4.k[0].1J}5(J.m=="l"||J.m=="1H"){4.m=[0-4.d.n.c,0-4.d.n.7,B(J.m=="l"?l:1H).r()-4.d.n.c-4.V.r-4.1c.c-(Z(4.i.h("3X"),10)||0),(B(J.m=="l"?l:1H).q()||l.1e.1J.3W)-4.d.n.7-4.V.q-4.1c.7-(Z(4.i.h("3V"),10)||0)]}5(!(/^(l|1H|n)$/).1h(J.m)){8 G=B(J.m)[0];8 I=B(J.m).d();4.m=[I.c+(Z(B(G).h("2H"),10)||0)-4.d.n.c,I.7+(Z(B(G).h("2I"),10)||0)-4.d.n.7,I.c+1m.3u(G.4U,G.2M)-(Z(B(G).h("2H"),10)||0)-4.d.n.c-4.V.r-4.1c.c-(Z(4.Y.h("3X"),10)||0),I.7+1m.3u(G.3W,G.2R)-(Z(B(G).h("2I"),10)||0)-4.d.n.7-4.V.q-4.1c.7-(Z(4.Y.h("3V"),10)||0)]}}5(4.b.1d!="2W"){4.Y.h("5t","6G")}5(!C){1z(8 E=4.w.U-1;E>=0;E--){4.w[E].19("4T",H,4)}}5(B.f.1A){B.f.1A.4P=4}5(B.f.1A&&!J.3Q){B.f.1A.4Q(4,H)}4.40=z;4.2p(H);e z},1I:6(D,E){5(!E){E=4.W}8 C=D=="1r"?1:-1;e{7:(E.7+4.d.n.7*C-(4.X[0]==l.1e?0:4.X[0].14)*C+4.1c.7*C),c:(E.c+4.d.n.c*C-(4.X[0]==l.1e?0:4.X[0].13)*C+4.1c.c*C)}},2D:6(F){8 G=4.b;8 C={7:(F.1L-4.d.t.7-4.d.n.7+(4.X[0]==l.1e?0:4.X[0].14)),c:(F.1G-4.d.t.c-4.d.n.c+(4.X[0]==l.1e?0:4.X[0].13))};5(!4.1D){e C}5(4.m){5(C.c<4.m[0]){C.c=4.m[0]}5(C.7<4.m[1]){C.7=4.m[1]}5(C.c>4.m[2]){C.c=4.m[2]}5(C.7>4.m[3]){C.7=4.m[3]}}5(G.1q){8 E=4.1D.7+1m.3U((C.7-4.1D.7)/G.1q[1])*G.1q[1];C.7=4.m?(!(E<4.m[1]||E>4.m[3])?E:(!(E<4.m[1])?E-G.1q[1]:E+G.1q[1])):E;8 D=4.1D.c+1m.3U((C.c-4.1D.c)/G.1q[0])*G.1q[0];C.c=4.m?(!(D<4.m[0]||D>4.m[2])?D:(!(D<4.m[0])?D-G.1q[0]:D+G.1q[0])):D}e C},2p:6(D){4.W=4.2D(D);4.1C=4.1I("1r");B.f.1w.1F(4,"22",[D,4.f()]);4.1C=4.1I("1r");4.k[0].2h.c=4.W.c+"2F";4.k[0].2h.7=4.W.7+"2F";1z(8 C=4.u.U-1;C>=0;C--){8 E=4.5u(4.u[C]);5(!E){3g}5(4.u[C].1g[0]!=4.Y[0]&&4.Y[E==1?"6y":"37"]()[0]!=4.u[C].1g[0]&&!A(4.Y[0],4.u[C].1g[0])&&(4.b.4s=="6C-6z"?!A(4.i[0],4.u[C].1g[0]):z)){4.5v=E==1?"5x":"6R";4.3O(D,4.u[C]);4.19("46",D);79}}4.5B(D);5(B.f.1A){B.f.1A.29(4,D)}4.i.1N("22",[D,4.f()],4.b.22);e o},3O:6(H,G,D,F){D?D[0].5q(4.Y[0]):G.1g[0].1J.4y(4.Y[0],(4.5v=="5x"?G.1g[0]:G.1g[0].7d));4.3a=4.3a?++4.3a:1;8 E=4,C=4.3a;1H.3p(6(){5(C==E.3a){E.3P(!F)}},0);5(4.b.1d){4.b.1d.34.1F(4.i,4.Y,4.1d)}},2O:6(E,D){5(B.f.1A&&!4.b.3Q){B.f.1A.5A(4,E)}5(4.b.24){8 C=4;8 F=C.Y.d();5(C.1d){C.1d.3b({1v:"5y"},(Z(4.b.24,10)||3Z)-50)}B(4.k).3b({c:F.c-4.d.n.c-C.1c.c+(4.X[0]==l.1e?0:4.X[0].13),7:F.7-4.d.n.7-C.1c.7+(4.X[0]==l.1e?0:4.X[0].14)},Z(4.b.24,10)||3Z,6(){C.2w(E)})}11{4.2w(E,D)}e o},2w:6(E,D){5(4.4e.37!=4.Y.37().3B(".f-15-k")[0]||4.4e.n!=4.Y.n()[0]){4.19("34",E,1k,D)}5(!A(4.i[0],4.Y[0])){4.19("1y",E,1k,D);1z(8 C=4.w.U-1;C>=0;C--){5(A(4.w[C].i[0],4.Y[0])){4.w[C].19("34",E,4,D);4.w[C].19("5H",E,4,D)}}}1z(8 C=4.w.U-1;C>=0;C--){4.w[C].19("5D",E,4,D);5(4.w[C].1S.2z){4.w[C].19("5C",E,4);4.w[C].1S.2z=0}}4.40=o;5(4.2Z){4.19("1E",E,1k,D);e o}B(4.Y).h("5t","");5(4.1d){4.1d.1y()}4.k.1y();4.k=1k;4.19("1E",E,1k,D);e z}}));B.2c(B.f.15,{4C:"5G 5E",2v:{k:"2W",3c:"4n",3y:1,39:0,1Y:z,1p:20,1o:20,38:":5s",u:"> *",1t:5w,5z:z,1T:"n"}});B.f.1w.1l("15","1R",{1M:6(E,D){8 C=B("1e");5(C.h("1R")){D.b.2G=C.h("1R")}C.h("1R",D.b.1R)},1E:6(D,C){5(C.b.2G){B("1e").h("1R",C.b.2G)}}});B.f.1w.1l("15","1t",{1M:6(E,D){8 C=D.k;5(C.h("1t")){D.b.2S=C.h("1t")}C.h("1t",D.b.1t)},1E:6(D,C){5(C.b.2S){B(C.k).h("1t",C.b.2S)}}});B.f.1w.1l("15","1v",{1M:6(E,D){8 C=D.k;5(C.h("1v")){D.b.2U=C.h("1v")}C.h("1v",D.b.1v)},1E:6(D,C){5(C.b.2U){B(C.k).h("1v",C.b.2U)}}});B.f.1w.1l("15","1Y",{1M:6(E,D){8 F=D.b;8 C=B(4).v("15");C.1j=6(G){3E{5(/2f|1Y/.1h(G.h("2e"))||(/2f|1Y/).1h(G.h("2e-y"))){e G}G=G.n()}35(G[0].1J);e B(l)}(C.Y);C.1f=6(G){3E{5(/2f|1Y/.1h(G.h("2e"))||(/2f|1Y/).1h(G.h("2e-x"))){e G}G=G.n()}35(G[0].1J);e B(l)}(C.Y);5(C.1j[0]!=l&&C.1j[0].2s!="2r"){C.2Q=C.1j.d()}5(C.1f[0]!=l&&C.1f[0].2s!="2r"){C.2L=C.1f.d()}},22:6(E,D){8 F=D.b;8 C=B(4).v("15");5(C.1j[0]!=l&&C.1j[0].2s!="2r"){5((C.2Q.7+C.1j[0].2R)-E.1L<F.1p){C.1j[0].14=C.1j[0].14+F.1o}5(E.1L-C.2Q.7<F.1p){C.1j[0].14=C.1j[0].14-F.1o}}11{5(E.1L-B(l).14()<F.1p){B(l).14(B(l).14()-F.1o)}5(B(1H).q()-(E.1L-B(l).14())<F.1p){B(l).14(B(l).14()+F.1o)}}5(C.1f[0]!=l&&C.1f[0].2s!="2r"){5((C.2L.c+C.1f[0].2M)-E.1G<F.1p){C.1f[0].13=C.1f[0].13+F.1o}5(E.1G-C.2L.c<F.1p){C.1f[0].13=C.1f[0].13-F.1o}}11{5(E.1G-B(l).13()<F.1p){B(l).13(B(l).13()-F.1o)}5(B(1H).r()-(E.1G-B(l).13())<F.1p){B(l).13(B(l).13()+F.1o)}}}});B.f.1w.1l("15","2t",{22:6(E,D){8 C=B(4).v("15");5(D.b.2t=="y"){C.W.c=C.1D.c}5(D.b.2t=="x"){C.W.7=C.1D.7}}})})(3h);(6(A){A.2k("f.j",{3f:6(){4.b.2b+=".j";4.3o(z)},2Y:6(B,C){5((/^1a/).1h(B)){4.36(C)}11{4.b[B]=C;4.3o()}},U:6(){e 4.$j.U},4x:6(B){e B.5r&&B.5r.2J(/\\s/g,"4o").2J(/[^A-66-5L-9\\-4o:\\.]/g,"")||4.b.5g+A.v(B)},f:6(C,B){e{b:4.b,61:C,5F:B,2j:4.$j.2j(C)}},3o:6(O){4.$1u=A("3I:5W(a[1Q])",4.i);4.$j=4.$1u.3R(6(){e A("a",4)[0]});4.$1i=A([]);8 P=4,D=4.b;4.$j.1n(6(R,Q){5(Q.2d&&Q.2d.2J("#","")){P.$1i=P.$1i.1l(Q.2d)}11{5(A(Q).1P("1Q")!="#"){A.v(Q,"1Q.j",Q.1Q);A.v(Q,"1W.j",Q.1Q);8 T=P.4x(Q);Q.1Q="#"+T;8 S=A("#"+T);5(!S.U){S=A(D.4A).1P("2y",T).1b(D.3j).5T(P.$1i[R-1]||P.i);S.v("2i.j",z)}P.$1i=P.$1i.1l(S)}11{D.12.25(R+1)}}});5(O){4.i.1b(D.4r);4.$1i.1n(6(){8 Q=A(4);Q.1b(D.3j)});5(D.1a===1U){5(4t.2d){4.$j.1n(6(S,Q){5(Q.2d==4t.2d){D.1a=S;5(A.1O.2u||A.1O.6T){8 R=A(4t.2d),T=R.1P("2y");R.1P("2y","");3p(6(){R.1P("2y",T)},3Z)}6V(0,0);e o}})}11{5(D.2V){8 J=Z(A.2V("f-j"+A.v(P.i)),10);5(J&&P.$j[J]){D.1a=J}}11{5(P.$1u.28("."+D.1x).U){D.1a=P.$1u.2j(P.$1u.28("."+D.1x)[0])}}}}D.1a=D.1a===1k||D.1a!==1U?D.1a:0;D.12=A.7a(D.12.7b(A.3R(4.$1u.28("."+D.2x),6(R,Q){e P.$1u.2j(R)}))).22();5(A.3q(D.1a,D.12)!=-1){D.12.75(A.3q(D.1a,D.12),1)}4.$1i.1b(D.2l);4.$1u.1B(D.1x);5(D.1a!==1k){4.$1i.23(D.1a).4w().1B(D.2l);4.$1u.23(D.1a).1b(D.1x);8 K=6(){A(P.i).1N("3K",[P.2g("3K"),P.f(P.$j[D.1a],P.$1i[D.1a])],D.4w)};5(A.v(4.$j[D.1a],"1W.j")){4.1W(D.1a,K)}11{K()}}A(1H).1X("73",6(){P.$j.21(".j");P.$1u=P.$j=P.$1i=1k})}1z(8 G=0,N;N=4.$1u[G];G++){A(N)[A.3q(G,D.12)!=-1&&!A(N).31(D.1x)?"1b":"1B"](D.2x)}5(D.2q===o){4.$j.2n("2q.j")}8 C,I,B={"3d-r":0,4v:1},E="6t";5(D.2T&&D.2T.5J==5I){C=D.2T[0]||B,I=D.2T[1]||B}11{C=I=D.2T||B}8 H={3m:"",2e:"",q:""};5(!A.1O.2u){H.1v=""}6 M(R,Q,S){Q.3b(C,C.4v||E,6(){Q.1b(D.2l).h(H);5(A.1O.2u&&C.1v){Q[0].2h.28=""}5(S){L(R,S,Q)}})}6 L(R,S,Q){5(I===B){S.h("3m","43")}S.3b(I,I.4v||E,6(){S.1B(D.2l).h(H);5(A.1O.2u&&I.1v){S[0].2h.28=""}A(P.i).1N("3K",[P.2g("3K"),P.f(R,S[0])],D.4w)})}6 F(R,T,Q,S){T.1b(D.1x).6H().1B(D.1x);M(R,Q,S)}4.$j.21(".j").1X(D.2b,6(){8 T=A(4).3w("3I:23(0)"),Q=P.$1i.28(":5O"),S=A(4.2d);5((T.31(D.1x)&&!D.3A)||T.31(D.2x)||A(4).31(D.3e)||A(P.i).1N("5m",[P.2g("5m"),P.f(4,S[0])],D.36)===o){4.3S();e o}P.b.1a=P.$j.2j(4);5(D.3A){5(T.31(D.1x)){P.b.1a=1k;T.1B(D.1x);P.$1i.1E();M(4,Q);4.3S();e o}11{5(!Q.U){P.$1i.1E();8 R=4;P.1W(P.$j.2j(4),6(){T.1b(D.1x).1b(D.4B);L(R,S)});4.3S();e o}}}5(D.2V){A.2V("f-j"+A.v(P.i),P.b.1a,D.2V)}P.$1i.1E();5(S.U){8 R=4;P.1W(P.$j.2j(4),Q.U?6(){F(R,T,Q,S)}:6(){T.1b(D.1x);L(R,S)})}11{6N"3h 6M 6E: 6D 6w 6v."}5(A.1O.2u){4.3S()}e o});5(!(/^t/).1h(D.2b)){4.$j.1X("t.j",6(){e o})}},1l:6(E,D,C){5(C==1U){C=4.$j.U}8 G=4.b;8 I=A(G.4K.2J(/#\\{1Q\\}/g,E).2J(/#\\{3G\\}/g,D));I.v("2i.j",z);8 H=E.6s("#")==0?E.2J("#",""):4.4x(A("a:6x-6A",I)[0]);8 F=A("#"+H);5(!F.U){F=A(G.4A).1P("2y",H).1b(G.2l).v("2i.j",z)}F.1b(G.3j);5(C>=4.$1u.U){I.1T(4.i);F.1T(4.i[0].1J)}11{I.4y(4.$1u[C]);F.4y(4.$1i[C])}G.12=A.3R(G.12,6(K,J){e K>=C?++K:K});4.3o();5(4.$j.U==1){I.1b(G.1x);F.1B(G.2l);8 B=A.v(4.$j[0],"1W.j");5(B){4.1W(C,B)}}4.i.1N("4Z",[4.2g("4Z"),4.f(4.$j[C],4.$1i[C])],G.1l)},1y:6(B){8 D=4.b,E=4.$1u.23(B).1y(),C=4.$1i.23(B).1y();5(E.31(D.1x)&&4.$j.U>1){4.36(B+(B+1<4.$j.U?1:-1))}D.12=A.3R(A.4D(D.12,6(G,F){e G!=B}),6(G,F){e G>=B?--G:G});4.3o();4.i.1N("4G",[4.2g("4G"),4.f(E.3l("a")[0],C[0])],D.1y)},4z:6(B){8 C=4.b;5(A.3q(B,C.12)==-1){e}8 D=4.$1u.23(B).1B(C.2x);5(A.1O.4F){D.h("3m","77-43");3p(6(){D.h("3m","43")},0)}C.12=A.4D(C.12,6(F,E){e F!=B});4.i.1N("4H",[4.2g("4H"),4.f(4.$j[B],4.$1i[B])],C.4z)},4u:6(C){8 B=4,D=4.b;5(C!=D.1a){4.$1u.23(C).1b(D.2x);D.12.25(C);D.12.22();4.i.1N("4L",[4.2g("4L"),4.f(4.$j[C],4.$1i[C])],D.4u)}},36:6(B){5(3s B=="41"){B=4.$j.2j(4.$j.28("[1Q$="+B+"]")[0])}4.$j.23(B).7e(4.b.2b)},1W:6(G,K){8 L=4,D=4.b,E=4.$j.23(G),J=E[0],H=K==1U||K===o,B=E.v("1W.j");K=K||6(){};5(!B||!H&&A.v(J,"2q.j")){K();e}8 M=6(N){8 O=A(N),P=O.3l("*:6X");e P.U&&P.5e(":3B(6r)")&&P||O};8 C=6(){L.$j.28("."+D.3e).1B(D.3e).1n(6(){5(D.3H){M(4).n().3z(M(4).v("3G.j"))}});L.3D=1k};5(D.3H){8 I=M(J).3z();M(J).6Z("<4p></4p>").3l("4p").v("3G.j",I).3z(D.3H)}8 F=A.2c({},D.3F,{56:B,4q:6(O,N){A(J.2d).3z(O);C();5(D.2q){A.v(J,"2q.j",z)}A(L.i).1N("55",[L.2g("55"),L.f(L.$j[G],L.$1i[G])],D.1W);D.3F.4q&&D.3F.4q(O,N);K()}});5(4.3D){4.3D.6n();C()}E.1b(D.3e);3p(6(){L.3D=A.67(F)},0)},56:6(C,B){4.$j.23(C).2n("2q.j").v("1W.j",B)},2i:6(){8 B=4.b;4.i.21(".j").1B(B.4r).2n("j");4.$j.1n(6(){8 C=A.v(4,"1Q.j");5(C){4.1Q=C}8 D=A(4).21(".j");A.1n(["1Q","1W","2q"],6(E,F){D.2n(F+".j")})});4.$1u.1l(4.$1i).1n(6(){5(A.v(4,"2i.j")){A(4).1y()}11{A(4).1B([B.1x,B.4B,B.2x,B.3j,B.2l].5b(" "))}})},2g:6(B){e A.2b.63({4s:B,26:4.i[0]})}});A.f.j.2v={3A:o,2b:"t",12:[],2V:1k,3H:"6Y&#6l;",2q:o,5g:"f-j-",3F:{},2T:1k,4K:\'<3I><a 1Q="#{1Q}"><4Y>#{3G}</4Y></a></3I>\',4A:"<2m></2m>",4r:"f-j-65",1x:"f-j-1a",4B:"f-j-3A",2x:"f-j-12",3j:"f-j-5F",2l:"f-j-5y",3e:"f-j-64"};A.f.j.4C="U";A.2c(A.f.j.2N,{47:1k,6h:6(C,F){F=F||o;8 B=4,E=4.b.1a;6 G(){B.47=5V(6(){E=++E<B.$j.U?E:0;B.36(E)},C)}6 D(H){5(!H||H.72){69(B.47)}}5(C){G();5(!F){4.$j.1X(4.b.2b,D)}11{4.$j.1X(4.b.2b,6(){D();E=B.b.1a;G()})}}11{D();4.$j.21(4.b.2b,D)}}})})(3h);',62,450,'||||this|if|function|top|var|||options|left|offset|return|ui||css|element|tabs|helper|document|containment|parent|false|instance|height|width||click|items|data|containers|||true|||||||||||||||||||||length|helperProportions|position|offsetParent|currentItem|parseInt||else|disabled|scrollLeft|scrollTop|sortable||draggable|relative|propagate|selected|addClass|margins|placeholder|body|overflowX|item|test|panels|overflowY|null|add|Math|each|scrollSpeed|scrollSensitivity|grid|absolute|cursorAt|zIndex|lis|opacity|plugin|selectedClass|remove|for|ddmanager|removeClass|positionAbs|originalPosition|stop|call|pageX|window|convertPositionTo|parentNode|cssPosition|pageY|start|triggerHandler|browser|attr|href|cursor|containerCache|appendTo|undefined|abs|load|bind|scroll|fixed||unbind|sort|eq|revert|push|target|_mouseStarted|filter|drag|floating|event|extend|hash|overflow|auto|fakeEvent|style|destroy|index|widget|hideClass|div|removeData|widgetName|mouseDrag|cache|HTML|tagName|axis|msie|defaults|clear|disabledClass|id|over|snapElements|outerHeight|outerWidth|generatePosition|apply|px|_cursor|borderLeftWidth|borderTopWidth|replace|plugins|overflowXOffset|offsetWidth|prototype|mouseStop|stack|overflowYOffset|offsetHeight|_zIndex|fx|_opacity|cookie|clone|isOver|setData|cancelHelperRemoval|handle|hasClass|isFunction|mouseStart|update|while|select|prev|cancel|delay|counter|animate|tolerance|min|loadingClass|init|continue|jQuery|offsetParentBorders|panelClass|mouseUp|find|display|currentContainer|tabify|setTimeout|inArray|right|typeof|cssCache|max|unselectable|parents|sortables|distance|html|unselect|not|mouse|xhr|do|ajaxOptions|label|spinner|li|_mouseDelayMet|tabsshow|_mouseDownEvent|iframeFix|absolutePosition|rearrange|refreshPositions|dropBehaviour|map|blur|bottom|round|marginBottom|scrollHeight|marginRight|refreshItems|500|dragging|string|mouseCapture|block|mouseDestroy|getData|change|rotation|custom|split|fn|mouseInit|_mouseMoveDelegate|connectWith|domPosition|uiHash|original|createPlaceholder|mouseDelayMet|_mouseUpDelegate|mouseDistanceMet|_helper|snap|guess|_|em|success|navClass|type|location|disable|duration|show|tabId|insertBefore|enable|panelTemplate|unselectClass|getter|grep|intersectsWith|safari|tabsremove|tabsenable|toleranceElement|refresh|tabTemplate|tabsdisable|andSelf|MozUserSelect|none|current|prepareOffsets|get|5000px|activate|scrollWidth|pointer|marginLeft|marginTop|span|tabsadd||key|class|removeChild|on|tabsload|url|_mouseUnselectable|mouseDown|mousemove|mouseup|join|snapMode|connectToSortable|is|sender|idPrefix|mouseMove|compareDocumentPosition|contains|widgetBaseClass|shouldRevert|tabsselect|arguments|expression|refreshContainers|appendChild|title|input|visibility|intersectsWithEdge|direction|1000|down|hide|dropOnEmpty|drop|contactContainers|out|deactivate|toArray|panel|serialize|receive|Array|constructor|outer|z0|inner|slice|visible|hasScroll|group|version|522|insertAfter|makeArray|setInterval|has|sortreceive|toSortable|snapTolerance|fromSortable|tab|fff|fix|loading|nav|Za|ajax|started|clearInterval|which|_mouseDelayTimer|preventDefault|button|mousedown|resizable|new|rotate|background|001|iframe|8230|mozilla|abort|invalid|valid|DragDropIframeFix|img|indexOf|normal|try|identifier|fragment|first|next|dynamic|child|both|semi|Mismatching|Tabs|default|hidden|siblings|gen|in|backgroundImage|transparent|UI|throw|backgroundColor|rgba|off|up|attribute|opera|match|scrollTo|forcePointerForContainers|last|Loading|wrapInner|float|enableSelection|clientX|unload|disableSelection|splice|10000|inline|static|break|unique|concat|String|nextSibling|trigger|catch'.split('|'),0,{}))
wpsc-admin/js/media.js DELETED
@@ -1,401 +0,0 @@
1
- /*global _, WPSC_Media, Backbone, alert, WPSC, wp, wpsc_refresh_variation_iframe, wpsc_set_variation_product_thumbnail, jQuery, WPRemoveThumbnail */
2
- (function($) {
3
- "use strict";
4
- window.WPSC = window.WPSC || {};
5
-
6
- /**
7
- * Inspired by Cocktail (https://github.com/onsi/cocktail/) but with some
8
- * important modifications.
9
- *
10
- * Mixing an object into a class' prototype will make sure that object is
11
- * extended from previous Mixins / oroginal prototype.
12
- *
13
- * Primitive values can also be mixed in.
14
- *
15
- * @param {Object} object The original object
16
- * @param {...Object} mixins Mixins
17
- */
18
- window.WPSC.mixin = function( clss ) {
19
- var modules = _.rest( arguments );
20
- var chain = {};
21
-
22
- _.each( modules, function( module ) {
23
- var override = module._mixin_override || [];
24
- module = _.omit( module, [ '_mixin_override'] );
25
-
26
- _.each( module, function( value, key ) {
27
- if ( _.contains( override, key ) ) {
28
- chain[key] = [value];
29
- return;
30
- }
31
-
32
- if ( _.isFunction( value ) ) {
33
- if ( clss.prototype[key] )
34
- chain[key] = [clss.prototype[key]];
35
-
36
- chain[key].push( value );
37
- } else if ( _.isObject( value ) ) {
38
- chain[key] = chain[key] || [{}];
39
- if ( clss.prototype[key] )
40
- chain[key] = [clss.prototype[key]];
41
-
42
- chain[key].push( _.extend( {}, chain[key][0], value ) );
43
- } else {
44
- chain[key] = chain[key] || [];
45
- chain[key].push( value );
46
- }
47
- } );
48
- } );
49
-
50
- _.each( chain, function( values, key ) {
51
- var last = _.last( values );
52
-
53
- if ( ! _.isFunction( last ) ) {
54
- clss.prototype[key] = last;
55
- return;
56
- }
57
-
58
- clss.prototype[key] = function() {
59
- var ret, args = arguments, that = this;
60
- _.each( values, function( fn ) {
61
- var fnRet = fn.apply( that, args );
62
- ret =
63
- _.isUndefined( fnRet ) ?
64
- ret :
65
- fnRet;
66
- });
67
-
68
- return ret;
69
- };
70
- } );
71
- };
72
-
73
- var media = window.wp.media;
74
-
75
- var backup = _.clone( media.view.settings.post );
76
-
77
- media.controller.wpsc = {
78
- ProductGallery: media.controller.Library.extend({
79
- defaults: _.defaults({
80
- id : 'wpsc-product-gallery',
81
- filterable : 'uploaded',
82
- multiple : 'add',
83
- toolbar : 'wpsc-save-gallery',
84
- title : WPSC_Media.l10n.productMediaTitle,
85
- priority : 50,
86
- library : media.query( { type: 'image' } ),
87
- syncSelection: false
88
- }, media.controller.Library.prototype.defaults ),
89
-
90
- initialize: function( options ) {
91
- options = options || {};
92
- var selection = new media.model.wpsc.ProductGallerySelection(
93
- [],
94
- {
95
- postId: media.model.settings.post.id,
96
- multiple: this.get( 'multiple' ),
97
- updateNonce: options.updateNonce || WPSC_Media.updateGalleryNonce,
98
- getNonce: options.getNonce || WPSC_Media.getGalleryNonce
99
- }
100
- );
101
- this.set(
102
- 'selection',
103
- selection
104
- );
105
-
106
- var models = options.models || WPSC_Media.gallery;
107
-
108
- // work around for backbone.js 0.9.2
109
- if ( _.isUndefined( Backbone.Collection.prototype.set ) ) {
110
- // force parse the response
111
- models = selection.parse( models );
112
- selection.reset( models );
113
- } else {
114
- selection.set( models, { parse: true } );
115
- }
116
-
117
- media.controller.Library.prototype.initialize.apply( this, arguments );
118
-
119
- this.on( 'select', function() {
120
- selection.save_gallery();
121
- } );
122
-
123
- this.on( 'reset', function() {
124
- selection.get_gallery();
125
- }) ;
126
-
127
- this.get( 'library' ).observe( selection );
128
- }
129
- })
130
- };
131
-
132
- media.model.wpsc = {
133
- ProductGallerySelection: media.model.Selection.extend( {
134
- initialize: function( models, options ) {
135
- media.model.Selection.prototype.initialize.apply( this, [models, options] );
136
- this.postId = options && options.postId;
137
- this.updateNonce = options.updateNonce || WPSC_Media.updateGalleryNonce;
138
- this.getNonce = options.getNonce || WPSC_Media.getGalleryNonce;
139
- },
140
-
141
- save_gallery: function( options ) {
142
- options = _.extend( options || {}, {
143
- data: {
144
- items: this.pluck( 'id' )
145
- },
146
- success: function( resp, status, xhr ) {
147
- // in case of backbone 0.9.2
148
- if ( _.isUndefined( this.set ) ) {
149
- // force parse the response
150
- resp.obj = this.parse( resp.obj, xhr );
151
- this.reset( resp.obj );
152
- } else {
153
- this.set( resp.obj, { parse: true } );
154
- }
155
-
156
- wpsc_update_product_gallery_tab(resp.obj);
157
- },
158
- error: function( resp ) {
159
- alert( resp.error.messages.join( "\n" ) );
160
- }
161
- } );
162
- this.sync( 'update', this, options );
163
- },
164
-
165
- get_gallery: function( options ) {
166
- options = _.extend( options || {}, {
167
- success: function( resp, status, xhr ) {
168
- // in case of backbone 0.9.2
169
- if ( _.isUndefined( this.set ) ) {
170
- // force parse the response
171
- resp.obj = this.parse( resp.obj, xhr );
172
- this.reset( resp.obj );
173
- } else {
174
- this.set( resp.obj, { parse: true } );
175
- }
176
- wpsc_refresh_variation_iframe();
177
- },
178
- error: function( resp ) {
179
- alert( resp.error.messages.join( "\n" ) );
180
- }
181
- } );
182
- this.sync( 'read', this, options );
183
- },
184
-
185
- sync: function( method, collection, options ) {
186
-
187
- var data;
188
- options = options ? _.clone( options ) : {};
189
-
190
- options.success = _.bind( options.success, this );
191
- options.error = _.bind( options.error, this );
192
-
193
- switch (method) {
194
- case 'read':
195
- options.data = options.data || {};
196
- data = _.defaults( {
197
- action: 'get_product_gallery',
198
- nonce : this.getNonce,
199
- postId: this.postId
200
- }, options.data );
201
- break;
202
-
203
- case 'update':
204
- options.data = options.data || {};
205
- data = _.defaults( {
206
- action: 'save_product_gallery',
207
- nonce : this.updateNonce,
208
- items : this.pluck( 'id' ),
209
- postId: this.postId
210
- }, options.data );
211
-
212
- break;
213
-
214
- case 'create':
215
- case 'delete':
216
- // do nothing for now
217
- break;
218
- }
219
-
220
- $.wpsc_post( data ).done( function( resp, status, xhr ) {
221
- if ( resp.is_successful ) {
222
- options.success( resp, status, xhr );
223
- } else {
224
- options.error( resp, status, xhr );
225
- }
226
- } );
227
- }
228
- } )
229
- };
230
-
231
- media.view.wpsc = {
232
- };
233
-
234
- /**
235
- * Extend the MediaFrame.Post class so that we can inject a custom tab
236
- * dynamically using JavaScript.
237
- */
238
- WPSC.mixin(
239
- media.view.MediaFrame.Post,
240
- {
241
- wpsc: {
242
- saveGalleryStatusBar: function( view ) {
243
- this.selectionStatusToolbar(view);
244
- },
245
- saveGalleryToolbar: function( toolbar ) {
246
- this.createSelectToolbar( toolbar, {
247
- text : WPSC_Media.l10n.saveGallery,
248
- state: this.options.state,
249
- reset: false
250
- } );
251
- },
252
- createStates: function() {
253
- this.states.add( new media.controller.wpsc.ProductGallery( { models: this.options.models, updateNonce: this.options.updateNonce, getNonce: this.options.getNonce } ) );
254
- },
255
- bindHandlers: function() {
256
- this.on( 'toolbar:create:wpsc-save-gallery', this.wpsc.saveGalleryToolbar, this );
257
- this.on( 'toolbar:render:wpsc-save-gallery', this.wpsc.saveGalleryStatusBar, this );
258
- }
259
- },
260
-
261
- initialize: function() {
262
- if ( ! this.options.models )
263
- this.options.models = WPSC_Media.gallery;
264
-
265
- if ( ! this.options.updateNonce )
266
- this.options.updateNonce = WPSC_Media.updateGalleryNonce;
267
-
268
- if ( ! this.options.getNonce )
269
- this.options.getNonce = WPSC_Media.getGalleryNonce;
270
-
271
- this.wpsc.createStates.apply( this );
272
- this.wpsc.bindHandlers.apply( this );
273
- }
274
- }
275
- );
276
-
277
- /**
278
- * Extend media.view.Attachment
279
- */
280
- WPSC.mixin(
281
- media.view.Attachment,
282
- {
283
- render: function() {
284
- if ( this.controller.state().id != 'wpsc-product-gallery' )
285
- return;
286
-
287
- if ( this.model.id != media.view.settings.post.featuredImageId )
288
- return;
289
-
290
- this.$el.find( '.thumbnail' ).append('<span class="wpsc-featured-label">featured</span>');
291
- }
292
- }
293
- );
294
-
295
- WPSC_Media.open = function( options ) {
296
- var workflow;
297
-
298
- media.view.settings.post.id = options.id;
299
- media.view.settings.post.featuredImageId = options.featuredId;
300
- media.view.settings.post.nonce = options.featuredNonce;
301
- media.model.settings.post = media.view.settings.post;
302
- media.editor.remove( 'wpsc-variation-media' );
303
- media.editor.add( 'wpsc-variation-media', {
304
- models: options.models,
305
- updateNonce: options.galleryUpdateNonce,
306
- getNonce: options.galleryGetNonce
307
- });
308
- workflow = media.editor.open( 'wpsc-variation-media' );
309
- };
310
-
311
- var oldEditorOpen = media.editor.open;
312
- media.editor.open = function( id ) {
313
- if ( id == 'content' ) {
314
- if ( media.view.settings.post.id == backup.id ) {
315
- // always make sure the backup copy is up to date
316
- backup = _.clone( media.view.settings.post );
317
- } else {
318
- // if the frame was opened for a variation previously, this time
319
- // restore the globals from the backup
320
- media.view.settings.post = _.clone( backup );
321
- media.model.settings.post = media.view.settings.post;
322
- }
323
- }
324
- return oldEditorOpen.apply( this, arguments );
325
- };
326
-
327
- // hack the set featured image function
328
- wp.media.featuredImage.set = function( id ) {
329
- var settings = wp.media.view.settings;
330
- var currentId = settings.post.id;
331
-
332
- settings.post.featuredImageId = id;
333
-
334
- wp.media.post( 'set-post-thumbnail', {
335
- json: true,
336
- post_id: settings.post.id,
337
- thumbnail_id: settings.post.featuredImageId,
338
- _wpnonce: settings.post.nonce
339
- }).done( function( html ) {
340
- if ( currentId == backup.id ) {
341
- wpsc_refresh_variation_iframe();
342
- $( '.inside', '#postimagediv' ).html( html );
343
- } else {
344
- wpsc_set_variation_product_thumbnail( currentId, $( html ).find( 'img' ).attr( 'src' ), id );
345
- }
346
- });
347
- };
348
-
349
- // hack the Remove thumbnail link so that it refreshes the variation iframe
350
- // after the AJAX request is processed
351
- WPRemoveThumbnail = function(nonce){
352
- $.post( ajaxurl, {
353
- action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
354
- }, function(str){
355
- if ( str == '0' ) {
356
- alert( setPostThumbnailL10n.error );
357
- } else {
358
- WPSetThumbnailHTML(str);
359
- wpsc_refresh_variation_iframe();
360
- }
361
- }
362
- );
363
- };
364
-
365
-
366
- $(function() {
367
- $('#wpsc-manage-product-gallery').on('click', function( e ) {
368
- var frame;
369
-
370
- e.preventDefault();
371
- e.stopPropagation();
372
-
373
- frame = wp.media({
374
- state: 'wpsc-product-gallery',
375
- states: [ new wp.media.controller.wpsc.ProductGallery() ]
376
- });
377
-
378
- frame.on( 'toolbar:create:wpsc-save-gallery', function(toolbar) {
379
- this.createSelectToolbar( toolbar, {
380
- text : WPSC_Media.l10n.saveGallery,
381
- state: this.options.state
382
- } );
383
- }, frame );
384
- frame.on( 'toolbar:render:wpsc-save-gallery', function( view ) {
385
- view.set( 'selection', new media.view.Selection({
386
- controller: this,
387
- collection: this.state().get( 'selection' ),
388
- priority: -40,
389
- editable: this.state().get('editable')
390
- }).render());
391
- }, frame );
392
-
393
- frame.open();
394
- });
395
- // make our gallery sortable
396
- $( 'div#wpsc_product_gallery' ).find( 'ul' ).sortable({
397
- cursor: 'move',
398
- revert: 300,
399
- }).disableSelection();
400
- });
401
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/js/product-variations.js CHANGED
@@ -8,12 +8,10 @@
8
  $(function(){
9
  resize_iframe();
10
 
11
- $('.wpsc-variation-stock-editor-link').click( function( event ) {
12
  var parent = $(this).closest('tr'),
13
  target_row = parent.next('.wpsc-stock-editor-row');
14
 
15
- event.preventDefault();
16
-
17
  target_row.show();
18
  parent.addClass('active');
19
  resize_iframe();
@@ -25,20 +23,19 @@
25
  var new_variation_set_count = 0;
26
 
27
  $(function(){
28
- $('.variation_checkboxes').on( 'click', '.variation-set', event_toggle_checkboxes );
29
- $('.variation_checkboxes').on( 'click', 'a.expand', event_toggle_children );
30
- $('.variation_checkboxes').on( 'click', '.selectit input:checkbox', event_display_apply_variations );
31
- $('.variation_checkboxes').on( 'click', '.children input:checkbox', event_toggle_parent );
32
-
33
- $('a.add_variation_set_action').on( 'click', event_add_new_variation_set );
34
- $('#add-new-variation-set .button').on( 'click', event_variation_set_add );
35
- $('#add-new-variation-set input[type="text"]').on( 'keypress', event_variation_set_inputs_keypress );
36
- $('#add-new-variation-set input[type="text"]').on( 'focus', event_variation_set_inputs_focus );
37
- $('#add-new-variation-set input[type="text"]').on( 'blur', event_variation_set_inputs_blur );
38
-
39
- $('.wpsc-product-variation-thumbnail a').on( 'click', event_variation_thumbnail_click );
40
- $('.wpsc-bulk-edit').on( 'change', 'input.wpsc-bulk-edit-fields', event_bulk_edit_checkboxes_changed );
41
- $('.wpsc-bulk-edit').on( 'keyup', 'input[type="text"]', event_bulk_edit_textboxes_keyup );
42
  });
43
 
44
  var event_bulk_edit_textboxes_keyup = function() {
@@ -55,31 +52,8 @@
55
  };
56
 
57
  var event_variation_thumbnail_click = function() {
58
- var t = $( this ), postId = t.data( 'id' ), nonce = t.data( 'nonce' );
59
-
60
- $.wpsc_post(
61
- {
62
- action: 'get_variation_gallery',
63
- nonce: nonce,
64
- id: postId
65
- },
66
- function( response ) {
67
- if ( ! response.is_successful ) {
68
- alert( response.error.messages.join( "\n" ) );
69
- return;
70
- }
71
-
72
- window.parent.WPSC_Media.open({
73
- id: postId,
74
- featuredId: response.obj.featuredId,
75
- models: response.obj.models,
76
- galleryUpdateNonce: t.data( 'save-gallery-nonce' ),
77
- galleryGetNonce: t.data( 'get-gallery-nonce' ),
78
- featuredNonce: t.data( 'featured-nonce' )
79
- });
80
- }
81
- );
82
-
83
  return false;
84
  };
85
 
8
  $(function(){
9
  resize_iframe();
10
 
11
+ $('.wpsc-variation-stock-editor-link').click(function(){
12
  var parent = $(this).closest('tr'),
13
  target_row = parent.next('.wpsc-stock-editor-row');
14
 
 
 
15
  target_row.show();
16
  parent.addClass('active');
17
  resize_iframe();
23
  var new_variation_set_count = 0;
24
 
25
  $(function(){
26
+ $('.variation_checkboxes').delegate('.variation-set', 'click', event_toggle_checkboxes).
27
+ delegate('a.expand', 'click', event_toggle_children).
28
+ delegate('.selectit input:checkbox', 'click', event_display_apply_variations).
29
+ delegate('.children input:checkbox', 'click', event_toggle_parent);
30
+
31
+ $('a.add_variation_set_action').bind('click', event_add_new_variation_set);
32
+ $('#add-new-variation-set .button').bind('click', event_variation_set_add);
33
+ $('#add-new-variation-set input[type="text"]').bind('keypress', event_variation_set_inputs_keypress).
34
+ bind('focus', event_variation_set_inputs_focus).
35
+ bind('blur', event_variation_set_inputs_blur);
36
+ $('.wpsc-product-variation-thumbnail a').bind('click', event_variation_thumbnail_click);
37
+ $('.wpsc-bulk-edit').delegate('input.wpsc-bulk-edit-fields', 'change', event_bulk_edit_checkboxes_changed).
38
+ delegate('input[type="text"]', 'keyup', event_bulk_edit_textboxes_keyup);
 
39
  });
40
 
41
  var event_bulk_edit_textboxes_keyup = function() {
52
  };
53
 
54
  var event_variation_thumbnail_click = function() {
55
+ var t = $(this);
56
+ window.parent.wpsc_display_thickbox(t.data('title'), t.attr('href'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  return false;
58
  };
59
 
wpsc-admin/js/product_tagcloud.js ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //this contains a nearly exact copy of the wordpress product tag editing functions
2
+
3
+ function new_tag_remove_tag() {
4
+ var id = jQuery( this ).attr( 'id' );
5
+ var num = id.substr( 10 );
6
+ var current_tags = jQuery( '#tags-input' ).val().split(',');
7
+ delete current_tags[num];
8
+ var new_tags = [];
9
+ jQuery.each( current_tags, function( key, val ) {
10
+ if ( val && !val.match(/^\s+$/) && '' != val ) {
11
+ new_tags = new_tags.concat( val );
12
+ }
13
+ });
14
+ jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
15
+ tag_update_quickclicks();
16
+ jQuery('#newtag').focus();
17
+ return false;
18
+ }
19
+
20
+ function tag_update_quickclicks() {
21
+ if ( jQuery( '#tags-input' ).length == 0 )
22
+ return;
23
+ var current_tags = jQuery( '#tags-input' ).val().split(',');
24
+ jQuery( '#tagchecklist' ).empty();
25
+ shown = false;
26
+ // jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique
27
+ jQuery.each( current_tags, function( key, val ) {
28
+ val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
29
+ if ( !val.match(/^\s+$/) && '' != val ) {
30
+ txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
31
+ jQuery( '#tagchecklist' ).append( txt );
32
+ jQuery( '#tag-check-' + key ).click( new_tag_remove_tag );
33
+ shown = true;
34
+ }
35
+ });
36
+ if ( shown )
37
+ jQuery( '#tagchecklist' ).prepend( '<strong>Tags Used</strong><br />' );
38
+ }
39
+
40
+ function tag_flush_to_text(e,a) {
41
+ a = a || false;
42
+ var text = a ? jQuery(a).text() : jQuery('#newtag').val();
43
+ var newtags = jQuery('#tags-input').val();
44
+
45
+ var t = text.replace( /\s*([^,]+).*/, '$1,' );
46
+ newtags += ','
47
+
48
+ if ( newtags.indexOf(t) != -1 )
49
+ return false;
50
+
51
+ newtags += text;
52
+
53
+ // massage
54
+ newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' );
55
+ jQuery('#tags-input').val( newtags );
56
+ tag_update_quickclicks();
57
+ if ( ! a ) {
58
+ jQuery('#newtag').val('');
59
+ jQuery('#newtag').focus();
60
+ }
61
+ return false;
62
+ }
63
+
64
+ function tag_save_on_publish() {
65
+ if ( jQuery('#newtag').val() != postL10n.addTag )
66
+ tag_flush_to_text();
67
+ }
68
+
69
+ function tag_press_key( e ) {
70
+ if ( 13 == e.keyCode ) {
71
+ tag_flush_to_text();
72
+ return false;
73
+ }
74
+ };
75
+
76
+ (function($){
77
+ tagCloud = {
78
+ init : function() {
79
+ $('#tagcloud-link').click(function(){tagCloud.get(); $(this).unbind().click(function(){return false;}); return false;});
80
+ },
81
+
82
+ get : function() {
83
+ $.post('admin-ajax.php', {'action':'get-tagcloud'}, function(r, stat) {
84
+ if ( 0 == r || 'success' != stat )
85
+ r = wpAjax.broken;
86
+
87
+ r = '<p id="the-tagcloud">'+r+'</p>';
88
+ $('#tagcloud-link').after($(r));
89
+ $('#the-tagcloud a').click(function(){
90
+ tag_flush_to_text(0,this);
91
+ return false;
92
+ });
93
+ });
94
+ }
95
+ }
96
+ })(jQuery);
97
+
98
+ jQuery(document).ready( function($) {
99
+ tagCloud.init();
100
+ tag_update_quickclicks();
101
+ jQuery('#tags-input').livequery(function(){
102
+ jQuery(this).hide();
103
+
104
+ })
105
+
106
+
107
+
108
+
109
+ // add the quickadd form
110
+ jQuery('#jaxtag').livequery(function(){
111
+ jQuery(this).prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="Add tag" /><input type="button" class="button" id="tagadd" value="Add" tabindex="3" /><input type="hidden"/><input type="hidden"/></span>');
112
+ jQuery('#tagadd').click( tag_flush_to_text );
113
+ jQuery('#newtag').focus(function() {
114
+ // if ( this.value == postL10n.addTag )
115
+ jQuery(this).val( '' ).removeClass( 'form-input-tip' );
116
+ });
117
+ tag_update_quickclicks();
118
+ jQuery('#newtag').blur(function() {
119
+ if ( this.value == '' )
120
+ jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
121
+ });
122
+ });
123
+
124
+ });
125
+
wpsc-admin/js/purchase-log-action-links.js DELETED
@@ -1,124 +0,0 @@
1
-
2
- ( function( $ ) {
3
-
4
- /**
5
- * Purchase Log Action Links
6
- */
7
- $.extend( WPSC_Purchase_Log_Action_Links, {
8
-
9
- /**
10
- * Setup purchase log action links and event handlers.
11
- *
12
- * @since 3.9.0
13
- */
14
- init : function() {
15
-
16
- $( function() {
17
- var wrapper = $( '#wpsc_purchlogitems_links ul' );
18
-
19
- // Add spinners to AJAX links
20
- wrapper.find( 'a.wpsc-purchlog-action-link.is-ajax' ).each( function() {
21
- $( this ).prepend( $( '<span class="spinner" />' ) );
22
- } );
23
-
24
- wrapper.on( 'click', 'a.wpsc-purchlog-action-link.is-ajax', WPSC_Purchase_Log_Action_Links.event_ajax_link_clicked );
25
- } );
26
-
27
- },
28
-
29
- /**
30
- * Handle purchase log action link click.
31
- *
32
- * @since 3.9.0
33
- */
34
- event_ajax_link_clicked : function( e ) {
35
-
36
- var action = $( this ).data( 'purchase-log-action' );
37
- var nonce = $( this ).data( 'nonce' );
38
-
39
- if ( action ) {
40
-
41
- // Only do AJAX request if not already doing it.
42
- if ( ! $( this ).hasClass( 'doing' ) ) {
43
-
44
- var post_data = {
45
- 'action' : 'purchase_log_action_link',
46
- 'purchase_log_action_link' : action,
47
- 'purchase_log_action_nonce' : nonce,
48
- 'log_id' : WPSC_Purchase_Log_Action_Links.log_id,
49
- 'nonce' : WPSC_Purchase_Log_Action_Links.purchase_log_action_link_nonce
50
- };
51
-
52
- $( this ).addClass( 'doing' );
53
- $.wpsc_post( post_data, WPSC_Purchase_Log_Action_Links.ajax_callback );
54
-
55
- }
56
-
57
- e.preventDefault();
58
-
59
- }
60
-
61
- },
62
-
63
- /**
64
- * Handle purchase log action AJAX response.
65
- *
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' );
78
- setTimeout( function() {
79
- dashicon.removeClass().addClass( dashicon_class );
80
- }, 3000 );
81
-
82
- // Remove spinner
83
- $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link.doing' ).removeClass( 'doing' );
84
-
85
- } else {
86
-
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
-
98
- // Failure notification.
99
- dashicon.removeClass().addClass( 'dashicons dashicons-no' );
100
- setTimeout( function() {
101
- dashicon.removeClass().addClass( dashicon_class );
102
- }, 3000 );
103
-
104
- } else {
105
- dashicon.removeClass().addClass( dashicon_class );
106
- }
107
-
108
- // Remove spinner.
109
- $( '#wpsc_purchlogitems_links ul a.wpsc-purchlog-action-link.doing' ).removeClass( 'doing' );
110
-
111
- // Show error message.
112
- if ( typeof response.error !== 'undefined' ) {
113
- alert( response.error.messages.join( "\n" ) );
114
- }
115
-
116
- }
117
-
118
- }
119
-
120
- } );
121
-
122
- } )( jQuery );
123
-
124
- WPSC_Purchase_Log_Action_Links.init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/js/purchase-logs.js CHANGED
@@ -5,16 +5,16 @@
5
 
6
  init : function() {
7
  $(function(){
8
- var wrapper = $('table.purchase-logs');
9
- wrapper.on( 'change' , '.wpsc-purchase-log-status' , WPSC_Purchase_Logs_Admin.event_log_status_change );
10
- wrapper.on( 'focus' , '.wpsc-purchase-log-tracking-id', WPSC_Purchase_Logs_Admin.event_tracking_id_focused );
11
- wrapper.on( 'click' , '.column-tracking a.add' , WPSC_Purchase_Logs_Admin.event_button_add_clicked );
12
- wrapper.on( 'blur' , '.wpsc-purchase-log-tracking-id', WPSC_Purchase_Logs_Admin.event_tracking_id_blurred );
13
- wrapper.on( 'click' , '.column-tracking a.save' , WPSC_Purchase_Logs_Admin.event_button_save_clicked );
14
- wrapper.on( 'click' , '.column-tracking .send-email a', WPSC_Purchase_Logs_Admin.event_button_send_email_clicked );
15
- wrapper.on( 'keypress' , '.wpsc-purchase-log-tracking-id', WPSC_Purchase_Logs_Admin.event_enter_key_pressed );
16
- wrapper.on( 'mousedown', '.column-tracking a.save' , WPSC_Purchase_Logs_Admin.event_disable_textbox_resize );
17
- wrapper.on( 'focus' , '.column-tracking a.save' , WPSC_Purchase_Logs_Admin.event_disable_textbox_resize );
18
  });
19
  },
20
 
5
 
6
  init : function() {
7
  $(function(){
8
+ $('table.purchase-logs').delegate('.wpsc-purchase-log-status', 'change', WPSC_Purchase_Logs_Admin.event_log_status_change).
9
+ delegate('.wpsc-purchase-log-tracking-id', 'focus', WPSC_Purchase_Logs_Admin.event_tracking_id_focused).
10
+ delegate('.column-tracking a.add', 'click', WPSC_Purchase_Logs_Admin.event_button_add_clicked).
11
+ delegate('.wpsc-purchase-log-tracking-id', 'blur', WPSC_Purchase_Logs_Admin.event_tracking_id_blurred).
12
+ delegate('.column-tracking a.save', 'click', WPSC_Purchase_Logs_Admin.event_button_save_clicked).
13
+ delegate('.column-tracking .send-email a', 'click', WPSC_Purchase_Logs_Admin.event_button_send_email_clicked).
14
+ delegate('.wpsc-purchase-log-tracking-id', 'keypress', WPSC_Purchase_Logs_Admin.event_enter_key_pressed).
15
+ delegate('.column-tracking a.save', 'mousedown', WPSC_Purchase_Logs_Admin.event_disable_textbox_resize).
16
+ delegate('.column-tracking a.save', 'focus', WPSC_Purchase_Logs_Admin.event_disable_textbox_resize);
17
+
18
  });
19
  },
20
 
wpsc-admin/js/set-post-thumbnail.js CHANGED
File without changes
wpsc-admin/js/settings-page.js CHANGED
@@ -39,14 +39,13 @@
39
  }
40
 
41
  // load the correct settings tab when back/forward browser button is used
 
42
 
43
- $(window).on('popstate', WPSC_Settings_Page.event_pop_state);
44
  $(function(){
45
- var wpsc_options = $('#wpsc_options');
46
- wpsc_options.on( 'click' , 'a.nav-tab' , WPSC_Settings_Page.event_tab_button_clicked);
47
- wpsc_options.on( 'change', 'input, textarea, select', WPSC_Settings_Page.event_settings_changed);
48
- wpsc_options.on( 'submit', '#wpsc-settings-form' , WPSC_Settings_Page.event_settings_form_submitted);
49
- $(window).on('beforeunload', WPSC_Settings_Page.event_before_unload);
50
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded');
51
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded_' + WPSC_Settings_Page.current_tab);
52
  $('.settings-error').insertAfter('.nav-tab-wrapper');
@@ -188,9 +187,9 @@
188
  */
189
  event_init : function() {
190
  var wrapper = $('#options_general');
191
- wrapper.on( 'change', '#wpsc-base-country-drop-down', WPSC_Settings_Page.General.event_base_country_changed);
192
- wrapper.on( 'click' , '.wpsc-select-all' , WPSC_Settings_Page.General.event_select_all);
193
- wrapper.on( 'click' ,'.wpsc-select-none' , WPSC_Settings_Page.General.event_select_none);
194
  },
195
 
196
  /**
@@ -237,7 +236,7 @@
237
  $.wpsc_post(postdata, ajax_callback);
238
  }
239
  };
240
- $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_general', WPSC_Settings_Page.General.event_init);
241
 
242
  /**
243
  * Presentation tab
@@ -258,9 +257,9 @@
258
  */
259
  event_init : function() {
260
  var wrapper = $('#options_presentation'),
261
- checkbox_selector = '#' + WPSC_Settings_Page.Presentation.grid_view_boxes.join(',#');
262
- wrapper.on( 'click', '#wpsc-show-images-only', WPSC_Settings_Page.Presentation.event_show_images_only_clicked);
263
- wrapper.on( 'click', checkbox_selector , WPSC_Settings_Page.Presentation.event_grid_view_boxes_clicked);
264
  },
265
 
266
  /**
@@ -284,7 +283,7 @@
284
  }
285
  }
286
  };
287
- $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_presentation', WPSC_Settings_Page.Presentation.event_init);
288
 
289
  /**
290
  * Checkout Tab
@@ -300,17 +299,16 @@
300
  */
301
  event_init : function() {
302
  var wrapper = $('#options_checkout');
303
- wrapper.on( 'click', '.add_new_form_set', WPSC_Settings_Page.Checkout.event_add_new_form_set);
304
- wrapper.on( 'click', '.actionscol a.wpsc-button-plus', WPSC_Settings_Page.Checkout.event_add_new_field);
305
- wrapper.on( 'click', '.actionscol a.wpsc-button-minus', WPSC_Settings_Page.Checkout.event_delete_field);
306
- wrapper.on( 'click', 'a.edit-options', WPSC_Settings_Page.Checkout.event_edit_field_options);
307
- wrapper.on( 'change', 'select[name^="form_type"], select[name^="new_field_type"]', WPSC_Settings_Page.Checkout.event_form_type_changed);
308
- wrapper.on( 'click', '.field-option-cell-wrapper .wpsc-button-plus', WPSC_Settings_Page.Checkout.event_add_field_option);
309
- wrapper.on( 'click', '.field-option-cell-wrapper .wpsc-button-minus', WPSC_Settings_Page.Checkout.event_delete_field_option);
310
- wrapper.on( 'click', '#wpsc-delete-checkout-set', WPSC_Settings_Page.Checkout.event_delete_checkout_set);
311
- wrapper.on( 'change', '#wpsc_form_set', WPSC_Settings_Page.Checkout.event_select_form_set);
312
- wrapper.on( 'click', '.mandatorycol input[type="checkbox"]', WPSC_Settings_Page.Checkout.event_disabled_toggled);
313
- $('#wpsc-settings-form').on( 'submit', WPSC_Settings_Page.Checkout.event_form_submit);
314
 
315
  wrapper.find('#wpsc_checkout_list').
316
  sortable({
@@ -327,21 +325,6 @@
327
  });
328
 
329
  WPSC_Settings_Page.Checkout.new_field_count = $('.new-field').length;
330
-
331
- /**
332
- * Finding checkboxes that are mandatory and disabling the display option.
333
- * If it's mandatory you no have choice for display.
334
- */
335
- wrapper.find( '.mandatorycol input[type="checkbox"]').each( function(){
336
- var displaycol = $( this ).parents( '.mandatorycol' ).siblings( '.displaycol' );
337
-
338
- if ( $( this ).is( ':checked' ) ) {
339
- $( displaycol ).find( 'input[type="checkbox"]' ).prop( 'checked', true ).prop( 'readonly', true );
340
- } else {
341
- $( displaycol ).find( 'input[type="checkbox"]' ).prop( 'readonly', this.checked );
342
- }
343
- });
344
-
345
  },
346
 
347
  event_add_field_option : function() {
@@ -393,7 +376,6 @@
393
  var t = $(this),
394
  target_row = t.closest('tr'),
395
  id = target_row.data('field-id'),
396
- type = target_row.data('field-type'),
397
  link = target_row.find('.edit-options'),
398
  options_row_id = 'wpsc-field-edit-options-' + id;
399
 
@@ -401,11 +383,7 @@
401
  id = target_row.data('new-field-id');
402
  options_row_id = 'wpsc-new-field-edit-options-' + id;
403
  }
404
- target_row
405
- .removeClass('field_type_'+type)
406
- .addClass('field_type_'+t.val())
407
- .data('field-type', t.val());
408
- type = t.val();
409
  if ($.inArray(t.val(), ['select', 'radio', 'checkbox']) !== -1) {
410
  link.show();
411
  } else {
@@ -500,7 +478,7 @@
500
 
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;
@@ -572,21 +550,6 @@
572
  return false;
573
  },
574
 
575
- /**
576
- * Disables and checks the display option if you make a field mandatory. If you uncheck
577
- * mandatory then it just enables you to uncheck the display box.
578
- */
579
- event_disabled_toggled : function() {
580
-
581
- var displaycol = $( this ).parents( '.mandatorycol' ).siblings( '.displaycol' );
582
-
583
- if ( $( this ).is( ':checked' ) ) {
584
- $( displaycol ).find( 'input[type="checkbox"]' ).prop( 'checked', true ).prop( 'readonly', true );
585
- } else {
586
- $( displaycol ).find( 'input[type="checkbox"]' ).prop( 'readonly', this.checked );
587
- }
588
- },
589
-
590
  /**
591
  * This hack is to make sure the dragged row has 100% width
592
  *
@@ -715,7 +678,7 @@
715
  $('#wpsc-delete-checkout-set').show();
716
  }
717
  };
718
- $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_checkout', WPSC_Settings_Page.Checkout.event_init);
719
 
720
  /**
721
  * Taxes tab
@@ -729,13 +692,11 @@
729
  */
730
  event_init : function() {
731
  var wrapper = $('#options_taxes');
732
-
733
- wrapper.on( 'click' , '.wpsc-button-minus' , function () { return false; } );
734
- wrapper.on( 'click' , '.wpsc-taxes-rates-add' , WPSC_Settings_Page.Taxes.event_add_tax_rate);
735
- wrapper.on( 'click' , '.wpsc-taxes-rates-delete' , WPSC_Settings_Page.Taxes.event_delete_tax_rate);
736
- wrapper.on( 'click' , '.wpsc-taxes-bands-add' , WPSC_Settings_Page.Taxes.event_add_tax_band);
737
- wrapper.on( 'click' , '.wpsc-taxes-bands-delete' , WPSC_Settings_Page.Taxes.event_delete_tax_band);
738
- wrapper.on( 'change', '.wpsc-taxes-country-drop-down', WPSC_Settings_Page.Taxes.event_country_drop_down_changed);
739
  },
740
 
741
  /**
@@ -744,11 +705,11 @@
744
  */
745
  event_country_drop_down_changed : function() {
746
  var c = $(this),
747
- post_data = {
748
  action : 'add_tax_rate',
749
  wpec_taxes_action : 'wpec_taxes_get_regions',
750
- current_key : c.data('row-key'),
751
- taxes_type : c.data('row-mode'),
752
  country_code : c.val(),
753
  nonce : WPSC_Settings_Page.add_tax_rate_nonce
754
  },
@@ -781,9 +742,6 @@
781
  */
782
  event_delete_tax_rate : function() {
783
  $(this).parents('.wpsc-tax-rates-row').remove();
784
- if ($('.wpsc-tax-rates-row').size() === 1) {
785
- WPSC_Settings_Page.Taxes.add_field('rates');
786
- }
787
  return false;
788
  },
789
 
@@ -802,9 +760,6 @@
802
  */
803
  event_delete_tax_band : function() {
804
  $(this).parents('.wpsc-tax-bands-row').remove();
805
- if ($('.wpsc-tax-bands-row').size() === 1) {
806
- WPSC_Settings_Page.Taxes.add_field('bands');
807
- }
808
  return false;
809
  },
810
 
@@ -814,17 +769,27 @@
814
  * @since 3.8.8
815
  */
816
  add_field : function(type) {
817
- var tbody = $('#wpec-taxes-' + type + ' tbody'),
818
- count = $('.wpsc-tax-' + type + '-row').size(),
819
- new_prototype_row = $('#wpsc-taxes-' + type + '-row-prototype').clone();
820
- new_prototype_row.removeClass('prototype');
821
- new_prototype_row.attr('id', new_prototype_row.attr('id').replace(/prototype/g, count));
822
- new_prototype_row.attr('data-row-key', new_prototype_row.attr('data-row-key').replace(/prototype/g, count));
823
- new_prototype_row.html( new_prototype_row.html().replace(/prototype/g, count) );
824
- tbody.append(new_prototype_row);
 
 
 
 
 
 
 
 
 
 
825
  }
826
  };
827
- $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_taxes', WPSC_Settings_Page.Taxes.event_init);
828
 
829
  /**
830
  * Shipping Tab
@@ -839,13 +804,12 @@
839
  event_init : function() {
840
  WPSC_Settings_Page.Shipping.wrapper = $('#options_shipping');
841
  WPSC_Settings_Page.Shipping.table_rate = WPSC_Settings_Page.Shipping.wrapper.find('.table-rate');
842
-
843
- WPSC_Settings_Page.Shipping.wrapper.on( 'click' , '.edit-shipping-module' , WPSC_Settings_Page.Shipping.event_edit_shipping_module);
844
- WPSC_Settings_Page.Shipping.wrapper.on( 'click' , '.table-rate .wpsc-button-plus' , WPSC_Settings_Page.Shipping.event_add_table_rate_layer);
845
- WPSC_Settings_Page.Shipping.wrapper.on( 'click' , '.table-rate .wpsc-button-minus', WPSC_Settings_Page.Shipping.event_delete_table_rate_layer);
846
- WPSC_Settings_Page.Shipping.wrapper.on( 'keypress', '.table-rate input[type="text"]', WPSC_Settings_Page.Shipping.event_enter_key_pressed);
847
- WPSC_Settings_Page.Shipping.wrapper.on( 'click' , 'a.shipwire_sync' , WPSC_Settings_Page.Shipping.event_sync_shipwire);
848
- WPSC_Settings_Page.Shipping.wrapper.on( 'click' , '.edit-shipping-module-cancel' , WPSC_Settings_Page.Shipping.event_edit_shipping_module_cancel);
849
  },
850
 
851
  /**
@@ -882,7 +846,7 @@
882
  }
883
 
884
  var this_row = $(this).closest('tr'),
885
- clone = this_row.clone();
886
 
887
  clone.find('input').val('');
888
  clone.find('.cell-wrapper').hide();
@@ -919,56 +883,29 @@
919
  */
920
  event_edit_shipping_module : function() {
921
  var element = $(this),
922
- shipping_module_id = element.closest('.wpsc-select-shipping').data('shipping-id'),
923
- spinner = element.children('.ajax-feedback'),
924
- post_data = {
925
- action : 'shipping_module_settings_form',
926
- 'shipping_module_id' : shipping_module_id,
927
- nonce : WPSC_Settings_Page.shipping_module_settings_form_nonce
928
- },
929
- ajax_callback = function(response) {
930
- if (! response.is_successful) {
931
- alert(response.error.messages.join("\n"));
932
- return false;
933
- }
934
-
935
- if (history.pushState) {
936
- var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab + '&shipping_module_id=' + shipping_module_id;
937
- history.pushState({url : new_url}, '', new_url);
938
- }
939
- spinner.toggleClass('ajax-feedback-active');
940
-
941
- $('#wpsc_shipping_settings_' + shipping_module_id + '_form').remove();
942
- $('#wpsc_shipping_settings_'+ shipping_module_id).show( 400 );
943
- $('#wpsc_shipping_settings_'+ shipping_module_id + '_container').append(response.obj.content);
944
-
945
- };
946
-
947
- if ( $( '#wpsc_shipping_settings_' + shipping_module_id + '_form' ).is( ':visible' ) ) {
948
- return false;
949
- }
950
 
951
  spinner.toggleClass('ajax-feedback-active');
952
  $.wpsc_post(post_data, ajax_callback);
953
-
954
- return false;
955
- },
956
-
957
- /**
958
- * Remove Shipping Module settings from from page when "Cancel" is clicked.
959
- * @since 3.8.11
960
- */
961
- event_edit_shipping_module_cancel : function() {
962
- var element = $(this),
963
- shipping_module_id = element.closest('.wpsc-select-shipping').data('shipping-id');
964
-
965
- if (history.pushState) {
966
- var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab;
967
- history.pushState({'url' : new_url}, '', new_url);
968
- }
969
- $('#wpsc_shipping_settings_' + shipping_module_id + '_form').remove();
970
- $('#wpsc_shipping_settings_' + shipping_module_id).hide( 400 );
971
-
972
  return false;
973
  },
974
 
@@ -978,24 +915,21 @@
978
  */
979
  event_sync_shipwire : function() {
980
  var element = $(this),
981
- spinner = element.siblings('.ajax-feedback'),
982
- post_data = {
983
- action : 'sync_shipwire_products',
984
- email : $('input[name="wpsc_options[shipwireemail]"]').val(),
985
- password : $('input[name="wpsc_options[shipwirepassword]"]').val(),
986
- server : $('input[name="wpsc_options[shipwire_test_server]"]').val(),
987
- nonce : WPSC_Settings_Page.shipping_module_settings_form_nonce
988
- },
989
- ajax_callback = function(response) {
990
- $('<div class="updated shipwire-update"><p><strong>' + response.tracking + '<br />' + response.inventory + '</strong></p></div>').
991
- insertBefore(element).
992
- fadeIn('slow').
993
- delay(5500).
994
- fadeOut('slow');
995
- spinner.toggleClass('ajax-feedback-active');
996
- };
997
  spinner.toggleClass('ajax-feedback-active');
998
- $.post( ajaxurl, post_data, ajax_callback, 'json' );
999
  return false;
1000
  },
1001
 
@@ -1008,7 +942,7 @@
1008
  WPSC_Settings_Page.Shipping.wrapper.find('#wpsc-shipping-module-settings tr:odd').addClass('alternate');
1009
  }
1010
  };
1011
- $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_shipping', WPSC_Settings_Page.Shipping.event_init);
1012
 
1013
  /**
1014
  * Payments Tab
@@ -1018,55 +952,38 @@
1018
  WPSC_Settings_Page.Gateway = {
1019
  event_init : function() {
1020
  var wrapper = $('#options_gateway');
1021
- wrapper.on( 'click', '.edit-payment-module' , WPSC_Settings_Page.Gateway.event_edit_payment_gateway);
1022
- wrapper.on( 'click', '.edit-payment-module-cancel', WPSC_Settings_Page.Gateway.event_edit_payment_gateway_cancel);
1023
  },
 
1024
  event_edit_payment_gateway : function() {
1025
- var element = $(this), // edit link
1026
- payment_gateway_id = element.closest('.wpsc-select-gateway').data('gateway-id'),
1027
- spinner = element.siblings('.ajax-feedback'),
1028
- post_data = {
1029
  action : 'payment_gateway_settings_form',
1030
  'payment_gateway_id' : payment_gateway_id,
1031
  nonce : WPSC_Settings_Page.payment_gateway_settings_form_nonce
1032
- },
1033
- ajax_callback = function(response) {
1034
- if ( ! response.is_successful ) {
1035
- alert(response.error.messages.join("\n"));
1036
- return false;
1037
- }
1038
-
1039
- if (history.pushState) {
1040
- var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab + '&payment_gateway_id=' + payment_gateway_id;
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' ) ) {
1050
- return false;
1051
- }
1052
 
1053
  spinner.toggleClass('ajax-feedback-active');
1054
  $.wpsc_post(post_data, ajax_callback);
1055
  return false;
1056
- },
1057
- event_edit_payment_gateway_cancel : function() {
1058
- var element = $(this),
1059
- payment_gateway_id = element.closest('.gateway_settings').data('gateway-id');
1060
- if (history.pushState) {
1061
- var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab;
1062
- history.pushState({'url' : new_url}, '', new_url);
1063
- }
1064
- $('#gateway_settings_' + payment_gateway_id + '_form').remove();
1065
- $('#wpsc_gateway_settings_' + payment_gateway_id).hide( 400 );
1066
- return false;
1067
  }
1068
  };
1069
- $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_gateway', WPSC_Settings_Page.Gateway.event_init);
1070
 
1071
  /**
1072
  * Marketing Tab
@@ -1078,14 +995,14 @@
1078
 
1079
  var wrapper = $('div#wpsc_google_analytics_integration');
1080
 
1081
- wrapper.on( 'click', 'input[type="checkbox"]', WPSC_Settings_Page.Marketing.event_show_hide_dependencies);
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
- });
1089
  },
1090
 
1091
  event_show_hide_dependencies : function () {
@@ -1099,7 +1016,7 @@
1099
 
1100
  };
1101
 
1102
- $(WPSC_Settings_Page).on('wpsc_settings_tab_loaded_marketing', WPSC_Settings_Page.Marketing.event_init);
1103
 
1104
  })(jQuery);
1105
 
39
  }
40
 
41
  // load the correct settings tab when back/forward browser button is used
42
+ $(window).bind('popstate', WPSC_Settings_Page.event_pop_state);
43
 
 
44
  $(function(){
45
+ $('#wpsc_options').delegate('a.nav-tab' , 'click' , WPSC_Settings_Page.event_tab_button_clicked).
46
+ delegate('input, textarea, select', 'change', WPSC_Settings_Page.event_settings_changed).
47
+ delegate('#wpsc-settings-form' , 'submit', WPSC_Settings_Page.event_settings_form_submitted);
48
+ $(window).bind('beforeunload', WPSC_Settings_Page.event_before_unload);
 
49
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded');
50
  $(WPSC_Settings_Page).trigger('wpsc_settings_tab_loaded_' + WPSC_Settings_Page.current_tab);
51
  $('.settings-error').insertAfter('.nav-tab-wrapper');
187
  */
188
  event_init : function() {
189
  var wrapper = $('#options_general');
190
+ wrapper.delegate('#wpsc-base-country-drop-down', 'change', WPSC_Settings_Page.General.event_base_country_changed).
191
+ delegate('.wpsc-select-all', 'click', WPSC_Settings_Page.General.event_select_all).
192
+ delegate('.wpsc-select-none', 'click', WPSC_Settings_Page.General.event_select_none);
193
  },
194
 
195
  /**
236
  $.wpsc_post(postdata, ajax_callback);
237
  }
238
  };
239
+ $(WPSC_Settings_Page).bind('wpsc_settings_tab_loaded_general', WPSC_Settings_Page.General.event_init);
240
 
241
  /**
242
  * Presentation tab
257
  */
258
  event_init : function() {
259
  var wrapper = $('#options_presentation'),
260
+ checkbox_selector = '#' + WPSC_Settings_Page.Presentation.grid_view_boxes.join(',#');
261
+ wrapper.delegate('#wpsc-show-images-only', 'click', WPSC_Settings_Page.Presentation.event_show_images_only_clicked);
262
+ wrapper.delegate(checkbox_selector , 'click', WPSC_Settings_Page.Presentation.event_grid_view_boxes_clicked);
263
  },
264
 
265
  /**
283
  }
284
  }
285
  };
286
+ $(WPSC_Settings_Page).bind('wpsc_settings_tab_loaded_presentation', WPSC_Settings_Page.Presentation.event_init);
287
 
288
  /**
289
  * Checkout Tab
299
  */
300
  event_init : function() {
301
  var wrapper = $('#options_checkout');
302
+ wrapper.delegate('.add_new_form_set', 'click', WPSC_Settings_Page.Checkout.event_add_new_form_set).
303
+ delegate('.actionscol a.add', 'click', WPSC_Settings_Page.Checkout.event_add_new_field).
304
+ delegate('.actionscol a.delete', 'click', WPSC_Settings_Page.Checkout.event_delete_field).
305
+ delegate('a.edit-options', 'click', WPSC_Settings_Page.Checkout.event_edit_field_options).
306
+ delegate('select[name^="form_type"], select[name^="new_field_type"]', 'change', WPSC_Settings_Page.Checkout.event_form_type_changed).
307
+ delegate('.field-option-cell-wrapper .add', 'click', WPSC_Settings_Page.Checkout.event_add_field_option).
308
+ delegate('.field-option-cell-wrapper .delete', 'click', WPSC_Settings_Page.Checkout.event_delete_field_option).
309
+ delegate('#wpsc-delete-checkout-set', 'click', WPSC_Settings_Page.Checkout.event_delete_checkout_set).
310
+ delegate('#wpsc_form_set', 'change', WPSC_Settings_Page.Checkout.event_select_form_set);
311
+ $('#wpsc-settings-form').bind('submit', WPSC_Settings_Page.Checkout.event_form_submit);
 
312
 
313
  wrapper.find('#wpsc_checkout_list').
314
  sortable({
325
  });
326
 
327
  WPSC_Settings_Page.Checkout.new_field_count = $('.new-field').length;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  },
329
 
330
  event_add_field_option : function() {
376
  var t = $(this),
377
  target_row = t.closest('tr'),
378
  id = target_row.data('field-id'),
 
379
  link = target_row.find('.edit-options'),
380
  options_row_id = 'wpsc-field-edit-options-' + id;
381
 
383
  id = target_row.data('new-field-id');
384
  options_row_id = 'wpsc-new-field-edit-options-' + id;
385
  }
386
+
 
 
 
 
387
  if ($.inArray(t.val(), ['select', 'radio', 'checkbox']) !== -1) {
388
  link.show();
389
  } else {
478
 
479
  event_form_submit : function() {
480
  var sort_order = $('#wpsc_checkout_list').sortable('toArray');
481
+ for (index in sort_order) {
482
  $(this).append('<input type="hidden" name="sort_order[]" value="' + sort_order[index] + '" />');
483
  }
484
  return true;
550
  return false;
551
  },
552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  /**
554
  * This hack is to make sure the dragged row has 100% width
555
  *
678
  $('#wpsc-delete-checkout-set').show();
679
  }
680
  };
681
+ $(WPSC_Settings_Page).bind('wpsc_settings_tab_loaded_checkout', WPSC_Settings_Page.Checkout.event_init);
682
 
683
  /**
684
  * Taxes tab
692
  */
693
  event_init : function() {
694
  var wrapper = $('#options_taxes');
695
+ wrapper.delegate('#wpsc-add-tax-rates a' , 'click' , WPSC_Settings_Page.Taxes.event_add_tax_rate).
696
+ delegate('.wpsc-taxes-rates-delete' , 'click' , WPSC_Settings_Page.Taxes.event_delete_tax_rate).
697
+ delegate('#wpsc-add-tax-bands a' , 'click' , WPSC_Settings_Page.Taxes.event_add_tax_band).
698
+ delegate('.wpsc-taxes-bands-delete' , 'click' , WPSC_Settings_Page.Taxes.event_delete_tax_band).
699
+ delegate('.wpsc-taxes-country-drop-down', 'change', WPSC_Settings_Page.Taxes.event_country_drop_down_changed);
 
 
700
  },
701
 
702
  /**
705
  */
706
  event_country_drop_down_changed : function() {
707
  var c = $(this),
708
+ post_data = {
709
  action : 'add_tax_rate',
710
  wpec_taxes_action : 'wpec_taxes_get_regions',
711
+ current_key : c.data('key'),
712
+ taxes_type : c.data('type'),
713
  country_code : c.val(),
714
  nonce : WPSC_Settings_Page.add_tax_rate_nonce
715
  },
742
  */
743
  event_delete_tax_rate : function() {
744
  $(this).parents('.wpsc-tax-rates-row').remove();
 
 
 
745
  return false;
746
  },
747
 
760
  */
761
  event_delete_tax_band : function() {
762
  $(this).parents('.wpsc-tax-bands-row').remove();
 
 
 
763
  return false;
764
  },
765
 
769
  * @since 3.8.8
770
  */
771
  add_field : function(type) {
772
+ var button_wrapper = $('#wpsc-add-tax-' + type),
773
+ count = $('.wpsc-tax-' + type + '-row').size(),
774
+ post_data = {
775
+ action : 'add_tax_rate',
776
+ wpec_taxes_action : 'wpec_taxes_build_' + type + '_form',
777
+ current_key : count,
778
+ nonce : WPSC_Settings_Page.add_tax_rate_nonce
779
+ },
780
+ ajax_callback = function(response) {
781
+ if (! response.is_successful) {
782
+ alert(response.error.messages.join("\n"));
783
+ return;
784
+ }
785
+ button_wrapper.before(response.obj.content).find('img').toggleClass('ajax-feedback-active');
786
+ };
787
+
788
+ button_wrapper.find('img').toggleClass('ajax-feedback-active');
789
+ $.wpsc_post(post_data, ajax_callback);
790
  }
791
  };
792
+ $(WPSC_Settings_Page).bind('wpsc_settings_tab_loaded_taxes', WPSC_Settings_Page.Taxes.event_init);
793
 
794
  /**
795
  * Shipping Tab
804
  event_init : function() {
805
  WPSC_Settings_Page.Shipping.wrapper = $('#options_shipping');
806
  WPSC_Settings_Page.Shipping.table_rate = WPSC_Settings_Page.Shipping.wrapper.find('.table-rate');
807
+ WPSC_Settings_Page.Shipping.wrapper.
808
+ delegate('.edit-shipping-module' , 'click' , WPSC_Settings_Page.Shipping.event_edit_shipping_module).
809
+ delegate('.table-rate .add' , 'click' , WPSC_Settings_Page.Shipping.event_add_table_rate_layer).
810
+ delegate('.table-rate .delete' , 'click' , WPSC_Settings_Page.Shipping.event_delete_table_rate_layer).
811
+ delegate('.table-rate input[type="text"]', 'keypress', WPSC_Settings_Page.Shipping.event_enter_key_pressed).
812
+ delegate('a.shipwire_sync' , 'click' , WPSC_Settings_Page.Shipping.event_sync_shipwire);
 
813
  },
814
 
815
  /**
846
  }
847
 
848
  var this_row = $(this).closest('tr'),
849
+ clone = this_row.clone();
850
 
851
  clone.find('input').val('');
852
  clone.find('.cell-wrapper').hide();
883
  */
884
  event_edit_shipping_module : function() {
885
  var element = $(this),
886
+ shipping_module_id = element.data('module-id'),
887
+ spinner = element.siblings('.ajax-feedback'),
888
+ post_data = {
889
+ action : 'shipping_module_settings_form',
890
+ 'shipping_module_id' : shipping_module_id,
891
+ nonce : WPSC_Settings_Page.shipping_module_settings_form_nonce
892
+ },
893
+ ajax_callback = function(response) {
894
+ if (! response.is_successful) {
895
+ alert(response.error.messages.join("\n"));
896
+ return;
897
+ }
898
+
899
+ if (history.pushState) {
900
+ var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab + '&shipping_module_id=' + shipping_module_id;
901
+ history.pushState({url : new_url}, '', new_url);
902
+ }
903
+ spinner.toggleClass('ajax-feedback-active');
904
+ $('#wpsc-shipping-module-settings').replaceWith(response.obj.content);
905
+ };
 
 
 
 
 
 
 
 
906
 
907
  spinner.toggleClass('ajax-feedback-active');
908
  $.wpsc_post(post_data, ajax_callback);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
909
  return false;
910
  },
911
 
915
  */
916
  event_sync_shipwire : function() {
917
  var element = $(this),
918
+ spinner = element.siblings('.ajax-feedback'),
919
+ post_data = {
920
+ action : 'sync_shipwire_products',
921
+ nonce : WPSC_Settings_Page.shipping_module_settings_form_nonce
922
+ },
923
+ ajax_callback = function(response) {
924
+ $('<div class="updated shipwire-update"><p><strong>' + response.tracking + '<br />' + response.inventory + '</strong></p></div>').
925
+ insertBefore(element).
926
+ fadeIn('slow').
927
+ delay(5500).
928
+ fadeOut('slow');
929
+ spinner.toggleClass('ajax-feedback-active');
930
+ };
 
 
 
931
  spinner.toggleClass('ajax-feedback-active');
932
+ $.post(ajaxurl, post_data, ajax_callback, 'json');
933
  return false;
934
  },
935
 
942
  WPSC_Settings_Page.Shipping.wrapper.find('#wpsc-shipping-module-settings tr:odd').addClass('alternate');
943
  }
944
  };
945
+ $(WPSC_Settings_Page).bind('wpsc_settings_tab_loaded_shipping', WPSC_Settings_Page.Shipping.event_init);
946
 
947
  /**
948
  * Payments Tab
952
  WPSC_Settings_Page.Gateway = {
953
  event_init : function() {
954
  var wrapper = $('#options_gateway');
955
+ wrapper.delegate('.edit-payment-module', 'click', WPSC_Settings_Page.Gateway.event_edit_payment_gateway);
 
956
  },
957
+
958
  event_edit_payment_gateway : function() {
959
+ var element = $(this),
960
+ payment_gateway_id = element.data('gateway-id'),
961
+ spinner = element.siblings('.ajax-feedback'),
962
+ post_data = {
963
  action : 'payment_gateway_settings_form',
964
  'payment_gateway_id' : payment_gateway_id,
965
  nonce : WPSC_Settings_Page.payment_gateway_settings_form_nonce
966
+ },
967
+ ajax_callback = function(response) {
968
+ if (! response.is_successful) {
969
+ alert(response.error.messages.join("\n"));
970
+ return;
971
+ }
972
+
973
+ if (history.pushState) {
974
+ var new_url = '?page=wpsc-settings&tab=' + WPSC_Settings_Page.current_tab + '&payment_gateway_id=' + payment_gateway_id;
975
+ history.pushState({url : new_url}, '', new_url);
976
+ }
977
+ spinner.toggleClass('ajax-feedback-active');
978
+ $('#wpsc-payment-gateway-settings-panel').replaceWith(response.obj.content);
979
+ };
 
 
 
 
 
 
980
 
981
  spinner.toggleClass('ajax-feedback-active');
982
  $.wpsc_post(post_data, ajax_callback);
983
  return false;
 
 
 
 
 
 
 
 
 
 
 
984
  }
985
  };
986
+ $(WPSC_Settings_Page).bind('wpsc_settings_tab_loaded_gateway', WPSC_Settings_Page.Gateway.event_init);
987
 
988
  /**
989
  * Marketing Tab
995
 
996
  var wrapper = $('div#wpsc_google_analytics_integration');
997
 
998
+ wrapper.delegate('input[type="checkbox"]', 'click', WPSC_Settings_Page.Marketing.event_show_hide_dependencies);
999
 
1000
  var checkbox = $( 'div#wpsc_google_analytics_integration input[type="checkbox"]' );
1001
 
1002
  $.each( checkbox, function( i, e ) {
1003
  if ( $(this).is( ':checked' ) )
1004
  $(this).parent('p').nextAll('p').hide();
1005
+ })
1006
  },
1007
 
1008
  event_show_hide_dependencies : function () {
1016
 
1017
  };
1018
 
1019
+ $(WPSC_Settings_Page).bind('wpsc_settings_tab_loaded_marketing', WPSC_Settings_Page.Marketing.event_init);
1020
 
1021
  })(jQuery);
1022
 
wpsc-admin/js/sortable-table.js CHANGED
@@ -87,7 +87,7 @@
87
  var t = $(this);
88
  t.find('tr').addClass('sortable');
89
  t.sortable({
90
- axis : 'y',
91
  items : 'tr.sortable',
92
  containment : t,
93
  placeholder : 'wpsc-sortable-table-placeholder',
@@ -99,4 +99,4 @@
99
  });
100
  });
101
  };
102
- })(jQuery);
87
  var t = $(this);
88
  t.find('tr').addClass('sortable');
89
  t.sortable({
90
+ axix : 'y',
91
  items : 'tr.sortable',
92
  containment : t,
93
  placeholder : 'wpsc-sortable-table-placeholder',
99
  });
100
  });
101
  };
102
+ })(jQuery);
wpsc-admin/js/variations.js CHANGED
@@ -46,33 +46,19 @@ var wpsc_display_thickbox = function(title, url) {
46
  tb_show(WPSC_Variations.thickbox_title.replace('%s', title), url);
47
  };
48
 
49
- var wpsc_set_variation_product_thumbnail = function(id, src, thumbId) {
50
  var iframe = jQuery('#wpsc_product_variation_forms iframe');
51
- var el = iframe.contents().find('#wpsc-variation-thumbnail-' + id);
52
- el.attr('src', src);
53
- el.parent().data( 'image-id', 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($) {
61
-
62
  $(function(){
63
-
64
- if ( 'undefined' === typeof WPSC_Term_List_Levels ) {
65
- return;
66
- }
67
-
68
  var table = $('body.edit-tags-php .wp-list-table');
69
  table.find('tbody tr').each(function(){
70
- var t = $(this);
71
- if (!t.hasClass('no-items')) {
72
  id = t.attr('id').replace(/[^0-9]+/g, '');
73
- t.data('level', WPSC_Term_List_Levels[id]);
74
- t.data('id', id);
75
- }
76
  });
77
 
78
  table.wpsc_sortable_table({
@@ -93,6 +79,6 @@ var wpsc_refresh_variation_iframe = function() {
93
  sort_order: order,
94
  parent_id: 0
95
  };
96
- jQuery.post( ajaxurl, data );
97
  };
98
  })(jQuery);
46
  tb_show(WPSC_Variations.thickbox_title.replace('%s', title), url);
47
  };
48
 
49
+ var wpsc_set_variation_product_thumbnail = function(id, src) {
50
  var iframe = jQuery('#wpsc_product_variation_forms iframe');
51
+ iframe.contents().find('#wpsc-variation-thumbnail-' + id).attr('src', src);
 
 
 
 
 
 
52
  };
53
 
54
  (function($) {
 
55
  $(function(){
 
 
 
 
 
56
  var table = $('body.edit-tags-php .wp-list-table');
57
  table.find('tbody tr').each(function(){
58
+ var t = $(this),
 
59
  id = t.attr('id').replace(/[^0-9]+/g, '');
60
+ t.data('level', WPSC_Term_List_Levels[id]);
61
+ t.data('id', id);
 
62
  });
63
 
64
  table.wpsc_sortable_table({
79
  sort_order: order,
80
  parent_id: 0
81
  };
82
+ jQuery.post(ajaxurl, data);
83
  };
84
  })(jQuery);
wpsc-admin/js/wp-e-commerce-admin.js DELETED
@@ -1,169 +0,0 @@
1
- ///////////////////////////////////////////////////////////////////////////////////////////////
2
- // This section is used to create the globals that were originally defined in the
3
- // dynamic-js file pre 3.8.14. Note that variables also also exist in the "wpsc_ajax" structure.
4
- // To add a new global property that can be referenced in the script see the hook
5
- // wpsc_javascript_localizations in wpsc-core/wpsc-functions.php
6
- //
7
-
8
- /**
9
- * Legacy javascript variables for WP-e-Commerce
10
- *
11
- * These WPeC WordPress localized vars were in use prior to release 3.8.14, and are explicitly
12
- * declared here for maximum backwards compatibility. For admin related js vars added after
13
- * version 3.8.14 use the following utility function to access the localized variables.
14
- *
15
- * wpsc_admin_var_get ( name )
16
- * wpsc_admin_var_set ( name, value )
17
- * wpsc_admin_var_isset ( name, value );
18
- *
19
- */
20
-
21
- if ( typeof wpsc_admin_vars !== undefined ) {
22
- var ajaxurl = wpsc_admin_vars['ajaxurl'];
23
- var base_url = wpsc_admin_vars['base_url'];
24
- var WPSC_URL = wpsc_admin_vars['WPSC_URL'];
25
- var WPSC_IMAGE_URL = wpsc_admin_vars['WPSC_IMAGE_URL'];
26
- var fileThickboxLoadingImage = wpsc_admin_vars['fileThickboxLoadingImage'];
27
- var hidden_boxes = wpsc_admin_vars['hidden_boxes'];
28
- var IS_WP27 = wpsc_admin_vars['IS_WP27'];
29
- var TXT_WPSC_DELETE = wpsc_admin_vars['TXT_WPSC_DELETE'];
30
- var TXT_WPSC_TEXT = wpsc_admin_vars['TXT_WPSC_TEXT'];
31
- var TXT_WPSC_EMAIL = wpsc_admin_vars['TXT_WPSC_EMAIL'];
32
- var TXT_WPSC_COUNTRY = wpsc_admin_vars['TXT_WPSC_COUNTRY'];
33
- var TXT_WPSC_TEXTAREA = wpsc_admin_vars['TXT_WPSC_TEXTAREA'];
34
- var TXT_WPSC_HEADING = wpsc_admin_vars['TXT_WPSC_HEADING'];
35
- var TXT_WPSC_COUPON = wpsc_admin_vars['TXT_WPSC_COUPON'];
36
- var HTML_FORM_FIELD_TYPES = wpsc_admin_vars['HTML_FORM_FIELD_TYPES'];
37
- var HTML_FORM_FIELD_UNIQUE_NAMES = wpsc_admin_vars['HTML_FORM_FIELD_UNIQUE_NAMES'];
38
- var TXT_WPSC_LABEL = wpsc_admin_vars['TXT_WPSC_LABEL'];
39
- var TXT_WPSC_LABEL_DESC = wpsc_admin_vars['TXT_WPSC_LABEL_DESC'];
40
- var TXT_WPSC_ITEM_NUMBER = wpsc_admin_vars['TXT_WPSC_ITEM_NUMBER'];
41
- var TXT_WPSC_LIFE_NUMBER = wpsc_admin_vars['TXT_WPSC_LIFE_NUMBER'];
42
- var TXT_WPSC_PRODUCT_CODE = wpsc_admin_vars['TXT_WPSC_PRODUCT_CODE'];
43
- var TXT_WPSC_PDF = wpsc_admin_vars['TXT_WPSC_PDF'];
44
- var TXT_WPSC_AND_ABOVE = wpsc_admin_vars['TXT_WPSC_AND_ABOVE'];
45
- var TXT_WPSC_IF_PRICE_IS = wpsc_admin_vars['TXT_WPSC_IF_PRICE_IS'];
46
- var TXT_WPSC_IF_WEIGHT_IS = wpsc_admin_vars['TXT_WPSC_IF_WEIGHT_IS'];
47
- }
48
- ///////////////////////////////////////////////////////////////////////////////////////////////
49
-
50
- /**
51
- * check if a localized WPeC value is set
52
- *
53
- * @since 3.8.14
54
- *
55
- * @param string name name of localized variable
56
- *
57
- * @returns boolean true if the var is set, false otherwise
58
- *
59
- */
60
- function wpsc_admin_var_isset( name ) {
61
- if ( typeof wpsc_admin_vars !== undefined ) {
62
- return wpsc_admin_vars[name] !== undefined;
63
- }
64
-
65
- return false;
66
- }
67
-
68
- /**
69
- * get the value of a localized WPeC value if it is set
70
- *
71
- * @since 3.8.14
72
- *
73
- * @param string name name of localized variable
74
- *
75
- * @returns varies value of the var set
76
- *
77
- */
78
- function wpsc_admin_var_get( name ) {
79
- if ( typeof wpsc_admin_vars !== undefined ) {
80
- return wpsc_admin_vars[name];
81
- }
82
-
83
- return undefined;
84
- }
85
-
86
- /**
87
- * change the value of a localized WPeC var
88
- *
89
- * @since 3.8.14
90
- *
91
- * @param string name name of localized variable
92
- * @param varies value value of the var being set
93
- *
94
- * @returns varies value of the var being set
95
- *
96
- */
97
- function wpsc_admin_var_set( name, value ) {
98
- if ( typeof wpsc_admin_vars !== undefined ) {
99
- wpsc_admin_vars[name] = value;
100
- return value;
101
- }
102
-
103
- return undefined;
104
- }
105
-
106
-
107
- ///////////////////////////////////////////////////////////////////////////////////////////////
108
- // Setting up the WPEC customer identifier
109
- //
110
- // When WPEC generates a page it sets a 'customer cookie' into the browser. This cookie is a
111
- // persistent identifier that connects a user's session to their cart or other profile data a
112
- // store may need to work correctly.
113
- //
114
- // When page caching or a CDN is in place WPEC does not get to set the cookie because
115
- // the page is served without the overhead of computing the page contents.
116
- // This means that the first GET/POST request, including requests using AJAX are required to
117
- // initialize the customer identifier
118
- //
119
- // Because browsers may execute these requests in parallel the probability of multiple unique
120
- // cookies being set is very high. This means that in the absence of the logic below WPEC would
121
- // have to create multiple unique profiles as each of the parallel requests are executed. This
122
- // can cause data when one request uses one profile and the other request uses a different profile.
123
- // It could also cause performance issues on the back-end, and create a potentially resource
124
- // intensive and wasteful situation.
125
- //
126
- // The mitigation for this issue is to look for the customer identifier when this script first
127
- // runs. If the identifier is not found, initiate a very quick synchronous AJAX request. This
128
- // happens before any other processing takes place. This request should create the unique
129
- // customer identifier before it is required by other processing.
130
- //
131
-
132
- // a global variable used to hold the current users visitor id,
133
- // if you are going to user it always check to be sure it is not false
134
- var wpsc_visitor_id = false;
135
-
136
- if ( ! ( document.cookie.indexOf("wpsc_customer_cookie") >= 0 ) ) {
137
- if ( ! ( document.cookie.indexOf("wpsc_attempted_validate") >= 0 ) ) {
138
- // create a cookie to signal that we have attempted validation. If we find the cookie is set
139
- // we don't re-attempt validation. This means will only try to validate once and not slow down
140
- // subsequent page views.
141
-
142
- // The lack of expiration date means the cookie will be deleted when the browser
143
- // is closed, so the next time the visitor attempts to access the site they will
144
- // attempt to revalidate
145
- var now = new Date();
146
- document.cookie="wpsc_attempted_validate="+now;
147
-
148
- var wpsc_http = new XMLHttpRequest();
149
- wpsc_http.overrideMimeType( "application/json" );
150
-
151
- // open setup and send the request in synchronous mode
152
- wpsc_http.open( "POST", ajaxurl + "?action=wpsc_validate_customer", false );
153
- wpsc_http.setRequestHeader( "Content-type", "application/json; charset=utf-8" );
154
-
155
- // Note that we cannot set a timeout on synchronous requests due to XMLHttpRequest limitations
156
- wpsc_http.send();
157
-
158
- // we did the request in synchronous mode so we don't need the on load or ready state change events to check the result
159
- if (wpsc_http.status == 200) {
160
- var result = JSON.parse( wpsc_http.responseText );
161
- if ( result.valid && result.id ) {
162
- wpsc_visitor_id = result.id;
163
- }
164
- }
165
- }
166
- }
167
- // end of setting up the WPEC customer identifier
168
- ///////////////////////////////////////////////////////////////////////////////////////////////
169
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/js/wpsc-swfupload-handlers.js ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * This is a nearly exact copy of the corresponding wordpress file, we needed to copy and modify it for our use of swfupoader as the wordpress handler code is specific to posts
3
+ */
4
+ // define a global variable for swfupload here so that we can later do things to it.
5
+ var swfu = null;
6
+
7
+
8
+ jQuery().ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
9
+ // nonces are only regenerated on autosaving when ther product ID is created/changed
10
+ // we only want to edit the swfuploader parameters when that happens
11
+ if(/autosave-generate-nonces/.test(ajaxOptions.data)) {
12
+ window.swfu.removePostParam('product_id');
13
+ window.swfu.addPostParam('product_id', parseInt(jQuery('#post_ID').val()));
14
+ }
15
+ //console.log(jQuery('#post_ID').val());
16
+ });
17
+
18
+
19
+ function wpsc_fileDialogStart() {
20
+ jQuery("#media-upload-error").empty();
21
+ }
22
+
23
+ // progress and success handlers for media multi uploads
24
+ function wpsc_fileQueued(fileObj) {
25
+ // Create a progress bar containing the filename
26
+ jQuery('#media-items').append('<div id="media-item-' + fileObj.id + '" ><div class="progress"><div class="bar"></div></div></div>');
27
+ // Display the progress div
28
+ jQuery('#media-item-' + fileObj.id + ' .progress').show();
29
+
30
+ // Disable the submit button
31
+ //jQuery('#insert-gallery').attr('disabled', 'disabled');
32
+ }
33
+
34
+ function wpsc_uploadStart(fileObj) {return true; }
35
+
36
+ function wpsc_uploadProgress(fileObj, bytesDone, bytesTotal) {
37
+ // Lengthen the progress bar
38
+ jQuery('#media-item-' + fileObj.id + ' .bar').width(500*bytesDone/bytesTotal);
39
+
40
+ if ( bytesDone == bytesTotal ) {
41
+ jQuery('#media-item-' + fileObj.id + ' .bar').html('<strong class="crunching"></strong>');
42
+ }
43
+ }
44
+
45
+ function wpsc_prepareMediaItem(fileObj, serverData) {
46
+ // Move the progress bar to 100%
47
+ jQuery('#media-item-' + fileObj.id + ' .bar').remove();
48
+ jQuery('#media-item-' + fileObj.id + ' .progress').hide();
49
+
50
+ var f = ( typeof shortform == 'undefined' ) ? 1 : 2;
51
+ // Old style: Append the HTML returned by the server -- thumbnail and form inputs
52
+ if ( isNaN(serverData) || !serverData ) {
53
+ jQuery('#media-item-' + fileObj.id).append(serverData);
54
+ prepareMediaItemInit(fileObj);
55
+ }
56
+ // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
57
+ else {
58
+ jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
59
+ }
60
+ }
61
+
62
+ function wpsc_prepareMediaItemInit(fileObj) {
63
+
64
+ // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
65
+ jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('class', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id);
66
+
67
+ // Replace the original filename with the new (unique) one assigned during upload
68
+ jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
69
+
70
+ // Also bind toggle to the links
71
+ jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){var o=jQuery(this).offset();window.scrollTo(0,o.top-36);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
72
+
73
+ // Bind AJAX to the new Delete button
74
+ jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){
75
+ // Tell the server to delete it. TODO: handle exceptions
76
+ jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{
77
+ id : this.id.replace(/[^0-9]/g,''),
78
+ action : 'delete-post',
79
+ _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')}
80
+ });
81
+ return false;
82
+ });
83
+
84
+ // Open this item if it says to start open (e.g. to display an error)
85
+ jQuery('#media-item-' + fileObj.id + '.startopen')
86
+ .removeClass('startopen')
87
+ .slideToggle(500)
88
+ .parent().eq(0).children('.toggle').toggle();
89
+ }
90
+
91
+ function wpsc_itemAjaxError(id, html) {
92
+ var error = jQuery('#media-item-error' + id);
93
+
94
+ error.html('<div class="file-error"><button type="button" id="dismiss-'+id+'" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+html+'</div>');
95
+ jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})});
96
+ }
97
+
98
+ function wpsc_deleteSuccess(data, textStatus) {
99
+ if ( data == '-1' )
100
+ return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
101
+ if ( data == '0' )
102
+ return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
103
+
104
+ var item = jQuery('#media-item-' + this.id);
105
+
106
+ // Decrement the counters.
107
+ if ( type = jQuery('#type-of-' + this.id).val() )
108
+ jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1);
109
+ if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
110
+ jQuery('.toggle').toggle();
111
+ jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
112
+ }
113
+
114
+ // Vanish it.
115
+ jQuery('#media-item-' + this.id + ' .filename:empty').remove();
116
+ jQuery('#media-item-' + this.id + ' .filename').append(' <span class="file-error">'+swfuploadL10n.deleted+'</span>').siblings('a.toggle').remove();
117
+ jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end()
118
+ .animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50})
119
+ .animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()})
120
+ .animate({backgroundColor:'#fff'}, 400)
121
+ .animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();});
122
+
123
+ return;
124
+ }
125
+
126
+ function wpsc_deleteError(X, textStatus, errorThrown) {
127
+ // TODO
128
+ }
129
+
130
+ function wpsc_updateMediaForm() {
131
+ storeState();
132
+ // Just one file, no need for collapsible part
133
+ if ( jQuery('.type-form #media-items>*').length == 1 ) {
134
+ jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle();
135
+ jQuery('.type-form .slidetoggle').siblings().addClass('hidden');
136
+ }
137
+
138
+ // Only show Save buttons when there is at least one file.
139
+ if ( jQuery('#media-items>*').not('.media-blank').length > 0 )
140
+ jQuery('.savebutton').show();
141
+ else
142
+ jQuery('.savebutton').hide();
143
+
144
+ // Only show Gallery button when there are at least two files.
145
+ if ( jQuery('#media-items>*').length > 1 )
146
+ jQuery('.insert-gallery').show();
147
+ else
148
+ jQuery('.insert-gallery').hide();
149
+ }
150
+
151
+ function wpsc_uploadSuccess(fileObj, serverData) {
152
+ // if async-upload returned an error message, place it in the media item div and return
153
+ if ( serverData.match('media-upload-error') ) {
154
+ jQuery('#media-item-' + fileObj.id).html(serverData);
155
+ return;
156
+ }
157
+ //console.log(fileObj);
158
+ //console.log(serverData);
159
+ eval(serverData);
160
+ if(upload_status == 1 ) {
161
+ output_html = "";
162
+ output_html +="<li class='gallery_image' id='product_image_"+image_id+"'>\n";
163
+ output_html += " <input type='hidden' value='"+image_id+"' name='gallery_image_id[]' class='image-id'/>\n";
164
+ output_html += " <div id='gallery_image_"+image_id+"' class='previewimage'>\n";
165
+ output_html += " <a class='thickbox' rel='product_extra_image_"+image_id+"' href='admin.php?wpsc_admin_action=crop_image&amp;imagename="+image_src+"&amp;imgheight=480&amp;imgwidth=600&amp;product_id=103&amp;width=640&amp;height=342' id='extra_preview_link_"+image_id+"'>\n";
166
+ output_html += " <img title='Preview' alt='Preview' src='"+image_src+"' class='previewimage'/>\n";
167
+ output_html += " </a>\n";
168
+ output_html += " <img src='" + WPSC_CORE_IMAGES_URL + "/cross.png' class='deleteButton' alt='-' style='display: none;'/>\n";
169
+ output_html += " </div>\n";
170
+ output_html += "</li>\n";
171
+
172
+ image_count = jQuery("ul#gallery_list li.gallery_image div a img.previewimage").size();
173
+ if(image_count < 1) {
174
+ replace_existing = 1;
175
+ }
176
+ //console.log(jQuery("ul#gallery_list li.gallery_image div a img.previewimage"));
177
+ //console.log(image_count);
178
+
179
+ if(replace_existing == 1) {
180
+ jQuery("ul#gallery_list").html(output_html);
181
+
182
+ input_set = jQuery.makeArray(jQuery("#gallery_list li:not(.ui-sortable-helper) input.image-id"));
183
+ set = new Array();
184
+ for( var i in input_set) {
185
+ set[i] = jQuery(input_set[i]).val();
186
+ }
187
+ //console.log(set);
188
+
189
+ img_id = jQuery('#gallery_image_'+set[0]).parent('li').attr('id');
190
+
191
+ jQuery('#gallery_image_'+set[0]).children('img.deleteButton').remove();
192
+ jQuery('#gallery_image_'+set[0]).append("<a class='editButton'>Edit <img src='" + WPSC_CORE_IMAGES_URL + "/pencil.png' alt ='' /></a>");
193
+ // jQuery('#gallery_image_'+set[0]).parent('li').attr('id', 0);
194
+
195
+ for(i=1;i<set.length;i++) {
196
+ jQuery('#gallery_image_'+set[i]).children('a.editButton').remove();
197
+ jQuery('#gallery_image_'+set[i]).append("<img alt='-' class='deleteButton' src='" + WPSC_CORE_IMAGES_URL + "/cross.png'/>");
198
+
199
+ element_id = jQuery('#gallery_image_'+set[i]).parent('li').attr('id');
200
+ if(element_id == 0) {
201
+ // jQuery('#gallery_image_'+set[i]).parent('li').attr('id', img_id);
202
+ }
203
+ }
204
+
205
+ order = set.join(',');
206
+ product_id = jQuery('#product_id').val();
207
+
208
+
209
+ postVars = "product_id="+product_id+"&order="+order;
210
+ jQuery.post( 'index.php?wpsc_admin_action=rearrange_images', postVars, function(returned_data) {
211
+ eval(returned_data);
212
+ jQuery('#gallery_image_'+image_id).children('a.editButton').remove();
213
+ jQuery('#gallery_image_'+image_id).children('div.image_settings_box').remove();
214
+ jQuery('#gallery_image_'+image_id).append(image_menu);
215
+ });
216
+ } else {
217
+ jQuery("ul#gallery_list").append(output_html);
218
+ ///jQuery("#gallery_list").trigger( 'update' );
219
+ }
220
+ }
221
+
222
+ //jQuery('#media-item-' + fileObj.id + ' .progress').show();
223
+ //window.setInterval(function() {
224
+ jQuery("#media-item-" + fileObj.id + "").fadeOut("normal");
225
+ //}, 5000);
226
+
227
+ //prepareMediaItem(fileObj, serverData);
228
+ //updateMediaForm();
229
+
230
+ }
231
+
232
+ function wpsc_uploadComplete(fileObj) {
233
+ // If no more uploads queued, enable the submit button
234
+ if ( swfu.getStats().files_queued == 0 )
235
+ jQuery('#insert-gallery').attr('disabled', '');
236
+ }
237
+
238
+
239
+ // wp-specific error handlers
240
+
241
+ // generic message
242
+ function wpsc_wpQueueError(message) {
243
+ jQuery('#media-upload-error').show().text(message);
244
+ }
245
+
246
+ // file-specific message
247
+ function wpsc_wpFileError(fileObj, message) {
248
+ jQuery('#media-item-' + fileObj.id + ' .filename').after('<div class="file-error"><button type="button" id="dismiss-' + fileObj.id + '" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+message+'</div>').siblings('.toggle').remove();
249
+ jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
250
+ }
251
+
252
+ function wpsc_fileQueueError(fileObj, error_code, message) {
253
+ // Handle this error separately because we don't want to create a FileProgress element for it.
254
+ if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) {
255
+ wpQueueError(swfuploadL10n.queue_limit_exceeded);
256
+ }
257
+ else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) {
258
+ fileQueued(fileObj);
259
+ wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit);
260
+ }
261
+ else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) {
262
+ fileQueued(fileObj);
263
+ wpFileError(fileObj, swfuploadL10n.zero_byte_file);
264
+ }
265
+ else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) {
266
+ fileQueued(fileObj);
267
+ wpFileError(fileObj, swfuploadL10n.invalid_filetype);
268
+ }
269
+ else {
270
+ wpQueueError(swfuploadL10n.default_error);
271
+ }
272
+ }
273
+
274
+ function wpsc_fileDialogComplete(num_files_queued) {
275
+ try {
276
+ if (num_files_queued > 0) {
277
+ this.startUpload();
278
+ }
279
+ } catch (ex) {
280
+ this.debug(ex);
281
+ }
282
+ }
283
+
284
+ function wpsc_swfuploadPreLoad() {
285
+ var swfupload_element = jQuery('#'+swfu.customSettings.swfupload_element_id).get(0);
286
+ jQuery('#' + swfu.customSettings.degraded_element_id).hide();
287
+ // Doing this directly because jQuery().show() seems to have timing problems
288
+ if ( swfupload_element && ! swfupload_element.style.display )
289
+ swfupload_element.style.display = 'block';
290
+ }
291
+
292
+ function wpsc_swfuploadLoadFailed() {
293
+ jQuery('#' + swfu.customSettings.swfupload_element_id).hide();
294
+ jQuery('#' + swfu.customSettings.degraded_element_id).show();
295
+ }
296
+
297
+ function wpsc_uploadError(fileObj, error_code, message) {
298
+ // first the file specific error
299
+ if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) {
300
+ wpFileError(fileObj, swfuploadL10n.missing_upload_url);
301
+ }
302
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) {
303
+ wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded);
304
+ }
305
+ else {
306
+ wpFileError(fileObj, swfuploadL10n.default_error);
307
+ }
308
+
309
+ // now the general upload status
310
+ if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) {
311
+ wpQueueError(swfuploadL10n.http_error);
312
+ }
313
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) {
314
+ wpQueueError(swfuploadL10n.upload_failed);
315
+ }
316
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) {
317
+ wpQueueError(swfuploadL10n.io_error);
318
+ }
319
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) {
320
+ wpQueueError(swfuploadL10n.security_error);
321
+ }
322
+ else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) {
323
+ wpQueueError(swfuploadL10n.security_error);
324
+ }
325
+ }
326
+
327
+ // remember the last used image size, alignment and url
328
+ var storeState;
329
+ (function($){
330
+
331
+ storeState = function(){
332
+ var align = getUserSetting('align') || '', imgsize = getUserSetting('imgsize') || '';
333
+
334
+ $('tr.align input[type="radio"]').click(function(){
335
+ setUserSetting('align', $(this).val());
336
+ }).filter(function(){
337
+ if ( $(this).val() == align )
338
+ return true;
339
+ return false;
340
+ }).attr('checked','checked');
341
+
342
+ $('tr.image-size input[type="radio"]').click(function(){
343
+ setUserSetting('imgsize', $(this).val());
344
+ }).filter(function(){
345
+ if ( $(this).attr('disabled') || $(this).val() != imgsize )
346
+ return false;
347
+ return true;
348
+ }).attr('checked','checked');
349
+
350
+ $('tr.url button').click(function(){
351
+ var c = this.className || '';
352
+ c = c.replace(/.*?(url[^ '"]+).*/, '$1');
353
+ if (c) setUserSetting('urlbutton', c);
354
+ $(this).siblings('.urlfield').val( $(this).attr('title') );
355
+ });
356
+
357
+ $('tr.url .urlfield').each(function(){
358
+ var b = getUserSetting('urlbutton');
359
+ $(this).val( $(this).siblings('button.'+b).attr('title') );
360
+ });
361
+ }
362
+ })(jQuery);
wpsc-admin/media.php DELETED
@@ -1,95 +0,0 @@
1
- <?php
2
-
3
- add_action( 'admin_enqueue_scripts', '_wpsc_action_enqueue_media_scripts' );
4
- add_action( 'admin_enqueue_scripts', '_wpsc_action_enqueue_media_styles' );
5
- add_action( 'admin_footer', '_wpsc_action_print_media_templates' );
6
-
7
- function _wpsc_action_enqueue_media_scripts() {
8
- $current_screen = get_current_screen();
9
-
10
- if ( in_array( $current_screen->id, array( 'wpsc-product-variations-iframe', 'wpsc-product' ) ) ) {
11
- $post = get_post();
12
- if ( ! $post )
13
- $id = absint( $_REQUEST['product_id'] );
14
- else
15
- $id = $post->ID;
16
-
17
- $gallery = _wpsc_get_product_gallery_json( $id );
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 ),
26
- 'getGalleryNonce' => wp_create_nonce( 'wpsc_ajax_get_gallery_' . $id )
27
- ) );
28
- }
29
- }
30
-
31
- function _wpsc_action_enqueue_media_styles() {
32
- $current_screen = get_current_screen();
33
-
34
- if ( 'wpsc-product' == $current_screen->id )
35
- wp_enqueue_style( 'wpsc-media', WPSC_URL . '/wpsc-admin/css/media.css', array( 'media-views' ), WPSC_VERSION );
36
- }
37
-
38
- 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>
47
- <?php
48
- }
49
-
50
- function _wpsc_ajax_verify_get_variation_gallery() {
51
- return _wpsc_ajax_verify_nonce( 'get_variation_gallery_' . absint( $_REQUEST['id'] ) );
52
- }
53
-
54
- function _wpsc_ajax_get_variation_gallery() {
55
- $id = absint( $_REQUEST['id'] );
56
-
57
- $gallery = _wpsc_get_product_gallery_json( $id );
58
-
59
- return array(
60
- 'models' => $gallery,
61
- 'featuredId' => wpsc_the_product_thumbnail_id( $id )
62
- );
63
- }
64
-
65
- function _wpsc_ajax_verify_save_product_gallery() {
66
- return _wpsc_ajax_verify_nonce( 'update_gallery_' . absint( $_REQUEST['postId'] ) );
67
- }
68
-
69
- function _wpsc_ajax_verify_get_product_gallery() {
70
- return _wpsc_ajax_verify_nonce( 'get_gallery_' . absint( $_REQUEST['postId'] ) );
71
- }
72
-
73
- function _wpsc_ajax_save_product_gallery() {
74
- $id = absint( $_REQUEST['postId'] );
75
- $items = array_map( 'absint', $_REQUEST['items'] );
76
- $thumb = get_post_thumbnail_id( $id );
77
-
78
- // always make sure the thumbnail is included
79
- if ( $thumb && ! in_array( $thumb, $items ) )
80
- $items[] = $thumb;
81
-
82
- $result = wpsc_set_product_gallery( $id, $items );
83
-
84
- return _wpsc_get_product_gallery_json( $id );
85
- }
86
-
87
- function _wpsc_ajax_get_product_gallery() {
88
- $id = absint( $_REQUEST['postId'] );
89
- return _wpsc_get_product_gallery_json( $id );
90
- }
91
-
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/settings-page.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * WP eCommerce Settings Page API.
4
  *
5
  * Third-party plugin / theme developers can add their own tabs to WPEC store settings page.
6
  *
@@ -11,10 +11,10 @@
11
  * function my_plugin_settings_tabs( $settings_page ) {
12
  * $settings_page->register_tab( 'recommendation_system', 'Recommendation System' );
13
  * }
14
- * add_action( 'wpsc_register_settings_tabs', 'my_plugin_settings_tabs', 10, 1 );
15
  * </code>
16
  *
17
- * Note that you need to hook into 'wpsc_register_settings_tabs' to do this.
18
  *
19
  * The next step is to create a class for your tab which inherits from the base 'WPSC_Settings_Tab'.
20
  * The name of the class needs to follow this convention: all the words have to be capitalized and
@@ -47,7 +47,8 @@
47
  * 'callback_submit_options()'. Then process your submitted fields there.
48
  *
49
  * <code>
50
- * class WPSC_Settings_Tab_Recommendation_System extends WPSC_Settings_Tab {
 
51
  * // ...
52
  * public function callback_submit_options() {
53
  * if ( isset( $_POST['my_option'] ) )
@@ -69,7 +70,8 @@
69
  * @package wp-e-commerce
70
  * @subpackage settings-api
71
  */
72
- abstract class WPSC_Settings_Tab {
 
73
  /**
74
  * Display the content of the tab. This function has to be overridden.
75
  *
@@ -172,7 +174,8 @@ abstract class WPSC_Settings_Tab {
172
  * @subpackage settings-api
173
  * @final
174
  */
175
- final class WPSC_Settings_Page {
 
176
  /**
177
  * @staticvar object The active object instance
178
  * @since 3.8.8
@@ -203,6 +206,7 @@ final class WPSC_Settings_Page {
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' ),
@@ -365,13 +369,10 @@ final class WPSC_Settings_Page {
365
  */
366
  public function set_current_tab( $tab_id = null ) {
367
  if ( ! $tab_id ) {
368
- $tabs = array_keys( $this->tabs );
369
-
370
  if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->tabs ) )
371
  $this->current_tab_id = $_GET['tab'];
372
  else
373
- $this->current_tab_id = array_shift( $tabs );
374
-
375
  } else {
376
  $this->current_tab_id = $tab_id;
377
  }
@@ -380,10 +381,7 @@ final class WPSC_Settings_Page {
380
 
381
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'submit_options' ) ) {
382
  check_admin_referer( 'update-options', 'wpsc-update-options' );
383
-
384
  $this->save_options();
385
- do_action( 'wpsc_save_' . $this->current_tab_id . '_settings', $this->current_tab );
386
-
387
  $query_args = array();
388
  if ( is_callable( array( $this->current_tab, 'callback_submit_options' ) ) ) {
389
  $additional_query_args = $this->current_tab->callback_submit_options();
@@ -396,7 +394,7 @@ final class WPSC_Settings_Page {
396
  set_transient( 'settings_errors', get_settings_errors(), 30 );
397
  $query_args['settings-updated'] = true;
398
  }
399
- wp_redirect( add_query_arg( $query_args ) );
400
  exit;
401
  }
402
  }
@@ -447,8 +445,7 @@ final class WPSC_Settings_Page {
447
  */
448
  private function submit_url() {
449
  $location = add_query_arg( 'tab', $this->current_tab_id );
450
- $location = apply_filters( 'wpsc_settings_page_submit_url', $location, $this, $this->current_tab );
451
- return $location;
452
  }
453
 
454
  /**
@@ -479,16 +476,16 @@ final class WPSC_Settings_Page {
479
  <div id="options_<?php echo esc_attr( $this->current_tab_id ); ?>" class="tab-content">
480
  <?php
481
  if ( is_callable( array( $this->current_tab, 'display' ) ) ) {
482
- do_action( 'wpsc_before_settings_tab', $this, $this->current_tab );
483
  $this->current_tab->display();
484
- do_action( 'wpsc_after_settings_tab', $this, $this->current_tab );
485
  }
486
  ?>
487
 
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>
@@ -511,11 +508,11 @@ final class WPSC_Settings_Page {
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(); ?>
517
  <div id='wpsc_options_page'>
518
- <form method='post' action='<?php echo esc_url( $this->submit_url() ); ?>' enctype='multipart/form-data' id='wpsc-settings-form'>
519
  <?php $this->display_current_tab(); ?>
520
  </form>
521
  </div>
@@ -532,7 +529,7 @@ final class WPSC_Settings_Page {
532
  * @uses wpdb::get_col() Queries the database.
533
  * @access public
534
  */
535
- private function save_options( $selected = '' ) {
536
  global $wpdb, $wpsc_gateways;
537
  $updated = 0;
538
 
@@ -579,12 +576,6 @@ final class WPSC_Settings_Page {
579
  else
580
  update_option( 'wpsc_ga_tracking_id', '' );
581
 
582
- if ( isset( $_POST['wpsc_ga_use_universal'] ) && $_POST['wpsc_ga_use_universal'] == '1' ) {
583
- update_option( 'wpsc_ga_use_universal', 1 );
584
- } else {
585
- update_option( 'wpsc_ga_use_universal', 0 );
586
- }
587
-
588
  }
589
 
590
  if (empty($_POST['countrylist2']) && !empty($_POST['wpsc_options']['currency_sign_location']))
@@ -641,9 +632,6 @@ final class WPSC_Settings_Page {
641
  );
642
  }
643
  }
644
-
645
- WPSC_Countries::clear_cache();
646
- wpsc_core_flush_temporary_data();
647
  }
648
  $previous_currency = get_option( 'currency_type' );
649
 
@@ -652,7 +640,7 @@ final class WPSC_Settings_Page {
652
  $_POST['wpsc_options'] = stripslashes_deep( $_POST['wpsc_options'] );
653
  // make sure stock keeping time is a number
654
  if ( isset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] ) ) {
655
- $skt = $_POST['wpsc_options']['wpsc_stock_keeping_time']; // I hate repeating myself
656
  $skt = (float) $skt;
657
  if ( $skt <= 0 || ( $skt < 1 && $_POST['wpsc_options']['wpsc_stock_keeping_interval'] == 'hour' ) ) {
658
  unset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] );
@@ -717,13 +705,4 @@ final class WPSC_Settings_Page {
717
  }
718
  }
719
 
720
- WPSC_Settings_Page::init();
721
-
722
- add_action( 'wpsc_after_settings_tab', '_wpsc_action_after_settings_tab' );
723
-
724
- function _wpsc_action_after_settings_tab() {
725
- ?>
726
- <input type='hidden' name='wpsc_admin_action' value='submit_options' />
727
- <?php
728
- wp_nonce_field( 'update-options', 'wpsc-update-options' );
729
- }
1
  <?php
2
  /**
3
+ * WP e-Commerce Settings Page API.
4
  *
5
  * Third-party plugin / theme developers can add their own tabs to WPEC store settings page.
6
  *
11
  * function my_plugin_settings_tabs( $settings_page ) {
12
  * $settings_page->register_tab( 'recommendation_system', 'Recommendation System' );
13
  * }
14
+ * add_action( 'wpsc_load_settings_tab_class', 'my_plugin_settings_tabs', 10, 1 );
15
  * </code>
16
  *
17
+ * Note that you need to hook into 'wpsc_load_settings_tab_class' to do this.
18
  *
19
  * The next step is to create a class for your tab which inherits from the base 'WPSC_Settings_Tab'.
20
  * The name of the class needs to follow this convention: all the words have to be capitalized and
47
  * 'callback_submit_options()'. Then process your submitted fields there.
48
  *
49
  * <code>
50
+ * class WPSC_Settings_Tab_Recommendation_System extends WPSC_Settings_Tab
51
+ * {
52
  * // ...
53
  * public function callback_submit_options() {
54
  * if ( isset( $_POST['my_option'] ) )
70
  * @package wp-e-commerce
71
  * @subpackage settings-api
72
  */
73
+ abstract class WPSC_Settings_Tab
74
+ {
75
  /**
76
  * Display the content of the tab. This function has to be overridden.
77
  *
174
  * @subpackage settings-api
175
  * @final
176
  */
177
+ final class WPSC_Settings_Page
178
+ {
179
  /**
180
  * @staticvar object The active object instance
181
  * @since 3.8.8
206
  public static function init() {
207
  self::$default_tabs = array(
208
  'general' => _x( 'General' , 'General settings tab in Settings->Store page' , 'wpsc' ),
209
+ 'presentation' => _x( 'Presentation', 'Presentation settings tab in Settings->Store page', 'wpsc' ),
210
  'admin' => _x( 'Admin' , 'Admin settings tab in Settings->Store page' , 'wpsc' ),
211
  'taxes' => _x( 'Taxes' , 'Taxes settings tab in Settings->Store page' , 'wpsc' ),
212
  'shipping' => _x( 'Shipping' , 'Shipping settings tab in Settings->Store page' , 'wpsc' ),
369
  */
370
  public function set_current_tab( $tab_id = null ) {
371
  if ( ! $tab_id ) {
 
 
372
  if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->tabs ) )
373
  $this->current_tab_id = $_GET['tab'];
374
  else
375
+ $this->current_tab_id = array_shift( array_keys( $this->tabs ) );
 
376
  } else {
377
  $this->current_tab_id = $tab_id;
378
  }
381
 
382
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'submit_options' ) ) {
383
  check_admin_referer( 'update-options', 'wpsc-update-options' );
 
384
  $this->save_options();
 
 
385
  $query_args = array();
386
  if ( is_callable( array( $this->current_tab, 'callback_submit_options' ) ) ) {
387
  $additional_query_args = $this->current_tab->callback_submit_options();
394
  set_transient( 'settings_errors', get_settings_errors(), 30 );
395
  $query_args['settings-updated'] = true;
396
  }
397
+ wp_redirect( esc_url( add_query_arg( $query_args ) ) );
398
  exit;
399
  }
400
  }
445
  */
446
  private function submit_url() {
447
  $location = add_query_arg( 'tab', $this->current_tab_id );
448
+ return esc_url( $location );
 
449
  }
450
 
451
  /**
476
  <div id="options_<?php echo esc_attr( $this->current_tab_id ); ?>" class="tab-content">
477
  <?php
478
  if ( is_callable( array( $this->current_tab, 'display' ) ) ) {
 
479
  $this->current_tab->display();
 
480
  }
481
  ?>
482
 
483
+ <?php do_action('wpsc_' . $this->current_tab_id . '_settings_page'); ?>
484
  <div class="submit">
485
+ <input type='hidden' name='wpsc_admin_action' value='submit_options' />
486
+ <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
487
  <?php if ( $this->current_tab->is_submit_button_displayed() ): ?>
488
+ <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wpsc' ); ?>" name="updateoption" />
489
  <?php endif ?>
490
  </div>
491
  </div>
508
  <div id="icon_card" class="icon32"></div>
509
  <h2 id="wpsc-settings-page-title">
510
  <?php esc_html_e( 'Store Settings', 'wpsc' ); ?>
511
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
512
  </h2>
513
  <?php $this->output_tabs(); ?>
514
  <div id='wpsc_options_page'>
515
+ <form method='post' action='<?php echo esc_attr( $this->submit_url() ); ?>' enctype='multipart/form-data' id='wpsc-settings-form'>
516
  <?php $this->display_current_tab(); ?>
517
  </form>
518
  </div>
529
  * @uses wpdb::get_col() Queries the database.
530
  * @access public
531
  */
532
+ private function save_options( $selected='' ) {
533
  global $wpdb, $wpsc_gateways;
534
  $updated = 0;
535
 
576
  else
577
  update_option( 'wpsc_ga_tracking_id', '' );
578
 
 
 
 
 
 
 
579
  }
580
 
581
  if (empty($_POST['countrylist2']) && !empty($_POST['wpsc_options']['currency_sign_location']))
632
  );
633
  }
634
  }
 
 
 
635
  }
636
  $previous_currency = get_option( 'currency_type' );
637
 
640
  $_POST['wpsc_options'] = stripslashes_deep( $_POST['wpsc_options'] );
641
  // make sure stock keeping time is a number
642
  if ( isset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] ) ) {
643
+ $skt =& $_POST['wpsc_options']['wpsc_stock_keeping_time']; // I hate repeating myself
644
  $skt = (float) $skt;
645
  if ( $skt <= 0 || ( $skt < 1 && $_POST['wpsc_options']['wpsc_stock_keeping_interval'] == 'hour' ) ) {
646
  unset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] );
705
  }
706
  }
707
 
708
+ WPSC_Settings_Page::init();
 
 
 
 
 
 
 
 
 
wpsc-admin/users.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
- _wpsc_deprecated_file(
3
- __FILE__,
4
- '3.9',
5
- '',
6
- __( 'The sole function that existed in users.php has now been deprecated.', 'wpsc' )
7
- );
 
 
 
 
 
 
 
wpsc-components/marketplace-core-v1/library/Sputnik.php DELETED
@@ -1,596 +0,0 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @package Sputnik
6
- * @subpackage Public API
7
- */
8
-
9
- /**
10
- * Main class
11
- *
12
- * @package Sputnik
13
- * @subpackage Public API
14
- */
15
- class Sputnik {
16
- /**
17
- * Minimum version of WordPress that Sputnik requires
18
- */
19
- const MINVERSION = '3.9';
20
-
21
- /**
22
- * Base URI for store URLs
23
- */
24
- const SITE_BASE = 'https://wpecommerce.org';
25
-
26
- /**
27
- * Base URI for API URLs
28
- */
29
- const API_BASE = 'https://wpecommerce.org/wpec';
30
-
31
- /**
32
- * OAuth client key
33
- */
34
- const OAUTH_KEY = 'k7q3lu9LeOJc';
35
-
36
- /**
37
- * OAuth client secret
38
- *
39
- * Not so secret any more.
40
- */
41
- const OAUTH_SECRET = '8jjSVN54VFhraZttr8pDsCdnogqE22Sq299zTRdFDL2hEUIq';
42
-
43
- /**
44
- * Path to Sputnik
45
- * @var string
46
- */
47
- public static $path = '';
48
-
49
- /**
50
- * Cache of purchased plugins API data
51
- */
52
- protected static $purchased = false;
53
-
54
- /**
55
- * Installed plugin IDs
56
- */
57
- protected static $installed = array();
58
-
59
- /**
60
- * Enabled plugins which haven't been purchased
61
- */
62
- protected static $invalid = array();
63
-
64
- /**
65
- * Plugins which have been suspended remotely
66
- */
67
- protected static $suspended = array();
68
-
69
- protected static $account = null;
70
-
71
- /**
72
- * Register everything we need
73
- */
74
- public static function bootstrap() {
75
-
76
- spl_autoload_register(array(get_class(), 'autoload'));
77
-
78
- self::$installed = get_option('sputnik_installed', array());
79
- self::$suspended = get_option('sputnik_suspended', array());
80
-
81
- //add_action('activated_plugin', array(get_class(), 'clear_installed'));
82
- //add_action('deactivated_plugin', array(get_class(), 'clear_installed'));
83
-
84
- // 'deactivated_plugin' runs before saving, so we have to do this instead:
85
- add_action('update_option_active_plugins', array(get_class(), 'clear_installed'));
86
-
87
- add_action( 'plugins_loaded', array(get_class(), 'loaded'));
88
- add_action( 'init', array(get_class(), 'init'));
89
- add_action( 'init', array( get_class(), 'check_for_saas_push' ) );
90
- add_action( 'init', array( get_class(), 'thumbnails' ) );
91
- add_action( 'init', array( get_class(), 'credentials' ) );
92
- add_action( 'wp', array( get_class(), 'show_login_form' ) );
93
- add_filter( 'extra_plugin_headers', array(get_class(), 'extra_headers'));
94
- add_filter( 'extra_theme_headers', array(get_class(), 'extra_headers'));
95
-
96
- add_action( 'wpsc_update_purchase_log_status', array( get_class(), 'push_sales_data' ), 10, 4 );
97
- add_action( 'init', array( get_class(), 'sales_data_postback' ) );
98
-
99
- add_filter( 'wpsc_purchase_log_customer_notification_raw_message', array( get_class(), 'add_download_link' ), 10, 2 );
100
- add_action( 'wpsc_transaction_results_shutdown' , array( get_class(), 'add_download_link_page' ), 10, 3 );
101
-
102
- Sputnik_Admin::bootstrap();
103
- Sputnik_Updater::bootstrap();
104
- Sputnik_Pointers::bootstrap();
105
- }
106
-
107
- public static function add_download_link( $message, $notification ) {
108
- $cart_contents = $notification->get_purchase_log()->get_cart_contents();
109
-
110
- $products = '';
111
-
112
- foreach ( $cart_contents as $product ) {
113
- $download_link = get_post_meta( $product->prodid, '_download_url', true );
114
- if ( !empty ( $download_link) ) {
115
- $download_link = esc_url( add_query_arg( 'marketplace', Sputnik_API::domain(), $download_link ) );
116
- $products .= "\n" . '<a href="' . $download_link . '">Download ' . $product->name . '</a>' . "\n";
117
- }
118
- }
119
-
120
- return $message . $products;
121
- }
122
-
123
- public static function show_login_form() {
124
- if ( ! isset( $_GET['marketplace'] ) )
125
- return;
126
-
127
- $url = 'http://www.wpeconomy.org/products-page/add/?framed=true&marketplace=' . urlencode( esc_url_raw( Sputnik_API::domain() ) );
128
-
129
- $auth = Sputnik_API::auth_request( $url, false );
130
- ?>
131
- <html>
132
- <head>
133
- <script type="text/javascript" src="<?php echo home_url( $GLOBALS['wp_scripts']->registered['jquery']->src ); ?>"></script>
134
- <script type="text/javascript">
135
- jQuery(window).load(function() {
136
- jQuery( '#add_form' ).load( '<?php echo esc_url( $auth ); ?>' );
137
- });
138
- </script>
139
- </head>
140
- <body>
141
- <div id="add_form"></div>
142
- </body>
143
- </html>
144
- <?php
145
- die;
146
- }
147
-
148
- public static function add_download_link_page( $purchase_log_object, $sessionid, $display_to_screen ) {
149
- if ( ! $display_to_screen )
150
- return;
151
-
152
- $cart_contents = $purchase_log_object->get_cart_contents();
153
-
154
- $products = '';
155
-
156
- foreach ( $cart_contents as $product ) {
157
- $download_link = get_post_meta( $product->prodid, '_download_url', true );
158
- if ( !empty ( $download_link) ) {
159
- $download_link = esc_url( add_query_arg( 'marketplace', Sputnik_API::domain(), $download_link ) );
160
- $products .= "\n" . '<a href="' . $download_link . '">Download ' . $product->name . '</a>' . "\n";
161
- }
162
- }
163
-
164
- echo $products;
165
- }
166
-
167
- /**
168
- * Callback for 'plugins_loaded' action
169
- */
170
- public static function loaded() {
171
- do_action('sputnik_loaded');
172
- }
173
-
174
- /**
175
- * Callback for 'init' action
176
- */
177
- public static function init() {
178
- do_action('sputnik_init');
179
- }
180
-
181
- public static function thumbnails() {
182
- if ( ! isset( $_REQUEST['thumbnails'] ) || ( isset( $_REQUEST['thumbnails'] ) && 'true' !== $_REQUEST['thumbnails'] ) )
183
- return;
184
-
185
- $thumbs = array( 'width' => get_option( 'product_image_width' ), 'height' => get_option( 'product_image_height' ) );
186
-
187
- echo json_encode( $thumbs );
188
- die;
189
- }
190
-
191
- public static function check_for_saas_push() {
192
-
193
- if ( ! isset( $_REQUEST['json_product_push'] ) || ( isset( $_REQUEST['json_product_push'] ) && 'true' !== $_REQUEST['json_product_push'] ) )
194
- return;
195
-
196
- error_reporting( E_ERROR );
197
-
198
- if ( ! empty( $_POST['product'] ) ) {
199
- $product = stripslashes( $_POST['product'] );
200
- $product = json_decode( $product );
201
-
202
- $download_url = Sputnik::API_BASE . '/download/' . $product->post_name . '.zip';
203
- $thumb_url = $product->thumbnail_url;
204
-
205
- //Check if local product exists - if so, update it, if not, don't.
206
- $local = get_posts( array(
207
- 'pagename' => $product->post_name,
208
- 'post_type' => 'wpsc-product',
209
- 'post_status' => 'publish',
210
- 'numberposts' => 1 )
211
- );
212
-
213
- $user_check = get_user_by( 'email', $product->author_email );
214
-
215
- if ( $user_check ) {
216
- $product->post_author = $user_check->ID;
217
-
218
- if ( ! in_array( 'vendor-administrator', $user_check->roles ) )
219
- $user_check->add_role( 'vendor-administrator' );
220
- }
221
- else {
222
- $product->post_author = wp_insert_user( array( 'role' => 'vendor-administrator', 'user_email' => $product->author_email, 'user_pass' => wp_generate_password(), 'user_login' => $product->author_email ) );
223
- }
224
-
225
- $product = (array) $product;
226
- unset( $product['guid'] );
227
- unset( $product['post_date_gmt'] );
228
- unset( $product['post_date'] );
229
-
230
- require_once(ABSPATH . 'wp-admin/includes/media.php');
231
- require_once(ABSPATH . 'wp-admin/includes/file.php');
232
- require_once(ABSPATH . 'wp-admin/includes/image.php');
233
-
234
- if ( ! empty( $local ) ) {
235
- $product['ID'] = $local[0]->ID;
236
- $new_id = wp_update_post( $product );
237
- } else {
238
- unset( $product['ID'] );
239
- // Doesn't exist, create it. Then, after created, add download URL and thumbnail.
240
- $new_id = wp_insert_post( $product );
241
- }
242
-
243
- update_post_meta( $new_id, '_download_url', $download_url );
244
-
245
- foreach ( $product['meta'] as $key => $val ) {
246
- if ( '_wpsc_product_metadata' == $key )
247
- continue;
248
-
249
- if ( '_wpsc_currency' == $key )
250
- continue;
251
-
252
- update_post_meta( $new_id, $key, $val[0] );
253
- }
254
-
255
-
256
-
257
- $thumb = media_sideload_image( $thumb_url, $new_id, 'Product Thumbnail' );
258
-
259
- if ( ! is_wp_error( $thumb ) ) {
260
- $thumbnail_id = get_posts( array( 'post_type' => 'attachment', 'post_parent' => $new_id ) );
261
-
262
- if ( ! empty( $thumbnail_id ) ) {
263
-
264
- $thumbnail = set_post_thumbnail( $new_id, $thumbnail_id[0]->ID );
265
- echo json_encode( array( 'set_thumbnail' => $thumbnail, 'post_id' => $new_id ) );
266
- die;
267
- }
268
- die;
269
- }
270
- die;
271
- }
272
-
273
- exit;
274
- }
275
-
276
- public static function credentials() {
277
-
278
- if ( ! isset( $_REQUEST['credential_request'] ) || ( isset( $_REQUEST['credential_request'] ) && 'true' !== $_REQUEST['credential_request'] ) )
279
- return;
280
-
281
- if ( ! isset( $_SERVER['HTTP_X_CREDENTIALS_REQUEST'] ) )
282
- return;
283
-
284
- die( json_encode( get_option( 'wpsc_payment_gateway_paypal_digital_goods' ) ) );
285
-
286
- }
287
-
288
- /**
289
- * Pushes sales data back to Baikonur
290
- *
291
- * Only pushes once. Accounts for annoying potential edge case of status-switching admins
292
- *
293
- * @param WPSC_Purchase_Log object $purchase_log Purchase Log object
294
- * @return void
295
- */
296
- public static function push_sales_data( $purchase_log_id, $current_status, $old_status, $purchase_log ) {
297
-
298
- $purchase_log = new WPSC_Purchase_Log( $purchase_log_id );
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' );
306
-
307
- if ( empty( $pushed_to_saas ) ) {
308
-
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;
317
- }
318
-
319
- $args = array(
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.
327
- $success = ( 200 === $response );
328
-
329
- wpsc_update_meta( $id, '_pushed_to_wpeconomy', $success, 'purchase_log' );
330
- }
331
- }
332
- }
333
-
334
- public static function sales_data_postback() {
335
- if ( ! isset( $_REQUEST['sales_data'] ) )
336
- return;
337
-
338
- $data = json_decode( stripslashes( $_POST['data'] ) );
339
- $cart_contents = json_decode( stripslashes( $_POST['cart_contents'] ) );
340
-
341
- //Unset purchase log ID, since we're inserting a new one.
342
- $data = (array) $data;
343
-
344
- unset( $data['id'] );
345
-
346
- $purchase_log = new WPSC_Purchase_Log( $data );
347
- $purchase_log->save();
348
- $purchase_log_id = $purchase_log->get( 'id' );
349
-
350
- global $wpdb;
351
-
352
- //We need to update the proper product ID, name and purchase ID
353
- foreach ( $cart_contents as $cart_item ) {
354
-
355
- $product = new WP_Query( array( 'post_type' => 'wpsc-product', 'pagename' => $cart_item->slug ) );
356
- $product = $product->get_posts();
357
- $product = $product[0];
358
-
359
- $cart_item = ( array ) $cart_item;
360
-
361
- unset( $cart_item['id'] );
362
- unset( $cart_item['slug'] );
363
-
364
- $cart_item['prodid'] = $product->ID;
365
- $cart_item['name'] = $product->post_title;
366
- $cart_item['purchaseid'] = $purchase_log_id;
367
-
368
- $wpdb->insert( WPSC_TABLE_CART_CONTENTS, $cart_item );
369
- }
370
-
371
- die;
372
- }
373
-
374
-
375
- /**
376
- * Register our extra plugin metadata headers
377
- */
378
- public static function extra_headers($headers) {
379
- $headers[] = 'Sputnik ID';
380
- $headers[] = 'Requires WPEC Version';
381
- $headers[] = 'Compatible to WPEC Version';
382
- return $headers;
383
- }
384
-
385
- /**
386
- * Autoload a Sputnik class
387
- *
388
- * @param string $class
389
- */
390
- public static function autoload($class) {
391
- if (strpos($class, 'Sputnik') !== 0) {
392
- return;
393
- }
394
-
395
- $file = str_replace('_', '/', $class);
396
- if (file_exists(self::$path . '/library/' . $file . '.php')) {
397
- require_once(self::$path . '/library/' . $file . '.php');
398
- }
399
- }
400
-
401
- /**
402
- * Get available modules
403
- *
404
- * @return array Available plugins (array of meta objects)
405
- */
406
- public static function get_available() {
407
- $plugins = Sputnik_API::get_all();
408
- return $plugins['body'];
409
- }
410
-
411
- /**
412
- * Get popular tags
413
- *
414
- * @return array
415
- */
416
- public static function get_tags() {
417
- $tags = Sputnik_API::get_tags();
418
- return $tags['body'];
419
- }
420
-
421
- /**
422
- * Return whether an account is linked to Sputnik
423
- *
424
- * @return bool
425
- */
426
- public static function account_is_linked() {
427
- $token = get_option('sputnik_oauth_access', false);
428
- return (is_array($token) && !empty($token['oauth_token']));
429
- }
430
-
431
- /**
432
- * Get account information
433
- *
434
- * @return stdObject
435
- */
436
- public static function get_account() {
437
- if ( is_null( self::$account ) ) {
438
- $account = Sputnik_API::get_account();
439
- self::$account = $account['body'];
440
- }
441
-
442
- return self::$account;
443
- }
444
-
445
- /**
446
- * Forces an update to the account information from the server
447
- *
448
- * @return stdObject
449
- */
450
- public static function update_account() {
451
- self::$account = null;
452
- return self::get_account();
453
- }
454
-
455
- /**
456
- * Get purchased plugins
457
- *
458
- * @return array Plugin slugs
459
- */
460
- public static function get_purchased() {
461
- // This should be cached in a transient
462
- if (self::$purchased === false) {
463
- $purchased = Sputnik_API::get_purchased();
464
- self::$purchased = $purchased['body'];
465
- }
466
- return self::$purchased;
467
- }
468
-
469
- /**
470
- * Check if a plugin has been purchased
471
- *
472
- * @param string $plugin Plugin slug
473
- * @return boolean
474
- */
475
- public static function is_purchased($plugin) {
476
- if (is_object($plugin)) {
477
- $plugin = $plugin->slug;
478
- }
479
-
480
- try {
481
- $account = self::get_account();
482
- return in_array($plugin, (array) $account->purchased);
483
- }
484
- catch (Exception $e) {
485
- return false;
486
- }
487
- }
488
-
489
- /**
490
- * Check if a plugin has been suspended
491
- *
492
- * @param string $plugin Plugin slug
493
- * @return boolean
494
- */
495
- public static function is_suspended($plugin) {
496
- if (is_object($plugin)) {
497
- $plugin = $plugin->slug;
498
- }
499
-
500
- return array_key_exists($plugin, self::$suspended);
501
- }
502
-
503
- /**
504
- * Suspend a plugin
505
- *
506
- * For internal use by {@see Sputnik_Updater} only
507
- * @param string $plugin Plugin slug
508
- */
509
- public static function suspend_plugin($plugin, $file, $data) {
510
- // Check that the updater was the one that issued the command
511
- if (!Sputnik_Updater::confirm_suspend($plugin, $data)) {
512
- return false;
513
- }
514
-
515
- self::$suspended[$plugin] = $data;
516
- deactivate_plugins(array($file), true);
517
- update_option('sputnik_suspended', self::$suspended);
518
- return true;
519
- }
520
-
521
- /**
522
- * Get a single module
523
- *
524
- * @param string $id
525
- * @return stdObject
526
- */
527
- public static function get_plugin($id, $user = 0) {
528
- $plugin = Sputnik_API::get_single($id, $user);
529
- return $plugin['body'];
530
- }
531
-
532
- public static function get_from_file($file) {
533
- if (empty(self::$installed)) {
534
- self::$installed = self::load_installed();
535
- }
536
-
537
- if (!empty(self::$installed[$file])) {
538
- return self::$installed[$file];
539
- }
540
-
541
- return null;
542
- }
543
-
544
- public static function check($file, $callback = null) {
545
- $file = plugin_basename($file);
546
-
547
- $plugin = self::get_from_file($file);
548
-
549
- if (!self::is_purchased($plugin['Sputnik ID'])) {
550
- $plugin['sputnik_error'] = 'not_purchased';
551
- self::$invalid[] = $plugin;
552
- return false;
553
- }
554
-
555
- if ($callback !== null) {
556
- call_user_func($callback);
557
- }
558
- return true;
559
- }
560
-
561
- public static function get_installed($force = false) {
562
- if (empty(self::$installed) || $force === true) {
563
- self::$installed = self::load_installed();
564
- }
565
-
566
- return self::$installed;
567
- }
568
-
569
- protected static function load_installed() {
570
- if (!function_exists('get_plugins')) {
571
- require_once(ABSPATH . 'wp-admin/includes/plugin.php');
572
- }
573
-
574
- $all = get_plugins();
575
- $plugins = array();
576
- foreach ($all as $file => $plugin) {
577
- if (empty($plugin['Sputnik ID'])) {
578
- continue;
579
- }
580
- $plugins[$file] = $plugin;
581
- }
582
-
583
- update_option('sputnik_installed', $plugins);
584
-
585
- return $plugins;
586
- }
587
-
588
- public static function clear_installed() {
589
- delete_option('sputnik_installed');
590
- self::$installed = self::load_installed();
591
- }
592
-
593
- public static function get_invalid() {
594
- return self::$invalid;
595
- }
596
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-components/marketplace-core-v1/library/Sputnik/API.php DELETED
@@ -1,246 +0,0 @@
1
- <?php
2
-
3
- class Sputnik_API {
4
- /**
5
- * @var Sputnik_API_Auth
6
- */
7
- protected static $auth = null;
8
-
9
- /**
10
- * For sites like WPeCommerce.org that will distribute Sputnik with a plugin to sell WP plugins,
11
- * we override the domain. This is because we need to ensure Baikonur receives the Saas domain,
12
- * not the end-user domain. Only relevant where Sputnik is available to an end-user, not a Saas.
13
- */
14
- protected static $domain_override = 'https://wpecommerce.org';
15
-
16
- public static function get_all($page = 1, $params = null) {
17
- $url = '/';
18
- if ($page !== 1) {
19
- $url = sprintf('/page/%d', $page);
20
- }
21
-
22
- return self::request($url, $params);
23
- }
24
-
25
- public static function search( $query, $params = null, $page = 1 ) {
26
- $url = '/';
27
-
28
- if ( $page !== 1 ) {
29
- $url = sprintf( '/page/%d', $page );
30
- }
31
-
32
- $extra = array(
33
- 'query' => $query
34
- );
35
-
36
- $params = array_merge( $params, $extra );
37
-
38
- return self::request( $url, $params );
39
- }
40
-
41
-
42
- public static function get_single($name, $user = 0) {
43
- $params = array(
44
- 'name' => $name
45
- );
46
- if ($user !== 0) {
47
- $params['user'] = $user;
48
- }
49
-
50
- $uri = "/info/{$name}/";
51
-
52
- return self::request( $uri );
53
- }
54
-
55
- public static function rate_product($name, $rating) {
56
- self::authenticate();
57
-
58
- $url = sprintf('/info/%s/rate', $name);
59
- $parameters = array('rating' => (int) $rating);
60
- $auth_header = self::$auth->get_auth_header($url, 'POST', $parameters);
61
- $options = array(
62
- 'method' => 'POST',
63
- 'headers' => array(
64
- 'Authorization' => $auth_header
65
- )
66
- );
67
- return self::request($url, $parameters, $options);
68
- }
69
-
70
- public static function get_tags() {
71
- return self::request('/tags');
72
- }
73
-
74
- protected static function authenticate() {
75
- $token = get_option('sputnik_oauth_access', false);
76
-
77
- if ($token == false) {
78
- throw new Exception('Need to authenticate first', 1);
79
- }
80
- self::$auth = new Sputnik_API_Auth(Sputnik::OAUTH_KEY, Sputnik::OAUTH_SECRET, $token['oauth_token'], $token['oauth_token_secret']);
81
- }
82
-
83
- public static function auth_request( $callback = '', $redirect = true ) {
84
- self::$auth = new Sputnik_API_Auth( Sputnik::OAUTH_KEY, Sputnik::OAUTH_SECRET);
85
- $callback_url = empty( $callback ) ? Sputnik_Admin::build_url( array( 'oauth' => 'callback' ) ) : $callback;
86
- $token = self::$auth->get_request_token( $callback_url );
87
-
88
- update_option( 'sputnik_oauth_request', $token );
89
-
90
- $auth_url = self::$auth->get_authorize_url( $token );
91
-
92
- //Modifying to add marketplace and user email to query string.
93
- if ( $redirect ) {
94
- wp_redirect( add_query_arg( array( 'domain' => self::domain(), 'user' => rawurlencode( wp_get_current_user()->user_email ) ), $auth_url ) );
95
- exit;
96
- } else {
97
- return $auth_url;
98
- }
99
- }
100
-
101
- public static function auth_access() {
102
-
103
- if( isset( $_REQUEST['denied'] ) ) {
104
-
105
- $return_url = Sputnik_Admin::build_url( array( 'auth' => 'denied' ) );
106
-
107
- } else {
108
- $request = get_option('sputnik_oauth_request', false);
109
-
110
- self::$auth = new Sputnik_API_Auth(Sputnik::OAUTH_KEY, Sputnik::OAUTH_SECRET, $request['oauth_token'], $request['oauth_token_secret']);
111
- $access = self::$auth->get_access_token($_REQUEST['oauth_verifier']);
112
-
113
- update_option('sputnik_oauth_access', $access);
114
-
115
- $args = array();
116
- if ( ! empty( $_REQUEST['oauth_buy'] ) )
117
- $args['oauth_buy'] = $_REQUEST['oauth_buy'];
118
- $return_url = Sputnik_Admin::build_url( $args );
119
- }
120
-
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();
128
- </script>
129
- </head>
130
- <body>&nbsp;</body>
131
- </html><?php
132
- die();
133
- }
134
-
135
- public static function get_account() {
136
- self::authenticate();
137
-
138
- $url = '/account';
139
- $request = self::$auth->sign($url);
140
- return self::request($request->to_url());
141
- }
142
-
143
- public static function get_purchased() {
144
- self::authenticate();
145
-
146
- $url = '/account/purchased';
147
- $request = self::$auth->sign($url);
148
- return self::request($request->to_url());
149
- }
150
-
151
- public static function get_own() {
152
- self::authenticate();
153
-
154
- $url = '/account/myplugins';
155
- $request = self::$auth->sign($url);
156
- return self::request($request->to_url());
157
- }
158
-
159
- public static function sign_download(&$url, &$args) {
160
- self::authenticate();
161
-
162
- if (!isset($args['headers'])) {
163
- $args['headers'] = array();
164
- }
165
-
166
- $oauth = self::$auth->sign($url);
167
-
168
- $url = $oauth->to_url();
169
- }
170
-
171
- public static function get_auth_for_download($url) {
172
- self::authenticate();
173
-
174
- return self::$auth->get_auth_header($url);
175
- }
176
-
177
- /* Purchase Methods */
178
-
179
- public static function get_checkout_token( $product ) {
180
- self::authenticate();
181
-
182
- $url = '/purchase/get_checkout_token/' . $product->client_product_id;
183
-
184
- $request = self::$auth->sign( $url, 'GET', array(
185
- 'redirect_uri' => Sputnik_Admin::build_url( array( '_wpnonce' => wp_create_nonce( 'sputnik_install-plugin_' . $product->slug ) ) )
186
- )
187
- );
188
-
189
- $response = self::request( $request->to_url(), array(), array( 'timeout' => 25 ) );
190
-
191
- return $response;
192
- }
193
-
194
- /* Helper Methods */
195
- public static function request($url, $params = null, $args = array()) {
196
-
197
- if ( ! empty( $params ) ) {
198
- $url = add_query_arg( $params, $url );
199
- }
200
-
201
- $defaults = array( 'method' => 'GET' );
202
-
203
- $args = wp_parse_args( $args, $defaults );
204
-
205
- if ( strpos( $url, 'http' ) !== 0 ) {
206
- $url = Sputnik::API_BASE . $url;
207
- }
208
-
209
- $args['timeout'] = 25;
210
- $args['headers']['user-agent'] = 'WP eCommerce Marketplace: ' . WPSC_VERSION;
211
- $args['headers']['X-WP-Domain'] = self::domain();
212
-
213
- $request = wp_remote_request( $url, $args );
214
-
215
- if ( is_wp_error( $request ) ) {
216
- throw new Exception( $request->get_error_message() );
217
- }
218
-
219
- if ( $request['response']['code'] != 200 ) {
220
- throw new Exception($request['body'], $request['response']['code']);
221
- }
222
-
223
- $result = json_decode($request['body']);
224
-
225
- if ($result === null) {
226
- throw new Exception($request['body'], $request['response']['code']);
227
- }
228
-
229
- $request['body'] = $result;
230
-
231
-
232
- return $request;
233
- }
234
-
235
- public static function domain() {
236
- $wp_install = home_url( '/' );
237
-
238
- if ( is_multisite() )
239
- $wp_install = network_site_url( '/' );
240
-
241
- if ( ! empty( self::$domain_override ) )
242
- $wp_install = self::$domain_override;
243
-
244
- return $wp_install;
245
- }
246
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-components/marketplace-core-v1/library/Sputnik/API/Auth.php DELETED
@@ -1,137 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Sputnik OAuth class
5
- */
6
- class Sputnik_API_Auth {
7
- public function __construct($key, $secret, $token = null, $token_secret = null) {
8
- $this->sha1_method = new Sputnik_OAuth_SignatureMethod_HMAC_SHA1();
9
- $this->consumer = new Sputnik_OAuth_Consumer($key, $secret);
10
- if (!empty($token) && !empty($token_secret)) {
11
- $this->token = new Sputnik_OAuth_Consumer($token, $token_secret);
12
- } else {
13
- $this->token = NULL;
14
- }
15
- }
16
-
17
- /**
18
- * Get a request_token from Twitter
19
- *
20
- * @return array A key/value array containing oauth_token and oauth_token_secret
21
- */
22
- public function get_request_token($callback = null) {
23
- $parameters = array();
24
- if (!empty($callback)) {
25
- $parameters['oauth_callback'] = $callback;
26
- }
27
- $request = $this->request('/auth/request_token', 'GET', $parameters);
28
-
29
- $token = Sputnik_OAuth_Util::parse_parameters($request);
30
- $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
31
- return $token;
32
- }
33
-
34
- /**
35
- * Get the authorize URL
36
- *
37
- * @return string
38
- */
39
- public function get_authorize_url($token) {
40
- if (is_array($token)) {
41
- $token = $token['oauth_token'];
42
- }
43
- return Sputnik::SITE_BASE . "/oauth/authorize?oauth_token={$token}";
44
- }
45
-
46
- /**
47
- * Exchange request token and secret for an access token and
48
- * secret, to sign API calls.
49
- *
50
- * @return array("oauth_token" => "the-access-token",
51
- * "oauth_token_secret" => "the-access-secret",
52
- * "user_id" => "9436992",
53
- * "screen_name" => "abraham")
54
- */
55
- public function get_access_token($verifier = false) {
56
- $parameters = array();
57
- if (!empty($verifier)) {
58
- $parameters['oauth_verifier'] = $verifier;
59
- }
60
-
61
- $request = $this->request('/auth/access_token', 'GET', $parameters);
62
-
63
- $token = Sputnik_OAuth_Util::parse_parameters($request);
64
- $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
65
- return $token;
66
- }
67
-
68
- /**
69
- * Format and sign an OAuth / API request
70
- */
71
- public function sign($url, $method = 'GET', $parameters = array()) {
72
- if (strpos($url, 'http') !== 0) {
73
- $url = Sputnik::API_BASE . $url;
74
- }
75
-
76
- $request = Sputnik_OAuth_Request::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
77
- $request->sign_request($this->sha1_method, $this->consumer, $this->token);
78
- return $request;
79
- }
80
-
81
- /**
82
- * Format and sign an OAuth / API request
83
- */
84
- public function get_auth_header($url, $method = 'GET', $parameters = array()) {
85
- if (strpos($url, 'http') !== 0) {
86
- $url = Sputnik::API_BASE . $url;
87
- }
88
- $request = Sputnik_OAuth_Request::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
89
- $request->sign_request($this->sha1_method, $this->consumer, $this->token);
90
- $header = $request->to_header($this->sha1_method, $this->consumer, $this->token);
91
-
92
- // We want to remove the 'Authorization' bit from the start
93
- return substr($header, 15);
94
- }
95
-
96
- /**
97
- * Format and sign an OAuth / API request, and execute it
98
- */
99
- public function request($url, $method, $parameters) {
100
- $request = $this->sign($url, $method, $parameters);
101
-
102
- switch ($method) {
103
- case 'GET':
104
- return $this->http($request->to_url(), 'GET');
105
- default:
106
- return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
107
- }
108
- }
109
-
110
- protected function http($url, $method, $postfields = NULL) {
111
- $args = array(
112
- 'method' => $method,
113
- 'user-agent' => 'WP eCommerce Marketplace: ' . WPSC_VERSION
114
- );
115
-
116
- switch ($method) {
117
- case 'POST':
118
- if (!empty($postfields)) {
119
- $args['body'] = $postfields;
120
- }
121
- break;
122
- }
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());
130
- }
131
-
132
- if ($response['response']['code'] != 200) {
133
- throw new Exception($response['body']);
134
- }
135
- return $response['body'];
136
- }
137
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-components/marketplace-core-v1/library/Sputnik/Admin.php DELETED
@@ -1,994 +0,0 @@
1
- <?php
2
-
3
- class Sputnik_Admin {
4
- protected static $page_is_current = false;
5
- protected static $list_table;
6
-
7
- protected static $page = 'dash';
8
-
9
- public static function bootstrap() {
10
- add_action( 'admin_init', array(__CLASS__, 'init'), 0);
11
- add_action( 'all_admin_notices', array(__CLASS__, 'report_errors'));
12
-
13
- add_action( 'admin_menu', array(__CLASS__, 'menu'));
14
-
15
- add_action( 'admin_head-wpsc-product_page_sputnik', array(__CLASS__, 'admin_head_page'));
16
- add_action( 'admin_head-wpsc-product_page_sputnik-account', array(__CLASS__, 'admin_head_page'));
17
- add_action( 'install_plugins_pre_plugin-information', array(__CLASS__, 'maybe_info'), 0);
18
- add_action( 'load-update.php', array(__CLASS__, 'maybe_redirect_update'));
19
- add_filter( 'plugin_row_meta', array(__CLASS__, 'add_row_note'), 10, 3);
20
- add_action( 'wp_ajax_sputnik_rate', array(__CLASS__, 'set_rating'));
21
- }
22
-
23
- public static function init() {
24
-
25
- if ( ! wpsc_is_store_admin() ) {
26
- return;
27
- }
28
-
29
- add_action('admin_print_styles', array(__CLASS__, 'styles'));
30
- add_action('admin_print_scripts', array(__CLASS__, 'scripts'));
31
-
32
- global $plugin_page;
33
-
34
- if ( $plugin_page !== 'sputnik' && $plugin_page !== 'sputnik-account' )
35
- return;
36
-
37
- // Run most OAuth stuff now, before output
38
- if (!empty($_GET['oauth'])) {
39
- if ($_GET['oauth'] == 'request') {
40
- $redirect_url = '';
41
- if ( ! empty( $_REQUEST['oauth_buy'] ) ) {
42
- $redirect_url = self::build_url( array( 'oauth' => 'callback' ) );
43
- $redirect_url = add_query_arg( 'oauth_buy', $_REQUEST['oauth_buy'], $redirect_url );
44
- }
45
- Sputnik_API::auth_request( $redirect_url );
46
- }
47
- if ($_GET['oauth'] == 'callback') {
48
- Sputnik_API::auth_access();
49
- }
50
- if ($_GET['oauth'] == 'reset') {
51
- delete_option('sputnik_oauth_request');
52
- delete_option('sputnik_oauth_access');
53
-
54
- wp_redirect(self::build_url());
55
- }
56
- }
57
-
58
- switch (true) {
59
- case isset($_GET['info']):
60
- self::$page = 'info';
61
- break;
62
- case isset($_GET['buy']):
63
- self::$page = 'buy';
64
- break;
65
- case isset($_GET['paid']):
66
- self::$page = 'paid';
67
- break;
68
- case isset($_GET['install']):
69
- self::$page = 'install';
70
- break;
71
- case isset($_GET['upgrade']):
72
- self::$page = 'upgrade';
73
- break;
74
- case isset($_GET['cancel_payment']):
75
- self::$page = 'cancel_payment';
76
- break;
77
- case $plugin_page === 'wpsc-product_page_sputnik-account':
78
- self::$page = 'account';
79
- $GLOBALS['tab'] = 'account';
80
- break;
81
- default:
82
- self::$page = 'dash';
83
- break;
84
- }
85
-
86
- // Avoid having to specify this for every page
87
- if (self::$page !== 'dash' && self::$page !== 'account') {
88
- $_GET['noheader'] = true;
89
- }
90
- }
91
-
92
- public static function report_errors() {
93
- $invalid = Sputnik::get_invalid();
94
- if (empty($invalid)) {
95
- return;
96
- }
97
- ?>
98
- <d