WP eCommerce - Version 3.8.8.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.8.6
Comparing to
See all releases

Code changes from version 3.9.2 to 3.8.8.6

Files changed (72) hide show
  1. images/google_checkout.gif +0 -0
  2. readme.txt +289 -576
  3. screenshot-1.png +0 -0
  4. screenshot-2.png +0 -0
  5. screenshot-3.png +0 -0
  6. screenshot-4.png +0 -0
  7. wp-shopping-cart.php +35 -165
  8. wpsc-admin/admin-form-functions.php +268 -69
  9. wpsc-admin/admin.php +257 -951
  10. wpsc-admin/ajax-and-init.php +1510 -40
  11. wpsc-admin/ajax.php +0 -926
  12. wpsc-admin/css/admin.css +979 -1519
  13. wpsc-admin/css/jquery.ui.datepicker-classic.css +0 -579
  14. wpsc-admin/css/jquery.ui.datepicker-fresh.css +0 -579
  15. wpsc-admin/css/media.css +0 -26
  16. wpsc-admin/css/plus-minus.png +0 -0
  17. wpsc-admin/css/settingspage.css +68 -95
  18. wpsc-admin/css/ui-images/ui-icons_21759b_256x240.png +0 -0
  19. wpsc-admin/css/ui-images/ui-icons_333333_256x240.png +0 -0
  20. wpsc-admin/css/ui-images/ui-icons_999999_256x240.png +0 -0
  21. wpsc-admin/css/ui-images/ui-icons_cc0000_256x240.png +0 -0
  22. wpsc-admin/css/xit.gif +0 -0
  23. wpsc-admin/db-upgrades/routines/1.php +0 -142
  24. wpsc-admin/db-upgrades/routines/10.php +0 -134
  25. wpsc-admin/db-upgrades/routines/11.php +0 -83
  26. wpsc-admin/db-upgrades/routines/12.php +0 -55
  27. wpsc-admin/db-upgrades/routines/13.php +0 -54
  28. wpsc-admin/db-upgrades/routines/14.php +0 -28
  29. wpsc-admin/db-upgrades/routines/2.php +0 -430
  30. wpsc-admin/db-upgrades/routines/3.php +0 -18
  31. wpsc-admin/db-upgrades/routines/4.php +0 -43
  32. wpsc-admin/db-upgrades/routines/5.php +0 -49
  33. wpsc-admin/db-upgrades/routines/6.php +0 -12
  34. wpsc-admin/db-upgrades/routines/7.php +0 -36
  35. wpsc-admin/db-upgrades/routines/8.php +0 -12
  36. wpsc-admin/db-upgrades/routines/9.php +0 -13
  37. wpsc-admin/db-upgrades/upgrade.php +0 -155
  38. wpsc-admin/db-upgrades/views/main.php +0 -11
  39. wpsc-admin/display-coupon-add.php +0 -133
  40. wpsc-admin/display-coupon-edit.php +0 -182
  41. wpsc-admin/display-coupons.php +400 -93
  42. wpsc-admin/display-debug.page.php +6 -11
  43. wpsc-admin/display-items.page.php +258 -433
  44. wpsc-admin/display-options-settings.page.php +22 -2
  45. wpsc-admin/display-sales-logs.php +367 -430
  46. wpsc-admin/display-update.page.php +20 -16
  47. wpsc-admin/display-upgrades.page.php +135 -41
  48. wpsc-admin/includes/coupon-list-table-class.php +0 -478
  49. wpsc-admin/includes/display-items-functions.php +814 -1226
  50. wpsc-admin/includes/product-functions.php +151 -333
  51. wpsc-admin/includes/product-variation-list-table.class.php +0 -675
  52. wpsc-admin/includes/product-variations-manage.page.php +0 -13
  53. wpsc-admin/includes/product-variations-page.class.php +0 -423
  54. wpsc-admin/includes/product-variations-setup.page.php +0 -40
  55. wpsc-admin/includes/product-variations.page.php +0 -59
  56. wpsc-admin/includes/products.php +411 -0
  57. wpsc-admin/includes/purchase-log-action-links.php +0 -482
  58. wpsc-admin/includes/purchase-log-list-table-class.php +64 -168
  59. wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php +3 -3
  60. wpsc-admin/includes/purchase-logs-page/item-details.php +70 -87
  61. wpsc-admin/includes/purchase-logs-page/list-table.php +13 -5
  62. wpsc-admin/includes/purchase-logs-page/packing-slip.php +0 -2
  63. wpsc-admin/includes/purchase-logs-page/upgrade.php +4 -4
  64. wpsc-admin/includes/save-data.functions.php +486 -411
  65. wpsc-admin/includes/settings-tabs/admin.php +48 -43
  66. wpsc-admin/includes/settings-tabs/checkout.php +90 -114
  67. wpsc-admin/includes/settings-tabs/gateway.php +138 -128
  68. wpsc-admin/includes/settings-tabs/general.php +127 -138
  69. wpsc-admin/includes/settings-tabs/import.php +84 -227
  70. wpsc-admin/includes/settings-tabs/marketing.php +49 -172
  71. wpsc-components/theme-engine-v1/classes/settings-tab-presentation.php → wpsc-admin/includes/settings-tabs/presentation.php +132 -148
  72. wpsc-admin/includes/settings-tabs/shipping.php +184 -301
images/google_checkout.gif ADDED
Binary file
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
 
@@ -34,532 +154,12 @@ Since 2006, we've been helping entrepreneurs just like you realize their goal of
34
  Before updating please make a backup of your existing files and database. Just in case.
35
  After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
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.
348
- * Fix: Attempt to regenerate customer ID if it's invalid to avoid fatal errors.
349
- * Fix: Australia Post doesn't return any quotes if the products' dimensions are not specified.
350
- * Fix: Billing state is set to shipping state upon checkout.
351
- * Fix: Cannot resent purchase receipt any more.
352
- * Fix: Custom Cart Messages on Sales Log need stripslashes.
353
- * Fix: Error message when changing purchase log status via AJAX.
354
- * Fix: Fatal error in merchant.class.php.
355
- * Fix: Giving stock or price of a product a 4 figure number will screw it up when the product is updated again.
356
- * Fix: Invalid zipcode is displayed even when the zipcode is not specified yet.
357
- * Fix: Quick editing a product doesn't work.
358
- * Fix: Transaction result emails are sent when an order is closed.
359
- * Fix: More native css support for product variations in WP 3.5+.
360
-
361
- = 3.8.9.4 =
362
- * Fix: "No shipping quotes" error is displayed when selecting "Shipping same as billing".
363
- * Fix: Avoid flooding transient data when site's feed is being visited by bots.
364
- * Fix: Blank Checkout page for some certain installation when Shipping is enabled.
365
- * Fix: Can't add to cart on some server.
366
- * Fix: Fatal error when viewing product variation iframe, because _wp_admin_html_begin() does not exist on older WordPress versions.
367
- * Fix: MySQL error/warning in _wpsc_filter_special_widget_where().
368
- * Fix: Only show attachment fields when viewed on an edit product page.
369
- * Fix: PHP Notice in cart.class.php.
370
- * Fix: Properly escape columns in admin products page.
371
- * Fix: Purchase log's item names are not translatable via qTranslate.
372
- * Fix: Shipping same as billing saves "State" field label as the shipping region.
373
- * Fix: Shipwire settings are not updated.
374
- * Fix: Shipwire syncing doesn't take into consideration products in trash, or multiple products using the same SKUs (as in WPML)
375
- * Fix: Specials widget is empty when there are no product with variation sales.
376
- * Fix: Variation sets are not being sorted on the front-end.
377
- * Fix: WPEC doesn't cooperate with WP 3.5 media UI.
378
- * Fix: wpsc_pre_transaction_results filter is ignored.
379
- * Make sure admin styles are enqueued for product variations iframe in older version of WordPress.
380
-
381
- = 3.8.9.3 =
382
- * New: Add support for quantity field in default grid view template.
383
- * New: Let plugins add new column to product variation list table via filter 'wpsc_manage_product_variations_custom_column'.
384
- * Fix: Blank transaction results page when using paypal gateways.
385
- * Fix: Comment form is displayed even though comment is closed on products page.
386
- * Fix: Fatal error in formatting.php for some sites.
387
- * Fix: New countries in 3.8.9 automatically added to target market list.
388
- * Fix: PayPal Standard doesnt' take care of coupons.
389
- * Fix: Punctuation in pending transaction email.
390
-
391
- = 3.8.9.2 =
392
- * Fix: Admin cannot download file from product edit page.
393
- * Fix: Compatibility issues with Jetpack.
394
- * Fix: Google Analytics is printed out even when it's not active. Also, PHP notice when the product doesn't have a category.
395
- * Fix: Make sure PayPal Standard works with 100% discount.
396
- * Fix: Product page title is not properly replaced with the category or tag title in WP 3.5.
397
- * Fix: Products are sometimes displayed even when products page is set to only display list of categories.
398
- * Fix: Products thumbnail sizes are inconsistent with the settings.
399
- * Fix: Properly flush outdated customer meta from the transient table.
400
- * Fix: Typo in wpsc_cart::update_location().
401
- * Fix: Wrong class attribute for price display.
402
-
403
- = 3.8.9.1 =
404
- * Fix: Fatal error in Shipwire.
405
- * Fix: Fatal error with customer meta on multisite.
406
- * Fix: Fatal error with get_the_product_tags().
407
- * Fix: Pagination in admin product list doesn't work.
408
- * Fix: Permalinks are incorrect when products page is set as home page and permalink scheme is set to %post_name%.
409
- * Fix: Rewrite rules are not regenerated correctly when switching from "Default" to "Post name".
410
- * Fix: Shipwire and Google Analytics are not working properly.
411
- * Fix: Shipwire request is sent even when Shipwire is not active.
412
- * Fix: States are displayed as numbers in admin purchase report.
413
- * Fix: Transaction results displaying cart content twice as well as "Oops, there is nothing in your cart".
414
- * Fix: Use customer meta instead of $_SESSION for eway and payflow message.
415
- * Fix: Variation pagination doesn't work.
416
-
417
- = 3.8.9 =
418
- * New: Additional columns can now be added to Store Sales page via filter hook.
419
- * New: Additional filters for purchase log notification classes.
420
- * New: Allow devs to filter the list of accepted credit cards in PayPal Pro.
421
- * New: Filters to enable image scaling (versus cropping).
422
- * New: Hook to modify the product table on transaction results and purchase receipts.
423
- * New: Make buy now button's html output filterable.
424
- * New: More flexibility in role management.
425
- * New: New Hook for cancelling subscriptions with Memebers Access.
426
- * New: Pagination UI for product variations.
427
- * New: Users can bulk edit products' stock, price, sales price etc.
428
- * New: Users can now choose to "Notify site owner" and "Unpublish product" separately when stock runs out.
429
- * New: Users can now delete checkout form sets.
430
- * New: Users can now set product sorting direction in Settings->Presentation.
431
- * New: Variation UI enhancements.
432
- * Change: "Registration required" and "Anyone can register" are now synchronized.
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.
440
- * Fix: Alignment of checkboxes and radios in product category edit page is a bit off.
441
- * Fix: Avoid using query_posts() which could break themes.
442
- * Fix: Backslashes are sometimes added to UPS and USPS settings.
443
- * Fix: Base_region option remains set if base country is switched.
444
- * Fix: Billing phone number not accessible via wpsc_merchant::$cart_data.
445
- * Fix: Buy Now feature doesn't properly create and update sales log.
446
- * Fix: Can't add variations on new products.
447
- * Fix: Can't delete coupon conditions.
448
- * Fix: Can't order products properly in Products admin page.
449
- * Fix: Can't upload product category image when adding a new category.
450
- * Fix: Cannot set thumbnail for variations.
451
- * Fix: Cart item name is not updated when corresponding variation name is changed.
452
- * Fix: Cart items are not translated for qTranslate.
453
- * Fix: Cart mix up when multisite is enabled.
454
- * Fix: Category image size metadata are not used properly on templates.
455
- * Fix: Category title is replaced with the first product's title, and pagination does not work correctly on Category page.
456
- * Fix: Changing an order status in Sales Log page incorrectly updates the views and pagination links.
457
- * Fix: Changing checkout field sort order doesn't work.
458
- * Fix: Checkout- Parent Product Thumbnail Displayed Instead of Product Variation Thumbnail.
459
- * Fix: Claimed stock cronjob doesn't take into consideration timezone.
460
- * Fix: Collapse product variation sets by default on Manage tab.
461
- * Fix: Colorbox Gallery doesn't work.
462
- * Fix: Country dropdown lists disregard Target Market option.
463
- * Fix: Coupon is not invalid is displayed even when there's no coupon applied.
464
- * Fix: Coupon start and expiry date don't take into account local timezone.
465
- * Fix: Currency converter doesn't work for some particular currencies.
466
- * Fix: Custom fields are missing in purchase log if they have the same name as other fields.
467
- * Fix: Customers are able able to purchase scheduled but unpublished products.
468
- * Fix: Database upgrade routines.
469
- * Fix: Division by zero in product-template.php.
470
- * Fix: Dollar signs are used in flat rate settings regardless of the main currency.
471
- * Fix: Duplicating a Product doesn't duplicate the images correctly.
472
- * Fix: Email information in "Admin" settings tab is not displayed properly.
473
- * Fix: Enabling shipping but not selecting any shipping methods causes frustrating unexpected issues.
474
- * Fix: Fatal error in PayPal Pro settings page.
475
- * Fix: Fatal error in checkout page form validation.
476
- * Fix: Fatal error when quick editing products.
477
- * Fix: Fatal error when upgrading from 3.7.x.
478
- * Fix: Final breadcrumb id tag is not W3C Compliant.
479
- * Fix: Free shipping discount is not updated when shipping method is changed.
480
- * Fix: Free shipping doesn't reset individual cart items' shipping amounts when submitted to PayPal.
481
- * Fix: Free-shipping doesn't work on PayPal Pro if the discount amount > item total.
482
- * Fix: Google Analytics is now tracking correctly.
483
- * Fix: Great Britain is redundant in country list (we already have U.K. and North Ireland).
484
- * Fix: Improper escaping of user input.
485
- * Fix: Inaccurate dimension calculation in Australia Post.
486
- * Fix: Incompatibility with $_SESSION.
487
- * Fix: Incorrect i18n in Presentation tab.
488
- * Fix: Increase gateway timeout settings across the board.
489
- * Fix: Inefficient pinging when product is updated.
490
- * Fix: Infinite loop on single product page.
491
- * Fix: Infinite loop when using PayPal Pro.
492
- * Fix: Issue with SSL and Share This URL.
493
- * Fix: Latest product widget doesn't show image.
494
- * Fix: Logic error in function wpsc_product_has_stock.
495
- * Fix: Make it clear that the sidebar widget doesn't include discount.
496
- * Fix: More flexibility in role management.
497
- * Fix: New coupon conditions are added below the first condition instead of the last.
498
- * Fix: Number of products per page field in shortcode generator doesn't work.
499
- * Fix: On user details page, switching country to a country without region won't display the State (Region) text field.
500
- * Fix: Only display permalink double save warning if WordPress version is earlier than 3.3.
501
- * Fix: Outdated country codes and currency codes.
502
- * Fix: Pagination does not work with price range widget.
503
- * Fix: Pagination for category short codes does not work.
504
- * Fix: Pagination for tags does not work.
505
- * Fix: Pagination links generated with unnecessary "page/" portion for WP 3.4.
506
- * Fix: Pagination links in Category shortcode page are not consistent.
507
- * Fix: Parent product is still treated as if it had variations even though all its variations have been moved to trash or hidden (set to draft).
508
- * Fix: PayPal Express Checkout doesn't take into account free shipping.
509
- * Fix: PayPal Standard Subscriptions produce unexpected product title in PayPal cart and receipts.
510
- * Fix: Performance improvement for dynamic stylesheet.
511
- * Fix: Placeholder image is missing for products without thumbnails.
512
- * Fix: Potential height issue with variation edit iframe (parent hidden overflow, expand/collapse checkboxes).
513
- * Fix: Prevent segmentation fault when using wpsc-products shortcode.
514
- * Fix: Product Specials Widget does not work with product variations on sale.
515
- * Fix: Product page URLs are sometimes not updated properly.
516
- * Fix: Product permalinks in single product view are not using current category path.
517
- * Fix: Products page pagination fails if the products page is set as the homepage.
518
- * Fix: Products with variations on sale does not display the prices correctly.
519
- * Fix: Purchase logs list table doesn't have Total line as before 3.8.8.
520
- * Fix: Refactor purchase log notifications to fix various issues:
521
- * Fix: Region field is not consistently updated or displayed when selecting a country without regions on checkout form.
522
- * Fix: SKU should be sent to PayPal Standard instead of Product ID if that's available.
523
- * Fix: Shipping error is reported when "Shipping same as billing" is selected on the checkout page, even when shipping is disabled.
524
- * Fix: Shipping location error message is displayed before the customer has a chance to specify state and zip code.
525
- * Fix: Shipping method and option are not displayed on Sales Log single page if there is no shipping form fields.
526
- * Fix: Shipping options not refreshed when "shipping same as billing" causes new quotes.
527
- * Fix: Shipping rate choice not correctly encoded during checkout.
528
- * Fix: Shipwire settings are broken.
529
- * Fix: Shortcode button doesn't work in visual mode if WP folder configuration is different from default.
530
- * Fix: Table rate shipping doesn't accept $0 amount.
531
- * Fix: Target makret restrictions for product categories is broken.
532
- * Fix: Tax bands not working.
533
- * Fix: Template tags for product tags don't work.
534
- * Fix: Terms & Conditions validation code is broken.
535
- * Fix: Total Price not properly reflective of the total after $1,000.
536
- * Fix: Transaction results refactor.
537
- * Fix: Updating purchase log status doesn't update pagination count
538
- * Fix: Unnecessary thumbnail regeneration on product single page.
539
- * Fix: Update message is displayed even when the db has bene updated.
540
- * Fix: Updating region when "Same shipping as billing" is checked doesn't update the shipping quote.
541
- * Fix: Use $cart_item->get_title() instead of $cart_item->product_name.
542
- * Fix: Use array instead of strings when calling WP_Query in wpsc_the_variation_price.
543
- * Fix: Users are now warned that setting products per row for grid view to 0 would probably lead to layout breakage.
544
- * Fix: Using 2 checkout sets shows incorrect order on Purchase History and Your details pages.
545
- * Fix: Valid checkout fields are not preserved when there are invalid fields.
546
- * Fix: Variation drag'n'drop sorting is not working.
547
- * Fix: Various bugs and inconsistencies with coupon conditions.
548
- * Fix: WPEC loads product image then scales to thumbnail size in the backend products list.
549
- * Fix: Weird Taxable Amount column.
550
- * Fix: When "Free Shipping" is enabled in Settings->Shipping, shipping is always set to 0 even when shipping discount value is set to 0 or empty.
551
- * Fix: Wrong alternate row class for variation inline shipping editor.
552
- * Fix: Wrong documentation link for Chronopay.
553
- * Fix: Wrong logic in deprecated function nzshpcrt_currency_display().
554
- * Fix: _wpsc_process_transaction_coupon() contains typos.
555
- * Fix: also bought image path is supposed to be fixed already.
556
- * Fix: i18n audit.
557
- * Fix: improper escaping in Price metabox.
558
- * Fix: post_status is not formatted correctly in wpsc_start_the_query().
559
- * Fix: private products are listed on the /products/ page.
560
- * Fix: wpsc_list_dir() should return empty array if directory is empty.
561
- * Fix: wpsc_shopping_cart() function call doesn't work.
562
- * Fix: wpsc_the_product_thumbnail() ignores custom width and height.
563
 
564
  = 3.8.8.5 =
565
  * Fix: Order Closed status does not count in the sales log totals on dashboard widget.
@@ -598,6 +198,7 @@ After upgrading from earlier versions look for link "Update Store". This will up
598
  * Fix: Sometimes clicking Save doesn't save tracking ID on sales log page.
599
 
600
  = 3.8.8 =
 
601
  * New: Actions for bulk actions on sales page: wpsc_sales_log_process_bulk_action, wpsc_sales_log_extra_tablenav
602
  * New: Allow variation checkboxes to be collapsed & expanded without having to tick the variation set checkbox itself.
603
  * New: Digital Download UI improvement.
@@ -625,18 +226,20 @@ After upgrading from earlier versions look for link "Update Store". This will up
625
  * Fix: $wpsc_query->query_vars['wpsc_product_category'] not always set on product page with hierarchical category permalinks.
626
  * Fix: Cannot add new Checkout field.
627
  * Fix: Cannot re-re-send buyer receipt.
 
628
  * Fix: 3.7 -> 3.8 Database Upgrade Routine causes some products with variations to display a $0.00 price.
629
  * Fix: Double <p> tag with wpec_taxes_display_tax_bands() on product edit page.
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.
637
  * Fix: Summary line does not get updated when sales log status is changed.
638
  * Fix: Total Quantity check fails for coupon codes.
639
  * Fix: USPS: "FLATE RATE ENVELOPE" should be changed to "VARIABLE" to allow for shipping quotes to be based on weight.
 
640
  * Fix: Use ->add_help_tab() to support WP 3.3 admin screen API.
641
  * Fix: Using discount causes Paypal Express to calculate wrong total amount.
642
  * Fix: get_the_content() is not enough in product feed.
@@ -774,44 +377,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.4.1
7
+ Stable tag: 3.8.8.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 1.9 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
 
154
  Before updating please make a backup of your existing files and database. Just in case.
155
  After upgrading from earlier versions look for link "Update Store". This will update your database structure to work with new version.
156
 
157
+
158
  == Changelog ==
159
 
160
+ = 3.8.8.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.8.5 =
165
  * Fix: Order Closed status does not count in the sales log totals on dashboard widget.
198
  * Fix: Sometimes clicking Save doesn't save tracking ID on sales log page.
199
 
200
  = 3.8.8 =
201
+ * New: 3 action hooks to process PayPal IPN responses: wpsc_paypal_pro_ipn, wpsc_paypal_standard_ipn and wpsc_paypal_express_ipn.
202
  * New: Actions for bulk actions on sales page: wpsc_sales_log_process_bulk_action, wpsc_sales_log_extra_tablenav
203
  * New: Allow variation checkboxes to be collapsed & expanded without having to tick the variation set checkbox itself.
204
  * New: Digital Download UI improvement.
226
  * Fix: $wpsc_query->query_vars['wpsc_product_category'] not always set on product page with hierarchical category permalinks.
227
  * Fix: Cannot add new Checkout field.
228
  * Fix: Cannot re-re-send buyer receipt.
229
+ * Fix: Custom Meta copies values when adding new.
230
  * Fix: 3.7 -> 3.8 Database Upgrade Routine causes some products with variations to display a $0.00 price.
231
  * Fix: Double <p> tag with wpec_taxes_display_tax_bands() on product edit page.
232
  * Fix: Fatal error when trying to include a non-existent admin file.
233
  * Fix: Hide Google Feed information from display
234
  * Fix: Incompatibility with Genesis framework in Product Edit page.
235
+ * Fix: Make the WP e-Commerce 3.8.x activation/installation routine much more efficient.
236
  * Fix: Mandatory fields in user_log_functions.php are not properly validated.
237
  * Fix: Memory improvement for productfeed.
238
  * Fix: Purchase logs have incorrect time if a timezone is specified in Settings->General.
239
  * Fix: Summary line does not get updated when sales log status is changed.
240
  * Fix: Total Quantity check fails for coupon codes.
241
  * Fix: USPS: "FLATE RATE ENVELOPE" should be changed to "VARIABLE" to allow for shipping quotes to be based on weight.
242
+ * Fix: USPS settings not saving correctly.
243
  * Fix: Use ->add_help_tab() to support WP 3.3 admin screen API.
244
  * Fix: Using discount causes Paypal Express to calculate wrong total amount.
245
  * Fix: get_the_content() is not enough in product feed.
377
  * Fix: Checking (or unchecking) Stock checkbox when editing product causes variation table columns to break.
378
  * Fix: jQuery 1.6 incompatibility with attr( 'className' ).
379
 
 
 
 
 
 
 
 
 
 
380
 
381
+ = 3.8.5 =
382
+ * New: Added hooks to support WPML.
383
+ * New: Links to WP e-Commerce documentation for individual payment gateways.
384
+ * Change: User can specify 0 in thumbnail width or height to make it scale proportional.
385
+ * Change: Show display name, not internal name for shipping method on purchase log view.
386
+ * Change: Presentation settings page is restored to WPEC Settings page when WooTheme is activated.
387
+ * Fix: Add to cart using Donation widget causes the page to reload and the item is added twice.
388
+ * Fix: Free-shipping discount causes tax to be calculated incorrectly.
389
+ * Fix: Paypal Buy Now button passes the wrong price to Paypal if product is on sale.
390
+ * Fix: Thumbnail sizes are not generated correctly.
391
+ * Fix: Broken output buffering rendering wpsc_add_advanced_options hook useless.
392
+ * Fix: Paypal Pro doesn't properly account for discount and coupon.
393
+ * Fix: IPN doesn't work on Paypal Standard.
394
+ * Fix: IPN doesn't work on Paypal Pro gateway.
395
+ * Fix: Paypal Express doesn't handle discounts.
396
+ * Fix: Paypal Express doesn't handle IPN.
397
+ * Fix: Paypal Express doesn't send purchase receipt after a payment is accepted on Paypal.
398
+ * Fix: Paypal Express doesn't include item description, quantity, tax etc. in email receipts.
399
+ * Fix: Invalid country code in Paypal Pro and Express, should be GB instead of UK
400
+ * Fix: Take Discount into account when DoExpressCheckout in Paypal Express gateway.
401
+ * Fix: Category checkout form sets don't work.
402
+ * Fix: Incorrect Product display mode selected when ['view_type'] is set and 'show_advanced_search' is disabled.
403
+ * Fix: PHP notice in wpsc-transaction_results_functions.php.
404
+ * Fix: attr('checked') == true always evaluates to false. Use is(':checked') instead.
405
+ * Fix: jQuery 1.6 select by attribute incompatibility.
406
+ * Fix: Price tag is added to RSS even when there is no price.
407
+ * Fix: Span tag is not closed in issue 598.
408
+ * Fix: Faulty php tag in template (issue 589).
409
+ * Fix: PHP Notices when checking out with shipping disabled.
410
+
411
+ = 3.8.4 =
412
+ * Add: User can duplicate a product in admin panel
413
+ * Add: WooThemes integration support
414
+ * Change: Total in Cart widget now excludes shipping and tax
415
+ * Fix: Invalid country code in paypal-standard.merchant.php
416
+ * Fix: Tax is not passed properly to Paypal Pro
417
+ * Fix: Currency code preference not correctly selected in Paypal gateways
418
+ * Fix: Paypal gateways doesn't check whether the currency being sent to Paypal is accepted or not, resulting in wrong currency
419
+ * Fix: Checkout form selecting the wrong field when a previous field with the same uniquename was deleted
420
+ * Fix: Various issues with Google Checkout
421
+ * Fix: State data outside of US is not passed to payment gateways
422
+ * Fix: State is not displaying correctly in the users purchase history
423
+ * Fix: Wrong generated product permalink when a product is assigned multiple cats, and a product category is being viewed
424
+ * Fix: Submitting a checkout form with mandatory billing state only refreshes the form although everything is filled out correctly
425
+ * Fix: Billing Country is trimmed, and Billing State is not properly decoded
426
+ * Fix: Billing and shipping state no longer stored correctly
427
+ * Fix: Checkout form validation skips mandatory custom checkout fields on default form set
428
+ * Fix: Paystation does not properly update purchase logs
429
+ * 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
430
+ * Fix: Store sub-pages return 404 error
431
+ * Fix: Only Purchase History in Your Account show the login option
432
+ * Fix: Weight on Variations contain too many decimals
433
+ * Fix: Add to Cart in grid view bypasses Variations selection
434
+ * Fix: get_queried_object() requires WP 3.1
435
+ * Fix: Invalid version number in display-update.page.php
436
+ * Fix: Correct HTML, to stop Free Shipping Discount getting blanked
437
+ * Fix: Support taxonomy archives for product_tag taxonomy
438
+
439
+ = 3.8.3 =
440
+ * New: Individual item details are sent to Paypal Express Checkout
441
+ * Change: Automatically reload database update page when PHP maximum execution time is detected
442
+ * Change: Add progress bar and estimated time remaining for database update tasks
443
+ * 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
444
+ * Change: Paypal Express Checkout API is updated to ver 71.0
445
+ * Fix: Tax is calculated incorrectly when a coupon is used
446
+ * Fix: Update a large database of products and variations take ages
447
+ * Fix: Reloading database update page makes wpec scan the records from the beginning instead of continuing where it left off
448
+ * 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)
449
+ * Fix: Purchase logs' statuses are not properly updated when upgrading from 3.7.x
450
+ * Fix: Billing state is not sent to checkout
451
+ * Fix: Country name is truncated when sending to payment gateway
452
+ * Fix: Billing state code is not properly converted before sending to payment gateway
453
+ * Fix: Wrong USA country code is sent to Paypal Standard Payment
454
+ * Fix: Wrong sandbox gateway URL for Paypal Pro
455
+ * Fix: SSLVERIFY error when connecting to Paypal Pro Gateway
456
+ * Fix: Template hierarchy error with child themes
457
+ * Fix: Total amount is not visible when checking out with Paypal Express Checkout
458
+ * Fix: Transaction result page is inaccurate after checking out with Paypal Express Checkout
459
+ * Fix: Incompatibility with Thesis theme's loop when viewing product category, or paginated product listing
460
+
461
+ = 3.8.2 =
462
+ * Add: Currency display for Google RSS feed
463
+ * Add: Third-party plugins can now filter 'wpsc-tax_rate' to provide their own tax solution
464
+ * Change: Merchant subclasses now have access to $this->address_keys
465
+ * Change: Grid Settings are now always visible
466
+ * Change: Total Shipping is no longer included in notification email when shipping is disabled
467
+ * Change: Thumbnail size for single product view now defaults to Single Product Page thumbnail size option
468
+ * Change: wpsc_the_product_thumbnail() defaults to 'medium-single-product' size when in single product view
469
+ * Fix: Update notice being displayed when it has already been completed
470
+ * Fix: Broken image in latest products widget
471
+ * Fix: Custom checkout field not always saved
472
+ * Fix: Downloadable file list not updated after existing files are selected
473
+ * Fix: Already attached downloadable files are duplicated each time you select an existing downloadable file
474
+ * Fix: Inconsistent behavior when adding a new field to a checkout form set
475
+ * Fix: Custom product slug not editable
476
+ * Fix: Incompatibility issues with shipping helper and modules
477
+ * Fix: Product meta are not included in Google product feed
478
+ * Fix: Incorrect variation "from" price
479
+ * Fix: Shortcode not working in single product description
480
+ * Fix: Item cost not correctly calculated in paypal-standard-merchant
481
+ * Fix: Invalid SSL URL for some images
482
+ * Fix: Select from wrong table in WPSC_Merchant::get_authcode()
483
+ * Fix: Wrong use of get_query_var() in wpsc_category_id()
484
+ * Fix: Table `wordpress.wp_wpsc_product_list` doesn't exist
485
+ * Fix: ?items_per_page=all is ignored
486
+ * Fix: Duplicate transaction result emails
487
+ * Fix: Wrong filter in wpsc_item_add_preview_file()
488
+ * Fix: Wrong display type when using advanced search view mode and viewing a category
489
+ * Fix: Category list is displayed in tag archive
490
+ * Fix: wpsc_display_products_page() outputs "Fail" when the product shortcode is used 10 times (no kidding)
491
+ * Fix: Single product view's thumbnail size is incorrect
492
+ * Fix: Wrong featured thumbnail is displayed in Single Product View when there are multiple attached product images
493
+ * Fix: Incorrect condition statements in WPSC_Coupons::compare_logic()
494
+ * Fix: Can't add new field to checkout form set in IE
495
+ * Fix: Missing trash icon when adding custom options to dropdowns in checkout form
496
+ * Fix: Custom select, checkbox and radio fields are displayed as textbox on [userlog] page
497
+ * Fix: Custom checkboxes, radios and select fields are not properly populated in Checkout form
498
+ * Fix: Attachment metadata are not properly generated when converting product thumbnails from 3.7.x to 3.8
499
 
500
+ = 3.8.1 =
501
+ * Fix: Special price mix-up when ugprade to 3.8
502
+ * Fix: Missing database update notice
503
+ * Fix: Breadcrumb markup and style fixes
504
+ * Fix: Deprecate WPSC_Query()
505
+ * Fix: Deprecate wpsc_total_product_count()
506
+ * Fix: Deprecate wpsc_print_product_list()
507
+ * Change: Warning message for PHP 4 users. GoldCart requires PHP 5 or above.
508
+ * Change: Don't display categories when there's a search
509
+
510
+ = 3.8 =
511
+ * Utilize custom post types for products
512
+ * Utilize custom taxonomy for categories and variations
513
+ * Database optimization
514
+ * Redesigned taxes and shipping systems
515
+ * New user interface
516
+ * Integrates with WordPress Media Manager
517
+ * Better template integration for designers
518
+ * Optimized for ticketing (Tikipress)
519
 
 
520
 
521
+ == Frequently Asked Questions ==
 
 
 
522
 
523
+ = How do I customize WP e-Commerce =
524
 
525
+ First of all you should check out the Presentation settings which are in the Settings->Store page.
526
 
527
+ 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/").
528
 
529
  == Screenshots ==
530
 
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,21 +106,8 @@ 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
 
@@ -240,10 +117,11 @@ class WP_eCommerce {
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 +135,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 +170,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.8.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
 
117
  // Setup the core WPEC globals
118
  wpsc_core_setup_globals();
119
 
120
+ // Setup the core WPEC cart
121
+ wpsc_core_setup_cart();
122
 
123
+ // Load the thumbnail sizes
124
+ wpsc_core_load_thumbnail_sizes();
125
 
126
  // Load the purchase log statuses
127
  wpsc_core_load_purchase_log_statuses();
135
  // Load the shipping modules
136
  wpsc_core_load_shipping_modules();
137
 
138
+ // Set page title array for important WPSC pages
139
+ wpsc_core_load_page_titles();
140
+
141
  // WPEC is fully loaded
142
  do_action( 'wpsc_loaded' );
143
  }
144
 
 
 
 
 
 
145
  /**
146
  * WPEC Activation Hook
 
 
 
 
147
  */
148
+ function install() {
149
+ global $wp_version;
150
+ if((float)$wp_version < 3.0){
151
+ deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourselves
152
+ 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));
153
+ return;
154
  }
155
+ define( 'WPSC_FILE_PATH', dirname( __FILE__ ) );
156
  require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-installer.php' );
157
  $this->constants();
158
  wpsc_install();
159
+
160
  }
161
 
 
 
 
 
 
 
162
  public function deactivate() {
163
  foreach ( wp_get_schedules() as $cron => $schedule ) {
164
  wp_clear_scheduled_hook( "wpsc_{$cron}_cron_task" );
170
  $wpec = new WP_eCommerce();
171
 
172
  // Activation
173
+ register_activation_hook( __FILE__, array( $wpec, 'install' ) );
174
  register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
175
+ ?>
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']);
@@ -17,13 +10,13 @@ $conditions = maybe_unserialize($coupon['condition']);
17
  $output .= "<form name='edit_coupon' id='".$coupon['coupon_code']."' method='post' action=''>\n\r";
18
  $output .= "<table class='add-coupon'>\n\r";
19
  $output .= " <tr>\n\r";
20
- $output .= " <th>".esc_html__('Coupon Code', 'wpsc')."</th>\n\r";
21
- $output .= " <th>".esc_html__('Discount', 'wpsc')."</th>\n\r";
22
- $output .= " <th>".esc_html__('Start', 'wpsc')."</th>\n\r";
23
- $output .= " <th>".esc_html__('Expiry', 'wpsc')."</th>\n\r";
24
- $output .= " <th>".esc_html__('Use Once', 'wpsc')."</th>\n\r";
25
- $output .= " <th>".esc_html__('Active', 'wpsc')."</th>\n\r";
26
- $output .= " <th>".esc_html__('Apply On All Products', 'wpsc')."</th>\n\r";
27
  $output .= " <th></th>\n\r";
28
  $output .= " </tr>\n\r";
29
  $output .= " <tr>\n\r";
@@ -37,16 +30,16 @@ $conditions = maybe_unserialize($coupon['condition']);
37
  $output .= " <select name='edit_coupon[".$id."][is-percentage]'>";
38
  $output .= " <option value='0' ".(($coupon['is-percentage'] == 0) ? "selected='true'" : '')." >$</option>\n\r";//
39
  $output .= " <option value='1' ".(($coupon['is-percentage'] == 1) ? "selected='true'" : '')." >%</option>\n\r";
40
- $output .= " <option value='2' ".(($coupon['is-percentage'] == 2) ? "selected='true'" : '')." >" . esc_html__( 'Free shipping', 'wpsc' ) . "</option>\n\r";
41
  $output .= " </select>\n\r";
42
  $output .= " </td>\n\r";
43
  $output .= " <td>\n\r";
44
- $coupon_start = get_date_from_gmt( $coupon['start'], 'Y-m-d' );
45
- $output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][start]' value='{$coupon_start}'>";
46
  $output .= " </td>\n\r";
47
  $output .= " <td>\n\r";
48
- $coupon_expiry = get_date_from_gmt( $coupon['expiry'], 'Y-m-d' );
49
- $output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][expiry]' value='{$coupon_expiry}'>";
50
  $output .= " </td>\n\r";
51
  $output .= " <td>\n\r";
52
  $output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][use-once]' />\n\r";
@@ -68,29 +61,29 @@ $conditions = maybe_unserialize($coupon['condition']);
68
  if($conditions != null){
69
  $output .= "<tr>";
70
  $output .= "<th>";
71
- $output .= esc_html__("Conditions", 'wpsc');
72
  $output .= "</th>";
73
  $output .= "</tr>";
74
  $output .= "<th>";
75
- $output .= esc_html__("Delete", 'wpsc');
76
  $output .= "</th>";
77
  $output .= "<th>";
78
- $output .= esc_html__("Property", 'wpsc');
79
  $output .= "</th>";
80
  $output .= "<th>";
81
- $output .= esc_html__("Logic", 'wpsc');
82
  $output .= "</th>";
83
  $output .= "<th>";
84
- $output .= esc_html__("Value", 'wpsc');
85
  $output .= "</th>";
86
  $output .= " </tr>\n\r";
87
-
88
- foreach ($conditions as $i => $condition){
89
  $output .= "<tr>";
90
  $output .= "<td>";
91
  $output .= "<input type='hidden' name='coupon_id' value='".$id."' />";
92
  $output .= "<input type='submit' id='delete_condition".$i."' style='display:none;' value='".$i."' name='delete_condition' />";
93
- $output .= "<span style='cursor:pointer;' class='delete_button' onclick='jQuery(\"#delete_condition".$i."\").click()'>" . esc_html__('Delete', 'wpsc' ) . "</span>";
94
  $output .= "</td>";
95
  $output .= "<td>";
96
  $output .= $condition['property'];
@@ -121,30 +114,30 @@ function wpsc_coupons_conditions($id){
121
 
122
  $output ='
123
  <input type="hidden" name="coupon_id" value="'.$id.'" />
124
- <tr><td colspan="3"><b>' . esc_html__( 'Add Conditions', 'wpsc') . '</b></td></tr>
125
  <tr><td colspan="6">
126
  <div class="coupon_condition">
127
  <div>
128
  <select class="ruleprops" name="rules[property][]">
129
- <option value="item_name" rel="order">' . esc_html__( 'Item name', 'wpsc') . '</option>
130
- <option value="item_quantity" rel="order">' . esc_html__( 'Item quantity', 'wpsc') . '</option>
131
- <option value="total_quantity" rel="order">' . esc_html__( 'Total quantity', 'wpsc') . '</option>
132
- <option value="subtotal_amount" rel="order">' . esc_html__( 'Subtotal amount', 'wpsc') . '</option>
133
  ' . apply_filters( 'wpsc_coupon_rule_property_options', '' ) . '
134
  </select>
135
  <select name="rules[logic][]">
136
- <option value="equal">' . esc_html__( 'Is equal to', 'wpsc') . '</option>
137
- <option value="greater">' . esc_html__( 'Is greater than', 'wpsc') . '</option>
138
- <option value="less">' . esc_html__( 'Is less than', 'wpsc') . '</option>
139
- <option value="contains">' . esc_html__( 'Contains', 'wpsc') . '</option>
140
- <option value="not_contain">' . esc_html__( 'Does not contain', 'wpsc') . '</option>
141
- <option value="begins">' . esc_html__( 'Begins with', 'wpsc') . '</option>
142
- <option value="ends">' . esc_html__( 'Ends with', 'wpsc') . '</option>
143
  </select>
144
  <span>
145
  <input type="text" name="rules[value][]"/>
146
  </span>
147
-
148
 
149
  </div>
150
  </div>
@@ -152,42 +145,34 @@ $output ='
152
  <td>
153
  </td>
154
  <td colspan="3">
155
- <input type="submit" value="'.esc_attr__("Update Coupon", "wpsc").'" class="button-primary" name="edit_coupon['.$id.'][submit_coupon]" />';
156
-
157
- $nonced_url = admin_url( 'admin.php' );
158
- $nonced_url = add_query_arg(
159
- array(
160
- 'wpsc_admin_action' => 'wpsc-delete-coupon',
161
- 'delete_id' => $id,
162
- '_wp_http_referer' => urlencode( admin_url( 'edit.php?post_type=wpsc-product&page=wpsc-edit-coupons' ) ),
163
- ),
164
- $nonced_url
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>
172
  </tr>
173
  ';
174
  return $output;
175
 
176
- }
177
  function setting_button(){
178
  $next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
179
-
180
- // $output.="<div><img src='" . plugins_url( WPSC_DIR_NAME . '/images/settings_button.jpg' ) . "' onclick='display_settings_button()'>";
181
- $output.="<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".esc_html__('Settings', 'wpsc')." &raquo;</a>";
182
  $output.="<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
183
  $output.="<ul class='settings_button'>";
184
-
185
  $output.="<li><a href='admin.php?page=wpsc-settings'>".__('Shop Settings', 'wpsc')."</a></li>";
186
  $output.="<li><a href='admin.php?page=wpsc-settings&amp;tab=gateway'>".__('Money and Payment', 'wpsc')."</a></li>";
187
  $output.="<li><a href='admin.php?page=wpsc-settings&amp;tab=checkout'>".__('Checkout Page Settings', 'wpsc')."</a></li>";
188
  $output.="</ul>";
189
  $output.="</span>&emsp;&emsp;</div>";
190
-
191
  return $output;
192
  }
193
 
@@ -198,7 +183,7 @@ function wpsc_right_now() {
198
  $start_timestamp = mktime(0, 0, 0, $month, 1, $year);
199
  $end_timestamp = mktime(0, 0, 0, ($month+1), 0, $year);
200
  $product_count = $wpdb->get_var("SELECT COUNT(*)
201
- FROM `".$wpdb->posts."`
202
  WHERE `post_status` = 'publish'
203
  AND `post_type` = 'wpsc-product'"
204
  );
@@ -212,7 +197,7 @@ function wpsc_right_now() {
212
  $theme = get_option('wpsc_selected_theme');
213
  ?>
214
  <div class='table'>
215
- <p class='sub'><?php esc_html_e( 'At a Glance', 'wpsc' ); ?></p>
216
  <table style='border-top:1px solid #ececec;'>
217
  <tr class='first'>
218
  <td class='first b'>
@@ -225,7 +210,7 @@ function wpsc_right_now() {
225
  <?php echo $sales_count; ?>
226
  </td>
227
  <td class='last'>
228
- <?php echo _nx( 'Sale', 'Sales', $sales_count, 'dashboard widget', 'wpsc' ); ?>
229
  </td>
230
  </tr>
231
  <tr>
@@ -233,13 +218,13 @@ function wpsc_right_now() {
233
  <?php echo $group_count; ?>
234
  </td>
235
  <td class='t'>
236
- <?php echo _nx( 'Category', 'Categories', $group_count, 'dashboard widget', 'wpsc' ); ?>
237
  </td>
238
  <td class='b'>
239
  <?php echo $pending_sales; ?>
240
  </td>
241
  <td class='last t waiting'>
242
- <?php echo _n( 'Pending sale', 'Pending sales', $pending_sales, 'wpsc' ); ?>
243
  </td>
244
  </tr>
245
  <tr>
@@ -247,13 +232,13 @@ function wpsc_right_now() {
247
  <?php echo $variation_count; ?>
248
  </td>
249
  <td class='t'>
250
- <?php echo _nx( 'Variation', 'Variations', $variation_count, 'dashboard widget', 'wpsc' ); ?>
251
  </td>
252
  <td class='b'>
253
  <?php echo $accept_sales; ?>
254
  </td>
255
  <td class='last t approved'>
256
- <?php echo _n( 'Closed sale', 'Closed sales', $accept_sales, 'wpsc'); ?>
257
  </td>
258
  </tr>
259
  </table>
@@ -261,5 +246,219 @@ 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']);
10
  $output .= "<form name='edit_coupon' id='".$coupon['coupon_code']."' method='post' action=''>\n\r";
11
  $output .= "<table class='add-coupon'>\n\r";
12
  $output .= " <tr>\n\r";
13
+ $output .= " <th>".__('Coupon Code', 'wpsc')."</th>\n\r";
14
+ $output .= " <th>".__('Discount', 'wpsc')."</th>\n\r";
15
+ $output .= " <th>".__('Start', 'wpsc')."</th>\n\r";
16
+ $output .= " <th>".__('Expiry', 'wpsc')."</th>\n\r";
17
+ $output .= " <th>".__('Use Once', 'wpsc')."</th>\n\r";
18
+ $output .= " <th>".__('Active', 'wpsc')."</th>\n\r";
19
+ $output .= " <th>".__('Apply On All Products', 'wpsc')."</th>\n\r";
20
  $output .= " <th></th>\n\r";
21
  $output .= " </tr>\n\r";
22
  $output .= " <tr>\n\r";
30
  $output .= " <select name='edit_coupon[".$id."][is-percentage]'>";
31
  $output .= " <option value='0' ".(($coupon['is-percentage'] == 0) ? "selected='true'" : '')." >$</option>\n\r";//
32
  $output .= " <option value='1' ".(($coupon['is-percentage'] == 1) ? "selected='true'" : '')." >%</option>\n\r";
33
+ $output .= " <option value='2' ".(($coupon['is-percentage'] == 2) ? "selected='true'" : '')." >" . __( 'Free shipping', 'wpsc' ) . "'</option>\n\r";
34
  $output .= " </select>\n\r";
35
  $output .= " </td>\n\r";
36
  $output .= " <td>\n\r";
37
+ $coupon_start = explode(" ",$coupon['start']);
38
+ $output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][start]' value='{$coupon_start[0]}'>";
39
  $output .= " </td>\n\r";
40
  $output .= " <td>\n\r";
41
+ $coupon_expiry = explode(" ",$coupon['expiry']);
42
+ $output .= "<input type='text' class='pickdate' size='11' name='edit_coupon[".$id."][expiry]' value='{$coupon_expiry[0]}'>";
43
  $output .= " </td>\n\r";
44
  $output .= " <td>\n\r";
45
  $output .= " <input type='hidden' value='0' name='edit_coupon[".$id."][use-once]' />\n\r";
61
  if($conditions != null){
62
  $output .= "<tr>";
63
  $output .= "<th>";
64
+ $output .= __("Conditions", 'wpsc');
65
  $output .= "</th>";
66
  $output .= "</tr>";
67
  $output .= "<th>";
68
+ $output .= __("Delete", 'wpsc');
69
  $output .= "</th>";
70
  $output .= "<th>";
71
+ $output .= __("Property", 'wpsc');
72
  $output .= "</th>";
73
  $output .= "<th>";
74
+ $output .= __("Logic", 'wpsc');
75
  $output .= "</th>";
76
  $output .= "<th>";
77
+ $output .= __("Value", 'wpsc');
78
  $output .= "</th>";
79
  $output .= " </tr>\n\r";
80
+ $i=0;
81
+ foreach ($conditions as $condition){
82
  $output .= "<tr>";
83
  $output .= "<td>";
84
  $output .= "<input type='hidden' name='coupon_id' value='".$id."' />";
85
  $output .= "<input type='submit' id='delete_condition".$i."' style='display:none;' value='".$i."' name='delete_condition' />";
86
+ $output .= "<span style='cursor:pointer;' class='delete_button' onclick='jQuery(\"#delete_condition".$i."\").click()'>" . __('Delete', 'wpsc' ) . "</span>";
87
  $output .= "</td>";
88
  $output .= "<td>";
89
  $output .= $condition['property'];
114
 
115
  $output ='
116
  <input type="hidden" name="coupon_id" value="'.$id.'" />
117
+ <tr><td colspan="3"><b>' . __( 'Add Conditions', 'wpsc') . '</b></td></tr>
118
  <tr><td colspan="6">
119
  <div class="coupon_condition">
120
  <div>
121
  <select class="ruleprops" name="rules[property][]">
122
+ <option value="item_name" rel="order">' . __( 'Item name', 'wpsc') . '</option>
123
+ <option value="item_quantity" rel="order">' . __( 'Item quantity', 'wpsc') . '</option>
124
+ <option value="total_quantity" rel="order">' . __( 'Total quantity', 'wpsc') . '</option>
125
+ <option value="subtotal_amount" rel="order">' . __( 'Subtotal amount', 'wpsc') . '</option>
126
  ' . apply_filters( 'wpsc_coupon_rule_property_options', '' ) . '
127
  </select>
128
  <select name="rules[logic][]">
129
+ <option value="equal">' . __( 'Is equal to', 'wpsc') . '</option>
130
+ <option value="greater">' . __( 'Is greater than', 'wpsc') . '</option>
131
+ <option value="less">' . __( 'Is less than', 'wpsc') . '</option>
132
+ <option value="contains">' . __( 'Contains', 'wpsc') . '</option>
133
+ <option value="not_contain">' . __( 'Does not contain', 'wpsc') . '</option>
134
+ <option value="begins">' . __( 'Begins with', 'wpsc') . '</option>
135
+ <option value="ends">' . __( 'Ends with', 'wpsc') . '</option>
136
  </select>
137
  <span>
138
  <input type="text" name="rules[value][]"/>
139
  </span>
140
+
141
 
142
  </div>
143
  </div>
145
  <td>
146
  </td>
147
  <td colspan="3">
148
+
149
+ <input type="submit" value="'.__("Update Coupon", "wpsc").'" class="button-primary" name="edit_coupon['.$id.'][submit_coupon]" />';
150
+
151
+ $nonced_url = wp_nonce_url("admin.php?wpsc_admin_action=wpsc-delete-coupon&amp;delete_id=$id", 'delete-coupon');
152
+
153
+ $output.= "<a class='delete_button' style='text-decoration:none;' href=" .$nonced_url."> Delete</a>";
154
+
155
+ $output.='
 
 
 
 
 
 
 
 
156
  </td>
157
  </tr>
158
  ';
159
  return $output;
160
 
161
+ }
162
  function setting_button(){
163
  $next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
164
+
165
+ // $output.="<div><img src='".get_option('siteurl')."/wp-content/plugins/".WPSC_DIR_NAME."/images/settings_button.jpg' onclick='display_settings_button()'>";
166
+ $output.="<div style='float: right; margin-top: 0px; position: relative;'> | <a href='#' onclick='display_settings_button(); return false;' style='text-decoration: underline;'>".__('Settings', 'wpsc')." &raquo;</a>";
167
  $output.="<span id='settings_button' style='width:180px;background-color:#f1f1f1;position:absolute; right: 10px; border:1px solid black; display:none;'>";
168
  $output.="<ul class='settings_button'>";
169
+
170
  $output.="<li><a href='admin.php?page=wpsc-settings'>".__('Shop Settings', 'wpsc')."</a></li>";
171
  $output.="<li><a href='admin.php?page=wpsc-settings&amp;tab=gateway'>".__('Money and Payment', 'wpsc')."</a></li>";
172
  $output.="<li><a href='admin.php?page=wpsc-settings&amp;tab=checkout'>".__('Checkout Page Settings', 'wpsc')."</a></li>";
173
  $output.="</ul>";
174
  $output.="</span>&emsp;&emsp;</div>";
175
+
176
  return $output;
177
  }
178
 
183
  $start_timestamp = mktime(0, 0, 0, $month, 1, $year);
184
  $end_timestamp = mktime(0, 0, 0, ($month+1), 0, $year);
185
  $product_count = $wpdb->get_var("SELECT COUNT(*)
186
+ FROM `".$wpdb->posts."`
187
  WHERE `post_status` = 'publish'
188
  AND `post_type` = 'wpsc-product'"
189
  );
197
  $theme = get_option('wpsc_selected_theme');
198
  ?>
199
  <div class='table'>
200
+ <p class='sub'><?php _e('At a Glance', 'wpsc'); ?></p>
201
  <table style='border-top:1px solid #ececec;'>
202
  <tr class='first'>
203
  <td class='first b'>
210
  <?php echo $sales_count; ?>
211
  </td>
212
  <td class='last'>
213
+ <?php echo _nx('Sale', 'Sales', $sales_count, 'dashboard widget', 'wpsc'); ?>
214
  </td>
215
  </tr>
216
  <tr>
218
  <?php echo $group_count; ?>
219
  </td>
220
  <td class='t'>
221
+ <?php echo _nx('Category', 'Categories', $group_count, 'dashboard widget', 'wpsc'); ?>
222
  </td>
223
  <td class='b'>
224
  <?php echo $pending_sales; ?>
225
  </td>
226
  <td class='last t waiting'>
227
+ <?php echo _n('Pending sale', 'Pending sales', $pending_sales, 'wpsc'); ?>
228
  </td>
229
  </tr>
230
  <tr>
232
  <?php echo $variation_count; ?>
233
  </td>
234
  <td class='t'>
235
+ <?php echo _nx('Variation', 'Variations', $variation_count, 'dashboard widget', 'wpsc'); ?>
236
  </td>
237
  <td class='b'>
238
  <?php echo $accept_sales; ?>
239
  </td>
240
  <td class='last t approved'>
241
+ <?php echo _n('Closed sale', 'Closed sales', $accept_sales, 'wpsc'); ?>
242
  </td>
243
  </tr>
244
  </table>
246
  <?php
247
  }
248
 
249
+
250
+ function wpsc_packing_slip( $purchase_id ) {
251
+ echo "<!DOCTYPE html><html><head><title>" . __( 'Packing Slip', 'wpsc' ) . "</title></head><body id='wpsc-packing-slip'>";
252
+ global $wpdb;
253
+ $purch_sql = $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id`=%d", $purchase_id );
254
+ $purch_data = $wpdb->get_row( $purch_sql, ARRAY_A ) ;
255
+
256
+ $cartsql = $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`=%d", $purchase_id );
257
+ $cart_log = $wpdb->get_results($cartsql,ARRAY_A) ;
258
+ $j = 0;
259
+
260
+ if($cart_log != null) {
261
+ echo "<div class='packing_slip'>\n\r";
262
+ echo apply_filters( 'wpsc_packing_slip_header', '<h2>' . __( 'Packing Slip', 'wpsc' ) . "</h2>\n\r" );
263
+ echo "<strong>".__('Order', 'wpsc')." #</strong> ".$purchase_id."<br /><br />\n\r";
264
+
265
+ echo "<table>\n\r";
266
+
267
+ $form_sql = $wpdb->prepare( "SELECT * FROM `".WPSC_TABLE_SUBMITED_FORM_DATA."` WHERE `log_id` = %d", $purchase_id );
268
+ $input_data = $wpdb->get_results($form_sql,ARRAY_A);
269
+
270
+ foreach($input_data as $input_row) {
271
+ $rekeyed_input[$input_row['form_id']] = $input_row;
272
+ }
273
+
274
+
275
+ if($input_data != null) {
276
+ $form_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1'",ARRAY_A);
277
+
278
+ foreach($form_data as $form_field) {
279
+
280
+ switch($form_field['type']) {
281
+ case 'country':
282
+ $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'] );
283
+ $delivery_region_count = $wpdb->get_var( $region_count_sql );
284
+
285
+ if(is_numeric($purch_data['billing_region']) && ($delivery_region_count > 0))
286
+ echo " <tr><td>".__('State', 'wpsc').":</td><td>".wpsc_get_region($purch_data['billing_region'])."</td></tr>\n\r";
287
+
288
+ echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8')."</td></tr>\n\r";
289
+ break;
290
+
291
+ case 'delivery_country':
292
+
293
+ if(is_numeric($purch_data['shipping_region']) && ($delivery_region_count > 0))
294
+ echo " <tr><td>".__('State', 'wpsc').":</td><td>".wpsc_get_region($purch_data['shipping_region'])."</td></tr>\n\r";
295
+
296
+ echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8')."</td></tr>\n\r";
297
+ break;
298
+
299
+ case 'heading':
300
+
301
+ if($form_field['name'] == "Hidden Fields")
302
+ continue;
303
+ else
304
+ echo " <tr class='heading'><td colspan='2'><strong>".wp_kses($form_field['name'], array()).":</strong></td></tr>\n\r";
305
+ break;
306
+
307
+ default:
308
+ if( $form_field['name'] == "Cupcakes") {
309
+ parse_str($rekeyed_input[$form_field['id']]['value'], $cupcakes );
310
+
311
+ foreach( $cupcakes as $product_id => $quantity ) {
312
+ $product = get_post($product_id);
313
+ $string .= "(".$quantity.") ".$product->post_title.", ";
314
+ }
315
+
316
+ $string = rtrim($string, ", ");
317
+ echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".htmlentities(stripslashes($string), ENT_QUOTES, 'UTF-8')."</td></tr>\n\r";
318
+ } else {
319
+ if ($form_field['name']=="State" && !empty($purch_data['billing_region']) || $form_field['name']=="State" && !empty($purch_data['billing_region']))
320
+ echo "";
321
+ else
322
+ echo " <tr><td>".wp_kses($form_field['name'], array() ).":</td><td>".
323
+ ( isset( $rekeyed_input[$form_field['id']] ) ? htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES, 'UTF-8') : '' ).
324
+ "</td></tr>\n\r";
325
+ }
326
+ break;
327
+ }
328
+
329
+ }
330
+ } else {
331
+ echo " <tr><td>".__('Name', 'wpsc').":</td><td>".$purch_data['firstname']." ".$purch_data['lastname']."</td></tr>\n\r";
332
+ echo " <tr><td>".__('Address', 'wpsc').":</td><td>".$purch_data['address']."</td></tr>\n\r";
333
+ echo " <tr><td>".__('Phone', 'wpsc').":</td><td>".$purch_data['phone']."</td></tr>\n\r";
334
+ echo " <tr><td>".__('Email', 'wpsc').":</td><td>".$purch_data['email']."</td></tr>\n\r";
335
+ }
336
+
337
+ if ( 2 == get_option( 'payment_method' ) ) {
338
+ $gateway_name = '';
339
+ $nzshpcrt_gateways = nzshpcrt_get_gateways();
340
+
341
+ foreach( $nzshpcrt_gateways as $gateway ) {
342
+ if ( $purch_data['gateway'] != 'testmode' ) {
343
+ if ( $gateway['internalname'] == $purch_data['gateway'] ) {
344
+ $gateway_name = $gateway['name'];
345
+ }
346
+ } else {
347
+ $gateway_name = __('Manual Payment', 'wpsc');
348
+ }
349
+ }
350
+ }
351
+
352
+ echo "</table>\n\r";
353
+
354
+
355
+ do_action ('wpsc_packing_slip_extra_info',$purchase_id);
356
+
357
+
358
+ echo "<table class='packing_slip'>";
359
+
360
+ echo "<tr>";
361
+ echo " <th>".__('Quantity', 'wpsc')." </th>";
362
+
363
+ echo " <th>".__('Name', 'wpsc')."</th>";
364
+
365
+
366
+ echo " <th>".__('Price', 'wpsc')." </th>";
367
+
368
+ echo " <th>".__('Shipping', 'wpsc')." </th>";
369
+ echo '<th>' . __('Tax', 'wpsc') . '</th>';
370
+ echo '</tr>';
371
+ $endtotal = 0;
372
+ $all_donations = true;
373
+ $all_no_shipping = true;
374
+ $file_link_list = array();
375
+ $total_shipping = 0;
376
+ foreach($cart_log as $cart_row) {
377
+ $alternate = "";
378
+ $j++;
379
+ if(($j % 2) != 0) {
380
+ $alternate = "class='alt'";
381
+ }
382
+ // product ID will be $cart_row['prodid']. need to fetch name and stuff
383
+
384
+ $variation_list = '';
385
+
386
+ if($cart_row['donation'] != 1) {
387
+ $all_donations = false;
388
+ }
389
+
390
+ if($cart_row['no_shipping'] != 1) {
391
+ $shipping = $cart_row['pnp'];
392
+ $total_shipping += $shipping;
393
+ $all_no_shipping = false;
394
+ } else {
395
+ $shipping = 0;
396
+ }
397
+
398
+ $price = $cart_row['price'] * $cart_row['quantity'];
399
+ $gst = $price - ($price / (1+($cart_row['gst'] / 100)));
400
+
401
+ if($gst > 0) {
402
+ $tax_per_item = $gst / $cart_row['quantity'];
403
+ }
404
+
405
+
406
+ echo "<tr $alternate>";
407
+
408
+
409
+ echo " <td>";
410
+ echo $cart_row['quantity'];
411
+ echo " </td>";
412
+
413
+ echo " <td>";
414
+ echo $cart_row['name'];
415
+ echo stripslashes($variation_list);
416
+ echo " </td>";
417
+
418
+
419
+ echo " <td>";
420
+ echo wpsc_currency_display( $price );
421
+ echo " </td>";
422
+
423
+ echo " <td>";
424
+ echo wpsc_currency_display($shipping );
425
+ echo " </td>";
426
+
427
+
428
+
429
+ echo '<td>';
430
+ echo wpsc_currency_display( $cart_row['tax_charged'] );
431
+ echo '</td>';
432
+ echo '</tr>';
433
+ }
434
+
435
+ echo "</table>";
436
+ echo '<table class="packing-slip-totals">';
437
+ if ( floatval( $purch_data['discount_value'] ) )
438
+ echo '<tr><th>'.__('Discount', 'wpsc').'</th><td>(' . wpsc_currency_display( $purch_data['discount_value'] ) . ')</td></tr>';
439
+
440
+ echo '<tr><th>'.__('Base Shipping','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['base_shipping'] ) . '</td></tr>';
441
+ echo '<tr><th>'.__('Total Shipping','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['base_shipping'] + $total_shipping ) . '</td></tr>';
442
+ //wpec_taxes
443
+ if($purch_data['wpec_taxes_total'] != 0.00)
444
+ {
445
+ echo '<tr><th>'.__('Taxes','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['wpec_taxes_total'] ) . '</td></tr>';
446
+ }
447
+ echo '<tr><th>'.__('Total Price','wpsc').'</th><td>' . wpsc_currency_display( $purch_data['totalprice'] ) . '</td></tr>';
448
+ echo '</table>';
449
+
450
+ echo "</div>\n\r";
451
+ } else {
452
+ echo "<br />".__('This users cart was empty', 'wpsc');
453
+ }
454
+
455
+ }
456
+
457
+
458
+
459
+
460
+
461
  function wpsc_product_item_row() {
462
  }
463
+
464
+ ?>
wpsc-admin/admin.php CHANGED
@@ -19,34 +19,23 @@ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/updating-functions.php' );
19
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-coupons.php' );
20
  require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs.class.php' );
21
  require_once( WPSC_FILE_PATH . '/wpsc-includes/theming.class.php' );
22
- require_once( WPSC_FILE_PATH . '/wpsc-admin/ajax.php' );
23
- 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' );
31
 
32
  if ( ! get_option( 'wpsc_checkout_form_sets' ) ) {
33
- $form_sets = array( __( 'Default Checkout Forms', 'wpsc' ) );
34
  update_option( 'wpsc_checkout_form_sets', $form_sets );
35
  }
36
-
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
 
@@ -55,6 +44,14 @@ function wpsc_query_vars_product_list( $vars ){
55
 
56
  $vars['posts_per_archive_page'] = 0;
57
 
 
 
 
 
 
 
 
 
58
  if( 'dragndrop' == get_option( 'wpsc_sort_by' ) ){
59
  $vars['orderby'] = 'menu_order title';
60
  $vars['order'] = 'desc';
@@ -65,43 +62,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);
@@ -113,15 +84,11 @@ add_filter('set-screen-option', 'wpsc_set_screen_option', 99, 3);
113
 
114
  /**
115
  * When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
116
- * @access public
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 +98,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 +128,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
 
@@ -194,17 +146,14 @@ function wpsc_admin_pages() {
194
  if ( wpsc_show_update_link() )
195
  $page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wpsc' ), __( 'Store Update', 'wpsc' ), 'administrator', 'wpsc-update', 'wpsc_display_update_page' );
196
 
197
- $store_upgrades_cap = apply_filters( 'wpsc_upgrades_cap', 'administrator' );
198
- $page_hooks[] = add_submenu_page( 'index.php', __( 'Store Upgrades', 'wpsc' ), __( 'Store Upgrades', 'wpsc' ), $store_upgrades_cap, 'wpsc-upgrades', 'wpsc_display_upgrades_page' );
199
 
200
- $purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', 'administrator' );
201
- $page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), $purchase_logs_cap, 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );
202
 
203
  // Set the base page for Products
204
  $products_page = 'edit.php?post_type=wpsc-product';
205
 
206
- $manage_coupon_cap = apply_filters( 'wpsc_coupon_cap', 'administrator' );
207
- $page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page , __( 'Coupons', 'wpsc' ), __( 'Coupons', 'wpsc' ), $manage_coupon_cap, 'wpsc-edit-coupons', 'wpsc_display_coupons_page' );
208
 
209
  // Add Settings pages
210
  $page_hooks[] = $edit_options_page = add_options_page( __( 'Store Settings', 'wpsc' ), __( 'Store', 'wpsc' ), 'administrator', 'wpsc-settings', 'wpsc_display_settings_page' );
@@ -262,9 +211,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 +218,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(
@@ -310,7 +251,7 @@ function wpsc_add_help_tabs() {
310
  'wpsc-product' => array(
311
  'title' => _x( 'Add and Edit Product', 'contextual help tab', 'wpsc' ),
312
  'links' => array(
313
- 'category/managing-your-store/' => _x( 'Managing Your Store' , 'contextual help link', 'wpsc' ),
314
  'resource/video-adding-products/' => _x( 'Video: Adding Products', 'contextual help link', 'wpsc' ),
315
  ),
316
  ),
@@ -351,189 +292,97 @@ function wpsc_add_help_tabs() {
351
  $screen = get_current_screen();
352
  if ( array_key_exists( $screen->id, $tabs ) ) {
353
  $tab = $tabs[$screen->id];
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' ),
404
- 'change_purchase_log_status_nonce' => _wpsc_create_ajax_nonce( 'change_purchase_log_status' ),
405
- 'purchase_log_save_tracking_id_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_save_tracking_id' ),
406
- 'purchase_log_send_tracking_email_nonce' => _wpsc_create_ajax_nonce( 'purchase_log_send_tracking_email' ),
407
- 'sending_message' => _x( 'sending...', 'sending tracking email for purchase log', 'wpsc' ),
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(
513
- 'navigate_settings_tab_nonce' => _wpsc_create_ajax_nonce( 'navigate_settings_tab' ),
514
- 'payment_gateway_settings_form_nonce' => _wpsc_create_ajax_nonce( 'payment_gateway_settings_form' ),
515
- 'shipping_module_settings_form_nonce' => _wpsc_create_ajax_nonce( 'shipping_module_settings_form' ),
516
- 'display_region_list_nonce' => _wpsc_create_ajax_nonce( 'display_region_list' ),
517
- 'update_checkout_fields_order_nonce' => _wpsc_create_ajax_nonce( 'update_checkout_fields_order' ),
518
- 'add_tax_rate_nonce' => _wpsc_create_ajax_nonce( 'add_tax_rate' ),
519
- 'current_tab' => WPSC_Settings_Page::get_instance()->get_current_tab_id(),
520
- 'before_unload_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wpsc' ),
521
- 'ajax_navigate_confirm_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wpsc' ) . "\n\n" . __( 'Click OK to discard your changes, or Cancel to remain on this page.' ),
522
- 'edit_field_options' => __( 'Edit Options', 'wpsc' ),
523
- 'hide_edit_field_options' => __( 'Hide Options', 'wpsc' ),
524
- 'delete_form_set_confirm' => __( 'Are you sure you want to delete %s? Submitted data of this form set will also be removed from sales logs.', 'wpsc' ),
525
  ) );
526
 
527
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
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';
@@ -541,40 +390,34 @@ function wpsc_meta_boxes() {
541
 
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
579
  wp_enqueue_script( 'jquery' );
580
  wp_enqueue_script( 'jquery-ui-draggable' );
@@ -590,176 +433,137 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
590
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
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' ) ) ) {
602
  wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery', 'wpsc-sortable-table' ), $version_identifier );
603
- wp_localize_script(
604
- 'wp-e-commerce-variations', // handle
605
- 'WPSC_Variations', // variable name
606
- array( // args
607
- 'thickbox_title' => __( 'Add Media - %s', 'wpsc' ),
608
- )
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'],
646
- 'add_variation_set_nonce' => _wpsc_create_ajax_nonce( 'add_variation_set' ),
647
- ) );
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(
659
- 'link_text' => __( 'Use as Product Thumbnail', 'wpsc' ),
660
- 'saving' => __( 'Saving...' ),
661
- 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
662
- 'done' => __( 'Done' ),
663
- 'nonce' => _wpsc_create_ajax_nonce( 'set_variation_product_thumbnail' ),
664
- ) );
665
- }
666
  }
667
 
668
- if ( 'dashboard_page_wpsc-upgrades' == $pagehook || 'dashboard_page_wpsc-update' == $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 . "`" );
@@ -768,7 +572,7 @@ function wpsc_admin_latest_activity() {
768
  * This is the right hand side for the past 30 days revenue on the wp dashboard
769
  */
770
  echo "<div id='leftDashboard'>";
771
- echo "<strong class='dashboardHeading'>" . esc_html__( 'Current Month', 'wpsc' ) . "</strong><br />";
772
  echo "<p class='dashboardWidgetSpecial'>";
773
  // calculates total amount of orders for the month
774
  $year = date( "Y" );
@@ -781,7 +585,7 @@ function wpsc_admin_latest_activity() {
781
  //calculates amount of money made for the month
782
  $currentMonthsSales = wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) );
783
  echo $currentMonthsSales;
784
- echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
785
  echo "</p>";
786
  echo "<p class='dashboardWidgetSpecial'>";
787
  echo "<span class='pricedisplay'>";
@@ -796,7 +600,7 @@ function wpsc_admin_latest_activity() {
796
  echo wpsc_currency_display( $monthsAverage );
797
  }
798
  //echo "</span>";
799
- echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wpsc' ) . "</span>";
800
  echo "</p>";
801
  echo "</div>";
802
  /*
@@ -804,11 +608,11 @@ function wpsc_admin_latest_activity() {
804
  */
805
 
806
  echo "<div id='rightDashboard' >";
807
- echo "<strong class='dashboardHeading'>" . esc_html__( 'Total Income', 'wpsc' ) . "</strong><br />";
808
 
809
  echo "<p class='dashboardWidgetSpecial'>";
810
  echo wpsc_currency_display( admin_display_total_price() );
811
- echo "<span class='dashboardWidget'>" . esc_html_x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
812
  echo "</p>";
813
  echo "<p class='dashboardWidgetSpecial'>";
814
  echo "<span class='pricedisplay'>";
@@ -825,77 +629,55 @@ function wpsc_admin_latest_activity() {
825
  }
826
  echo wpsc_currency_display( $totalAverage );
827
  //echo "</span>";
828
- echo "<span class='dashboardWidget'>" . esc_html__( 'Avg Order', 'wpsc' ) . "</span>";
829
  echo "</p>";
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
849
- wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
850
- wp_enqueue_script( 'datepicker-ui', WPSC_URL . "/wpsc-core/js/ui.datepicker.js", array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier );
851
-
852
- $news_cap = apply_filters( 'wpsc_dashboard_news_cap' , 'manage_options' );
853
- $sales_cap = apply_filters( 'wpsc_dashboard_sales_summary_cap' , 'manage_options' );
854
- $quarterly_sales_cap = apply_filters( 'wpsc_dashboard_quarterly_sales_cap', 'manage_options' );
855
- $monthly_sales_cap = apply_filters( 'wpsc_dashboard_monthly_sales_cap' , 'manage_options' );
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 ) )
863
  wp_add_dashboard_widget( 'wpsc_quarterly_dashboard_widget', __( 'Sales by Quarter', 'wpsc' ), 'wpsc_quarterly_dashboard_widget' );
864
- if ( current_user_can( $monthly_sales_cap ) )
865
  wp_add_dashboard_widget( 'wpsc_dashboard_4months_widget', __( 'Sales by Month', 'wpsc' ), 'wpsc_dashboard_4months_widget' );
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();
876
- if ( isset( $normal_dashboard['wpsc_dashboard_news'] ) ) {
877
- $wpsc_widget_backup['wpsc_dashboard_news'] = $normal_dashboard['wpsc_dashboard_news'];
878
  unset( $normal_dashboard['wpsc_dashboard_news'] );
879
- }
880
- if ( isset( $normal_dashboard['wpsc_dashboard_widget'] ) ) {
881
- $wpsc_widget_backup['wpsc_dashboard_widget'] = $normal_dashboard['wpsc_dashboard_widget'];
882
  unset( $normal_dashboard['wpsc_dashboard_widget'] );
883
- }
884
- if ( isset( $normal_dashboard['wpsc_quarterly_dashboard_widget'] ) ) {
885
- $wpsc_widget_backup['wpsc_quarterly_dashboard_widget'] = $normal_dashboard['wpsc_quarterly_dashboard_widget'];
886
  unset( $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
887
- }
888
- if ( isset( $normal_dashboard['wpsc_dashboard_4months_widget'] ) ) {
889
- $wpsc_widget_backup['wpsc_dashboard_4months_widget'] = $normal_dashboard['wpsc_dashboard_4months_widget'];
890
  unset( $normal_dashboard['wpsc_dashboard_4months_widget'] );
891
- }
892
 
893
- // Merge the two arrays together so our widget is at the beginning
894
- $sorted_dashboard = array_merge( $wpsc_widget_backup, $normal_dashboard );
 
895
 
896
- // Save the sorted array back into the original metaboxes
897
 
898
- $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
 
899
  }
900
 
901
  /*
@@ -904,33 +686,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,17 +707,11 @@ 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
  ?>
951
  <form action='' method='post'>
952
- <label for='date_start'><?php esc_html_e( 'Financial Year End' , 'wpsc' ); ?>: </label>
953
  <input id='date_start' type='text' class='pickdate' size='11' value='<?php echo get_option( 'wpsc_last_date' ); ?>' name='add_start' />
954
  <!--<select name='add_start[day]'>
955
  <?php
@@ -1006,8 +768,8 @@ function wpsc_quarterly_dashboard_widget() {
1006
  ?>
1007
  <div id='box'>
1008
  <p class='atglance'>
1009
- <span class='wpsc_quart_left'><?php esc_html_e( 'At a Glance' , 'wpsc' ); ?></span>
1010
- <span class='wpsc_quart_right'><?php esc_html_e( 'Revenue' , 'wpsc' ); ?></span>
1011
  </p>
1012
  <div style='clear:both'></div>
1013
  <p class='quarterly'>
@@ -1030,15 +792,12 @@ 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' );
 
 
1042
  }
1043
 
1044
  /*
@@ -1048,12 +807,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 +838,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
@@ -1110,10 +865,10 @@ function wpsc_dashboard_4months_widget() {
1110
  $tablerow = 1;
1111
  ob_start();
1112
  ?>
1113
- <div style="padding-bottom:15px; "><?php esc_html_e( 'Last four months of sales on a per product basis:', 'wpsc' ); ?></div>
1114
  <table style="width:100%" border="0" cellspacing="0">
1115
  <tr style="font-style:italic; color:#666;" height="20">
1116
- <td colspan="2" style=" font-family:\'Times New Roman\', Times, serif; font-size:15px; border-bottom:solid 1px #000;"><?php esc_html_e( 'At a Glance', 'wpsc' ); ?></td>
1117
  <?php foreach ( $months as $mnth ): ?>
1118
  <td align="center" style=" font-family:\'Times New Roman\'; font-size:15px; border-bottom:solid 1px #000;"><?php echo date( "M", $mnth ); ?></td>
1119
  <?php endforeach; ?>
@@ -1137,12 +892,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 +900,36 @@ 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 +944,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,458 +986,25 @@ 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
  }
1258
 
1259
- /**
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' );
1275
-
1276
- if ( ! in_array( $base_country, WPSC_Country::get_outdated_isocodes() ) )
1277
- return;
1278
 
1279
- switch ( $base_country ) {
1280
- case 'YU':
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
 
1293
- $message = sprintf(
1294
- /* message */ $message,
1295
- /* %1$s */ 'http://en.wikipedia.org/wiki/ISO_3166-1',
1296
- /* %2$s */ admin_url( 'options-general.php?page=wpsc-settings&tab=general' ),
1297
- /* %3$s */ WPSC_VERSION
1298
- );
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
-
1326
- $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_parent = %d AND post_type ='wpsc-product-file'", $file_name, $product_id );
1327
- $product_id_to_delete = $wpdb->get_var( $sql );
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,
1359
- 'post_type' => $new_post_type,
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,
1367
- 'post_content' => $post_content,
1368
- 'post_content_filtered' => $post_content_filtered,
1369
- 'post_mime_type' => $post->post_mime_type,
1370
- 'import_id' => 0
1371
- );
1372
-
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
-
1381
- // Copy the taxonomies
1382
- wpsc_duplicate_taxonomies( $post->ID, $new_post_id, $post->post_type );
1383
-
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
-
1392
- return $new_post_id;
1393
- }
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;
1429
-
1430
- $post_meta_infos = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $id ) );
1431
-
1432
- if ( count( $post_meta_infos ) ) {
1433
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
1434
- $values = array();
1435
- foreach ( $post_meta_infos as $meta_info ) {
1436
- $meta_key = $meta_info->meta_key;
1437
- $meta_value = addslashes( $meta_info->meta_value );
1438
-
1439
- $sql_query_sel[] = "( $new_id, '$meta_key', '$meta_value' )";
1440
- $values[] = $new_id;
1441
- $values[] = $meta_key;
1442
- $values[] = $meta_value;
1443
- $values += array( $new_id, $meta_key, $meta_value );
1444
- }
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',
1468
- 'post_status' => 'any',
1469
- 'numberposts' => -1,
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' );
19
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-coupons.php' );
20
  require_once( WPSC_FILE_PATH . '/wpsc-includes/purchaselogs.class.php' );
21
  require_once( WPSC_FILE_PATH . '/wpsc-includes/theming.class.php' );
 
 
22
  require_once( WPSC_FILE_PATH . '/wpsc-admin/ajax-and-init.php' );
23
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-options-settings.page.php' );
 
 
24
 
25
  if ( ( isset( $_SESSION['wpsc_activate_debug_page'] ) && ( $_SESSION['wpsc_activate_debug_page'] == true ) ) || ( defined( 'WPSC_ADD_DEBUG_PAGE' ) && ( constant( 'WPSC_ADD_DEBUG_PAGE' ) == true ) ) )
26
  require_once( WPSC_FILE_PATH . '/wpsc-admin/display-debug.page.php' );
27
 
28
  if ( ! get_option( 'wpsc_checkout_form_sets' ) ) {
29
+ $form_sets = array( 'Default Checkout Forms' );
30
  update_option( 'wpsc_checkout_form_sets', $form_sets );
31
  }
 
 
 
 
32
  /**
33
  * wpsc_query_vars_product_list sets the ordering for the edit-products page list
 
 
34
  * @access public
35
  *
36
+ * @since 3.8
37
+ * @param $vars (array) - default query arguments
38
+ * @return $vars (array) - modified query arguments
 
39
  */
40
  function wpsc_query_vars_product_list( $vars ){
41
 
44
 
45
  $vars['posts_per_archive_page'] = 0;
46
 
47
+ if( is_admin() && isset( $vars['orderby'] ) ) {
48
+ $vars['orderby'] = 'date';
49
+ $vars['order'] = 'desc';
50
+ $vars['nopaging'] = false;
51
+ $posts_per_page = (int)get_user_option( 'edit_wpsc_product_per_page' );
52
+ $vars['posts_per_page'] = ( $posts_per_page ) ? $posts_per_page : 20;
53
+ }
54
+
55
  if( 'dragndrop' == get_option( 'wpsc_sort_by' ) ){
56
  $vars['orderby'] = 'menu_order title';
57
  $vars['order'] = 'desc';
62
  }
63
 
64
  /**
65
+ * setting the screen option to between 1 and 999
 
 
66
  * @access public
67
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  * @since 3.8
69
+ * @param $status
70
+ * @param $option (string) name of option being saved
71
+ * @param $value (string) value of option being saved
 
 
 
 
72
  * @return $value after changes...
73
  */
74
  function wpsc_set_screen_option($status, $option, $value){
75
+ if( in_array($option, array ("edit_wpsc_variation_per_page","edit_wpsc_product_per_page" )) ){
76
  if ( "edit_wpsc_variation_per_page" == $option ){
77
  global $user_ID;
78
  update_user_option($user_ID,'edit_wpsc-variation_per_page',$value);
84
 
85
  /**
86
  * When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
87
+ * @access public (wp-admin)
88
  *
89
  * @since 3.8
90
+ * @param $per_page (int) number of products per page
91
+ * @param $post_type (string) name of current post type
 
 
 
 
92
  * @return $per_page after changes...
93
  */
94
  function wpsc_drag_and_drop_ordering($per_page, $post_type){
98
  return $per_page;
99
  }
100
  add_filter( 'request', 'wpsc_query_vars_product_list' );
101
+ add_filter('edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
 
102
  /**
103
  * Checks whether to display or hide the update wp-e-commerce link
104
  *
 
105
  * @access public
106
  *
107
+ * @since 3.8
 
108
  * @return boolean true - show link, false- hide link
109
  */
110
  function wpsc_show_update_link() {
128
  *
129
  * If the permissions are changed here, they will likewise need to be changed for the other sections of the admin that either use ajax
130
  * or bypass the normal download system.
 
 
 
 
 
 
 
 
 
 
 
 
131
  */
132
  function wpsc_admin_pages() {
133
 
146
  if ( wpsc_show_update_link() )
147
  $page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wpsc' ), __( 'Store Update', 'wpsc' ), 'administrator', 'wpsc-update', 'wpsc_display_update_page' );
148
 
149
+ $page_hooks[] = add_submenu_page( 'index.php', __( 'Store Upgrades', 'wpsc' ), __( 'Store Upgrades', 'wpsc' ), 'administrator', 'wpsc-upgrades', 'wpsc_display_upgrades_page' );
 
150
 
151
+ $page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), 'administrator', 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );
 
152
 
153
  // Set the base page for Products
154
  $products_page = 'edit.php?post_type=wpsc-product';
155
 
156
+ $page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page , __( 'Coupons', 'wpsc' ), __( 'Coupons', 'wpsc' ), 'administrator', 'wpsc-edit-coupons', 'wpsc_display_coupons_page' );
 
157
 
158
  // Add Settings pages
159
  $page_hooks[] = $edit_options_page = add_options_page( __( 'Store Settings', 'wpsc' ), __( 'Store', 'wpsc' ), 'administrator', 'wpsc-settings', 'wpsc_display_settings_page' );
211
  add_action( 'load-post.php' , 'wpsc_add_help_tabs' );
212
  add_action( 'load-post-new.php' , 'wpsc_add_help_tabs' );
213
  add_action( 'load-edit-tags.php' , 'wpsc_add_help_tabs' );
 
 
 
214
  }
215
 
216
  /**
218
  * add_contextual_help() is supported as well as $screen->add_help_tab().
219
  *
220
  * @since 3.8.8
 
 
 
 
 
221
  */
222
  function wpsc_add_help_tabs() {
223
  $tabs = array(
251
  'wpsc-product' => array(
252
  'title' => _x( 'Add and Edit Product', 'contextual help tab', 'wpsc' ),
253
  'links' => array(
254
+ 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wpsc' ),
255
  'resource/video-adding-products/' => _x( 'Video: Adding Products', 'contextual help link', 'wpsc' ),
256
  ),
257
  ),
292
  $screen = get_current_screen();
293
  if ( array_key_exists( $screen->id, $tabs ) ) {
294
  $tab = $tabs[$screen->id];
295
+ $content = '<p><strong>' . __( 'Fore More Information', 'wpsc' ) . '</strong></p>';
296
  $links = array();
297
  foreach( $tab['links'] as $link => $link_title ) {
298
+ $link = 'http://docs.getshopped.org/' . $link;
299
  $links[] = '<a target="_blank" href="' . esc_url( $link ) . '">' . esc_html( $link_title ) . '</a>';
300
  }
301
  $content .= '<p>' . implode( '<br />', $links ) . '</p>';
302
 
303
+ if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
304
+ add_contextual_help( $screen->id, $content );
305
+ } else {
306
+ $screen->add_help_tab( array(
307
+ 'id' => $screen->id . '_help',
308
+ 'title' => $tab['title'],
309
+ 'content' => $content,
310
+ ) );
311
+ }
312
  }
313
  }
314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  function wpsc_admin_include_purchase_logs_css_and_js() {
 
 
 
316
  wp_enqueue_script( 'wp-e-commerce-purchase-logs', WPSC_URL . '/wpsc-admin/js/purchase-logs.js', array( 'jquery' ), WPSC_VERSION . '.' . WPSC_MINOR_VERSION );
317
  wp_localize_script( 'wp-e-commerce-purchase-logs', 'WPSC_Purchase_Logs_Admin', array(
318
+ 'nonce' => wp_create_nonce( 'wpsc_purchase_logs' ),
319
+ 'status_error_dialog' => __( "An unknown error occurred. The order's status might not have been updated properly.\n\nPlease refresh this page and try again.", 'wpsc' ),
320
+ 'tracking_error_dialog' => __( "An unknown error occurred. The order's tracking ID might not have been updated properly.\n\nPlease refresh this page and try again.", 'wpsc' ),
321
+ 'send_tracking_email_error_dialog' => __( "An unknown error occurred. The tracking email might not have been sent.\n\nPlease refresh this page and try again.", 'wpsc' ),
322
+ 'sending_message' => _x( 'sending...', 'sending tracking email for purchase log', 'wpsc' ),
323
+ 'sent_message' => _x( 'Email Sent!', 'sending tracking email for purchase log', 'wpsc' ),
324
+ 'current_view' => empty( $_REQUEST['status'] ) ? 'all' : $_REQUEST['status'],
 
 
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='" . get_option( 'siteurl' ) . "/wp-admin/index.php?rss=true&amp;rss_key=key&amp;action=purchase_log&amp;type=rss' title='WP e-Commerce Purchase Log RSS' 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-js-dimensions', WPSC_URL . '/wpsc-admin/js/dimensions.js', false, $version_identifier );
370
  wp_enqueue_script( 'wp-e-commerce-admin-settings-page', WPSC_URL . '/wpsc-admin/js/settings-page.js', array( 'jquery-query' ), $version_identifier );
371
 
372
  wp_localize_script( 'wp-e-commerce-admin-settings-page', 'WPSC_Settings_Page', array(
373
+ 'nonce' => wp_create_nonce( 'wpsc_settings_page_nonce' ),
374
+ 'current_tab' => WPSC_Settings_Page::get_instance()->get_current_tab_id(),
375
+ 'before_unload_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wpsc' ),
376
+ 'ajax_navigate_confirm_dialog' => __( 'The changes you made will be lost if you navigate away from this page.', 'wpsc' ) . "\n\n" . __( 'Click OK to discard your changes, or Cancel to remain on this page.' ),
377
+ 'checkout_field_sort_error_dialog' => __( "An error occurred when saving your field order preference.\n\nPlease refresh the page and try again.", 'wpsc' ),
378
+ 'edit_field_options' => __( 'Edit Options', 'wpsc' ),
379
+ 'hide_edit_field_options' => __( 'Hide Options', 'wpsc' ),
 
 
 
 
 
380
  ) );
381
 
382
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
383
  wp_enqueue_style( 'wp-e-commerce-ui-tabs', WPSC_URL . '/wpsc-admin/css/jquery.ui.tabs.css', false, $version_identifier, 'all' );
384
  }
385
 
 
 
 
 
 
 
386
  function wpsc_meta_boxes() {
387
  global $post;
388
  $pagename = 'wpsc-product';
390
 
391
  //if a variation page do not show these metaboxes
392
  if ( is_object( $post ) && $post->post_parent == 0 ) {
393
+ add_meta_box( 'wpsc_product_variation_forms', __('Variations', 'wpsc'), 'wpsc_product_variation_forms', $pagename, 'normal', 'high' );
394
+ add_meta_box( 'wpsc_product_external_link_forms', __('Off Site Product link', 'wpsc'), 'wpsc_product_external_link_forms', $pagename, 'normal', 'high' );
395
  } else if( is_object( $post ) && $post->post_status == "inherit" ) {
396
+ remove_meta_box( 'tagsdiv-product_tag', 'wpsc-product', 'core' );
397
+ remove_meta_box( 'wpsc_product_external_link_forms', 'wpsc-product', 'core' );
398
+ remove_meta_box( 'wpsc_product_categorydiv', 'wpsc-product', 'core' );
399
  }
400
 
401
+ add_meta_box( 'wpsc_price_control_forms', __('Price Control', 'wpsc'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
402
+ add_meta_box( 'wpsc_stock_control_forms', __('Stock Control', 'wpsc'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
403
  add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wpsc'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
404
+ add_meta_box( 'wpsc_additional_desc', __('Additional Description', 'wpsc'), 'wpsc_additional_desc', $pagename, 'normal', 'high' );
405
+ add_meta_box( 'wpsc_product_download_forms', __('Product Download', 'wpsc'), 'wpsc_product_download_forms', $pagename, 'normal', 'high' );
406
+ add_meta_box( 'wpsc_product_image_forms', __('Product Images', 'wpsc'), 'wpsc_product_image_forms', $pagename, 'normal', 'high' );
407
+ add_meta_box( 'wpsc_product_shipping_forms', __('Shipping', 'wpsc'), 'wpsc_product_shipping_forms', $pagename, 'normal', 'high' );
408
+ add_meta_box( 'wpsc_product_advanced_forms', __('Advanced Settings', 'wpsc'), 'wpsc_product_advanced_forms', $pagename, 'normal', 'high' );
409
+
410
  }
411
 
412
  add_action( 'admin_footer', 'wpsc_meta_boxes' );
413
  add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
 
 
 
 
 
 
 
 
 
 
 
 
 
414
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
415
+ global $post_type, $current_screen;
416
 
417
+ if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) )
418
+ wp_admin_css( 'dashboard' );
419
 
420
+ if($current_screen->id == 'dashboard_page_wpsc-sales-logs'){
421
  // jQuery
422
  wp_enqueue_script( 'jquery' );
423
  wp_enqueue_script( 'jquery-ui-draggable' );
433
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
434
  $pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
435
 
436
+ 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' ) {
 
 
 
437
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
438
+ wp_enqueue_script( 'wp-e-commerce-admin-parameters', admin_url( 'admin.php?wpsc_admin_dynamic_js=true' ), false, $version_identifier );
439
  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 );
440
+ wp_enqueue_script( 'wp-e-commerce-legacy-ajax', WPSC_URL . '/wpsc-admin/js/ajax.js', false, $version_identifier ); // needs removing
441
+
442
  wp_enqueue_script( 'wpsc-sortable-table', WPSC_URL . '/wpsc-admin/js/sortable-table.js', array( 'jquery' ) );
443
 
444
+ if ( in_array( $current_screen->id, array( 'edit-wpsc-variation', 'wpsc-product' ) ) ) {
445
  wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery', 'wpsc-sortable-table' ), $version_identifier );
 
 
 
 
 
 
 
446
  }
447
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
448
+ wp_enqueue_style( 'wp-e-commerce-admin-dynamic', admin_url( "admin.php?wpsc_admin_dynamic_css=true" ), false, $version_identifier, 'all' );
449
+ // Localize scripts
450
+ wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
451
+ 'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
452
+ 'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  ) );
454
+ }
455
+ if ( 'dashboard_page_wpsc-upgrades' == $pagehook || 'dashboard_page_wpsc-update' == $pagehook )
456
+ wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
457
+ }
458
 
459
+ function wpsc_admin_dynamic_js() {
460
+ header( 'Content-Type: text/javascript' );
461
+ header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
462
+ header( 'Cache-Control: public, must-revalidate, max-age=86400' );
463
+ header( 'Pragma: public' );
464
 
465
+ $siteurl = get_option( 'siteurl' );
466
+ $hidden_boxes = get_option( 'wpsc_hidden_box' );
 
 
 
 
 
 
 
 
467
 
468
+ $form_types1 = get_option( 'wpsc_checkout_form_fields' );
469
+ $unique_names1 = get_option( 'wpsc_checkout_unique_names' );
470
 
471
+ $form_types = '';
472
+ foreach ( (array)$form_types1 as $form_type ) {
473
+ $form_types .= "<option value='" . $form_type . "'>" . $form_type . "</option>";
474
+ }
475
 
476
+ $unique_names = "<option value='-1'>" . __('Select a Unique Name', 'wpsc') . "</option>";
477
+ foreach ( (array)$unique_names1 as $unique_name ) {
478
+ $unique_names.= "<option value='" . $unique_name . "'>" . $unique_name . "</option>";
 
 
 
 
 
 
 
479
  }
480
 
481
+ $hidden_boxes = implode( ',', (array)$hidden_boxes );
482
+ echo "var base_url = '" . esc_js( $siteurl ) . "';\n\r";
483
+ echo "var WPSC_URL = '" . esc_js( WPSC_URL ) . "';\n\r";
484
+ echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
485
+ echo "var WPSC_DIR_NAME = '" . esc_js( WPSC_DIR_NAME ) . "';\n\r";
486
+ echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
487
 
488
+ // LightBox Configuration start
489
+ echo "var fileLoadingImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/loading.gif';\n\r";
490
+ echo "var fileBottomNavCloseImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/closelabel.gif';\n\r";
491
+ echo "var fileThickboxLoadingImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/loadingAnimation.gif';\n\r";
492
 
493
+ echo "var resizeSpeed = 9;\n\r";
 
 
 
 
 
 
 
 
494
 
495
+ echo "var borderSize = 10;\n\r";
 
496
 
497
+ echo "var hidden_boxes = '" . esc_js( $hidden_boxes ) . "';\n\r";
498
+ echo "var IS_WP27 = '" . esc_js( IS_WP27 ) . "';\n\r";
499
+ echo "var TXT_WPSC_DELETE = '" . esc_js( __( 'Delete', 'wpsc' ) ) . "';\n\r";
500
+ echo "var TXT_WPSC_TEXT = '" . esc_js( __( 'Text', 'wpsc' ) ) . "';\n\r";
501
+ echo "var TXT_WPSC_EMAIL = '" . esc_js( __( 'Email', 'wpsc' ) ) . "';\n\r";
502
+ echo "var TXT_WPSC_COUNTRY = '" . esc_js( __( 'Country', 'wpsc' ) ) . "';\n\r";
503
+ echo "var TXT_WPSC_TEXTAREA = '" . esc_js( __( 'Textarea', 'wpsc' ) ) . "';\n\r";
504
+ echo "var TXT_WPSC_HEADING = '" . esc_js( __( 'Heading', 'wpsc' ) ) . "';\n\r";
505
+ echo "var TXT_WPSC_COUPON = '" . esc_js( __( 'Coupon', 'wpsc' ) ) . "';\n\r";
506
 
507
+ echo "var HTML_FORM_FIELD_TYPES =\" " . esc_js( $form_types ) . "; \" \n\r";
508
+ echo "var HTML_FORM_FIELD_UNIQUE_NAMES = \" " . esc_js( $unique_names ) . "; \" \n\r";
 
 
509
 
510
+ echo "var TXT_WPSC_LABEL = '" . esc_js( __( 'Label', 'wpsc' ) ) . "';\n\r";
511
+ echo "var TXT_WPSC_LABEL_DESC = '" . esc_js( __( 'Label Description', 'wpsc' ) ) . "';\n\r";
512
+ echo "var TXT_WPSC_ITEM_NUMBER = '" . esc_js( __( 'Item Number', 'wpsc' ) ) . "';\n\r";
513
+ echo "var TXT_WPSC_LIFE_NUMBER = '" . esc_js( __( 'Life Number', 'wpsc' ) ) . "';\n\r";
514
+ echo "var TXT_WPSC_PRODUCT_CODE = '" . esc_js( __( 'Product Code', 'wpsc' ) ) . "';\n\r";
515
+ echo "var TXT_WPSC_PDF = '" . esc_js( __( 'PDF', 'wpsc' ) ) . "';\n\r";
516
 
517
+ echo "var TXT_WPSC_AND_ABOVE = '" . esc_js( __( ' and above', 'wpsc' ) ) . "';\n\r";
518
+ echo "var TXT_WPSC_IF_PRICE_IS = '" . esc_js( __( 'If price is ', 'wpsc' ) ) . "';\n\r";
519
+ echo "var TXT_WPSC_IF_WEIGHT_IS = '" . esc_js( __( 'If weight is ', 'wpsc' ) ) . "';\n\r";
 
520
 
521
+ exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  }
523
 
524
+ if ( isset( $_GET['wpsc_admin_dynamic_js'] ) && ( $_GET['wpsc_admin_dynamic_js'] == 'true' ) ) {
525
+ add_action( "admin_init", 'wpsc_admin_dynamic_js' );
526
+ }
527
+
528
+ function wpsc_admin_dynamic_css() {
529
+ header( 'Content-Type: text/css' );
530
+ header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
531
+ header( 'Cache-Control: public, must-revalidate, max-age=86400' );
532
+ header( 'Pragma: public' );
533
+ $flash = 0;
534
+ $flash = apply_filters( 'flash_uploader', $flash );
535
+
536
+ if ( $flash = 1 ) {
537
+ ?>
538
+ div.flash-image-uploader {
539
+ display: block;
540
+ }
541
+
542
+ div.browser-image-uploader {
543
+ display: none;
544
+ }
545
+ <?php
546
+ } else {
547
+ ?>
548
+ div.flash-image-uploader {
549
+ display: none;
550
+ }
551
+
552
+ div.browser-image-uploader {
553
+ display: block;
554
+ }
555
+ <?php
556
  }
557
+ exit();
558
+ }
559
+
560
+ if ( isset( $_GET['wpsc_admin_dynamic_css'] ) && ( $_GET['wpsc_admin_dynamic_css'] == 'true' ) ) {
561
+ add_action( "admin_init", 'wpsc_admin_dynamic_css' );
562
  }
563
 
564
  add_action( 'admin_menu', 'wpsc_admin_pages' );
565
 
566
+
 
 
 
 
 
 
 
 
 
 
567
  function wpsc_admin_latest_activity() {
568
  global $wpdb;
569
  $totalOrders = $wpdb->get_var( "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "`" );
572
  * This is the right hand side for the past 30 days revenue on the wp dashboard
573
  */
574
  echo "<div id='leftDashboard'>";
575
+ echo "<strong class='dashboardHeading'>" . __( 'Current Month', 'wpsc' ) . "</strong><br />";
576
  echo "<p class='dashboardWidgetSpecial'>";
577
  // calculates total amount of orders for the month
578
  $year = date( "Y" );
585
  //calculates amount of money made for the month
586
  $currentMonthsSales = wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) );
587
  echo $currentMonthsSales;
588
+ echo "<span class='dashboardWidget'>" . _x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
589
  echo "</p>";
590
  echo "<p class='dashboardWidgetSpecial'>";
591
  echo "<span class='pricedisplay'>";
600
  echo wpsc_currency_display( $monthsAverage );
601
  }
602
  //echo "</span>";
603
+ echo "<span class='dashboardWidget'>" . __( 'Avg Order', 'wpsc' ) . "</span>";
604
  echo "</p>";
605
  echo "</div>";
606
  /*
608
  */
609
 
610
  echo "<div id='rightDashboard' >";
611
+ echo "<strong class='dashboardHeading'>" . __( 'Total Income', 'wpsc' ) . "</strong><br />";
612
 
613
  echo "<p class='dashboardWidgetSpecial'>";
614
  echo wpsc_currency_display( admin_display_total_price() );
615
+ echo "<span class='dashboardWidget'>" . _x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
616
  echo "</p>";
617
  echo "<p class='dashboardWidgetSpecial'>";
618
  echo "<span class='pricedisplay'>";
629
  }
630
  echo wpsc_currency_display( $totalAverage );
631
  //echo "</span>";
632
+ echo "<span class='dashboardWidget'>" . __( 'Avg Order', 'wpsc' ) . "</span>";
633
  echo "</p>";
634
  echo "</div>";
635
  echo "<div style='clear:both'></div>";
636
  }
637
+
638
  add_action( 'wpsc_admin_pre_activity', 'wpsc_admin_latest_activity' );
639
 
640
+
641
  /*
642
  * Dashboard Widget Setup
643
  * Adds the dashboard widgets if the user is an admin
 
644
  * Since 3.6
 
 
 
 
 
645
  */
646
+
647
  function wpsc_dashboard_widget_setup() {
648
+ if ( is_admin() && current_user_can( 'manage_options' ) ) {
649
+ $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
650
+ // Enqueue the styles and scripts necessary
651
+ wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
652
+ wp_enqueue_script( 'datepicker-ui', WPSC_URL . "/wpsc-core/js/ui.datepicker.js", array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier );
653
+ // Add the dashboard widgets
654
+ wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'Getshopped News' , 'wpsc' ), 'wpsc_dashboard_news' );
 
 
 
 
 
 
 
655
  wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
 
656
  wp_add_dashboard_widget( 'wpsc_quarterly_dashboard_widget', __( 'Sales by Quarter', 'wpsc' ), 'wpsc_quarterly_dashboard_widget' );
 
657
  wp_add_dashboard_widget( 'wpsc_dashboard_4months_widget', __( 'Sales by Month', 'wpsc' ), 'wpsc_dashboard_4months_widget' );
658
 
659
+ // Sort the Dashboard widgets so ours it at the top
660
+ global $wp_meta_boxes;
661
+ $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
662
+ // Backup and delete our new dashbaord widget from the end of the array
663
+ $wpsc_widget_backup = array( 'wpsc_dashboard_news' => $normal_dashboard['wpsc_dashboard_news'] );
664
+ $wpsc_widget_backup += array( 'wpsc_dashboard_widget' => $normal_dashboard['wpsc_dashboard_widget'] );
665
+ $wpsc_widget_backup += array( 'wpsc_quarterly_dashboard_widget' => $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
666
+ $wpsc_widget_backup += array( 'wpsc_dashboard_4months_widget' => $normal_dashboard['wpsc_dashboard_4months_widget'] );
667
 
 
 
 
 
 
 
668
  unset( $normal_dashboard['wpsc_dashboard_news'] );
 
 
 
669
  unset( $normal_dashboard['wpsc_dashboard_widget'] );
 
 
 
670
  unset( $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
 
 
 
671
  unset( $normal_dashboard['wpsc_dashboard_4months_widget'] );
 
672
 
673
+ // Merge the two arrays together so our widget is at the beginning
674
+
675
+ $sorted_dashboard = array_merge( $wpsc_widget_backup, $normal_dashboard );
676
 
677
+ // Save the sorted array back into the original metaboxes
678
 
679
+ $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
680
+ }
681
  }
682
 
683
  /*
686
 
687
  add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
688
 
 
 
 
 
 
 
689
  function wpsc_dashboard_news() {
690
+ $rss = fetch_feed( 'http://getshopped.org/category/wp-e-commerce-plugin/' );
691
+ $args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items'=>3 );
692
  wp_widget_rss_output( $rss, $args );
693
 
694
  }
695
 
 
 
 
 
 
 
 
 
696
  function wpsc_get_quarterly_summary() {
697
+ (int)$firstquarter = get_option( 'wpsc_first_quart' );
698
+ (int)$secondquarter = get_option( 'wpsc_second_quart' );
699
+ (int)$thirdquarter = get_option( 'wpsc_third_quart' );
700
+ (int)$fourthquarter = get_option( 'wpsc_fourth_quart' );
701
+ (int)$finalquarter = get_option( 'wpsc_final_quart' );
702
 
703
  $results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
704
  $results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
707
  return $results;
708
  }
709
 
 
 
 
 
 
 
710
  function wpsc_quarterly_dashboard_widget() {
711
  if ( get_option( 'wpsc_business_year_start' ) == false ) {
712
  ?>
713
  <form action='' method='post'>
714
+ <label for='date_start'><?php _e( 'Financial Year End' , 'wpsc' ); ?>: </label>
715
  <input id='date_start' type='text' class='pickdate' size='11' value='<?php echo get_option( 'wpsc_last_date' ); ?>' name='add_start' />
716
  <!--<select name='add_start[day]'>
717
  <?php
768
  ?>
769
  <div id='box'>
770
  <p class='atglance'>
771
+ <span class='wpsc_quart_left'><?php _e( 'At a Glance' , 'wpsc' ); ?></span>
772
+ <span class='wpsc_quart_right'><?php _e( 'Revenue' , 'wpsc' ); ?></span>
773
  </p>
774
  <div style='clear:both'></div>
775
  <p class='quarterly'>
792
  }
793
  }
794
 
795
+
 
 
 
 
 
796
  function wpsc_dashboard_widget() {
797
+ if ( current_user_can( 'manage_options' ) ) {
798
+ do_action( 'wpsc_admin_pre_activity' );
799
+ do_action( 'wpsc_admin_post_activity' );
800
+ }
801
  }
802
 
803
  /*
807
 
808
  /*
809
  * Dashboard Widget Last Four Month Sales.
 
 
 
 
 
810
  */
811
+
812
  function wpsc_dashboard_4months_widget() {
813
  global $wpdb;
814
 
838
  $timeranges[2]["start"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
839
  $timeranges[2]["end"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
840
  $timeranges[3]["start"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
841
+ $timeranges[3]["end"] = mktime();
842
 
843
  $prod_data = array( );
844
  foreach ( (array)$products as $product ) { //run through products and get each product income amounts and name
865
  $tablerow = 1;
866
  ob_start();
867
  ?>
868
+ <div style="padding-bottom:15px; "><?php _e('Last four months of sales on a per product basis:', 'wpsc'); ?></div>
869
  <table style="width:100%" border="0" cellspacing="0">
870
  <tr style="font-style:italic; color:#666;" height="20">
871
+ <td colspan="2" style=" font-family:\'Times New Roman\', Times, serif; font-size:15px; border-bottom:solid 1px #000;"><?php _e('At a Glance', 'wpsc'); ?></td>
872
  <?php foreach ( $months as $mnth ): ?>
873
  <td align="center" style=" font-family:\'Times New Roman\'; font-size:15px; border-bottom:solid 1px #000;"><?php echo date( "M", $mnth ); ?></td>
874
  <?php endforeach; ?>
892
 
893
  //Modification to allow for multiple column layout
894
 
 
 
 
 
 
 
895
  function wpec_two_columns( $columns, $screen ) {
896
  if ( $screen == 'toplevel_page_wpsc-edit-products' )
897
  $columns['toplevel_page_wpsc-edit-products'] = 2;
900
  }
901
  add_filter( 'screen_layout_columns', 'wpec_two_columns', 10, 2 );
902
 
 
 
 
 
 
903
  function wpsc_fav_action( $actions ) {
904
  $actions['post-new.php?post_type=wpsc-product'] = array( 'New Product', 'manage_options' );
905
  return $actions;
906
  }
907
  add_filter( 'favorite_actions', 'wpsc_fav_action' );
908
 
909
+ function wpsc_print_admin_scripts() {
910
+ $scheme = is_ssl() ? 'https' : 'http';
911
+ wp_enqueue_script( 'wp-e-commerce-dynamic', home_url( "/index.php?wpsc_user_dynamic_js=true", $scheme ) );
912
+ }
913
+
914
  /**
915
+ * wpsc_update_permalinks update the product pages permalinks when WordPress permalinks are changed
916
+ *
917
+ * @public
918
  *
919
+ * @3.8
920
+ * @returns nothing
921
  */
922
+ function wpsc_update_permalinks( $return = '' ) {
923
+ wpsc_update_page_urls( true );
924
+ return $return;
 
925
  }
926
 
927
  /**
928
  * wpsc_ajax_ie_save save changes made using inline edit
929
  *
930
+ * @public
 
 
 
 
 
 
 
 
 
 
 
 
931
  *
932
+ * @3.8
933
  * @returns nothing
934
  */
935
  function wpsc_ajax_ie_save() {
944
  $id = absint( $_POST['id'] );
945
  $post = get_post( $_POST['id'] );
946
  $parent = get_post( $post->post_parent );
947
+ $terms = wp_get_object_terms( $id, 'wpsc-variation', array( 'fields' => 'names' ) );
948
 
949
  $product = array(
950
  'ID' => $_POST['id'],
986
  die();
987
  }
988
 
 
 
 
 
 
989
  function wpsc_add_meta_boxes(){
990
+ add_meta_box( 'dashboard_right_now', __('Current Month', 'wpsc'), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
991
  }
992
 
993
+ function wpsc_check_permalink_notice(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
994
 
995
+ ?>
996
+ <div id="notice" class="error fade"><p>
997
+ <?php printf( __( 'Due to a problem in WordPress Permalinks and Custom Post Types, WP e-Commerce encourages you to refresh your permalinks a second time. (for a more geeky explanation visit <a href="%s">trac</a>)' , 'wpsc' ), 'http://core.trac.wordpress.org/ticket/16736' ); ?>
998
+ </p></div>
999
+ <?php
 
 
 
 
 
 
 
 
1000
 
 
 
 
 
 
 
 
1001
  }
1002
 
1003
+ add_action( 'permalink_structure_changed' , 'wpsc_check_permalink_notice' );
1004
+ add_action( 'permalink_structure_changed' , 'wpsc_update_permalinks' );
1005
+ /* add_action( 'get_sample_permalink_html' , 'wpsc_update_permalinks' ); // this just seems unnecessary and produces PHP notices */
1006
+ add_action( 'wp_ajax_category_sort_order', 'wpsc_ajax_set_category_order' );
1007
  add_action( 'wp_ajax_variation_sort_order', 'wpsc_ajax_set_variation_order' );
1008
+ add_action( 'wp_ajax_wpsc_ie_save', 'wpsc_ajax_ie_save' );
1009
+ add_action('in_admin_header', 'wpsc_add_meta_boxes');
1010
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/ajax-and-init.php CHANGED
@@ -7,22 +7,485 @@
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 +516,25 @@ 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' ) {
@@ -69,8 +551,17 @@ function wpsc_admin_ajax() {
69
  wpsc_member_activate_subscriptions( $_POST['id'] );
70
  }
71
 
72
- wpsc_update_purchase_log_status( $_POST['id'], $newvalue );
73
-
 
 
 
 
 
 
 
 
 
74
  if ( ($newvalue > $log_data['processed']) && ($log_data['processed'] < 2) ) {
75
  transaction_results( $log_data['sessionid'], false );
76
  }
@@ -91,21 +582,371 @@ function wpsc_admin_ajax() {
91
  }
92
  }
93
 
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;
110
  if ( $currency_data[0]['symbol'] != '' ) {
111
  $currency_sign = $currency_data[0]['symbol_html'];
@@ -118,16 +959,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'] );
@@ -161,20 +993,55 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action']
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 +1069,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 +1083,7 @@ function wpsc_clean_categories() {
214
  '%s',
215
  '%d'
216
  );
 
217
  }
218
  }
219
  $wp_rewrite->flush_rules();
@@ -226,11 +1096,611 @@ 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
  }
233
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clean_categories') )
234
  add_action( 'admin_init', 'wpsc_clean_categories' );
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  *
8
  * @package wp-e-commerce
9
  * @since 3.7
10
+ */
11
+
12
+ /**
13
+ * Add new variation set via AJAX.
14
  *
15
+ * If the variation set name is the same as an existing variation set,
16
+ * the children variant terms will be added inside that existing set.
17
+ * @since 3.8.8
 
 
 
 
 
18
  */
19
+ function wpsc_add_variation_set() {
20
+ $new_variation_set = $_POST['variation_set'];
21
+ $variants = preg_split( '/\s*,\s*/', $_POST['variants'] );
22
 
23
+ $parent_term_exists = term_exists( $new_variation_set, 'wpsc-variation' );
24
+
25
+ // only use an existing parent ID if the term is not a child term
26
+ if ( $parent_term_exists ) {
27
+ $parent_term = get_term( $parent_term_exists['term_id'], 'wpsc-variation' );
28
+ if ( $parent_term->parent == '0' )
29
+ $variation_set_id = $parent_term_exists['term_id'];
30
+ }
31
+
32
+ if ( empty( $variation_set_id ) ) {
33
+ $results = wp_insert_term( $new_variation_set, 'wpsc-variation' );
34
+ if ( is_wp_error( $results ) )
35
+ die('-1');
36
+ $variation_set_id = $results['term_id'];
37
+ }
38
+
39
+ $inserted_variants = array();
40
+
41
+ if ( ! empty( $variation_set_id ) ) {
42
+ foreach ( $variants as $variant ) {
43
+ $results = wp_insert_term( $variant, 'wpsc-variation', array( 'parent' => $variation_set_id ) );
44
+
45
+ if ( is_wp_error( $results ) )
46
+ die('-1');
47
+
48
+ $inserted_variants[] = $results['term_id'];
49
+ }
50
+
51
+ require_once( 'includes/walker-variation-checklist.php' );
52
+
53
+ /* --- DIRTY HACK START --- */
54
+ /*
55
+ There's a bug with term cache in WordPress core. See http://core.trac.wordpress.org/ticket/14485.
56
+ The next 3 lines will delete children term cache for wpsc-variation.
57
+ Without this hack, the new child variations won't be displayed on "Variations" page and
58
+ also won't be displayed in wp_terms_checklist() call below.
59
+ */
60
+ clean_term_cache( $variation_set_id, 'wpsc-variation' );
61
+ delete_option('wpsc-variation_children');
62
+ wp_cache_set( 'last_changed', 1, 'terms' );
63
+ _get_term_hierarchy('wpsc-variation');
64
+ /* --- DIRTY HACK END --- */
65
+
66
+ wp_terms_checklist( (int) $_POST['post_id'], array(
67
+ 'taxonomy' => 'wpsc-variation',
68
+ 'descendants_and_self' => $variation_set_id,
69
+ 'walker' => new WPSC_Walker_Variation_Checklist( $inserted_variants ),
70
+ 'checked_ontop' => false,
71
+ ) );
72
+ }
73
+ exit();
74
+ }
75
+
76
+ add_action( 'wp_ajax_wpsc_add_variation_set', 'wpsc_add_variation_set' );
77
+
78
+ function wpsc_payment_gateway_settings_form() {
79
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_settings_page_nonce' ) )
80
+ die( 'Session expired. Try refreshing your settings page.' );
81
+
82
+ require_once( 'settings-page.php' );
83
+ require_once( 'includes/settings-tabs/gateway.php' );
84
+
85
+ $tab = new WPSC_Settings_Tab_Gateway();
86
+ $tab->display_payment_gateway_settings_form();
87
+ exit;
88
+ }
89
+
90
+ add_action( 'wp_ajax_wpsc_payment_gateway_settings_form', 'wpsc_payment_gateway_settings_form' );
91
+
92
+ function wpsc_shipping_module_settings_form() {
93
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_settings_page_nonce' ) )
94
+ die( 'Session expired. Try refreshing your settings page.' );
95
+
96
+ require_once( 'settings-page.php' );
97
+ require_once( 'includes/settings-tabs/shipping.php' );
98
+
99
+ $tab = new WPSC_Settings_Tab_Shipping();
100
+ $tab->display_shipping_module_settings_form();
101
+ exit;
102
+ }
103
+
104
+ add_action( 'wp_ajax_wpsc_shipping_module_settings_form', 'wpsc_shipping_module_settings_form' );
105
+
106
+ function wpsc_navigate_settings_tab() {
107
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_settings_page_nonce' ) )
108
+ die( 'Session expired. Try refreshing your settings page.' );
109
+
110
+ require_once( 'settings-page.php' );
111
+
112
+ $settings_page = new WPSC_Settings_Page( $_POST['tab'] );
113
+ $settings_page->display_current_tab();
114
+ exit;
115
+ }
116
+
117
+ add_action( 'wp_ajax_wpsc_navigate_settings_tab', 'wpsc_navigate_settings_tab' );
118
+
119
+ function wpsc_display_region_list() {
120
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_settings_page_nonce' ) )
121
+ die( 'Session expired. Try refreshing your settings page.' );
122
+
123
+ require_once( 'settings-page.php' );
124
+ require_once( 'includes/settings-tabs/general.php' );
125
+
126
+ $tab = new WPSC_Settings_Tab_General();
127
+ $tab->display_region_drop_down();
128
+ exit;
129
+ }
130
+
131
+ add_action( 'wp_ajax_wpsc_display_region_list', 'wpsc_display_region_list' );
132
+
133
+ function wpsc_purchase_log_save_tracking_id() {
134
+ global $wpdb;
135
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_purchase_logs' ) )
136
+ die( 'Session expired. Try refreshing your Sales Log page.' );
137
+
138
+
139
+ $wpdb->update(
140
+ WPSC_TABLE_PURCHASE_LOGS,
141
+ array(
142
+ 'track_id' => $_POST['value']
143
+ ),
144
+ array(
145
+ 'id' => $_POST['log_id']
146
+ ),
147
+ '%s',
148
+ '%d'
149
+ );
150
+
151
+ die('success');
152
+ }
153
+
154
+ add_action( 'wp_ajax_wpsc_purchase_log_save_tracking_id', 'wpsc_purchase_log_save_tracking_id' );
155
+
156
+ function wpsc_purchase_log_send_tracking_email() {
157
+ global $wpdb;
158
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_purchase_logs' ) )
159
+ die( 'Session expired. Try refreshing your Sales Log page.' );
160
+
161
+ $id = absint( $_POST['log_id'] );
162
+ $sql = $wpdb->prepare( "SELECT `track_id` FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE `id`=%d LIMIT 1", $id );
163
+ $trackingid = $wpdb->get_var( $sql );
164
+
165
+ $message = get_option( 'wpsc_trackingid_message' );
166
+ $message = str_replace( '%trackid%', $trackingid, $message );
167
+ $message = str_replace( '%shop_name%', get_option( 'blogname' ), $message );
168
+
169
+ $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" );
170
+ $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 ) );
171
+
172
+ $subject = get_option( 'wpsc_trackingid_subject' );
173
+ $subject = str_replace( '%shop_name%', get_option( 'blogname' ), $subject );
174
+
175
+ add_filter( 'wp_mail_from', 'wpsc_replace_reply_address', 0 );
176
+ add_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name', 0 );
177
+
178
+ wp_mail( $email, $subject, $message);
179
+ die( 'success' );
180
+ }
181
+
182
+ add_action( 'wp_ajax_wpsc_purchase_log_send_tracking_email', 'wpsc_purchase_log_send_tracking_email' );
183
+
184
+ function wpsc_ajax_sales_quarterly() {
185
+ $lastdate = $_POST['add_start'];
186
+ $date = preg_split( '/-/', $lastdate );
187
+ if ( !isset( $date[0] ) )
188
+ $date[0] = 0;
189
+ if ( !isset( $date[1] ) )
190
+ $date[1] = 0;
191
+ if ( !isset( $date[2] ) )
192
+ $date[2] = 0;
193
+ $lastquart = mktime( 0, 0, 0, $date[1], $date[2], $date[0] );
194
+ if ( $lastquart != get_option( 'wpsc_last_quarter' ) ) {
195
+ update_option( 'wpsc_last_date', $lastdate );
196
+ update_option( 'wpsc_fourth_quart', $lastquart );
197
+ $thirdquart = mktime( 0, 0, 0, $date[1] - 3, $date[2], $date[0] );
198
+ update_option( 'wpsc_third_quart', $thirdquart );
199
+ $secondquart = mktime( 0, 0, 0, $date[1] - 6, $date[2], $date[0] );
200
+ update_option( 'wpsc_second_quart', $secondquart );
201
+ $firstquart = mktime( 0, 0, 0, $date[1] - 9, $date[2], $date[0] );
202
+ update_option( 'wpsc_first_quart', $firstquart );
203
+ $finalquart = mktime( 0, 0, 0, $date[1], $date[2], $date[0] - 1 );
204
+ update_option( 'wpsc_final_quart', $finalquart );
205
+ }
206
+ }
207
+
208
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'wpsc_quarterly') ) {
209
+ add_action( 'admin_init', 'wpsc_ajax_sales_quarterly' );
210
+ }
211
+
212
+
213
+ function wpsc_delete_file() {
214
+ global $wpdb;
215
+ $output = 0;
216
+ $row_number = absint( $_REQUEST['row_number'] );
217
+ $product_id = absint( $_REQUEST['product_id'] );
218
+ $file_name = basename( $_REQUEST['file_name'] );
219
+ check_admin_referer( 'delete_file_' . $file_name );
220
+
221
+ $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_parent = %d AND post_type ='wpsc-product-file'", $file_name, $product_id );
222
+ $product_id_to_delete = $wpdb->get_var( $sql );
223
+
224
+ wp_delete_post( $product_id_to_delete, true );
225
+
226
+ if ( $_POST['ajax'] !== 'true' ) {
227
+ $sendback = wp_get_referer();
228
+ wp_redirect( $sendback );
229
+ exit;
230
+ }
231
+
232
+ echo "jQuery('#select_product_file_row_$row_number').fadeOut('fast',function() {\n";
233
+ echo " jQuery(this).remove();\n";
234
+ echo " jQuery('div.select_product_file p:even').removeClass('alt');\n";
235
+ echo " jQuery('div.select_product_file p:odd').addClass('alt');\n";
236
+ echo "});\n";
237
+
238
+ exit( "" );
239
+ }
240
+
241
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'delete_file') ) {
242
+ add_action( 'admin_init', 'wpsc_delete_file' );
243
+ }
244
+
245
+ /**
246
+ Function and action for publishing or unpublishing single products
247
+ */
248
+ function wpsc_ajax_toggle_published() {
249
+ $product_id = absint( $_GET['product'] );
250
+ check_admin_referer( 'toggle_publish_' . $product_id );
251
+
252
+ $status = (wpsc_toggle_publish_status( $product_id )) ? ('true') : ('false');
253
+ $sendback = add_query_arg( 'flipped', "1", wp_get_referer() );
254
+ wp_redirect( $sendback );
255
+ exit();
256
+ }
257
+
258
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'toggle_publish') ) {
259
+ add_action( 'admin_init', 'wpsc_ajax_toggle_published' );
260
+ }
261
+
262
+ /**
263
+ * Function and action for duplicating products,
264
+ * Refactored for 3.8
265
+ * Purposely not duplicating stick post status (logically, products are most often duplicated because they share many attributes, where products are generally 'featured' uniquely.)
266
+ */
267
+ function wpsc_duplicate_product() {
268
+
269
+ // Get the original post
270
+ $id = absint( $_GET['product'] );
271
+ $post = get_post( $id );
272
+
273
+ // Copy the post and insert it
274
+ if ( isset( $post ) && $post != null ) {
275
+ $new_id = wpsc_duplicate_product_process( $post );
276
+
277
+ $duplicated = true;
278
+ $sendback = wp_get_referer();
279
+ $sendback = add_query_arg( 'duplicated', (int)$duplicated, $sendback );
280
+
281
+ wp_redirect( esc_url( $sendback ) );
282
+ exit();
283
+ } else {
284
+ wp_die( __( 'Sorry, for some reason, we couldn\'t duplicate this product because it could not be found in the database, check there for this ID: ', 'wpsc' ) . $id );
285
  }
286
+ }
287
+
288
+ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
289
+ $new_post_date = $post->post_date;
290
+ $new_post_date_gmt = get_gmt_from_date( $new_post_date );
291
 
292
+ $new_post_type = $post->post_type;
293
+ $post_content = str_replace( "'", "''", $post->post_content );
294
+ $post_content_filtered = str_replace( "'", "''", $post->post_content_filtered );
295
+ $post_excerpt = str_replace( "'", "''", $post->post_excerpt );
296
+ $post_title = str_replace( "'", "''", $post->post_title ) . " (Duplicate)";
297
+ $post_name = str_replace( "'", "''", $post->post_name );
298
+ $comment_status = str_replace( "'", "''", $post->comment_status );
299
+ $ping_status = str_replace( "'", "''", $post->ping_status );
300
+
301
+ $defaults = array(
302
+ 'post_status' => $post->post_status,
303
+ 'post_type' => $new_post_type,
304
+ 'ping_status' => $ping_status,
305
+ 'post_parent' => $new_parent_id ? $new_parent_id : $post->post_parent,
306
+ 'menu_order' => $post->menu_order,
307
+ 'to_ping' => $post->to_ping,
308
+ 'pinged' => $post->pinged,
309
+ 'post_excerpt' => $post_excerpt,
310
+ 'post_title' => $post_title,
311
+ 'post_content' => $post_content,
312
+ 'post_content_filtered' => $post_content_filtered,
313
+ 'import_id' => 0
314
+ );
315
+
316
+ // Insert the new template in the post table
317
+ $new_post_id = wp_insert_post($defaults);
318
+
319
+ // Copy the taxonomies
320
+ wpsc_duplicate_taxonomies( $post->ID, $new_post_id, $post->post_type );
321
+
322
+ // Copy the meta information
323
+ wpsc_duplicate_product_meta( $post->ID, $new_post_id );
324
+
325
+ // Finds children (Which includes product files AND product images), their meta values, and duplicates them.
326
+ wpsc_duplicate_children( $post->ID, $new_post_id );
327
+
328
+ return $new_post_id;
329
+ }
330
+
331
+ /**
332
+ * Copy the taxonomies of a post to another post
333
+ */
334
+ function wpsc_duplicate_taxonomies( $id, $new_id, $post_type ) {
335
+ $taxonomies = get_object_taxonomies( $post_type ); //array("category", "post_tag");
336
+ foreach ( $taxonomies as $taxonomy ) {
337
+ $post_terms = wp_get_object_terms( $id, $taxonomy );
338
+ for ( $i = 0; $i < count( $post_terms ); $i++ ) {
339
+ wp_set_object_terms( $new_id, $post_terms[$i]->slug, $taxonomy, true );
340
+ }
341
+ }
342
+ }
343
+
344
+ /**
345
+ * Copy the meta information of a post to another post
346
+ */
347
+ function wpsc_duplicate_product_meta( $id, $new_id ) {
348
+ global $wpdb;
349
+
350
+ $post_meta_infos = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $id ) );
351
+
352
+ if ( count( $post_meta_infos ) ) {
353
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
354
+ $values = array();
355
+ foreach ( $post_meta_infos as $meta_info ) {
356
+ $meta_key = $meta_info->meta_key;
357
+ $meta_value = addslashes( $meta_info->meta_value );
358
+
359
+ $sql_query_sel[] = "( $new_id, '$meta_key', '$meta_value' )";
360
+ $values[] = $new_id;
361
+ $values[] = $meta_key;
362
+ $values[] = $meta_value;
363
+ $values += array( $new_id, $meta_key, $meta_value );
364
+ }
365
+ $sql_query.= implode( ",", $sql_query_sel );
366
+ $sql_query = $wpdb->prepare( $sql_query, $values );
367
+ $wpdb->query( $sql_query );
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Duplicates children product and children meta
373
+ */
374
+ function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
375
+
376
+ //Get children products and duplicate them
377
+ $child_posts = get_posts( array(
378
+ 'post_parent' => $old_parent_id,
379
+ 'post_type' => 'any',
380
+ 'post_status' => 'any',
381
+ 'numberposts' => -1,
382
+ ) );
383
+
384
+ foreach ( $child_posts as $child_post )
385
+ wpsc_duplicate_product_process( $child_post, $new_parent_id );
386
+
387
+ }
388
+
389
+ function wpsc_purchase_log_csv() {
390
+ global $wpdb, $wpsc_gateways;
391
+ get_currentuserinfo();
392
+ $count = 0;
393
+ if ( 'key' == $_REQUEST['rss_key'] && current_user_can( 'manage_options' ) ) {
394
+ if ( isset( $_REQUEST['start_timestamp'] ) && isset( $_REQUEST['end_timestamp'] ) ) {
395
+ $start_timestamp = $_REQUEST['start_timestamp'];
396
+ $end_timestamp = $_REQUEST['end_timestamp'];
397
+ $start_end_sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` BETWEEN '%d' AND '%d' ORDER BY `date` DESC";
398
+ $start_end_sql = apply_filters( 'wpsc_purchase_log_start_end_csv', $start_end_sql );
399
+ $data = $wpdb->get_results( $wpdb->prepare( $start_end_sql, $start_timestamp, $end_timestamp ), ARRAY_A );
400
+ $csv_name = 'Purchase Log ' . date( "M-d-Y", $start_timestamp ) . ' to ' . date( "M-d-Y", $end_timestamp ) . '.csv';
401
+ } elseif ( isset( $_REQUEST['m'] ) ) {
402
+ $year = (int) substr( $_REQUEST['m'], 0, 4);
403
+ $month = (int) substr( $_REQUEST['m'], -2 );
404
+ $month_year_sql = "
405
+ SELECT *
406
+ FROM " . WPSC_TABLE_PURCHASE_LOGS . "
407
+ WHERE YEAR(FROM_UNIXTIME(date)) = %d AND MONTH(FROM_UNIXTIME(date)) = %d
408
+ ";
409
+ $month_year_sql = apply_filters( 'wpsc_purchase_log_month_year_csv', $month_year_sql );
410
+ $data = $wpdb->get_results( $wpdb->prepare( $month_year_sql, $year, $month ), ARRAY_A );
411
+ $csv_name = 'Purchase Log ' . $month . '/' . $year . '.csv';
412
+ } else {
413
+ $sql = apply_filters( 'wpsc_purchase_log_month_year_csv', "SELECT * FROM " . WPSC_TABLE_PURCHASE_LOGS );
414
+ $data = $wpdb->get_results( $sql, ARRAY_A );
415
+ $csv_name = "All Purchase Logs.csv";
416
+ }
417
+
418
+ $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `type` != 'heading' ORDER BY `checkout_order` DESC;";
419
+ $form_data = $wpdb->get_results( $form_sql, ARRAY_A );
420
+ $csv = 'Purchase ID, Price, Firstname, Lastname, Email, Order Status, Data, ';
421
+
422
+ $headers = "\"Purchase ID\",\"Purchase Total\","; //capture the headers
423
+ $headers2 ="\"Payment Gateway\",";
424
+ $headers2 .="\"Payment Status\",\"Purchase Date\",";
425
+
426
+ $output = '';
427
+
428
+ foreach ( (array)$data as $purchase ) {
429
+ $form_headers = '';
430
+ $output .= "\"" . $purchase['id'] . "\","; //Purchase ID
431
+ $output .= "\"" . $purchase['totalprice'] . "\","; //Purchase Total
432
+ foreach ( (array)$form_data as $form_field ) {
433
+ $form_headers .="\"".$form_field['unique_name']."\",";
434
+ $collected_data_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` = '" . $purchase['id'] . "' AND `form_id` = '" . $form_field['id'] . "' LIMIT 1";
435
+ $collected_data = $wpdb->get_results( $collected_data_sql, ARRAY_A );
436
+ $collected_data = $collected_data[0];
437
+ $output .= "\"" . $collected_data['value'] . "\","; // get form fields
438
+ }
439
+
440
+ if ( isset( $wpsc_gateways[$purchase['gateway']] ) && isset( $wpsc_gateways[$purchase['gateway']]['display_name'] ) )
441
+ $output .= "\"" . $wpsc_gateways[$purchase['gateway']]['display_name'] . "\","; //get gateway name
442
+ else
443
+ $output .= "\"\",";
444
+
445
+
446
+ $status_name = wpsc_find_purchlog_status_name( $purchase['processed'] );
447
+
448
+ $output .= "\"" . $status_name . "\","; //get purchase status
449
+ $output .= "\"" . date( "jS M Y", $purchase['date'] ) . "\","; //date
450
+
451
+ $cartsql = "SELECT `prodid`, `quantity`, `name` FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase['id'] . "";
452
+ $cart = $wpdb->get_results( $cartsql, ARRAY_A );
453
+
454
+ if( $count < count( $cart ) )
455
+ $count = count( $cart );
456
+ // Go through all products in cart and display quantity and sku
457
+ foreach ( (array)$cart as $item ) {
458
+ $skuvalue = get_product_meta( $item['prodid'], 'sku', true );
459
+ if( empty( $skuvalue ) )
460
+ $skuvalue = __( 'N/A', 'wpsc' );
461
+ $output .= "\"" . $item['quantity'] . "\",";
462
+ $output .= "\"" . str_replace( '"', '\"', $item['name'] ) . "\"";
463
+ $output .= "," . $skuvalue."," ;
464
+ }
465
+ $output .= "\n"; // terminates the row/line in the CSV file
466
+ }
467
+ // Get the most number of products and create a header for them
468
+ $headers3 = "";
469
+ for( $i = 0; $i < $count; $i++ ){
470
+ $headers3 .= "\"Quantity\",\"Product Name\",\"SKU\"";
471
+ if( $i < ( $count - 1 ) )
472
+ $headers3 .= ",";
473
+ }
474
+
475
+ $headers = apply_filters( 'wpsc_purchase_log_csv_headers', $headers . $form_headers . $headers2 . $headers3, $data, $form_data );
476
+ $output = apply_filters( 'wpsc_purchase_log_csv_output', $output, $data, $form_data );
477
+ header( 'Content-Type: text/csv' );
478
+ header( 'Content-Disposition: inline; filename="' . $csv_name . '"' );
479
+ echo $headers . "\n". $output;
480
+ exit;
481
+ }
482
+ }
483
+
484
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'wpsc_downloadcsv') ) {
485
+ add_action( 'admin_init', 'wpsc_purchase_log_csv' );
486
+ }
487
+
488
+ function wpsc_admin_ajax() {
489
  global $wpdb;
490
 
491
  if ( isset( $_POST['action'] ) && $_POST['action'] == 'product-page-order' ) {
516
  exit();
517
  }
518
 
519
+ if ( isset( $_POST['hide_ecom_dashboard'] ) && $_POST['hide_ecom_dashboard'] == 'true' ) {
520
+ require_once (ABSPATH . WPINC . '/rss.php');
521
+ $rss = fetch_rss( 'http://www.instinct.co.nz/feed/' );
522
+ $rss->items = array_slice( $rss->items, 0, 5 );
523
+ $rss_hash = sha1( serialize( $rss->items ) );
524
+ update_option( 'wpsc_ecom_news_hash', $rss_hash );
525
+ exit( 1 );
526
+ }
527
+
528
+ if ( isset( $_POST['remove_meta'] ) && $_POST['remove_meta'] == 'true' && is_numeric( $_POST['meta_id'] ) ) {
529
+ $meta_id = (int)$_POST['meta_id'];
530
+ if ( delete_meta( $meta_id ) ) {
531
+ echo $meta_id;
532
+ exit();
533
+ }
534
+ echo 0;
535
+ exit();
536
+ }
537
+
538
  if ( isset( $_REQUEST['log_state'] ) && $_REQUEST['log_state'] == "true" && is_numeric( $_POST['id'] ) && is_numeric( $_POST['value'] ) ) {
539
  $newvalue = $_POST['value'];
540
  if ( $_REQUEST['suspend'] == 'true' ) {
551
  wpsc_member_activate_subscriptions( $_POST['id'] );
552
  }
553
 
554
+ $wpdb->update(
555
+ WPSC_TABLE_PURCHASE_LOGS,
556
+ array(
557
+ 'processed' => $newvalue
558
+ ),
559
+ array(
560
+ 'id' => $_POST['id']
561
+ ),
562
+ '%d',
563
+ '%d'
564
+ );
565
  if ( ($newvalue > $log_data['processed']) && ($log_data['processed'] < 2) ) {
566
  transaction_results( $log_data['sessionid'], false );
567
  }
582
  }
583
  }
584
 
585
+ function wpsc_admin_sale_rss() {
586
+ global $wpdb;
587
+ if ( ($_GET['rss'] == "true") && ($_GET['rss_key'] == 'key') && ($_GET['action'] == "purchase_log") ) {
588
+ $sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date`!='' ORDER BY `date` DESC";
589
+ $purchase_log = $wpdb->get_results( $sql, ARRAY_A );
590
+ header( "Content-Type: application/xml; charset=UTF-8" );
591
+ header( 'Content-Disposition: inline; filename="WP_E-Commerce_Purchase_Log.rss"' );
592
+ $output = '';
593
+ $output .= "<?xml version='1.0'?>\n\r";
594
+ $output .= "<rss version='2.0'>\n\r";
595
+ $output .= " <channel>\n\r";
596
+ $output .= " <title>WP e-Commerce Product Log</title>\n\r";
597
+ $output .= " <link>" . get_option( 'siteurl' ) . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php</link>\n\r";
598
+ $output .= " <description>This is the WP e-Commerce Product Log RSS feed</description>\n\r";
599
+ $output .= " <generator>WP e-Commerce Plugin</generator>\n\r";
600
+
601
+ foreach ( (array)$purchase_log as $purchase ) {
602
+ $purchase_link = get_option( 'siteurl' ) . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php&amp;purchaseid=" . $purchase['id'];
603
+ $output .= " <item>\n\r";
604
+ $output .= " <title>Purchase # " . $purchase['id'] . "</title>\n\r";
605
+ $output .= " <link>$purchase_link</link>\n\r";
606
+ $output .= " <description>This is an entry in the purchase log.</description>\n\r";
607
+ $output .= " <pubDate>" . date( "r", $purchase['date'] ) . "</pubDate>\n\r";
608
+ $output .= " <guid>$purchase_link</guid>\n\r";
609
+ $output .= " </item>\n\r";
610
+ }
611
+ $output .= " </channel>\n\r";
612
+ $output .= "</rss>";
613
+ echo $output;
614
+ exit();
615
+ }
616
+ }
617
+
618
+ function wpsc_display_invoice() {
619
+ $purchase_id = (int)$_REQUEST['purchaselog_id'];
620
+ add_action('wpsc_packing_slip', 'wpsc_packing_slip');
621
+ do_action('wpsc_before_packing_slip', $purchase_id);
622
+ do_action('wpsc_packing_slip', $purchase_id);
623
+ exit();
624
+ }
625
+ //other actions are here
626
+ if ( isset( $_GET['display_invoice'] ) && ( 'true' == $_GET['display_invoice'] ) )
627
+ add_action( 'admin_init', 'wpsc_display_invoice', 0 );
628
+
629
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc_display_invoice' == $_REQUEST['wpsc_admin_action'] ) )
630
+ add_action( 'admin_init', 'wpsc_display_invoice' );
631
 
632
  /**
633
+ * Purchase log ajax code starts here
 
634
  */
635
+ function wpsc_purchlog_resend_email() {
636
+ global $wpdb;
637
+ $log_id = $_REQUEST['email_buyer_id'];
638
+ $wpec_taxes_controller = new wpec_taxes_controller();
639
+ if ( is_numeric( $log_id ) ) {
640
+ $selectsql = "SELECT `sessionid` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`= %d LIMIT 1";
641
+ $purchase_log = $wpdb->get_var( $wpdb->prepare( $selectsql, $log_id ) );
642
+ transaction_results( $purchase_log, false );
643
+ $sent = true;
644
+ }
645
+ $sendback = wp_get_referer();
646
+ if ( isset( $sent ) )
647
+ $sendback = add_query_arg( 'sent', $sent, $sendback );
648
 
649
+ wp_redirect( esc_url( $sendback ) );
650
+ exit();
651
+ }
652
+
653
+ if ( isset( $_REQUEST['email_buyer_id'] ) && is_numeric( $_REQUEST['email_buyer_id'] ) ) {
654
+ add_action( 'admin_init', 'wpsc_purchlog_resend_email' );
655
+ }
656
+
657
+ function wpsc_purchlog_clear_download_items() {
658
+ global $wpdb;
659
+ if ( is_numeric( $_GET['purchaselog_id'] ) ) {
660
+ $purchase_id = (int)$_GET['purchaselog_id'];
661
+ $downloadable_items = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `purchid` IN ('$purchase_id')", ARRAY_A );
662
+
663
+ $clear_locks_sql = "UPDATE`" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `ip_number` = '' WHERE `purchid` IN ('$purchase_id')";
664
+ $wpdb->query( $clear_locks_sql );
665
+ $cleared = true;
666
+
667
+ $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" );
668
+ $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" );
669
+
670
+ foreach ( (array)$downloadable_items as $downloadable_item ) {
671
+ $download_links .= $siteurl . "?downloadid=" . $downloadable_item['uniqueid'] . "\n";
672
+ }
673
+
674
+
675
+ 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' ) . "" );
676
+
677
+
678
+ $sendback = wp_get_referer();
679
+
680
+ if ( isset( $cleared ) ) {
681
+ $sendback = add_query_arg( 'cleared', $cleared, $sendback );
682
+ }
683
+ wp_redirect( esc_url( $sendback ) );
684
+ exit();
685
+ }
686
+ }
687
+
688
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clear_locks') ) {
689
+ add_action( 'admin_init', 'wpsc_purchlog_clear_download_items' );
690
+ }
691
+
692
+ //call to change view for purchase log
693
+
694
+ function wpsc_purchlog_filter_by() {
695
+ wpsc_change_purchlog_view( $_POST['view_purchlogs_by'], $_POST['view_purchlogs_by_status'] );
696
+ }
697
+
698
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'purchlog_filter_by') ) {
699
+ add_action( 'admin_init', 'wpsc_purchlog_filter_by' );
700
+ }
701
+
702
+ //bulk actions for purchase log
703
+ function wpsc_purchlog_bulk_modify() {
704
+ if ( $_POST['purchlog_multiple_status_change'] != -1 ) {
705
+ if ( is_numeric( $_POST['purchlog_multiple_status_change'] ) && $_POST['purchlog_multiple_status_change'] != 'delete' ) {
706
+ foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
707
+ wpsc_purchlog_edit_status( $purchlogid, $_POST['purchlog_multiple_status_change'] );
708
+ $updated++;
709
+ }
710
+ } elseif ( $_POST['purchlog_multiple_status_change'] == 'delete' ) {
711
+ foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
712
+
713
+ wpsc_delete_purchlog( $purchlogid );
714
+ $deleted++;
715
+ }
716
+ }
717
+ }
718
+ $sendback = wp_get_referer();
719
+ if ( isset( $updated ) ) {
720
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
721
+ }
722
+ if ( isset( $deleted ) ) {
723
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
724
+ }
725
+ if ( isset( $_POST['view_purchlogs_by'] ) ) {
726
+ $sendback = add_query_arg( 'view_purchlogs_by', $_POST['view_purchlogs_by'], $sendback );
727
  }
728
+ if ( isset( $_POST['view_purchlogs_by_status'] ) ) {
729
+ $sendback = add_query_arg( 'view_purchlogs_by_status', $_POST['view_purchlogs_by_status'], $sendback );
730
+ }
731
+ wp_redirect( esc_url( $sendback ) );
732
+ exit();
733
+ }
734
+
735
+ if ( isset( $_REQUEST['wpsc_admin_action2'] ) && ($_REQUEST['wpsc_admin_action2'] == 'purchlog_bulk_modify') ) {
736
+ add_action( 'admin_init', 'wpsc_purchlog_bulk_modify' );
737
+ }
738
+
739
+ //edit purchase log status function
740
+ function wpsc_purchlog_edit_status( $purchlog_id='', $purchlog_status='' ) {
741
+ global $wpdb;
742
+ if ( empty($purchlog_id) && empty($purchlog_status) ) {
743
+ $purchlog_id = absint( $_POST['id'] );
744
+ $purchlog_status = absint( $_POST['new_status'] );
745
+ }
746
+
747
+ $log_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '{$purchlog_id}' LIMIT 1", ARRAY_A );
748
+ $is_transaction = wpsc_check_purchase_processed($log_data['processed']);
749
+ if ( $is_transaction && function_exists('wpsc_member_activate_subscriptions')) {
750
+ wpsc_member_activate_subscriptions( $_POST['id'] );
751
+ }
752
+
753
+ //in the future when everyone is using the 2.0 merchant api, we should use the merchant class to update the staus,
754
+ // then you can get rid of this hook and have each person overwrite the method that updates the status.
755
+ do_action('wpsc_edit_order_status', array('purchlog_id'=>$purchlog_id, 'purchlog_data'=>$log_data, 'new_status'=>$purchlog_status));
756
+
757
+ $wpdb->update(
758
+ WPSC_TABLE_PURCHASE_LOGS,
759
+ array(
760
+ 'processed' => $purchlog_status
761
+ ),
762
+ array(
763
+ 'id' => $purchlog_id
764
+ ),
765
+ '%d',
766
+ '%d'
767
+ );
768
+ wpsc_clear_stock_claims();
769
+ wpsc_decrement_claimed_stock($purchlog_id);
770
+
771
+ if ( $purchlog_status == 3 )
772
+ transaction_results($log_data['sessionid'],false,null);
773
+
774
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
775
+ set_current_screen( 'dashboard_page_wpsc-sales-logs' );
776
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/purchase-log-list-table-class.php' );
777
+ $purchaselog_table = new WPSC_Purchase_Log_List_Table();
778
+ $purchaselog_table->views();
779
+ exit;
780
+ }
781
+ }
782
+
783
+ function _wpsc_ajax_purchlog_edit_status() {
784
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_purchase_logs' ) )
785
+ die( '-1' );
786
+
787
+ wpsc_purchlog_edit_status( $_POST['id'], $_POST['new_status'] );
788
+ }
789
+
790
+ add_action( 'wp_ajax_wpsc_change_purchase_log_status', '_wpsc_ajax_purchlog_edit_status' );
791
+
792
+ function wpsc_save_product_order() {
793
+ global $wpdb;
794
+
795
+ $products = array( );
796
+ foreach ( $_POST['post'] as $product ) {
797
+ $products[] = absint( $product );
798
+ }
799
+
800
+ print_r( $products );
801
+
802
+ foreach ( $products as $order => $product_id ) {
803
+ $wpdb->update(
804
+ $wpdb->posts,
805
+ array(
806
+ 'menu_order' => $order
807
+ ),
808
+ array(
809
+ 'ID' => $product_id
810
+ ),
811
+ '%d',
812
+ '%d'
813
+ );
814
+ }
815
+ $success = true;
816
+
817
+ exit( (string)$success );
818
+ }
819
+
820
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'save_product_order') ) {
821
+ add_action( 'admin_init', 'wpsc_save_product_order' );
822
+ }
823
 
824
+ function wpsc_update_checkout_fields_order() {
825
+ global $wpdb;
826
+
827
+ if ( ! wp_verify_nonce( $_POST['nonce'], 'wpsc_settings_page_nonce' ) )
828
+ die( 'Session expired. Try refreshing your settings page.' );
829
+
830
+ $checkout_fields = $_REQUEST['sort_order'];
831
+ $order = 1;
832
+ foreach ( $checkout_fields as $checkout_field ) {
833
+ // ignore new fields
834
+ if ( strpos( $checkout_field, 'new-field' ) === 0 )
835
+ continue;
836
+ $checkout_field = absint( preg_replace('/[^0-9]+/', '', $checkout_field ) );
837
+ $wpdb->update(
838
+ WPSC_TABLE_PURCHASE_LOGS,
839
+ array(
840
+ 'notes' => $purchlog_notes
841
+ ),
842
+ array(
843
+ 'id' => $purchlog_id
844
+ ),
845
+ '%s',
846
+ '%d'
847
+ );
848
+
849
+ $order ++;
850
+ }
851
+
852
+ die( 'success' );
853
+ }
854
+
855
+ add_action( 'wp_ajax_wpsc_update_checkout_fields_order', 'wpsc_update_checkout_fields_order' );
856
+
857
+ /* Start Order Notes (by Ben) */
858
+ function wpsc_purchlogs_update_notes( $purchlog_id = '', $purchlog_notes = '' ) {
859
+ global $wpdb;
860
+ if ( wp_verify_nonce( $_POST['wpsc_purchlogs_update_notes_nonce'], 'wpsc_purchlogs_update_notes' ) ) {
861
+ if ( ($purchlog_id == '') && ($purchlog_notes == '') ) {
862
+ $purchlog_id = absint( $_POST['purchlog_id'] );
863
+ $purchlog_notes = $wpdb->escape( $_POST['purchlog_notes'] );
864
+ }
865
+ $wpdb->update(
866
+ WPSC_TABLE_PURCHASE_LOGS,
867
+ array(
868
+ 'notes' => $purchlog_notes
869
+ ),
870
+ array(
871
+ 'id' => $purchlog_id
872
+ ),
873
+ array(
874
+ '%s'
875
+ ),
876
+ array(
877
+ '%d'
878
+ )
879
+ );
880
+ }
881
+ }
882
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'purchlogs_update_notes' ) )
883
+ add_action( 'admin_init', 'wpsc_purchlogs_update_notes' );
884
+
885
+ /* End Order Notes (by Ben) */
886
+
887
+ //delete a purchase log
888
+ function wpsc_delete_purchlog( $purchlog_id='' ) {
889
+ global $wpdb;
890
+ $deleted = 0;
891
+ if ( $purchlog_id == '' ) {
892
+ $purchlog_id = absint( $_GET['purchlog_id'] );
893
+ check_admin_referer( 'delete_purchlog_' . $purchlog_id );
894
+ }
895
+
896
+ if ( is_numeric( $purchlog_id ) ) {
897
+ $delete_log_form_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='$purchlog_id'";
898
+ $cart_content = $wpdb->get_results( $delete_log_form_sql, ARRAY_A );
899
+ }
900
+
901
+ $purchlog_status = $wpdb->get_var( $wpdb->prepare( "SELECT `processed` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`= %d", $purchlog_id ) );
902
+ if ( $purchlog_status == 5 || $purchlog_status == 1 ) {
903
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_CLAIMED_STOCK . "` WHERE `cart_id` = %d AND `cart_submitted` = '1'", $purchlog_id ) );
904
+ }
905
+
906
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid` = %d", $purchlog_id ) );
907
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` IN (%d)", $purchlog_id ) );
908
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = %d LIMIT 1", $purchlog_id ) );
909
+
910
+ $deleted = 1;
911
+
912
+ if ( is_numeric( $_GET['purchlog_id'] ) ) {
913
+ $sendback = wp_get_referer();
914
+ $sendback = remove_query_arg( array( 'c', 'id' ), $sendback );
915
+ if ( isset( $deleted ) ) {
916
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
917
+ }
918
+ wp_redirect( esc_url( $sendback ) );
919
+ exit();
920
+ }
921
+ }
922
+
923
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'delete_purchlog') ) {
924
+ add_action( 'admin_init', 'wpsc_delete_purchlog' );
925
+ }
926
+
927
+ function wpsc_ajax_get_payment_form() {
928
+ $paymentname = $_REQUEST['paymentname'];
929
+ $payment_data = wpsc_get_payment_form( $paymentname );
930
+ $html_payment_name = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $payment_data['name'] ) );
931
+ $payment_form = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $payment_data['form_fields'] ) );
932
+ echo "payment_name_html = '$html_payment_name'; \n\r";
933
+ echo "payment_form_html = '$payment_form'; \n\r";
934
+ echo "has_submit_button = '{$payment_data['has_submit_button']}'; \n\r";
935
+ exit();
936
+ }
937
+
938
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'get_payment_form') )
939
+ add_action( 'admin_init', 'wpsc_ajax_get_payment_form' );
940
+
941
+ add_action( 'update_option_product_category_hierarchical_url', 'wpsc_update_option_product_category_hierarchical_url' );
942
+
943
+ function wpsc_update_option_product_category_hierarchical_url() {
944
+ flush_rewrite_rules( false );
945
+ }
946
+
947
+ function wpsc_change_currency() {
948
  if ( is_numeric( $_POST['currencyid'] ) ) {
949
+ $currency_data = $wpdb->get_results( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . $_POST['currencyid'] . "' LIMIT 1", ARRAY_A );
950
  $price_out = null;
951
  if ( $currency_data[0]['symbol'] != '' ) {
952
  $currency_sign = $currency_data[0]['symbol_html'];
959
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_currency') )
960
  add_action( 'admin_init', 'wpsc_change_currency' );
961
 
 
 
 
 
962
  function wpsc_rearrange_images() {
 
 
 
 
 
963
  global $wpdb;
964
  $images = explode( ",", $_POST['order'] );
965
  $product_id = absint( $_POST['product_id'] );
993
  add_action( 'admin_init', 'wpsc_rearrange_images' );
994
 
995
  /**
996
+ * wpsc_update_page_urls gets the permalinks for products pages and stores them in the options for quick reference
997
+ * @public
998
  *
999
+ * @since 3.6
1000
+ * @param $auto (Boolean) true if coming from WordPress Permalink Page, false otherwise
1001
+ * @return nothing
 
 
1002
  */
1003
+ function wpsc_update_page_urls($auto = false) {
1004
+ global $wpdb;
1005
 
1006
+ $wpsc_pageurl_option['product_list_url'] = '[productspage]';
1007
+ $wpsc_pageurl_option['shopping_cart_url'] = '[shoppingcart]';
1008
+ $check_chekout = $wpdb->get_var( "SELECT `guid` FROM `{$wpdb->posts}` WHERE `post_content` LIKE '%[checkout]%' LIMIT 1" );
1009
+ if ( $check_chekout != null ) {
1010
+ $wpsc_pageurl_option['checkout_url'] = '[checkout]';
1011
+ } else {
1012
+ $wpsc_pageurl_option['checkout_url'] = '[checkout]';
1013
+ }
1014
+ $wpsc_pageurl_option['transact_url'] = '[transactionresults]';
1015
+ $wpsc_pageurl_option['user_account_url'] = '[userlog]';
1016
+ $changes_made = false;
1017
+ foreach ( $wpsc_pageurl_option as $option_key => $page_string ) {
1018
+ $post_id = $wpdb->get_var( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` IN('page','post') AND `post_content` LIKE '%$page_string%' LIMIT 1" );
1019
+ if ( ! $post_id )
1020
+ continue;
1021
+ $the_new_link = _get_page_link( $post_id );
1022
+ if ( stristr( get_option( $option_key ), "https://" ) ) {
1023
+ $the_new_link = str_replace( 'http://', "https://", $the_new_link );
1024
+ }
1025
+
1026
+ update_option( $option_key, $the_new_link );
1027
  }
1028
 
1029
+ if(!$auto){
1030
+ $sendback = wp_get_referer();
1031
+ if ( isset( $updated ) )
1032
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
1033
+
1034
+ if ( isset( $_SESSION['wpsc_settings_curr_page'] ) )
1035
+ $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
1036
+
1037
+ wp_redirect( esc_url( $sendback ) );
1038
+ exit();
1039
+ }
1040
+ }
1041
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'update_page_urls') )
1042
+ add_action( 'admin_init', 'wpsc_update_page_urls' );
1043
+
1044
+ function wpsc_clean_categories() {
1045
  global $wpdb, $wp_rewrite;
1046
  $sql_query = "SELECT `id`, `name`, `active` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`";
1047
  $sql_data = $wpdb->get_results( $sql_query, ARRAY_A );
1069
  '%d'
1070
  );
1071
 
1072
+ $updated;
1073
+
1074
  } else if ( $datarow['active'] == 0 ) {
1075
  $wpdb->update(
1076
  WPSC_TABLE_PRODUCT_CATEGORIES,
1083
  '%s',
1084
  '%d'
1085
  );
1086
+ $updated;
1087
  }
1088
  }
1089
  $wp_rewrite->flush_rules();
1096
  $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
1097
  }
1098
 
1099
+ wp_redirect( esc_url( $sendback ) );
1100
 
1101
  exit();
1102
  }
1103
  if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clean_categories') )
1104
  add_action( 'admin_init', 'wpsc_clean_categories' );
1105
 
1106
+ //change the regions tax settings
1107
+ function wpsc_change_region_tax() {
1108
+ global $wpdb;
1109
+ if ( is_array( $_POST['region_tax'] ) ) {
1110
+ foreach ( $_POST['region_tax'] as $region_id => $tax ) {
1111
+ if ( is_numeric( $region_id ) && is_numeric( $tax ) ) {
1112
+ $previous_tax = $wpdb->get_var( $wpdb->prepare( "SELECT `tax` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id` = %d LIMIT 1", $region_id ) );
1113
+ if ( $tax != $previous_tax ) {
1114
+ $wpdb->update(
1115
+ WPSC_TABLE_REGION_TAX,
1116
+ array(
1117
+ 'tax' => $tax
1118
+ ),
1119
+ array(
1120
+ 'id' => $region_id
1121
+ ),
1122
+ '%s',
1123
+ '%d'
1124
+ );
1125
+ $changes_made = true;
1126
+ }
1127
+ }
1128
+ }
1129
+ $sendback = wp_get_referer();
1130
+ wp_redirect( $sendback );
1131
+ }
1132
+ }
1133
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_region_tax') )
1134
+ add_action( 'admin_init', 'wpsc_change_region_tax' );
1135
+
1136
+ function wpsc_product_files_existing() {
1137
+ //List all product_files, with checkboxes
1138
+
1139
+ $product_id = absint( $_GET["product_id"] );
1140
+ $file_list = wpsc_uploaded_files();
1141
+
1142
+ $args = array(
1143
+ 'post_type' => 'wpsc-product-file',
1144
+ 'post_parent' => $product_id,
1145
+ 'numberposts' => -1,
1146
+ 'post_status' => 'all'
1147
+ );
1148
+ $attached_files = (array)get_posts( $args );
1149
+
1150
+ foreach ( $attached_files as $key => $attached_file ) {
1151
+ $attached_files_by_file[$attached_file->post_title] = & $attached_files[$key];
1152
+ }
1153
+
1154
+ $output = "<span class='admin_product_notes select_product_note '>" . __( 'Choose a downloadable file for this product:', 'wpsc' ) . "</span><br>";
1155
+ $output .= "<form method='post' class='product_upload'>";
1156
+ $output .= "<div class='ui-widget-content multiple-select select_product_file'>";
1157
+ $num = 0;
1158
+ foreach ( (array)$file_list as $file ) {
1159
+ $num++;
1160
+ $checked_curr_file = "";
1161
+ if ( isset( $attached_files_by_file[$file['display_filename']] ) ) {
1162
+ $checked_curr_file = "checked='checked'";
1163
+ }
1164
+
1165
+ $output .= "<p " . ((($num % 2) > 0) ? '' : "class='alt'") . " id='select_product_file_row_$num'>\n";
1166
+ $output .= " <input type='checkbox' name='select_product_file[]' value='" . $file['real_filename'] . "' id='select_product_file_$num' " . $checked_curr_file . " />\n";
1167
+ $output .= " <label for='select_product_file_$num'>" . $file['display_filename'] . "</label>\n";
1168
+ $output .= "</p>\n";
1169
+ }
1170
+
1171
+ $output .= "</div>";
1172
+ $output .= "<input type='hidden' id='hidden_id' value='$product_id' />";
1173
+ $output .= "<input type='submit' name='save' name='product_files_submit' class='button-primary prdfil' value='Save Product Files' />";
1174
+ $output .= "</form>";
1175
+ $output .= "<div class='" . ((is_numeric( $product_id )) ? "edit_" : "") . "select_product_handle'><div></div></div>";
1176
+ $output .= "<script type='text/javascript'>\n\r";
1177
+ $output .= "var select_min_height = " . (25 * 3) . ";\n\r";
1178
+ $output .= "var select_max_height = " . (25 * ($num + 1)) . ";\n\r";
1179
+ $output .= "</script>";
1180
+
1181
+
1182
+ echo $output;
1183
+ }
1184
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'product_files_existing') )
1185
+ add_action( 'admin_init', 'wpsc_product_files_existing' );
1186
+
1187
+ function prod_upload() {
1188
+ global $wpdb;
1189
+ $product_id = absint( $_POST["product_id"] );
1190
+ $output = '';
1191
+ foreach ( $_POST["select_product_file"] as $selected_file ) {
1192
+ // if we already use this file, there is no point doing anything more.
1193
+
1194
+ $sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'wpsc-product-file' AND post_title = %s", $selected_file ); // TODO it's safer to select by post ID, in that case we will use get_posts()
1195
+ $file_post_data = $wpdb->get_row( $sql, ARRAY_A );
1196
+ $selected_file_path = WPSC_FILE_DIR . basename( $selected_file );
1197
+
1198
+ if ( empty( $file_post_data ) ) {
1199
+ $type = wpsc_get_mimetype( $selected_file_path );
1200
+ $attachment = array(
1201
+ 'post_mime_type' => $type,
1202
+ 'post_parent' => $product_id,
1203
+ 'post_title' => $selected_file,
1204
+ 'post_content' => '',
1205
+ 'post_type' => "wpsc-product-file",
1206
+ 'post_status' => 'inherit'
1207
+ );
1208
+ $id = wp_insert_post( $attachment );
1209
+ } else {
1210
+ // already attached
1211
+ if ( $file_post_data['post_parent'] == $product_id )
1212
+ continue;
1213
+ $type = $file_post_data["post_mime_type"];
1214
+ $url = $file_post_data["guid"];
1215
+ $title = $file_post_data["post_title"];
1216
+ $content = $file_post_data["post_content"];
1217
+ // Construct the attachment
1218
+ $attachment = array(
1219
+ 'post_mime_type' => $type,
1220
+ 'guid' => $url,
1221
+ 'post_parent' => absint( $product_id ),
1222
+ 'post_title' => $title,
1223
+ 'post_content' => $content,
1224
+ 'post_type' => "wpsc-product-file",
1225
+ 'post_status' => 'inherit'
1226
+ );
1227
+ // Save the data
1228
+ $id = wp_insert_post( $attachment );
1229
+ }
1230
+ $deletion_url = wp_nonce_url( "admin.php?wpsc_admin_action=delete_file&amp;file_name={$attachment['post_title']}&amp;product_id={$product_id}", 'delete_file_' . $attachment['post_title'] );
1231
+
1232
+ $output .= '<tr class="wpsc_product_download_row ' . $class . '" id="elect_product_file_row_id_' . $id . '">';
1233
+ $output .= '<td style="padding-right: 30px;">' . $attachment['post_title'] . '</td>';
1234
+ $output .= '<td>' . wpsc_convert_byte( $file_size ) . '</td>';
1235
+ $output .= '<td>.' . wpsc_get_extension( $attachment['post_title'] ) . '</td>';
1236
+ $output .= "<td><a class='file_delete_button' href='{$deletion_url}' >" . _x( 'Delete', 'Digital Downliad UI row', 'wpsc' ) . "</a></td>";
1237
+ $output .= '<td><a href=' .$file_url .'>' . _x( 'Download', 'Digital Downliad UI row', 'wpsc' ) . '</a></td>';
1238
+ $output .= '</tr>';
1239
+ }
1240
+
1241
+ echo $output;
1242
+ }
1243
+ if ( isset( $_GET['wpsc_admin_action'] ) && ($_GET['wpsc_admin_action'] == 'product_files_upload') )
1244
+ add_action( 'admin_init', 'prod_upload' );
1245
+
1246
+ //change the gateway settings
1247
+ function wpsc_gateway_settings() {
1248
+ //To update options
1249
+ if ( isset( $_POST['wpsc_options'] ) ) {
1250
+ foreach ( $_POST['wpsc_options'] as $key => $value ) {
1251
+ if ( $value != get_option( $key ) ) {
1252
+ update_option( $key, $value );
1253
+ }
1254
+ }
1255
+ unset( $_POST['wpsc_options'] );
1256
+ }
1257
+
1258
+
1259
+
1260
+ if ( isset( $_POST['user_defined_name'] ) && is_array( $_POST['user_defined_name'] ) ) {
1261
+ $payment_gateway_names = get_option( 'payment_gateway_names' );
1262
+
1263
+ if ( !is_array( $payment_gateway_names ) ) {
1264
+ $payment_gateway_names = array( );
1265
+ }
1266
+ $payment_gateway_names = array_merge( $payment_gateway_names, (array)$_POST['user_defined_name'] );
1267
+ update_option( 'payment_gateway_names', $payment_gateway_names );
1268
+ }
1269
+ $custom_gateways = get_option( 'custom_gateway_options' );
1270
+
1271
+ $nzshpcrt_gateways = nzshpcrt_get_gateways();
1272
+ foreach ( $nzshpcrt_gateways as $gateway ) {
1273
+ if ( in_array( $gateway['internalname'], $custom_gateways ) ) {
1274
+ if ( isset( $gateway['submit_function'] ) ) {
1275
+ call_user_func_array( $gateway['submit_function'], array( ) );
1276
+ $changes_made = true;
1277
+ }
1278
+ }
1279
+ }
1280
+ if ( (isset( $_POST['payment_gw'] ) && $_POST['payment_gw'] != null ) ) {
1281
+ update_option( 'payment_gateway', $_POST['payment_gw'] );
1282
+ }
1283
+ }
1284
+ if ( isset( $_REQUEST['wpsc_gateway_settings'] ) && ($_REQUEST['wpsc_gateway_settings'] == 'gateway_settings') )
1285
+ add_action( 'admin_init', 'wpsc_gateway_settings' );
1286
+
1287
+ function wpsc_google_shipping_settings() {
1288
+ if ( isset( $_POST['submit'] ) ) {
1289
+ foreach ( (array)$_POST['google_shipping'] as $key => $country ) {
1290
+ if ( $country == 'on' ) {
1291
+ $google_shipping_country[] = $key;
1292
+ $updated++;
1293
+ }
1294
+ }
1295
+ update_option( 'google_shipping_country', $google_shipping_country );
1296
+ $sendback = wp_get_referer();
1297
+ $sendback = remove_query_arg( 'googlecheckoutshipping', $sendback );
1298
+
1299
+ if ( isset( $updated ) ) {
1300
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
1301
+ }
1302
+
1303
+ wp_redirect( esc_url( $sendback ) );
1304
+ exit();
1305
+ }
1306
+ }
1307
+
1308
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'google_shipping_settings') ) {
1309
+ add_action( 'admin_init', 'wpsc_google_shipping_settings' );
1310
+ }
1311
+
1312
+ function wpsc_update_variations() {
1313
+ $product_id = absint( $_POST["product_id"] );
1314
+ $product_type_object = get_post_type_object('wpsc-product');
1315
+ if (!current_user_can($product_type_object->cap->edit_post, $product_id))
1316
+ return;
1317
+
1318
+ //Setup postdata
1319
+ $post_data = array( );
1320
+ $post_data['edit_var_val'] = isset( $_POST['edit_var_val'] ) ? $_POST["edit_var_val"] : '';
1321
+ $post_data['description'] = isset( $_POST['description'] ) ? $_POST["description"] : '';
1322
+ $post_data['additional_description'] = isset( $_POST['additional_description'] ) ? $_POST['additional_description'] : '';
1323
+ $post_data['name'] = (!empty($_POST['name']))?$_POST['name']:$_POST["post_title"];
1324
+
1325
+ //Add or delete variations
1326
+ wpsc_edit_product_variations( $product_id, $post_data );
1327
+ if (defined('DOING_AJAX') && DOING_AJAX) {
1328
+ wpsc_admin_product_listing( $product_id );
1329
+ die();
1330
+ }
1331
+ }
1332
+
1333
+ if ( isset($_POST["edit_var_val"]) )
1334
+ add_action( 'admin_init', 'wpsc_update_variations', 50 );
1335
+ add_action('wp_ajax_wpsc_update_variations', 'wpsc_update_variations', 50 );
1336
+
1337
+ function wpsc_delete_variation_set() {
1338
+ check_admin_referer( 'delete-variation' );
1339
+
1340
+ if ( is_numeric( $_GET['deleteid'] ) ) {
1341
+ $variation_id = absint( $_GET['deleteid'] );
1342
 
1343
+ $variation_set = get_term( $variation_id, 'wpsc-variation', ARRAY_A );
1344
+
1345
+
1346
+ $variations = get_terms( 'wpsc-variation', array(
1347
+ 'hide_empty' => 0,
1348
+ 'parent' => $variation_id
1349
+ ) );
1350
+
1351
+ foreach ( (array)$variations as $variation ) {
1352
+ $return_value = wp_delete_term( $variation->term_id, 'wpsc-variation' );
1353
+ }
1354
+
1355
+ if ( !empty( $variation_set ) ) {
1356
+ $return_value = wp_delete_term( $variation_set['term_id'], 'wpsc-variation' );
1357
+ }
1358
+ $deleted = 1;
1359
+ }
1360
+
1361
+ $sendback = wp_get_referer();
1362
+ if ( isset( $deleted ) ) {
1363
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
1364
+ }
1365
+ $sendback = remove_query_arg( array(
1366
+ 'deleteid',
1367
+ 'variation_id'
1368
+ ), $sendback );
1369
+
1370
+ wp_redirect( esc_url( $sendback ) );
1371
+ exit();
1372
+ }
1373
+
1374
+ function wpsc_force_flush_theme_transients() {
1375
+ // Flush transients
1376
+ wpsc_flush_theme_transients( true );
1377
+
1378
+ // Bounce back
1379
+ $sendback = wp_get_referer();
1380
+ wp_redirect( $sendback );
1381
+
1382
+ exit();
1383
+ }
1384
+ if ( isset( $_REQUEST['wpsc_flush_theme_transients'] ) && ( $_REQUEST['wpsc_flush_theme_transients'] == 'true' ) )
1385
+ add_action( 'admin_init', 'wpsc_force_flush_theme_transients' );
1386
+
1387
+ function wpsc_backup_theme() {
1388
+ $wp_theme_path = get_stylesheet_directory();
1389
+ wpsc_recursive_copy( $wp_theme_path, WPSC_THEME_BACKUP_DIR );
1390
+ $_SESSION['wpsc_themes_backup'] = true;
1391
+ $sendback = wp_get_referer();
1392
+ wp_redirect( $sendback );
1393
+
1394
+ exit();
1395
+ }
1396
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'backup_themes' ) )
1397
+ add_action( 'admin_init', 'wpsc_backup_theme' );
1398
+
1399
+
1400
+ function wpsc_delete_coupon(){
1401
+ global $wpdb;
1402
+
1403
+ check_admin_referer( 'delete-coupon' );
1404
+ $coupon_id = (int)$_GET['delete_id'];
1405
+
1406
+ if(isset($coupon_id)) {
1407
+ $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPSC_TABLE_COUPON_CODES."` WHERE `id` = %d LIMIT 1", $coupon_id ) );
1408
+ $deleted = 1;
1409
+ }
1410
+ $sendback = wp_get_referer();
1411
+ if ( isset( $deleted ) )
1412
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
1413
+
1414
+ $sendback = remove_query_arg( array('deleteid',), $sendback );
1415
+ wp_redirect( esc_url( $sendback ) );
1416
+ exit();
1417
+ }
1418
+
1419
+ if ( isset( $_GET['action'] ) && ( 'purchase_log' == $_GET['action'] ) )
1420
+ add_action( 'admin_init', 'wpsc_admin_sale_rss' );
1421
+
1422
+ if ( isset( $_GET['purchase_log_csv'] ) && ( 'true' == $_GET['purchase_log_csv'] ) )
1423
+ add_action( 'admin_init', 'wpsc_purchase_log_csv' );
1424
+
1425
+ if ( isset( $_REQUEST['ajax'] ) && isset( $_REQUEST['admin'] ) && ($_REQUEST['ajax'] == "true") && ($_REQUEST['admin'] == "true") )
1426
+ add_action( 'admin_init', 'wpsc_admin_ajax' );
1427
+
1428
+ // Variation set deleting init code starts here
1429
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-variation-set' == $_REQUEST['wpsc_admin_action'] ) )
1430
+ add_action( 'admin_init', 'wpsc_delete_variation_set' );
1431
+
1432
+ //Delete Coupon
1433
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-coupon' == $_REQUEST['wpsc_admin_action'] ) )
1434
+ add_action( 'admin_init', 'wpsc_delete_coupon' );
1435
+
1436
+
1437
+ function flat_price( $price ) {
1438
+ if ( ! empty( $price ) && strchr( $price, '-' ) === false && strchr( $price, '+' ) === false && strchr( $price, '%' ) === false )
1439
+ return true;
1440
+ }
1441
+
1442
+ function percentile_price( $price ) {
1443
+ if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) )
1444
+ return true;
1445
+ }
1446
+
1447
+ function differential_price( $price ) {
1448
+ if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) === false )
1449
+ return true;
1450
+ }
1451
+
1452
+ /**
1453
+ * If it doesn't exist, let's create a multi-dimensional associative array
1454
+ * that will contain all of the term/price associations
1455
+ *
1456
+ * @param <type> $variation
1457
+ */
1458
+ function variation_price_field( $variation ) {
1459
+ $term_prices = get_option( 'term_prices' );
1460
+
1461
+ if ( is_object( $variation ) )
1462
+ $term_id = $variation->term_id;
1463
+
1464
+ if ( empty( $term_prices ) || !is_array( $term_prices ) ) {
1465
+
1466
+ $term_prices = array( );
1467
+ if ( isset( $term_id ) ) {
1468
+ $term_prices[$term_id] = array( );
1469
+ $term_prices[$term_id]["price"] = '';
1470
+ $term_prices[$term_id]["checked"] = '';
1471
+ }
1472
+ add_option( 'term_prices', $term_prices );
1473
+ }
1474
+
1475
+ if ( isset( $term_id ) && is_array( $term_prices ) && array_key_exists( $term_id, $term_prices ) )
1476
+ $price = esc_attr( $term_prices[$term_id]["price"] );
1477
+ else
1478
+ $price = '';
1479
+
1480
+ if( !isset( $_GET['action'] ) ) {
1481
+ ?>
1482
+ <div class="form-field">
1483
+ <label for="variation_price"><?php _e( 'Variation Price', 'wpsc' ); ?></label>
1484
+ <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1485
+ <span class="description"><?php _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>
1486
+ </div>
1487
+ <script type="text/javascript">
1488
+ jQuery('#parent option:contains("   ")').remove();
1489
+ jQuery('#parent').mousedown(function(){
1490
+ jQuery('#parent option:contains("   ")').remove();
1491
+ });
1492
+ </script>
1493
+ <?php
1494
+ } else{
1495
+ ?>
1496
+ <tr class="form-field">
1497
+ <th scope="row" valign="top">
1498
+ <label for="variation_price"><?php _e( 'Variation Price', 'wpsc' ); ?></label>
1499
+ </th>
1500
+ <td>
1501
+ <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1502
+ <span class="description"><?php _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>
1503
+ </td>
1504
+ </tr>
1505
+ <?php
1506
+ }
1507
+ }
1508
+ add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field' );
1509
+ add_action( 'wpsc-variation_add_form_fields', 'variation_price_field' );
1510
+
1511
+ /*
1512
+ WordPress doesnt let you change the custom post type taxonomy form very easily
1513
+ Use Jquery to move the set variation (parent) field to the top and add a description
1514
+ */
1515
+ function variation_set_field(){
1516
+ ?>
1517
+ <script>
1518
+ /* change the text on the variation set from (none) to new variation set*/
1519
+ jQuery("#parent option[value='-1']").text("New Variation Set");
1520
+ /* Move to the top of the form and add a description */
1521
+ jQuery("#tag-name").parent().before( jQuery("#parent").parent().append('<p>Choose the Variation Set you want to add variants to. If your\'e creating a new variation set then select "New Variation Set"</p>') );
1522
+ /*
1523
+ create a small description about variations below the add variation / set title
1524
+ we can then get rid of the big red danger warning
1525
+ */
1526
+ ( jQuery("div#ajax-response").after('<p>Variations allow you to create options for your products, for example if you\'re selling T-Shirts they will have a size option you can create this as a variation. 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 draging and droping them within their Variation Set.</p>') );
1527
+ </script>
1528
+ <?php
1529
+ }
1530
+ add_action( 'wpsc-variation_edit_form_fields', 'variation_set_field' );
1531
+ add_action( 'wpsc-variation_add_form_fields', 'variation_set_field' );
1532
+
1533
+
1534
+ function category_edit_form(){
1535
+ ?>
1536
+ <script type="text/javascript">
1537
+
1538
+ </script>
1539
+ <?php
1540
+ }
1541
+
1542
+ function variation_price_field_check( $variation ) {
1543
+
1544
+ $term_prices = get_option( 'term_prices' );
1545
+
1546
+ if ( is_array( $term_prices ) && array_key_exists( $variation->term_id, $term_prices ) )
1547
+ $checked = ($term_prices[$variation->term_id]["checked"] == 'checked') ? 'checked' : '';
1548
+ else
1549
+ $checked = ''; ?>
1550
+
1551
+ <tr class="form-field">
1552
+ <th scope="row" valign="top"><label for="apply_to_current"><?php _e( 'Apply to current variations?', 'wpsc' ) ?></label></th>
1553
+ <td>
1554
+ <span class="description"><input type="checkbox" name="apply_to_current" id="apply_to_current" style="width:2%;" <?php echo $checked; ?> /><?php _e( 'By checking this box, the price rule you implement above will be applied to all variations that currently exist. If you leave it unchecked, it will only apply to products that use this variation created or edited from now on. Take note, this will apply this rule to <strong>every</strong> product using this variation. If you need to override it for any reason on a specific product, simply go to that product and change the price.', 'wpsc' ); ?></span>
1555
+ </td>
1556
+ </tr>
1557
+ <?php
1558
+ }
1559
+ add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field_check' );
1560
+
1561
+
1562
+
1563
+ /**
1564
+ * @todo - Should probably refactor this at some point - very procedural,
1565
+ * WAY too many foreach loops for my liking :) But it does the trick
1566
+ *
1567
+ * @param <type> $term_id
1568
+ */
1569
+ function save_term_prices( $term_id ) {
1570
+
1571
+ // First - Saves options from input
1572
+ if ( isset( $_POST['variation_price'] ) || isset( $_POST["apply_to_current"] ) ) {
1573
+
1574
+ $term_prices = get_option( 'term_prices' );
1575
+
1576
+ $term_prices[$term_id]["price"] = $_POST["variation_price"];
1577
+ $term_prices[$term_id]["checked"] = (isset( $_POST["apply_to_current"] )) ? "checked" : "unchecked";
1578
+
1579
+ update_option( 'term_prices', $term_prices );
1580
+ }
1581
+
1582
+ // 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
1583
+ if ( isset( $_POST["apply_to_current"] ) ) {
1584
+
1585
+ //Check for flat, percentile or differential
1586
+ $var_price_type = '';
1587
+
1588
+ if ( flat_price( $_POST["variation_price"] ) )
1589
+ $var_price_type = 'flat';
1590
+ elseif ( differential_price( $_POST["variation_price"] ) )
1591
+ $var_price_type = 'differential';
1592
+ elseif ( percentile_price( $_POST["variation_price"] ) )
1593
+ $var_price_type = 'percentile';
1594
+
1595
+ //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)
1596
+ $products_to_mod = get_objects_in_term( $term_id, "wpsc-variation" );
1597
+ $product_parents = array( );
1598
+
1599
+ foreach ( (array)$products_to_mod as $get_parent ) {
1600
+
1601
+ $post = get_post( $get_parent );
1602
+
1603
+ if ( !$post->post_parent )
1604
+ $product_parents[] = $post->ID;
1605
+ }
1606
+
1607
+ //Now that we have all parent IDs with this term, we can get the children (only the ones that are also in $products_to_mod, we don't want to apply pricing to ALL kids)
1608
+
1609
+ foreach ( $product_parents as $parent ) {
1610
+ $args = array(
1611
+ 'post_parent' => $parent,
1612
+ 'post_type' => 'wpsc-product'
1613
+ );
1614
+ $children = get_children( $args, ARRAY_A );
1615
+
1616
+ foreach ( $children as $childrens ) {
1617
+ $parent = $childrens["post_parent"];
1618
+ $children_ids[$parent][] = $childrens["ID"];
1619
+ $children_ids[$parent] = array_intersect( $children_ids[$parent], $products_to_mod );
1620
+ }
1621
+ }
1622
+
1623
+ //Got the right kids, let's grab their parent pricing and modify their pricing based on var_price_type
1624
+
1625
+ foreach ( (array)$children_ids as $parents => $kids ) {
1626
+
1627
+ $kids = array_values( $kids );
1628
+
1629
+ foreach ( $kids as $kiddos ) {
1630
+ $price = wpsc_determine_variation_price( $kiddos );
1631
+ update_product_meta( $kiddos, 'price', $price );
1632
+ }
1633
+ }
1634
+ }
1635
+ }
1636
+ add_action( 'edited_wpsc-variation', 'save_term_prices' );
1637
+ add_action( 'created_wpsc-variation', 'save_term_prices' );
1638
+
1639
+ function wpsc_delete_variations( $postid ) {
1640
+ $post = get_post( $postid );
1641
+ if ( $post->post_type != 'wpsc-product' || $post->post_parent != 0 )
1642
+ return;
1643
+ $variations = get_posts( array(
1644
+ 'post_type' => 'wpsc-product',
1645
+ 'post_parent' => $postid,
1646
+ 'post_status' => 'any',
1647
+ 'numberposts' => -1,
1648
+ ) );
1649
+
1650
+ if ( ! empty( $variations ) )
1651
+ foreach ( $variations as $variation ) {
1652
+ wp_delete_post( $variation->ID, true );
1653
+ }
1654
+ }
1655
+ add_action( 'delete_post', 'wpsc_delete_variations' );
1656
+
1657
+ /*
1658
+ Save the variations that have been
1659
+ created on the products page
1660
+ */
1661
+ function wpsc_add_variant_from_products_page() {
1662
+ /* This is the parent term / vartiation set we will save this first */
1663
+ $variation_set_term = $_POST['variation'];
1664
+ $variants[0] = $_POST['variant'];
1665
+
1666
+ /*
1667
+ variants can be coma separated so we check for
1668
+ these and put them into an array
1669
+ */
1670
+ $variants = explode( ',', $variants[0] );
1671
+ wp_insert_term( $variation_set_term, 'wpsc-variation', $args = array() );
1672
+
1673
+ /* now get the parent id so we can save all the kids*/
1674
+ $parent_term = term_exists( $variation_set_term, 'wpsc-variation' ); // array is returned if taxonomy is given
1675
+ $parent_term_id = $parent_term['term_id']; // get numeric term id
1676
+ /* if we have a parent and some kids then we will add kids now */
1677
+ if( !empty($parent_term_id) && !empty($variants) ){
1678
+ foreach( $variants as $variant ){
1679
+ wp_insert_term( $variant, 'wpsc-variation', $args = array('parent' => $parent_term_id) );
1680
+ /* want to get out the id so we can return it with the response */
1681
+ $varient_term = term_exists( $variant, 'wpsc-variation', $parent_term_id );
1682
+ $variant_term_id[] = $varient_term['term_id']; // get numeric term id
1683
+ }
1684
+ }
1685
+ $response = new WP_Ajax_Response;
1686
+ $response -> add( array(
1687
+ 'data' => 'success',
1688
+ 'supplemental' => array(
1689
+ 'variant_id' => implode(",",$variant_term_id),
1690
+ ),
1691
+ )
1692
+ );
1693
+ $response -> send();
1694
+ exit();
1695
+ }
1696
+
1697
+ add_action( 'wp_ajax_wpsc_add_variant_from_products_page', 'wpsc_add_variant_from_products_page' );
1698
+
1699
+ function wpsc_delete_variant_from_products_page(){
1700
+ $variant_id = $_POST['variant_id'];
1701
+ /* should never be empty but best to check first*/
1702
+ if (!empty($variant_id))
1703
+ wp_delete_term( $variant_id, 'wpsc-variation');
1704
+ exit();
1705
+ }
1706
+ add_action( 'wp_ajax_wpsc_delete_variant_from_products_page', 'wpsc_delete_variant_from_products_page' );
wpsc-admin/ajax.php DELETED
@@ -1,926 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Verify nonce of an AJAX request
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
- */
48
- function _wpsc_ajax_fire_callback( $ajax_action ) {
49
- // if callback exists, call it and output JSON response
50
- $callback = "_wpsc_ajax_{$ajax_action}";
51
-
52
- if ( is_callable( $callback ) )
53
- $result = call_user_func( $callback );
54
- else
55
- $result = new WP_Error( 'wpsc_invalid_ajax_callback', __( 'Invalid AJAX callback.', 'wpsc' ) );
56
-
57
- return $result;
58
- }
59
-
60
- /**
61
- * AJAX handler for all WPEC ajax requests.
62
- *
63
- * This function automates nonce checking and outputs JSON response.
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 );
84
-
85
- $output = array(
86
- 'is_successful' => false,
87
- );
88
-
89
- if ( is_wp_error( $result ) ) {
90
- $output['error'] = array(
91
- 'code' => $result->get_error_code(),
92
- 'messages' => $result->get_error_messages(),
93
- 'data' => $result->get_error_data(),
94
- );
95
- } else {
96
- $output['is_successful'] = true;
97
- $output['obj'] = $result;
98
- }
99
-
100
- echo json_encode( $output );
101
- exit;
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
-
114
- if ( $action )
115
- $ajax = $ajax && ! empty( $_REQUEST['wpsc_action'] ) && $action == str_replace( '-', '_', $_REQUEST['wpsc_action'] );
116
-
117
- return $ajax;
118
- }
119
-
120
- /**
121
- * Helper function that generates nonce for an AJAX action. Basically just a wrapper of
122
- * wp_create_nonce() but automatically add prefix.
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
- */
132
- function _wpsc_create_ajax_nonce( $ajax_action ) {
133
- return wp_create_nonce( "wpsc_ajax_{$ajax_action}" );
134
- }
135
-
136
- /**
137
- * Add new variation set via AJAX.
138
- *
139
- * If the variation set name is the same as an existing variation set,
140
- * the children variant terms will be added inside that existing set.
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() {
160
- $new_variation_set = $_POST['variation_set'];
161
- $variants = preg_split( '/\s*,\s*/', $_POST['variants'] );
162
-
163
- $return = array();
164
-
165
- $parent_term_exists = term_exists( $new_variation_set, 'wpsc-variation' );
166
-
167
- // only use an existing parent ID if the term is not a child term
168
- if ( $parent_term_exists ) {
169
- $parent_term = get_term( $parent_term_exists['term_id'], 'wpsc-variation' );
170
- if ( $parent_term->parent == '0' )
171
- $variation_set_id = $parent_term_exists['term_id'];
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'];
179
- }
180
-
181
- if ( empty( $variation_set_id ) )
182
- return new WP_Error( 'wpsc_invalid_variation_id', __( 'Cannot retrieve the variation set in order to proceed.', 'wpsc' ) );
183
-
184
- foreach ( $variants as $variant ) {
185
- $results = wp_insert_term( apply_filters( 'wpsc_new_variant', $variant, $variation_set_id ), 'wpsc-variation', array( 'parent' => $variation_set_id ) );
186
-
187
- if ( is_wp_error( $results ) )
188
- return $results;
189
-
190
- $inserted_variants[] = $results['term_id'];
191
- }
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(
224
- 'variation_set_id' => $variation_set_id,
225
- 'inserted_variants' => $inserted_variants,
226
- 'content' => $content,
227
- );
228
-
229
- return $return;
230
- }
231
-
232
- /**
233
- * Display gateway settings form via AJAX
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() {
244
- require_once( 'settings-page.php' );
245
- require_once( 'includes/settings-tabs/gateway.php' );
246
-
247
- $return = array();
248
- ob_start();
249
- $tab = new WPSC_Settings_Tab_Gateway();
250
- $tab->display_payment_gateway_settings_form();
251
- $return['content'] = ob_get_clean();
252
-
253
- return $return;
254
- }
255
-
256
- /**
257
- * Display shipping module settings form via AJAX
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' );
269
- require_once( 'includes/settings-tabs/shipping.php' );
270
-
271
- $return = array();
272
- ob_start();
273
- $tab = new WPSC_Settings_Tab_Shipping();
274
- $tab->display_shipping_module_settings_form();
275
- $return['content'] = ob_get_clean();
276
-
277
- return $return;
278
- }
279
-
280
- /**
281
- * Display settings tab via AJAX
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' );
293
-
294
- $return = array();
295
- ob_start();
296
- $settings_page = new WPSC_Settings_Page( $_POST['tab'] );
297
- $settings_page->display_current_tab();
298
- $return['content'] = ob_get_clean();
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' );
316
- require_once( 'includes/settings-tabs/general.php' );
317
-
318
- $return = array();
319
- ob_start();
320
- $tab = new WPSC_Settings_Tab_General();
321
- $tab->display_region_drop_down();
322
- $return['content'] = ob_get_clean();
323
-
324
- return $return;
325
- }
326
-
327
- /**
328
- * Save tracking ID of a sales log.
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;
339
-
340
- $result = $wpdb->update(
341
- WPSC_TABLE_PURCHASE_LOGS,
342
- array(
343
- 'track_id' => $_POST['value']
344
- ),
345
- array(
346
- 'id' => $_POST['log_id']
347
- ),
348
- '%s',
349
- '%d'
350
- );
351
-
352
- if ( ! $result )
353
- return new WP_Error( 'wpsc_cannot_save_tracking_id', __( "Couldn't save tracking ID of the transaction. Please try again.", 'wpsc' ) );
354
-
355
- $return = array(
356
- 'rows_affected' => $result,
357
- 'id' => $_POST['log_id'],
358
- 'track_id' => $_POST['value'],
359
- );
360
-
361
- return $return;
362
- }
363
-
364
- /**
365
- * Send sales log tracking email via AJAX
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;
381
-
382
- $id = absint( $_POST['log_id'] );
383
- $sql = $wpdb->prepare( "SELECT `track_id` FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE `id`=%d LIMIT 1", $id );
384
- $trackingid = $wpdb->get_var( $sql );
385
-
386
- $message = get_option( 'wpsc_trackingid_message' );
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 );
394
-
395
- add_filter( 'wp_mail_from', 'wpsc_replace_reply_address', 0 );
396
- add_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name', 0 );
397
-
398
- $result = wp_mail( $email, $subject, $message);
399
-
400
- if ( ! $result )
401
- return new WP_Error( 'wpsc_cannot_send_tracking_email', __( "Couldn't send tracking email. Please try again.", 'wpsc' ) );
402
-
403
- $return = array(
404
- 'id' => $id,
405
- 'tracking_id' => $trackingid,
406
- 'subject' => $subject,
407
- 'message' => $message,
408
- 'email' => $email
409
- );
410
-
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'] );
509
- $file_name = basename( $_REQUEST['file_name'] );
510
-
511
- $result = _wpsc_delete_file( $product_id, $file_name );
512
-
513
- if ( ! $result )
514
- return new WP_Error( 'wpsc_cannot_delete_file', __( "Couldn't delete the file. Please try again.", 'wpsc' ) );
515
-
516
- $return = array(
517
- 'product_id' => $product_id,
518
- 'file_name' => $file_name,
519
- );
520
-
521
- return $return;
522
- }
523
-
524
- /**
525
- * Delete a product meta via AJAX
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'];
537
- if ( ! delete_meta( $meta_id ) )
538
- return new WP_Error( 'wpsc_cannot_delete_product_meta', __( "Couldn't delete product meta. Please try again.", 'wpsc' ) );
539
-
540
- return array( 'meta_id' => $meta_id );
541
- }
542
-
543
- /**
544
- * Modify a purchase log's status.
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'] );
560
- if ( ! $result )
561
- return new WP_Error( 'wpsc_cannot_edit_purchase_log_status', __( "Couldn't modify purchase log's status. Please try again.", 'wpsc' ) );
562
-
563
- $args = array();
564
-
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 );
569
- $purchaselog_table->prepare_items();
570
-
571
- ob_start();
572
- $purchaselog_table->views();
573
- $views = ob_get_clean();
574
-
575
- ob_start();
576
- $purchaselog_table->display_tablenav( 'top' );
577
- $tablenav_top = ob_get_clean();
578
-
579
- ob_start();
580
- $purchaselog_table->display_tablenav( 'bottom' );
581
- $tablenav_bottom = ob_get_clean();
582
-
583
- $return = array(
584
- 'id' => $_POST['id'],
585
- 'new_status' => $_POST['new_status'],
586
- 'views' => $views,
587
- 'tablenav_top' => $tablenav_top,
588
- 'tablenav_bottom' => $tablenav_bottom,
589
- );
590
-
591
- return $return;
592
- }
593
-
594
- /**
595
- * Save product ordering after drag-and-drop sorting
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 ) {
610
- $products[] = (int) str_replace( 'post-', '', $product );
611
- }
612
-
613
- $failed = array();
614
- foreach ( $products as $order => $product_id ) {
615
- $result = wp_update_post( array(
616
- 'ID' => $product_id,
617
- 'menu_order' => $order,
618
- ) );
619
-
620
- if ( ! $result )
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,
631
- );
632
-
633
- return new WP_Error( 'wpsc_cannot_save_product_sort_order', __( "Couldn't save the products' sort order. Please try again.", 'wpsc' ), $error_data );
634
- }
635
-
636
- return array(
637
- 'ids' => $products,
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() {
686
- global $wpdb;
687
-
688
- $checkout_fields = $_REQUEST['sort_order'];
689
- $order = 1;
690
- $failed = array();
691
- $modified = array();
692
- foreach ( $checkout_fields as &$checkout_field ) {
693
- // ignore new fields
694
- if ( strpos( $checkout_field, 'new-field' ) === 0 )
695
- continue;
696
- $checkout_field = absint( preg_replace('/[^0-9]+/', '', $checkout_field ) );
697
- $result = $wpdb->update(
698
- WPSC_TABLE_CHECKOUT_FORMS,
699
- array(
700
- 'checkout_order' => $order
701
- ),
702
- array(
703
- 'id' => $checkout_field
704
- ),
705
- '%d',
706
- '%d'
707
- );
708
- $order ++;
709
- if ( $result === false )
710
- $failed[] = $checkout_field;
711
- elseif ( $result > 0 )
712
- $modified[] = $checkout_field;
713
- }
714
-
715
- if ( ! empty( $failed ) )
716
- return new WP_Error( 'wpsc_cannot_save_checkout_field_sort_order', __( "Couldn't save checkout field sort order. Please try again.", 'wpsc' ), array( 'failed_ids' => $failed ) );
717
-
718
- return array(
719
- 'modified' => $modified,
720
- );
721
- }
722
-
723
- /**
724
- * Save a downloadable file to a product
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() {
742
- global $wpdb;
743
- $product_id = absint( $_POST["product_id"] );
744
- $output = '';
745
- $delete_nonce = _wpsc_create_ajax_nonce( 'delete_file' );
746
-
747
- foreach ( $_POST["select_product_file"] as $selected_file ) {
748
- // if we already use this file, there is no point doing anything more.
749
- $sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'wpsc-product-file' AND post_title = %s", $selected_file ); // TODO it's safer to select by post ID, in that case we will use get_posts()
750
- $file_post_data = $wpdb->get_row( $sql, ARRAY_A );
751
- $selected_file_path = WPSC_FILE_DIR . basename( $selected_file );
752
- $file_url = WPSC_FILE_URL . basename( $selected_file );
753
- $file_size = filesize( $selected_file_path );
754
- if ( empty( $file_post_data ) ) {
755
- $type = wpsc_get_mimetype( $selected_file_path );
756
- $attachment = array(
757
- 'post_mime_type' => $type,
758
- 'post_parent' => $product_id,
759
- 'post_title' => $selected_file,
760
- 'post_content' => '',
761
- 'post_type' => "wpsc-product-file",
762
- 'post_status' => 'inherit'
763
- );
764
- $id = wp_insert_post( $attachment );
765
- } else {
766
- // already attached
767
- if ( $file_post_data['post_parent'] == $product_id )
768
- continue;
769
- $type = $file_post_data["post_mime_type"];
770
- $url = $file_post_data["guid"];
771
- $title = $file_post_data["post_title"];
772
- $content = $file_post_data["post_content"];
773
- // Construct the attachment
774
- $attachment = array(
775
- 'post_mime_type' => $type,
776
- 'guid' => $url,
777
- 'post_parent' => absint( $product_id ),
778
- 'post_title' => $title,
779
- 'post_content' => $content,
780
- 'post_type' => "wpsc-product-file",
781
- 'post_status' => 'inherit'
782
- );
783
- // Save the data
784
- $id = wp_insert_post( $attachment );
785
- }
786
-
787
- $deletion_url = wp_nonce_url( "admin.php?wpsc_admin_action=delete_file&amp;file_name={$attachment['post_title']}&amp;product_id={$product_id}", 'delete_file_' . $attachment['post_title'] );
788
-
789
- $output .= '<tr class="wpsc_product_download_row">';
790
- $output .= '<td style="padding-right: 30px;">' . $attachment['post_title'] . '</td>';
791
- $output .= '<td>' . wpsc_convert_byte( $file_size ) . '</td>';
792
- $output .= '<td>.' . wpsc_get_extension( $attachment['post_title'] ) . '</td>';
793
- $output .= "<td><a data-file-name='" . esc_attr( $attachment['post_title'] ) . "' data-product-id='" . esc_attr( $product_id ) . "' data-nonce='" . esc_attr( $delete_nonce ) . "' class='file_delete_button' href='{$deletion_url}' >" . _x( 'Delete', 'Digital Download UI row', 'wpsc' ) . "</a></td>";
794
- $output .= '<td><a href=' .$file_url .'>' . _x( 'Download', 'Digital Download UI row', 'wpsc' ) . '</a></td>';
795
- $output .= '</tr>';
796
- }
797
-
798
- return array(
799
- 'content' => $output,
800
- );
801
- }
802
-
803
- /**
804
- * Generate variations
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() {
815
- $product_id = absint( $_REQUEST["product_id"] );
816
- wpsc_update_variations();
817
-
818
- ob_start();
819
- wpsc_admin_product_listing( $product_id );
820
- $content = ob_get_clean();
821
-
822
- return array( 'content' => $content );
823
- }
824
-
825
- /**
826
- * Display the shortcode generator.
827
- *
828
- * @since 3.8.9
829
- * @access private
830
- */
831
- function _wpsc_action_tinymce_window() {
832
- require_once( WPSC_CORE_JS_PATH . '/tinymce3/window.php' );
833
- exit;
834
- }
835
- add_action( 'wp_ajax_wpsc_tinymce_window', '_wpsc_action_tinymce_window' );
836
-
837
- /**
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() {
851
- //include taxes controller
852
- $wpec_taxes_controller = new wpec_taxes_controller;
853
-
854
- switch ( $_REQUEST['wpec_taxes_action'] ) {
855
- case 'wpec_taxes_get_regions':
856
- $regions = $wpec_taxes_controller->wpec_taxes->wpec_taxes_get_regions( $_REQUEST['country_code'] );
857
- $key = $_REQUEST['current_key'];
858
- $type = $_REQUEST['taxes_type'];
859
- $default_option = array( 'region_code' => 'all-markets', 'name' => 'All Markets' );
860
- $select_settings = array(
861
- 'id' => "{$type}-region-{$key}",
862
- 'name' => "wpsc_options[wpec_taxes_{$type}][{$key}][region_code]",
863
- 'class' => 'wpsc-taxes-region-drop-down'
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(
870
- 'content' => $returnable,
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();
887
-
888
- exit;
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
905
- );
906
-
907
- $post_ID = intval( $_POST['post_id'] );
908
- if ( current_user_can( 'edit_post', $post_ID ) ) {
909
- $thumbnail_id = intval( $_POST['thumbnail_id'] );
910
-
911
- if ( $thumbnail_id == '-1' )
912
- delete_post_thumbnail( $post_ID );
913
-
914
- set_post_thumbnail( $post_ID, $thumbnail_id );
915
-
916
- $thumbnail = wpsc_the_product_thumbnail( 50, 50, $post_ID, '' );
917
- if ( ! $thumbnail )
918
- $thumbnail = WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif';
919
- $response['src'] = $thumbnail;
920
- $response['success'] = true;
921
- }
922
-
923
- echo json_encode( $response );
924
- exit;
925
- }
926
- add_action( 'wp_ajax_wpsc_set_variation_product_thumbnail', '_wpsc_ajax_set_variation_product_thumbnail' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,36 @@ 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 +1337,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,147 +1354,304 @@ 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 {
1603
- clear: both;
1604
  }
1605
-
1606
- .wpsc_featured div.product_grid_display div.product_grid_item {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1607
  width: 100%;
1608
  height: auto !important;
1609
  margin: 4px 90px 8px 0;
1610
  position: relative;
1611
  }
1612
 
 
1613
  .wpsc_featured .item_text {
1614
  float: left;
1615
  height: 240px;
@@ -1628,12 +1670,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,882 +1687,299 @@ 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 {
1811
  visibility: hidden;
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"],
1997
- #wpsc-product-variations-wrapper .column-tax input[type="text"],
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"],
2009
- #wpsc-product-variations-wrapper .inline-edit-row.column-tax input[type="text"],
2010
- #wpsc-product-variations-wrapper .inline-edit-row.column-price input[type="text"],
2011
- #wpsc-product-variations-wrapper .inline-edit-row.column-sale_price input[type="text"],
2012
- #wpsc-product-variations-wrapper .inline-edit-row.column-sku input[type="text"] {
2013
- width: 60%;
2014
- }
2015
-
2016
- #wpsc-product-variations-wrapper .column-stock,
2017
- #wpsc-product-variations-wrapper .column-tax,
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,
2026
- #wpsc-product-variations-wrapper .column-tax input,
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,
2039
- #wpsc-product-variations-wrapper div.error {
2040
- margin: 15px 0 2px;
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 {
2052
- padding-bottom: 5px;
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 {
2143
- color: #D54E21;
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
-
2158
- .wpsc-save-product-variations.top {
2159
- margin: 8px 0 5px;
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;
2173
- height: 50px;
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
- }
2185
-
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
+ .add_new_form_set {
1325
+ /* display: block;
1326
+ float: left;*/
1327
+ text-decoration: underline;
1328
+ font-weight: bold;
1329
+ font-size:0.9em;
1330
  }
1331
 
1332
+
1333
  p.add_new_form_set_forms {
1334
  display: none;
1335
  }
1337
  td.product-image a img.attachment-thumbnail {
1338
  height: 38px;
1339
  width: 38px;
1340
+
1341
  }
1342
 
1343
  #wpsc_product_category_and_tag_forms .tagchecklist {
1344
+ font-size:11px;
1345
  }
1346
 
1347
+ #categorydiv div{
1348
  margin-top: 4px;
1349
  }
1350
 
1354
  font-size: 15px;
1355
  }
1356
 
1357
+ .toplevel_page_wpsc-edit-products .wrap h2
1358
+ {
1359
+ padding-bottom:0px;
1360
+ border-bottom:1px solid #CCC;
1361
  }
1362
+ #post-body #advanced-sortables
1363
+ {
1364
+ margin-right:300px
1365
  }
 
1366
  #media-buttons #add_audio,
1367
  #media-buttons #add_video,
1368
  #media-buttons #add_media {
1369
+ display:none;
1370
  }
 
1371
  .meta-box-sortables-wpec .postbox:hover .handlediv {
1372
  background: transparent url(../../wpsc-core/images/menu-bits.gif) no-repeat scroll 0% -111px;
1373
  }
1374
+ /* Main Flora Style Sheet for jQuery UI ui-datepicker */
1375
+ #ui-datepicker-div, .ui-datepicker-inline {
1376
+ font-family: Arial,Helvetica,sans-serif;
1377
+ font-size: 14px;
1378
+ padding: 0;
1379
+ margin: 0;
1380
+ background: #E0F4D7;
1381
+ width: 185px;
1382
+ }
1383
+ #ui-datepicker-div {
1384
  display: none;
1385
+ border: 1px solid #21759B;
1386
+ z-index: 10;
1387
  }
1388
+ .ui-datepicker-inline {
1389
+ float: left;
1390
+ display: block;
1391
+ border: 0;
1392
  }
1393
+ .ui-datepicker-rtl {
1394
+ direction: rtl;
 
1395
  }
1396
+ .ui-datepicker-dialog {
1397
+ padding: 5px !important;
1398
+ border: 4px ridge #fff !important;
 
 
1399
  }
1400
+ button.ui-datepicker-trigger {
1401
+ width: 25px;
 
 
 
1402
  }
1403
+ img.ui-datepicker-trigger {
1404
+ margin: 2px;
1405
+ vertical-align: middle;
 
1406
  }
1407
+ .ui-datepicker-prompt {
1408
+ float: left;
1409
+ padding: 2px;
1410
+ background: #fff;
1411
+ color: #000;
1412
  }
1413
+ *html .ui-datepicker-prompt {
1414
+ width: 185px;
1415
+ }
1416
+ .ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {
1417
+ clear: both;
1418
+ float: left;
1419
  width: 100%;
1420
+ color: #FFF;
1421
  }
1422
+ .ui-datepicker-control {
1423
+ background: #fff;
1424
+ padding: 2px 0px;
1425
+ display:none;
1426
  }
1427
+ .ui-datepicker-links {
1428
+ background: #fff;
1429
+ padding: 2px 0px;
1430
+ }
1431
+ .ui-datepicker-control, .ui-datepicker-links {
1432
  font-weight: bold;
1433
+ font-size: 80%;
1434
+ letter-spacing: 1px;
1435
  }
1436
+ .ui-datepicker-links label {
1437
+ padding: 2px 5px;
1438
+ color: #fff;
 
1439
  }
1440
+ .ui-datepicker-clear, .ui-datepicker-prev {
1441
+ float: left;
1442
+ width: 34%;
1443
  }
1444
+ .ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {
1445
+ float: right;
1446
+ text-align: right;
1447
  }
1448
+ .ui-datepicker-current {
1449
+ float: left;
1450
+ width: 30%;
1451
+ text-align: center;
1452
  }
1453
+ .ui-datepicker-close, .ui-datepicker-next {
1454
+ float: right;
1455
+ width: 34%;
1456
+ text-align: right;
1457
  }
1458
+ .ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {
 
 
 
 
1459
  float: left;
1460
+ text-align: left;
 
 
1461
  }
1462
+ .ui-datepicker-header {
1463
+ padding: 1px 0 3px;
1464
+ background: #fff;
1465
+ text-align: center;
1466
+ font-weight: bold;
1467
+ height: 1.3em;
1468
  }
1469
+ .ui-datepicker-header select {
1470
+ background: #fff;
1471
+ color: #000;
1472
+ border: 0px;
1473
+ font-weight: bold;
1474
+ }
1475
+ .ui-datepicker {
1476
+ background: #fff;
1477
+ text-align: center;
1478
+ font-size: 100%;
1479
+ }
1480
+ .ui-datepicker a {
1481
  display: block;
1482
+ width: 100%;
 
 
1483
  }
1484
+ .ui-datepicker-title-row {
1485
+ background: #fff;
1486
+ color: #000;
1487
  }
1488
+ .ui-datepicker-title-row .ui-datepicker-week-end-cell {
1489
+ background: #fff;
 
1490
  }
1491
+ .ui-datepicker-days-row {
1492
+ background: #FFF;
1493
+ color: #666;
 
1494
  }
1495
+ .ui-datepicker-week-col {
1496
+ background: #ededed;
1497
+ color: #000;
1498
  }
1499
+ .ui-datepicker-days-cell {
1500
+ color: #000;
1501
+ border: 1px solid #DDD;
1502
+ }
1503
+ .ui-datepicker-days-cell a {
1504
+ display: block;
1505
+ }
1506
+ .ui-datepicker-week-end-cell {
1507
+ background: #EAF2FA;
1508
+ }
1509
+ .ui-datepicker-unselectable {
1510
+ color: #888;
1511
+ }
1512
+ .ui-datepicker-week-over, .ui-datepicker-week-over .ui-datepicker-week-end-cell {
1513
+ background: #B1DB87 !important;
1514
+ }
1515
+ .ui-datepicker-days-cell-over, .ui-datepicker-days-cell-over.ui-datepicker-week-end-cell {
1516
+ background: #FFF !important;
1517
+ border: 1px solid #777;
1518
+ }
1519
+ * html .ui-datepicker-title-row .ui-datepicker-week-end-cell {
1520
+ background: #ddd !important;
1521
+ }
1522
+ * html .ui-datepicker-week-end-cell {
1523
+ background: #ddd !important;
1524
+ border: 1px solid #DDD !important;
1525
+ }
1526
+ * html .ui-datepicker-days-cell-over {
1527
+ background: #FFF !important;
1528
+ border: 1px solid #777 !important;
1529
+ }
1530
+ * html .ui-datepicker-current-day {
1531
+ background: #d3d3d3 !important;
1532
+ }
1533
+ .ui-datepicker-today {
1534
+ background: #dddddd !important;
1535
+ }
1536
+ .ui-datepicker-current-day {
1537
+ background: #d3d3d3 !important;
1538
+ }
1539
+ .ui-datepicker-status {
1540
+ background: #fff;
1541
+ width: 100%;
1542
+ font-size: 80%;
1543
+ text-align: center;
1544
+ }
1545
+ #ui-datepicker-div a, .ui-datepicker-inline a {
1546
+ cursor: pointer;
1547
+ margin: 0;
1548
+ padding: 0;
1549
+ background: none;
1550
+ color: #000;
1551
+ }
1552
+ .ui-datepicker-inline .ui-datepicker-links a {
1553
+ padding: 0 5px !important;
1554
+ }
1555
+ .ui-datepicker-control a, .ui-datepicker-links a {
1556
+ padding: 2px 5px !important;
1557
+ color: #000 !important;
1558
+ }
1559
+ .ui-datepicker-title-row a {
1560
+ color: #000 !important;
1561
+ }
1562
+ .ui-datepicker-control a:hover {
1563
+ background: #f1f1f1 !important;
1564
+ color: #333 !important;
1565
+ }
1566
+ .ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {
1567
+ background: #FFF !important;
1568
+ color: #333 !important;
1569
+ }
1570
+ .ui-datepicker-multi .ui-datepicker {
1571
+ /* border: 1px solid #83C948; */
1572
+ }
1573
+ .ui-datepicker-one-month {
1574
+ float: left;
1575
+ width: 185px;
1576
+ }
1577
+ .ui-datepicker-new-row {
1578
+ clear: left;
1579
+ }
1580
+ .ui-datepicker-cover {
1581
+ display: none;
1582
+ display: block;
1583
+ position: absolute;
1584
+ z-index: -1;
1585
+ filter: mask();
1586
+ top: -4px;
1587
+ left: -4px;
1588
+ width: 193px;
1589
+ height: 200px;
1590
+ }
1591
+ /* marketing / coupon page styling */
1592
+
1593
+ div.modify_coupon{ border: 1px solid #eeeeee; display: none; width: 100%; }
1594
+ table.coupon_data{
1595
+ width: 100%;
1596
+ }
1597
+ table.add-coupon{width:100%;}
1598
+ table.add-coupon tr th{ text-align: left; padding: 2px 5px 0px 5px; border: none;}
1599
+ table.add-coupon tr td{ text-align: left; padding: 2px 5px 2px 5px; border: none;}
1600
+ table.add-coupon tr td p{padding:0;margin:5px;}
1601
+ #table_header{
1602
+ font-size:16px;
1603
+ margin-top:20px;
1604
+ font-weight: bold;
1605
+ }
1606
+ table.coupon-list{ width: 100%; }
1607
+ table.coupon-list th{ text-align:left;}
1608
+ table.coupon-list tr.toprow td{ text-align: left; font-weight:bold; }
1609
+
1610
+ table.coupon-list tr td{ padding: 5px 5px 10px 10px; vertical-align: middle;}
1611
+
1612
+ table.coupon-list tr.alt{ background-color: #eeeeee; }
1613
+
1614
+ table.coupon-list tr.alt td{ background-color: #eeeeee; }
1615
+ table.coupon-list tr.coupon_edit td{ padding:0; }
1616
+ td#order_summary_container{ width: 80px; }
1617
+ table.category_forms a.delete_button, span.delete_button {
1618
+ color:#FF0000;
1619
+ display:block;
1620
+ float:left;
1621
+ font-size:11px;
1622
+ margin:3px 0 0 8px;
1623
+ text-decoration:underline;
1624
+ }
1625
+ p span.input_label{
1626
+ font-size:1.2em;
1627
+ width:180px;
1628
+ float:left;
1629
+ }
1630
+ a.wpsc_featured_product_toggle {
1631
+ display: block;
1632
+ height: 18px;
1633
+ width: 18px;
1634
+ margin: 4px 0px 0px 6px;
1635
+ }
1636
+
1637
+ a.wpsc_featured_product_toggle img {
1638
+ display: block;
1639
+ margin: 0px auto 0px auto;
1640
+
1641
+ }
1642
+
1643
+ div.wpsc_clear {
1644
+ clear: both;
1645
+ }
1646
+
1647
+ .wpsc_featured div.product_grid_display div.product_grid_item {
1648
  width: 100%;
1649
  height: auto !important;
1650
  margin: 4px 90px 8px 0;
1651
  position: relative;
1652
  }
1653
 
1654
+
1655
  .wpsc_featured .item_text {
1656
  float: left;
1657
  height: 240px;
1670
  height: 240px;
1671
  width: 340px;
1672
  border: 1px solid #FEFAF1;
1673
+ border-radius: 18px;
1674
+ -moz-border-radius: 18px;
1675
  -webkit-border-radius: 18px;
 
 
1676
  background-repeat: no-repeat;
1677
  }
1678
 
1679
+
1680
  .wpsc_featured .item_text h3 {
1681
  font-size: 1.4em;
1682
  margin: 0px 0px 8px 0px;
1687
  line-height: normal;
1688
  display: block;
1689
  margin: 0px 0px 4px 0px;
1690
+
1691
  }
1692
 
1693
  .wpsc_featured .item_text .wpsc_description {
1694
  font-size: 1em;
1695
+ line-height:24px;
1696
+ display:block;
1697
+ float:left;
1698
  width: auto;
1699
  color: #9B9A96;
1700
+ font-family: Georgia,"Bitstream Charter",serif;
1701
  }
1702
 
1703
  .wpsc_featured .item_text .wpsc_description p {
1704
  margin-bottom: 0px;
1705
  }
1706
 
1707
+
1708
  .wpsc_featured .item_text .wpsc_description a {
1709
+ color:#9B9A96;
1710
  }
1711
 
1712
  ul.wpsc_categories {
1713
  clear: both;
1714
  }
1715
 
1716
+ a.update_variations_action
1717
+ {
1718
+ vertical-align:middle;
1719
  }
 
1720
  #poststuff .inside p.update-variations {
1721
+ display:none;
1722
+ margin-top:1em;
1723
  }
1724
+ #search-products{
1725
+ width:auto;
1726
+ float:right;
 
1727
  }
1728
+ .productnav{
1729
+ height: 30px;
1730
+ margin: 6px 0px 4px;
1731
+ vertical-align: middle;
 
1732
  }
1733
 
1734
+ .wpsc_stock_control_forms .edit_stock {
1735
+ margin-top:0.5em;
1736
+ line-height:16px;
1737
  }
1738
+ .wpsc_stock_control_forms .unpublish_when_none_left {
1739
+ margin:0.5em 0;
 
 
1740
  }
 
1741
  #media-upload form p.help {
1742
+ text-align:left;
1743
+ clear:both;
1744
+ }
1745
+ ul#category_list_li, ul.poll-options {
1746
  }
1747
+ ul#category_list_li li div,
1748
+ ul#category_list_li li div ul li div {
1749
+ }
1750
+ ul#category_list_li li div div,
1751
+ ul#category_list_li li div ul li div div {
1752
 
1753
+ }
1754
+ ul#category_list_li li div:hover div{
1755
  }
1756
 
1757
+ ul#category_list_li li div ul li div:hover div {
1758
+ }
1759
+ ul#category_list_li li {
1760
+ }
1761
+ ul#category_list_li li:hover span.handle {
1762
+ cursor: move;
1763
+ }
1764
+ .edit{
1765
+ }
1766
  ul#category_list_li li span.handle {
1767
+ float:left;
1768
+
1769
  padding: 5px;
1770
+
1771
  }
1772
 
1773
+ .category_admin_list_img a.row-title{
1774
  text-decoration: none;
1775
  }
1776
 
1777
+
1778
  .category_admin_list_img:hover div.row-actions {
1779
+ visibility:visible;
1780
  }
1781
 
1782
  ul#category_list_li ul {
1783
+ margin-left:15px;
1784
  }
1785
 
1786
  .row-title img {
1787
+ width:30px;
1788
+ float:left;
1789
+ padding-right:10px;
1790
  }
 
1791
  .row-title {
1792
+ margin-right:5px;
1793
  }
 
1794
  body.edit-php form#posts-filter {
1795
+ min-width:830px;
1796
  }
 
1797
  input.wpsc_cat_image_size {
1798
+ width:40px
1799
  }
 
1800
  input.wpsc_cat_box {
1801
+ width:auto;
1802
+ margin:6px;
 
1803
  }
1804
 
1805
+ .wpsc_ie_field{
1806
+ width:100%;
1807
  }
 
1808
  .wpsc_inline_actions .loading_indicator {
1809
+ position:relative;
1810
+ top:3px;
1811
+ left:2px;
1812
  visibility: hidden;
1813
  }
 
1814
  table.tags th#image {
1815
+ width:60px;
1816
  }
1817
+ /* quick edit product */
1818
+ fieldset.wpsc-cols {
1819
+ width:30% !important;
1820
+ float:left !important;
 
 
 
 
 
 
 
 
 
1821
  }
1822
 
1823
+ .inline-edit-col-left {
1824
+ width:35% !important;
 
1825
  }
1826
 
1827
  .wpsc-quick-edit {
1828
+ width: 30%;
1829
+ float:left;
1830
  }
1831
 
1832
  textarea.tax_input_product_tag {
1833
+ width:50% !important;
1834
+ height: 95px !important;
1835
  }
1836
 
1837
  ul.wpsc_product_category-checklist {
1838
+ height: 280px;
1839
  }
1840
 
1841
+ span.wpsc-quick-edit{
1842
+ width:75px;
1843
+ display: block;
1844
+ float: left;
1845
  }
1846
+ .wpsc_var_description{
1847
+ margin:20px 0 0 20px !important;
1848
+ color:red;
 
1849
  }
1850
 
1851
  .ajax-loading {
1852
  visibility: hidden;
1853
  }
1854
 
 
 
 
 
 
 
 
 
 
1855
  .dashboard_page_wpsc-update .wpsc-progress-bar {
1856
+ position:relative;
1857
+ height:20px;
1858
+ width:300px;
1859
+ border:1px solid #3a58cf;
1860
+ margin:-0.75em 0 27px;
1861
  }
1862
 
1863
  .dashboard_page_wpsc-update .wpsc-progress-bar * {
1864
+ position:absolute;
1865
+ left:0;
1866
+ top:0;
1867
+ background:#f9f9f9;
1868
+ font-size:12px;
1869
  }
1870
 
1871
  .dashboard_page_wpsc-update .wpsc-progress-bar .block {
1872
+ background-color:#527dff;
1873
+ z-index:-1;
1874
+ height:20px;
1875
  }
1876
 
1877
  .dashboard_page_wpsc-update .wpsc-progress-bar span {
1878
+ display:block;
1879
+ left:310px;
1880
+ line-height:20px;
1881
+ width:200px;
1882
  }
1883
 
1884
  .dashboard_page_wpsc-update .wpsc-progress-bar .eta {
1885
+ top:22px;
1886
+ line-height:15px;
1887
+ width:100%;
1888
  }
1889
 
1890
+ .downloadables_float{
1891
  float: right;
1892
+ width:80px;
1893
  vertical-align: middle;
1894
+
1895
  }
1896
 
1897
+ .downloadables_headding1{
1898
  display: inline;
1899
+ float:left;
1900
  text-align: left;
1901
  vertical-align: middle;
1902
  width: auto;
1903
  }
1904
 
1905
  img.ajax-feedback-active {
1906
+ vertical-align:middle;
1907
+ visibility:visible;
1908
  }
1909
 
1910
  .dashboard_page_wpsc-purchase-logs .column-id {
1911
+ width:75px;
1912
  }
1913
 
1914
  .dashboard_page_wpsc-purchase-logs .column-amount {
1915
+ width:100px;
1916
  }
1917
 
1918
+ .js table.purchase-logs td.column-status span, table.purchase-logs .column-status select {
1919
+ display:none;
 
1920
  }
1921
 
1922
  .js table.purchase-logs .column-status select {
1923
+ display:inline-block;
1924
+ margin-right:5px;
1925
  }
1926
 
1927
  table.purchase-logs .column-tracking .empty {
1928
+ position:relative;
1929
  }
1930
 
1931
  table.purchase-logs .column-tracking .empty .send-email {
1932
+ display:none;
1933
  }
1934
 
1935
  table.purchase-logs .column-tracking .add {
1936
+ position:absolute;
1937
+ left:6px;
1938
+ top:4px;
1939
  }
1940
 
1941
  table.purchase-logs .column-tracking {
1942
+ width:200px;
1943
  }
1944
 
1945
  table.purchase-logs .column-tracking input[type="text"] {
1946
+ width:180px;
1947
  }
1948
 
1949
  table.purchase-logs .column-tracking a.save {
1950
+ display:none;
1951
+ float:right;
1952
  }
1953
 
1954
  table.purchase-logs .column-tracking a.add {
1955
+ display:none;
1956
+ color:#ccc;
1957
+ cursor:text;
1958
  }
1959
 
1960
  table.purchase-logs .column-tracking .empty a.add {
1961
+ display:inline;
1962
  }
1963
 
1964
  table.purchase-logs .column-tracking .ajax-feedback {
1965
+ display:none;
1966
+ float:right;
1967
+ margin-top:5px;
1968
  }
1969
 
1970
  table.purchase-logs .column-tracking .ajax-feedback-active {
1971
+ display:inline-block;
1972
  }
1973
 
1974
  table.purchase-logs .column-tracking em.sent {
1975
+ color:green;
1976
  }
1977
 
1978
  table.purchase-logs .column-id .delete {
1979
+ color:red;
1980
+ visibility:hidden;
1981
  }
1982
 
1983
  table.purchase-logs tr:hover .column-id .delete {
1984
+ visibility:visible;
1985
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/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,13 @@ 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 {
@@ -445,21 +435,4 @@ div.wpsc-select-gateway p, div.wpsc_shipping_options p {
445
  }
446
  #wpsc-payment-gateway-settings-panel input[type=text], #wpsc-payment-gateway-settings-panel textarea {
447
  width:265px;
448
- }
449
- table.form-table td .updated.shipwire-update {
450
- display : none;
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, div.wpsc-select-gateway:hover .wpsc-gateway-actions {
430
+ font-size:10px;
431
  visibility:visible;
432
  }
433
  div.wpsc-select-gateway p, div.wpsc_shipping_options p {
435
  }
436
  #wpsc-payment-gateway-settings-panel input[type=text], #wpsc-payment-gateway-settings-panel textarea {
437
  width:265px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  }
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 DELETED
@@ -1,142 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_1() {
4
- _wpsc_fix_checkout_field_limitation();
5
- _wpsc_fix_mexico_currency_sign();
6
- _wpsc_fix_canadian_province_codes();
7
- _wpsc_fix_colombia_currency();
8
- _wpsc_fix_ukraine_currency();
9
- _wpsc_fix_russia_currency();
10
- _wpsc_fix_belarus_currency();
11
- _wpsc_fix_estonia_currency();
12
- _wpsc_fix_slovenia_currency();
13
- _wpsc_fix_sudan_currency();
14
- _wpsc_create_south_sudan();
15
- wpsc_update_permalink_slugs();
16
- }
17
-
18
- function _wpsc_fix_checkout_field_limitation() {
19
- global $wpdb;
20
- $wpdb->query( "ALTER TABLE " . WPSC_TABLE_CHECKOUT_FORMS . " MODIFY options longtext" );
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() {
34
- global $wpdb;
35
-
36
- $correct_provinces = array(
37
- 'AB' => 'Alberta',
38
- 'BC' => 'British Columbia',
39
- 'MB' => 'Manitoba',
40
- 'NB' => 'New Brunswick',
41
- 'NT' => 'Northwest Territories',
42
- 'NS' => 'Nova Scotia',
43
- 'NU' => 'Nunavut',
44
- 'ON' => 'Ontario',
45
- 'PE' => 'Prince Edward Island',
46
- 'QC' => 'Quebec',
47
- 'SK' => 'Saskatchewan',
48
- 'YT' => 'Yukon',
49
- );
50
-
51
- foreach( $correct_provinces as $code => $name ) {
52
- $wpdb->update( WPSC_TABLE_REGION_TAX,
53
- array(
54
- 'code' => $code
55
- ),
56
- array(
57
- 'name' => $name
58
- )
59
- );
60
- }
61
-
62
- $wpdb->update( WPSC_TABLE_REGION_TAX,
63
- array(
64
- 'code' => 'NL',
65
- 'name' => 'Newfoundland and Labrador',
66
- ),
67
- array(
68
- 'name' => 'Newfoundland',
69
- )
70
- );
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() {
133
- $country = new WPSC_Country( array(
134
- 'id' => '242',
135
- 'country' => __( 'South Sudan', 'wpsc' ),
136
- 'isocode' => __( 'SS', 'wpsc' ),
137
- 'currency' => __( 'South Sudanese Pound', 'wpsc' ),
138
- 'code' => __( 'SSP', 'wpsc' ),
139
- 'continent' => 'africa',
140
- 'visible' => 0,
141
- ) );
142
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 DELETED
@@ -1,430 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_2() {
4
- _wpsc_fix_UK_country_code();
5
- _wpsc_fix_guernsey_country_code();
6
- _wpsc_new_country_serbia();
7
- _wpsc_new_country_montenegro();
8
- _wpsc_fix_timor_leste_name();
9
- _wpsc_new_country_aland_islands();
10
- _wpsc_new_country_saint_barthelemy();
11
- _wpsc_new_country_bonaire_et_al();
12
- _wpsc_new_country_curacao();
13
- _wpsc_new_country_saint_martin_french();
14
- _wpsc_new_country_palestinian_territories();
15
- _wpsc_update_israeli_new_shekel_symbol();
16
- _wpsc_new_country_sint_maarten_dutch();
17
- _wpsc_new_country_french_guiana();
18
- _wpsc_fix_netherlands_antille();
19
- _wpsc_fix_angola_kwanza();
20
- _wpsc_fix_aruban_florin();
21
- _wpsc_fix_azerbaijani_manat();
22
- _wpsc_fix_cyprus_currency();
23
- _wpsc_fix_republic_of_the_congo();
24
- _wpsc_fix_currency_el_salvador();
25
- _wpsc_fix_ghanaian_currency_code();
26
- _wpsc_fix_guatemala_currency();
27
- _wpsc_fix_guinea_bissau_currency();
28
- _wpsc_fix_madagascar_currency();
29
- _wpsc_fix_malta_currency();
30
- _wpsc_fix_mozambique_currency();
31
- _wpsc_fix_nicaragua_currency();
32
- _wpsc_fix_romania_currency();
33
- _wpsc_fix_san_marino_currency();
34
- _wpsc_fix_somalia_currency();
35
- _wpsc_fix_suriname_currency();
36
- _wpsc_fix_taiwan_currency();
37
- _wpsc_fix_tajikistan_currency();
38
- _wpsc_fix_tunisia_currency();
39
- _wpsc_fix_uganda_currency();
40
- _wpsc_fix_turkey_currency();
41
- _wpsc_fix_uruguay_currency();
42
- _wpsc_fix_venezuela_currency();
43
- _wpsc_fix_zimbabwe_currency();
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() {
60
- $country = new WPSC_Country( array(
61
- 'id' => 243,
62
- 'country' => __( 'Serbia', 'wpsc' ),
63
- 'isocode' => 'RS',
64
- 'currency' => __('Serbian Dinar', 'wpsc'),
65
- 'code' => __('RSD', 'wpsc'),
66
- 'continent' => 'europe',
67
- 'visible' => '0',
68
- ) );
69
- }
70
-
71
- function _wpsc_new_country_montenegro() {
72
- $country = new WPSC_Country( array(
73
- 'id' => 244,
74
- 'country' => __( 'Montenegro', 'wpsc' ),
75
- 'isocode' => 'ME',
76
- 'currency' => __( 'Euro', 'wpsc' ),
77
- 'symbol' => __( '€', 'wpsc' ),
78
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
79
- 'code' => __( 'EUR', 'wpsc' ),
80
- 'continent' => 'europe',
81
- 'visible' => '0',
82
- ) );
83
- }
84
-
85
- function _wpsc_fix_timor_leste_name() {
86
- $country = new WPSC_Country( array(
87
- 'id' => 245,
88
- 'country' => __( 'Timor-Leste', 'wpsc' ),
89
- 'isocode' => 'TL',
90
- 'currency' => __( 'US Dollar', 'wpsc' ),
91
- 'symbol' => __( '$', 'wpsc' ),
92
- 'symbol_html' => __( '&#036', 'wpsc' ),
93
- 'code' => 'USD',
94
- 'continent' => 'asiapacific',
95
- 'visible' => '0',
96
- ) );
97
- }
98
-
99
- function _wpsc_new_country_aland_islands() {
100
- $country = new WPSC_Country( array(
101
- 'id' => 246,
102
- 'country' => __( 'Aland Islands', 'wpsc' ),
103
- 'isocode' => 'AX',
104
- 'currency' => __( 'Euro', 'wpsc' ),
105
- 'symbol' => __( '€', 'wpsc' ),
106
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
107
- 'code' => __( 'EUR', 'wpsc' ),
108
- 'continent' => 'europe',
109
- 'visible' => '0',
110
- ) );
111
- }
112
-
113
- function _wpsc_new_country_saint_barthelemy() {
114
- $country = new WPSC_Country( array(
115
- 'id' => 247,
116
- 'country' => __( 'Saint Barthelemy', 'wpsc' ),
117
- 'isocode' => 'BL',
118
- 'currency' => __( 'Euro', 'wpsc' ),
119
- 'symbol' => __( '€', 'wpsc' ),
120
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
121
- 'code' => __( 'EUR', 'wpsc' ),
122
- 'continent' => 'europe',
123
- 'visible' => '0',
124
- ) );
125
- }
126
-
127
- function _wpsc_new_country_bonaire_et_al() {
128
- $country = new WPSC_Country( array(
129
- 'id' => 248,
130
- 'country' => __( 'Bonaire, Sint Eustatius and Saba', 'wpsc' ),
131
- 'isocode' => 'BQ',
132
- 'currency' => __( 'US Dollar', 'wpsc' ),
133
- 'symbol' => __( '$', 'wpsc' ),
134
- 'symbol_html' => __( '&#036;', 'wpsc' ),
135
- 'code' => __( 'USD', 'wpsc' ),
136
- 'continent' => 'southamerica',
137
- 'visible' => '0',
138
- ) );
139
- }
140
-
141
- function _wpsc_new_country_curacao() {
142
- $country = new WPSC_Country( array(
143
- 'id' => 249,
144
- 'country' => __( 'Curacao', 'wpsc' ),
145
- 'isocode' => 'CW',
146
- 'currency' => __( 'Netherlands Antillean Guilder', 'wpsc' ),
147
- 'symbol' => __( 'ƒ', 'wpsc' ),
148
- 'symbol_html' => __( '&#402;', 'wpsc' ),
149
- 'code' => __( 'ANG', 'wpsc' ),
150
- 'continent' => 'southamerica',
151
- 'visible' => '0',
152
- ) );
153
- }
154
-
155
- function _wpsc_new_country_saint_martin_french() {
156
- $country = new WPSC_Country( array(
157
- 'id' => 250,
158
- 'country' => __( 'Saint Martin (French Part)', 'wpsc' ),
159
- 'isocode' => 'MF',
160
- 'currency' => __( 'Euro', 'wpsc' ),
161
- 'symbol' => __( '€', 'wpsc' ),
162
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
163
- 'code' => __( 'EUR', 'wpsc' ),
164
- 'continent' => 'southamerica',
165
- 'visible' => '0',
166
- ) );
167
- }
168
-
169
- function _wpsc_new_country_palestinian_territories() {
170
- $country = new WPSC_Country( array(
171
- 'id' => 251,
172
- 'country' => __( 'Palestinian Territories', 'wpsc' ),
173
- 'isocode' => 'PS',
174
- 'currency' => __( 'Israeli New Sheqel', 'wpsc' ),
175
- 'symbol' => __( '₪', 'wpsc' ),
176
- 'symbol_html' => __( '&#8362;', 'wpsc' ),
177
- 'code' => __( 'ILS', 'wpsc' ),
178
- 'continent' => 'asiapacific',
179
- 'visible' => '0',
180
- ) );
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() {
192
- $country = new WPSC_Country( array(
193
- 'id' => 252,
194
- 'country' => __( 'Sint Maarten (Dutch Part)', 'wpsc' ),
195
- 'isocode' => 'SX',
196
- 'currency' => __( 'Netherlands Antillean Guilder', 'wpsc' ),
197
- 'symbol' => __( 'ƒ', 'wpsc' ),
198
- 'symbol_html' => __( '&#402;', 'wpsc' ),
199
- 'code' => __( 'ANG', 'wpsc' ),
200
- 'continent' => 'southamerica',
201
- 'visible' => '0',
202
- ) );
203
- }
204
-
205
- function _wpsc_new_country_french_guiana() {
206
- $country = new WPSC_Country( array(
207
- 'id' => 253,
208
- 'country' => __( 'French Guiana', 'wpsc' ),
209
- 'isocode' => 'GF',
210
- 'currency' => __( 'Euro', 'wpsc' ),
211
- 'symbol' => __( '€', 'wpsc' ),
212
- 'symbol_html' => __( '&#8364;', 'wpsc' ),
213
- 'code' => __( 'EUR', 'wpsc' ),
214
- 'continent' => 'southamerica',
215
- 'visible' => '0',
216
- ) );
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/routines/3.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- function _wpsc_db_upgrade_3() {
4
- _wpsc_maybe_create_UK();
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 DELETED
@@ -1,155 +0,0 @@
1
- <?php
2
- /**
3
- * Upgrade routines
4
- *
5
- * @since 3.8.9
6
- * @access private
7
- * @package wp-e-commerce
8
- */
9
-
10
- /**
11
- * Execute upgrade routines if necessary
12
- *
13
- * @access private
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 ) )
26
- require_once( $file_path );
27
-
28
- if ( ! function_exists( '_wpsc_db_upgrade_' . $i ) )
29
- continue;
30
-
31
- wpsc_core_flush_temporary_data();
32
-
33
- call_user_func( '_wpsc_db_upgrade_' . $i );
34
- update_option( 'wpsc_db_version', $i );
35
-
36
- }
37
-
38
- wpsc_core_flush_temporary_data();
39
-
40
- }
41
-
42
- function _wpsc_upgrade_display_backup_warning() {
43
- $message = __( '<strong>Important:</strong> Before proceeding with the database upgrade, <a href="%1$s">please backup your database and files</a>.<br>We recommend using <a href="%2$s">VaultPress</a> or <a href="%3$s">BackupBuddy</a> to regularly backup your WordPress installation.', 'wpsc' );
44
- $message = sprintf(
45
- $message,
46
- 'http://codex.wordpress.org/WordPress_Backups',
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">
52
- <p><?php echo $message; ?></p>
53
- </div>
54
- <?php
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">
62
- <p><?php echo $message; ?></p>
63
- </div>
64
- <?php
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">
72
- <p><?php echo $message; ?></p>
73
- </div>
74
- <?php
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
-
88
- function _wpsc_needs_3dot7_db_upgrade() {
89
- global $wpdb;
90
-
91
- static $return = null;
92
-
93
- if ( is_null( $return ) ) {
94
- // in case this installation was first installed using 3.8.x, then return false
95
- if ( ! get_option( 'wpsc_needs_update', false ) ) {
96
- $return = false;
97
- } else {
98
- // in case this installation was first installed using 3.7.x, we need to check whether
99
- // the legacy database table exists, and if there are any products remain in that table
100
- $table_exists = $wpdb->get_var( "SHOW TABLES LIKE '" . WPSC_TABLE_PRODUCT_LIST . "'" );
101
- $product_count = empty( $table_exists ) ? 0 : $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST );
102
-
103
- $return = $product_count > 0;
104
- }
105
- }
106
-
107
- return $return;
108
- }
109
-
110
- function _wpsc_needs_upgrade() {
111
- if ( ! current_user_can( 'update_plugins' ) )
112
- return false;
113
-
114
- $current_db_ver = get_option( 'wpsc_db_version', 0 );
115
-
116
- if ( WPSC_DB_VERSION <= $current_db_ver )
117
- return false;
118
-
119
- // if upgrading from 3.7.x, avoid displaying this notification until 3.7.x db has been successfully
120
- // migrated
121
- if ( _wpsc_needs_3dot7_db_upgrade() )
122
- return false;
123
-
124
- return true;
125
- }
126
-
127
- function _wpsc_is_db_upgrade_page() {
128
- $current_screen = get_current_screen();
129
- return ! empty( $current_screen->id ) && 'dashboard_page_wpsc-db-upgrade' == $current_screen->id;
130
- }
131
-
132
- function _wpsc_action_admin_menu_db_upgrade() {
133
- if ( _wpsc_needs_upgrade() ) {
134
- $page_hook = add_submenu_page( 'index.php', __( 'Database Upgrade', 'wpsc' ), __( 'Database Upgrade', 'wpsc' ), 'update_plugins', 'wpsc-db-upgrade', '_wpsc_callback_display_db_upgrade_page' );
135
- add_action( 'load-' . $page_hook, '_wpsc_action_load_db_upgrade' );
136
- }
137
- }
138
- add_action( 'admin_menu', '_wpsc_action_admin_menu_db_upgrade' );
139
-
140
- function _wpsc_action_load_db_upgrade() {
141
- if ( empty( $_REQUEST['action'] ) )
142
- return;
143
-
144
- check_admin_referer( 'wpsc_db_upgrade' );
145
-
146
- _wpsc_maybe_upgrade();
147
-
148
- wp_redirect( add_query_arg( 'wpsc_db_upgrade_successful', 1, admin_url() ) );
149
- exit;
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/db-upgrades/views/main.php DELETED
@@ -1,11 +0,0 @@
1
- <div class="wrap">
2
- <div id="icon-tools" class="icon32"><br></div>
3
- <h2><?php esc_html_e( 'WP eCommerce Database Upgrade', 'wpsc' ); ?></h2>
4
- <form class="wpsc-db-upgrade" action="" method="post">
5
- <h3><?php echo esc_html( $update_title ); ?></h3>
6
- <p><?php esc_html_e( 'Click "Start Database Upgrade" when you are ready.', 'wpsc' ); ?></p>
7
- <?php wp_nonce_field( 'wpsc_db_upgrade' ); ?>
8
- <input type="hidden" name="action" value="start_upgrade" />
9
- <?php submit_button( __( 'Start Database Upgrade', 'wpsc' ), 'primary', 'submit', false ); ?>
10
- </form>
11
- </div>
 
 
 
 
 
 
 
 
 
 
 
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,138 +12,453 @@ 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(
40
  WPSC_TABLE_COUPON_CODES,
41
  array(
42
  'coupon_code' => $coupon_code,
43
  'value' => $discount,
44
- 'is-percentage' => $discount_type,
45
  'use-once' => $use_once,
46
  'is-used' => 0,
47
  'active' => $is_active,
48
  'every_product' => $every_product,
49
  'start' => $start_date,
50
  'expiry' => $end_date,
51
- 'condition' => serialize( $new_rules )
52
  ),
53
  array(
54
  '%s',
55
  '%f',
 
56
  '%s',
57
  '%s',
58
  '%s',
59
  '%s',
60
  '%s',
61
  '%s',
62
- '%s',
63
- '%s',
64
  )
65
  );
66
  if ( $insert )
67
- echo "<div class='updated'><p>" . __( 'The coupon has been added.', 'wpsc' ) . "</p></div>";
68
 
69
  }
70
 
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(
32
  WPSC_TABLE_COUPON_CODES,
33
  array(
34
  'coupon_code' => $coupon_code,
35
  'value' => $discount,
36
+ 'is-percentage' => $discount_type,
37
  'use-once' => $use_once,
38
  'is-used' => 0,
39
  'active' => $is_active,
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'>" . __( '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'] = $coupon_data['start'] . " 00:00:00";
69
+ $coupon_data['expiry'] = $coupon_data['expiry'] . " 00:00:00";
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
+ <script type='text/javascript'>
187
+ jQuery(".pickdate").datepicker();
188
+ /* jQuery datepicker selector */
189
+ if (typeof jQuery('.pickdate').datepicker != "undefined") {
190
+ jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' });
191
  }
192
+ </script>
193
+
194
+ <div class="wrap">
195
+ <h2>
196
+ <?php _e( 'Coupons', 'wpsc' ); ?>
197
+ <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' );">
198
+ <?php _e( 'Add New', 'wpsc' ); ?>
199
+ </a>
200
+ </h2>
201
+
202
+ <table style="width: 100%;">
203
+ <tr>
204
+ <td id="coupon_data">
205
+ <div id='add_coupon_box' class='modify_coupon' >
206
+ <form name='add_coupon' method='post' action=''>
207
+ <table class='add-coupon' >
208
+ <tr>
209
+ <th><?php _e( 'Coupon Code', 'wpsc' ); ?></th>
210
+ <th><?php _e( 'Discount', 'wpsc' ); ?></th>
211
+ <th><?php _e( 'Start', 'wpsc' ); ?></th>
212
+ <th><?php _e( 'Expiry', 'wpsc' ); ?></th>
213
+ <!--
214
+ <th><?php _e( 'Use Once', 'wpsc' ); ?></th>
215
+ <th><?php _e( 'Active', 'wpsc' ); ?></th>
216
+ <th><?php _e( 'Apply On All Products', 'wpsc' ); ?></th>
217
+ -->
218
+
219
+ </tr>
220
+ <tr>
221
+ <td>
222
+ <input type='text' value='' name='add_coupon_code' />
223
+ </td>
224
+ <td>
225
+ <input type='text' value='' size='3' name='add_discount' />
226
+ <select name='add_discount_type'>
227
+ <option value='0' >$</option>
228
+ <option value='1' >%</option>
229
+ <option value='2' ><?php _e( 'Free shipping', 'wpsc' ); ?></option>
230
+ </select>
231
+ </td>
232
+ <td>
233
+ <input type='text' class='pickdate' size='11' value="<?php echo date('Y-m-d'); ?>" name='add_start' />
234
+ </td>
235
+ <td>
236
+ <input type='text' class='pickdate' size='11' name='add_end' value="<?php echo (date('Y')+1) . date('-m-d') ; ?>">
237
+ </td>
238
+ <td>
239
+ <input type='hidden' value='true' name='add_coupon' />
240
+ <input type='submit' value='Add Coupon' name='submit_coupon' class='button-primary' />
241
+ </td>
242
+ </tr>
243
+
244
+ <tr>
245
+ <td colspan='3' scope="row">
246
+ <p>
247
+ <span class='input_label'><?php _e( 'Active', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_active' />
248
+ <input type='checkbox' value='1' checked='checked' name='add_active' />
249
+ <span class='description'><?php _e( 'Activate coupon on creation.', 'wpsc' ) ?></span>
250
+ </p>
251
+ </td>
252
+ </tr>
253
+
254
+ <tr>
255
+ <td colspan='3' scope="row">
256
+ <p>
257
+ <span class='input_label'><?php _e( 'Use Once', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_use-once' />
258
+ <input type='checkbox' value='1' name='add_use-once' />
259
+ <span class='description'><?php _e( 'Deactivate coupon after it has been used.', 'wpsc' ) ?></span>
260
+ </p>
261
+ </td>
262
+ </tr>
263
+
264
+ <tr>
265
+ <td colspan='3' scope="row">
266
+ <p>
267
+ <span class='input_label'><?php _e( 'Apply On All Products', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_every_product' />
268
+ <input type="checkbox" value="1" name='add_every_product'/>
269
+ <span class='description'><?php _e( 'This coupon affects each product at checkout.', 'wpsc' ) ?></span>
270
+ </p>
271
+ </td>
272
+ </tr>
273
+
274
+ <tr><td colspan='3'><span id='table_header'>Conditions</span></td></tr>
275
+ <tr>
276
+ <td colspan="8">
277
+ <div class='coupon_condition' >
278
+ <div class='first_condition'>
279
+ <select class="ruleprops" name="rules[property][]">
280
+ <option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
281
+ <option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
282
+ <option value="total_quantity" rel="order"><?php _e( 'Total quantity', 'wpsc' ); ?></option>
283
+ <option value="subtotal_amount" rel="order"><?php _e( 'Subtotal amount', 'wpsc' ); ?></option>
284
+ <?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
285
+ </select>
286
+
287
+ <select name="rules[logic][]">
288
+ <option value="equal"><?php _e( 'Is equal to', 'wpsc' ); ?></option>
289
+ <option value="greater"><?php _e( 'Is greater than', 'wpsc' ); ?></option>
290
+ <option value="less"><?php _e( 'Is less than', 'wpsc' ); ?></option>
291
+ <option value="contains"><?php _e( 'Contains', 'wpsc' ); ?></option>
292
+ <option value="not_contain"><?php _e( 'Does not contain', 'wpsc' ); ?></option>
293
+ <option value="begins"><?php _e( 'Begins with', 'wpsc' ); ?></option>
294
+ <option value="ends"><?php _e( 'Ends with', 'wpsc' ); ?></option>
295
+ <option value="category"><?php _e( 'In Category', 'wpsc' ); ?></option>
296
+ </select>
297
+
298
+ <span><input type="text" name="rules[value][]"/></span>
299
+
300
+ <span>
301
+ <script>
302
+ var coupon_number=1;
303
+ function add_another_property(this_button){
304
+ var new_property='<div class="coupon_condition">\n'+
305
+ '<div><img height="16" width="16" class="delete" alt="Delete" src="<?php echo WPSC_CORE_IMAGES_URL; ?>/cross.png" onclick="jQuery(this).parent().remove();"/> \n'+
306
+ '<select class="ruleprops" name="rules[property][]"> \n'+
307
+ '<option value="item_name" rel="order">Item name</option> \n'+
308
+ '<option value="item_quantity" rel="order">Item quantity</option>\n'+
309
+ '<option value="total_quantity" rel="order">Total quantity</option>\n'+
310
+ '<option value="subtotal_amount" rel="order">Subtotal amount</option>\n'+
311
+ '<?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>'+
312
+ '</select> \n'+
313
+ '<select name="rules[logic][]"> \n'+
314
+ '<option value="equal">Is equal to</option> \n'+
315
+ '<option value="greater">Is greater than</option> \n'+
316
+ '<option value="less">Is less than</option> \n'+
317
+ '<option value="contains">Contains</option> \n'+
318
+ '<option value="not_contain">Does not contain</option> \n'+
319
+ '<option value="begins">Begins with</option> \n'+
320
+ '<option value="ends">Ends with</option> \n'+
321
+ '</select> \n'+
322
+ '<span> \n'+
323
+ '<input type="text" name="rules[value][]"/> \n'+
324
+ '</span> \n'+
325
+ '</div> \n'+
326
+ '</div> ';
327
+
328
+ jQuery('.coupon_condition :first').after(new_property);
329
+ coupon_number++;
330
+ }
331
+ </script>
332
+ </span>
333
+ </div>
334
+ </div>
335
+ </tr>
336
+
337
+ <tr>
338
+ <td>
339
+ <a class="wpsc_coupons_condition_add" onclick="add_another_property(jQuery(this));">
340
+ <?php _e( 'Add New Condition', 'wpsc' ); ?>
341
+ </a>
342
+ </td>
343
+ </tr>
344
+ </table>
345
+ </form>
346
+ </div>
347
+ </td>
348
+ </tr>
349
+ </table>
350
+
351
  <?php
352
+ $columns = array(
353
+ 'coupon_code' => __( 'Coupon Code', 'wpsc' ),
354
+ 'discount' => __( 'Discount', 'wpsc' ),
355
+ 'start' => __( 'Start', 'wpsc' ),
356
+ 'expiry' => __( 'Expiry', 'wpsc' ),
357
+ 'active' => __( 'Active', 'wpsc' ),
358
+ 'apply_on_prods' => __( 'Apply On All Products', 'wpsc' ),
359
+ 'edit' => __( 'Edit', 'wpsc' )
360
+ );
361
+ register_column_headers( 'display-coupon-details', $columns );
362
+ ?>
363
+
364
+ <table class="coupon-list widefat" cellspacing="0">
365
+ <thead>
366
+ <tr>
367
+ <?php print_column_headers( 'display-coupon-details' ); ?>
368
+ </tr>
369
+ </thead>
370
+
371
+ <tfoot>
372
+ <tr>
373
+ <?php print_column_headers( 'display-coupon-details', false ); ?>
374
+ </tr>
375
+ </tfoot>
376
+
377
+ <tbody>
378
+ <?php
379
+ $i = 0;
380
+ $coupon_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` ", ARRAY_A );
381
+
382
+ foreach ( (array)$coupon_data as $coupon ) {
383
+ $alternate = "";
384
+ $i++;
385
+ if ( ($i % 2) != 0 ) {
386
+ $alternate = "class='alt'";
387
+ }
388
+ echo "<tr $alternate>\n\r";
389
+
390
+ echo " <td>\n\r";
391
+ esc_attr_e( $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
+ echo __("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 date( "d/m/Y", strtotime( esc_attr( $coupon['start'] ) ) );
408
+ echo " </td>\n\r";
409
+
410
+ echo " <td>\n\r";
411
+ echo date( "d/m/Y", strtotime( esc_attr( $coupon['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' >" . __( '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
  *
@@ -20,351 +21,247 @@ require_once(WPSC_FILE_PATH . '/wpsc-admin/includes/products.php');
20
  *
21
  */
22
  function wpsc_additional_column_names( $columns ){
23
- $columns = array();
24
-
25
- $columns['cb'] = '<input type="checkbox" />';
26
- $columns['image'] = '';
27
- $columns['title'] = __('Name', 'wpsc');
28
- $columns['stock'] = __('Stock', 'wpsc');
29
- $columns['price'] = __('Price', 'wpsc');
30
- $columns['sale_price'] = __('Sale', 'wpsc');
31
- $columns['SKU'] = __('SKU', 'wpsc');
32
- $columns['weight'] = __('Weight', 'wpsc');
33
- $columns['cats'] = __('Categories', 'wpsc');
34
- $columns['featured'] = '<img src="' . WPSC_CORE_IMAGES_URL . '/black-star.png" alt="' . __( 'Featured', 'wpsc' ) . '" title="' . __( 'Featured', 'wpsc' ) . '">';
35
- $columns['hidden_alerts'] = '';
36
- $columns['date'] = __('Date', 'wpsc');
37
-
38
- return $columns;
39
  }
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';
48
- $columns['price'] = 'price';
49
- $columns['sale_price'] = 'sale_price';
50
- $columns['SKU'] = 'SKU';
51
 
52
- return $columns;
53
  }
54
-
55
- /**
56
- * Image column in Manage Products page
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' );
69
-
70
- if ( $src )
71
- echo '<img src="' . esc_url( $src ). '" alt="" />';
72
- else
73
- echo '<img src="' . esc_url( WPSC_CORE_IMAGES_URL . '/no-image-uploaded.gif' ) . '" width="38" height="38" />';
74
- }
75
- add_action( 'wpsc_manage_products_column_image', '_wpsc_manage_products_column_image', 10, 2 );
76
-
77
- /**
78
- * Weight column in Manage Products page
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 ) {
96
- esc_html_e( 'N/A', 'wpsc' );
97
- return;
98
- }
99
- $product_data = array();
100
- $product_data['meta'] = array();
101
- $product_data['meta'] = get_post_meta( $post->ID, '' );
102
- foreach( $product_data['meta'] as $meta_name => $meta_value ) {
103
- $product_data['meta'][$meta_name] = maybe_unserialize( array_pop( $meta_value ) );
104
- }
105
-
106
- $product_data['transformed'] = array();
107
- if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight'] ) )
108
- $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
109
- if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight_unit'] ) )
110
- $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
111
-
112
- $product_data['transformed']['weight'] = wpsc_convert_weight( $product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'] );
113
-
114
- $weight = $product_data['transformed']['weight'];
115
- if( $weight == '' )
116
- $weight = '0';
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 );
124
 
125
  /**
126
- * Stock column in Manage Products page.
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 );
141
-
142
- if( $stock == '' )
143
- $stock = __('N/A', 'wpsc');
144
-
145
- if ( $has_variations ) {
146
- echo '~ ' . wpsc_variations_stock_remaining( $post->ID );
147
- return;
148
- }
149
-
150
- echo $stock;
151
- echo '<div id="inline_' . $post->ID . '_stock" class="hidden">' . esc_html( $stock ) . '</div>';
152
-
153
- }
154
- add_action( 'wpsc_manage_products_column_stock', '_wpsc_manage_products_column_stock', 10, 3 );
155
-
156
- /**
157
- * Price column in Manage Products page
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
-
187
- /**
188
- * Sale price column in Manage Products page.
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 );
203
- if( ! $has_variations ) {
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
-
211
- /**
212
- * SKU column in Manage Products page
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 );
225
- if( $sku == '' )
226
- $sku = __('N/A', 'wpsc');
227
-
228
- echo $sku;
229
- echo '<div id="inline_' . $post->ID . '_sku" class="hidden">' . esc_html( $sku ) . '</div>';
230
- }
231
- add_action( 'wpsc_manage_products_column_sku', '_wpsc_manage_products_column_sku', 10, 2 );
232
-
233
- /**
234
- * Categories column in Manage Products page
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 );
248
- if ( !empty( $categories ) ) {
249
- $out = array();
250
- foreach ( $categories as $c )
251
- $out[] = "<a href='?post_type=wpsc-product&amp;wpsc_product_category={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . "</a>";
252
- echo join( ', ', $out );
253
- } else {
254
- _e('Uncategorized', 'wpsc');
255
- }
256
- }
257
- add_action( 'wpsc_manage_products_column_cats', '_wpsc_manage_products_column_cats', 10, 2 );
258
-
259
- /**
260
- * Featured column in Manage Products page.
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
-
286
- /**
287
- * Product alert column in Manage Products page
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 );
299
- if( !empty( $product_alert['messages'] ) )
300
- $product_alert['messages'] = implode( "\n",( array )$product_alert['messages'] );
301
-
302
- if( $product_alert['state'] === true ) {
303
- ?>
304
- <img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_CORE_IMAGES_URL;?>/product-alert.jpg' alt='' />
305
- <?php
306
- }
307
-
308
- // If a product alert has stuff to display, show it.
309
- // Can be used to add extra icons etc
310
- if ( !empty( $product_alert['display'] ) )
311
- echo $product_alert['display'];
312
- }
313
- add_action( 'wpsc_manage_products_column_hidden_alerts', '_wpsc_manage_products_column_hidden_alerts', 10, 2 );
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 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
 
334
- $is_parent = wpsc_product_has_children($post_id);
335
- $column = strtolower( $column );
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;
346
 
347
- switch ( $vars['orderby'] ) :
348
- case 'stock' :
349
- $vars = array_merge(
350
  $vars,
351
  array(
352
  'meta_key' => '_wpsc_stock',
353
  'orderby' => 'meta_value_num'
354
  )
355
  );
356
- break;
357
  case 'price' :
358
- $vars = array_merge(
359
  $vars,
360
  array(
361
  'meta_key' => '_wpsc_price',
362
  'orderby' => 'meta_value_num'
363
  )
364
  );
365
- break;
366
- case 'sale_price' :
367
- $vars = array_merge(
368
  $vars,
369
  array(
370
  'meta_key' => '_wpsc_special_price',
@@ -372,26 +269,20 @@ function wpsc_column_sql_orderby( $vars ) {
372
  )
373
  );
374
 
375
- break;
376
  case 'SKU' :
377
- $vars = array_merge(
378
  $vars,
379
  array(
380
  'meta_key' => '_wpsc_sku',
381
  'orderby' => 'meta_value'
382
  )
383
  );
384
- break;
385
  endswitch;
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
 
@@ -406,22 +297,14 @@ function wpsc_cats_restrict_manage_posts() {
406
  // retrieve array of term objects per taxonomy
407
  // output html for taxonomy dropdown filter
408
  echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
409
- echo "<option value=''>" . esc_html( sprintf( _x( 'Show All %s', 'Show all [category name]', 'wpsc' ), $tax_name ) ) . "</option>";
410
  wpsc_cats_restrict_manage_posts_print_terms($tax_slug);
411
  echo "</select>";
412
  }
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,19 +315,20 @@ 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;
444
 
445
- $vars['post_parent'] = 0;
446
 
447
- return $vars;
448
  }
449
 
450
  /**
@@ -452,53 +336,20 @@ 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,82 +357,56 @@ 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;
578
 
579
- $url = admin_url( 'edit.php' );
580
- $url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
581
 
582
- $actions['duplicate'] = '<a href="'.esc_url( $url ).'">' . esc_html_x( 'Duplicate', 'row-actions', 'wpsc' ) . '</a>';
583
- return $actions;
 
584
  }
585
 
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
  *
21
  *
22
  */
23
  function wpsc_additional_column_names( $columns ){
24
+ $columns = array();
25
+
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';
44
+ $columns['price'] = 'price';
45
+ $columns['sale_price'] = 'sale_price';
46
+ $columns['SKU'] = 'SKU';
47
 
48
+ return $columns;
49
  }
50
+ function wpsc_additional_column_name_variations( $columns ){
51
+ global $post;
52
+
53
+ if(isset($post) && $post->post_parent != '0' )
54
+ remove_meta_box( 'wpsc_product_variation_forms', 'wpsc-product', 'normal' );
55
+
56
+ $columns['image'] = '';
57
+ $columns['title'] = __('Name', 'wpsc');
58
+ $columns['weight'] = __('Weight', 'wpsc');
59
+ $columns['stock'] = __('Stock', 'wpsc');
60
+ $columns['price'] = __('Price', 'wpsc');
61
+ $columns['sale_price'] = __('Sale Price', 'wpsc');
62
+ $columns['SKU'] = __('SKU', 'wpsc');
63
+ $columns['hidden_alerts'] = '';
64
+
65
+ //For BC for 3.0 (hoping to remove for WPEC 3.9)
66
+ register_column_headers( 'wpsc-product_variants', $columns );
67
+ return apply_filters( 'wpsc_variation_column_headers', $columns);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
 
69
 
70
  /**
71
+ * wpsc_additional_column_data.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  *
73
  * @access public
 
74
  * @param (array) $column
75
  * @return void
 
76
  * @todo Need to check titles / alt tags ( I don't think thumbnails have any in this code )
77
  * @desc Switch function to generate columns the right way...no more UI hacking!
78
  *
 
 
 
79
  */
80
+ function wpsc_additional_column_data( $column ) {
81
+ global $post;
82
+
83
+ $is_parent = ( bool )wpsc_product_has_children($post->ID);
84
+ switch ( $column ) :
85
+
86
+ case 'image' :
87
+
88
+ $attached_images = get_posts( array(
89
+ 'post_type' => 'attachment',
90
+ 'numberposts' => 1,
91
+ 'post_parent' => $post->ID,
92
+ 'orderby' => 'menu_order',
93
+ 'order' => 'ASC'
94
+ ) );
95
+
96
+ if( isset( $post->ID ) && has_post_thumbnail( $post->ID ) )
97
+ echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
98
+ else if( !empty( $attached_images ) ) {
99
+ $attached_image = $attached_images[0];
100
+ $src = wp_get_attachment_url( $attached_image->ID );
101
+ ?>
102
+ <div style='width:38px; height:38px; overflow:hidden;'>
103
+ <img src='<?php echo $src; ?>' alt='<?php _e( 'Drag to a new position', 'wpsc' ); ?>' width='38' height='38' />
104
+ </div>
105
+ <?php
106
+ } else {
107
+ $image_url = WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif";
108
+ ?>
109
+ <img src='<?php echo $image_url; ?>' alt='<?php _e( 'Drag to a new position', 'wpsc' ); ?>' width='38' height='38' />
110
+ <?php
111
+ }
112
+ break;
113
+ case 'weight' :
114
+
115
+ if( $is_parent ) :
116
+ _e( 'N/A', 'wpsc' );
117
+ else :
118
+ $product_data['meta'] = array();
119
+ $product_data['meta'] = get_post_meta( $post->ID, '' );
120
+ foreach( $product_data['meta'] as $meta_name => $meta_value )
121
+ $product_data['meta'][$meta_name] = maybe_unserialize( array_pop( $meta_value ) );
122
+
123
+ $product_data['transformed'] = array();
124
+ if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight'] ) )
125
+ $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
126
+ if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight_unit'] ) )
127
+ $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
128
+
129
+ $product_data['transformed']['weight'] = wpsc_convert_weight( $product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'] );
130
+
131
+ $weight = $product_data['transformed']['weight'];
132
+ if( $weight == '' )
133
+ $weight = '0';
134
+
135
+ $unit = $product_data['meta']['_wpsc_product_metadata']['weight_unit'];
136
+
137
+ switch( $unit ) {
138
+ case "pound":
139
+ $unit = __(" lbs.", "wpsc");
140
+ break;
141
+ case "ounce":
142
+ $unit = __(" oz.", "wpsc");
143
+ break;
144
+ case "gram":
145
+ $unit = __(" g", "wpsc");
146
+ break;
147
+ case "kilograms":
148
+ case "kilogram":
149
+ $unit = __(" kgs.", "wpsc");
150
+ break;
151
+ }
152
+ echo $weight.$unit;
153
+ echo '<div id="inline_' . $post->ID . '_weight" class="hidden">' . $weight . '</div>';
154
+
155
+ endif;
156
+ break;
157
+ case 'stock' :
158
+ $stock = get_post_meta( $post->ID, '_wpsc_stock', true );
159
+ if( $stock == '' )
160
+ $stock = __('N/A', 'wpsc');
161
+ if( !$is_parent ) {
162
+ echo $stock;
163
+ echo '<div id="inline_' . $post->ID . '_stock" class="hidden">' . $stock . '</div>';
164
+ }
165
+ else
166
+ echo '~'.wpsc_variations_stock_remaining( $post->ID );
167
+ break;
168
+ case 'price' :
169
+ $price = get_post_meta( $post->ID, '_wpsc_price', true );
170
+ $has_var = '1';
171
+ if( !$is_parent ) {
172
+ echo wpsc_currency_display( $price );
173
+ echo '<div id="inline_' . $post->ID . '_price" class="hidden">' . trim($price) . '</div>';
174
+ $has_var = '0';
175
+ }
176
+ else
177
+ echo wpsc_product_variation_price_available( $post->ID ).'+';
178
+ echo '<input type="hidden" value="'.$has_var.'" id="inline_' . $post->ID . '_has_var" />';
179
+
180
+ break;
181
+ case 'sale_price' :
182
+ $price = get_post_meta( $post->ID, '_wpsc_special_price', true );
183
+ if( !$is_parent ) {
184
+ echo wpsc_currency_display( $price );
185
+ echo '<div id="inline_' . $post->ID . '_sale_price" class="hidden">' . $price . '</div>';
186
+ } else
187
+ echo wpsc_product_variation_price_available( $post->ID ).'+';
188
+ break;
189
+ case 'SKU' :
190
+ $sku = get_post_meta( $post->ID, '_wpsc_sku', true );
191
+ if( $sku == '' )
192
+ $sku = __('N/A', 'wpsc');
193
+
194
+ echo $sku;
195
+ echo '<div id="inline_' . $post->ID . '_sku" class="hidden">' . $sku . '</div>';
196
+ break;
197
+ case 'cats' :
198
+ $categories = get_the_product_category( $post->ID );
199
+ if ( !empty( $categories ) ) {
200
+ $out = array();
201
+ foreach ( $categories as $c )
202
+ $out[] = "<a href='?post_type=wpsc-product&amp;wpsc_product_category={$c->slug}'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . "</a>";
203
+ echo join( ', ', $out );
204
+ } else {
205
+ _e('Uncategorized', 'wpsc');
206
+ }
207
+ break;
208
+ case 'featured' :
209
+ $featured_product_url = wp_nonce_url( "index.php?wpsc_admin_action=update_featured_product&amp;product_id=$post->ID", 'feature_product_' . $post->ID);
210
+ ?>
211
+ <a class="wpsc_featured_product_toggle featured_toggle_<?php echo $post->ID; ?>" href='<?php echo $featured_product_url; ?>' >
212
+ <?php if ( in_array( $post->ID, (array)get_option( 'sticky_products' ) ) ) : ?>
213
+ <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' ); ?>' />
214
+ <?php else: ?>
215
+ <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' ); ?>' />
216
+ <?php endif; ?>
217
+ </a>
218
+ <?php
219
+ break;
220
+ case 'hidden_alerts' :
221
+ $product_alert = apply_filters( 'wpsc_product_alert', array( false, '' ), $post );
222
+ if( !empty( $product_alert['messages'] ) )
223
+ $product_alert['messages'] = implode( "\n",( array )$product_alert['messages'] );
224
+
225
+ if( $product_alert['state'] === true ) {
226
+ ?>
227
+ <img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_CORE_IMAGES_URL;?>/product-alert.jpg' alt='' />
228
+ <?php
229
+ }
230
+
231
+ // If a product alert has stuff to display, show it.
232
+ // Can be used to add extra icons etc
233
+ if ( !empty( $product_alert['display'] ) )
234
+ echo $product_alert['display'];
235
+ break;
236
+ endswitch;
237
 
 
 
 
238
  }
 
 
 
 
 
239
  function wpsc_column_sql_orderby( $vars ) {
240
+
241
  if ( ! isset( $vars['post_type'] ) || 'wpsc-product' != $vars['post_type'] || ! isset( $vars['orderby'] ) )
242
+ return $vars;
243
 
244
+ switch ( $vars['orderby'] ) :
245
+ case 'stock' :
246
+ $vars = array_merge(
247
  $vars,
248
  array(
249
  'meta_key' => '_wpsc_stock',
250
  'orderby' => 'meta_value_num'
251
  )
252
  );
253
+ break;
254
  case 'price' :
255
+ $vars = array_merge(
256
  $vars,
257
  array(
258
  'meta_key' => '_wpsc_price',
259
  'orderby' => 'meta_value_num'
260
  )
261
  );
262
+ break;
263
+ case 'sale_price' :
264
+ $vars = array_merge(
265
  $vars,
266
  array(
267
  'meta_key' => '_wpsc_special_price',
269
  )
270
  );
271
 
272
+ break;
273
  case 'SKU' :
274
+ $vars = array_merge(
275
  $vars,
276
  array(
277
  'meta_key' => '_wpsc_sku',
278
  'orderby' => 'meta_value'
279
  )
280
  );
281
+ break;
282
  endswitch;
283
 
284
  return $vars;
285
  }
 
 
 
 
 
 
286
  function wpsc_cats_restrict_manage_posts() {
287
  global $typenow;
288
 
297
  // retrieve array of term objects per taxonomy
298
  // output html for taxonomy dropdown filter
299
  echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
300
+ echo "<option value=''>" . sprintf(_x('Show All %s', 'Show all [category name]', 'wpsc'), $tax_name) . "</option>";
301
  wpsc_cats_restrict_manage_posts_print_terms($tax_slug);
302
  echo "</select>";
303
  }
304
  }
305
  }
306
 
307
+ function wpsc_cats_restrict_manage_posts_print_terms($taxonomy, $parent = 0, $level = 0){
 
 
 
 
 
 
 
 
308
  $prefix = str_repeat( '&nbsp;&nbsp;&nbsp;' , $level );
309
  $terms = get_terms( $taxonomy, array( 'parent' => $parent, 'hide_empty' => false ) );
310
  if( !($terms instanceof WP_Error) && !empty($terms) )
315
  }
316
 
317
  /**
318
+ * wpsc no minors allowed
319
  * Restrict the products page to showing only parent products and not variations.
 
320
  * @since 3.8
321
  */
322
+
323
  function wpsc_no_minors_allowed( $vars ) {
324
+ global $current_screen;
325
 
326
+ if( $current_screen->post_type != 'wpsc-product' )
327
+ return $vars;
328
 
329
+ $vars['post_parent'] = 0;
330
 
331
+ return $vars;
332
  }
333
 
334
  /**
336
  *
337
  * Only sorts columns on edit.php page.
338
  * @since 3.8.8
 
 
339
  */
 
 
 
 
340
 
341
+ function wpsc_sortable_column_load() {
342
+ add_filter( 'request', 'wpsc_no_minors_allowed' );
343
+ add_filter( 'request', 'wpsc_column_sql_orderby', 8 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  }
345
 
346
+ add_action( 'load-edit.php', 'wpsc_sortable_column_load' );
347
+ add_action( 'admin_head', 'wpsc_additional_column_name_variations' );
348
+ add_action( 'restrict_manage_posts', 'wpsc_cats_restrict_manage_posts' );
349
+ add_action( 'manage_pages_custom_column', 'wpsc_additional_column_data', 10, 2 );
 
350
  add_filter( 'manage_edit-wpsc-product_sortable_columns', 'wpsc_additional_sortable_column_names' );
351
+ add_filter( 'manage_edit-wpsc-product_columns', 'wpsc_additional_column_names' );
352
+ add_filter( 'manage_wpsc-product_posts_columns', 'wpsc_additional_column_names' );
353
 
354
 
355
 
357
  * wpsc_update_featured_products function.
358
  *
359
  * @access public
360
+ * @todo Should be refactored to e
361
  * @return void
 
 
 
 
 
 
362
  */
363
  function wpsc_update_featured_products() {
364
+ $is_ajax = (int)(bool)$_POST['ajax'];
365
+ $product_id = absint( $_GET['product_id'] );
366
+ check_admin_referer( 'feature_product_' . $product_id );
 
 
 
 
 
 
 
 
 
 
367
  $status = get_option( 'sticky_products' );
368
 
369
+ $new_status = (in_array( $product_id, $status )) ? false : true;
370
 
371
  if ( $new_status ) {
372
+
373
  $status[] = $product_id;
374
  } else {
375
  $status = array_diff( $status, array( $product_id ) );
376
  $status = array_values( $status );
377
  }
378
+ update_option( 'sticky_products', $status );
379
 
380
+ if ( $is_ajax == true ) {
381
+ if ( $new_status == true ) : ?>
382
+ jQuery('.featured_toggle_<?php echo $product_id; ?>').html("<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' ); ?>' />");
383
+ <?php else: ?>
384
+ jQuery('.featured_toggle_<?php echo $product_id; ?>').html("<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' ); ?>' />");
385
+ <?php
386
+ endif;
 
 
 
 
 
 
 
387
  exit();
388
  }
389
  wp_redirect( wp_get_referer() );
390
+ exit();
391
  }
392
 
393
+ add_filter( 'page_row_actions','my_action_row', 10, 2 );
394
 
395
+ function my_action_row( $actions, $post ) {
 
 
 
 
 
 
 
 
 
 
396
 
397
+ if ( $post->post_type != "wpsc-product" )
398
+ return $actions;
399
 
400
+ $url = admin_url( 'edit.php' );
401
+ $url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
402
 
403
+ $actions['duplicate'] = '<a href="'.esc_url( $url ).'">'._x( 'Duplicate', 'row-actions', 'wpsc' ).'</a>';
404
+
405
+ return $actions;
406
  }
407
 
408
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) )
409
+ add_action( 'admin_init', 'wpsc_update_featured_products' );
410
+
411
+ if ( isset( $_GET['wpsc_admin_action'] ) && ( $_GET['wpsc_admin_action'] == 'duplicate_product' ) )
412
+ add_action( 'admin_init', 'wpsc_duplicate_product' );
wpsc-admin/display-options-settings.page.php CHANGED
@@ -23,6 +23,26 @@ function wpsc_the_settings_tabs() {
23
  WPSC_Settings_Page::get_instance()->output_tabs();
24
  }
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  function wpsc_settings_page_update_notification() {
27
 
28
  if ( isset( $_GET['skipped'] ) || isset( $_GET['updated'] ) || isset( $_GET['regenerate'] ) || isset( $_GET['deleted'] ) || isset( $_GET['shipadd'] ) ) { ?>
@@ -51,10 +71,10 @@ function wpsc_settings_page_update_notification() {
51
  $message = true;
52
  }
53
 
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
23
  WPSC_Settings_Page::get_instance()->output_tabs();
24
  }
25
 
26
+ function country_list( $selected_country = null ) {
27
+ global $wpdb;
28
+
29
+ $output = '';
30
+ $output .= "<option value=''></option>";
31
+ $country_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
32
+
33
+ foreach ( (array)$country_data as $country ) {
34
+ $selected = '';
35
+
36
+ if ( $selected_country == $country['isocode'] )
37
+ $selected = "selected='selected'";
38
+
39
+ $output .= "<option value='" . $country['isocode'] . "' $selected>" . htmlspecialchars( $country['country'] ) . "</option>";
40
+ }
41
+
42
+ return $output;
43
+ }
44
+
45
+
46
  function wpsc_settings_page_update_notification() {
47
 
48
  if ( isset( $_GET['skipped'] ) || isset( $_GET['updated'] ) || isset( $_GET['regenerate'] ) || isset( $_GET['deleted'] ) || isset( $_GET['shipadd'] ) ) { ?>
71
  $message = true;
72
  }
73
 
74
+ if ( !isset( $message ) )
75
  _e( 'Settings successfully updated.', 'wpsc' );
76
 
77
+ $_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'] ) ); ?>
78
  </p></div>
79
 
80
  <?php
wpsc-admin/display-sales-logs.php CHANGED
@@ -8,441 +8,378 @@
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 _ex( 'Select an Option', 'Dropdown default when called in uniquename dropdown', 'wpsc' ); ?>'</option>
52
+ <option value='billingfirstname'><?php _e( 'Billing First Name', 'wpsc' ); ?></option>
53
+ <option value='billinglastname'><?php _e( 'Billing Last Name', 'wpsc' ); ?></option>
54
+ <option value='billingaddress'><?php _e( 'Billing Address', 'wpsc' ); ?></option>
55
+ <option value='billingcity'><?php _e( 'Billing City', 'wpsc' ); ?></option>
56
+ <option value='billingstate'><?php _e( 'Billing State', 'wpsc' ); ?></option>
57
+ <option value='billingcountry'><?php _e( 'Billing Country', 'wpsc' ); ?></option>
58
+ <option value='billingemail'><?php _e( 'Billing Email', 'wpsc' ); ?></option>
59
+ <option value='billingphone'><?php _e( 'Billing Phone', 'wpsc' ); ?></option>
60
+ <option value='billingpostcode'><?php _e( 'Billing Post Code', 'wpsc' ); ?></option>
61
+ <option value='shippingfirstname'><?php _e( 'Shipping First Name', 'wpsc' ); ?></option>
62
+ <option value='shippinglastname'><?php _e( 'Shipping Last Name', 'wpsc' ); ?></option>
63
+ <option value='shippingaddress'><?php _e( 'Shipping Address', 'wpsc' ); ?></option>
64
+ <option value='shippingcity'><?php _e( 'Shipping City', 'wpsc' ); ?></option>
65
+ <option value='shippingstate'><?php _e( 'Shipping State', 'wpsc' ); ?></option>
66
+ <option value='shippingcountry'><?php _e( 'Shipping Country', 'wpsc' ); ?></option>
67
+ <option value='shippingpostcode'><?php _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' ), 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
+ if ( ! empty($purchlogitem->customcheckoutfields ) ) {
135
+ ?>
136
+ <div class="metabox-holder">
137
+ <div id="custom_checkout_fields" class="postbox">
138
+ <h3 class='hndle'><?php _e( 'Additional Checkout Fields' , 'wpsc' ); ?></h3>
139
+ <div class='inside'>
140
+ <?php
141
+ foreach((array)$purchlogitem->customcheckoutfields as $key=>$value){
142
+ $value['value'] = maybe_unserialize($value['value']);
143
+ if(is_array($value['value'])){
144
+ ?>
145
+ <p><strong><?php echo $key; ?> :</strong> <?php echo implode(stripslashse($value['value']), ','); ?></p>
146
+ <?php
147
+ }else{
148
+ ?>
149
+ <p><strong><?php echo $key; ?> :</strong> <?php echo stripslashes($value['value']); ?></p>
150
+ <?php
151
+ }
152
+ }
153
+ ?>
154
+ </div>
155
+ </div>
156
+ </div>
157
+ <?php
158
+ }
159
+ }
160
+
161
+ private function purchase_log_custom_fields(){
162
+ if( wpsc_purchlogs_has_customfields() ){?>
163
+ <div class='metabox-holder'>
164
+ <div id='purchlogs_customfields' class='postbox'>
165
+ <h3 class='hndle'><?php _e( 'Users Custom Fields' , 'wpsc' ); ?></h3>
166
+ <div class='inside'>
167
+ <?php $messages = wpsc_purchlogs_custommessages(); ?>
168
+ <?php $files = wpsc_purchlogs_customfiles(); ?>
169
+ <?php if(count($files) > 0){ ?>
170
+ <h4><?php _e( 'Cart Items with Custom Files' , 'wpsc' ); ?>:</h4>
171
+ <?php
172
+ foreach($files as $file){
173
+ echo $file;
174
+ }
175
+ }?>
176
+ <?php if(count($messages) > 0){ ?>
177
+ <h4><?php _e( 'Cart Items with Custom Messages' , 'wpsc' ); ?>:</h4>
178
+ <?php
179
+ foreach($messages as $message){
180
+ echo $message;
181
+ }
182
+ } ?>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ <?php
187
+ }
188
+ }
189
+
190
+ private function purchase_log_cart_items() {
191
+ while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item(); ?>
192
+ <tr>
193
+ <td><?php echo wpsc_purchaselog_details_name(); ?></td> <!-- NAME! -->
194
+ <td><?php echo wpsc_purchaselog_details_SKU(); ?></td> <!-- SKU! -->
195
+ <td><?php echo wpsc_purchaselog_details_quantity(); ?></td> <!-- QUANTITY! -->
196
+ <td>
197
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  echo wpsc_currency_display( wpsc_purchaselog_details_price() );
199
  do_action( 'wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id() );
200
+ ?>
201
  </td> <!-- PRICE! -->
202
+ <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_shipping() ); ?></td> <!-- SHIPPING! -->
203
+ <?php if( wpec_display_product_tax() ): ?>
204
+ <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_tax() ); ?></td> <!-- TAX! -->
205
+ <?php endif; ?>
206
+ <!-- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_discount() ); ?></td> --> <!-- DISCOUNT! -->
207
+ <td class="amount"><?php echo wpsc_currency_display( wpsc_purchaselog_details_total() ); ?></td> <!-- TOTAL! -->
208
+ </tr>
209
+ <?php
210
+ endwhile;
211
+ }
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
+ public function controller_item_details() {
214
+ if ( ! isset( $_REQUEST['id'] ) )
215
+ die( 'Invalid sales log ID' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
+ global $purchlogitem;
218
+
219
+ $this->log_id = (int) $_REQUEST['id'];
220
+
221
+ // TODO: seriously get rid of all these badly coded purchaselogs.class.php functions in 4.0
222
+ $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
223
+
224
+ $columns = array(
225
+ 'title' => __( 'Name','wpsc' ),
226
+ 'sku' => __( 'SKU','wpsc' ),
227
+ 'quantity' => __( 'Quantity','wpsc' ),
228
+ 'price' => __( 'Price','wpsc' ),
229
+ 'shipping' => __( 'Item Shipping','wpsc'),
230
+ );
231
+
232
+ if ( wpec_display_product_tax() ) {
233
+ $columns['tax'] = __( 'Item Tax', 'wpsc' );
234
+ }
235
+
236
+ $columns['total'] = __( 'Item Total','wpsc' );
237
+
238
+ register_column_headers( 'wpsc_purchase_log_item_details', $columns );
239
+
240
+ add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_purchase_log' ) );
241
+ }
242
+
243
+ public function controller_packing_slip() {
244
+ if ( ! isset( $_REQUEST['id'] ) )
245
+ die( 'Invalid sales log ID' );
246
+
247
+ global $purchlogitem;
248
+
249
+ $this->log_id = (int) $_REQUEST['id'];
250
+
251
+ $purchlogitem = new wpsc_purchaselogs_items( $this->log_id );
252
+
253
+ $columns = array(
254
+ 'title' => __( 'Item Name','wpsc' ),
255
+ 'sku' => __( 'SKU','wpsc' ),
256
+ 'quantity' => __( 'Quantity','wpsc' ),
257
+ 'price' => __( 'Price','wpsc' ),
258
+ 'shipping' => __( 'Item Shipping','wpsc'),
259
+ );
260
+
261
+ if ( wpec_display_product_tax() ) {
262
+ $columns['tax'] = __( 'Item Tax', 'wpsc' );
263
+ }
264
+
265
+ $columns['total'] = __( 'Item Total','wpsc' );
266
+
267
+ $cols = count( $columns ) - 2;
268
+
269
+ register_column_headers( 'wpsc_purchase_log_item_details', $columns );
270
+
271
+ include( 'includes/purchase-logs-page/packing-slip.php' );
272
+ exit;
273
+ }
274
+
275
+ public function controller_default() {
276
+ //Create an instance of our package class...
277
+ $this->list_table = new WPSC_Purchase_Log_List_Table();
278
+ $this->process_bulk_action();
279
+ $this->list_table->prepare_items();
280
+ add_action( 'wpsc_display_purchase_logs_page', array( $this, 'display_list_table' ) );
281
+ }
282
+
283
+ public function display_purchase_log() {
284
+ if ( wpec_display_product_tax() )
285
+ $cols = 5;
286
+ else
287
+ $cols = 4;
288
+ include( 'includes/purchase-logs-page/item-details.php' );
289
+ }
290
+
291
+ public function download_csv() {
292
+ $_REQUEST['rss_key'] = 'key';
293
+ wpsc_purchase_log_csv();
294
+ }
295
+
296
+ public function process_bulk_action() {
297
+ global $wpdb;
298
+ $current_action = $this->list_table->current_action();
299
+
300
+ do_action( 'wpsc_sales_log_process_bulk_action', $current_action );
301
+
302
+ if ( ! $current_action || ( 'download_csv' != $current_action && empty( $_REQUEST['post'] ) ) ) {
303
+ if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
304
+ wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'action2' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
305
+ exit;
306
+ }
307
+
308
+ unset( $_REQUEST['post'] );
309
+ return;
310
+ }
311
+
312
+ if ( 'download_csv' == $current_action ) {
313
+ $this->download_csv();
314
+ exit;
315
+ }
316
+
317
+ $sendback = remove_query_arg( array(
318
+ '_wpnonce',
319
+ '_wp_http_referer',
320
+ 'action',
321
+ 'action2',
322
+ 'confirm',
323
+ 'post',
324
+ 'last_paged'
325
+ ) );
326
+
327
+ if ( 'delete' == $current_action ) {
328
+
329
+ // delete action
330
+ if ( empty( $_REQUEST['confirm'] ) ) {
331
+ $this->list_table->disable_search_box();
332
+ $this->list_table->disable_bulk_actions();
333
+ $this->list_table->disable_sortable();
334
+ $this->list_table->disable_month_filter();
335
+ $this->list_table->disable_views();
336
+ $this->list_table->set_per_page(0);
337
+ add_action( 'wpsc_purchase_logs_list_table_before', array( $this, 'action_list_table_before' ) );
338
+ return;
339
+ } else {
340
+ if ( empty( $_REQUEST['post'] ) )
341
+ return;
342
+
343
+ $ids = array_map( 'intval', $_REQUEST['post'] );
344
+ $in = implode( ', ', $ids );
345
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE id IN ($in)" );
346
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_CLAIMED_STOCK . " WHERE cart_id IN ($in)" );
347
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_CART_CONTENTS . " WHERE purchaseid IN ($in)" );
348
+ $wpdb->query( "DELETE FROM " . WPSC_TABLE_SUBMITED_FORM_DATA . " WHERE log_id IN ($in)" );
349
+
350
+ $sendback = esc_url( add_query_arg( array(
351
+ 'paged' => $_REQUEST['last_paged'],
352
+ 'deleted' => count( $_REQUEST['post'] ),
353
+ ), $sendback ) );
354
+
355
+ }
356
+ }
357
+
358
+ // change status actions
359
+ if ( is_numeric( $current_action ) && $current_action < 7 && ! empty( $_REQUEST['post'] ) ) {
360
+
361
+ foreach ( $_REQUEST['post'] as $id )
362
+ wpsc_purchlog_edit_status( $id, $current_action );
363
+
364
+ $sendback = esc_url( add_query_arg( array(
365
+ 'updated' => count( $_REQUEST['post'] ),
366
+ ), $sendback ) );
367
+ }
368
+
369
+ wp_redirect( $sendback );
370
+ exit;
371
+ }
372
+
373
+ public function action_list_table_before() {
374
+ include( 'includes/purchase-logs-page/bulk-delete-confirm.php' );
375
+ }
376
+
377
+ public function display_list_table() {
378
+ if ( ! empty( $this->output ) ) {
379
+ echo $this->output;
380
+ return;
381
+ }
382
+
383
+ include( 'includes/purchase-logs-page/list-table.php' );
384
+ }
385
  }
wpsc-admin/display-update.page.php CHANGED
@@ -29,38 +29,42 @@ $wpsc_version = get_option( 'wpsc_version', '0' );
29
  if ( ! get_option( 'wpsc_needs_update', false ) ) {
30
  $show_update_page = 0;
31
  } else {
32
-
33
  $table_exists = $wpdb->get_var( "SHOW TABLES LIKE '" . WPSC_TABLE_PRODUCT_LIST . "'" );
34
  $product_count = empty( $table_exists ) ? 0 : $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST );
35
 
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' )
43
  add_action( 'admin_notices', 'wpsc_display_update_notice' );
44
 
45
  // There weren't any products, so mark the update as complete
46
- } else {
47
  update_option( 'wpsc_version', WPSC_VERSION );
48
  }
49
  }
50
 
 
 
 
 
51
  function wpsc_display_php_version_notice() {
52
  ?>
53
- <div id='wpsc-warning' class='error fade'><p><?php printf( __( 'You are using PHP %s. WP eCommerce %s requires PHP 5.0 or above. Please contact your hosting provider for further assistance.', 'wpsc' ), PHP_VERSION, WPSC_VERSION ); ?></p></div>
54
  <?php
55
  }
56
 
57
  function wpsc_display_update_page() {
58
  global $wpdb;
59
-
60
  ?>
61
-
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'] ) ) :
@@ -76,15 +80,15 @@ function wpsc_display_update_page() {
76
  'create_or_update_tables' => __( 'Updating Database...' , 'wpsc' ),
77
  'update_database' => '',
78
  );
79
-
80
  foreach ( $update_stages as $function => $message ) {
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
88
  }
89
  update_option('wpsc_version', 3.8);
90
  update_option('wpsc_hide_update', true);
@@ -94,22 +98,22 @@ 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>
101
  <br />
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;
109
  ?>
110
  </div>
111
 
112
- <?php
113
  }
114
 
115
  ?>
29
  if ( ! get_option( 'wpsc_needs_update', false ) ) {
30
  $show_update_page = 0;
31
  } else {
32
+
33
  $table_exists = $wpdb->get_var( "SHOW TABLES LIKE '" . WPSC_TABLE_PRODUCT_LIST . "'" );
34
  $product_count = empty( $table_exists ) ? 0 : $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PRODUCT_LIST );
35
 
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' )
43
  add_action( 'admin_notices', 'wpsc_display_update_notice' );
44
 
45
  // There weren't any products, so mark the update as complete
46
+ } else {
47
  update_option( 'wpsc_version', WPSC_VERSION );
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
 
61
  function wpsc_display_update_page() {
62
  global $wpdb;
63
+
64
  ?>
65
+
66
  <div class="wrap">
67
+ <h2><?php echo esc_html( __('Update WP e-Commerce', 'wpsc') ); ?> </h2>
68
  <br />
69
  <?php
70
  if ( isset( $_REQUEST['run_updates'] ) ) :
80
  'create_or_update_tables' => __( 'Updating Database...' , 'wpsc' ),
81
  'update_database' => '',
82
  );
83
+
84
  foreach ( $update_stages as $function => $message ) {
85
  $wpsc_update->run( $function, $message );
86
  }
87
 
88
+ echo '<br /><br /><strong>' . __('WP e-Commerce updated successfully!', 'wpsc') . '</strong><br />';
89
  if( '' != get_option('permalink_structure')){ ?>
90
+ <em><?php printf(__('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
92
  }
93
  update_option('wpsc_version', 3.8);
94
  update_option('wpsc_hide_update', true);
98
  else:
99
 
100
 
101
+ _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 _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>
105
  <br />
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="Update WP e-Commerce" name="Submit"></p>
110
  </form>
111
  <?php
112
  endif;
113
  ?>
114
  </div>
115
 
116
+ <?php
117
  }
118
 
119
  ?>
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 _e( 'WP e-Commerce Upgrades', 'wpsc' ); ?></strong><br />
10
+ <span><?php _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='Buy Now' 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 _e( 'Gold Cart', 'wpsc' ); ?></strong></a>
16
+ <p class='wpsc_gold_text'>Add product search, multiple image upload, gallery view, Grid View and multiple payment gateway options to your shop</p>
17
+ <span class='wpsc_gold_info'>$40</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 _e( 'DropShop', 'wpsc' ); ?></strong></a>
23
+ <p class='wpsc_gold_text'>Impress your customers with our AJAX powered DropShop that lets your customers drag and drop products into their shopping cart</p>
24
+ <span class='wpsc_gold_info'>$100</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 _e( 'Members Access Plugin', 'wpsc' ); ?></strong></a>
30
+ <p class='wpsc_gold_text'>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</p>
31
+ <span class='wpsc_gold_info'>$49</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 _e( 'Product Slider', 'wpsc' ); ?> </strong></a>
37
+ <p class='wpsc_gold_text'>Display your products in a new and fancy way using the "Product Slider" module.</p>
38
+ <span class='wpsc_gold_info'>$45</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 _e( 'NextGen Gallery Buy Now Buttons', 'wpsc' ); ?> </strong></a>
44
+ <p class='wpsc_gold_text'>Make your Online photo gallery into an e-Commerce solution.</p>
45
+ <span class='wpsc_gold_info'>$10</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 _e( 'JPlayer - MP3 Plugin', 'wpsc' ); ?> </strong></a>
51
+ <p class='wpsc_gold_text'>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.</p>
52
+ <span class='wpsc_gold_info'>$40</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 _e( 'FedEx Plugin', 'wpsc' ); ?> </strong></a>
57
+ <p class='wpsc_gold_text'>This plugin offers shop owners the ability to provide Fedex Shipping Quotes for products with weights..</p>
58
+ <span class='wpsc_gold_info'>$40</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&utm_medium=affiliates&utm_campaign=wpec" target="_blank"><strong><?php _e( 'Piggy', 'wpsc' ); ?> </strong></a>
63
+ <p class='wpsc_gold_text'>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.</p>
64
+ <span class='wpsc_gold_info'>$39</span>
65
+ </div>
66
+
67
  </div>
68
 
69
+ <h2><?php _e( 'Upgrades', 'wpsc' ); ?></h2>
70
+ <div class='wpsc_gold_float'>
71
+ <p><?php _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 _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 _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 _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 _e( 'API Key Reset', 'wpsc' ); ?></h3>
100
+ <p>
101
+ <label for='activation_name'><?php _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 _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 _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'>" . __( '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,276 +67,196 @@ 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 />
330
- <input size='32' type='text' class='text' id="wpsc_sku" name='meta[_wpsc_sku]' value='<?php echo esc_html( $product_data['meta']['_wpsc_sku'] ); ?>' />
331
  <br style="clear:both" />
332
  <?php
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,62 +265,40 @@ 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 { ?>
387
  <div style='display: none;' class='edit_stock'>
388
- <?php esc_html_e( 'Stock Qty', 'wpsc' ); ?><input type='text' name='meta[_wpsc_stock]' value='0' size='10' />
389
  <div style='font-size:9px; padding:5px;'>
390
- <input type='checkbox' class='notify_when_oos' name='meta[_wpsc_product_metadata][notify_when_none_left]' /> <?php esc_html_e( 'Email site owner if this Product runs out of stock', 'wpsc' ); ?>
391
- <input type='checkbox' class='unpublish_when_oos' name='meta[_wpsc_product_metadata][unpublish_when_none_left]' /> <?php esc_html_e( 'Set status to Unpublished if this Product runs out of stock', 'wpsc' ); ?>
392
  </div>
393
- </div>
394
- <?php
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 +335,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,314 +345,305 @@ 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() {
481
- ?>
482
- <iframe src="<?php echo _wpsc_get_product_variation_form_url(); ?>"></iframe>
483
- <?php
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
 
494
- 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();
613
- else
614
- $product_id = $product->ID;
615
-
616
- $meta = get_post_meta( $product_id, '_wpsc_product_metadata', true );
617
- if ( ! is_array( $meta ) )
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 );
639
- $meta['dimensions'] = array_merge( $dimensions_defaults, $meta['dimensions'] );
640
- $meta['shipping'] = array_merge( $shipping_defaults, $meta['shipping'] );
641
-
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">
717
- <?php if ( $bulk ): ?>
718
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][shipping][local]" value="1" />
719
- <?php endif; ?>
720
- <label for="wpsc-product-shipping-flatrate-local"><?php esc_html_e( 'Local Shipping Fee', 'wpsc' ); ?></label>
721
- <span>
722
- <?php echo esc_html( $ct_symb ); ?>
723
- <input type="text" id="wpsc-product-shipping-flatrate-local" name="<?php echo esc_html( $field_name_prefix ); ?>[shipping][local]" value="<?php if ( ! $bulk ) echo $shipping['local']; ?>" />
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
 
756
  $custom_fields = $wpdb->get_results( "
757
  SELECT
@@ -765,338 +657,252 @@ 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,
966
- 'numberposts' => -1,
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,27 +917,56 @@ 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' );
1118
  }
1119
  return $translation;
1120
  }
1121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1122
  function wpsc_attachment_fields( $form_fields, $post ) {
1123
  $out = '';
1124
-
1125
- if( isset( $_REQUEST["post_id"] ) )
1126
- $parent_post = get_post( absint( $_REQUEST["post_id"] ) );
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();
1135
  echo '
1136
  <script type="text/javascript">
1137
 
@@ -1139,23 +974,21 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1139
 
1140
  jQuery("a.wp-post-thumbnail").each(function(){
1141
  var product_image = jQuery(this).text();
1142
- if (product_image == "' . esc_js( __( 'Use as featured image' ) ) . '") {
1143
- jQuery(this).text("' . esc_js( __('Use as Product Thumbnail', 'wpsc') ) . '");
1144
  }
1145
  });
1146
 
1147
  var trash = jQuery("#media-upload a.del-link").text();
1148
 
1149
- if (trash == "' . esc_js( __( 'Delete' ) ) . '") {
1150
- jQuery("#media-upload a.del-link").text("' . esc_js( __( 'Trash' ) ) . '");
1151
  }
1152
 
1153
 
1154
  });
1155
 
1156
  </script>';
1157
- $out .= ob_get_clean();
1158
-
1159
  $size_names = array( 'small-product-thumbnail' => __( 'Default Product Thumbnail Size', 'wpsc' ), 'medium-single-product' => __( 'Single Product Image Size', 'wpsc' ), 'full' => __( 'Full Size', 'wpsc' ) );
1160
 
1161
  $check = get_post_meta( $post->ID, '_wpsc_selected_image_size', true );
@@ -1167,8 +1000,16 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1167
  $settings_height = get_option( 'single_view_image_height' );
1168
 
1169
  // regenerate size metadata in case it's missing
1170
- if ( ! $check || ( $current_size['width'] != $settings_width && $current_size['height'] != $settings_height ) ) {
1171
- _wpsc_regenerate_thumbnail_size( $post->ID, $check );
 
 
 
 
 
 
 
 
1172
  }
1173
 
1174
  //This loop attaches the custom thumbnail/single image sizes to this page
@@ -1179,7 +1020,7 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1179
  $css_id = "image-size-{$size}-{$post->ID}";
1180
  // if this size is the default but that's not available, don't select it
1181
 
1182
- $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][wpsc_image_size]' id='{$css_id}' value='{$size}' " . checked( $size, $check, false ) . " />";
1183
 
1184
  $html .= "<label for='{$css_id}'>$name</label>";
1185
  // only show the dimensions if that choice is available
@@ -1194,7 +1035,7 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1194
  unset( $form_fields['post_excerpt'], $form_fields['image_url'], $form_fields['post_content'], $form_fields['post_title'], $form_fields['url'], $form_fields['align'], $form_fields['image_alt']['helps'], $form_fields["image-size"] );
1195
  $form_fields['image_alt']['helps'] = __( 'Alt text for the product image, e.g. &#8220;Rockstar T-Shirt&#8221;', 'wpsc' );
1196
 
1197
- $form_fields["wpsc_image_size"] = array(
1198
  'label' => __( 'Single Product Page Thumbnail:', 'wpsc' ),
1199
  'input' => 'html',
1200
  'html' => $out,
@@ -1211,136 +1052,161 @@ function wpsc_attachment_fields( $form_fields, $post ) {
1211
 
1212
  ";
1213
  $form_fields["wpsc_custom_thumb"] = array(
1214
- "label" => __( 'Products Page Thumbnail Size:', 'wpsc' ),
1215
  "input" => "html", // this is default if "input" is omitted
1216
  "helps" => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'Custom thumbnail size for this image on the main Product Page', 'wpsc') . "</span>",
1217
  "html" => $custom_thumb_html
1218
  );
 
1219
  }
1220
  return $form_fields;
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 );
1339
- }
 
 
 
 
 
 
 
 
1340
  }
 
 
 
 
1341
 
1342
  return $post_id;
1343
-
1344
  }
1345
 
1346
  /**
@@ -1360,345 +1226,67 @@ 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
  }
1420
 
1421
- add_action( 'quick_edit_custom_box', 'wpsc_quick_edit_boxes', 10, 2 );
1422
- add_action( 'bulk_edit_custom_box', 'wpsc_quick_edit_boxes', 10, 2 );
1423
- add_action( 'save_post', 'wpsc_save_quickedit_box' );
1424
-
1425
- /**
1426
- * If it doesn't exist, let's create a multi-dimensional associative array
1427
- * that will contain all of the term/price associations
1428
- *
1429
- * @param <type> $variation
1430
- */
1431
- function variation_price_field( $variation ) {
1432
- $term_prices = get_option( 'term_prices' );
1433
-
1434
- if ( is_object( $variation ) )
1435
- $term_id = $variation->term_id;
1436
-
1437
- if ( empty( $term_prices ) || !is_array( $term_prices ) ) {
1438
-
1439
- $term_prices = array( );
1440
- if ( isset( $term_id ) ) {
1441
- $term_prices[$term_id] = array( );
1442
- $term_prices[$term_id]["price"] = '';
1443
- $term_prices[$term_id]["checked"] = '';
1444
- }
1445
- add_option( 'term_prices', $term_prices );
1446
- }
1447
-
1448
- if ( isset( $term_id ) && is_array( $term_prices ) && array_key_exists( $term_id, $term_prices ) )
1449
- $price = esc_attr( $term_prices[$term_id]["price"] );
1450
- else
1451
- $price = '';
1452
-
1453
- if( !isset( $_GET['action'] ) ) {
1454
- ?>
1455
- <div class="form-field">
1456
- <label for="variation_price"><?php esc_html_e( 'Variation Price', 'wpsc' ); ?></label>
1457
- <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1458
- <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>
1459
- </div>
1460
- <script type="text/javascript">
1461
- jQuery('#parent option:contains("   ")').remove();
1462
- jQuery('#parent').mousedown(function(){
1463
- jQuery('#parent option:contains("   ")').remove();
1464
- });
1465
- </script>
1466
- <?php
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
- }
1480
- }
1481
- add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field' );
1482
- add_action( 'wpsc-variation_add_form_fields', 'variation_price_field' );
1483
-
1484
  /*
1485
- WordPress doesnt let you change the custom post type taxonomy form very easily
1486
- Use Jquery to move the set variation (parent) field to the top and add a description
1487
- */
1488
- function variation_set_field(){
1489
- ?>
1490
- <script>
1491
- /* change the text on the variation set from (none) to new variation set*/
1492
- jQuery("#parent option[value='-1']").text("New Variation Set");
1493
- /* Move to the top of the form and add a description */
1494
- jQuery("#tag-name").parent().before( jQuery("#parent").parent().append('<p>Choose the Variation Set you want to add variants to. If your\'e creating a new variation set then select "New Variation Set"</p>') );
1495
- /*
1496
- create a small description about variations below the add variation / set title
1497
- we can then get rid of the big red danger warning
1498
- */
1499
- ( jQuery("div#ajax-response").after('<p>Variations allow you to create options for your products, for example if you\'re selling T-Shirts they will have a size option you can create this as a variation. 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 draging and droping them within their Variation Set.</p>') );
1500
- </script>
1501
- <?php
1502
- }
1503
- add_action( 'wpsc-variation_edit_form_fields', 'variation_set_field' );
1504
- add_action( 'wpsc-variation_add_form_fields', 'variation_set_field' );
1505
-
1506
-
1507
- function category_edit_form(){
1508
- ?>
1509
- <script type="text/javascript">
1510
-
1511
- </script>
1512
- <?php
1513
- }
1514
-
1515
- function variation_price_field_check( $variation ) {
1516
-
1517
- $term_prices = get_option( 'term_prices' );
1518
-
1519
- if ( is_array( $term_prices ) && array_key_exists( $variation->term_id, $term_prices ) )
1520
- $checked = ($term_prices[$variation->term_id]["checked"] == 'checked') ? 'checked' : '';
1521
- else
1522
- $checked = ''; ?>
1523
-
1524
- <tr class="form-field">
1525
- <th scope="row" valign="top"><label for="apply_to_current"><?php esc_html_e( 'Apply to current variations?', 'wpsc' ) ?></label></th>
1526
- <td>
1527
- <span class="description"><input type="checkbox" name="apply_to_current" id="apply_to_current" style="width:2%;" <?php echo $checked; ?> /><?php _e( 'By checking this box, the price rule you implement above will be applied to all variations that currently exist. If you leave it unchecked, it will only apply to products that use this variation created or edited from now on. Take note, this will apply this rule to <strong>every</strong> product using this variation. If you need to override it for any reason on a specific product, simply go to that product and change the price.', 'wpsc' ); ?></span>
1528
- </td>
1529
- </tr>
1530
- <?php
1531
- }
1532
- add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field_check' );
1533
-
1534
-
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
-
1546
- $term_prices = get_option( 'term_prices' );
1547
-
1548
- $term_prices[$term_id]["price"] = $_POST["variation_price"];
1549
- $term_prices[$term_id]["checked"] = (isset( $_POST["apply_to_current"] )) ? "checked" : "unchecked";
1550
-
1551
- update_option( 'term_prices', $term_prices );
1552
- }
1553
-
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( );
1560
-
1561
- foreach ( (array)$products_to_mod as $get_parent ) {
1562
-
1563
- $post = get_post( $get_parent );
1564
-
1565
- if ( !$post->post_parent )
1566
- $product_parents[] = $post->ID;
1567
- }
1568
-
1569
- //Now that we have all parent IDs with this term, we can get the children (only the ones that are also in $products_to_mod, we don't want to apply pricing to ALL kids)
1570
-
1571
- foreach ( $product_parents as $parent ) {
1572
- $args = array(
1573
- 'post_parent' => $parent,
1574
- 'post_type' => 'wpsc-product'
1575
- );
1576
- $children = get_children( $args, ARRAY_A );
1577
-
1578
- foreach ( $children as $childrens ) {
1579
- $parent = $childrens["post_parent"];
1580
- $children_ids[$parent][] = $childrens["ID"];
1581
- $children_ids[$parent] = array_intersect( $children_ids[$parent], $products_to_mod );
1582
- }
1583
- }
1584
-
1585
- //Got the right kids, let's grab their parent pricing and modify their pricing based on var_price_type
1586
-
1587
- foreach ( (array)$children_ids as $parents => $kids ) {
1588
-
1589
- $kids = array_values( $kids );
1590
-
1591
- foreach ( $kids as $kiddos ) {
1592
- $price = wpsc_determine_variation_price( $kiddos );
1593
- update_product_meta( $kiddos, 'price', $price );
1594
- }
1595
- }
1596
- }
1597
  }
1598
- add_action( 'edited_wpsc-variation', 'save_term_prices' );
1599
- add_action( 'created_wpsc-variation', 'save_term_prices' );
1600
-
1601
- function wpsc_delete_variations( $postid ) {
1602
- $post = get_post( $postid );
1603
- if ( $post->post_type != 'wpsc-product' || $post->post_parent != 0 )
1604
- return;
1605
- $variations = get_posts( array(
1606
- 'post_type' => 'wpsc-product',
1607
- 'post_parent' => $postid,
1608
- 'post_status' => 'any',
1609
- 'numberposts' => -1,
1610
- ) );
1611
-
1612
- if ( ! empty( $variations ) )
1613
- foreach ( $variations as $variation ) {
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 (Wording doesn't make sense. If Variations box is closed, you don't go there, and it's not necessarily "below") */ ?>
130
+ <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
131
+ <?php $price = wpsc_product_variation_price_available( $post->ID ); ?>
132
+ <p><?php _e( 'This Product has variations, to edit the price please use the <a href="#variation_control">Variation Controls</a> below.' , 'wpsc' ); ?></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 _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 _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 _e( '+ New Currency', 'wpsc' ); ?></a>
150
+ <br />
151
+ <!-- add new currency layer -->
152
+ <div class='new_layer'>
153
+ <label for='newCurrency[]'><?php _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 _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 _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 _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 _e( 'Table Rate Price', 'wpsc' ); ?></label>
196
+ <div id='table_rate'>
197
+ <a class='add_level' style='cursor:pointer;'><?php _e( '+ Add level', 'wpsc' ); ?></a><br />
198
+ <br style='clear:both' />
199
+ <table>
200
+ <tr>
201
+ <th><?php _e( 'Quantity In Cart', 'wpsc' ); ?></th>
202
+ <th colspan='2'><?php _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 _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 _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
+ if ( !isset( $product_meta['unpublish_when_none_left'] ) )
247
+ $product_meta['unpublish_when_none_left'] = ''; ?>
 
 
 
248
 
249
+ <label for="wpsc_sku"><abbr title="<?php _e( 'Stock Keeping Unit', 'wpsc' ); ?>"><?php _e( 'SKU:', 'wpsc' ); ?></abbr></label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  <?php
251
  if ( !isset( $product_data['meta']['_wpsc_sku'] ) )
252
  $product_data['meta']['_wpsc_sku'] = $wpsc_product_defaults['meta']['sku']; ?><br />
253
+ <input size='32' type='text' class='text' id="wpsc_sku" name='meta[_wpsc_sku]' value='<?php echo htmlentities( stripslashes( $product_data['meta']['_wpsc_sku'] ), ENT_QUOTES, 'UTF-8' ); ?>' />
254
  <br style="clear:both" />
255
  <?php
256
  if ( !isset( $product_data['meta']['_wpsc_stock'] ) )
257
  $product_data['meta']['_wpsc_stock'] = ''; ?>
258
  <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]' />
259
+ <label for='add_form_quantity_limited' class='small'><?php _e( 'I have limited stock for this Product', 'wpsc' ); ?></label>
260
  <?php
261
  if ( $post->ID > 0 ) {
262
  if ( is_numeric( $product_data['meta']['_wpsc_stock'] ) ) {?>
265
  <div class='edit_stock' style='display: none;'><?php
266
  } ?>
267
  <?php if ( wpsc_product_has_children( $post->ID ) ) : ?>
268
+ <?php $stock = wpsc_variations_stock_remaining( $post->ID ); ?>
269
+ <p><?php _e( 'This Product has variations, to edit the quantity please use the Variation Controls below.' , 'wpsc' ); ?></p>
270
  <p><?php printf( _n( "%s variant item in stock.", "%s variant items in stock.", $stock, 'wpsc' ), $stock ); ?></p>
271
  <?php else: ?>
272
+ <label for="stock_limit_quantity"><?php _e( 'Quantity:', 'wpsc' ); ?></label>
273
+ <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' />
274
+ <?php
275
+ $remaining_quantity = wpsc_get_remaining_quantity( $post->ID );
276
+ $reserved_quantity = $product_data['meta']['_wpsc_stock'] - $remaining_quantity;
277
+ if($reserved_quantity): ?>
278
+ <p><em>
 
279
  <?php
280
+ 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);
 
 
 
 
 
 
 
 
 
281
  ?>
282
+ </em></p>
283
+ <?php endif; ?>
284
  <?php endif; ?>
 
 
 
 
 
 
 
 
285
  <div class='unpublish_when_none_left'>
286
+ <input type='checkbox' id="inform_when_oos" name='meta[_wpsc_product_metadata][unpublish_when_none_left]' class='inform_when_oos'<?php if ( $product_meta['unpublish_when_none_left'] == 1 ) echo ' checked="checked"'; ?> />
287
+ <label for="inform_when_oos"><?php _e( 'Notify site owner and unpublish this Product if stock runs out', 'wpsc' ); ?></label>
 
 
 
288
  </div>
289
+ <p><em><?php _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>
290
  </div> <?php
291
  } else { ?>
292
  <div style='display: none;' class='edit_stock'>
293
+ <?php _e( 'Stock Qty', 'wpsc' ); ?><input type='text' name='meta[_wpsc_stock]' value='0' size='10' />
294
  <div style='font-size:9px; padding:5px;'>
295
+ <input type='checkbox' class='inform_when_oos' name='meta[_wpsc_product_metadata][unpublish_when_none_left]' /> <?php _e( 'If this Product runs out of stock set status to Unpublished & email site owner', 'wpsc' ); ?>
 
296
  </div>
297
+ </div><?php
 
298
  }
299
+ ?>
300
+ <?php
 
301
  }
 
302
  function wpsc_product_taxes_forms() {
303
  global $post, $wpdb, $wpsc_product_defaults;
304
  $product_data = get_post_custom( $post->ID );
335
  'type' => 'checkbox',
336
  'id' => 'wpec_taxes_taxable',
337
  'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable]',
338
+ 'label' => __( 'This product is not taxable.', 'wpsc' )
339
  );
340
 
341
  if ( isset( $product_meta['wpec_taxes_taxable'] ) && 'on' == $product_meta['wpec_taxes_taxable'] ) {
345
  //add taxable amount only for exclusive tax
346
  if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ) {
347
  $taxable_amount_input_settings = array(
348
+ 'id' => 'wpec_taxes_taxable_amount',
349
+ 'name' => 'meta[_wpsc_product_metadata][wpec_taxes_taxable_amount]',
350
+ 'label' => __( 'Taxable Amount', 'wpsc' )
 
351
  );
352
 
353
  if ( isset( $product_meta['wpec_taxes_taxable_amount'] ) ) {
354
  $taxable_amount_input_settings['value'] = $product_meta['wpec_taxes_taxable_amount'];
 
 
 
 
 
355
  }
356
  }// if
357
 
358
+ ?> <a name="wpsc_tax"></a>
359
+ <p><?php echo $wpec_taxes_controller->wpec_taxes_display_tax_bands( $band_select_settings, $wpec_taxes_band ); ?></p>
360
+ <p>
361
+ <?php if ( !$wpec_taxes_controller->wpec_taxes_isincluded() ): ?>
362
+ <?php echo $wpec_taxes_controller->wpec_taxes_build_input( $taxable_amount_input_settings );?>
363
+ <?php endif;?>
364
+ </p>
365
+ <p><?php echo $wpec_taxes_controller->wpec_taxes_build_input( $taxable_checkbox_settings ); ?></p>
366
+ <?php
367
+ }
368
 
369
+ function wpsc_product_variation_forms() {
370
+ require_once( 'walker-variation-checklist.php' );
371
+ global $post, $wpdb, $wp_query, $variations_processor, $wpsc_product_defaults;
372
 
373
+ $db_version = get_option( 'db_version' );
374
 
375
+ $product_data = get_post_custom( $post->ID );
376
+ $product_data['meta'] = maybe_unserialize( $product_data );
377
 
378
+ foreach ( $product_data['meta'] as $meta_key => $meta_value )
379
+ $product_data['meta'][$meta_key] = $meta_value[0];
380
 
381
+ $product_meta = array();
382
+ if ( !empty( $product_data["_wpsc_product_metadata"] ) )
383
+ $product_meta = maybe_unserialize( $product_data["_wpsc_product_metadata"][0] );
 
 
384
 
385
+ $siteurl = get_option( 'siteurl' );
386
+ $output = '';
387
+ ?>
388
+ <a name="#wpsc_variation_metabox"></a>
389
+ <?php if ( empty( $post->post_title ) ) : ?>
390
+ <p><?php _e( 'You must first save this Product as a Draft before adding variations.', 'wpsc' ); ?></p>
391
+ <h4><a href="<?php echo get_admin_url(); ?>/edit-tags.php?taxonomy=wpsc-variation&post_type=wpsc-product" target="_blank">+ Add New Variation Set</a></h4>
392
+ <?php else : ?>
393
+ <div id="product_variations">
394
+ <p><a name='variation_control'>&nbsp;</a><?php _e( 'Select the Variation sets and then the corresponding Variants you want to add to this product.', 'wpsc' ) ?></p>
395
+
396
+ <ul class="variation_checkboxes">
397
+ <?php
398
 
399
+ wp_terms_checklist( $post->ID, array(
400
+ 'taxonomy' => 'wpsc-variation',
401
+ 'walker' => new WPSC_Walker_Variation_Checklist(),
402
+ 'checked_ontop' => false,
403
+ ) );
404
 
405
+ ?>
406
+ </ul>
407
+
408
+ <p class="update-variations">
409
+ <a class="button update_variations_action" href='#'><?php _e( 'Apply Variations &rarr;', 'wpsc' ); ?></a>
410
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
411
+ </p>
412
+
413
+ <div class="clear"></div>
414
+ <h4><a href="#wpsc_variation_metabox" class="add_variation_set_action"><?php esc_html_e( '+ Add New Variants', 'wpsc' ) ?></a></h4>
415
+
416
+ <div id="add-new-variation-set">
417
+ <p>
418
+ <label for="new-variation-set-name"><?php esc_html_e( "Enter variation set's name", 'wpsc' ); ?></label>
419
+ <input type="text" class="text-field" id="new-variation-set-name" /><br />
420
+ </p>
421
+ <p class="howto"><?php esc_html_e( "Example: Color. If you want to add variants to an existing set, you can enter the name of that set here.", 'wpsc' ); ?></p>
422
+ <p>
423
+ <label for="new-variants"><?php esc_html_e( "Enter new variants", 'wpsc' ); ?></label>
424
+ <input type="text" class="text-field" id="new-variants" /><br />
425
+ </p>
426
+ <p class="howto"><?php esc_html_e( "Example: Red, Green, Blue. Separate variants with commas.", 'wpsc' ); ?></p>
427
+ <p>
428
+ <a class="button" href="#"><?php esc_html_e( 'Add New Variants', 'wpsc' ); ?></a>
429
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
430
+ </p>
431
+ </div>
432
+ </div>
433
+ <?php
434
+ $parent_product = $post->ID;
435
 
436
+ $query = array(
437
+ 'post_type' => 'wpsc-product',
438
+ 'orderby' => 'menu_order post_title',
439
+ 'post_parent' => $parent_product,
440
+ 'post_status' => 'publish, inherit',
441
+ 'order' => "ASC"
 
 
 
 
 
 
442
  );
 
443
 
444
+ $args = array(
445
+ 'post_type' => 'attachment',
446
+ 'numberposts' => 1,
447
+ 'post_status' => null,
448
+ 'post_parent' => $parent_product,
449
+ 'orderby' => 'menu_order',
450
+ 'order' => 'ASC'
 
 
 
 
 
 
451
  );
 
452
 
453
+ $image_data = (array)get_posts( $args );
454
+ $parent_product_data['image'] = array_shift( $image_data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
 
456
+ query_posts( $query );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
 
458
+ if ( !isset( $parent_product_data ) )
459
+ $parent_product_data = null;
460
+ ?>
461
+ <table class="widefat page" id='wpsc_product_list' cellspacing="0">
462
+ <thead>
463
+ <tr>
464
+ <?php print_column_headers( 'wpsc-product_variants' ); ?>
465
+ </tr>
466
+ </thead>
467
 
468
+ <tfoot>
469
+ <tr>
470
+ <?php print_column_headers( 'wpsc-product_variants', false ); ?>
471
+ </tr>
472
+ </tfoot>
473
 
474
+ <tbody>
475
+ <?php
476
+ wpsc_admin_product_listing( $parent_product_data );
477
+ ?>
478
+ <?php
479
+ if ( ! have_posts() ) :
480
+ ?>
481
+ <tr>
482
+ <td colspan="8">
483
+ <?php _e( 'You have no Variations added.', 'wpsc' ); ?>
484
+ </td>
485
+ </tr>
486
 
487
+ <?php endif; ?>
488
+ </tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
489
 
490
+ </table>
491
 
492
+ <?php
493
+ endif;
494
+ wp_reset_query();
495
 
496
+ // reset the global $id variable. This is to prevent incompatibility with Genesis framework,
497
+ // which (wrongly) relies on this global.
498
+ $GLOBALS['id'] = null;
499
  }
500
+ function wpsc_product_shipping_forms() {
501
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
502
 
503
+ $product_data = get_post_custom( $post->ID );
504
+ $product_data['meta'] = maybe_unserialize( $product_data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
 
506
+ foreach ( $product_data['meta'] as $meta_key => $meta_value )
507
+ $product_data['meta'][$meta_key] = $meta_value[0];
 
508
 
509
+ $product_meta = array();
510
+ if ( !empty( $product_data["_wpsc_product_metadata"] ) )
511
+ $product_meta = maybe_unserialize( $product_data["_wpsc_product_metadata"][0] );
512
 
513
+ $product_data['transformed'] = array();
514
+ if ( !isset( $product_meta['weight'] ) )
515
+ $product_meta['weight'] = "";
516
 
517
+ if( !isset( $product_meta['weight_unit'] ) )
518
+ $product_meta['weight_unit'] = '';
 
 
 
519
 
520
+ $product_data['transformed']['weight'] = wpsc_convert_weight( $product_meta['weight'], "pound", $product_meta['weight_unit']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
 
522
+ // Fix wp_debug notices
523
+ if(!isset($product_meta['dimensions'])){
524
+ $product_meta['dimensions'] = array(
525
+ 'height' => 0,
526
+ 'width' => 0,
527
+ 'length' => 0
528
+ );
529
+ }
530
+ if( !isset($product_meta['display_weight_as']) )
531
+ $product_meta['display_weight_as'] = '';
532
 
533
+ if( !isset( $product_meta['dimensions']['height_unit'] ) )
534
+ $product_meta['dimensions']['height_unit'] = '';
 
535
 
536
+ if( !isset( $product_meta['dimensions']['width_unit'] ) )
537
+ $product_meta['dimensions']['width_unit'] = '';
538
 
539
+ if( !isset( $product_meta['dimensions']['length_unit'] ) )
540
+ $product_meta['dimensions']['length_unit'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
 
542
+ if( !isset( $product_meta['shipping'] ) ){
543
+ $product_meta['shipping']['local'] = '';
544
+ $product_meta['shipping']['international'] = '';
545
+ }
546
+ if( !isset( $product_meta['no_shipping'] ) )
547
+ $product_meta['no_shipping'] = '';
548
+ ?> <a name="wpsc_shipping"></a>
549
+ <table>
550
+
551
+ <!--USPS shipping changes-->
552
+ <tr>
553
+ <td>
554
+ <?php _e( 'Weight', 'wpsc' ); ?>
555
+ </td>
556
+ <td>
557
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][weight]' value='<?php echo $product_data['transformed']['weight']; ?>' />
558
+ <select name='meta[_wpsc_product_metadata][weight_unit]'>
559
+ <option value='pound' <?php echo ( ( $product_meta['display_weight_as'] == 'pound' ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Pounds', 'wpsc' ); ?></option>
560
+ <option value='ounce' <?php echo ( ( preg_match( "/o(u)?nce/", $product_meta['display_weight_as'] ) ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Ounces', 'wpsc' ); ?></option>
561
+ <option value='gram' <?php echo ( ( $product_meta['display_weight_as'] == 'gram' ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Grams', 'wpsc' ); ?></option>
562
+ <option value='kilogram' <?php echo ( ( $product_meta['display_weight_as'] == 'kilogram' || $product_meta['display_weight_as'] == 'kilograms' ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Kilograms', 'wpsc' ); ?></option>
563
+ </select>
564
+ </td>
565
+ </tr>
566
+ <!--dimension-->
567
+ <tr>
568
+ <td>
569
+ <?php _e( 'Height', 'wpsc' ); ?>
570
+ </td>
571
+ <td>
572
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][dimensions][height]' value= '<?php echo $product_meta['dimensions']['height'] ; ?>'>
573
+ <select name='meta[_wpsc_product_metadata][dimensions][height_unit]'>
574
+ <option value='in' <?php echo ( ( $product_meta['dimensions']['height_unit'] == 'in' ) ? 'selected' : '' ); ?> ><?php _e( 'inches', 'wpsc' ); ?></option>
575
+ <option value='cm' <?php echo ( ( $product_meta['dimensions']['height_unit'] == 'cm' ) ? 'selected' : '' ); ?> ><?php _e( 'cm', 'wpsc' ); ?></option>
576
+ <option value='meter' <?php echo ( ( $product_meta['dimensions']['height_unit'] == 'meter' ) ? 'selected' : '' ); ?> ><?php _e( 'meter', 'wpsc' ); ?></option>
577
+ </select>
578
+ </td>
579
+ </tr>
580
+ <tr>
581
+ <td>
582
+ <?php _e( 'Width', 'wpsc' ); ?>
583
+ </td>
584
+ <td>
585
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][dimensions][width]' value='<?php echo $product_meta['dimensions']['width']; ?> '>
586
+ <select name='meta[_wpsc_product_metadata][dimensions][width_unit]'>
587
+ <option value='in' <?php echo( ( $product_meta['dimensions']['width_unit'] == 'in' ) ? 'selected' : '' ); ?> ><?php _e( 'inches', 'wpsc' ); ?></option>
588
+ <option value='cm' <?php echo ( ( $product_meta['dimensions']['width_unit'] == 'cm' ) ? 'selected' : '' ); ?> ><?php _e( 'cm', 'wpsc' ); ?></option>
589
+ <option value='meter' <?php echo ( ( $product_meta['dimensions']['width_unit'] == 'meter' ) ? 'selected' : '' ); ?> ><?php _e( 'meter', 'wpsc' ); ?></option>
590
+ </select>
591
+ </td>
592
+ </tr>
593
+ <tr>
594
+ <td>
595
+ <?php _e( 'Length', 'wpsc' ); ?>
596
+ </td>
597
+ <td>
598
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][dimensions][length]' value='<?php echo $product_meta['dimensions']['length']; ?>'>
599
+ <select name='meta[_wpsc_product_metadata][dimensions][length_unit]'>
600
+ <option value='in' <?php echo( ( $product_meta['dimensions']['length_unit'] == 'in' ) ? 'selected' : '' ); ?> ><?php _e( 'inches', 'wpsc' ); ?></option>
601
+ <option value='cm' <?php echo( ( $product_meta['dimensions']['length_unit'] == 'cm' ) ? 'selected' : '' ); ?> ><?php _e( 'cm', 'wpsc' ); ?></option>
602
+ <option value='meter' <?php echo ( ( $product_meta['dimensions']['length_unit'] == 'meter' ) ? 'selected' : '' ); ?> ><?php _e( 'meter', 'wpsc' ); ?></option>
603
+ </select>
604
+ </td>
605
+ </tr>
606
+
607
+ <!--//dimension-->
608
+ <!--USPS shipping changes ends-->
609
+ <tr>
610
+ <td colspan='2'>
611
+ <strong><?php _e( 'Flat Rate Settings', 'wpsc' ); ?></strong>
612
+ </td>
613
+ </tr>
614
+ <tr>
615
+ <td>
616
+ <?php _e( 'Local Shipping Fee', 'wpsc' ); ?>
617
+ </td>
618
+ <td>
619
+ <input type='text' size='10' name='meta[_wpsc_product_metadata][shipping][local]' value='<?php echo number_format( (float)$product_meta['shipping']['local'], 2, '.', '' ); ?>' />
620
+ </td>
621
+ </tr>
622
 
623
+ <tr>
624
+ <td>
625
+ <?php _e( 'International Shipping Fee', 'wpsc' ); ?>
626
+ </td>
627
+ <td>
628
+ <input type='text' size='10' name='meta[_wpsc_product_metadata][shipping][international]' value='<?php echo number_format( (float)$product_meta['shipping']['international'], 2, '.', '' ); ?>' />
629
+ </td>
630
+ </tr>
631
+ <tr>
632
+ <td>
633
+ <br />
634
+ <input id='add_form_no_shipping' type='checkbox' name='meta[_wpsc_product_metadata][no_shipping]' value='1' <?php echo ( ( $product_meta['no_shipping'] == 1 ) ? 'checked="checked"' : '' ); ?> />&nbsp;<label for='add_form_no_shipping'><?php _e( 'Disregard Shipping for this Product', 'wpsc' ); ?></label>
635
+ </td>
636
+ </tr>
637
+ </table>
638
+ <?php
639
  }
 
 
 
 
 
 
 
640
  function wpsc_product_advanced_forms() {
641
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
642
+ $product_data = get_post_custom( $post->ID );
643
 
644
+ $product_data['meta'] = $product_meta = array();
645
+ if ( !empty( $product_data['_wpsc_product_metadata'] ) )
646
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
647
 
648
  $custom_fields = $wpdb->get_results( "
649
  SELECT
657
  ORDER BY
658
  LOWER(meta_key)", ARRAY_A
659
  );
660
+ if( !isset( $product_meta['engraved'] ) )
661
+ $product_meta['engraved'] = '';
662
 
663
+ if( !isset( $product_meta['can_have_uploaded_image'] ) )
664
+ $product_meta['can_have_uploaded_image'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
665
 
666
+ ?>
 
 
 
 
 
667
 
668
+ <table>
669
+ <tr>
670
+ <td colspan='2' class='itemfirstcol'>
671
+ <strong><?php _e( 'Custom Meta', 'wpsc' ); ?>:</strong><br />
672
+ <a href='#' class='add_more_meta' onclick="return add_more_meta(this)"> + <?php _e( 'Add Custom Meta', 'wpsc' );?> </a><br /><br />
673
 
674
+ <?php
675
+ foreach ( (array)$custom_fields as $custom_field ) {
676
+ $i = $custom_field['meta_id'];
677
 
678
+ ?>
679
+ <div class='product_custom_meta' id='custom_meta_<?php echo $i; ?>'>
680
+ <?php _e( 'Name', 'wpsc' ); ?>
681
+ <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; ?>'>
682
+ <?php _e( 'Value', 'wpsc' ); ?>
683
+ <textarea class='text' name='custom_meta[<?php echo $i; ?>][value]' id='custom_meta_value_<?php echo $i; ?>'><?php echo $custom_field['meta_value']; ?></textarea>
684
+ <a href='#' class='remove_meta' onclick='return remove_meta(this, <?php echo $i; ?>)'><?php _e( 'Delete', 'wpsc' ); ?></a>
685
+ <br />
686
+ </div>
687
+ <?php
688
+ }
689
+ ?>
690
+ <div class='product_custom_meta'>
691
+ <?php _e( 'Name', 'wpsc' ); ?>: <br />
692
+ <input type='text' name='new_custom_meta[name][]' value='' class='text'/><br />
693
+ <?php _e( 'Description', 'wpsc' ); ?>: <br />
694
+ <textarea name='new_custom_meta[value][]' cols='40' rows='10' class='text' ></textarea>
695
+ <br />
696
+ </div>
697
+ </td>
698
+ </tr>
699
+ <tr>
700
+ <td class='itemfirstcol' colspan='2'><br /> <strong><?php _e( 'Merchant Notes:', 'wpsc' ); ?></strong><br />
701
+
702
+ <textarea cols='40' rows='3' name='meta[_wpsc_product_metadata][merchant_notes]' id='merchant_notes'><?php
703
+ if ( isset( $product_meta['merchant_notes'] ) )
704
+ echo stripslashes( trim( $product_meta['merchant_notes'] ) );
705
+ ?></textarea>
706
+ <small><?php _e( 'These notes are only available here.', 'wpsc' ); ?></small>
707
+ </td>
708
+ </tr>
709
+ <tr>
710
+ <td class='itemfirstcol' colspan='2'><br />
711
+ <strong><?php _e( 'Personalisation Options', 'wpsc' ); ?>:</strong><br />
712
+ <input type='hidden' name='meta[_wpsc_product_metadata][engraved]' value='0' />
713
+ <input type='checkbox' name='meta[_wpsc_product_metadata][engraved]' <?php echo ( ( $product_meta['engraved'] == true ) ? 'checked="checked"' : '' ); ?> id='add_engrave_text' />
714
+ <label for='add_engrave_text'><?php _e( 'Users can personalize this Product by leaving a message on single product page', 'wpsc' ); ?></label>
715
+ <br />
716
+ </td>
717
+ </tr>
718
+ <tr>
719
+ <td class='itemfirstcol' colspan='2'>
720
+ <input type='hidden' name='meta[_wpsc_product_metadata][can_have_uploaded_image]' value='0' />
721
+ <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' />
722
+ <label for='can_have_uploaded_image'> <?php _e( 'Users can upload images on single product page to purchase logs.', 'wpsc' ); ?> </label>
723
+ <br />
724
+ </td>
725
+ </tr>
726
+ <?php
727
+ if ( get_option( 'payment_gateway' ) == 'google' ) {
728
+ ?>
729
+ <tr>
730
+ <td class='itemfirstcol' colspan='2'>
731
 
732
+ <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'>
733
+ <?php _e( 'Prohibited <a href="http://checkout.google.com/support/sell/bin/answer.py?answer=75724">by Google?</a>', 'wpsc' ); ?>
734
+ </label><br />
735
+ </td>
736
+ </tr>
737
+ <?php
738
+ }
739
+ do_action( 'wpsc_add_advanced_options', $post->ID );
740
+ ?>
741
+ <tr>
742
+ <td class='itemfirstcol' colspan='2'><br />
743
+ <strong><?php _e( 'Enable Comments', 'wpsc' ); ?>:</strong><br />
744
+ <select name='meta[_wpsc_product_metadata][enable_comments]'>
745
+ <option value='' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '' ) ? 'selected' : '' ); ?> ><?php _e( 'Use Default', 'wpsc' ); ?></option>
746
+ <option value='1' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '1' ) ? 'selected' : '' ); ?> ><?php _e( 'Yes', 'wpsc' ); ?></option>
747
+ <option value='0' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '0' ) ? 'selected' : '' ); ?> ><?php _e( 'No', 'wpsc' ); ?></option>
748
+ </select>
749
+ <br/><?php _e( 'Allow users to comment on this Product.', 'wpsc' ); ?>
750
+ </td>
751
+ </tr>
752
+ </table>
753
+ <?php
754
  }
 
 
 
 
 
 
755
  function wpsc_product_external_link_forms() {
756
 
757
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
758
+ $product_data = get_post_custom( $post->ID );
759
 
760
+ $product_data['meta'] = $product_meta = array();
761
+ if ( !empty( $product_data['_wpsc_product_metadata'] ) )
762
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
 
764
+ // Get External Link Values
765
+ $external_link_value = isset( $product_meta['external_link'] ) ? $product_meta['external_link'] : '';
766
+ $external_link_text_value = isset( $product_meta['external_link_text'] ) ? $product_meta['external_link_text'] : '';
767
+ $external_link_target_value = isset( $product_meta['external_link_target'] ) ? $product_meta['external_link_target'] : '';
768
+ $external_link_target_value_selected[$external_link_target_value] = ' selected="selected"';
769
+ if ( !isset( $external_link_target_value_selected['_self'] ) ) $external_link_target_value_selected['_self'] = '';
770
+ if ( !isset( $external_link_target_value_selected['_blank'] ) ) $external_link_target_value_selected['_blank'] = '';
771
 
772
+ ?>
773
+ <p><?php _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' ); ?>
774
+ <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
775
+ <tbody>
776
+ <tr class="form-field">
777
+ <th valign="top" scope="row"><label for="external_link"><?php _e( 'External Link', 'wpsc' ); ?></label></th>
778
+ <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>
779
+ </tr>
780
+ <tr class="form-field">
781
+ <th valign="top" scope="row"><label for="external_link_text"><?php _e( 'External Link Text', 'wpsc' ); ?></label></th>
782
+ <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>
783
+ </tr>
784
+ <tr class="form-field">
785
+ <th valign="top" scope="row"><label for="external_link_target"><?php _e( 'External Link Target', 'wpsc' ); ?></label></th>
786
+ <td>
787
+ <select id="external_link_target" name="meta[_wpsc_product_metadata][external_link_target]">
788
+ <option value=""><?php _ex( 'Default (set by theme)', 'External product link target', 'wpsc' ); ?></option>
789
+ <option value="_self" <?php echo $external_link_target_value_selected['_self'] ; ?>><?php _e( 'Open link in the same window', 'wpsc' ); ?></option>
790
+ <option value="_blank" <?php echo $external_link_target_value_selected['_blank'] ; ?>><?php _e( 'Open link in a new window', 'wpsc' ); ?></option>
791
+ </select>
792
+ </td>
793
+ </tr>
794
+ </tbody>
795
+ </table>
796
+ <?php
797
  }
798
+ function wpsc_product_image_forms() {
799
+
800
+ global $post;
801
 
802
+ edit_multiple_image_gallery( $post );
803
+
804
+ ?>
805
+
806
+ <p><strong <?php if ( isset( $display ) ) echo $display; ?>><a href="media-upload.php?parent_page=wpsc-edit-products&post_id=<?php echo $post->ID; ?>&type=image&tab=gallery&TB_iframe=1&width=640&height=566" class="thickbox" title="Manage Your Product Images"><?php _e( 'Manage Product Images', 'wpsc' ); ?></a></strong></p>
807
+ <?php
808
+ }
809
  function wpsc_additional_desc() {
810
+ global $post;
811
  ?>
812
+ <textarea name='additional_description' id='additional_description' cols='40' rows='5' ><?php echo stripslashes( $post->post_excerpt ); ?></textarea>
 
813
  <?php
814
 
815
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  function wpsc_product_download_forms() {
817
  global $post, $wpdb, $wpsc_product_defaults;
818
  $product_data = get_post_custom( $post->ID );
819
  $output = '';
820
+ $product_data['meta'] = $product_meta = array();
 
821
  if ( !empty( $product_data['_wpsc_product_metadata'] ) )
822
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
823
 
824
  $upload_max = wpsc_get_max_upload_size();
825
  ?>
826
  <?php echo wpsc_select_product_file( $post->ID ); ?>
827
+ <h4><a href="admin.php?wpsc_admin_action=product_files_existing&amp;product_id=<?php echo $post->ID; ?>" class="thickbox" title="<?php printf( __( 'Select all downloadable files for %s', 'wpsc' ), $post->post_title ); ?>"><?php _e( 'Select from existing files', 'wpsc' ); ?></a></h4>
828
+ <a name="wpsc_downloads"></a>
829
+ <h4><?php _e( 'Upload New File', 'wpsc' ); ?>:</h4>
830
+ <input type='file' name='file' value='' /><br /><?php _e( 'Max Upload Size ', 'wpsc' ); ?>:<span><?php echo $upload_max; ?></span> <span> - <?php _e( 'Choose your file, then update this product to save the download.', 'wpsc' ); ?></span><br /><br />
831
 
832
+ <?php
 
 
 
 
 
 
 
 
833
  if ( function_exists( "make_mp3_preview" ) || function_exists( "wpsc_media_player" ) ) {
834
  ?>
835
+ <br />
836
+ <h4><?php _e( "Select an MP3 file to upload as a preview", 'wpsc' ) ?></h4>
837
+ <input type='file' name='preview_file' value='' /><br />
838
+
839
+ <h4><?php _e( "Your preview for this product:", 'wpsc' ) ?></h4>
840
+
841
+ <?php
842
+ $args = array(
843
+ 'post_type' => 'wpsc-preview-file',
844
+ 'post_parent' => $post->ID,
845
+ 'numberposts' => -1,
846
+ 'post_status' => 'all'
847
+ );
848
 
849
+ $preview_files = (array)get_posts( $args );
850
 
851
+ foreach ($preview_files as $preview)
852
  echo $preview->post_title . '<br />';
 
853
 
854
  ?>
 
 
 
855
 
856
+ <br />
857
+ <?php
858
+ }
859
  $output = apply_filters( 'wpsc_downloads_metabox', $output );
860
  }
861
+ function wpsc_product_label_forms() {
862
+ _deprecated_function( __FUNCTION__, '3.8' );
863
+ return false;
864
+ }
865
  /**
866
+ * Adding function to change text for media buttons
 
 
867
  */
868
+ function change_context( $context ) {
869
+ global $current_screen;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
870
 
871
+ if ( $current_screen->id != 'wpsc-product' )
872
+ return $context;
873
+ return __( 'Upload Image%s', 'wpsc' );
874
  }
875
+ function change_link( $link ) {
876
+ global $post_ID, $current_screen;
877
 
878
+ if ( $current_screen->id != 'wpsc-product' )
879
+ return $link;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
880
 
881
+ $uploading_iframe_ID = $post_ID;
882
+ $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
 
883
 
884
+ return $media_upload_iframe_src . "&amp;type=image&parent_page=wpsc-edit-products";
 
 
 
 
885
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
886
  function wpsc_form_multipart_encoding() {
887
  echo ' enctype="multipart/form-data"';
888
  }
889
 
890
  add_action( 'post_edit_form_tag', 'wpsc_form_multipart_encoding' );
891
+ add_filter( 'media_buttons_context', 'change_context' );
892
+ add_filter( 'image_upload_iframe_src', "change_link" );
893
  /*
894
  * Modifications to Media Gallery
895
  */
896
 
897
+ if ( ( isset( $_REQUEST['parent_page'] ) && ( $_REQUEST['parent_page'] == 'wpsc-edit-products' ) ) ) {
898
+ add_filter( 'media_upload_tabs', 'wpsc_media_upload_tab_gallery', 12 );
899
+ add_filter( 'attachment_fields_to_save', 'wpsc_save_attachment_fields', 9, 2 );
900
+ add_filter( 'media_upload_form_url', 'wpsc_media_upload_url', 9, 1 );
901
+ add_action( 'admin_head', 'wpsc_gallery_css_mods' );
902
+ }
903
+ add_filter( 'gettext', 'wpsc_filter_delete_text', 12 , 3 );
904
  add_filter( 'attachment_fields_to_edit', 'wpsc_attachment_fields', 11, 2 );
905
+ add_filter( 'gettext', 'wpsc_filter_feature_image_text', 12, 3 );
906
  add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
907
 
908
  /*
917
  function wpsc_filter_gettex_with_context( $translation, $text, $context, $domain ) {
918
 
919
  if ( 'Taxonomy Parent' == $context && 'Parent' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ) {
920
+ $translations = &get_translations_for_domain( $domain );
921
  return $translations->translate( 'Variation Set', 'wpsc' );
922
+ //this will never happen, this is here only for gettex to pick up the translation
923
  return __( 'Variation Set', 'wpsc' );
924
  }
925
  return $translation;
926
  }
927
 
928
+ /*
929
+ * This filter translates string before it is displayed
930
+ * specifically for the words 'Use as featured image' with 'Use as Product Thumbnail' when the user is selecting a Product Thumbnail
931
+ * using media gallery.
932
+ *
933
+ * @param $translation The current translation
934
+ * @param $text The text being translated
935
+ * @param $domain The domain for the translation
936
+ * @return string The translated / filtered text.
937
+ */
938
+ function wpsc_filter_feature_image_text( $translation, $text, $domain ) {
939
+
940
+ if ( 'Use as featured image' == $text && isset( $_REQUEST['post_id'] ) ) {
941
+ $post = get_post( $_REQUEST['post_id'] );
942
+ if ( $post->post_type != 'wpsc-product' ) return $translation;
943
+ $translations = &get_translations_for_domain( $domain );
944
+ return $translations->translate( 'Use as Product Thumbnail', 'wpsc' );
945
+ //this will never happen, this is here only for gettex to pick up the translation
946
+ return __( 'Use as Product Thumbnail', 'wpsc' );
947
+ }
948
+ /*
949
+ if ( 'The name is how it appears on your site.' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ){
950
+ $translations = &get_translations_for_domain( $domain );
951
+ return $translations->translate( 'The name is how it appears on your site. <br><div class="error"><strong>Please read this carefully before starting to work with variations:</strong><br />Variations in WP e-Commerce are divided into sets. For example set <strong>Color</strong> could have variations <strong>Red, Green,</strong> and <strong>Blue</strong>. To create a variation set simply enter the <strong>name</strong> and push Enter key on your keyboard or click <strong>Add New Variation/Set</strong> button in the bottom of this page. Then you will be able to select it from <strong>Variation set</strong> drop-down menu and add some variations to it. To add a new variation set just select <strong>New Variation Set</strong> in <strong>Variation set</strong> drop-down menu.</div>', 'wpsc' );
952
+ //this will never happen, this is here only for gettex to pick up the translation
953
+ return __( 'The name is how it appears on your site. <br><div class="error"><strong>Please read this carefully before starting to work with variations:</strong><br />Variations in WP e-Commerce are divided into sets. For example set <strong>Color</strong> could have variations <strong>Red, Green,</strong> and <strong>Blue</strong>. To create a set simply enter <strong>Name</strong> and push Enter key on your keyboard or click <strong>Add New Variation/Set</strong> button in the bottom of this page. Now you can select the variation set that you\'ve just created from <strong>Variation set</strong> drop-down menu and add some variations to it.</div>', 'wpsc' );
954
+ }
955
+ */
956
+
957
+ return $translation;
958
+ }
959
  function wpsc_attachment_fields( $form_fields, $post ) {
960
  $out = '';
961
+ if(isset($_GET["post_id"]))
962
+ $parent_post = get_post( absint($_GET["post_id"]) );
 
963
  else
964
  $parent_post = get_post( $post->post_parent );
965
 
966
+ if ( $parent_post->post_type == "wpsc-product" ) {
 
967
 
968
  //Unfortunate hack, as I'm not sure why the From Computer tab doesn't process filters the same way the Gallery does
969
+
970
  echo '
971
  <script type="text/javascript">
972
 
974
 
975
  jQuery("a.wp-post-thumbnail").each(function(){
976
  var product_image = jQuery(this).text();
977
+ if (product_image == "' . __('Use as featured image') . '") {
978
+ jQuery(this).text("' . __('Use as Product Thumbnail', 'wpsc') . '");
979
  }
980
  });
981
 
982
  var trash = jQuery("#media-upload a.del-link").text();
983
 
984
+ if (trash == "Delete") {
985
+ jQuery("#media-upload a.del-link").text("Trash");
986
  }
987
 
988
 
989
  });
990
 
991
  </script>';
 
 
992
  $size_names = array( 'small-product-thumbnail' => __( 'Default Product Thumbnail Size', 'wpsc' ), 'medium-single-product' => __( 'Single Product Image Size', 'wpsc' ), 'full' => __( 'Full Size', 'wpsc' ) );
993
 
994
  $check = get_post_meta( $post->ID, '_wpsc_selected_image_size', true );
1000
  $settings_height = get_option( 'single_view_image_height' );
1001
 
1002
  // regenerate size metadata in case it's missing
1003
+ if ( ! $check || $current_size['width'] != $settings_width || $current_size['height'] != $settings_height ) {
1004
+ if ( ! $metadata = wp_get_attachment_metadata( $post->ID ) )
1005
+ $metadata = array();
1006
+ if ( empty( $metadata['sizes'] ) )
1007
+ $metadata['sizes'] = array();
1008
+ $file = get_attached_file( $post->ID );
1009
+ $generated = wp_generate_attachment_metadata( $post->ID, $file );
1010
+ $metadata['sizes'] = array_merge((array) $metadata['sizes'], (array) $generated['sizes'] );
1011
+
1012
+ wp_update_attachment_metadata( $post->ID, $metadata );
1013
  }
1014
 
1015
  //This loop attaches the custom thumbnail/single image sizes to this page
1020
  $css_id = "image-size-{$size}-{$post->ID}";
1021
  // if this size is the default but that's not available, don't select it
1022
 
1023
+ $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}' " . checked( $size, $check, false ) . " />";
1024
 
1025
  $html .= "<label for='{$css_id}'>$name</label>";
1026
  // only show the dimensions if that choice is available
1035
  unset( $form_fields['post_excerpt'], $form_fields['image_url'], $form_fields['post_content'], $form_fields['post_title'], $form_fields['url'], $form_fields['align'], $form_fields['image_alt']['helps'], $form_fields["image-size"] );
1036
  $form_fields['image_alt']['helps'] = __( 'Alt text for the product image, e.g. &#8220;Rockstar T-Shirt&#8221;', 'wpsc' );
1037
 
1038
+ $form_fields["image-size"] = array(
1039
  'label' => __( 'Single Product Page Thumbnail:', 'wpsc' ),
1040
  'input' => 'html',
1041
  'html' => $out,
1052
 
1053
  ";
1054
  $form_fields["wpsc_custom_thumb"] = array(
1055
+ "label" => __( "Products Page Thumbnail Size:", 'wpsc' ),
1056
  "input" => "html", // this is default if "input" is omitted
1057
  "helps" => "<span style='text-align:left; clear:both; display:block; padding-top:3px;'>" . __( 'Custom thumbnail size for this image on the main Product Page', 'wpsc') . "</span>",
1058
  "html" => $custom_thumb_html
1059
  );
1060
+
1061
  }
1062
  return $form_fields;
1063
 
1064
  }
1065
  function wpsc_save_attachment_fields( $post, $attachment ) {
1066
 
1067
+ if ( isset ( $attachment['wpsc_custom_thumb_w'] ) )
1068
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_w', $attachment['wpsc_custom_thumb_w'] );
 
1069
 
1070
+ if ( isset ( $attachment['wpsc_custom_thumb_h'] ) )
1071
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_h', $attachment['wpsc_custom_thumb_h'] );
 
1072
 
1073
+ if ( isset ( $attachment['image-size'] ) )
1074
+ update_post_meta( $post['ID'], '_wpsc_selected_image_size', $attachment['image-size'] );
 
1075
 
1076
  return $post;
1077
  }
1078
+ function wpsc_media_upload_url( $form_action_url ) {
1079
 
1080
+ $form_action_url = esc_url( add_query_arg( array( 'parent_page'=>'wpsc-edit-products' ) ) );
 
 
 
 
 
 
 
 
 
 
 
1081
 
1082
+ return $form_action_url;
1083
 
1084
+ }
1085
+ function wpsc_gallery_css_mods() {
 
 
1086
 
1087
+ print '<style type="text/css">
1088
+ #gallery-settings *{
1089
+ display:none;
1090
+ }
1091
+ a.wp-post-thumbnail {
1092
+ color:green;
1093
+ }
1094
+ #media-upload a.del-link {
1095
+ color:red;
1096
+ }
1097
+ #media-upload a.wp-post-thumbnail {
1098
+ margin-left:0px;
1099
+ }
1100
+ td.savesend input.button {
1101
+ display:none;
1102
+ }
1103
+ </style>';
1104
+ print '
1105
+ <script type="text/javascript">
1106
+ jQuery(function(){
1107
+ jQuery("td.A1B1").each(function(){
1108
 
1109
+ var target = jQuery(this).next();
1110
+ jQuery("p > input.button", this).appendTo(target);
 
 
 
 
 
 
1111
 
1112
+ });
 
 
 
 
 
 
1113
 
1114
+ jQuery("a.wp-post-thumbnail").each(function(){
1115
+ var product_image = jQuery(this).text();
1116
+ if (product_image == "' . __('Use as featured image') . '") {
1117
+ jQuery(this).text("' . __('Use as Product Thumbnail', 'wpsc') . '");
1118
+ }
1119
+ });
1120
+ });
1121
 
1122
+ </script>';
1123
+ }
1124
+ function wpsc_media_upload_tab_gallery( $tabs ) {
 
1125
 
1126
+ unset( $tabs['gallery'] );
1127
+ $tabs['gallery'] = __( 'Product Image Gallery', 'wpsc' );
 
 
 
1128
 
1129
+ return $tabs;
1130
+ }
1131
+ function wpsc_filter_delete_text( $translation, $text, $domain ) {
 
 
 
1132
 
1133
+ if ( 'Delete' == $text && isset( $_REQUEST['post_id'] ) && isset( $_REQUEST["parent_page"] ) ) {
1134
+ $translations = &get_translations_for_domain( $domain );
1135
+ return $translations->translate( 'Trash' ) ;
1136
+ }
1137
+ return $translation;
1138
+ }
1139
+ function edit_multiple_image_gallery( $post ) {
1140
+ global $wpdb;
1141
+ //Make sure thumbnail isn't duplicated
1142
+ $siteurl = get_option( 'siteurl' );
1143
 
1144
+ if ( $post->ID > 0 ) {
1145
+ if ( has_post_thumbnail( $post->ID ) )
1146
+ echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
1147
+
1148
+ $args = array(
1149
+ 'post_type' => 'attachment',
1150
+ 'numberposts' => -1,
1151
+ 'post_status' => null,
1152
+ 'post_parent' => $post->ID,
1153
+ 'orderby' => 'menu_order',
1154
+ 'order' => 'ASC'
1155
+ );
1156
 
1157
+ $attached_images = (array)get_posts( $args );
 
 
 
 
1158
 
1159
+ if ( count( $attached_images ) > 0 ) {
1160
+ foreach ( $attached_images as $images ) {
1161
+ $attached_image = wp_get_attachment_image( $images->ID, 'admin-product-thumbnails' );
1162
+ echo $attached_image. '&nbsp;';
1163
+ }
1164
+ }
1165
 
1166
+ }
1167
+ }
 
1168
 
1169
+ /**
1170
+ * wpsc_save_quickedit_box function
1171
+ * Saves input for the various meta in the quick edit boxes
1172
+ *
1173
+ * @todo UI
1174
+ * @todo Data validation / sanitization / security
1175
+ * @todo AJAX should probably return weight unit
1176
+ * @return $post_id (int) Post ID
1177
+ */
1178
 
1179
+ function wpsc_save_quickedit_box( $post_id ) {
1180
+ global $current_screen;
1181
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || empty( $current_screen ) || $current_screen->id != 'edit-wpsc-product' || ! defined( 'DOING_AJAX' ) || ! DOING_AJAX )
1182
+ return;
1183
 
1184
+ $is_parent = ( bool )wpsc_product_has_children( $post_id );
1185
+ $product_meta = get_post_meta( $post_id, '_wpsc_product_metadata', true );
 
 
 
1186
 
1187
+ $weight_unit = $product_meta["weight_unit"];
1188
+ $weight = wpsc_convert_weight( $_POST["weight"], $weight_unit, "pound", true );
 
 
 
1189
 
1190
+ if ( isset( $product_meta["weight"] ) )
1191
+ unset( $product_meta["weight"] );
1192
 
1193
+ $product_meta["weight"] = $weight;
1194
+
1195
+ if ( !$is_parent ) {
1196
+ update_post_meta( $post_id, '_wpsc_product_metadata', $product_meta );
1197
+ if(is_numeric($_POST['stock']))
1198
+ update_post_meta( $post_id, '_wpsc_stock', $_POST['stock'] );
1199
+ else
1200
+ update_post_meta( $post_id, '_wpsc_stock', '' );
1201
+ update_post_meta( $post_id, '_wpsc_price', $_POST['price'] );
1202
+ update_post_meta( $post_id, '_wpsc_special_price', $_POST['sale_price'] );
1203
  }
1204
+ if($_POST['sku'] == __('N/A', 'wpsc'))
1205
+ update_post_meta( $post_id, '_wpsc_sku', '' );
1206
+ else
1207
+ update_post_meta( $post_id, '_wpsc_sku', $_POST['sku'] );
1208
 
1209
  return $post_id;
 
1210
  }
1211
 
1212
  /**
1226
  ?>
1227
 
1228
  <fieldset class="inline-edit-col-left wpsc-cols">
1229
+ <div class="inline-edit-col">
1230
+ <div class="inline-edit-group">
1231
+ <?php
1232
  switch ( $col_name ) :
1233
  case 'SKU' :
1234
  ?>
1235
+ <label class="alignleft">
1236
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'SKU:', 'wpsc' ); ?> </span>
1237
+ <input type="text" name="sku" class="wpsc_ie_sku" />
1238
+ </label>
1239
+ <?php
 
 
1240
  break;
1241
  case 'weight' :
1242
  ?>
1243
+ <label class="alignleft">
1244
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Weight:', 'wpsc' ); ?> </span>
1245
+ <input type="text" name="weight" class="wpsc_ie_weight" />
1246
+ </label>
1247
+ <?php
 
1248
  break;
1249
  case 'stock' :
1250
  ?>
1251
+ <label class="alignleft">
1252
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Stock:', 'wpsc' ); ?> </span>
1253
+ <input type="text" name="stock" class="wpsc_ie_stock" />
1254
+ </label>
1255
+ <?php
 
1256
  break;
1257
  case 'price' :
1258
  ?>
1259
+ <label class="alignleft">
1260
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Price:', 'wpsc' ); ?> </span>
1261
+ <input type="text" name="price" class="wpsc_ie_price" />
1262
+ </label>
1263
+ <?php
 
1264
  break;
1265
  case 'sale_price' :
1266
  ?>
1267
+ <label class="alignleft">
1268
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Sale Price:', 'wpsc' ); ?> </span>
1269
+ <input type="text" name="sale_price" class="wpsc_ie_sale_price" />
1270
+ </label>
1271
+ <?php
 
1272
  break;
1273
  endswitch;
1274
  ?>
1275
+ </div>
1276
+ </div>
1277
  </fieldset>
1278
  <?php
1279
  }
1280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1281
  /*
1282
+ * Remove bulk edit as it is broken,
1283
+ * ToDo : Fix Bulk Edit for Products
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1284
  */
1285
+ function wpsc_remove_bulk_edit($options){
1286
+ unset($options['edit']);
1287
+ return $options;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1288
  }
1289
+ add_action( 'quick_edit_custom_box', 'wpsc_quick_edit_boxes', 10, 2 );
1290
+ add_action( 'save_post', 'wpsc_save_quickedit_box' );
1291
+ add_action( 'bulk_actions-edit-wpsc-product', 'wpsc_remove_bulk_edit');
1292
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-functions.php CHANGED
@@ -7,7 +7,28 @@
7
  */
8
 
9
  function wpsc_get_max_upload_size(){
10
- return size_format( wp_max_upload_size() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
 
13
  /**
@@ -18,37 +39,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,147 +66,55 @@ 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
  }
133
 
134
- if ( isset( $post_data['meta']['_wpsc_product_metadata']['shipping'] ) ) {
135
- $post_data['meta']['_wpsc_product_metadata']['shipping']['local'] = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['shipping']['local'] );
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 +145,40 @@ 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;
@@ -271,6 +189,7 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
271
  wpsc_item_add_preview_file($product_id, $post_data['files']['preview_file']);
272
  }
273
  do_action('wpsc_edit_product', $product_id);
 
274
  }
275
  return $product_id;
276
  }
@@ -286,15 +205,14 @@ function wpsc_pre_update( $data , $postarr ) {
286
  $data["post_parent"] = $postarr["parent_post"];
287
 
288
  // Sanitize status for variations (see #324)
289
- if ( $data['post_parent'] && ( ! isset( $data['ID'] ) || $data['post_parent'] != $data['ID'] ) && $data['post_status'] == 'publish' ) {
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 +221,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
  /**
@@ -354,8 +272,6 @@ function wpsc_sanitise_product_forms($post_data = null) {
354
  $post_data = &$_POST;
355
  }
356
 
357
- $post_data = stripslashes_deep( $post_data );
358
-
359
  $post_data['name'] = isset($post_data['post_title']) ? $post_data['post_title'] : '';
360
  $post_data['title'] = $post_data['name'];
361
  $post_data['description'] = isset($post_data['content']) ? $post_data['content'] : '';
@@ -368,8 +284,9 @@ function wpsc_sanitise_product_forms($post_data = null) {
368
  $post_data['post_status'] = 'draft';
369
  }
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'];
@@ -379,13 +296,11 @@ function wpsc_sanitise_product_forms($post_data = null) {
379
  $post_data['meta']['_wpsc_stock'] = false;
380
  }
381
  unset($post_data['meta']['_wpsc_limited_stock']);
382
- if(!isset($post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'] = 0;
383
  if(!isset($post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = '';
384
  if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
385
  if(!isset($post_data['special'])) $post_data['special'] = '';
386
  if(!isset($post_data['meta']['_wpsc_product_metadata']['no_shipping'])) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = '';
387
 
388
- $post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['notify_when_none_left'];
389
  $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
390
  $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
391
  $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
@@ -395,9 +310,8 @@ function wpsc_sanitise_product_forms($post_data = null) {
395
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
396
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
397
 
398
- $weight = wpsc_string_to_float( $post_data['meta']['_wpsc_product_metadata']['weight'] );
399
- $weight = wpsc_convert_weight( $weight, $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
400
- $post_data['meta']['_wpsc_product_metadata']['weight'] = $weight;
401
  $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
402
 
403
  $post_data['files'] = $_FILES;
@@ -441,9 +355,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 +389,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 +437,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 +484,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 +529,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,22 +543,20 @@ 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'];
629
-
630
  $child_product_template = array(
631
  'post_author' => $user_ID,
632
- 'post_content' => get_post_field( 'post_content', $parent_id, 'raw' ),
633
- 'post_excerpt' => get_post_field( 'post_excerpt', $parent_id, 'raw' ),
634
- 'post_title' => get_post_field( 'post_title', $parent_id, 'raw' ),
635
  'post_status' => 'inherit',
636
  'post_type' => "wpsc-product",
 
637
  'post_parent' => $product_id
638
  );
639
 
@@ -717,8 +640,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 +648,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
 
@@ -755,11 +670,10 @@ function wpsc_edit_product_variations($product_id, $post_data) {
755
  }
756
  }
757
  }
758
- $current_children = get_posts(array(
759
  'post_parent' => $post_id,
760
- 'post_type' => 'wpsc-product',
761
- 'post_status' => 'all',
762
- 'numberposts' => -1
763
  ));
764
 
765
  foreach((array)$current_children as $child_prod){
@@ -774,8 +688,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 +742,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 +768,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 +847,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];
@@ -944,6 +859,8 @@ function wpsc_item_reassign_file($product_id, $selected_files) {
944
  return null;
945
  }
946
 
 
 
947
  foreach($selected_files as $selected_file) {
948
  // if we already use this file, there is no point doing anything more.
949
  $file_is_attached = false;
@@ -984,7 +901,7 @@ function wpsc_item_reassign_file($product_id, $selected_files) {
984
  }
985
  }
986
 
987
- return true;
988
  }
989
 
990
  /**
@@ -1140,103 +1057,4 @@ function wpsc_variations_stock_remaining($product_id){
1140
  `pm`.`meta_key` = "_wpsc_stock"
1141
  ', $product_id ) );
1142
  }
1143
-
1144
- function flat_price( $price ) {
1145
- if ( ! empty( $price ) && strchr( $price, '-' ) === false && strchr( $price, '+' ) === false && strchr( $price, '%' ) === false )
1146
- return true;
1147
- }
1148
-
1149
- function percentile_price( $price ) {
1150
- if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) )
1151
- return true;
1152
- }
1153
-
1154
- function differential_price( $price ) {
1155
- if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) === false )
1156
- return true;
1157
- }
1158
-
1159
- /**
1160
- * Refresh variation terms assigned to parent product based on the variations it has.
1161
- *
1162
- * @since 3.8.9
1163
- * @access private
1164
- * @param int $parent_id Parent product ID
1165
- */
1166
- function _wpsc_refresh_parent_product_terms( $parent_id ) {
1167
- $children = get_children( array(
1168
- 'post_parent' => $parent_id,
1169
- 'post_status' => array( 'publish', 'inherit' ),
1170
- ) );
1171
-
1172
- $children_ids = wp_list_pluck( $children, 'ID' );
1173
-
1174
- $children_terms = wp_get_object_terms( $children_ids, 'wpsc-variation' );
1175
- $new_terms = array();
1176
- foreach ( $children_terms as $term ) {
1177
- if ( $term->parent )
1178
- $new_terms[] = $term->parent;
1179
- }
1180
-
1181
- $children_term_ids = wp_list_pluck( $children_terms, 'term_id' );
1182
- $new_terms = array_merge( $new_terms, $children_term_ids );
1183
- $new_terms = array_unique( $new_terms );
1184
- $new_terms = array_map( 'absint', $new_terms );
1185
- wp_set_object_terms( $parent_id, $new_terms, 'wpsc-variation' );
1186
- }
1187
-
1188
- /**
1189
- * Make sure parent product's assigned terms are refreshed when its variations are deleted or trashed
1190
- *
1191
- * @since 3.8.9
1192
- * @access private
1193
- * @param int $post_id Parent product ID
1194
- */
1195
- function _wpsc_action_refresh_variation_parent_terms( $post_id ) {
1196
- $post = get_post( $post_id );
1197
- if ( $post->post_type != 'wpsc-product' || ! $post->post_parent || in_array( $post->post_status, array( 'publish', 'inherit' ) ) )
1198
- return;
1199
-
1200
- _wpsc_refresh_parent_product_terms( $post->post_parent );
1201
- }
1202
-
1203
- /**
1204
- * Make sure parent product's assigned terms are refresh when its variations' statuses are changed
1205
- *
1206
- * @since 3.8.9
1207
- * @access private
1208
- * @param string $new_status New status
1209
- * @param string $old_status Old status
1210
- * @param object $post Variation object
1211
- */
1212
- function _wpsc_action_transition_post_status( $new_status, $old_status, $post ) {
1213
- if ( $post->post_type != 'wpsc-product' || ! $post->post_parent )
1214
- return;
1215
-
1216
- _wpsc_refresh_parent_product_terms( $post->post_parent );
1217
- }
1218
-
1219
- /**
1220
- * Prevent parent terms from being refreshed when its variations are updated. This is useful when
1221
- * the variations are being mass updated.
1222
- *
1223
- * @since 3.8.9
1224
- * @access private
1225
- */
1226
- function _wpsc_remove_refresh_variation_parent_term_hooks() {
1227
- remove_action( 'transition_post_status', '_wpsc_action_transition_post_status', 10, 3 );
1228
- remove_action( 'deleted_post', '_wpsc_action_refresh_variation_parent_terms', 10, 1 );
1229
- }
1230
-
1231
- /**
1232
- * Add hooks so that parent product's assigned terms are refreshed when its variations are updated.
1233
- *
1234
- * @since 3.8.9
1235
- * @access private
1236
- */
1237
- function _wpsc_add_refresh_variation_parent_term_hooks() {
1238
- add_action( 'transition_post_status', '_wpsc_action_transition_post_status', 10, 3 );
1239
- add_action( 'deleted_post', '_wpsc_action_refresh_variation_parent_terms', 10, 1 );
1240
- }
1241
-
1242
- _wpsc_add_refresh_variation_parent_term_hooks();
7
  */
8
 
9
  function wpsc_get_max_upload_size(){
10
+
11
+ return wp_convert_bytes_to_hr( wp_max_upload_size() );
12
+ }
13
+
14
+
15
+ /**
16
+ * wpsc_product_has_children function
17
+ * Checks whether a product has variations or not
18
+ *
19
+ * @return boolean true if product does have variations, false otherwise
20
+ */
21
+ function wpsc_product_has_children($id){
22
+ $args = array(
23
+ 'post_parent' => $id,
24
+ 'post_type' => 'wpsc-product',
25
+ 'post_status' => 'inherit publish'
26
+ );
27
+ $children = get_children($args);
28
+ if( empty($children) )
29
+ return false;
30
+ else
31
+ return true;
32
  }
33
 
34
  /**
39
  * @return nothing
40
  */
41
  function wpsc_admin_submit_product( $post_ID, $post ) {
42
+ global $current_screen, $wpdb;
43
 
44
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || empty( $current_screen ) || $current_screen->id != 'wpsc-product' || $post->post_type != 'wpsc-product' || empty( $_POST['meta'] ) )
45
+ return $post_ID;
 
46
 
47
  //Type-casting ( not so much sanitization, which would be good to do )
48
+ $post_data = $_POST;
49
  $product_id = $post_ID;
50
+ $post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
51
+ $post_meta['meta'] = (array)$_POST['meta'];
 
 
 
 
 
 
52
  if ( isset( $post_data['meta']['_wpsc_price'] ) )
53
+ $post_data['meta']['_wpsc_price'] = abs( (float) str_replace( ',', '', $post_data['meta']['_wpsc_price'] ) );
 
54
  if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
55
+ $post_data['meta']['_wpsc_special_price'] = abs((float)str_replace( ',','',$post_data['meta']['_wpsc_special_price'] ));
56
+ if($post_data['meta']['_wpsc_sku'] == __('N/A', 'wpsc'))
 
57
  $post_data['meta']['_wpsc_sku'] = '';
58
+ if( isset( $post_data['meta']['_wpsc_is_donation'] ) )
59
+ $post_data['meta']['_wpsc_is_donation'] = 1;
60
+ else
61
+ $post_data['meta']['_wpsc_is_donation'] = 0;
 
 
 
62
  if ( ! isset( $post_data['meta']['_wpsc_limited_stock'] ) ){
63
  $post_data['meta']['_wpsc_stock'] = false;
64
  } else {
66
  }
67
 
68
  unset($post_data['meta']['_wpsc_limited_stock']);
69
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = '';
70
+ if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
71
+ if(!isset($post_data['special'])) $post_data['special'] = '';
72
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['no_shipping'])) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = '';
73
 
74
+ $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
75
  $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
76
  $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
77
+ $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['no_shipping'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  // Product Weight
80
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
81
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
82
 
83
+ $weight = wpsc_convert_weight($post_data['meta']['_wpsc_product_metadata']['weight'], $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
84
+ $post_data['meta']['_wpsc_product_metadata']['weight'] = (float)$weight;
 
 
85
  $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
 
86
 
87
+ // table rate price
88
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = isset( $post_data['table_rate_price'] ) ? $post_data['table_rate_price'] : array();
 
 
 
89
 
90
+ // if table_rate_price is unticked, wipe the table rate prices
91
+ if ( empty( $post_data['table_rate_price']['state'] ) ) {
92
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = array();
93
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = array();
94
  }
95
 
96
+ if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] ) ) {
97
+ foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value ){
98
+ if(empty($value)){
99
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][$key]);
100
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][$key]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
  }
103
  }
104
 
 
 
 
 
 
 
 
105
 
106
+ $post_data['meta']['_wpsc_product_metadata']['shipping']['local'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['local'];
107
+ $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['international'];
 
 
 
 
 
 
 
 
108
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
  // Advanced Options
111
+ $post_data['meta']['_wpsc_product_metadata']['engraved'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['engraved'];
112
+ $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'];
113
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
 
 
 
 
 
 
 
 
 
 
 
114
  $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
115
 
116
+ $post_data['meta']['_wpsc_product_metadata']['enable_comments'] = $post_data['meta']['_wpsc_product_metadata']['enable_comments'];
117
+ $post_data['meta']['_wpsc_product_metadata']['merchant_notes'] = $post_data['meta']['_wpsc_product_metadata']['merchant_notes'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  $post_data['files'] = $_FILES;
120
 
145
  'thumbnail_state' => null
146
  );
147
 
148
+ foreach($product_columns as $column => $default)
149
+ {
150
+ if (!isset($post_data[$column])) $post_data[$column] = '';
151
+
152
+ if($post_data[$column] !== null) {
153
+ $update_values[$column] = stripslashes($post_data[$column]);
154
+ } else if(($update != true) && ($default !== null)) {
155
+ $update_values[$column] = stripslashes($default);
156
  }
157
  }
 
158
  // if we succeed, we can do further editing (todo - if_wp_error)
159
 
160
  // if we have no categories selected, assign one.
161
+ 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){
162
  $post_data['tax_input']['wpsc_product_category'][1] = wpsc_add_product_category_default($product_id);
 
163
 
164
+ }
165
  // and the meta
166
  wpsc_update_product_meta($product_id, $post_data['meta']);
167
 
168
  // and the custom meta
169
  wpsc_update_custom_meta($product_id, $post_data);
170
 
171
+ // sort out the variations
172
+ wpsc_edit_product_variations( $product_id, $post_data );
173
 
174
+ //and the alt currency
175
+ if ( ! empty( $post_data['newCurrency'] ) ) {
176
+ foreach( (array) $post_data['newCurrency'] as $key =>$value ){
177
+ wpsc_update_alt_product_currency( $product_id, $value, $post_data['newCurrPrice'][$key] );
 
 
 
 
 
 
178
  }
179
  }
180
 
181
+ if($post_data['files']['file']['tmp_name'] != '') {
182
  wpsc_item_process_file($product_id, $post_data['files']['file']);
183
  } else {
184
  if (!isset($post_data['select_product_file'])) $post_data['select_product_file'] = null;
189
  wpsc_item_add_preview_file($product_id, $post_data['files']['preview_file']);
190
  }
191
  do_action('wpsc_edit_product', $product_id);
192
+ wpsc_ping();
193
  }
194
  return $product_id;
195
  }
205
  $data["post_parent"] = $postarr["parent_post"];
206
 
207
  // Sanitize status for variations (see #324)
208
+ if ( $data['post_parent'] && ( ! isset( $data['ID'] ) || $data['post_parent'] != $data['ID'] ) ) {
209
  $data['post_status'] = 'inherit';
210
  }
211
 
212
+ if ( !empty( $postarr['meta'] ) && ( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] == 0 || empty( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] ) ) )
213
+ $data["comment_status"] = "closed";
214
+ else
215
+ $data["comment_status"] = "open";
 
216
 
217
  //Can anyone explain to me why this is here?
218
  if ( isset( $sku ) && ( $sku != '' ) )
221
  return $data;
222
  }
223
  add_filter( 'wp_insert_post_data','wpsc_pre_update', 99, 2 );
224
+ add_action( 'save_post', 'wpsc_admin_submit_product', 10, 2 );
225
  add_action( 'admin_notices', 'wpsc_admin_submit_notices' );
226
 
227
  /**
272
  $post_data = &$_POST;
273
  }
274
 
 
 
275
  $post_data['name'] = isset($post_data['post_title']) ? $post_data['post_title'] : '';
276
  $post_data['title'] = $post_data['name'];
277
  $post_data['description'] = isset($post_data['content']) ? $post_data['content'] : '';
284
  $post_data['post_status'] = 'draft';
285
  }
286
 
287
+ $post_data['meta']['_wpsc_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_price'] );
288
+ $post_data['meta']['_wpsc_special_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_special_price'] );
289
+ $post_data['meta']['_wpsc_sku'] = $post_data['meta']['_wpsc_sku'];
290
  if (!isset($post_data['meta']['_wpsc_is_donation'])) $post_data['meta']['_wpsc_is_donation'] = '';
291
  $post_data['meta']['_wpsc_is_donation'] = (int)(bool)$post_data['meta']['_wpsc_is_donation'];
292
  $post_data['meta']['_wpsc_stock'] = (int)$post_data['meta']['_wpsc_stock'];
296
  $post_data['meta']['_wpsc_stock'] = false;
297
  }
298
  unset($post_data['meta']['_wpsc_limited_stock']);
 
299
  if(!isset($post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = '';
300
  if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
301
  if(!isset($post_data['special'])) $post_data['special'] = '';
302
  if(!isset($post_data['meta']['_wpsc_product_metadata']['no_shipping'])) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = '';
303
 
 
304
  $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
305
  $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
306
  $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
310
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
311
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
312
 
313
+ $weight = wpsc_convert_weight($post_data['meta']['_wpsc_product_metadata']['weight'], $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
314
+ $post_data['meta']['_wpsc_product_metadata']['weight'] = (float)$weight;
 
315
  $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
316
 
317
  $post_data['files'] = $_FILES;
355
  );
356
 
357
 
358
+ foreach($product_columns as $column => $default)
359
+ {
360
+ if (!isset($post_data[$column])) $post_data[$column] = '';
361
+
362
+ if($post_data[$column] !== null) {
363
+ $update_values[$column] = stripslashes($post_data[$column]);
364
+ } else if(($update != true) && ($default !== null)) {
365
+ $update_values[$column] = stripslashes($default);
366
  }
367
  }
368
 
389
  }else {
390
  unstick_post($product_id);
391
  }
392
+ if ($product_id == 0 ) {
393
+ if ( $wp_error ) {
394
+ return new WP_Error('db_insert_error', __( 'Could not insert product into the database', 'wpsc' ), $wpdb->last_error);
395
+ } else {
396
+ return 0;
397
+ }
398
+ }
399
  $adding = true;
400
 
401
  // if we succeed, we can do further editing
437
  }
438
 
439
  if (strchr($price, '-') ) {
440
+ $negative = true;
441
  } else {
442
  $positive = true;
443
  }
484
  $price = (float) get_product_meta( $variation->post_parent, 'price', true );
485
 
486
  if ( ! $term_ids )
487
+ $term_ids = wp_get_object_terms( $variation_id, 'wpsc-variation', array( 'fields' => 'ids' ) );
488
 
489
  $term_price_arr = get_option( 'term_prices' );
490
  foreach ( $term_ids as $term_id ) {
529
  if (!isset($post_data['edit_var_val']))
530
  $post_data['edit_var_val'] = '';
531
 
532
+ $variations = (array)$post_data['edit_var_val'];
533
 
534
  // Generate the arrays for variation sets, values and combinations
535
  $wpsc_combinator = new wpsc_variation_combinator($variations);
543
  // Retrieve the array containing the combinations of each variation set to be associated with this product.
544
  $combinations = $wpsc_combinator->return_combinations();
545
 
546
+ $product_terms = wp_get_object_terms($product_id, 'wpsc-variation');
547
 
548
  $variation_sets_and_values = array_merge($variation_sets, $variation_values);
549
  $variation_sets_and_values = apply_filters('wpsc_edit_product_variation_sets_and_values', $variation_sets_and_values, $product_id);
 
550
  wp_set_object_terms($product_id, $variation_sets_and_values, 'wpsc-variation');
551
 
 
 
552
  $child_product_template = array(
553
  'post_author' => $user_ID,
554
+ 'post_content' => $post_data['description'],
555
+ 'post_excerpt' => $post_data['additional_description'],
556
+ 'post_title' => $post_data['name'],
557
  'post_status' => 'inherit',
558
  'post_type' => "wpsc-product",
559
+ 'post_name' => sanitize_title($post_data['name']),
560
  'post_parent' => $product_id
561
  );
562
 
640
  $currently_associated_vars[] = $current->term_id;
641
  }
642
 
 
 
643
  foreach ($posted_term as $term=>$val) {
644
  $posted_terms[] = $term;
645
  if(is_array($val)) {
648
  }
649
  }
650
  }
 
651
  if(!empty($currently_associated_vars)){
652
  $term_ids_to_delete = array();
653
  $term_ids_to_delete = array_diff($currently_associated_vars, $posted_terms);
654
  }
655
+ if(isset($_REQUEST["post_ID"]))
 
656
  $post_id = $_REQUEST["post_ID"];
657
+ elseif(isset($_REQUEST["product_id"]))
658
  $post_id = $_REQUEST["product_id"];
 
 
 
 
659
  if(!empty($term_ids_to_delete) && (isset($_REQUEST["product_id"]) || isset($post_id))) {
660
  $post_ids_to_delete = array();
661
 
670
  }
671
  }
672
  }
673
+ $current_children = query_posts(array(
674
  'post_parent' => $post_id,
675
+ 'post_type' => "wpsc-product",
676
+ 'post_status' => 'all'
 
677
  ));
678
 
679
  foreach((array)$current_children as $child_prod){
688
  }
689
  }
690
  }
 
 
691
  }
692
 
693
  function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
742
 
743
  function wpsc_update_custom_meta($product_id, $post_data) {
744
 
745
+ if($post_data['new_custom_meta'] != null) {
746
  foreach((array)$post_data['new_custom_meta']['name'] as $key => $name) {
747
  $value = $post_data['new_custom_meta']['value'][(int)$key];
748
  if(($name != '') && ($value != '')) {
749
  add_post_meta($product_id, $name, $value);
750
  }
751
  }
752
+ }
753
 
754
  if (!isset($post_data['custom_meta'])) $post_data['custom_meta'] = '';
755
  if($post_data['custom_meta'] != null) {
768
  * @param array the file array from $_FILES
769
  * @param array the preview file array from $_FILES
770
  */
771
+ function wpsc_item_process_file($product_id, $submitted_file, $preview_file = null) {
772
+ global $wpdb;
773
+ add_filter('upload_dir', 'wpsc_modify_upload_directory');
774
+ $overrides = array('test_form'=>false);
 
775
 
776
+ $time = current_time('mysql');
777
+ if ( $post = get_post($product_id) ) {
778
  if ( substr( $post->post_date, 0, 4 ) > 0 )
779
  $time = $post->post_date;
780
  }
781
 
782
+ $file = wp_handle_upload($submitted_file, $overrides, $time);
783
+ if ( isset($file['error']) )
 
784
  return new WP_Error( 'upload_error', $file['error'] );
 
785
 
786
+ $name_parts = pathinfo($file['file']);
787
+ $name = $name_parts['basename'];
788
+
789
+ $url = $file['url'];
790
+ $type = $file['type'];
791
+ $file = $file['file'];
792
+ $title = $name;
793
+ $content = '';
794
 
795
  // Construct the attachment array
796
  $attachment = array(
797
+ 'post_mime_type' => $type,
798
+ 'guid' => $url,
799
+ 'post_parent' => $product_id,
800
+ 'post_title' => $title,
801
+ 'post_content' => $content,
802
+ 'post_type' => "wpsc-product-file",
803
+ 'post_status' => 'inherit'
804
  );
805
 
806
  // Save the data
807
+ $id = wp_insert_post($attachment, $file, $product_id);
808
+ remove_filter('upload_dir', 'wpsc_modify_upload_directory');
 
809
  }
810
 
811
  function wpsc_modify_upload_directory($input) {
847
  'post_status' => 'any'
848
  );
849
 
850
+ $attached_files = (array)get_posts($args);
 
851
 
852
  foreach($attached_files as $key => $attached_file) {
853
  $attached_files_by_file[$attached_file->post_title] = $attached_files[$key];
859
  return null;
860
  }
861
 
862
+
863
+
864
  foreach($selected_files as $selected_file) {
865
  // if we already use this file, there is no point doing anything more.
866
  $file_is_attached = false;
901
  }
902
  }
903
 
904
+ return $fileid;
905
  }
906
 
907
  /**
1057
  `pm`.`meta_key` = "_wpsc_stock"
1058
  ', $product_id ) );
1059
  }
1060
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-variation-list-table.class.php DELETED
@@ -1,675 +0,0 @@
1
- <?php
2
-
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();
15
- private $is_trash = false;
16
- private $is_draft = false;
17
- private $is_publish = false;
18
- private $is_all = true;
19
- private $is_bulk_edit = false;
20
- private $bulk_edited_items = array();
21
- private $bulk_edited_item_ids = array();
22
-
23
- public function __construct( $product_id ) {
24
- WP_List_Table::__construct( array(
25
- 'plural' => 'variations',
26
- ) );
27
-
28
- $this->product_id = $product_id;
29
- if ( isset( $_REQUEST['post_status'] ) ) {
30
- $this->is_trash = $_REQUEST['post_status'] == 'trash';
31
- $this->is_draft = $_REQUEST['post_status'] == 'draft';
32
- $this->is_publish = $_REQUEST['post_status'] == 'publish';
33
- $this->is_all = $_REQUEST['post_status'] == 'all';
34
- } else {
35
- $this->is_all = true;
36
- }
37
- }
38
-
39
- public function prepare_items() {
40
- if ( ! empty( $this->items ) )
41
- return;
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,
51
- 'order' => "ASC",
52
- 'posts_per_page' => $per_page,
53
- );
54
-
55
- if ( isset( $_REQUEST['post_status'] ) )
56
- $this->args['post_status'] = $_REQUEST['post_status'];
57
-
58
- if ( isset( $_REQUEST['s'] ) )
59
- $this->args['s'] = $_REQUEST['s'];
60
-
61
- if ( isset( $_REQUEST['paged'] ) )
62
- $this->args['paged'] = $_REQUEST['paged'];
63
-
64
- $query = new WP_Query( $this->args );
65
-
66
- $this->items = $query->posts;
67
- $total_items = $query->found_posts;
68
- $total_pages = $query->max_num_pages;
69
-
70
- $this->set_pagination_args( array(
71
- 'total_items' => $total_items,
72
- 'total_pages' => $total_pages,
73
- 'per_page' => $per_page
74
- ) );
75
-
76
- if ( empty( $this->items ) )
77
- return;
78
-
79
- $ids = wp_list_pluck( $this->items, 'ID' );
80
- $object_terms = wp_get_object_terms( $ids, 'wpsc-variation', array( 'fields' => 'all_with_object_id' ) );
81
-
82
- foreach ( $object_terms as $term ) {
83
- if ( ! array_key_exists( $term->object_id, $this->object_terms_cache ) )
84
- $this->object_terms_cache[$term->object_id] = array();
85
-
86
- $this->object_terms_cache[$term->object_id][$term->parent] = $term->name;
87
- }
88
- }
89
-
90
- public function get_hidden_columns() {
91
- return array();
92
- }
93
-
94
- /**
95
- * Get a list of all, hidden and sortable columns, with filter applied
96
- *
97
- * @since 3.1.0
98
- * @access protected
99
- *
100
- * @return array
101
- */
102
- public function get_column_info() {
103
- if ( isset( $this->_column_headers ) )
104
- return $this->_column_headers;
105
-
106
- $screen = get_current_screen();
107
-
108
- $columns = $this->get_columns();
109
- $hidden = $this->get_hidden_columns();
110
- $_sortable = $this->get_sortable_columns();
111
-
112
- $sortable = array();
113
- foreach ( $_sortable as $id => $data ) {
114
- if ( empty( $data ) )
115
- continue;
116
-
117
- $data = (array) $data;
118
- if ( !isset( $data[1] ) )
119
- $data[1] = false;
120
-
121
- $sortable[$id] = $data;
122
- }
123
-
124
- $this->_column_headers = array( $columns, $hidden, $sortable );
125
-
126
- return $this->_column_headers;
127
- }
128
-
129
- public function get_columns() {
130
- $columns = array(
131
- 'cb' => '<input type="checkbox" />',
132
- 'title' => __( 'Title', 'wpsc' ),
133
- 'sku' => __( 'SKU', 'wpsc' ),
134
- 'price' => __( 'Price', 'wpsc' ),
135
- 'sale_price' => __( 'Sale Price', 'wpsc' ),
136
- 'stock' => __( 'Stock', 'wpsc' ),
137
- );
138
-
139
- if ( get_option( 'wpec_taxes_enabled' ) )
140
- $columns['tax'] = __( 'Taxable Amount', 'wpsc' );
141
-
142
- return apply_filters( 'wpsc_variation_column_headers', $columns );
143
- }
144
-
145
- public function get_sortable_columns() {
146
- return array();
147
- }
148
-
149
- public function column_cb( $item ) {
150
- $checked = isset( $_REQUEST['variations'] ) ? checked( in_array( $item->ID, $_REQUEST['variations'] ), true, false ) : '';
151
- return sprintf(
152
- '<input type="checkbox" %1$s name="%2$s[]" value="%3$s" />',
153
- /*$1%s*/ $checked,
154
- /*$2%s*/ 'post',
155
- /*$3%s*/ $item->ID
156
- );
157
- }
158
-
159
- private function get_row_actions( $item ) {
160
- $post_type_object = get_post_type_object( 'wpsc-product' );
161
- $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $item->ID );
162
-
163
- $actions = array();
164
- if ( apply_filters( 'wpsc_show_product_variations_edit_action', true, $item ) && $can_edit_post && 'trash' != $item->post_status )
165
- $actions['edit'] = '<a target="_blank" href="' . get_edit_post_link( $item->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ), 'wpsc' ) . '">' . __( 'Edit' ) . '</a>';
166
-
167
- $actions['stock hide-if-no-js'] = '<a class="wpsc-variation-stock-editor-link" href="#" title="' . __( 'Show shipping editor', 'wpsc' ) . '">' . __( 'Edit Shipping', 'wpsc' ) . '</a>';
168
-
169
- if ( $item->post_status == 'draft' ) {
170
- $show_url = add_query_arg( array(
171
- 'bulk_action' => 'show',
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 ) ) {
186
- $force_delete = 'trash' == $item->post_status || ! EMPTY_TRASH_DAYS;
187
- $redirect_url = urlencode( _wpsc_get_product_variation_form_url( $this->product_id ) );
188
- $delete_link = add_query_arg( '_wp_http_referer', $redirect_url, get_delete_post_link( $item->ID, '', $force_delete ) );
189
-
190
- if ( 'trash' == $item->post_status ) {
191
- $restore_url = admin_url( sprintf( $post_type_object->_edit_link, $item->ID ) );
192
- $restore_url = add_query_arg(
193
- array(
194
- 'action' => 'untrash',
195
- '_wp_http_referer' => $redirect_url,
196
- ),
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;
210
- }
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>
239
- <div class="wpsc-product-variation-title">
240
- <strong class="row-title">
241
- <?php if ( $show_edit_link ): ?>
242
- <a target="_blank" href="<?php echo esc_url( get_edit_post_link( $item->ID, true ) ); ?>" title="<?php esc_attr_e( __( 'Edit this item' ), 'wpsc' ); ?>">
243
- <?php endif; ?>
244
- <?php echo esc_html( apply_filters( 'wpsc_variation_name', $title, $item ) ); ?>
245
- <?php if ( $show_edit_link ): ?>
246
- </a>
247
- <?php endif; ?>
248
- </strong>
249
- <?php echo $this->row_actions( $this->get_row_actions( $item ) ); ?>
250
- </div>
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
276
- }
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
285
- }
286
-
287
- public function column_sku( $item ) {
288
- $sku = get_product_meta( $item->ID, 'sku', true );
289
- ?>
290
- <input type="text" name="wpsc_variations[<?php echo $item->ID; ?>][sku]" value="<?php echo esc_attr( $sku ); ?>" />
291
- <?php
292
- }
293
-
294
- public function column_tax( $item ) {
295
- $meta = get_post_meta( $item->ID, '_wpsc_product_metadata', true );
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
303
- }
304
-
305
- public function column_default( $item, $column_name ) {
306
- $output = apply_filters( 'wpsc_manage_product_variations_custom_column', '', $column_name, $item );
307
- return $output;
308
- }
309
-
310
- private function shipping_editor( $item = false ) {
311
- static $alternate = '';
312
-
313
- if ( ! $item )
314
- $alternate = '';
315
- else
316
- $alternate = ( $alternate == '' ) ? ' alternate' : '';
317
-
318
- $row_class = $alternate;
319
-
320
- $style = '';
321
- $bulk = false;
322
- if ( ! $item ) {
323
- $item = get_post( $this->product_id );
324
- $field_name = "wpsc_bulk_edit[product_metadata]";
325
- $row_class .= " wpsc_bulk_edit_shipping";
326
- if ( $this->is_bulk_edit )
327
- $style = ' style="display:table-row;"';
328
- else
329
- $style = ' style="display:none;"';
330
- $bulk = true;
331
- } else {
332
- $field_name = "wpsc_variations[{$item->ID}][product_metadata]";
333
- }
334
- $colspan = count( $this->get_columns() ) - 1;
335
- ?>
336
- <tr class="wpsc-stock-editor-row inline-edit-row<?php echo $row_class; ?>"<?php echo $style; ?> id="wpsc-stock-editor-row-<?php echo $item->ID; ?>">
337
- <td></td>
338
- <td colspan="<?php echo $colspan; ?>" class="colspanchange">
339
- <h4><?php esc_html_e( 'Variation Stock Editor', 'wpsc' ); ?></h4>
340
- <?php wpsc_product_shipping_forms( $item, $field_name, $bulk ); ?>
341
- </td>
342
- </tr>
343
- <?php
344
- }
345
-
346
- public function single_row( $item ) {
347
- static $count = 0;
348
- $count ++;
349
- $item->index = $count;
350
- parent::single_row( $item );
351
- $this->shipping_editor( $item );
352
- }
353
-
354
- /**
355
- * Generate the table navigation above or below the table
356
- *
357
- * @since 3.1.0
358
- * @access protected
359
- */
360
- public function display_tablenav( $which ) {
361
- ?>
362
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
363
- <div class="alignleft actions">
364
- <?php $this->bulk_actions( $which ); ?>
365
- </div>
366
- <?php
367
- $this->extra_tablenav( $which );
368
- $this->pagination( $which );
369
- ?>
370
- <br class="clear" />
371
- </div>
372
- <?php
373
- }
374
-
375
- public function display_rows() {
376
- $this->display_bulk_edit_row();
377
- if ( ! $this->is_bulk_edit )
378
- parent::display_rows();
379
- }
380
-
381
- public function display_messages() {
382
- if ( isset($_REQUEST['locked']) || isset($_REQUEST['skipped']) || isset($_REQUEST['updated']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) )
383
- $messages = array();
384
- else
385
- return;
386
-
387
- if ( isset($_REQUEST['updated']) && (int) $_REQUEST['updated'] ) {
388
- $messages[] = sprintf( _n( '%s post updated.', '%s posts updated.', $_REQUEST['updated'] ), number_format_i18n( $_REQUEST['updated'] ) );
389
- unset($_REQUEST['updated']);
390
- }
391
-
392
- if ( isset($_REQUEST['skipped']) && (int) $_REQUEST['skipped'] )
393
- unset($_REQUEST['skipped']);
394
-
395
- if ( isset($_REQUEST['locked']) && (int) $_REQUEST['locked'] ) {
396
- $messages[] = sprintf( _n( '%s item not updated, somebody is editing it.', '%s items not updated, somebody is editing them.', $_REQUEST['locked'] ), number_format_i18n( $_REQUEST['locked'] ) );
397
- unset($_REQUEST['locked']);
398
- }
399
-
400
- if ( isset($_REQUEST['deleted']) && (int) $_REQUEST['deleted'] ) {
401
- $messages[] = sprintf( _n( 'Item permanently deleted.', '%s items permanently deleted.', $_REQUEST['deleted'] ), number_format_i18n( $_REQUEST['deleted'] ) );
402
- unset($_REQUEST['deleted']);
403
- }
404
-
405
- if ( isset($_REQUEST['trashed']) && (int) $_REQUEST['trashed'] ) {
406
- $messages[] = sprintf( _n( 'Item moved to the Trash.', '%s items moved to the Trash.', $_REQUEST['trashed'] ), number_format_i18n( $_REQUEST['trashed'] ) );
407
- $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
408
- $undo_url = wp_nonce_url( add_query_arg( array( 'doaction' => 'undo', 'action' => 'untrash', 'ids' => $ids ) ), 'bulk-posts' );
409
- $messages[] = '<a href="' . esc_url( $undo_url ) . '">' . __('Undo') . '</a>';
410
- unset($_REQUEST['trashed']);
411
- }
412
-
413
- if ( isset($_REQUEST['untrashed']) && (int) $_REQUEST['untrashed'] ) {
414
- $messages[] = sprintf( _n( 'Item restored from the Trash.', '%s items restored from the Trash.', $_REQUEST['untrashed'] ), number_format_i18n( $_REQUEST['untrashed'] ) );
415
- unset($_REQUEST['undeleted']);
416
- }
417
- ?>
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
-
425
- public function get_bulk_actions() {
426
- $actions = array();
427
-
428
- if ( $this->is_trash )
429
- $actions['untrash'] = __( 'Restore' );
430
-
431
- if ( $this->is_draft )
432
- $actions['show'] = __( 'Publish', 'wpsc' );
433
- elseif ( $this->is_all || $this->is_publish )
434
- $actions['hide'] = __( 'Mark as Draft', 'wpsc' );
435
-
436
- $actions['edit'] = __( 'Edit', 'wpsc' );
437
-
438
- if ( $this->is_trash || !EMPTY_TRASH_DAYS )
439
- $actions['delete'] = __( 'Delete Permanently' );
440
- else
441
- $actions['trash'] = __( 'Move to Trash' );
442
-
443
- return $actions;
444
- }
445
-
446
- public function bulk_actions( $which = '' ) {
447
- $screen = get_current_screen();
448
-
449
- if ( is_null( $this->_actions ) ) {
450
- $no_new_actions = $this->_actions = $this->get_bulk_actions();
451
- // This filter can currently only be used to remove actions.
452
- $this->_actions = apply_filters( 'bulk_actions-' . $screen->id, $this->_actions );
453
- $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
454
- $two = '';
455
- } else {
456
- $two = '2';
457
- }
458
-
459
- if ( empty( $this->_actions ) )
460
- return;
461
-
462
- echo '<input type="hidden" name="bulk_action_nonce" value="' . wp_create_nonce( 'wpsc_product_variations_bulk_action' ) .'" />';
463
- echo "<select name='bulk_action$two'>\n";
464
- echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
465
-
466
- foreach ( $this->_actions as $name => $title ) {
467
- $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
468
-
469
- echo "\t<option value='$name'$class>$title</option>\n";
470
- }
471
-
472
- echo "</select>\n";
473
-
474
- submit_button( __( 'Apply' ), 'action', false, false, array( 'id' => "doaction$two" ) );
475
- echo "\n";
476
- }
477
-
478
- public function current_action() {
479
- if ( isset( $_REQUEST['bulk_action'] ) && -1 != $_REQUEST['bulk_action'] )
480
- return $_REQUEST['bulk_action'];
481
-
482
- if ( isset( $_REQUEST['bulk_action2'] ) && -1 != $_REQUEST['bulk_action2'] )
483
- return $_REQUEST['bulk_action2'];
484
-
485
- return false;
486
- }
487
-
488
- private function count_variations() {
489
- global $wpdb;
490
- $query = $wpdb->prepare( "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = 'wpsc-product' AND post_parent = %d GROUP BY post_status", $this->product_id );
491
- $results = $wpdb->get_results( $query );
492
-
493
- $return = array();
494
- foreach ( get_post_stati() as $state )
495
- $stats[$state] = 0;
496
-
497
- foreach ( $results as $row ) {
498
- $return[$row->post_status] = $row->num_posts;
499
- }
500
-
501
- return (object) $return;
502
- }
503
-
504
- public function get_views() {
505
- global $locked_post_status;
506
- $parent = get_post( $this->product_id );
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();
518
-
519
- $status_links = array();
520
- $num_posts = $this->count_variations();
521
- $class = '';
522
-
523
- $current_user_id = get_current_user_id();
524
-
525
- if ( isset( $num_posts->inherit ) ) {
526
- $key = $parent->post_status;
527
- if ( ! isset( $num_posts->$key ) )
528
- $num_posts->$key = 0;
529
-
530
- $num_posts->$key += $num_posts->inherit;
531
- unset( $num_posts->inherit );
532
- }
533
-
534
- $total_posts = array_sum( (array) $num_posts );
535
-
536
- // Subtract post types that are not included in the admin all list.
537
- foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state ) {
538
- if ( isset( $num_posts->$state ) )
539
- $total_posts -= $num_posts->$state;
540
- }
541
-
542
- $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
543
- $status_links['all'] = "<a href='{$url_base}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
544
-
545
- foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
546
- $class = '';
547
-
548
- $status_name = $status->name;
549
-
550
- if ( $status_name == 'publish' )
551
- continue;
552
-
553
- if ( !in_array( $status_name, $avail_post_stati ) )
554
- continue;
555
-
556
- if ( empty( $num_posts->$status_name ) ) {
557
- if ( isset( $_REQUEST['post_status'] ) && $status_name == $_REQUEST['post_status'] )
558
- $num_posts->$_REQUEST['post_status'] = 0;
559
- else
560
- continue;
561
- }
562
-
563
- if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
564
- $class = ' class="current"';
565
-
566
- $status_links[$status_name] = "<a href='" . esc_url( add_query_arg( 'post_status', $status_name, $url_base ) ) ."'$class>" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
567
- }
568
-
569
- return $status_links;
570
- }
571
-
572
- public function set_bulk_edited_items( $item_ids ) {
573
- $this->prepare_items();
574
- $this->is_bulk_edit = true;
575
- foreach ( $this->items as $key => $item ) {
576
- if ( in_array( $item->ID, $item_ids ) ) {
577
- $this->bulk_edited_items[] = $item;
578
- unset( $this->items[$key] );
579
- }
580
- }
581
- $this->bulk_edited_item_ids = $item_ids;
582
- }
583
-
584
- private function display_bulk_edit_row() {
585
- $style = $this->is_bulk_edit ? '' : ' style="display:none";';
586
- $classes = 'wpsc-bulk-edit';
587
- if ( $this->is_bulk_edit )
588
- $classes .= ' active';
589
- echo "<tr{$style} class='{$classes}'>";
590
- list( $columns, $hidden ) = $this->get_column_info();
591
- foreach ( $columns as $column_name => $column_display_name ) {
592
- $class = "class='$column_name column-$column_name inline-edit-row'";
593
- $style = '';
594
-
595
- if ( in_array( $column_name, $hidden ) )
596
- $style = ' style="display:none;"';
597
-
598
- $attributes = "$class$style";
599
-
600
- if ( $column_name == 'cb' )
601
- echo '<td></td>';
602
- elseif ( method_exists( $this, 'bulk_edit_column_' . $column_name ) ) {
603
- echo "<td $attributes>";
604
- echo call_user_func( array( &$this, 'bulk_edit_column_' . $column_name ) );
605
- echo "</td>";
606
- }
607
- }
608
- echo '</tr>';
609
- $this->shipping_editor();
610
- }
611
-
612
- public function bulk_edit_column_title() {
613
- ?>
614
- <div class="wpsc-bulk-edit-items">
615
- <?php foreach ( $this->bulk_edited_items as $item ):
616
- $title = implode( ', ', $this->object_terms_cache[$item->ID] );
617
- ?>
618
- <div class="wpsc-bulk-edit-item">
619
- <span>
620
- <input type="checkbox" name="wpsc_bulk_edit[post][]" checked="checked" value="<?php echo $item->ID; ?>" />
621
- </span>
622
- <strong>
623
- <a class="row-title" href="<?php echo get_edit_post_link( $item->ID ); ?>" title="<?php esc_attr_e( 'Edit this variation', 'wpsc' ) ?>"><?php echo esc_html( $title ); ?></a>
624
- </strong>
625
- </div>
626
- <?php endforeach; ?>
627
- </div>
628
- <?php
629
- }
630
-
631
- public function bulk_edit_column_stock() {
632
- ?>
633
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][stock]" value="1" />
634
- <input tabindex="101" type="text" name="wpsc_bulk_edit[stock]" value="" />
635
- <?php
636
- }
637
-
638
- public function bulk_edit_column_price() {
639
- ?>
640
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][price]" value="1" />
641
- <input tabindex="103" type="text" name="wpsc_bulk_edit[price]" value="" />
642
- <?php
643
- }
644
-
645
- public function bulk_edit_column_tax() {
646
- ?>
647
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][wpec_taxes_taxable_amount]" value="1" />
648
- <input tabindex="102" type="text" name="wpsc_bulk_edit[product_metadata][wpec_taxes_taxable_amount]" value="" />
649
- <?php
650
- }
651
-
652
- public function bulk_edit_column_sku() {
653
- ?>
654
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][sku]" value="1" />
655
- <input tabindex="105" type="text" name="wpsc_bulk_edit[sku]" value="" />
656
- <?php
657
- }
658
-
659
- public function bulk_edit_column_sale_price() {
660
- $sale_price = get_product_meta( $this->product_id, 'special_price', true );
661
- ?>
662
- <input class="wpsc-bulk-edit-fields" type="checkbox" name="wpsc_bulk_edit[fields][sale_price]" value="1" />
663
- <input tabindex="104" type="text" name="wpsc_bulk_edit[sale_price]" value="">
664
- <?php
665
- }
666
-
667
- public function extra_tablenav( $which ) {
668
- $post_type_object = get_post_type_object( 'wpsc-product' );
669
- ?><div class="alignleft actions"><?php
670
- if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
671
- submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false );
672
- }
673
- ?></div><?php
674
- }
675
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-variations-manage.page.php DELETED
@@ -1,13 +0,0 @@
1
- <?php $this->list_table->display_messages(); ?>
2
- <form action="" method="post">
3
- <?php $this->list_table->views(); ?>
4
- <div class="alignright actions wpsc-save-product-variations top">
5
- <?php submit_button( __( 'Save Variations', 'wpsc' ) ); ?>
6
- </div>
7
- <input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
8
- <?php wp_nonce_field( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' ); ?>
9
- <?php $this->list_table->display(); ?>
10
- <div class="alignright actions wpsc-save-product-variations bottom">
11
- <?php submit_button( __( 'Save Variations', 'wpsc' ) ); ?>
12
- </div>
13
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-variations-page.class.php DELETED
@@ -1,423 +0,0 @@
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() {
16
- require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/product-variation-list-table.class.php' );
17
- $GLOBALS['hook_suffix'] = 'wpsc-product-variations-iframe';
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 ) {
36
- $keys = array_merge( array_keys( $original ), array_keys( $updated ) );
37
-
38
- foreach ( $keys as $key ) {
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];
46
- if ( in_array( $key, array( 'weight', 'wpec_taxes_taxable_amount', 'height', 'width', 'length' ) ) )
47
- $original[$key] = (float) $original[$key];
48
- }
49
-
50
- }
51
-
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
-
101
- private function save_variations_meta(){
102
- if ( empty( $_REQUEST['wpsc_variations'] ) )
103
- return;
104
-
105
- check_admin_referer( 'wpsc_save_variations_meta', '_wpsc_save_meta_nonce' );
106
- $post_type_object = get_post_type_object( 'wpsc-product' );
107
- if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
108
- wp_die( __( 'Cheatin&#8217; uh?' ) );
109
-
110
- /* Long-term, we should have a better saving routine here. Can't unset these currently. *
111
- /* That said, the only thing that fails hard if we can't unset it is the checkbox. */
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();
125
- $admin_body_class = $hook_suffix;
126
- $post_type_object = get_post_type_object( 'wpsc-product' );
127
-
128
- wp_enqueue_style( 'global' );
129
- wp_enqueue_style( 'wp-admin' );
130
- wp_enqueue_style( 'buttons' );
131
- wp_enqueue_style( 'colors' );
132
- wp_enqueue_style( 'ie' );
133
- wp_enqueue_script( 'common' );
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}" ) ) )
142
- $callback = "callback_tab_manage";
143
-
144
- $this->$callback();
145
-
146
- @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
147
- require_once( WPSC_FILE_PATH . "/wpsc-admin/includes/product-variations.page.php" );
148
- }
149
-
150
- private function display_tabs() {
151
- $tabs = array(
152
- 'manage' => _x( 'Manage', 'manage product variations', 'wpsc' ),
153
- 'setup' => __( 'Setup', 'wpsc' ),
154
- );
155
-
156
- echo '<ul id="wpsc-product-variations-tabs" class="category-tabs">';
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>';
164
- }
165
-
166
- private function callback_tab_manage() {
167
- $this->list_table = new WPSC_Product_Variation_List_Table( $this->parent_id );
168
- $this->save_variations_meta();
169
- $this->process_bulk_action();
170
- $this->list_table->prepare_items();
171
- }
172
-
173
- private function callback_tab_setup() {
174
- global $post;
175
- require_once( 'walker-variation-checklist.php' );
176
-
177
- $this->generate_variations();
178
- }
179
-
180
- private function generate_variations() {
181
- if ( ! isset( $_REQUEST['action2'] ) || $_REQUEST['action2'] != 'generate' )
182
- return;
183
-
184
- check_admin_referer( 'wpsc_generate_product_variations', '_wpsc_generate_product_variations_nonce' );
185
-
186
- wpsc_update_variations();
187
-
188
- $sendback = remove_query_arg( array(
189
- '_wp_http_referer',
190
- 'updated',
191
- ) );
192
- wp_redirect( add_query_arg( 'tab', 'manage', $sendback ) );
193
- exit;
194
- }
195
-
196
- public function display_current_tab() {
197
- require_once( WPSC_FILE_PATH . "/wpsc-admin/includes/product-variations-{$this->current_tab}.page.php" );
198
- }
199
-
200
- public function process_bulk_action_delete_all( $post_ids ) {
201
- $post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] );
202
- if ( get_post_status_object( $post_status ) ) // Check the post status exists first
203
- $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='wpsc-product' AND post_status = %s", $post_type, $post_status ) );
204
-
205
- return $this->process_bulk_action_delete( $post_ids );
206
- }
207
-
208
- public function process_bulk_action_trash( $post_ids ) {
209
- $post_type_object = get_post_type_object( 'wpsc-product' );
210
- $trashed = 0;
211
- foreach( (array) $post_ids as $post_id ) {
212
- if ( !current_user_can( $post_type_object->cap->delete_post, $post_id ) )
213
- wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
214
-
215
- if ( !wp_trash_post( $post_id ) )
216
- wp_die( __( 'Error in moving to Trash.' ) );
217
-
218
- $trashed++;
219
- }
220
- return add_query_arg( array( 'trashed' => $trashed, 'ids' => join( ',', $post_ids ) ) );
221
- }
222
-
223
- public function process_bulk_action_untrash( $post_ids ) {
224
- $post_type_object = get_post_type_object( 'wpsc-product' );
225
- $untrashed = 0;
226
- foreach( (array) $post_ids as $post_id ) {
227
- if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
228
- wp_die( __( 'You are not allowed to restore this item from the Trash.' ) );
229
-
230
- if ( !wp_untrash_post( $post_id ) )
231
- wp_die( __( 'Error in restoring from Trash.' ) );
232
-
233
- $untrashed++;
234
- }
235
- return add_query_arg( 'untrashed', $untrashed );
236
- }
237
-
238
- public function process_bulk_action_delete( $post_ids ) {
239
- $deleted = 0;
240
- $post_type_object = get_post_type_object( 'wpsc-product' );
241
- foreach( (array) $post_ids as $post_id ) {
242
- $post_del = & get_post( $post_id );
243
-
244
- if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
245
- wp_die( __( 'You are not allowed to delete this item.' ) );
246
-
247
- if ( $post_del->post_type == 'attachment' ) {
248
- if ( ! wp_delete_attachment( $post_id ) )
249
- wp_die( __( 'Error in deleting...' ) );
250
- } else {
251
- if ( ! wp_delete_post( $post_id ) )
252
- wp_die( __( 'Error in deleting...' ) );
253
- }
254
- $deleted++;
255
- }
256
- return add_query_arg( 'deleted', $deleted );
257
- }
258
-
259
- public function process_bulk_action_hide( $post_ids ) {
260
- $updated = 0;
261
- foreach( $post_ids as $id ) {
262
- wp_update_post( array(
263
- 'ID' => $id,
264
- 'post_status' => 'draft',
265
- ) );
266
- $updated ++;
267
- }
268
- return add_query_arg( 'updated', $updated );
269
- }
270
-
271
- public function process_bulk_action_show( $post_ids ) {
272
- $updated = 0;
273
- foreach ( $post_ids as $id ) {
274
- wp_update_post( array(
275
- 'ID' => $id,
276
- 'post_status' => 'publish',
277
- ) );
278
- $updated ++;
279
- }
280
- return add_query_arg( 'updated', $updated );
281
- }
282
-
283
- private function save_bulk_edited_items() {
284
- $ids = array_map( 'absint', $_REQUEST['wpsc_bulk_edit']['post'] );
285
- $data = $_REQUEST['wpsc_bulk_edit'];
286
-
287
- if ( empty( $_REQUEST['wpsc_bulk_edit']['fields'] ) )
288
- return;
289
-
290
- $fields = $_REQUEST['wpsc_bulk_edit']['fields'];
291
-
292
- foreach ( array( 'stock', 'price', 'sale_price', 'sku' ) as $field ) {
293
- if ( empty( $fields[$field] ) )
294
- unset( $data[$field] );
295
- }
296
-
297
- if ( empty( $fields['shipping'] ) )
298
- unset( $data['product_metadata']['shipping'] );
299
- else {
300
- foreach ( array( 'local', 'international' ) as $field ) {
301
- if ( empty( $fields['shipping'][$field] ) )
302
- unset( $data['product_metadata'][$field] );
303
- }
304
- }
305
-
306
- if ( empty( $fields['measurements'] ) ) {
307
- unset( $data['product_metadata']['dimensions'] );
308
- unset( $data['product_metadata']['weight'] );
309
- unset( $data['product_metadata']['weight_unit'] );
310
- } else {
311
- if ( empty( $fields['measurements']['weight'] ) ) {
312
- unset( $data['product_metadata']['weight'] );
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'] );
331
- unset( $data['fields'] );
332
-
333
- foreach ( $ids as $id ) {
334
- $this->save_variation_meta( $id, $data );
335
- }
336
-
337
- $sendback = $_SERVER['REQUEST_URI'];
338
- $sendback = remove_query_arg( array(
339
- '_wp_http_referer',
340
- 'bulk_action',
341
- 'bulk_action2',
342
- 'bulk_action_nonce',
343
- 'confirm',
344
- 'post',
345
- 'last_paged'
346
- ), $sendback );
347
- $sendback = add_query_arg( 'updated', count( $ids ), $sendback );
348
- wp_redirect( $sendback );
349
- exit;
350
- }
351
-
352
- public function process_bulk_action_edit( $post_ids ) {
353
- $this->list_table->set_bulk_edited_items( $post_ids );
354
- }
355
-
356
- public function process_bulk_action() {
357
- if ( ! empty( $_REQUEST['wpsc_bulk_edit']['post'] ) ) {
358
- $this->save_bulk_edited_items();
359
- return;
360
- }
361
-
362
- $current_action = $this->list_table->current_action();
363
- if ( empty( $current_action ) )
364
- return;
365
-
366
- _wpsc_remove_refresh_variation_parent_term_hooks();
367
-
368
- check_admin_referer( 'wpsc_product_variations_bulk_action', 'bulk_action_nonce' );
369
- $sendback = $_SERVER['REQUEST_URI'];
370
- $callback = 'process_bulk_action_' . $current_action;
371
-
372
- $post_ids = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : array();
373
- if ( ! is_array( $post_ids ) )
374
- $post_ids = explode( ',', $post_ids );
375
- $post_ids = array_map('intval', $post_ids);
376
- if ( ! empty( $post_ids ) && is_callable( array( $this, $callback ) ) )
377
- $sendback = $this->$callback( $post_ids );
378
-
379
- $sendback = remove_query_arg( array(
380
- '_wp_http_referer',
381
- 'bulk_action',
382
- 'bulk_action2',
383
- 'bulk_action_nonce',
384
- 'confirm',
385
- 'post',
386
- 'last_paged'
387
- ), $sendback );
388
-
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
- }
396
- }
397
-
398
- /**
399
- * Wrapper for _wp_admin_html_begin(), which might not be available on older
400
- * WordPress versions.
401
- *
402
- * @access private
403
- * @since 3.8.9.4
404
- */
405
- function _wpsc_admin_html_begin() {
406
- if ( function_exists( '_wp_admin_html_begin' ) ) {
407
- _wp_admin_html_begin();
408
- return;
409
- }
410
-
411
- $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
412
- ?>
413
- <!DOCTYPE html>
414
- <!--[if IE 8]>
415
- <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
416
- <![endif]-->
417
- <!--[if !(IE 8) ]><!-->
418
- <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
419
- <!--<![endif]-->
420
- <head>
421
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
422
- <?php
423
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-variations-setup.page.php DELETED
@@ -1,40 +0,0 @@
1
- <div id="product_variations">
2
- <h4><a href="#wpsc_variation_metabox" class="add_variation_set_action"><?php esc_html_e( '+ Add New Variants', 'wpsc' ) ?></a></h4>
3
-
4
- <div id="add-new-variation-set">
5
- <p>
6
- <label for="new-variation-set-name"><?php esc_html_e( "Enter variation set's name", 'wpsc' ); ?></label>
7
- <input type="text" class="text-field" id="new-variation-set-name" /><br />
8
- </p>
9
- <p class="howto"><?php esc_html_e( "Example: Color. If you want to add variants to an existing set, you can enter the name of that set here.", 'wpsc' ); ?></p>
10
- <p>
11
- <label for="new-variants"><?php esc_html_e( "Enter new variants", 'wpsc' ); ?></label>
12
- <input type="text" class="text-field" id="new-variants" /><br />
13
- </p>
14
- <p class="howto"><?php esc_html_e( "Example: Red, Green, Blue. Separate variants with commas.", 'wpsc' ); ?></p>
15
- <p>
16
- <a class="button" href="#"><?php esc_html_e( 'Add New Variants', 'wpsc' ); ?></a>
17
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
18
- </p>
19
- </div>
20
-
21
- <p><a name='variation_control'>&nbsp;</a><?php _e( 'Select the Variation sets and then the corresponding Variants you want to add to this product.', 'wpsc' ) ?></p>
22
-
23
- <form action="" method="post">
24
- <ul class="variation_checkboxes">
25
- <?php
26
- wp_terms_checklist( $this->parent_id, array(
27
- 'taxonomy' => 'wpsc-variation',
28
- 'walker' => new WPSC_Walker_Variation_Checklist(),
29
- 'checked_ontop' => false,
30
- ) );
31
- ?>
32
- </ul>
33
- <input type="hidden" name="action2" value="generate" />
34
- <input type="hidden" name="product_id" value="<?php echo $this->parent_id; ?>" />
35
- <?php wp_nonce_field( 'wpsc_generate_product_variations', '_wpsc_generate_product_variations_nonce' ); ?>
36
- <?php submit_button( __( 'Generate Variations', 'wpsc' ) ); ?>
37
- </form>
38
-
39
- <div class="clear"></div>
40
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-variations.page.php DELETED
@@ -1,59 +0,0 @@
1
- <?php _wpsc_admin_html_begin(); ?>
2
- <title><?php esc_html_e( 'Manage Product Variations', 'wpsc' ); ?></title>
3
- <script type="text/javascript">
4
- addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
5
- var userSettings = {
6
- 'url': '<?php echo SITECOOKIEPATH; ?>',
7
- 'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
8
- 'time':'<?php echo time() ?>'
9
- },
10
- ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
11
- pagenow = '<?php echo $current_screen->id; ?>',
12
- typenow = '<?php echo $current_screen->post_type; ?>',
13
- adminpage = '<?php echo $admin_body_class; ?>',
14
- thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
15
- decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
16
- isRtl = <?php echo (int) is_rtl(); ?>;
17
- </script>
18
- <?php
19
- do_action('admin_enqueue_scripts', $hook_suffix);
20
- do_action("admin_print_styles-$hook_suffix");
21
- do_action('admin_print_styles');
22
- do_action("admin_print_scripts-$hook_suffix");
23
- do_action('admin_print_scripts');
24
- do_action("admin_head-$hook_suffix");
25
- do_action('admin_head');
26
- ?>
27
- <style type="text/css">
28
- html {
29
- background-color:transparent;
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
-
53
- <?php
54
- do_action('admin_print_footer_scripts');
55
- do_action("admin_footer-" . $GLOBALS['hook_suffix']);
56
- ?>
57
- <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
58
- </body>
59
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/products.php CHANGED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP eCommerce product page functions
4
+ *
5
+ * These are the main WPSC Admin functions
6
+ *
7
+ * @package wp-e-commerce
8
+ * @since 3.8
9
+ *
10
+ */
11
+
12
+ /**
13
+ * wpsc_product_rows function, copies the functionality of the wordpress code for displaying posts and pages, but is for products
14
+ *
15
+ */
16
+ function wpsc_admin_product_listing($parent_product = null) {
17
+ global $wp_query;
18
+ add_filter('the_title','esc_html');
19
+ $args = array_merge( $wp_query->query, array( 'posts_per_page' => '-1' ) );
20
+ $GLOBALS['wpsc_products'] = get_posts( $args );
21
+
22
+ foreach ( (array)$GLOBALS['wpsc_products'] as $product ) {
23
+ wpsc_product_row($product, $parent_product);
24
+ }
25
+ }
26
+
27
+ /**
28
+ * Adds the -trash status in the product row of manage products page
29
+ *
30
+ * Gary asks: Why do we need this?
31
+ *
32
+ * @access public
33
+ *
34
+ * @since 3.8
35
+ * @param $post_status (array) of current posts statuses
36
+ * @return $post_status (array)
37
+ */
38
+ function wpsc_trashed_post_status($post_status){
39
+ $post = get_post(get_the_ID());
40
+ if( !empty($post) && 'wpsc-product' == $post->post_type && 'trash' == $post->post_status && !in_array('trash', $post_status))
41
+ $post_status[] = 'Trash';
42
+
43
+ return $post_status;
44
+ }
45
+
46
+ // commenting this out because it seems unnecessary and producing PHP notices
47
+ // add_filter('display_post_states','wpsc_trashed_post_status');
48
+
49
+ /**
50
+ * Spits out the current products details in a table row for manage products page and variations on edit product page.
51
+ * @access public
52
+ *
53
+ * @since 3.8
54
+ * @param $product (Object), $parent_product (Int) Note: I believe parent_product is unused
55
+ */
56
+ function wpsc_product_row(&$product, $parent_product = null) {
57
+ global $mode, $current_user, $wpsc_products;
58
+
59
+ //is this good practice? <v.bakaitis@gmail.com>
60
+ static $rowclass, $object_terms_cache = array();
61
+
62
+ // store terms associated with variants inside a cache array. This only requires 1 DB query.
63
+ if ( empty( $object_terms_cache ) ) {
64
+ $ids = wp_list_pluck( $wpsc_products, 'ID' );
65
+ $object_terms = wp_get_object_terms( $ids, 'wpsc-variation', array( 'fields' => 'all_with_object_id' ) );
66
+ foreach ( $object_terms as $term ) {
67
+ if ( ! array_key_exists( $term->object_id, $object_terms_cache ) )
68
+ $object_terms_cache[$term->object_id] = array();
69
+
70
+ $object_terms_cache[$term->object_id][$term->parent] = $term->name;
71
+ }
72
+ }
73
+
74
+ $global_product = $product;
75
+ setup_postdata($product);
76
+ $product_post_type_object = get_post_type_object('wpsc-product');
77
+ $current_user_can_edit_this_product = current_user_can( $product_post_type_object->cap->edit_post, $product->ID );
78
+
79
+ $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
80
+ $post_owner = ( $current_user->ID == $product->post_author ? 'self' : 'other' );
81
+ $edit_link = get_edit_post_link( $product->ID );
82
+
83
+ if ( isset( $object_terms_cache[$product->ID] ) ) {
84
+ ksort( $object_terms_cache[$product->ID] );
85
+ $title = implode( ', ', $object_terms_cache[$product->ID] );
86
+ } else {
87
+ $title = get_the_title( $product->ID );
88
+ }
89
+
90
+ if ( empty( $title ) )
91
+ $title = __('(no title)', 'wpsc');
92
+
93
+ ?>
94
+
95
+ <tr id='post-<?php echo $product->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $product->post_status ); ?> iedit <?php if ( get_option ( 'wpsc_sort_by' ) == 'dragndrop') { echo 'product-edit'; } ?>' valign="top">
96
+ <?php
97
+ $posts_columns = get_column_headers( 'wpsc-product_variants' );
98
+
99
+ if(empty($posts_columns))
100
+ $posts_columns = array('image' => '', 'title' => __('Name', 'wpsc') , 'weight' => __('Weight', 'wpsc'), 'stock' => __('Stock', 'wpsc'), 'price' => __('Price', 'wpsc'), 'sale_price' => __('Sale Price', 'wpsc'), 'SKU' => __('SKU', 'wpsc'), 'hidden_alerts' => '');
101
+
102
+ foreach ( $posts_columns as $column_name=>$column_display_name ) {
103
+ $attributes = "class=\"$column_name column-$column_name\"";
104
+
105
+ switch ($column_name) {
106
+
107
+ case 'date': /* !date case */
108
+ if ( '0000-00-00 00:00:00' == $product->post_date && 'date' == $column_name ) {
109
+ $t_time = $h_time = __('Unpublished', 'wpsc');
110
+ $time_diff = 0;
111
+ } else {
112
+ $t_time = get_the_time(__('Y/m/d g:i:s A', 'wpsc'));
113
+ $m_time = $product->post_date;
114
+ $time = get_post_time('G', true, $post);
115
+
116
+ $time_diff = time() - $time;
117
+
118
+ if ( $time_diff > 0 && $time_diff < 24*60*60 )
119
+ $h_time = sprintf( __('%s ago', 'wpsc'), human_time_diff( $time ) );
120
+ else
121
+ $h_time = mysql2date(__('Y/m/d', 'wpsc'), $m_time);
122
+ }
123
+
124
+ echo '<td ' . $attributes . '>';
125
+ if ( 'excerpt' == $mode )
126
+ echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
127
+ else
128
+ echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
129
+ echo '<br />';
130
+ if ( 'publish' == $product->post_status ) {
131
+ _e('Published', 'wpsc');
132
+ } elseif ( 'future' == $product->post_status ) {
133
+ if ( $time_diff > 0 )
134
+ echo '<strong class="attention">' . __('Missed schedule', 'wpsc') . '</strong>';
135
+ else
136
+ _e('Scheduled', 'wpsc');
137
+ } else {
138
+ _e('Last Modified', 'wpsc');
139
+ }
140
+ echo '</td>';
141
+ break;
142
+
143
+ case 'title': /* !title case */
144
+ $attributes = 'class="post-title column-title"';
145
+
146
+ $edit_link = wp_nonce_url( $edit_link, 'edit-product_'.$product->ID );
147
+ ?>
148
+ <td <?php echo $attributes ?>>
149
+ <strong>
150
+ <?php if ( $current_user_can_edit_this_product && $product->post_status != 'trash' ) { ?>
151
+ <span><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;', 'wpsc'), $title)); ?>"><?php echo $title ?></a></span>
152
+ <?php if($parent_product): ?>
153
+ <a href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;', 'wpsc'), $title)); ?>"><?php echo $title ?></a>
154
+
155
+ <?php endif; ?>
156
+ <?php } else {
157
+ echo $title;
158
+ };
159
+
160
+ _post_states($product);
161
+ $product_alert = apply_filters('wpsc_product_alert', array(false, ''), $product);
162
+ if(!empty($product_alert['messages']))
163
+ $product_alert['messages'] = implode("\n",(array)$product_alert['messages']);
164
+
165
+ if($product_alert['state'] === true) {
166
+ ?>
167
+ <img alt='<?php echo $product_alert['messages'];?>' title='<?php echo $product_alert['messages'];?>' class='product-alert-image' src='<?php echo WPSC_CORE_IMAGES_URL;?>/product-alert.jpg' alt='' />
168
+ <?php
169
+ }
170
+
171
+ // If a product alert has stuff to display, show it.
172
+ // Can be used to add extra icons etc
173
+ if ( !empty( $product_alert['display'] ) ) {
174
+ echo $product_alert['display'];
175
+ }
176
+
177
+ ?>
178
+ </strong>
179
+ <?php
180
+ $has_var = '';
181
+ if(! $parent_product && wpsc_product_has_children($product->ID))
182
+ $has_var = 'wpsc_has_variation';
183
+ $actions = array();
184
+ if ( $current_user_can_edit_this_product && 'trash' != $product->post_status ) {
185
+ $actions['edit'] = '<a class="edit-product" href="'.$edit_link.'" title="' . esc_attr(__('Edit this product', 'wpsc')) . '">'. __('Edit', 'wpsc') . '</a>';
186
+ //commenting this out for now as we are trying new variation ui quick edit boxes are open by default so we dont need this link.
187
+ //$actions['quick_edit'] = "<a class='wpsc_editinline ".$has_var."' title='".esc_attr(__('Quick Edit', 'wpsc'))."' href='#'>".__('Quick Edit', 'wpsc')."</a>";
188
+ }
189
+
190
+ $actions = apply_filters('post_row_actions', $actions, $product);
191
+ $action_count = count($actions);
192
+ $i = 0;
193
+ echo '<div class="row-actions">';
194
+
195
+ foreach ( $actions as $action => $link ) {
196
+ ++$i;
197
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
198
+ echo "<span class='$action'>$link$sep</span>";
199
+ }
200
+
201
+ echo '</div>';
202
+ ?>
203
+ </td>
204
+ <?php
205
+ break;
206
+
207
+
208
+
209
+ case 'image': /* !image case */
210
+ ?>
211
+ <td class="product-image ">
212
+ <?php
213
+ $attachment_args = array(
214
+ 'post_type' => 'attachment',
215
+ 'numberposts' => 1,
216
+ 'post_status' => null,
217
+ 'post_parent' => $product->ID,
218
+ 'orderby' => 'menu_order',
219
+ 'order' => 'ASC'
220
+ );
221
+
222
+
223
+
224
+
225
+ if(isset($product->ID) && has_post_thumbnail($product->ID)){
226
+ echo get_the_post_thumbnail($product->ID, 'admin-product-thumbnails');
227
+ } else {
228
+ $image_url = WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif";
229
+ ?>
230
+ <img title='Drag to a new position' src='<?php echo $image_url; ?>' alt='<?php echo $title; ?>' width='38' height='38' />
231
+ <?php
232
+
233
+
234
+ }
235
+
236
+ ?>
237
+ </td>
238
+ <?php
239
+ break;
240
+
241
+
242
+
243
+ case 'price': /* !price case */
244
+
245
+ $price = get_product_meta($product->ID, 'price', true);
246
+ ?>
247
+ <td <?php echo $attributes ?>>
248
+ <?php echo wpsc_currency_display( $price ); ?>
249
+ <input type="text" class="wpsc_ie_field wpsc_ie_price" value="<?php echo $price; ?>">
250
+ <a href="<?php echo $edit_link?>/#wpsc_downloads">Variant Download Files</a>
251
+ </td>
252
+ <?php
253
+ break;
254
+
255
+ case 'weight' :
256
+
257
+ $product_data['meta'] = array();
258
+ $product_data['meta'] = get_post_meta($product->ID, '');
259
+ foreach($product_data['meta'] as $meta_name => $meta_value) {
260
+ $product_data['meta'][$meta_name] = maybe_unserialize(array_pop($meta_value));
261
+ }
262
+ $product_data['transformed'] = array();
263
+ if(!isset($product_data['meta']['_wpsc_product_metadata']['weight'])) $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
264
+ if(!isset($product_data['meta']['_wpsc_product_metadata']['weight_unit'])) $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
265
+
266
+ $product_data['transformed']['weight'] = wpsc_convert_weight($product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'], false);
267
+ $weight = $product_data['transformed']['weight'];
268
+ if($weight == ''){
269
+ $weight = '0';
270
+ }
271
+ ?>
272
+ <td <?php echo $attributes ?>>
273
+ <span><?php echo $weight; ?></span>
274
+ <input type="text" class="wpsc_ie_field wpsc_ie_weight" value="<?php echo $weight; ?>">
275
+ <a href="<?php echo $edit_link?>/#wpsc_tax">Set Variant Tax</a>
276
+ </td>
277
+ <?php
278
+
279
+ break;
280
+
281
+ case 'stock' :
282
+ $stock = get_post_meta($product->ID, '_wpsc_stock', true);
283
+ ?>
284
+ <td <?php echo $attributes ?>>
285
+ <span><?php echo $stock ? $stock : __('N/A', 'wpsc') ; ?></span>
286
+ <input type="text" class="wpsc_ie_field wpsc_ie_stock" value="<?php echo $stock; ?>">
287
+ <a href="<?php echo $edit_link?>/#wpsc_shipping">Set Variant Shipping</a>
288
+ </td>
289
+ <?php
290
+ break;
291
+
292
+ case 'categories': /* !categories case */
293
+ ?>
294
+ <td <?php echo $attributes ?>><?php
295
+ $categories = get_the_product_category($product->ID);
296
+ if ( !empty( $categories ) ) {
297
+ $out = array();
298
+ foreach ( $categories as $c )
299
+ $out[] = "<a href='admin.php?page=wpsc-edit-products&amp;category={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
300
+ echo join( ', ', $out );
301
+ } else {
302
+ _e('Uncategorized', 'wpsc');
303
+ }
304
+ ?></td>
305
+ <?php
306
+ break;
307
+
308
+
309
+
310
+ case 'tags': /* !tags case */
311
+ ?>
312
+ <td <?php echo $attributes ?>><?php
313
+ $tags = get_the_tags($product->ID);
314
+ if ( !empty( $tags ) ) {
315
+ $out = array();
316
+ foreach ( $tags as $c )
317
+ $out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
318
+ echo join( ', ', $out );
319
+ } else {
320
+ _e('No Tags', 'wpsc');
321
+ }
322
+ ?></td>
323
+ <?php
324
+ break;
325
+ case 'SKU':
326
+ $sku = get_post_meta($product->ID, '_wpsc_sku', true);
327
+ ?>
328
+ <td <?php echo $attributes ?>>
329
+ <span><?php echo $sku ? $sku : __('N/A', 'wpsc'); ?></span>
330
+ <input type="text" class="wpsc_ie_field wpsc_ie_sku" value="<?php echo $sku; ?>">
331
+ <input type="hidden" class="wpsc_ie_id wpsc_ie_field" value="<?php echo $product->ID ?>">
332
+ <div class="wpsc_inline_actions"><input type="button" class="button-primary wpsc_ie_save" value="Save"><img src="<?php echo admin_url( 'images/wpspin_light.gif' ) ?>" class="loading_indicator"><br/></div>
333
+ </td>
334
+ <?php
335
+ break;
336
+ case 'sale_price':
337
+
338
+ $sale_price = get_post_meta($product->ID, '_wpsc_special_price', true);
339
+ ?>
340
+ <td <?php echo $attributes ?>>
341
+ <span><?php echo wpsc_currency_display( $sale_price ); ?></span>
342
+ <input type="text" class="wpsc_ie_field wpsc_ie_special_price" value="<?php echo $sale_price; ?>">
343
+ </td>
344
+ <?php
345
+
346
+ break;
347
+
348
+
349
+ case 'comments': /* !comments case */
350
+ ?>
351
+ <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
352
+ <?php
353
+ $pending_phrase = sprintf( __('%s pending', 'wpsc'), number_format( $pending_comments ) );
354
+ if ( $pending_comments )
355
+ echo '<strong>';
356
+ comments_number("<a href='edit-comments.php?p=$product->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count', 'wpsc') . '</span></a>', "<a href='edit-comments.php?p=$product->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count', 'wpsc') . '</span></a>', "<a href='edit-comments.php?p=$product->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count', 'wpsc') . '</span></a>');
357
+ if ( $pending_comments )
358
+ echo '</strong>';
359
+ ?>
360
+ </div></td>
361
+ <?php
362
+ break;
363
+
364
+
365
+
366
+ case 'author': /* !author case */
367
+ ?>
368
+ <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
369
+ <?php
370
+ break;
371
+
372
+
373
+ case 'control_view': /* !control view case */
374
+ ?>
375
+ <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View', 'wpsc'); ?></a></td>
376
+ <?php
377
+ break;
378
+
379
+
380
+
381
+ case 'control_edit': /* !control edit case */
382
+ ?>
383
+ <td><?php if ( $current_user_can_edit_this_product ) { echo "<a href='$edit_link' class='edit'>" . __('Edit', 'wpsc') . "</a>"; } ?></td>
384
+ <?php
385
+ break;
386
+
387
+
388
+
389
+ case 'control_delete': /* !control delete case */
390
+ ?>
391
+ <td><?php if ( $current_user_can_edit_this_product ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $product->ID) . "' class='delete'>" . __('Delete', 'wpsc') . "</a>"; } ?></td>
392
+ <?php
393
+ break;
394
+
395
+ case 'featured': /* !control featured case */
396
+ ?>
397
+ <td><?php do_action('manage_posts_featured_column', $product->ID); ?></td>
398
+ <?php
399
+ break;
400
+ default: /* !default case */
401
+ ?>
402
+ <td <?php echo $attributes ?>><?php do_action('manage_posts_custom_column', $column_name, $product->ID); ?></td>
403
+ <?php
404
+ break;
405
+ }
406
+ }
407
+ ?>
408
+ </tr>
409
+ <?php
410
+ $product = $global_product;
411
+ }
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,28 +5,19 @@
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;
12
  private $month_filter = true;
13
  private $views = true;
14
- private $status = 'all';
15
  private $per_page = 20;
16
- private $total_amount = 0;
17
- private $joins;
18
- private $where;
19
- private $where_no_filter;
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 )
29
- $_SERVER['REQUEST_URI'] = wp_get_referer();
30
  }
31
 
32
  public function disable_sortable() {
@@ -49,14 +40,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 +58,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 +91,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
 
@@ -130,13 +103,11 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
130
  }
131
 
132
  // filter by status
133
- if ( ! empty( $_REQUEST['status'] ) && $_REQUEST['status'] != 'all' ) {
134
- $this->status = absint( $_REQUEST['status'] );
135
- $where[] = 'processed = ' . $this->status;
136
  }
137
 
138
- $this->where_no_filter = implode( ' AND ', $where );
139
-
140
  // filter by month
141
  if ( ! empty( $_REQUEST['m'] ) ) {
142
  $year = (int) substr( $_REQUEST['m'], 0, 4);
@@ -145,29 +116,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
 
@@ -176,21 +145,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
176
  'per_page' => $this->per_page,
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
- }
185
-
186
- $total_sql = "
187
- SELECT SUM(totalprice)
188
- FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
189
- {$this->joins}
190
- WHERE {$total_where}
191
- ";
192
-
193
- $this->total_amount = $wpdb->get_var( $total_sql );
194
  }
195
 
196
  public function is_pagination_enabled() {
@@ -209,13 +163,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 +171,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 +183,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() {
@@ -253,14 +193,12 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
253
  // there are lots of logs
254
  $today = getdate();
255
  $transient_key = 'wpsc_purchase_logs_months_' . $today['year'] . $today['month'];
256
- /* if ( $months = get_transient( $transient_key ) )
257
- return $months; */
258
 
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
  ";
266
 
@@ -271,14 +209,13 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
271
 
272
  public function get_views() {
273
  global $wpdb;
274
-
275
  $view_labels = array(
276
  1 => _nx_noop( 'Incomplete <span class="count">(%s)</span>', 'Incomplete <span class="count">(%s)</span>', 'purchase logs' ),
277
- 2 => _nx_noop( 'Received <span class="count">(%s)</span>' , 'Received <span class="count">(%s)</span>' , 'purchase logs' ),
278
- 3 => _nx_noop( 'Accepted <span class="count">(%s)</span>' , 'Accepted <span class="count">(%s)</span>' , 'purchase logs' ),
279
  4 => _nx_noop( 'Dispatched <span class="count">(%s)</span>', 'Dispatched <span class="count">(%s)</span>', 'purchase logs' ),
280
- 5 => _nx_noop( 'Closed <span class="count">(%s)</span>' , 'Closed <span class="count">(%s)</span>' , 'purchase logs' ),
281
- 6 => _nx_noop( 'Declined <span class="count">(%s)</span>' , 'Declined <span class="count">(%s)</span>' , 'purchase logs' ),
282
  );
283
 
284
  $sql = "SELECT DISTINCT processed, COUNT(*) AS count FROM " . WPSC_TABLE_PURCHASE_LOGS . " GROUP BY processed ORDER BY processed";
@@ -298,7 +235,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
298
  _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_count, 'purchase logs', 'wpsc' ),
299
  number_format_i18n( $total_count )
300
  );
301
-
302
  $all_href = remove_query_arg( array(
303
  'status',
304
  'paged',
@@ -310,7 +246,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
310
  'paged',
311
  's',
312
  ) );
313
- $all_class = ( $this->status == 'all' && empty( $_REQUEST['m'] ) && empty( $_REQUEST['s'] ) ) ? 'class="current"' : '';
314
  $views = array(
315
  'all' => sprintf(
316
  '<a href="%s" %s>%s</a>',
@@ -321,8 +257,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
321
  );
322
 
323
  foreach ( $statuses as $status => $count ) {
324
- if ( ! isset( $view_labels[$status] ) )
325
- continue;
326
  $text = sprintf(
327
  translate_nooped_plural( $view_labels[$status], $count, 'wpsc' ),
328
  number_format_i18n( $count )
@@ -337,7 +271,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
337
  'paged',
338
  's',
339
  ), $href );
340
- $class = ( $this->status == $status ) ? 'class="current"' : '';
341
  $views[$status] = sprintf(
342
  '<a href="%s" %s>%s</a>',
343
  esc_url( $href ),
@@ -349,14 +283,14 @@ 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;
356
 
357
  if ( ! $this->month_filter ) {
358
  if ( $m !== 0 )
359
- echo '<input type="hidden" name="m" value="' . esc_attr( $m ) . '" />';
360
 
361
  return false;
362
  }
@@ -393,21 +327,6 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
393
  }
394
  }
395
 
396
- public function pagination( $which ) {
397
- ob_start();
398
- parent::pagination( $which );
399
- $output = ob_get_clean();
400
- if ( $this->status == 'all' )
401
- $string = _x( 'Total (excluding Incomplete and Declined): %s', 'sales log page total', 'wpsc' );
402
- else
403
- $string = _x( 'Total: %s', 'sales log page total', 'wpsc' );
404
- $total_amount = ' - ' . sprintf( $string, wpsc_currency_display( $this->total_amount ) );
405
- $total_amount = str_replace( '$', '\$', $total_amount );
406
- $output = preg_replace( '/(<span class="displaying-num">)([^<]+)(<\/span>)/', '${1}${2}' . ' ' . $total_amount . '${3}', $output );
407
-
408
- echo $output;
409
- }
410
-
411
  public function column_cb( $item ){
412
  $checked = isset( $_REQUEST['post'] ) ? checked( in_array( $item->id, $_REQUEST['post'] ), true, false ) : '';
413
  return sprintf(
@@ -430,36 +349,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,15 +373,15 @@ 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 ) {
482
  ?>
483
- <a href="<?php echo esc_url( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wpsc' ) ?>"><?php echo esc_html( $item->id ); ?></a>
484
  <?php if ( ! $this->current_action() == 'delete' ): ?>
485
  <br />
486
- <small><a class="delete" href="<?php echo esc_url( $this->delete_url( $item ) ); ?>"><?php echo esc_html_x( 'Delete', 'Sales log page', 'wpsc' ); ?></a></small>
487
  <?php endif ?>
488
  <?php
489
  }
@@ -509,14 +407,12 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
509
  }
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 +427,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 ) {
@@ -539,11 +435,11 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
539
  $empty = empty( $item->track_id );
540
  ?>
541
  <div data-log-id="<?php echo esc_attr( $item->id ); ?>" <?php echo $empty ? ' class="empty"' : ''; ?>>
542
- <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wpsc' ); ?></a>
543
  <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
544
- <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wpsc' ); ?></a>
545
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
546
- <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wpsc' ); ?></a></small>
547
  </div>
548
  <?php
549
  }
@@ -557,7 +453,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
557
  '1' => __( 'Incomplete Sale', 'wpsc' ),
558
  '2' => __( 'Order Received', 'wpsc' ),
559
  '3' => __( 'Accepted Payment', 'wpsc' ),
560
- '4' => __( 'Job Dispatched', 'wpsc' ),
561
  '5' => __( 'Closed Order', 'wpsc' ),
562
  '6' => __( 'Payment Declined', 'wpsc' ),
563
  );
@@ -570,4 +466,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;
13
  private $month_filter = true;
14
  private $views = true;
 
15
  private $per_page = 20;
 
 
 
 
16
 
17
+ public function __construct() {
18
+ WP_List_Table::__construct( array(
19
+ 'plural' => 'purchase-logs',
20
+ ) );
 
 
 
 
 
21
  }
22
 
23
  public function disable_sortable() {
40
  $this->views = false;
41
  }
42
 
 
 
 
 
 
 
 
 
43
  public function set_per_page( $per_page ) {
44
  $this->per_page = (int) $per_page;
45
  }
58
  $joins = array();
59
  $where = array( '1 = 1' );
60
 
61
+ if ( isset( $_REQUEST['post'] ) )
62
+ $where[] = 'p.id IN (' . implode( ', ', $_REQUEST['post'] ) . ')';
 
 
63
 
64
  $i = 1;
65
  $selects = array( 'p.id', 'p.totalprice AS amount', 'p.processed AS status', 'p.track_id', 'p.date' );
66
  $selects[] = '
67
  (
68
+ SELECT COUNT(*) FROM ' . WPSC_TABLE_CART_CONTENTS . ' AS c
69
  WHERE c.purchaseid = p.id
70
  ) AS item_count';
71
 
72
  $search_terms = empty( $_REQUEST['s'] ) ? array() : explode( ' ', $_REQUEST['s'] );
73
+ $search_sql = array();
 
74
  foreach ( $checkout_fields as $field ) {
75
+ $table_as = 's' . $i;
76
  $select_as = str_replace('billing', '', $field->unique_name );
77
  $selects[] = $table_as . '.value AS ' . $select_as;
78
+ $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 );
79
 
80
  // build search term queries for first name, last name, email
81
  foreach ( $search_terms as $term ) {
82
+ $escaped_term = esc_sql( like_escape( $term ) );
83
+ if ( ! array_key_exists( $term, $search_sql ) )
84
+ $search_sql[$term] = array();
85
 
86
+ $search_sql[$term][] = $table_as . ".value LIKE '%" . $escaped_term . "%'";
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
  $i++;
91
 
92
  // combine query phrases into a single query string
93
  foreach ( $search_terms as $term ) {
94
+ $search_sql[$term][] = "p.track_id = '" . esc_sql( $term ) . "'";
95
  if ( is_numeric( $term ) )
96
+ $search_sql[$term][] = 'p.id = ' . esc_sql( $term );
97
+ $search_sql[$term] = '(' . implode( ' OR ', $search_sql[$term] ) . ')';
98
  }
99
  $search_sql = implode( ' AND ', array_values( $search_sql ) );
100
 
103
  }
104
 
105
  // filter by status
106
+ if ( ! empty( $_REQUEST['status'] ) ) {
107
+ $status = absint( $_REQUEST['status'] );
108
+ $where[] = 'processed = ' . $status;
109
  }
110
 
 
 
111
  // filter by month
112
  if ( ! empty( $_REQUEST['m'] ) ) {
113
  $year = (int) substr( $_REQUEST['m'], 0, 4);
116
  $where[] = "MONTH(FROM_UNIXTIME(date)) = " . esc_sql( $month );
117
  }
118
 
119
+ $selects = implode( ', ', $selects );
120
+ $joins = implode( ' ', $joins );
121
+ $where = implode( ' AND ', $where );
 
122
  $limit = ( $this->per_page !== 0 ) ? "LIMIT {$offset}, {$this->per_page}" : '';
123
 
124
  $orderby = empty( $_REQUEST['orderby'] ) ? 'p.id' : 'p.' . $_REQUEST['orderby'];
125
+ $order = empty( $_REQUEST['order'] ) ? 'DESC' : $_REQUEST['order'];
126
 
127
+ $orderby = esc_sql( $orderby );
128
+ $order = esc_sql( $order );
129
 
130
+ $submitted_data_log = WPSC_TABLE_SUBMITED_FORM_DATA;
131
+ $purchase_log_sql = "
132
  SELECT SQL_CALC_FOUND_ROWS {$selects}
133
  FROM " . WPSC_TABLE_PURCHASE_LOGS . " AS p
134
+ {$joins}
135
+ WHERE {$where}
136
  ORDER BY {$orderby} {$order}
137
  {$limit}
138
+ ";
139
+ $this->items = $wpdb->get_results( $purchase_log_sql );
 
140
  if ( $this->per_page ) {
141
  $total_items = $wpdb->get_var( "SELECT FOUND_ROWS()" );
142
 
145
  'per_page' => $this->per_page,
146
  ) );
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
149
 
150
  public function is_pagination_enabled() {
163
  return $this->search_box;
164
  }
165
 
 
 
 
 
 
 
 
166
  public function get_columns() {
167
  return array(
168
  'cb' => '<input type="checkbox" />',
171
  'amount' => __( 'Amount', 'wpsc' ),
172
  'status' => _x( 'Status', 'sales log list table column', 'wpsc' ),
173
  'date' => __( 'Date', 'wpsc' ),
174
+ 'tracking' => __( 'Tracking ID', 'wpsc' ),
175
+ );
176
  }
177
 
 
 
 
 
 
 
 
178
  public function get_sortable_columns() {
179
  if ( ! $this->sortable )
180
  return array();
183
  'date' => 'id',
184
  'status' => 'processed',
185
  'amount' => 'totalprice',
186
+ );
187
  }
188
 
189
  private function get_months() {
193
  // there are lots of logs
194
  $today = getdate();
195
  $transient_key = 'wpsc_purchase_logs_months_' . $today['year'] . $today['month'];
196
+ if ( $months = get_transient( $transient_key ) )
197
+ return $months;
198
 
199
  $sql = "
200
  SELECT DISTINCT YEAR(FROM_UNIXTIME(date)) AS year, MONTH(FROM_UNIXTIME(date)) AS month
201
+ FROM " . WPSC_TABLE_PURCHASE_LOGS . "
 
 
202
  ORDER BY date DESC
203
  ";
204
 
209
 
210
  public function get_views() {
211
  global $wpdb;
 
212
  $view_labels = array(
213
  1 => _nx_noop( 'Incomplete <span class="count">(%s)</span>', 'Incomplete <span class="count">(%s)</span>', 'purchase logs' ),
214
+ 2 => _nx_noop( 'Received <span class="count">(%s)</span>', 'Received <span class="count">(%s)</span>', 'purchase logs' ),
215
+ 3 => _nx_noop( 'Accepted <span class="count">(%s)</span>', 'Accepted <span class="count">(%s)</span>', 'purchase logs' ),
216
  4 => _nx_noop( 'Dispatched <span class="count">(%s)</span>', 'Dispatched <span class="count">(%s)</span>', 'purchase logs' ),
217
+ 5 => _nx_noop( 'Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'purchase logs' ),
218
+ 6 => _nx_noop( 'Declined <span class="count">(%s)</span>', 'Declined <span class="count">(%s)</span>', 'purchase logs' ),
219
  );
220
 
221
  $sql = "SELECT DISTINCT processed, COUNT(*) AS count FROM " . WPSC_TABLE_PURCHASE_LOGS . " GROUP BY processed ORDER BY processed";
235
  _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_count, 'purchase logs', 'wpsc' ),
236
  number_format_i18n( $total_count )
237
  );
 
238
  $all_href = remove_query_arg( array(
239
  'status',
240
  'paged',
246
  'paged',
247
  's',
248
  ) );
249
+ $all_class = ( ( empty( $_REQUEST['status'] ) || $_REQUEST['status'] == 'all' ) && empty( $_REQUEST['m'] ) && empty( $_REQUEST['s'] ) ) ? 'class="current"' : '';
250
  $views = array(
251
  'all' => sprintf(
252
  '<a href="%s" %s>%s</a>',
257
  );
258
 
259
  foreach ( $statuses as $status => $count ) {
 
 
260
  $text = sprintf(
261
  translate_nooped_plural( $view_labels[$status], $count, 'wpsc' ),
262
  number_format_i18n( $count )
271
  'paged',
272
  's',
273
  ), $href );
274
+ $class = ( ! empty( $_REQUEST['status'] ) && $_REQUEST['status'] == $status ) ? 'class="current"' : '';
275
  $views[$status] = sprintf(
276
  '<a href="%s" %s>%s</a>',
277
  esc_url( $href ),
283
  return $views;
284
  }
285
 
286
+ public function months_dropdown() {
287
  global $wp_locale;
288
 
289
  $m = isset( $_REQUEST['m'] ) ? $_REQUEST['m'] : 0;
290
 
291
  if ( ! $this->month_filter ) {
292
  if ( $m !== 0 )
293
+ echo '<input type="hidden" name="m" value="' . $m . '" />';
294
 
295
  return false;
296
  }
327
  }
328
  }
329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  public function column_cb( $item ){
331
  $checked = isset( $_REQUEST['post'] ) ? checked( in_array( $item->id, $_REQUEST['post'] ), true, false ) : '';
332
  return sprintf(
349
  'c' => 'item_details',
350
  'id' => $item->id,
351
  ), $location );
352
+ return esc_url( $location );
353
  }
354
 
355
  public function column_customer( $item ) {
356
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  <strong>
358
+ <a class="row-title" href="<?php echo esc_attr( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wpsc' ) ?>"><?php echo esc_html( $item->firstname . ' ' . $item->lastname ); ?></a>
359
  </strong><br />
360
+ <small><?php echo make_clickable( $item->email ); ?></small>
 
 
 
361
  <?php
362
  }
363
 
373
  'updated',
374
  'deleted',
375
  ), $location );
376
+ return esc_url( $location );
377
  }
378
 
379
  public function column_id( $item ) {
380
  ?>
381
+ <a href="<?php echo esc_attr( $this->item_url( $item ) ); ?>" title="<?php esc_attr_e( 'View order details', 'wpsc' ) ?>"><?php echo esc_html( $item->id ); ?></a>
382
  <?php if ( ! $this->current_action() == 'delete' ): ?>
383
  <br />
384
+ <small><a class="delete" href="<?php echo esc_url( $this->delete_url( $item ) ); ?>"><?php echo esc_html( _x( 'Delete', 'Sales log page', 'wpsc' ) ); ?></a></small>
385
  <?php endif ?>
386
  <?php
387
  }
407
  }
408
 
409
  public function column_default( $item, $column_name ) {
410
+ return esc_html( $item->$column_name );
 
 
411
  }
412
 
413
  public function column_status( $item ) {
414
  global $wpsc_purchlog_statuses;
415
+ $dropdown_options = array();
416
  $current_status = false;
417
  foreach ( $wpsc_purchlog_statuses as $status ) {
418
  $selected = '';
427
  echo '<select class="wpsc-purchase-log-status" data-log-id="' . $item->id . '">';
428
  echo $dropdown_options;
429
  echo '</select>';
430
+ echo '<img src="' . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . '" class="ajax-feedback" title="" alt="" />';
431
  }
432
 
433
  public function column_tracking( $item ) {
435
  $empty = empty( $item->track_id );
436
  ?>
437
  <div data-log-id="<?php echo esc_attr( $item->id ); ?>" <?php echo $empty ? ' class="empty"' : ''; ?>>
438
+ <a class="add" href="#"><?php echo esc_html( _x( 'Add Tracking ID', 'add purchase log tracking id', 'wpsc' ) ); ?></a>
439
  <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
440
+ <a class="button save" href="#"><?php echo esc_html( _x( 'Save', 'save sales log tracking id', 'wpsc' ) ); ?></a>
441
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
442
+ <small class="send-email"><a href="#"><?php echo esc_html( _x( 'Send Email', 'sales log', 'wpsc' ) ); ?></a></small>
443
  </div>
444
  <?php
445
  }
453
  '1' => __( 'Incomplete Sale', 'wpsc' ),
454
  '2' => __( 'Order Received', 'wpsc' ),
455
  '3' => __( 'Accepted Payment', 'wpsc' ),
456
+ '4' => __( 'Job dispatched', 'wpsc' ),
457
  '5' => __( 'Closed Order', 'wpsc' ),
458
  '6' => __( 'Payment Declined', 'wpsc' ),
459
  );
466
 
467
  parent::search_box( $text, $input_id );
468
  }
469
+ }
wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php CHANGED
@@ -1,9 +1,9 @@
1
  <h3>
2
- <?php esc_html_e( 'Are you sure you want to delete these purchase logs?', 'wpsc' ); ?><br />
3
  </h3>
4
  <div>
5
- <a href="<?php echo esc_url( wp_get_referer() ); ?>" class="button"><?php esc_html_e( 'Go Back', 'wpsc' ); ?></a>
6
- <input class="button-primary" type="submit" value="<?php esc_attr_e( 'Delete', 'wpsc' ); ?>" />
7
  <input type="hidden" name="confirm" value="1" />
8
  <input type="hidden" name="action" value="delete" />
9
  </div>
1
  <h3>
2
+ <?php esc_html_e( 'Are you sure you want to delete these purchase logs?', 'wpsc'); ?><br />
3
  </h3>
4
  <div>
5
+ <a href="<?php echo esc_url( wp_get_referer() ); ?>" class="button">Go Back</a>
6
+ <input class="button-primary" type="submit" value="Delete" />
7
  <input type="hidden" name="confirm" value="1" />
8
  <input type="hidden" name="action" value="delete" />
9
  </div>
wpsc-admin/includes/purchase-logs-page/item-details.php CHANGED
@@ -2,86 +2,53 @@
2
  <div id="icon-users" class="icon32"><br/></div>
3
  <h2>
4
  <?php esc_html_e( 'Sales Log Details', 'wpsc' ); ?>
5
- <span class="subtitle">#<?php echo $this->log_id; ?> – <?php echo wpsc_purchaselog_details_date_time(); ?></span>
6
- <?php $this->purchase_logs_pagination() ?>
7
- </h2>
8
- <?php if ( $receipt_sent ): ?>
9
- <div class="updated">
10
- <p><?php esc_html_e( 'Receipt has been resent successfully.', 'wpsc' ); ?></p>
11
- </div>
12
- <?php elseif ( $receipt_not_sent ) : ?>
13
- <div class="error">
14
- <p><?php esc_html_e( 'Receipt could not be sent to buyer. Please contact your hosting service and make sure your server can send emails.', 'wpsc' ); ?></p>
15
- </div>
16
- <?php endif; ?>
17
-
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 +69,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 +104,45 @@
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
  <div id='post-body'>
8
  <?php if ( wpsc_has_purchlog_shipping() ): ?>
 
9
  <div id='wpsc_shipping_details_box'>
10
  <h3><?php esc_html_e( 'Shipping Address', 'wpsc' ); ?></h3>
11
+ <p><strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong></p>
12
+ <p>
13
+ <?php echo wpsc_display_purchlog_shipping_address(); ?><br />
14
+ <?php echo wpsc_display_purchlog_shipping_city(); ?><br />
15
+ <?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?><br />
16
+ <?php echo wpsc_display_purchlog_shipping_country(); ?><br />
17
+ </p>
18
+ <strong><?php esc_html_e( 'Shipping Options', 'wpsc' ); ?></strong>
19
+ <p>
20
+ <?php esc_html_e('Shipping Method:','wpsc'); ?> <?php echo wpsc_display_purchlog_shipping_method(); ?><br />
21
+ <?php esc_html_e('Shipping Option:','wpsc'); ?> <?php echo wpsc_display_purchlog_shipping_option(); ?><br />
22
+ <?php if( wpsc_purchlogs_has_tracking() ) : ?>
23
+ <?php esc_html_e('Tracking ID:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackid(); ?><br />
24
+ <?php esc_html_e('Shipping Status:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackstatus(); ?><br />
25
+ <?php esc_html_e('Track History:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackhistory(); ?>
26
+ <?php endif; ?>
27
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  </div>
29
  <?php endif ?>
30
 
31
  <div id='wpsc_billing_details_box'>
32
+ <?php do_action( 'wpsc_billing_details_top' ); ?>
33
  <h3><?php esc_html_e( 'Billing Details', 'wpsc' ); ?></h3>
34
+ <p><strong><?php esc_html_e( 'Purchase Log Date:' ,'wpsc'); ?> </strong><?php echo wpsc_purchaselog_details_date(); ?> </p>
35
+ <p><strong><?php esc_html_e('Purchase Number:','wpsc'); ?> </strong><?php echo wpsc_purchaselog_details_purchnumber(); ?> </p>
36
+ <p><strong><?php esc_html_e('Buyers Name:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_name(); ?></p>
37
+ <p>
38
+ <strong><?php esc_html_e('Address:','wpsc'); ?> </strong><br />
39
+ <?php echo wpsc_display_purchlog_buyers_address(); ?><br />
40
+ <?php echo wpsc_display_purchlog_buyers_city(); ?><br />
41
+ <?php echo wpsc_display_purchlog_buyers_state_and_postcode(); ?><br />
42
+ <?php echo wpsc_display_purchlog_buyers_country(); ?><br />
43
+ </p>
44
+
45
+ <p><strong><?php esc_html_e('Phone:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_phone(); ?></p>
46
+ <p><strong><?php esc_html_e('Email:','wpsc'); ?> </strong><a href="mailto:<?php echo wpsc_display_purchlog_buyers_email(); ?>?subject=Message From '<?php echo get_option('siteurl'); ?>'"><?php echo wpsc_display_purchlog_buyers_email(); ?></a></p>
47
+ <p><strong><?php esc_html_e('Payment Method:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?></p>
48
+ <?php if(wpsc_display_purchlog_display_howtheyfoundus()) : ?>
49
+ <p><strong><?php esc_html_e('How User Found Us:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?></p>
50
+ <?php endif; ?>
51
+ <?php do_action( 'wpsc_billing_details_bottom'); ?>
 
 
 
 
 
52
  </div>
53
 
54
  <div id='wpsc_items_ordered'>
69
  <?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
70
  <?php endif; ?>
71
  </td>
72
+ <th><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
73
  <td><?php echo wpsc_display_purchlog_discount(); ?></td>
74
  </tr>
75
 
76
  <?php if( ! wpec_display_product_tax() ): ?>
77
  <tr>
78
  <td colspan='<?php echo $cols; ?>'></td>
79
+ <th><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
80
  <td><?php echo wpsc_display_purchlog_taxes(); ?></td>
81
  </tr>
82
  <?php endif; ?>
83
 
84
  <tr>
85
  <td colspan='<?php echo $cols; ?>'></td>
86
+ <th><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
87
  <td><?php echo wpsc_display_purchlog_shipping(); ?></td>
88
  </tr>
89
  <tr>
90
  <td colspan='<?php echo $cols; ?>'></td>
91
+ <th><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
92
  <td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
93
  </tr>
94
  </tbody>
104
  <input type='hidden' name='wpsc_admin_action' value='purchlogs_update_notes' />
105
  <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' ); ?>" />
106
  <input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
107
+ <p>
108
+ <textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;">
109
+ <?php
110
+ if ( isset( $_POST['purchlog_notes'] ) ) {
111
+ echo esc_html( $_POST['purchlog_notes'] );
112
+ } else {
113
+ echo wpsc_display_purchlog_notes();
114
+ }
115
+ ?>
116
+ </textarea>
117
+ </p>
118
+ <p><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></p>
119
  </form>
120
  </div>
121
  </div>
122
  </div>
123
+ <!-- End Order Notes (by Ben) -->
124
 
125
  <?php $this->purchase_logs_checkout_fields(); ?>
 
126
 
127
  </div>
128
  </div>
129
 
130
+ <div id='wpsc_purchlogitems_links'>
131
  <h3><?php esc_html_e( 'Actions', 'wpsc' ); ?></h3>
132
  <?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
133
+ <?php if ( wpsc_purchlogs_have_downloads_locked() != false ): ?>
134
+ <img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/lock_open.png' alt='clear lock icon' />&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' />
135
+ <?php endif; ?>
136
+ <img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/printer.png' alt='printer icon' />&ensp;<a target="_blank" href='<?php echo esc_url( add_query_arg( 'c', 'packing_slip' ) ); ?>'><?php esc_html_e( 'View Packing Slip', 'wpsc' ); ?></a>
137
+ <br /><br class='small' />
138
+ <img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/email_go.png' alt='email icon' />&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>
139
+
140
+ <br /><br class='small' />
141
+ <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='delete icon' /> &nbsp;<?php _e('Remove this record', 'wpsc') ?></a>
142
+
143
+ <br /><br class='small' />&emsp;&ensp; <a href='<?php echo esc_attr( wp_get_referer() ); ?>'><?php _e('Go Back', 'wpsc'); ?></a>
144
+ <br /><br />
145
  </div>
146
+ <br />
147
 
148
+ </div>
wpsc-admin/includes/purchase-logs-page/list-table.php CHANGED
@@ -1,11 +1,11 @@
1
  <div class="wrap">
2
  <div id="icon-users" class="icon32"><br/></div>
3
  <h2>
4
- <?php esc_html_e( 'Sales Log', 'wpsc' ); ?>
5
 
6
  <?php
7
  if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
8
- printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( stripslashes( $_REQUEST['s'] ) ) ); ?>
9
  </h2>
10
 
11
  <?php if ( ! empty( $_REQUEST['updated'] ) || ! empty( $_REQUEST['deleted'] ) ): ?>
@@ -24,16 +24,16 @@
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="">
35
  <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
36
- <?php $this->list_table->search_box( __( 'Search Sales Logs', 'wpsc' ), 'post' ); ?>
37
  <?php if ( ! empty( $_REQUEST['status'] ) ): ?>
38
  <input type="hidden" name="status" value="<?php echo esc_attr( $_REQUEST['status'] ); ?>" />
39
  <?php endif ?>
@@ -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>
1
  <div class="wrap">
2
  <div id="icon-users" class="icon32"><br/></div>
3
  <h2>
4
+ <?php esc_html_e( 'Sales Log' ); ?>
5
 
6
  <?php
7
  if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
8
+ printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes( $_REQUEST['s'] ) ) ); ?>
9
  </h2>
10
 
11
  <?php if ( ! empty( $_REQUEST['updated'] ) || ! empty( $_REQUEST['deleted'] ) ): ?>
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="">
35
  <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
36
+ <?php $this->list_table->search_box( 'Search Sales Logs', 'post' ); ?>
37
  <?php if ( ! empty( $_REQUEST['status'] ) ): ?>
38
  <input type="hidden" name="status" value="<?php echo esc_attr( $_REQUEST['status'] ); ?>" />
39
  <?php endif ?>
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
@@ -1,13 +1,13 @@
1
  <div class='wrap'>
2
 
3
- <h2><?php esc_html_e( 'Sales Upgrade Fix', 'wpsc' ); ?> </h2>
4
 
5
  <?php if ( $numChanged != 0 && $numQueries != 0 ): ?>
6
  <div class="updated">
7
- <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wpsc' ), remove_query_arg( 'c' ) ); ?></p>
8
  </div>
9
  <?php else: ?>
10
- <p><?php _e( 'Upgrading to WP eCommerce 3.7 and later requires you to run this fix once. The following boxes correspond to the form fields in your current checkout page. All you have to do is select from the drop-down menu box what each of the following fields represent. Sorry for any inconvenience caused, but we\'re sure you\'ll agree that the new purchase logs are worth this minor hassle.', 'wpsc' ); ?> </p>
11
 
12
  <div class="metabox-holder" style="width:700px">
13
  <form action='' method='post'>
@@ -38,7 +38,7 @@
38
 
39
  }
40
  ?>
41
- <input type='submit' value='<?php _e( 'Apply', 'wpsc' ); ?>' class='button-secondary action' />
42
  </form>
43
  </div>
44
  <?php endif; ?>
1
  <div class='wrap'>
2
 
3
+ <h2><?php echo esc_html( __('Sales Upgrade Fix', 'wpsc') ); ?> </h2>
4
 
5
  <?php if ( $numChanged != 0 && $numQueries != 0 ): ?>
6
  <div class="updated">
7
+ <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.' , 'wpsc' ), esc_url( remove_query_arg( 'c' ) ) ); ?></p>
8
  </div>
9
  <?php else: ?>
10
+ <p><?php _e('Upgrading to WP e-Commerce 3.7 and later requires you to run this fix once.The following Boxes corresponds to the form fields in your current checkout page. All you have to do is select from the drop-down menu box what each of the following fields represent. Sorry for any inconvenience caused, but we\'re sure you\'ll agree that the new purchase logs are worth this minor hassle.', 'wpsc'); ?> </p>
11
 
12
  <div class="metabox-holder" style="width:700px">
13
  <form action='' method='post'>
38
 
39
  }
40
  ?>
41
+ <input type='submit' value='<?php _e('Apply', 'wpsc'); ?>' class='button-secondary action' />
42
  </form>
43
  </div>
44
  <?php endif; ?>
wpsc-admin/includes/save-data.functions.php CHANGED
@@ -12,18 +12,15 @@ 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
 
29
  /**
@@ -41,15 +38,15 @@ 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
  }
54
 
55
  add_filter( 'manage_edit-wpsc_product_category_columns', 'wpsc_custom_category_columns' );
@@ -68,42 +65,40 @@ 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 +107,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
  /**
@@ -151,126 +138,189 @@ function wpsc_admin_get_category_array( $parent_id = null ){
151
  function wpsc_admin_category_forms_add() {
152
  global $wpdb;
153
  $category_value_count = 0;
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
- /**
264
- * Check whether a display type (such as grid, list) is supported.
265
- *
266
- * @since 3.8.9
267
- * @access private
268
- * @param string $display_type Display type
269
- * @return bool Return true if display type is supported.
270
- */
271
- function _wpsc_is_display_type_supported( $display_type ) {
272
- $callback = 'product_display_' . $display_type;
273
- return function_exists( $callback );
274
  }
275
 
276
  function wpsc_admin_category_forms_edit() {
@@ -279,294 +329,319 @@ function wpsc_admin_category_forms_edit() {
279
  $category_value_count = 0;
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
  /**
470
  * wpsc_save_category_set, Saves the category set data
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' );
485
  } else {
486
- image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), null, null, 'image' );
487
- }
488
  $image = esc_sql( $_FILES['image']['name'] );
489
  } else {
490
  $new_image_path = ( WPSC_CATEGORY_DIR.basename($_FILES['image']['name'] ) );
491
  move_uploaded_file( $_FILES['image']['tmp_name'], $new_image_path );
492
  $stat = stat( dirname( $new_image_path ) );
493
  $perms = $stat['mode'] & 0000666;
494
- @ chmod( $new_image_path, $perms );
495
  $image = esc_sql( $_FILES['image']['name'] );
496
  }
497
  } else {
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
 
26
  /**
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
  }
51
 
52
  add_filter( 'manage_edit-wpsc_product_category_columns', 'wpsc_custom_category_columns' );
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.stripslashes( $image )."\" title='".$name."' alt='".$name."' width='30' height='30' />";
96
+ else
97
+ $image = "<img src='".WPSC_CORE_IMAGES_URL."/no-image-uploaded.gif' title='".$name."' alt='".$name."' width='30' height='30' />";
98
+
99
+
100
+ return $image;
101
 
 
 
 
 
 
 
 
 
102
  }
103
 
104
  /**
107
  * for use in other list functions
108
  * @param int $parent_id
109
  */
110
+ function wpsc_admin_get_category_array($parent_id = null){
111
+ global $wpdb;
112
+ $orderedList = array();
113
+ if(!isset($parent_id)) $parent_id = 0;
114
+ $category_list = get_terms('wpsc_product_category','hide_empty=0&parent='.$parent_id);
115
+ if(!is_array($category_list)){
116
+ return false;
117
+ }
118
+ foreach($category_list as $category){
119
+ $category_order = wpsc_get_categorymeta($category->term_id, 'order');
120
+ $category_image = wpsc_get_categorymeta($category->term_id, 'image');
121
+ if(!isset($category_order) || $category_order == 0) $category_order = (count($orderedList) +1);
122
+ print "<!-- setting category Order number to ".$category_order."-->";
123
+ $orderedList[$category_order]['id'] = $category->term_id;
124
+ $orderedList[$category_order]['name'] = $category->name;
125
+ $orderedList[$category_order]['image'] = $category_image;
126
+ $orderedList[$category_order]['parent_id'] = $parent_id;
127
+ $orderedList[$category_order]['children'] = wpsc_admin_get_category_array($category->term_id);
128
+ }
129
+
130
+ ksort($orderedList);
131
+ return($orderedList);
 
 
 
 
 
 
 
 
132
  }
133
 
134
  /**
138
  function wpsc_admin_category_forms_add() {
139
  global $wpdb;
140
  $category_value_count = 0;
 
141
  ?>
142
 
143
+ <h3><?php _e('Advanced Settings', 'wpsc'); ?></h3>
144
+
145
+ <div id="poststuff" class="postbox">
146
+ <h3 class="hndle"><?php _e('Presentation Settings', 'wpsc'); ?></h3>
147
+
148
+ <div class="inside">
149
+ <tr>
150
+ <td>
151
+ <label for='image'><?php _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 _e('Catalog View', 'wpsc'); ?>
160
+ </td>
161
+ <td>
162
+ <?php
163
+ if (!isset($category['display_type'])) $category['display_type'] = '';
 
 
 
 
 
 
164
 
165
+ if ($category['display_type'] == 'grid') {
166
+ $display_type1="selected='selected'";
167
+ } else if ($category['display_type'] == 'default') {
168
+ $display_type2="selected='selected'";
169
+ }
170
 
171
+ switch($category['display_type']) {
172
+ case "default":
173
+ $category_view1 = "selected ='selected'";
174
+ break;
175
+
176
+ case "grid":
177
+ if(function_exists('product_display_grid')) {
178
+ $category_view3 = "selected ='selected'";
179
+ break;
180
+ }
181
+
182
+ case "list":
183
+ if(function_exists('product_display_list')) {
184
+ $category_view2 = "selected ='selected'";
185
+ break;
186
+ }
187
+
188
+ default:
189
+ $category_view0 = "selected ='selected'";
190
+ break;
191
+ }?>
192
+
193
+
194
+ <select name='display_type'>
195
+ <option value=''<?php echo $category_view0; ?> ><?php _e('Please select', 'wpsc'); ?></option>
196
+ <option value='default' <?php if (isset($category_view1)) echo $category_view1; ?> ><?php _e('Default View', 'wpsc'); ?></option>
197
+
198
+ <?php if(function_exists('product_display_list')) {?>
199
+ <option value='list' <?php echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
200
+ <?php } else { ?>
201
+ <option value='list' disabled='disabled' <?php if (isset($category_view2)) echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
202
+ <?php } ?>
203
+ <?php if(function_exists('product_display_grid')) { ?>
204
+ <option value='grid' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e('Grid View', 'wpsc'); ?></option>
205
+ <?php } else { ?>
206
+ <option value='grid' disabled='disabled' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e('Grid View', 'wpsc'); ?></option>
207
+ <?php } ?>
208
+ </select><br /><br />
209
+ </td>
210
+ </tr>
211
+ <tr>
212
+ <td>
213
+ <span class='small'><?php _e('To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc'); ?></span><br /><br />
214
+ </td>
215
+ </tr>
216
+
217
+ <?php if(function_exists("getimagesize")) { ?>
218
+ <tr>
219
+ <td>
220
+ <?php _e('Thumbnail&nbsp;Size', 'wpsc'); ?>
221
+ </td>
222
+ <td>
223
+ <?php _e('Width', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_width'])) echo $category['image_width']; ?>' name='image_width' size='6'/>
224
+ <?php _e('Height', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_height'])) echo $category['image_height']; ?>' name='image_height' size='6'/><br/>
225
+ </td>
226
+ </tr>
227
+ <?php
228
+ }
229
+ ?>
230
+ </div>
231
+ </div>
232
+
233
+ <!-- START OF TARGET MARKET SELECTION -->
234
+ <div id="poststuff" class="postbox">
235
+ <h3 class="hndle"><?php _e( 'Target Market Restrictions', 'wpsc' ); ?></h3>
236
+ <div class="inside"><?php
237
  $category_id = '';
238
+ if (isset($_GET["tag_ID"])) $category_id = $_GET["tag_ID"];
239
+ $countrylist = $wpdb->get_results("SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A);
240
+ $selectedCountries = wpsc_get_meta($category_id,'target_market','wpsc_category');
241
+ $output = '';
242
+ $output .= " <tr>\n\r";
243
+ $output .= " <td>\n\r";
244
+ $output .= __('Target Markets', 'wpsc').":\n\r";
245
+ $output .= " </td>\n\r";
246
+ $output .= " <td>\n\r";
247
+
248
+ if(@extension_loaded('suhosin')) {
249
+ $output .= "<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.
250
+ ",'wpsc')."</em>";
251
 
252
+ } else {
253
+ $output .= "<span>Select: <a href='' class='wpsc_select_all'>All</a>&nbsp; <a href='' class='wpsc_select_none'>None</a></span><br />";
254
+ $output .= " <div id='resizeable' class='ui-widget-content multiple-select'>\n\r";
255
+ foreach($countrylist as $country){
256
+ if(in_array($country['id'], (array)$selectedCountries)){
257
+ $output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />\n\r";
258
+ } else {
259
+ $output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />\n\r";
260
+ }
261
+ }
262
+ $output .= " </div><br /><br />";
263
+ $output .= " <span class='wpscsmall description'>Select the markets you are selling this category to.<span>\n\r";
264
  }
265
+ $output .= " </td>\n\r";
266
+ $output .= " </tr>\n\r";
267
 
268
+ echo $output;
269
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  </div>
271
+ </div>
272
 
273
+ <!-- Checkout settings -->
274
+ <div id="poststuff" class="postbox">
275
+ <h3 class="hndle"><?php _e('Checkout Settings', 'wpsc'); ?></h3>
276
+ <div class="inside">
277
+ <table class='category_forms'>
 
 
 
 
 
 
278
  <?php
279
+ if (!isset($category['term_id'])) $category['term_id'] = '';
280
+ $used_additonal_form_set = wpsc_get_categorymeta($category['term_id'], 'use_additional_form_set'); ?>
281
+ <tr>
282
+ <td>
283
+ <?php _e("This category requires additional checkout form fields",'wpsc'); ?>
284
+ </td>
285
+ <td>
286
+ <select name='use_additional_form_set'>
287
+ <option value=''><?php _e("None",'wpsc'); ?></option>
288
+ <?php
289
+ $checkout_sets = get_option('wpsc_checkout_form_sets');
290
+ unset($checkout_sets[0]);
291
+
292
+ foreach((array)$checkout_sets as $key => $value) {
293
+ $selected_state = "";
294
+ if($used_additonal_form_set == $key)
295
+ $selected_state = "selected='selected'";
296
+ ?>
297
+ <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo stripslashes($value); ?></option>
298
+ <?php
299
+ }
300
+ ?>
301
+ </select>
302
+ </td>
303
+ </tr>
304
+ <?php $uses_billing_address = (bool)wpsc_get_categorymeta($category['term_id'], 'uses_billing_address'); ?>
305
+ <tr>
306
+ <td>
307
+ <?php _e("Products in this category use the billing address to calculate shipping",'wpsc'); ?>
308
+ </td>
309
+ <td>
310
+ <input type='radio' value='1' name='uses_billing_address' <?php echo (($uses_billing_address == true) ? "checked='checked'" : ""); ?> /><?php _e("Yes",'wpsc'); ?>
311
+ <input type='radio' value='0' name='uses_billing_address' <?php echo (($uses_billing_address != true) ? "checked='checked'" : ""); ?> /><?php _e("No",'wpsc'); ?>
312
+ </td>
313
+ </tr>
314
+ </table>
315
  </div>
316
+ </div>
317
 
318
+ <table class="category_forms">
319
+ <tr>
 
 
 
 
 
320
 
321
+ </tr>
322
+ </table>
323
+ <?php
 
 
 
 
 
 
 
 
324
  }
325
 
326
  function wpsc_admin_category_forms_edit() {
329
  $category_value_count = 0;
330
  $category_name = '';
331
  $category = array();
332
+
333
+ $category_id = absint( $_REQUEST["tag_ID"] );
334
+ $category = get_term($category_id, 'wpsc_product_category', ARRAY_A);
335
+ $category['nice-name'] = wpsc_get_categorymeta($category['term_id'], 'nice-name');
336
+ $category['description'] = wpsc_get_categorymeta($category['term_id'], 'description');
337
+ $category['image'] = wpsc_get_categorymeta($category['term_id'], 'image');
338
+ $category['fee'] = wpsc_get_categorymeta($category['term_id'], 'fee');
339
+ $category['active'] = wpsc_get_categorymeta($category['term_id'], 'active');
340
+ $category['order'] = wpsc_get_categorymeta($category['term_id'], 'order');
341
+ $category['display_type'] = wpsc_get_categorymeta($category['term_id'], 'display_type');
342
+ $category['image_height'] = wpsc_get_categorymeta($category['term_id'], 'image_height');
343
+ $category['image_width'] = wpsc_get_categorymeta($category['term_id'], 'image_width');
344
+ $category['use_additional_form_set'] = wpsc_get_categorymeta($category['term_id'], 'use_additional_form_set');
345
+
346
 
347
  ?>
348
 
349
+ <tr>
350
+ <td colspan="2">
351
+ <h3><?php _e( 'Advanced Settings', 'wpsc' ); ?></h3>
352
+
353
+ </td>
354
+ </tr>
 
 
355
 
356
  <tr class="form-field">
357
+ <th scope="row" valign="top">
358
+ <label for="display_type"><?php _e( 'Catalog View', 'wpsc' ); ?></label>
359
+ </th>
360
+ <td>
361
+ <?php
362
+ //Could probably be *heavily* refactored later just to use do_action here and in GoldCart. Baby steps.
363
+ if (!isset($category['display_type'])) $category['display_type'] = '';
364
+
365
+ if ($category['display_type'] == 'grid') {
366
+ $display_type1="selected='selected'";
367
+ } else if ($category['display_type'] == 'default') {
368
+ $display_type2="selected='selected'";
369
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
+ switch($category['display_type']) {
372
+ case "default":
373
+ $category_view1 = "selected ='selected'";
374
+ break;
375
+
376
+ case "grid":
377
+ if(function_exists('product_display_grid')) {
378
+ $category_view3 = "selected ='selected'";
379
+ break;
380
+ }
381
+
382
+ case "list":
383
+ if(function_exists('product_display_list')) {
384
+ $category_view2 = "selected ='selected'";
385
+ break;
386
+ }
387
+
388
+ default:
389
+ $category_view0 = "selected ='selected'";
390
+ break;
391
+ }
392
+ ?>
393
+ <select name='display_type'>
394
+ <option value=''<?php echo $category_view0; ?> ><?php _e('Please select', 'wpsc'); ?></option>
395
+ <option value='default' <?php if (isset($category_view1)) echo $category_view1; ?> ><?php _e( 'Default View', 'wpsc' ); ?></option>
396
+
397
+ <?php if(function_exists('product_display_list')) {?>
398
+ <option value='list' <?php echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
399
+ <?php } else { ?>
400
+ <option value='list' disabled='disabled' <?php if (isset($category_view2)) echo $category_view2; ?>><?php _e( 'List View', 'wpsc' ); ?></option>
401
+ <?php } ?>
402
+ <?php if(function_exists('product_display_grid')) { ?>
403
+ <option value='grid' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
404
+ <?php } else { ?>
405
+ <option value='grid' disabled='disabled' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
406
+ <?php } ?>
407
+ </select><br />
408
+ <span class="description"><?php _e( 'To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc' ); ?></span>
409
+ </td>
410
  </tr>
411
+ <tr class="form-field">
412
+ <th scope="row" valign="top">
413
+ <label for="image"><?php _e( 'Category Image', 'wpsc' ); ?></label>
414
+ </th>
415
+ <td>
416
+ <input type='file' name='image' value='' /><br />
417
+ <label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php _e( 'Delete Image', 'wpsc' ); ?></label><br/>
418
+ <span class="description"><?php _e( 'You can set an image for the category here. If one exists, check the box to delete.', 'wpsc' ); ?></span>
419
+ </td>
420
  </tr>
421
+ <?php if( function_exists( "getimagesize" ) ) : ?>
422
+ <tr class="form-field">
423
+ <th scope="row" valign="top">
424
+ <label for="image"><?php _e( 'Thumbnail Size', 'wpsc' ); ?></label>
425
+ </th>
426
+ <td>
427
+ <?php _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' />
428
+ <?php _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/>
429
+ </td>
430
  </tr>
431
+ <?php endif; // 'getimagesize' condition ?>
 
 
432
  <tr>
433
+ <td colspan="2"><h3><?php _e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h3></td>
434
+ </tr>
435
+
436
+ <tr class="form-field">
437
+ <th scope="row" valign="top">
438
+ <label for="image"><?php _e( 'Display Category Shortcode', 'wpsc' ); ?>:</label>
439
+ </th>
440
+ <td>
441
+ <span>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</span><br />
442
+ <span class="description"><?php _e( 'Shortcodes are used to display a particular category or group within any WordPress page or post.', 'wpsc' ); ?></span>
443
+ </td>
444
  </tr>
445
+ <tr class="form-field">
446
+ <th scope="row" valign="top">
447
+ <label for="image"><?php _e( 'Display Category Template Tag', 'wpsc' ); ?>:</label>
448
+ </th>
449
+ <td>
450
+ <span>&lt;?php echo wpsc_display_products_page( array( 'category_url_name'=>'<?php echo $category["slug"]; ?>' ) ); ?&gt;</span><br />
451
+ <span class="description"><?php _e( 'Template tags are used to display a particular category or group within your theme / template.', 'wpsc' ); ?></span>
452
+ </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  </tr>
454
 
455
+ <!-- START OF TARGET MARKET SELECTION -->
456
+
457
+ <tr>
458
+ <td colspan="2">
459
+ <h3><?php _e( 'Target Market Restrictions', 'wpsc' ); ?></h3>
460
+ </td>
461
+ </tr>
462
+ <?php
463
+ $countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A );
464
+ $selectedCountries = wpsc_get_meta( $category_id,'target_market','wpsc_category' );
465
+ ?>
466
+ <tr class="form-field">
467
+ <th scope="row" valign="top">
468
+ <label for="image"><?php _e( 'Target Markets', 'wpsc' ); ?>:</label>
469
+ </th>
470
+ <td>
471
+ <?php
472
+ if ( @extension_loaded( 'suhosin' ) ) :
473
+ ?>
474
+ <em><?php _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>
475
+
476
+ <?php
477
+ else :
478
+ ?>
479
+ <span><?php _e( 'Select', 'wpsc' ); ?>: <a href='' class='wpsc_select_all'><?php _e( 'All', 'wpsc' ); ?></a>&nbsp; <a href='' class='wpsc_select_none'><?php _e( 'None', 'wpsc' ); ?></a></span><br />
480
+ <div id='resizeable' class='ui-widget-content multiple-select'>
481
+ <?php
482
+ foreach( $countrylist as $country ) {
483
+ if( in_array( $country['id'], (array)$selectedCountries ) )
484
+ echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />";
485
+ else
486
+ echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />";
487
+ }
488
+ ?>
489
+ </div>
490
+ <?php
491
+ endif;
492
+ ?><br />
493
+ <span class="description"><?php _e( 'Select the markets you are selling this category to.', 'wpsc' ); ?></span>
494
+ </td>
495
  </tr>
496
+ <!-- Checkout settings -->
497
+
498
+ <tr>
499
+ <td colspan="2">
500
+ <h3><?php _e( 'Checkout Settings', 'wpsc' ); ?></h3>
501
+ </td>
502
+ </tr>
503
+ <?php
504
+ if ( !isset( $category['term_id'] ) )
505
+ $category['term_id'] = '';
506
+ $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
507
+ $checkout_sets = get_option('wpsc_checkout_form_sets');
508
+ unset($checkout_sets[0]);
509
+ $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' );
510
+ ?>
511
+ <tr class="form-field">
512
+ <th scope="row" valign="top">
513
+ <label for="image"><?php _e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
514
+ </th>
515
+ <td>
516
+ <select name='use_additional_form_set'>
517
+ <option value=''><?php _e( 'None', 'wpsc' ); ?></option>
518
+ <?php
519
+ foreach( (array) $checkout_sets as $key => $value ) {
520
+ $selected_state = "";
521
+ if( $used_additonal_form_set == $key )
522
+ $selected_state = "selected='selected'";
523
+ ?>
524
+ <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo stripslashes( $value ); ?></option>
525
+ <?php
526
+ }
527
+ ?>
528
+ </select><br />
529
+ </td>
530
  </tr>
531
 
532
+ <tr class="form-field">
533
+ <th scope="row" valign="top">
534
+ <label for="image"><?php _e( 'Products in this category use the billing address to calculate shipping', 'wpsc' ); ?></label>
535
+ </th>
536
+ <td>
537
+ <input type='radio' class="wpsc_cat_box" value='1' name='uses_billing_address' <?php echo ( ( $uses_billing_address == true ) ? "checked='checked'" : "" ); ?> /><?php _e( 'Yes','wpsc' ); ?>
538
+ <input type='radio' class="wpsc_cat_box" value='0' name='uses_billing_address' <?php echo (($uses_billing_address != true) ? "checked='checked'" : ""); ?> /><?php _e( 'No','wpsc' ); ?>
539
+ <br />
540
+ </td>
541
  </tr>
542
 
543
+ <?php
544
+ }
545
 
546
  /**
547
  * wpsc_save_category_set, Saves the category set data
548
  * @param nothing
549
  * @return nothing
550
  */
551
+ function wpsc_save_category_set($category_id, $tt_id) {
552
  global $wpdb;
553
+ if( !empty( $_POST ) ) {
 
554
  /* Image Processing Code*/
555
+ if( !empty( $_FILES['image'] ) && preg_match( "/\.(gif|jp(e)*g|png){1}$/i", $_FILES['image']['name'] ) ) {
556
+ if( function_exists( "getimagesize" ) ) {
557
+ if( ( (int) $_POST['width'] > 10 && (int) $_POST['width'] < 512 ) && ((int)$_POST['height'] > 10 && (int)$_POST['height'] < 512) ) {
558
  $width = (int) $_POST['width'];
559
  $height = (int) $_POST['height'];
560
+ image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), $width, $height );
561
  } else {
562
+ image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ) );
563
+ }
564
  $image = esc_sql( $_FILES['image']['name'] );
565
  } else {
566
  $new_image_path = ( WPSC_CATEGORY_DIR.basename($_FILES['image']['name'] ) );
567
  move_uploaded_file( $_FILES['image']['tmp_name'], $new_image_path );
568
  $stat = stat( dirname( $new_image_path ) );
569
  $perms = $stat['mode'] & 0000666;
570
+ @ chmod( $new_image_path, $perms );
571
  $image = esc_sql( $_FILES['image']['name'] );
572
  }
573
  } else {
574
  $image = '';
575
  }
576
+ //Good to here
577
+
578
+ if( isset( $_POST['tag_ID'] ) ) {
579
+ //Editing
580
+ $category_id= $_POST['tag_ID'];
581
+ $category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
582
+ $url_name=$category->slug;
583
+
584
+ }
585
+ if(isset($_POST['deleteimage']) && $_POST['deleteimage'] == 1) {
586
+ wpsc_delete_categorymeta($category_id, 'image');
587
+ } else if($image != '') {
588
+ wpsc_update_categorymeta($category_id, 'image', $image);
589
  }
590
+
591
+ if ( !empty( $_POST['height'] ) && is_numeric( $_POST['height'] ) && !empty( $_POST['width'] ) && is_numeric( $_POST['width'] ) && $image == null ) {
592
+ $imagedata = wpsc_get_categorymeta($category_id, 'image');
593
+ if($imagedata != null) {
594
+ $height = $_POST['height'];
595
+ $width = $_POST['width'];
596
+ $imagepath = WPSC_CATEGORY_DIR . $imagedata;
597
  $image_output = WPSC_CATEGORY_DIR . $imagedata;
598
+ image_processing($imagepath, $image_output, $width, $height);
599
  }
600
  }
601
+
602
+ wpsc_update_categorymeta($category_id, 'fee', '0');
603
+ wpsc_update_categorymeta($category_id, 'active', '1');
604
+ wpsc_update_categorymeta($category_id, 'order', '0');
605
+
606
+ if ( isset( $_POST['display_type'] ) )
607
+ wpsc_update_categorymeta($category_id, 'display_type',esc_sql(stripslashes($_POST['display_type'])));
608
+
609
+ if ( isset( $_POST['image_height'] ) )
610
+ wpsc_update_categorymeta($category_id, 'image_height', esc_sql(stripslashes($_POST['image_height'])));
611
+
612
+ if ( isset( $_POST['image_width'] ) )
613
+ wpsc_update_categorymeta($category_id, 'image_width', esc_sql(stripslashes($_POST['image_width'])));
614
+
615
+
 
 
616
  if ( ! empty( $_POST['use_additional_form_set'] ) ) {
617
+ wpsc_update_categorymeta($category_id, 'use_additional_form_set', $_POST['use_additional_form_set']);
618
+ //exit('<pre>'.print_r($_POST,1).'</pre>');
619
  } else {
620
+ wpsc_delete_categorymeta($category_id, 'use_additional_form_set');
621
  }
622
 
623
  if ( ! empty( $_POST['uses_billing_address'] ) ) {
624
+ wpsc_update_categorymeta($category_id, 'uses_billing_address', 1);
625
  $uses_additional_forms = true;
626
  } else {
627
+ wpsc_update_categorymeta($category_id, 'uses_billing_address', 0);
628
  $uses_additional_forms = false;
629
+ }
630
+
631
+ if( ! empty( $_POST['countrylist2'] ) && ($category_id > 0)){
632
+ $AllSelected = false;
633
+ $countryList = $wpdb->get_col("SELECT `id` FROM `".WPSC_TABLE_CURRENCY_LIST."`");
634
+
635
+ if($AllSelected != true){
636
+ $unselectedCountries = array_diff($countryList, $_POST['countrylist2']);
 
637
  //find the countries that are selected
638
+ $selectedCountries = array_intersect($countryList, $_POST['countrylist2']);
639
+ wpsc_update_categorymeta( $category_id, 'target_market', $selectedCountries);
640
  }
641
+
642
+ } elseif ( ! isset($_POST['countrylist2'] ) ){
643
+ wpsc_update_categorymeta( $category_id, 'target_market','');
644
+ $AllSelected = true;
645
  }
646
 
647
  }
wpsc-admin/includes/settings-tabs/admin.php CHANGED
@@ -1,20 +1,15 @@
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>
13
  <table class='wpsc_options form-table'>
14
  <tr>
15
- <th scope="row"><?php esc_html_e( 'Max downloads per file', 'wpsc' ); ?>: </th>
16
  <td>
17
- <input type="number" min="0" size="10" value="<?php echo esc_attr( get_option('max_downloads') ); ?>" name="wpsc_options[max_downloads]" />
18
  </td>
19
  </tr>
20
  <?php
@@ -34,7 +29,7 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
34
  ?>
35
  <tr>
36
  <th scope="row">
37
- <?php esc_html_e( 'Lock downloads to IP address', 'wpsc' ); ?>:
38
  </th>
39
  <td>
40
  <input type='radio' value='1' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads2' <?php echo $wpsc_ip_lock_downloads1; ?> /> <label for='wpsc_ip_lock_downloads2'><?php _e('Yes', 'wpsc');?></label>&nbsp;
@@ -60,14 +55,14 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
60
  ?>
61
  <tr>
62
  <th scope="row">
63
- <?php esc_html_e( 'Check MIME types on file uploads', 'wpsc' ); ?>:
64
  </th>
65
  <td>
66
  <input type='radio' value='0' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types2' <?php echo $wpsc_check_mime_types1; ?> /> <label for='wpsc_check_mime_types2'><?php _e('Yes', 'wpsc');?></label>&nbsp;
67
  <input type='radio' value='1' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types1' <?php echo $wpsc_check_mime_types2; ?> /> <label for='wpsc_check_mime_types1'><?php _e('No', 'wpsc');?></label><br />
68
 
69
  <span class="wpscsmall description">
70
- <?php esc_html_e( 'Warning: Disabling this exposes your site to greater possibility of malicious files being uploaded, we recommend installing the Fileinfo extension for PHP rather than disabling this.', 'wpsc' ); ?>
71
  </span>
72
  </td>
73
  </tr>
@@ -75,79 +70,89 @@ class WPSC_Settings_Tab_Admin extends WPSC_Settings_Tab {
75
 
76
  <tr>
77
  <th scope="row">
78
- <?php esc_html_e( 'Store Admin Email', 'wpsc' );?>:
 
 
 
 
 
 
 
 
79
  </th>
80
  <td>
81
- <input class='text' name='wpsc_options[purch_log_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'purch_log_email' ) ); ?>' />
82
- <p class="howto"><?php esc_html_e( 'Admin notifications will be sent here.' ); ?></p>
83
  </td>
84
  </tr>
85
 
86
  <tr>
87
  <th scope="row">
88
- <?php esc_html_e( 'Terms and Conditions', 'wpsc' );?>:
89
  </th>
90
  <td>
91
- <textarea name='wpsc_options[terms_and_conditions]' cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'terms_and_conditions' ) ); ?></textarea>
 
 
 
 
 
 
 
 
 
92
  </td>
93
  </tr>
94
 
95
  </table>
96
- <h3 class="form_group"><?php esc_html_e( 'Customer Purchase Receipt', 'wpsc' );?>:</h3>
97
  <table class='wpsc_options form-table'>
98
  <tr>
99
- <th colspan="2"><?php esc_html_e( 'Tags can be used', 'wpsc' );?>: <?php echo esc_html( '%purchase_id%, %shop_name%, %product_list%, %total_price%, %total_shipping%, %find_us%, %total_tax%' ); ?></th>
100
  </tr>
101
  <tr>
102
  <td class='wpsc_td_note' colspan='2'>
103
  <span class="wpscsmall description">
104
- <?php esc_html_e( 'Note: The purchase receipt is the message e-mailed to users after purchasing products from your shop.' , 'wpsc' ); ?>
105
  <br />
106
- <?php esc_html_e( 'Note: You need to have the %product_list% in your purchase receipt in order for digital download links to be emailed to your buyers.' , 'wpsc' ); ?>
107
  </span>
108
  </td>
109
  </tr>
110
  <tr>
111
- <th scope="row">
112
- <?php echo esc_html_x( 'From Address', 'purchase receipt', 'wpsc' );?>:
113
- </th>
114
- <td>
115
- <input class='text' name='wpsc_options[return_email]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_email' ) ); ?>' />
116
- </td>
117
  </tr>
118
-
119
  <tr>
120
- <th scope="row">
121
- <?php esc_html_e( 'Sender Name', 'wpsc' );?>:
122
- </th>
123
- <td>
124
- <input class='text' name='wpsc_options[return_name]' type='text' size='40' value='<?php echo esc_attr( get_option( 'return_name' ) ); ?>' />
125
  </td>
126
  </tr>
127
  <tr>
128
- <th><?php esc_html_e( 'Message Body', 'wpsc' ); ?></th>
129
- <td><textarea name="wpsc_options[wpsc_email_receipt]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_email_receipt' ) );?></textarea></td>
130
  </tr>
131
  </table>
132
 
133
- <h3 class="form_group"><?php esc_html_e( 'Track and Trace settings', 'wpsc' ); ?>:</h3>
134
  <table class='wpsc_options form-table'>
135
  <tr>
136
  <td class='wpsc_td_note' colspan='2'>
137
  <span class="wpscsmall description">
138
- <?php esc_html_e( 'Note: The Tracking Subject, is the subject for The Tracking Message email. The Tracking Message is the message e-mailed to users when you click \'Email buyer\' on the sales log. This option is only available for purchases with the status of \'Job Dispatched\'. Tags you can use in the email message section are %trackid% and %shop_name%' , 'wpsc' ); ?>
139
  </span>
140
  </td>
141
  </tr>
142
  <tr>
143
- <th><strong><?php esc_html_e( 'Tracking Email Subject', 'wpsc' );?></strong></th>
144
- <td><input name="wpsc_options[wpsc_trackingid_subject]" type='text' value='<?php echo esc_attr( get_option( 'wpsc_trackingid_subject' ) );?>' /></td>
145
  </tr>
146
  <tr>
147
- <th><strong><?php esc_html_e( 'Tracking Email Message', 'wpsc' );?></strong></th>
148
- <td><textarea name="wpsc_options[wpsc_trackingid_message]" cols='' rows='' style='width: 300px; height: 200px;'><?php echo esc_textarea( get_option( 'wpsc_trackingid_message' ) );?></textarea></td>
149
  </tr>
150
  </table>
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 _e('Admin Settings', 'wpsc'); ?></h3>
8
  <table class='wpsc_options form-table'>
9
  <tr>
10
+ <th scope="row"><?php _e('Max downloads per file', 'wpsc');?>: </th>
11
  <td>
12
+ <input type='text' size='10' value='<?php esc_attr_e( get_option('max_downloads') ); ?>' name='wpsc_options[max_downloads]' />
13
  </td>
14
  </tr>
15
  <?php
29
  ?>
30
  <tr>
31
  <th scope="row">
32
+ <?php _e('Lock downloads to IP address', 'wpsc');?>:
33
  </th>
34
  <td>
35
  <input type='radio' value='1' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads2' <?php echo $wpsc_ip_lock_downloads1; ?> /> <label for='wpsc_ip_lock_downloads2'><?php _e('Yes', 'wpsc');?></label>&nbsp;
55
  ?>
56
  <tr>
57
  <th scope="row">
58
+ <?php _e('Check MIME types on file uploads', 'wpsc');?>:
59
  </th>
60
  <td>
61
  <input type='radio' value='0' name='wpsc_options[wpsc_check_mime_types]' id='wpsc_check_mime_types2' <?php echo $wpsc_check_mime_types1; ?> /> <label for='wpsc_check_mime_types2'><?php _e('Yes', 'wpsc');?></label>&nbsp;
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 _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>
70
 
71
  <tr>
72
  <th scope="row">
73
+ <?php _e('Purchase Log Email', 'wpsc');?>:
74
+ </th>
75
+ <td>
76
+ <input class='text' name='wpsc_options[purch_log_email]' type='text' size='40' value='<?php esc_attr_e( get_option('purch_log_email') ); ?>' />
77
+ </td>
78
+ </tr>
79
+ <tr>
80
+ <th scope="row">
81
+ <?php _e('Purchase Receipt - Reply Address', 'wpsc');?>:
82
  </th>
83
  <td>
84
+ <input class='text' name='wpsc_options[return_email]' type='text' size='40' value='<?php esc_attr_e( get_option('return_email') ); ?>' />
 
85
  </td>
86
  </tr>
87
 
88
  <tr>
89
  <th scope="row">
90
+ <?php _e('Purchase Receipt - Reply Name', 'wpsc');?>:
91
  </th>
92
  <td>
93
+ <input class='text' name='wpsc_options[return_name]' type='text' size='40' value='<?php esc_attr_e( get_option('return_name') ); ?>' />
94
+ </td>
95
+ </tr>
96
+
97
+ <tr>
98
+ <th scope="row">
99
+ <?php _e('Terms and Conditions', 'wpsc');?>:
100
+ </th>
101
+ <td>
102
+ <textarea name='wpsc_options[terms_and_conditions]' cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e(stripslashes(get_option('terms_and_conditions') ) ); ?></textarea>
103
  </td>
104
  </tr>
105
 
106
  </table>
107
+ <h3 class="form_group"><?php _e('Custom Messages', 'wpsc');?>:</h3>
108
  <table class='wpsc_options form-table'>
109
  <tr>
110
+ <th colspan="2"><?php _e('Tags can be used', 'wpsc');?>: %purchase_id%, %shop_name%,<!-- %order_status%,--> %product_list%, %total_price%, %total_shipping%, %find_us%, %total_tax%</th>
111
  </tr>
112
  <tr>
113
  <td class='wpsc_td_note' colspan='2'>
114
  <span class="wpscsmall description">
115
+ <?php _e('Note: The purchase receipt is the message e-mailed to users after purchasing products from your shop.' , 'wpsc'); ?>
116
  <br />
117
+ <?php _e('Note: You need to have the %product_list% in your purchase receipt in order for digital download links to be emailed to your buyers.' , 'wpsc'); ?>
118
  </span>
119
  </td>
120
  </tr>
121
  <tr>
122
+ <th><strong><?php _e('Purchase Receipt', 'wpsc');?></strong></th>
123
+ <td><textarea name="wpsc_options[wpsc_email_receipt]" cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e( stripslashes(get_option('wpsc_email_receipt') ) );?></textarea></td>
 
 
 
 
124
  </tr>
 
125
  <tr>
126
+ <td class='wpsc_td_note' colspan='2'>
127
+ <span class="wpscsmall description">
128
+ <?php _e('Note: The Admin Report is the email sent to the e-mail address set above as soon as someone successfully buys a product.' , 'wpsc'); ?>
129
+ </span>
 
130
  </td>
131
  </tr>
132
  <tr>
133
+ <th><strong><?php _e('Admin Report', 'wpsc');?></strong></th>
134
+ <td><textarea name="wpsc_options[wpsc_email_admin]" cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e( stripslashes(get_option('wpsc_email_admin') ) );?></textarea></td>
135
  </tr>
136
  </table>
137
 
138
+ <h3 class="form_group"><?php _e("Track and Trace settings", 'wpsc');?>:</h3>
139
  <table class='wpsc_options form-table'>
140
  <tr>
141
  <td class='wpsc_td_note' colspan='2'>
142
  <span class="wpscsmall description">
143
+ <?php _e('Note: The Tracking Subject, is the subject for The Tracking Message email. The Tracking Message is the message e-mailed to users when you click \'Email buyer\' on the sales log. This option is only available for purchases with the status of \'Job Dispatched\'. Tags you can use in the email message section are %trackid% and %shop_name%' , 'wpsc'); ?>
144
  </span>
145
  </td>
146
  </tr>
147
  <tr>
148
+ <th><strong><?php _e('Tracking Email Subject', 'wpsc');?></strong></th>
149
+ <td><input name="wpsc_options[wpsc_trackingid_subject]" type='text' value='<?php esc_attr_e( stripslashes(get_option('wpsc_trackingid_subject') ) );?>' /></td>
150
  </tr>
151
  <tr>
152
+ <th><strong><?php _e('Tracking Email Message', 'wpsc');?></strong></th>
153
+ <td><textarea name="wpsc_options[wpsc_trackingid_message]" cols='' rows='' style='width: 300px; height: 200px;'><?php esc_attr_e( stripslashes(get_option('wpsc_trackingid_message') ) );?></textarea></td>
154
  </tr>
155
  </table>
156
  <?php
157
  }
158
+ }
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,18 +13,13 @@ 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
 
28
  $form_sql = $wpdb->prepare( "
29
  SELECT *
@@ -34,50 +30,29 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
34
  $this->form_fields = $wpdb->get_results( $form_sql );
35
 
36
  $columns = array(
37
- 'drag' => __( 'Drag', 'wpsc' ),
38
- 'name' => __( 'Title', 'wpsc' ),
39
- 'type' => __( 'Type', 'wpsc' ),
40
  'unique_name' => '&nbsp;',
41
- 'display' => __( 'Display', 'wpsc' ),
42
- 'mandatory' => __( 'Mandatory', 'wpsc' ),
43
  'actions' => '&nbsp;',
44
  );
45
- register_column_headers( 'display-checkout-list', $columns );
46
- }
47
-
48
- private function delete_form_set() {
49
- global $wpdb;
50
-
51
- $selected_checkout_set = $_REQUEST['checkout_set'];
52
-
53
- if ( empty( $selected_checkout_set ) )
54
- return;
55
-
56
- $form_sets = get_option( 'wpsc_checkout_form_sets' );
57
- unset( $form_sets[$selected_checkout_set] );
58
- update_option( 'wpsc_checkout_form_sets', $form_sets );
59
-
60
- $sql = $wpdb->prepare( 'DELETE FROM ' . WPSC_TABLE_CHECKOUT_FORMS . ' WHERE checkout_set = %s', $selected_checkout_set );
61
- $wpdb->query( $sql );
62
  }
63
 
64
  public function callback_submit_options() {
65
  global $wpdb;
66
 
67
- if ( ! empty( $_POST['wpsc_checkout_set_delete'] ) ) {
68
- $this->delete_form_set();
69
- return;
70
- }
71
-
72
  if ( ! empty( $_POST['new_form_set'] ) ) {
73
  $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
74
- $checkout_sets[] = sanitize_text_field( $_POST['new_form_set'] );
75
  update_option( 'wpsc_checkout_form_sets', $checkout_sets );
76
  add_settings_error( 'wpsc-settings', 'wpsc_form_set_added', __( 'New form set successfully created.', 'wpsc' ), 'updated' );
77
  }
78
 
79
  if ( isset( $_POST['checkout_set'] ) ) {
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 +106,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 +137,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 +144,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 +240,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 +261,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 +274,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 +304,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>
@@ -351,69 +322,75 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
351
  global $wpdb;
352
 
353
  //not to sure if we still need these any more - $form_types, $unique_names
354
- $form_types = get_option( 'wpsc_checkout_form_fields' );
355
- $unique_names = get_option( 'wpsc_checkout_unique_names' );
356
 
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>
401
  <select id='wpsc_form_set' name='checkout_set'>
402
  <?php foreach ( $this->checkout_sets as $key => $value ): ?>
403
  <option <?php selected( $this->current_checkout_set, $key ); ?> value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
404
  <?php endforeach; ?>
405
  </select>
406
-
407
  <input type='submit' value='<?php esc_attr_e( 'Filter', 'wpsc' ); ?>' name='wpsc_checkout_set_filter' class='button-secondary' />
408
- <input <?php if (! $this->current_checkout_set) echo 'style="display:none;"'; ?> id="wpsc-delete-checkout-set" type='submit' value='<?php esc_attr_e( 'Delete', 'wpsc' ); ?>' name='wpsc_checkout_set_delete' class='button-secondary' />
409
  </p>
410
 
411
- <p><a class="add_new_form_set button-secondary" href='#'><?php esc_html_e("Add New Form Set", 'wpsc'); ?></a></p>
412
-
413
  <p class='add_new_form_set_forms'>
414
  <label><?php esc_html_e( "Add new Form Set", 'wpsc' ); ?>:
415
  <input type="text" value="" name="new_form_set" /></label>
416
- <input type="submit" value="<?php esc_attr_e( 'Add', 'wpsc' ); ?>" class="button-primary" id="formset-add-sumbit"/>
417
  </p>
418
 
419
  <input type="hidden" name="selected_form_set" value="<?php echo esc_attr( $this->current_checkout_set ); ?>" />
@@ -436,19 +413,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 +462,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 +482,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 : $_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
  $form_sql = $wpdb->prepare( "
25
  SELECT *
30
  $this->form_fields = $wpdb->get_results( $form_sql );
31
 
32
  $columns = array(
33
+ 'drag' => __('Drag', 'wpsc'),
34
+ 'name' => __('Title', 'wpsc'),
35
+ 'type' => __('Type', 'wpsc'),
36
  'unique_name' => '&nbsp;',
37
+ 'display' => __('Display', 'wpsc'),
38
+ 'mandatory' => __('Mandatory', 'wpsc'),
39
  'actions' => '&nbsp;',
40
  );
41
+ register_column_headers('display-checkout-list', $columns);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
 
44
  public function callback_submit_options() {
45
  global $wpdb;
46
 
 
 
 
 
 
47
  if ( ! empty( $_POST['new_form_set'] ) ) {
48
  $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
49
+ $checkout_sets[] = $_POST['new_form_set'];
50
  update_option( 'wpsc_checkout_form_sets', $checkout_sets );
51
  add_settings_error( 'wpsc-settings', 'wpsc_form_set_added', __( 'New form set successfully created.', 'wpsc' ), 'updated' );
52
  }
53
 
54
  if ( isset( $_POST['checkout_set'] ) ) {
55
+ $_SERVER['REQUEST_URI'] = esc_url( add_query_arg( 'checkout_set', $_POST['checkout_set'] ) );
56
  }
57
 
58
  if ( ! isset( $_POST['form_name'] ) && ! isset( $_POST['new_field_name'] ) )
106
  $value = $_POST['form_options'][$field_id]['value'][$key];
107
  if ( $label === '' && $value === '')
108
  continue;
109
+ $options[$label] = $value;
 
110
  }
111
  $data['options'] = serialize( $options );
112
  $data_format[] = '%s';
137
  'active' => empty( $_POST['new_field_display'][$key] ) ? 0 : 1,
138
  'mandatory' => empty( $_POST['new_field_mandatory'][$key] ) ? 0 : 1,
139
  'checkout_set' => $this->current_checkout_set,
 
140
  );
141
 
142
  $data_format = array(
144
  '%s', // type
145
  '%s', // active
146
  '%s', // mandatory
 
 
147
  );
148
 
149
  if ( isset( $new_field_orders[$key] ) ) {
240
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
241
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
242
  </a>
243
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
244
  </div>
245
  </td>
246
  <td class="namecol">
247
  <div class="cell-wrapper">
248
+ <input type="text" name="new_field_name[<?php echo $new_field_id; ?>]" value="" />
249
+ <a class="edit-options" href="#"><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
250
  </div>
251
  </td>
252
  <td class="typecol">
261
  </div>
262
  </td>
263
  <td class="uniquenamecol">
 
264
  </td>
265
  <td class="displaycol">
266
  <div class="cell-wrapper">
274
  </td>
275
  <td class="actionscol">
276
  <div class="cell-wrapper">
277
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
278
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
279
  </div>
280
  </td>
281
  </tr>
304
  </td>
305
  <td class="column-actions">
306
  <div class="field-option-cell-wrapper">
307
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
308
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
309
  </div>
310
  </td>
311
  </tr>
322
  global $wpdb;
323
 
324
  //not to sure if we still need these any more - $form_types, $unique_names
325
+ $form_types = get_option('wpsc_checkout_form_fields');
326
+ $unique_names = get_option('wpsc_checkout_unique_names');
327
 
328
+ do_action('wpsc_checkout_form_fields_page');
329
  ?>
330
 
331
+ <div class='metabox-holder' style='width:95%;'>
332
+ <div class='postbox'>
333
+ <input type='hidden' name='checkout_submits' value='true' />
334
+ <h3 class='hndle'><?php _e( 'Misc Checkout Options' , 'wpsc' ); ?></h3>
335
+ <div class='inside'>
336
+ <table>
337
+ <tr>
338
+ <td><?php _e('Users must register before checking out', 'wpsc'); ?>:</td>
339
+ <td>
340
+ <input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php checked( $this->require_register, 1 ); ?> />
341
+ <label for='require_register1'><?php _e('Yes', 'wpsc');?></label> &nbsp;
342
+ <input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php checked( $this->require_register, 0 ); ?> />
343
+ <label for='require_register2'><?php _e('No', 'wpsc');?></label>
344
+ </td>
345
+ <td>
346
+ <a title='<?php _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>
347
+ </td>
348
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
 
350
+ <tr>
351
+ <td scope="row"><?php _e('Enable Shipping Same as Billing Option', 'wpsc'); ?>:</td>
352
+ <td>
353
+ <input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php checked( $this->shipping_same_as_billing, 1 ); ?> />
354
+ <label for='shippingsameasbilling1'><?php _e('Yes', 'wpsc');?></label> &nbsp;
355
+ <input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php checked( $this->shipping_same_as_billing, 0 ); ?> />
356
+ <label for='shippingsameasbilling2'><?php _e('No', 'wpsc');?></label>
357
+ </td>
358
+ </tr>
359
+ <tr>
360
+ <td><?php _e('Force users to use SSL', 'wpsc'); ?>:</td>
361
+ <td>
362
+ <input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php checked( $this->force_ssl, 1 ); ?> />
363
+ <label for='wpsc_force_ssl1'><?php _e('Yes', 'wpsc');?></label> &nbsp;
364
+ <input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php checked( $this->force_ssl, 0 ); ?> />
365
+ <label for='wpsc_force_ssl2'><?php _e('No', 'wpsc');?></label>
366
+ </td>
367
+ <td>
368
+ <a title='<?php _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>
369
+ </td>
370
+ </tr>
371
+ </table>
372
+ </div>
373
+ </div>
374
+ </div>
375
 
376
+ <h3><?php _e('Form Fields', 'wpsc'); ?></h3>
377
+ <p><?php _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>
378
 
379
  <p>
380
+ <label for='wpsc_form_set'><?php _e('Select a Form Set' , 'wpsc'); ?>:</label>
381
  <select id='wpsc_form_set' name='checkout_set'>
382
  <?php foreach ( $this->checkout_sets as $key => $value ): ?>
383
  <option <?php selected( $this->current_checkout_set, $key ); ?> value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value ); ?></option>
384
  <?php endforeach; ?>
385
  </select>
 
386
  <input type='submit' value='<?php esc_attr_e( 'Filter', 'wpsc' ); ?>' name='wpsc_checkout_set_filter' class='button-secondary' />
387
+ <a href='#' class='add_new_form_set'><?php esc_html_e("+ Add New Form Set", 'wpsc'); ?></a>
388
  </p>
389
 
 
 
390
  <p class='add_new_form_set_forms'>
391
  <label><?php esc_html_e( "Add new Form Set", 'wpsc' ); ?>:
392
  <input type="text" value="" name="new_form_set" /></label>
393
+ <input type="submit" value="<?php _e('Add', 'wpsc'); ?>" class="button-secondary" id="formset-add-sumbit"/>
394
  </p>
395
 
396
  <input type="hidden" name="selected_form_set" value="<?php echo esc_attr( $this->current_checkout_set ); ?>" />
413
  <?php $this->prototype_field( 'new' ); ?>
414
  <?php else: ?>
415
  <?php foreach ( $this->form_fields as $form_field ): ?>
416
+ <tr data-field-id="<?php echo esc_attr( $form_field->id ); ?>" id="checkout_<?php echo esc_attr( $form_field->id ); ?>" class="checkout_form_field">
 
417
  <td class="drag">
418
  <div class="cell-wrapper">
419
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
420
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
421
  </a>
422
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
423
  </div>
424
  </td>
425
  <td class="namecol">
426
  <div class="cell-wrapper">
427
  <input type="text" name="form_name[<?php echo esc_attr( $form_field->id ); ?>]" value="<?php echo esc_attr( $form_field->name ); ?>" />
428
+ <a
429
+ class="edit-options" href="#"
430
+ <?php
431
+ if ( in_array( $form_field->type, array( 'select', 'radio', 'checkbox' ) ) )
432
+ echo 'style="display:inline;"';
433
+ ?>
434
+ ><?php esc_html_e( 'Edit Options', 'wpsc' ); ?></a>
435
  </div>
436
  </td>
437
  <td class="typecol">
462
 
463
  <td class="uniquenamecol">
464
  <div class="cell-wrapper">
465
+ <?php if ( $form_field->type != 'heading' && ! empty( $form_field->unique_name ) ): ?>
466
+ <small><?php echo esc_html( $form_field->unique_name ); ?></small>
467
+ <?php endif ?>
 
 
 
 
 
 
 
468
  </div>
469
  </td>
470
  <td class="displaycol">
482
  <td class="actionscol">
483
  <div class="cell-wrapper">
484
  <?php if ( ! $this->is_field_default( $form_field ) ): ?>
485
+ <a tabindex="-1" title="<?php _e( 'Delete Field', 'wpsc' ); ?>" class="action delete" href="#">Delete</a>
486
  <?php else: ?>
487
+ <span title="<?php _e( 'Cannot Delete Default Fields', 'wpsc' ); ?>" class="action delete">Delete</span>
488
  <?php endif; ?>
489
+ <a tabindex="-1" title="<?php _e( 'Add Field', 'wpsc' ); ?>" class="action add" href="#">Add</a>
490
  </div>
491
  </td>
492
  </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";
38
+ break;
39
+
40
+ case "manual_payment":
41
+ $display_name = "Manual Payment";
42
+ break;
43
+
44
+ case "google_checkout":
45
+ $display_name = "Google Checkout";
46
+ break;
47
+
48
+ case "credit_card":
49
+ default:
50
+ $display_name = "Credit Card";
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 _e( "Edit this Payment Gateway's Settings", 'wpsc' ) ?>" href='<?php echo esc_attr( $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 esc_attr_e( $gateway['internalname'] ); ?>' id='<?php esc_attr_e( $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 _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="Sign up for PayPal and start accepting credit card payments instantly." /></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="Sign up for Google Checkout" /></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() {
@@ -38,169 +39,157 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
38
  public function display() {
39
  global $wpdb;
40
  ?>
41
- <h3><?php echo esc_html_e( 'General Settings', 'wpsc' ); ?></h3>
42
  <table class='wpsc_options form-table'>
43
  <tr>
44
- <th scope="row"><label for="wpsc-base-country-drop-down"><?php esc_html_e( 'Base Country/Region', 'wpsc' ); ?></label></th>
45
  <td>
46
- <?php
47
- wpsc_country_dropdown( array(
48
- 'id' => 'wpsc-base-country-drop-down',
49
- 'name' => 'wpsc_options[base_country]',
50
- 'selected' => get_option( 'base_country' ),
51
- 'include_invisible' => true,
52
- ) );
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() {
39
  public function display() {
40
  global $wpdb;
41
  ?>
42
+ <h3><?php echo _e( 'General Settings', 'wpsc' ); ?></h3>
43
  <table class='wpsc_options form-table'>
44
  <tr>
45
+ <th scope="row"><?php _e( 'Base Country/Region', 'wpsc' ); ?>: </th>
46
  <td>
47
+ <select id="wpsc-base-country-drop-down" name='wpsc_options[base_country]'>
48
+ <?php echo country_list( esc_attr( get_option( 'base_country' ) ) ); ?>
49
+ </select>
 
 
 
 
 
50
  <span id='wpsc-base-region-drop-down'>
51
  <?php $this->display_region_drop_down(); ?>
52
+ <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
53
  </span>
54
+ <br /><?php _e( 'Select your primary business location.', 'wpsc' ); ?>
55
  </td>
56
  </tr>
 
57
  <?php
58
+ /* START OF TARGET MARKET SELECTION */
59
+ $countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ", ARRAY_A );
60
  ?>
61
+ <tr>
62
+ <th scope="row">
63
+ <?php _e( 'Target Markets', 'wpsc' ); ?>:
64
+ </th>
65
+ <td>
66
  <?php
67
  // check for the suhosin module
68
+ if ( @extension_loaded( 'suhosin' ) && (@ini_get( 'suhosin.post.max_vars' ) > 0) && (@ini_get( 'suhosin.post.max_vars' ) < 500) ) {
69
  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>";
70
  } else {
71
+ ?>
72
  <span>
73
+ <?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' ) ) ) ); ?>
74
  </span><br />
75
  <div id='wpsc-target-markets' class='ui-widget-content multiple-select'>
76
+ <?php
77
+ foreach ( (array)$countrylist as $country ) {
78
+ $country['country'] = htmlspecialchars( $country['country'] );
79
+ if ( $country['visible'] == 1 ) {
80
+ ?>
81
+ <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 echo $country['country']; ?></label><br />
82
+ <?php } else {
83
+ ?>
84
+ <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_attr_e( $country['country'] ); ?></label><br />
85
+ <?php }
86
+ } ?>
87
+ </div><br />
88
+ <?php _e( 'Select the markets you are selling products to.' , 'wpsc');
89
  }
90
+ ?>
91
+ </td>
92
+ </tr>
93
+ <?php
94
+ $stock_keeping_time = get_option( 'wpsc_stock_keeping_time', 1 );
95
+ $stock_keeping_interval = get_option( 'wpsc_stock_keeping_interval', 'day' );
96
+ ?>
97
+ <tr>
98
+ <th scope="row">
99
+ <label for="wpsc-stock-keeping-time"><?php _e( 'Keep stock in cart for' ); ?>:</label>
100
+ </th>
101
+ <td>
102
+ <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 ); ?>" />
103
+ <select name="wpsc_options[wpsc_stock_keeping_interval]">
104
+ <option value="hour" <?php selected( 'hour', $stock_keeping_interval ); ?>><?php echo _n( 'hour', 'hours', $stock_keeping_time, 'wpsc' ); ?></option>
105
+ <option value="day" <?php selected( 'day', $stock_keeping_interval ); ?>><?php echo _n( 'day', 'days', $stock_keeping_time, 'wpsc' ) ?></option>
106
+ <option value="week" <?php selected( 'week', $stock_keeping_interval ); ?>><?php echo _n( 'week', 'weeks', $stock_keeping_time, 'wpsc' ) ?></option>
107
+ </select><br />
108
+ <?php _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.") ?>
109
+ </td>
110
+ </tr>
111
+ <?php $hierarchical_category = get_option( 'product_category_hierarchical_url', 0 ); ?>
112
+ <tr>
113
+ <th scope="row">
114
+ <?php _e( 'Use Hierarchical Product Category URL:' ); ?>
115
+ </th>
116
+ <td>
117
+ <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;
118
+ <label><input type="radio" <?php checked( $hierarchical_category, 0 ); ?>name="wpsc_options[product_category_hierarchical_url]" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label><br />
119
+ <?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' ); ?>
120
+ </td>
121
+ </tr>
122
+ </table>
123
 
124
+ <h3 class="form_group"><?php _e( 'Currency Settings', 'wpsc' ); ?>:</h3>
125
+ <table class='wpsc_options form-table'>
126
+ <tr>
127
+ <th scope="row"><?php _e( 'Currency Type', 'wpsc' ); ?>:</th>
 
 
 
 
128
  <td>
129
+ <select name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
130
+ <?php
131
+ $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
132
+ $currency_type = esc_attr( get_option( 'currency_type' ) );
133
+ foreach ( $currency_data as $currency ) {
134
+ ?>
135
+ <option value='<?php echo $currency['id']; ?>' <?php selected( $currency['id'], $currency_type ); ?>><?php echo htmlspecialchars( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)</option>
136
+ <?php
137
+ }
138
+ $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 );
139
+ if ( $currency_data['symbol'] != '' ) {
140
+ $currency_sign = esc_attr( $currency_data['symbol_html'] );
141
+ } else {
142
+ $currency_sign = esc_attr( $currency_data['code'] );
143
+ }
144
+ ?>
145
  </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  </td>
147
  </tr>
 
 
 
 
 
 
 
 
148
  <tr>
149
+ <th scope="row"><?php _e( 'Currency Sign Location', 'wpsc' ); ?>:</th>
150
+ <td>
151
+ <?php
152
+ $currency_sign_location = esc_attr( get_option( 'currency_sign_location' ) );
153
+ $csl1 = "";
154
+ $csl2 = "";
155
+ $csl3 = "";
156
+ $csl4 = "";
157
+ switch ( $currency_sign_location ) {
158
+ case 1:
159
+ $csl1 = "checked ='checked'";
160
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
 
162
+ case 2:
163
+ $csl2 = "checked ='checked'";
164
+ break;
165
 
166
+ case 3:
167
+ $csl3 = "checked ='checked'";
168
+ break;
169
 
170
+ case 4:
171
+ $csl4 = "checked ='checked'";
172
+ break;
173
+ } ?>
174
+ <input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
175
+ <label for='csl1'>100<span id='cslchar1'><?php echo $currency_sign; ?></span></label> &nbsp;
176
+ <input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
177
+ <label for='csl2'>100 <span id='cslchar2'><?php echo $currency_sign; ?></span></label> &nbsp;
178
+ <input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
179
+ <label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span>100</label> &nbsp;
180
+ <input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
181
+ <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> 100</label>
182
+ </td>
183
+ </tr>
184
+ <tr>
185
+ <th scope="row"><?php _e( 'Thousands and decimal separators', 'wpsc' ); ?>:</th>
186
+ <td>
187
+ <?php _e( 'Thousands separator', 'wpsc' ); ?>: <input name="wpsc_options[wpsc_thousands_separator]" type="text" maxlength="1" size="1" value="<?php echo esc_attr( stripslashes( get_option( 'wpsc_thousands_separator' ) ) ); ?>" /> <br />
188
+ <?php _e( 'Decimal separator', 'wpsc' ); ?>: <input name="wpsc_options[wpsc_decimal_separator]" type="text" maxlength="1" size="1" value="<?php echo esc_attr( stripslashes( get_option( 'wpsc_decimal_separator' ) ) ); ?>" /> <br />
189
+ <?php _e( 'Preview:', 'wpsc' ); ?> 10<?php echo esc_attr( stripslashes( get_option( 'wpsc_thousands_separator' ) ) ); ?>000<?php echo esc_attr( stripslashes( get_option( 'wpsc_decimal_separator' ) ) ); ?>00
190
+ </td>
191
+ </tr>
192
+ </table>
 
 
 
 
193
  <?php
194
  }
195
+ }
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 _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 _e('Product Status' , 'wpsc' ); ?></h3>
145
+ <div class='inside'>
146
+ <table>
147
+ <tr>
148
+ <td style='width:80%;'>
149
+ <?php _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 _e( 'Publish', 'wpsc'); ?></option>
155
+ <option value='draft' ><?php _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 _e('Product Name' , 'wpsc'); ?></option>
175
+ <option <?php selected( $key, 1 ); ?> value='column_description' ><?php _e('Description' , 'wpsc'); ?></option>
176
+ <option <?php selected( $key, 2 ); ?> value='column_additional_description'><?php _e('Additional Description', 'wpsc'); ?></option>
177
+ <option <?php selected( $key, 3 ); ?> value='column_price' ><?php _e('Price' , 'wpsc'); ?></option>
178
+ <option <?php selected( $key, 4 ); ?> value='column_sku' ><?php _e('SKU' , 'wpsc'); ?></option>
179
+ <option <?php selected( $key, 5 ); ?> value='column_weight' ><?php _e('Weight' , 'wpsc'); ?></option>
180
+ <option <?php selected( $key, 6 ); ?> value='column_weight_unit' ><?php _e('Weight Unit' , 'wpsc'); ?></option>
181
+ <option <?php selected( $key, 7 ); ?> value='column_quantity' ><?php _e('Stock Quantity' , 'wpsc'); ?></option>
182
+ <option <?php selected( $key, 8 ); ?> value='column_quantity_limited' ><?php _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 _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
@@ -1,210 +1,87 @@
1
  <?php
2
 
3
- class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
4
-
5
- public function __construct() {
6
- add_action( 'admin_notices', array( $this, 'yoast_check' ) );
7
- }
 
 
 
 
8
 
9
- public function yoast_check() {
10
- $yoast_options = get_option( 'Yoast_Google_Analytics' );
11
- $wpec_tracking = isset( $yoast_options['wpec_tracking'] ) && $yoast_options['wpec_tracking'] ? true : false;
12
 
13
- if ( $wpec_tracking ) {
14
- ?>
15
- <div class="error">
16
- <p><?php _e( '<strong>You appear to have Google Analytics for WordPress installed.</strong>. <br /> This is not a problem, however, you also appear to have the WPeC tracking enabled. We highly recommend disabling that setting and using the settings on this page.', 'wpsc' ); ?></p>
17
  </div>
18
  <?php
19
- }
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
  }
1
  <?php
2
 
3
+ class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab
4
+ {
5
+ public function display() {
6
+ ?>
7
+ <div class='metabox-holder'>
8
+ <?php
9
+ add_meta_box( 'wpsc_marketing_settings', __( 'Marketing Section', 'wpsc' ), array( $this, 'marketing_meta_box' ), 'wpsc' );
10
+ add_meta_box( 'wpsc_rss_address', __( 'RSS Address', 'wpsc' ), array( $this, 'rss_address_meta_box' ), 'wpsc' );
11
+ add_meta_box( 'wpsc_google_merch_center', __( 'Google Merchant Centre / Google Product Search', 'wpsc' ), array( $this, 'google_merch_center_meta_box' ), 'wpsc' );
12
 
13
+ do_meta_boxes( 'wpsc', 'advanced', null );
14
+ ?>
 
15
 
 
 
 
 
16
  </div>
17
  <?php
 
18
  }
19
 
20
+ public function marketing_meta_box() {
 
 
 
 
 
 
 
21
 
22
  $wpsc_also_bought = get_option( 'wpsc_also_bought' );
23
  $wpsc_also_bought1 = '';
24
 
25
  if ( '1' == $wpsc_also_bought )
26
+ $wpsc_also_bought1 = "checked ='checked'";
27
 
28
  $wpsc_share_this = get_option( 'wpsc_share_this' );
29
  $wpsc_share_this1 = '';
30
 
31
  if ( '1' == $wpsc_share_this )
32
+ $wpsc_share_this1 = "checked ='checked'";
33
 
34
  $facebook_like = get_option( 'wpsc_facebook_like' );
35
  $facebook_like1 = '';
36
  if ( 'on' == $facebook_like )
37
+ $facebook_like1 = "checked ='checked'";
38
 
39
  $display_find_us = get_option( 'display_find_us' );
40
  $display_find_us1 = '';
41
 
42
  if ( '1' == $display_find_us )
43
+ $display_find_us1 = "checked ='checked'"; ?>
44
+ <input type='hidden' name='change-settings' value='true' />
45
+ <p>
46
+ <span class='input_label'><?php _e( 'Display Cross Sales', 'wpsc' ); ?></span>
47
+ <input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
48
+ <span class='description'> <?php _e( 'Adds the \'Users who bought this also bought\' item to the single products page.', 'wpsc' ); ?></span>
49
+ </p><br />
50
+ <p>
51
+ <span class='input_label'><?php _e( 'Show Share This (Social Bookmarks)', 'wpsc' ); ?></span>
52
+ <input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
53
+ <span class='description'> <?php _e( 'Adds the \'Share this link\' item to the single products page.', 'wpsc' ); ?></span>
54
+ </p><br />
55
+ <p>
56
+ <span class='input_label'> <?php _e( 'Display How Customer Found Us Survey', 'wpsc' ) ?></span>
57
+ <input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
58
+ <span class='description'> <?php _e( 'Adds the \'How did you find out about us\' drop-down option at checkout.', 'wpsc' ) ?></span>
59
+ </p><br />
60
+ <p>
61
+ <span class='input_label'> <?php _e( 'Display Facebook Like', 'wpsc' ) ?></span>
62
+ <input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
63
+ <input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
64
+ <span class='description'> <?php _e( 'Adds the Facebook Like button on your single products page.', 'wpsc' ) ?></span>
65
+ </p><br />
66
+
67
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
69
 
70
+ public function rss_address_meta_box() {
71
  ?>
72
+ <p><?php _e( 'People can use this RSS feed to keep up to date with your product list.', 'wpsc' ); ?></p>
73
+ <p><?php _e( 'RSS Feed Address', 'wpsc' ) ?> : <?php echo get_bloginfo( 'url' ) . "/index.php?rss=true&amp;action=product_list"; ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
74
  <?php
75
  }
76
 
77
+ function google_merch_center_meta_box() {
78
  ?>
79
+ <p><?php _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>
80
+
81
+ <?php $google_feed_url = get_bloginfo( 'url' ) . "/index.php?rss=true&action=product_list&xmlformat=google"; ?>
82
+
83
+ <a href="<?php esc_attr_e( htmlentities( $google_feed_url, ENT_QUOTES, 'UTF-8' ) ); ?>"><?php esc_attr_e( htmlentities( $google_feed_url, ENT_QUOTES, 'UTF-8' ) ); ?></a>
 
 
 
 
 
 
 
 
 
 
 
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  <?php
86
  }
 
87
  }
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
  }
@@ -26,7 +27,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
26
 
27
  $categorylist .= "<option value='list' " . $selected . " >" . __( 'Show list of product categories', 'wpsc' ) . "</option>";
28
 
29
- $categorylist .= "<optgroup label='" . __( 'Product Categories', 'wpsc' ) . "'>";
30
  foreach ( $group_data as $group ) {
31
  $selected = "";
32
  if ( $current_default == $group->term_id )
@@ -81,7 +82,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
81
  ?>
82
  <div id="poststuff" class="metabox-holder">
83
  <div id="themes_and_appearance" class='postbox'>
84
- <h3 class="hndle"><span><?php esc_html_e( "Advanced Theme Settings", 'wpsc' ); ?></span></h3>
85
  <div class="inside">
86
  <?php
87
 
@@ -89,7 +90,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
89
  ?>
90
 
91
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
92
- <p><?php esc_html_e( 'You did not specify any template files to be moved.', 'wpsc' ); ?></p>
93
  </div>
94
  <?php
95
  $_SESSION['wpsc_theme_empty'] = false;
@@ -99,9 +100,9 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
99
  ?>
100
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
101
  <?php if(in_array(false, $_SESSION['wpsc_themes_copied_results'], true)): ?>
102
- <p style="color:red;"><?php esc_html_e( 'Error: some files could not be copied. Please make sure that theme folder is writable.', 'wpsc' ); ?></p>
103
  <?php else: ?>
104
- <p><?php esc_html_e( 'Thanks, the themes have been copied.', 'wpsc' ); ?></p>
105
  <?php endif; ?>
106
  </div>
107
  <?php
@@ -111,8 +112,8 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
111
  if ( isset( $_SESSION['wpsc_themes_backup'] ) && ($_SESSION['wpsc_themes_backup'] == true) ) {
112
  ?>
113
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
114
- <p><?php _e( 'Thanks, you have made a succesful backup of your theme. It is located at the URL below. Please note each backup you create will replace your previous backups.', 'wpsc' ); ?></p>
115
- <p><?php _e( 'URL:', 'wpsc' ); ?> <?php echo "/" . str_replace( ABSPATH, "", WPSC_THEME_BACKUP_DIR ); ?></p>
116
  </div>
117
  <?php
118
  $_SESSION['wpsc_themes_backup'] = false;
@@ -121,17 +122,17 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
121
  <p>
122
  <?php if(false !== $themes_location)
123
  //Some themes have been moved to the themes folder
124
- _e( 'Some Theme files have been moved to your WordPress Theme Folder.', 'wpsc' );
125
  else
126
- _e( 'No Theme files have been moved to your WordPress Theme Folder.', 'wpsc' );
127
 
128
  ?>
129
 
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>
136
  <ul>
137
  <?php
@@ -141,24 +142,24 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
141
  if(false !== array_search($file, (array)$themes_location))
142
  $selected = 'checked="checked"';
143
  ?>
144
- <li><input type='checkbox' id='<?php echo $id; ?>' <?php echo $selected; ?> value='<?php echo esc_attr( $file ); ?>' name='wpsc_templates_to_port[]' />
145
- <label for='<?php echo $id; ?>'><?php echo esc_html( $file ); ?></label></li>
146
  <?php } ?>
147
  </ul>
148
  <p>
149
  <?php if(false !== $themes_location){
150
- esc_html_e( 'To change the look of certain aspects of your shop, you can edit the moved files that are found here:', 'wpsc' );
151
  ?>
152
  </p>
153
- <p class="howto"> <?php echo get_stylesheet_directory(); ?></p>
154
  <?php } ?>
155
  <p><?php
156
  wp_nonce_field('wpsc_copy_themes');
157
  ?>
158
- <input type='submit' value='<?php esc_attr_e( 'Move Template Files &rarr;' ); ?>' class="button" name='wpsc_move_themes' />
159
  </p>
160
- <p><?php _e( 'You can create a copy of your WordPress Theme by clicking the backup button bellow. Once copied you can find them here:' ,'wpsc' ); ?></p>
161
- <p class="howto"><?php echo esc_html( '/wp-content/uploads/wpsc/theme_backup/' ); ?></p>
162
  <p>
163
  <?php
164
  printf( __( '<a href="%s" class="button">Backup Your WordPress Theme</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_admin_action=backup_themes', 'backup_themes' ) ); ?>
@@ -166,7 +167,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
166
  </p>
167
 
168
  <br style="clear:both" />
169
- <p><?php esc_html_e( 'If you have moved your files in some other way i.e FTP, you may need to click the Flush Theme Cache. This will refresh the locations WordPress looks for your templates.' ,'wpsc' ); ?></p>
170
  <p><?php printf( __( '<a href="%s" class="button">Flush Theme Cache</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_flush_theme_transients=true', 'wpsc_flush_theme_transients' ) ); ?></p>
171
  <br style="clear:both" />
172
  <br style="clear:both" />
@@ -179,13 +180,10 @@ 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>
190
  <?php
191
  $addtocart_or_buynow = get_option( 'addtocart_or_buynow' );
@@ -202,13 +200,13 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
202
  }
203
  ?>
204
  <input type='radio' value='0' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow1' <?php echo $addtocart_or_buynow1; ?> />
205
- <label for='addtocart_or_buynow1'><?php esc_html_e( 'Add To Cart', 'wpsc' ); ?></label> &nbsp;<br />
206
  <?php $selected_gateways = get_option( 'custom_gateway_options' );
207
  $disable_buy_now = '';
208
  $message = '';
209
  if (!in_array( 'wpsc_merchant_paypal_standard', (array)$selected_gateways )){
210
  $disable_buy_now = 'disabled="disabled"';
211
- $message = __( 'Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.','wpsc' );
212
  } ?>
213
  <input <?php echo $disable_buy_now; ?> type='radio' value='1' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow2' <?php echo $addtocart_or_buynow2; ?> />
214
  <label for='addtocart_or_buynow2'><?php _e( 'Buy Now', 'wpsc' ); ?></label><br />
@@ -217,7 +215,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
217
  </tr>
218
 
219
  <tr>
220
- <th scope="row"><?php esc_html_e( 'Hide "Add to cart" button', 'wpsc' ); ?>:</th>
221
  <td>
222
  <?php
223
  $hide_addtocart_button = get_option( 'hide_addtocart_button' );
@@ -239,12 +237,12 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
239
  </tr>
240
  </table>
241
 
242
- <h3 class="form_group"><?php esc_html_e( 'Product Settings', 'wpsc' ); ?></h3>
243
 
244
  <table class='wpsc_options form-table'>
245
 
246
  <tr>
247
- <th scope="row"><?php esc_html_e( 'Show Product Ratings', 'wpsc' ); ?>:</th>
248
  <td>
249
  <?php
250
  $display_pnp = get_option( 'product_ratings' );
@@ -274,7 +272,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
274
  $list_view_quantity_value2 = 'checked="checked"';
275
  ?>
276
  <th scope="row">
277
- <?php esc_html_e( 'Show Stock Availability', 'wpsc' ); ?>:
278
  </th>
279
  <td>
280
  <input type='radio' value='1' name='wpsc_options[list_view_quantity]' id='list_view_quantity1' <?php echo $list_view_quantity_value1; ?> /> <label for='list_view_quantity1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
@@ -283,7 +281,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
283
  </tr>
284
  <tr>
285
  <th scope="row">
286
- <?php esc_html_e( 'Display Fancy Purchase Notifications', 'wpsc' ); ?>:
287
  </th>
288
  <td>
289
  <?php
@@ -307,7 +305,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
307
 
308
 
309
  <tr>
310
- <th scope="row"><?php esc_html_e( 'Display per item shipping', 'wpsc' ); ?>:</th>
311
  <td>
312
  <?php
313
  $display_pnp = get_option( 'display_pnp' );
@@ -329,7 +327,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
329
  </tr>
330
 
331
  <tr>
332
- <th scope="row"><?php esc_html_e( 'Disable link in Title', 'wpsc' ); ?>: </th>
333
  <td>
334
  <?php
335
  $hide_name_link = get_option( 'hide_name_link' );
@@ -353,7 +351,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
353
  </tr>
354
 
355
  <tr>
356
- <th scope="row"><?php esc_html_e( 'Add quantity field to each product description', 'wpsc' ); ?>:</th>
357
  <td>
358
  <?php
359
  $multi_adding = get_option( 'multi_add' );
@@ -378,11 +376,14 @@ 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'>
384
  <tr>
385
- <th scope="row"><?php esc_html_e( 'Product Display', 'wpsc' ); ?>:</th>
386
  <td>
387
  <?php
388
  $display_pnp = get_option( 'product_view' );
@@ -434,67 +435,67 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
434
  }
435
  ?>
436
  <select name='wpsc_options[product_view]'>
437
- <option value='default' <?php echo $product_view1; ?>><?php esc_html_e( 'Default View', 'wpsc' ); ?></option>
438
  <?php
439
  if ( function_exists( 'product_display_list' ) ) {
440
  ?>
441
- <option value='list' <?php echo $product_view2; ?>><?php esc_html_e( 'List View', 'wpsc' ); ?></option>
442
  <?php
443
  } else {
444
  ?>
445
- <option value='list' disabled='disabled' <?php echo $product_view2; ?>><?php esc_html_e( 'List View', 'wpsc' ); ?></option>
446
  <?php
447
  }
448
 
449
  if ( function_exists( 'product_display_grid' ) ) {
450
  ?>
451
- <option value='grid' <?php echo $product_view3; ?>><?php esc_html_e( 'Grid View', 'wpsc' ); ?></option>
452
  <?php
453
  } else {
454
  ?>
455
- <option value='grid' disabled='disabled' <?php echo $product_view3; ?>><?php esc_html_e( 'Grid View', 'wpsc' ); ?></option>
456
  <?php
457
  }
458
  ?>
459
  </select>
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
  ?>
467
  </td>
468
  </tr>
469
 
 
470
  <tr id="wpsc-grid-settings">
471
- <th scope="row"><?php esc_html_e( 'Grid view settings:', 'wpsc' ) ?></th>
472
  <td>
473
- <input type='number' min="0" name='wpsc_options[grid_number_per_row]' id='grid_number_per_row' size='2' value='<?php esc_attr_e( get_option( 'grid_number_per_row' ) ); ?>' class='small-text' />
474
- <label for='grid_number_per_row'><?php esc_html_e( 'Products Per Row', 'wpsc' ); ?></label><br />
475
 
476
  <input type='hidden' value='0' name='wpsc_options[show_images_only]' />
477
  <input type='checkbox' value='1' name='wpsc_options[show_images_only]' id='wpsc-show-images-only' <?php echo $show_images_only_value; ?> />
478
- <label for='wpsc-show-images-only'><?php esc_html_e( 'Show images only', 'wpsc' ); ?></label><br />
479
 
480
  <input type='hidden' value='0' name='wpsc_options[display_variations]' />
481
  <input type='checkbox' value='1' name='wpsc_options[display_variations]' id='wpsc-display-variations' <?php echo $display_variations; ?> />
482
- <label for='wpsc-display-variations'><?php esc_html_e( 'Display Variations', 'wpsc' ); ?></label><br />
483
 
484
  <input type='hidden' value='0' name='wpsc_options[display_description]' />
485
  <input type='checkbox' value='1' name='wpsc_options[display_description]' id='wpsc-display-description' <?php echo $display_description; ?> />
486
- <label for='wpsc-display-description'><?php esc_html_e( 'Display Description', 'wpsc' ); ?></label><br />
487
 
488
  <input type='hidden' value='0' name='wpsc_options[display_addtocart]' />
489
  <input type='checkbox' value='1' name='wpsc_options[display_addtocart]' id='wpsc-display-add-to-cart' <?php echo $display_addtocart; ?> />
490
- <label for='wpsc-display-add-to-cart'><?php esc_html_e( 'Display "Add To Cart" Button', 'wpsc' ); ?></label><br />
491
 
492
  <input type='hidden' value='0' name='wpsc_options[display_moredetails]' />
493
  <input type='checkbox' value='1' name='wpsc_options[display_moredetails]' id='wpsc-display-more-details' <?php echo $display_moredetails; ?> />
494
- <label for='wpsc-display-more-details'><?php esc_html_e( 'Display "More Details" Button', 'wpsc' ); ?></label>
495
  </td>
496
  </tr>
497
 
 
498
  <?php
499
  $selected1 = $selected2 = '';
500
  if(get_option('wpsc_display_categories'))
@@ -504,17 +505,16 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
504
  ?>
505
 
506
  <tr>
507
- <th scope="row"><?php esc_html_e( 'Show list of categories', 'wpsc' ); ?>:</th>
508
  <td>
509
- <input type='radio' value='1' name='wpsc_options[wpsc_display_categories]' id='display_categories2' <?php echo $selected1; ?> />
510
- <label for='display_categories2'><?php _e( 'Yes', 'wpsc' ); ?></label>
511
  <input type='radio' value='0' name='wpsc_options[wpsc_display_categories]' id='display_categories1' <?php echo $selected2; ?> />
512
  <label for='display_categories1'><?php _e( 'No', 'wpsc' ); ?></label><br />
513
  </td>
514
  </tr>
515
 
516
  <tr>
517
- <th scope="row"><?php esc_html_e( 'Select what product category you want to display on the products page', 'wpsc' ); ?>:</th>
518
  <td>
519
  <?php echo $this->category_list(); ?>
520
  </td>
@@ -547,24 +547,19 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
547
  <td>
548
  <select name='wpsc_options[wpsc_sort_by]'>
549
  <option <?php if ( isset( $wpsc_sort_by1 ) )
550
- echo $wpsc_sort_by1; ?> value='name'><?php esc_html_e( 'Name', 'wpsc' ); ?></option>
551
  <option <?php if ( isset( $wpsc_sort_by2 ) )
552
- echo $wpsc_sort_by2; ?> value='price'><?php esc_html_e( 'Price', 'wpsc' ); ?></option>
553
  <option <?php if ( isset( $wpsc_sort_by4 ) )
554
- echo $wpsc_sort_by4; ?> value='dragndrop'><?php esc_html_e( 'Drag &amp; Drop', 'wpsc' ); ?></option>
555
  <option <?php if ( isset( $wpsc_sort_by3 ) )
556
- echo $wpsc_sort_by3; ?> value='id'><?php esc_html_e( 'Time Uploaded', 'wpsc' ); ?></option>
557
  </select>
558
-
559
- <select name="wpsc_options[wpsc_product_order]">
560
- <option value="ASC" <?php selected( get_option( 'wpsc_product_order' ), 'ASC' ); ?>><?php _ex( 'Ascending', 'product order setting', 'wpsc' ); ?></option>
561
- <option value="DESC" <?php selected( get_option( 'wpsc_product_order' ), 'DESC' ); ?>><?php _ex( 'Descending', 'product order setting', 'wpsc' ); ?></option>
562
- </select>
563
  </td>
564
  </tr>
565
 
566
  <tr>
567
- <th scope="row"><?php esc_html_e( 'Show Breadcrumbs', 'wpsc' ); ?>:</th>
568
  <td>
569
  <?php
570
  $show_breadcrumbs = get_option( 'show_breadcrumbs' );
@@ -589,7 +584,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
589
 
590
  <tr>
591
  <th scope="row">
592
- <?php esc_html_e( 'Product Groups/Products Display', 'wpsc' ); ?>:
593
  </th>
594
  <td>
595
  <?php
@@ -606,14 +601,14 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
606
  break;
607
  }
608
  ?>
609
- <input type='radio' value='0' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type1' <?php echo $catsprods_display_type1; ?> /> <label for='catsprods_display_type1'><?php _e( 'Product Groups Only (All products displayed)', 'wpsc' ); ?></label><br/>
610
  <input type='radio' value='1' name='wpsc_options[catsprods_display_type]' id='catsprods_display_type2' <?php echo $catsprods_display_type2; ?> /> <label for='catsprods_display_type2'><?php _e( 'Sliding Product Groups (1 product per page)', 'wpsc' ); ?></label>
611
  </td>
612
  </tr>
613
 
614
  <tr>
615
  <th scope="row">
616
- <?php esc_html_e( 'Show Subcategory Products in Parent Category', 'wpsc' ); ?>:
617
  </th>
618
  <td>
619
  <?php
@@ -638,7 +633,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
638
  if ( function_exists( 'gold_shpcrt_search_form' ) ) {
639
  ?>
640
  <tr>
641
- <th scope="row"><?php esc_html_e( 'Show Search', 'wpsc' ); ?>:</th>
642
  <td>
643
  <?php
644
  $display_pnp = get_option( 'show_search' );
@@ -681,13 +676,13 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
681
  <div <?php echo $dis; ?> id='wpsc_advanced_search'>
682
  <input type='hidden' name='wpsc_options[show_advanced_search]' value='0' />
683
  <input type='checkbox' name='wpsc_options[show_advanced_search]' id='show_advanced_search' <?php echo $show_advanced_search; ?> value='1' />
684
- <?php esc_html_e( 'Show Advanced Search', 'wpsc' ); ?><br />
685
  <input type='hidden' name='wpsc_options[show_live_search]' value='0' />
686
  <input type='checkbox' name='wpsc_options[show_live_search]' id='show_live_search' <?php echo $show_live_search; ?> value='1' />
687
- <?php esc_html_e( 'Use Live Search', 'wpsc' ); ?><br />
688
  <input type='hidden' name='wpsc_options[embed_live_search_results]' value='0' />
689
  <input type='checkbox' name='wpsc_options[embed_live_search_results]' id='embed_live_search_results'<?php echo $embed_live_search_results; ?> value='1' />
690
- <?php esc_html_e( 'Dynamically replace search results into product list', 'wpsc' ); ?>
691
  </div>
692
  </td>
693
  </tr>
@@ -697,7 +692,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
697
 
698
 
699
  <tr>
700
- <th scope="row"><?php esc_html_e( 'Replace Page Title With Product/Category Name', 'wpsc' ); ?>:</th>
701
  <td>
702
  <?php
703
  $wpsc_replace_page_title = get_option( 'wpsc_replace_page_title' );
@@ -718,7 +713,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
718
  </td>
719
  </tr>
720
  <tr>
721
- <th scope="row"><?php esc_html_e( 'Display Featured Product above Product Pages', 'wpsc' ); ?>:</th>
722
  <td>
723
  <?php
724
  $wpsc_hide_featured_products = get_option( 'wpsc_hide_featured_products' );
@@ -741,10 +736,10 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
741
  </tr>
742
  </table>
743
 
744
- <h3 class="form_group"><?php esc_html_e( 'Shopping Cart Settings', 'wpsc' ); ?></h3>
745
  <table class='wpsc_options form-table'>
746
  <tr>
747
- <th scope="row"><?php esc_html_e( 'Cart Location', 'wpsc' ); ?>:</th>
748
  <td>
749
  <?php
750
  $cart_location = get_option( 'cart_location' );
@@ -770,31 +765,31 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
770
  break;
771
  }
772
  ?>
773
- <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='2' name='wpsc_options[cart_location]' id='cart2' <?php echo $cart2; ?> /> <label for='cart2'><?php esc_html_e( 'Page', 'wpsc' ); ?></label> &nbsp;
774
  <?php
775
  if ( function_exists( 'wp_register_sidebar_widget' ) ) {
776
  ?>
777
- <input type='radio' value='4' onclick='hideelement1("dropshop_option", this.value)' name='wpsc_options[cart_location]' id='cart4' <?php echo $cart4; ?> /> <label for='cart4'><?php esc_html_e( 'Widget', 'wpsc' ); ?></label> &nbsp;
778
  <?php
779
  } else {
780
  ?>
781
- <input type='radio' disabled='disabled' value='4' name='wpsc_options[cart_location]' id='cart4' alt='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' title='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' <?php echo $cart4; ?> /> <label style='color: #666666;' for='cart4' title='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>'><?php esc_html_e( 'Widget', 'wpsc' ); ?></label> &nbsp;
782
  <?php
783
  }
784
 
785
  if ( function_exists( 'drag_and_drop_cart_ajax' ) ) {
786
  ?>
787
- <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='5' name='wpsc_options[cart_location]' id='cart5' <?php echo $cart5; ?> /> <label for='cart5'><?php esc_html_e( 'DropShop', 'wpsc' ); ?></label> &nbsp;
788
  <?php
789
  } else {
790
  ?>
791
- <input type='radio' disabled='disabled' value='5' name='wpsc_options[cart_location]' id='cart5' alt='<?php esc_attr_e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' title='<?php esc_attr_e( 'You need to install the Gold and DropShop extentions to use this', 'wpsc' ); ?>' <?php if ( isset( $cart5 ) )
792
- echo $cart5; ?> /> <label style='color: #666666;' for='cart5' title='<?php esc_attr_e( 'You need to install the Gold and DropShop extentions to use this', 'wpsc' ); ?>'><?php esc_html_e( 'DropShop', 'wpsc' ); ?></label> &nbsp;
793
  <?php
794
  }
795
  ?>
796
  <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='3' name='wpsc_options[cart_location]' id='cart3' <?php if ( isset( $cart3 ) )
797
- echo $cart3; ?> /> <label for='cart3'><?php esc_html_e( 'Manual', 'wpsc' ); ?> <span style='font-size: 7pt;'><?php echo esc_html( '(PHP code: <?php echo wpsc_shopping_cart(); ?> )')?></span></label>
798
  <div style='display: <?php if ( !empty( $cart5 ) ) {
799
  echo "block";
800
  } else {
@@ -803,21 +798,21 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
803
  <p>
804
  <input type="radio" id="drop1" value="all" <?php if ( get_option( 'dropshop_display' ) == 'all' ) {
805
  echo "checked='checked'";
806
- } ?> name="wpsc_options[dropshop_display]" /><label for="drop1"><?php esc_html_e( 'Show Dropshop on every page', 'wpsc' ); ?></label>
807
  <input type="radio" id="drop2" value="product" <?php if ( get_option( 'dropshop_display' ) == 'product' ) {
808
  echo "checked='checked'";
809
- } ?> name="wpsc_options[dropshop_display]"/><label for="drop2"><?php esc_html_e( 'Show Dropshop only on product page', 'wpsc' ); ?></label>
810
  </p>
811
  <p>
812
  <input type="radio" id="wpsc_dropshop_theme1" value="light" <?php if ( get_option( 'wpsc_dropshop_theme' ) != 'dark' ) {
813
  echo "checked='checked'";
814
- } ?> name="wpsc_options[wpsc_dropshop_theme]" /><label for="wpsc_dropshop_theme1"><?php esc_html_e( 'Use light Dropshop style', 'wpsc' ); ?></label>
815
  <input type="radio" id="wpsc_dropshop_theme2" value="dark" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'dark' ) {
816
  echo "checked='checked'";
817
- } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php esc_html_e( 'Use dark Dropshop style', 'wpsc' ); ?></label>
818
  <input type="radio" id="wpsc_dropshop_theme3" value="craftyc" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'craftyc' ) {
819
  echo "checked='checked'";
820
- } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php esc_html_e( 'Crafty', 'wpsc' ); ?></label>
821
 
822
  </p>
823
  </div>
@@ -826,7 +821,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
826
 
827
  <tr>
828
  <th scope="row">
829
- <?php esc_html_e( 'Display "+ Postage & Tax"', 'wpsc' ); ?>:
830
  </th>
831
  <td>
832
  <?php
@@ -849,11 +844,11 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
849
  </tr>
850
  </table>
851
 
852
- <h3 class="form_group"><?php esc_html_e( 'Product Category Settings', 'wpsc' ); ?></h3>
853
  <table class='wpsc_options form-table'>
854
 
855
  <tr>
856
- <th scope="row"><?php esc_html_e( 'Show Product Category Description', 'wpsc' ); ?>:</th>
857
  <td>
858
  <?php
859
  $wpsc_category_description = get_option( 'wpsc_category_description' );
@@ -877,7 +872,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
877
 
878
  <tr>
879
  <th scope="row">
880
- <?php esc_html_e( 'Show Product Category Thumbnails', 'wpsc' ); ?>:
881
  </th>
882
  <td>
883
  <?php
@@ -903,7 +898,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
903
 
904
  <tr>
905
  <th scope="row">
906
- <?php esc_html_e( 'Show Product Count per Product Category', 'wpsc' ); ?>:
907
  </th>
908
  <td>
909
  <?php
@@ -928,7 +923,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
928
  <!-- // Adrian - options for displaying category display type -->
929
 
930
  <tr>
931
- <th scope="row"><?php esc_html_e( 'Use Category Grid View', 'wpsc' ); ?>:</th>
932
  <td>
933
  <?php
934
  $wpsc_category_grid_view = get_option( 'wpsc_category_grid_view' );
@@ -952,50 +947,39 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
952
  </table>
953
 
954
 
955
- <h3 class="form_group"><a name='thumb_settings'><?php esc_html_e( 'Thumbnail Settings', 'wpsc' ); ?></a></h3>
956
- <p><em><?php esc_html_e( 'Note: Anytime you update any of the thumbnail settings, WPeC will automatically resize all of your thumbnails for you. Depending on how many images you have, this could take awhile.', 'wpsc' ); ?></em></p>
957
  <table class='wpsc_options form-table'>
958
  <?php if ( function_exists( "getimagesize" ) ) { ?>
959
  <tr>
960
- <th scope="row"><?php esc_html_e( 'Default Product Thumbnail Size', 'wpsc' ); ?>:</th>
961
  <td>
962
- <fieldset class="wpsc-width-height-fields">
963
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
964
- <input name="wpsc_options[product_image_width]" type="number" step="1" min="0" id="product_image_width" value="<?php esc_attr_e( get_option( 'product_image_width' ) ); ?>" class="small-text">
965
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
966
- <input name="wpsc_options[product_image_height]" type="number" step="1" min="0" id="product_image_height" value="<?php esc_attr_e( get_option( 'product_image_height' ) ); ?>" class="small-text">
967
- </fieldset>
968
  </td>
969
  </tr>
970
  <tr>
971
  <th scope="row">
972
- <?php esc_html_e( 'Default Product Category Thumbnail Size', 'wpsc' ); ?>:
973
  </th>
974
  <td>
975
- <fieldset class="wpsc-width-height-fields">
976
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
977
- <input name="wpsc_options[category_image_width]" type="number" step="1" min="0" id="category_image_width" value="<?php esc_attr_e( get_option( 'category_image_width' ) ); ?>" class="small-text">
978
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
979
- <input name="wpsc_options[category_image_height]" type="number" step="1" min="0" id="category_image_height" value="<?php esc_attr_e( get_option( 'category_image_height' ) ); ?>" class="small-text">
980
- </fieldset>
981
  </td>
982
  </tr>
983
  <tr>
984
  <th scope="row">
985
- <?php esc_html_e( 'Single Product Image Size', 'wpsc' ); ?>:
986
  </th>
987
  <td>
988
- <fieldset class="wpsc-width-height-fields">
989
- <label for="image_width"><?php esc_html_e( 'Width', 'wpsc' ); ?></label>
990
- <input name="wpsc_options[single_view_image_width]" type="number" step="1" min="0" id="single_view_image_width" value="<?php esc_attr_e( get_option( 'single_view_image_width' ) ); ?>" class="small-text">
991
- <label for="large_size_h"><?php esc_html_e( 'Height', 'wpsc' ); ?></label>
992
- <input name="wpsc_options[single_view_image_height]" type="number" step="1" min="0" id="single_view_image_height" value="<?php esc_attr_e( get_option( 'single_view_image_height' ) ); ?>" class="small-text">
993
- </fieldset>
994
  </td>
995
  </tr>
996
  <tr>
997
- <th scope="row">
998
- <?php
999
  $cropthumbs = get_option( 'wpsc_crop_thumbnails' );
1000
  $crop1 = "";
1001
  $crop2 = "";
@@ -1009,12 +993,12 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1009
  break;
1010
  }
1011
  ?>
1012
- <?php esc_html_e( 'Crop Thumbnails', 'wpsc' ); ?>:
1013
  </th>
1014
  <td>
1015
- <input type='radio' value='1' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails1' <?php echo $crop1; ?> /> <label for='crop1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1016
  <input type='radio' value='0' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails2' <?php echo $crop2; ?> /> <label for='crop2'><?php _e( 'No', 'wpsc' ); ?></label><br />
1017
- <?php esc_html_e( 'Choosing "Yes" means that thumbnails are cropped to exact dimensions (normally thumbnails are proportional)', 'wpsc' ); ?>
1018
  </td>
1019
  </tr>
1020
  <?php
@@ -1022,7 +1006,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1022
  ?>
1023
 
1024
  <tr>
1025
- <th scope="row"><?php esc_html_e( 'Show Thumbnails', 'wpsc' ); ?>:</th>
1026
  <td>
1027
  <?php
1028
  $show_thumbnails = get_option( 'show_thumbnails' );
@@ -1043,7 +1027,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1043
  </td>
1044
  </tr>
1045
  <tr>
1046
- <th scope="row"><?php esc_html_e( 'Use Lightbox Effect for product images', 'wpsc' ); ?>:</th>
1047
  <td>
1048
  <?php
1049
  $show_thumbnails_thickbox = get_option( 'show_thumbnails_thickbox' );
@@ -1061,11 +1045,11 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1061
  ?>
1062
  <input type='radio' value='1' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox1' <?php echo $show_thumbnails_thickbox1; ?> /> <label for='show_thumbnails_thickbox1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1063
  <input type='radio' value='0' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox2' <?php echo $show_thumbnails_thickbox2; ?> /> <label for='show_thumbnails_thickbox2'><?php _e( 'No', 'wpsc' ); ?></label><br />
1064
- <?php esc_html_e( 'Using lightbox means that when clicking on a product image, a larger version will be displayed in a "lightbox" style window. If you are using a plugin such as Shutter Reloaded, you may want to disable lightbox.', 'wpsc' ); ?>
1065
  </td>
1066
  </tr>
1067
  <tr>
1068
- <th scope="row"><?php esc_html_e( 'Lightbox script to use', 'wpsc' ); ?>:</th>
1069
  <td>
1070
  <?php
1071
  $wpsc_lightbox = get_option( 'wpsc_lightbox', 'thickbox' );
@@ -1086,7 +1070,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1086
  ?>
1087
  <tr>
1088
  <th scope="row">
1089
- <?php esc_html_e( 'Show Thumbnail Gallery', 'wpsc' ); ?>:
1090
  </th>
1091
  <td>
1092
  <?php
@@ -1110,11 +1094,11 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1110
 
1111
  <tr>
1112
  <th scope="row">
1113
- <?php esc_html_e( 'Gallery Thumbnail Image Size', 'wpsc' ); ?>:
1114
  </th>
1115
  <td>
1116
- <?php esc_html_e( 'Width', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_width]' value='<?php esc_attr_e( get_option( 'wpsc_gallery_image_width' ) ); ?>' />
1117
- <?php esc_html_e( 'Height', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_height]' value='<?php esc_attr_e( get_option( 'wpsc_gallery_image_height' ) ); ?>' /><br />
1118
 
1119
  </td>
1120
  </tr>
@@ -1125,11 +1109,11 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1125
  </table>
1126
 
1127
 
1128
- <h3 class="form_group"><?php esc_html_e( 'Pagination Settings', 'wpsc' ); ?></h3>
1129
  <table class='wpsc_options form-table'>
1130
  <tr>
1131
  <th scope="row">
1132
- <?php esc_html_e( 'Use Pagination', 'wpsc' ); ?>:
1133
  </th>
1134
  <td>
1135
  <?php
@@ -1158,30 +1142,30 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1158
 
1159
  <tr>
1160
  <th scope="row">
1161
- <?php esc_html_e( 'Page Number position', 'wpsc' ); ?>:
1162
  </th>
1163
  <td>
1164
  <input type='radio' value='1' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position1' <?php if ( get_option( 'wpsc_page_number_position' ) == 1 ) {
1165
  echo "checked='checked'";
1166
- } ?> />&nbsp;<label for='wpsc_page_number_position1'><?php esc_html_e( 'Top', 'wpsc' ); ?></label> &nbsp;
1167
  <input type='radio' value='2' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position2' <?php if ( get_option( 'wpsc_page_number_position' ) == 2 ) {
1168
  echo "checked='checked'";
1169
- } ?> />&nbsp;<label for='wpsc_page_number_position2'><?php esc_html_e( 'Bottom', 'wpsc' ); ?></label>&nbsp;
1170
  <input type='radio' value='3' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position3' <?php if ( get_option( 'wpsc_page_number_position' ) == 3 ) {
1171
  echo "checked='checked'";
1172
- } ?> />&nbsp;<label for='wpsc_page_number_position3'><?php esc_html_e( 'Both', 'wpsc' ); ?></label>
1173
  <br />
1174
  </td>
1175
  </tr>
1176
  </table>
1177
 
1178
 
1179
- <h3 class="form_group"><?php esc_html_e( 'Comment Settings', 'wpsc' ); ?></h3>
1180
  <table class='wpsc_options form-table'>
1181
  <tr>
1182
  <th scope="row">
1183
- <?php esc_html_e( 'Use IntenseDebate Comments', 'wpsc' ); ?>:
1184
- <a href="http://intensedebate.com/" title="<?php esc_attr_e( 'IntenseDebate comments enhance and encourage conversation on your blog or website', 'wpsc' ); ?>" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/intensedebate-logo.png" alt="<?php esc_attr_e( 'intensedebate-logo', 'wpsc' ); ?>" title="<?php esc_attr_e( 'IntenseDebate', 'wpsc' ); ?>" /></a>
1185
  </th>
1186
  <td>
1187
  <?php
@@ -1204,9 +1188,9 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1204
  <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").show()' type='radio' value='1' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments1' <?php echo $enable_comments1; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1205
  <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").hide()' type='radio' value='0' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments2' <?php echo $enable_comments2; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'No', 'wpsc' ); ?></label><br />
1206
  <div id='wpsc_enable_comments' <?php echo $intense_debate_account_id_display_state; ?> >
1207
- <?php esc_html_e( 'IntenseDebate Account ID', 'wpsc' ); ?>:<br/>
1208
  <input type='text' size='30' name='wpsc_options[wpsc_intense_debate_account_id]' value='<?php esc_attr_e( get_option( 'wpsc_intense_debate_account_id' ) ); ?>' /><br/>
1209
- <small><a href='http://intensedebate.com/sitekey/' title='<?php esc_attr_e( 'Help on finding the Account ID', 'wpsc' ); ?>'><?php _e( 'Help on finding the Account ID', 'wpsc' ); ?></a></small>
1210
  </div>
1211
  </td>
1212
  </tr>
@@ -1215,17 +1199,17 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
1215
 
1216
  <th scope="row">
1217
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1218
- <?php esc_html_e( 'By Default Display Comments on', 'wpsc' ); ?>:
1219
  </div>
1220
  </th>
1221
  <td>
1222
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1223
  <input type='radio' value='1' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products1' <?php if ( get_option( 'wpsc_comments_which_products' ) == 1 || !get_option( 'wpsc_comments_which_products' ) ) {
1224
  echo "checked='checked'";
1225
- } ?> /><label for='wpsc_comments_which_products1'><?php esc_html_e( 'All Products', 'wpsc' ); ?></label>&nbsp;
1226
  <input type='radio' value='2' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products2' <?php if ( get_option( 'wpsc_comments_which_products' ) == 2 ) {
1227
  echo "checked='checked'";
1228
- } ?> /><label for='wpsc_comments_which_products2'><?php esc_html_e( 'Per Product', 'wpsc' ); ?></label>&nbsp;
1229
  <br />
1230
  </div>
1231
  </td>
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
  }
27
 
28
  $categorylist .= "<option value='list' " . $selected . " >" . __( 'Show list of product categories', 'wpsc' ) . "</option>";
29
 
30
+ $categorylist .= "<optgroup label='Product Categories'>";
31
  foreach ( $group_data as $group ) {
32
  $selected = "";
33
  if ( $current_default == $group->term_id )
82
  ?>
83
  <div id="poststuff" class="metabox-holder">
84
  <div id="themes_and_appearance" class='postbox'>
85
+ <h3 class="hndle"><span><?php _e( "Advanced Theme Settings", 'wpsc' ); ?></span></h3>
86
  <div class="inside">
87
  <?php
88
 
90
  ?>
91
 
92
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
93
+ <p><?php _e('You did not specify any template files to be moved.','wpsc'); ?></p>
94
  </div>
95
  <?php
96
  $_SESSION['wpsc_theme_empty'] = false;
100
  ?>
101
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
102
  <?php if(in_array(false, $_SESSION['wpsc_themes_copied_results'], true)): ?>
103
+ <p style="color:red;"><?php _e( "Error: some files could not be copied. Please make sure that theme folder is writable.", 'wpsc' ); ?></p>
104
  <?php else: ?>
105
+ <p><?php _e( "Thanks, the themes have been copied.", 'wpsc' ); ?></p>
106
  <?php endif; ?>
107
  </div>
108
  <?php
112
  if ( isset( $_SESSION['wpsc_themes_backup'] ) && ($_SESSION['wpsc_themes_backup'] == true) ) {
113
  ?>
114
  <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
115
+ <p><?php _e( "Thanks, you have made a succesful backup of your theme. It is located at the URL below. Please note each backup you create will replace your previous backups.", 'wpsc' ); ?></p>
116
+ <p>URL: <?php echo "/" . str_replace( ABSPATH, "", WPSC_THEME_BACKUP_DIR ); ?></p>
117
  </div>
118
  <?php
119
  $_SESSION['wpsc_themes_backup'] = false;
122
  <p>
123
  <?php if(false !== $themes_location)
124
  //Some themes have been moved to the themes folder
125
+ _e('Some Theme files have been moved to your WordPress Theme Folder.','wpsc');
126
  else
127
+ _e('No Theme files have been moved to your WordPress Theme Folder.','wpsc');
128
 
129
  ?>
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>
137
  <ul>
138
  <?php
142
  if(false !== array_search($file, (array)$themes_location))
143
  $selected = 'checked="checked"';
144
  ?>
145
+ <li><input type='checkbox' id='<?php echo $id; ?>' <?php echo $selected; ?> value='<?php esc_attr_e( $file ); ?>' name='wpsc_templates_to_port[]' />
146
+ <label for='<?php echo $id; ?>'><?php esc_attr_e( $file ); ?></label></li>
147
  <?php } ?>
148
  </ul>
149
  <p>
150
  <?php if(false !== $themes_location){
151
+ _e('To change the look of certain aspects of your shop, you can edit the moved files that are found here:','wpsc');
152
  ?>
153
  </p>
154
+ <p class="howto"> <?php echo get_stylesheet_directory(); ?></p>
155
  <?php } ?>
156
  <p><?php
157
  wp_nonce_field('wpsc_copy_themes');
158
  ?>
159
+ <input type='submit' value='Move Template Files &rarr;' class="button" name='wpsc_move_themes' />
160
  </p>
161
+ <p><?php _e('You can create a copy of your WordPress Theme by clicking the backup button bellow. Once copied you can find them here:' ,'wpsc'); ?></p>
162
+ <p class="howto"> /wp-content/uploads/wpsc/theme_backup/ </p>
163
  <p>
164
  <?php
165
  printf( __( '<a href="%s" class="button">Backup Your WordPress Theme</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_admin_action=backup_themes', 'backup_themes' ) ); ?>
167
  </p>
168
 
169
  <br style="clear:both" />
170
+ <p><?php _e('If you have moved your files in some other way i.e FTP, you may need to click the Flush Theme Cache. This will refresh the locations WordPress looks for your templates.' ,'wpsc'); ?></p>
171
  <p><?php printf( __( '<a href="%s" class="button">Flush Theme Cache</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_flush_theme_transients=true', 'wpsc_flush_theme_transients' ) ); ?></p>
172
  <br style="clear:both" />
173
  <br style="clear:both" />
180
  public function display() {
181
  ?>
182
  <div class='product_and_button_settings'>
183
+ <h3 class="form_group"><?php _e( 'Button Settings', 'wpsc' ); ?></h3>
184
+ <table class='wpsc_options form-table'>
 
 
 
185
  <tr>
186
+ <th scope="row"><?php _e( 'Button Type', 'wpsc' ); ?>:</th>
187
  <td>
188
  <?php
189
  $addtocart_or_buynow = get_option( 'addtocart_or_buynow' );
200
  }
201
  ?>
202
  <input type='radio' value='0' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow1' <?php echo $addtocart_or_buynow1; ?> />
203
+ <label for='addtocart_or_buynow1'><?php _e( 'Add To Cart', 'wpsc' ); ?></label> &nbsp;<br />
204
  <?php $selected_gateways = get_option( 'custom_gateway_options' );
205
  $disable_buy_now = '';
206
  $message = '';
207
  if (!in_array( 'wpsc_merchant_paypal_standard', (array)$selected_gateways )){
208
  $disable_buy_now = 'disabled="disabled"';
209
+ $message = __('Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.','wpsc');
210
  } ?>
211
  <input <?php echo $disable_buy_now; ?> type='radio' value='1' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow2' <?php echo $addtocart_or_buynow2; ?> />
212
  <label for='addtocart_or_buynow2'><?php _e( 'Buy Now', 'wpsc' ); ?></label><br />
215
  </tr>
216
 
217
  <tr>
218
+ <th scope="row"><?php _e( 'Hide "Add to cart" button', 'wpsc' ); ?>: </th>
219
  <td>
220
  <?php
221
  $hide_addtocart_button = get_option( 'hide_addtocart_button' );
237
  </tr>
238
  </table>
239
 
240
+ <h3 class="form_group"><?php _e( 'Product Settings', 'wpsc' ); ?></h3>
241
 
242
  <table class='wpsc_options form-table'>
243
 
244
  <tr>
245
+ <th scope="row"><?php _e( 'Show Product Ratings', 'wpsc' ); ?>:</th>
246
  <td>
247
  <?php
248
  $display_pnp = get_option( 'product_ratings' );
272
  $list_view_quantity_value2 = 'checked="checked"';
273
  ?>
274
  <th scope="row">
275
+ <?php _e('Show Stock Availability','wpsc'); ?>
276
  </th>
277
  <td>
278
  <input type='radio' value='1' name='wpsc_options[list_view_quantity]' id='list_view_quantity1' <?php echo $list_view_quantity_value1; ?> /> <label for='list_view_quantity1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
281
  </tr>
282
  <tr>
283
  <th scope="row">
284
+ <?php _e( 'Display Fancy Purchase Notifications', 'wpsc' ); ?>:
285
  </th>
286
  <td>
287
  <?php
305
 
306
 
307
  <tr>
308
+ <th scope="row"><?php _e( 'Display per item shipping', 'wpsc' ); ?>:</th>
309
  <td>
310
  <?php
311
  $display_pnp = get_option( 'display_pnp' );
327
  </tr>
328
 
329
  <tr>
330
+ <th scope="row"><?php _e( 'Disable link in Title', 'wpsc' ); ?>: </th>
331
  <td>
332
  <?php
333
  $hide_name_link = get_option( 'hide_name_link' );
351
  </tr>
352
 
353
  <tr>
354
+ <th scope="row"><?php _e( 'Add quantity field to each product description', 'wpsc' ); ?>:</th>
355
  <td>
356
  <?php
357
  $multi_adding = get_option( 'multi_add' );
376
  </table>
377
  </div>
378
 
379
+ <?php $this->theme_metabox(); ?>
380
+
381
+ <div style='clear:both;'></div>
382
 
383
+ <h3 class="form_group"><?php _e( 'Product Page Settings', 'wpsc' ); ?></h3>
384
  <table class='wpsc_options form-table'>
385
  <tr>
386
+ <th scope="row"><?php _e( 'Product Display', 'wpsc' ); ?>:</th>
387
  <td>
388
  <?php
389
  $display_pnp = get_option( 'product_view' );
435
  }
436
  ?>
437
  <select name='wpsc_options[product_view]'>
438
+ <option value='default' <?php echo $product_view1; ?>><?php _e( 'Default View', 'wpsc' ); ?></option>
439
  <?php
440
  if ( function_exists( 'product_display_list' ) ) {
441
  ?>
442
+ <option value='list' <?php echo $product_view2; ?>><?php _e( 'List View', 'wpsc' ); ?></option>
443
  <?php
444
  } else {
445
  ?>
446
+ <option value='list' disabled='disabled' <?php echo $product_view2; ?>><?php _e( 'List View', 'wpsc' ); ?></option>
447
  <?php
448
  }
449
 
450
  if ( function_exists( 'product_display_grid' ) ) {
451
  ?>
452
+ <option value='grid' <?php echo $product_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
453
  <?php
454
  } else {
455
  ?>
456
+ <option value='grid' disabled='disabled' <?php echo $product_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
457
  <?php
458
  }
459
  ?>
460
  </select>
461
  <?php
462
+ if ( !function_exists( 'product_display_grid' ) ) {
463
+ ?><a href='http://getshopped.org/extend/premium-upgrades'><?php _e( 'Purchase unavailable options', 'wpsc' ); ?></a> <?php
 
 
464
  }
465
  ?>
466
  </td>
467
  </tr>
468
 
469
+
470
  <tr id="wpsc-grid-settings">
471
+ <th scope="row"><?php _e( 'Grid view settings:', 'wpsc' ) ?></th>
472
  <td>
473
+ <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' ) ); ?>' />
474
+ <label for='grid_number_per_row'><?php _e( 'Products Per Row', 'wpsc' ); ?></label><br />
475
 
476
  <input type='hidden' value='0' name='wpsc_options[show_images_only]' />
477
  <input type='checkbox' value='1' name='wpsc_options[show_images_only]' id='wpsc-show-images-only' <?php echo $show_images_only_value; ?> />
478
+ <label for='wpsc-show-images-only'><?php _e( 'Show images only', 'wpsc' ); ?></label><br />
479
 
480
  <input type='hidden' value='0' name='wpsc_options[display_variations]' />
481
  <input type='checkbox' value='1' name='wpsc_options[display_variations]' id='wpsc-display-variations' <?php echo $display_variations; ?> />
482
+ <label for='wpsc-display-variations'><?php _e( 'Display Variations', 'wpsc' ); ?></label><br />
483
 
484
  <input type='hidden' value='0' name='wpsc_options[display_description]' />
485
  <input type='checkbox' value='1' name='wpsc_options[display_description]' id='wpsc-display-description' <?php echo $display_description; ?> />
486
+ <label for='wpsc-display-description'><?php _e( 'Display Description', 'wpsc' ); ?></label><br />
487
 
488
  <input type='hidden' value='0' name='wpsc_options[display_addtocart]' />
489
  <input type='checkbox' value='1' name='wpsc_options[display_addtocart]' id='wpsc-display-add-to-cart' <?php echo $display_addtocart; ?> />
490
+ <label for='wpsc-display-add-to-cart'><?php _e( 'Display "Add To Cart" Button', 'wpsc' ); ?></label><br />
491
 
492
  <input type='hidden' value='0' name='wpsc_options[display_moredetails]' />
493
  <input type='checkbox' value='1' name='wpsc_options[display_moredetails]' id='wpsc-display-more-details' <?php echo $display_moredetails; ?> />
494
+ <label for='wpsc-display-more-details'><?php _e( 'Display "More Details" Button', 'wpsc' ); ?></label>
495
  </td>
496
  </tr>
497
 
498
+
499
  <?php
500
  $selected1 = $selected2 = '';
501
  if(get_option('wpsc_display_categories'))
505
  ?>
506
 
507
  <tr>
508
+ <th scope="row"><?php _e('Show list of categories','wpsc'); ?></th>
509
  <td>
510
+ <input type='radio' value='1' name='wpsc_options[wpsc_display_categories]' id='display_categories2' <?php echo $selected1; ?> /> <label for='display_categories2'><?php _e( 'Yes', 'wpsc' ); ?></label>
 
511
  <input type='radio' value='0' name='wpsc_options[wpsc_display_categories]' id='display_categories1' <?php echo $selected2; ?> />
512
  <label for='display_categories1'><?php _e( 'No', 'wpsc' ); ?></label><br />
513
  </td>
514
  </tr>
515
 
516
  <tr>
517
+ <th scope="row"><?php _e( 'Select what product category you want to display on the products page', 'wpsc' ); ?>:</th>
518
  <td>
519
  <?php echo $this->category_list(); ?>
520
  </td>
547
  <td>
548
  <select name='wpsc_options[wpsc_sort_by]'>
549
  <option <?php if ( isset( $wpsc_sort_by1 ) )
550
+ echo $wpsc_sort_by1; ?> value='name'><?php _e( 'Name', 'wpsc' ); ?></option>
551
  <option <?php if ( isset( $wpsc_sort_by2 ) )
552
+ echo $wpsc_sort_by2; ?> value='price'><?php _e( 'Price', 'wpsc' ); ?></option>
553
  <option <?php if ( isset( $wpsc_sort_by4 ) )
554
+ echo $wpsc_sort_by4; ?> value='dragndrop'><?php _e( 'Drag &amp; Drop', 'wpsc' ); ?></option>
555
  <option <?php if ( isset( $wpsc_sort_by3 ) )
556
+ echo $wpsc_sort_by3; ?> value='id'><?php _e( 'Time Uploaded', 'wpsc' ); ?></option>
557
  </select>
 
 
 
 
 
558
  </td>
559
  </tr>
560
 
561
  <tr>
562
+ <th scope="row"><?php _e( 'Show Breadcrumbs', 'wpsc' ); ?>:</th>
563
  <td>
564
  <?php
565
  $show_breadcrumbs = get_option( 'show_breadcrumbs' );
584
 
585
  <tr>
586
  <th scope="row">
587
+ <?php _e( 'Product Groups/Products Display', 'wpsc' ); ?>:
588
  </th>
589
  <td>
590
  <?php
601
  break;
602
  }
603
  ?>
604
+ <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;
605
  <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>
606
  </td>
607
  </tr>
608
 
609
  <tr>
610
  <th scope="row">
611
+ <?php echo __( 'Show Subcategory Products in Parent Category', 'wpsc' ); ?>:
612
  </th>
613
  <td>
614
  <?php
633
  if ( function_exists( 'gold_shpcrt_search_form' ) ) {
634
  ?>
635
  <tr>
636
+ <th scope="row"><?php _e( 'Show Search', 'wpsc' ); ?>:</th>
637
  <td>
638
  <?php
639
  $display_pnp = get_option( 'show_search' );
676
  <div <?php echo $dis; ?> id='wpsc_advanced_search'>
677
  <input type='hidden' name='wpsc_options[show_advanced_search]' value='0' />
678
  <input type='checkbox' name='wpsc_options[show_advanced_search]' id='show_advanced_search' <?php echo $show_advanced_search; ?> value='1' />
679
+ <?php _e( 'Show Advanced Search', 'wpsc' ); ?><br />
680
  <input type='hidden' name='wpsc_options[show_live_search]' value='0' />
681
  <input type='checkbox' name='wpsc_options[show_live_search]' id='show_live_search' <?php echo $show_live_search; ?> value='1' />
682
+ <?php _e( 'Use Live Search', 'wpsc' ); ?><br />
683
  <input type='hidden' name='wpsc_options[embed_live_search_results]' value='0' />
684
  <input type='checkbox' name='wpsc_options[embed_live_search_results]' id='embed_live_search_results'<?php echo $embed_live_search_results; ?> value='1' />
685
+ <?php _e( 'Dynamically replace search results into product list', 'wpsc' ); ?>
686
  </div>
687
  </td>
688
  </tr>
692
 
693
 
694
  <tr>
695
+ <th scope="row"><?php _e( 'Replace Page Title With Product/Category Name', 'wpsc' ); ?>:</th>
696
  <td>
697
  <?php
698
  $wpsc_replace_page_title = get_option( 'wpsc_replace_page_title' );
713
  </td>
714
  </tr>
715
  <tr>
716
+ <th scope="row"><?php _e( 'Display Featured Product above Product Pages', 'wpsc' ); ?>:</th>
717
  <td>
718
  <?php
719
  $wpsc_hide_featured_products = get_option( 'wpsc_hide_featured_products' );
736
  </tr>
737
  </table>
738
 
739
+ <h3 class="form_group"><?php _e( 'Shopping Cart Settings', 'wpsc' ); ?></h3>
740
  <table class='wpsc_options form-table'>
741
  <tr>
742
+ <th scope="row"><?php _e( 'Cart Location', 'wpsc' ); ?>:</th>
743
  <td>
744
  <?php
745
  $cart_location = get_option( 'cart_location' );
765
  break;
766
  }
767
  ?>
768
+ <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='2' name='wpsc_options[cart_location]' id='cart2' <?php echo $cart2; ?> /> <label for='cart2'><?php _e( 'Page', 'wpsc' ); ?></label> &nbsp;
769
  <?php
770
  if ( function_exists( 'wp_register_sidebar_widget' ) ) {
771
  ?>
772
+ <input type='radio' value='4' onclick='hideelement1("dropshop_option", this.value)' name='wpsc_options[cart_location]' id='cart4' <?php echo $cart4; ?> /> <label for='cart4'><?php _e( 'Widget', 'wpsc' ); ?></label> &nbsp;
773
  <?php
774
  } else {
775
  ?>
776
+ <input type='radio' disabled='disabled' value='4' name='wpsc_options[cart_location]' id='cart4' alt='<?php _e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' title='<?php _e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' <?php echo $cart4; ?> /> <label style='color: #666666;' for='cart4' title='<?php _e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>'><?php _e( 'Widget', 'wpsc' ); ?></label> &nbsp;
777
  <?php
778
  }
779
 
780
  if ( function_exists( 'drag_and_drop_cart_ajax' ) ) {
781
  ?>
782
+ <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='5' name='wpsc_options[cart_location]' id='cart5' <?php echo $cart5; ?> /> <label for='cart5'><?php _e( 'DropShop', 'wpsc' ); ?></label> &nbsp;
783
  <?php
784
  } else {
785
  ?>
786
+ <input type='radio' disabled='disabled' value='5' name='wpsc_options[cart_location]' id='cart5' alt='<?php _e( 'You need to enable the widgets plugin to use this', 'wpsc' ); ?>' title='<?php _e( 'You need to install the Gold and DropShop extentions to use this', 'wpsc' ); ?>' <?php if ( isset( $cart5 ) )
787
+ echo $cart5; ?> /> <label style='color: #666666;' for='cart5' title='<?php _e( 'You need to install the Gold and DropShop extentions to use this', 'wpsc' ); ?>'><?php _e( 'DropShop', 'wpsc' ); ?></label> &nbsp;
788
  <?php
789
  }
790
  ?>
791
  <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='3' name='wpsc_options[cart_location]' id='cart3' <?php if ( isset( $cart3 ) )
792
+ echo $cart3; ?> /> <label for='cart3'><?php _e( 'Manual', 'wpsc' ); ?> <span style='font-size: 7pt;'>(PHP code: &lt;?php echo wpsc_shopping_cart(); ?&gt; )</span></label>
793
  <div style='display: <?php if ( !empty( $cart5 ) ) {
794
  echo "block";
795
  } else {
798
  <p>
799
  <input type="radio" id="drop1" value="all" <?php if ( get_option( 'dropshop_display' ) == 'all' ) {
800
  echo "checked='checked'";
801
+ } ?> name="wpsc_options[dropshop_display]" /><label for="drop1"><?php _e( 'Show Dropshop on every page', 'wpsc' ); ?></label>
802
  <input type="radio" id="drop2" value="product" <?php if ( get_option( 'dropshop_display' ) == 'product' ) {
803
  echo "checked='checked'";
804
+ } ?> name="wpsc_options[dropshop_display]"/><label for="drop2"><?php _e( 'Show Dropshop only on product page', 'wpsc' ); ?></label>
805
  </p>
806
  <p>
807
  <input type="radio" id="wpsc_dropshop_theme1" value="light" <?php if ( get_option( 'wpsc_dropshop_theme' ) != 'dark' ) {
808
  echo "checked='checked'";
809
+ } ?> name="wpsc_options[wpsc_dropshop_theme]" /><label for="wpsc_dropshop_theme1"><?php _e( 'Use light Dropshop style', 'wpsc' ); ?></label>
810
  <input type="radio" id="wpsc_dropshop_theme2" value="dark" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'dark' ) {
811
  echo "checked='checked'";
812
+ } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php _e( 'Use dark Dropshop style', 'wpsc' ); ?></label>
813
  <input type="radio" id="wpsc_dropshop_theme3" value="craftyc" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'craftyc' ) {
814
  echo "checked='checked'";
815
+ } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php _e( 'Crafty', 'wpsc' ); ?></label>
816
 
817
  </p>
818
  </div>
821
 
822
  <tr>
823
  <th scope="row">
824
+ <?php _e( 'Display "+ Postage & Tax"', 'wpsc' ); ?>:
825
  </th>
826
  <td>
827
  <?php
844
  </tr>
845
  </table>
846
 
847
+ <h3 class="form_group"><?php _e( 'Product Category Settings', 'wpsc' ); ?></h3>
848
  <table class='wpsc_options form-table'>
849
 
850
  <tr>
851
+ <th scope="row"><?php _e( 'Show Product Category Description', 'wpsc' ); ?>:</th>
852
  <td>
853
  <?php
854
  $wpsc_category_description = get_option( 'wpsc_category_description' );
872
 
873
  <tr>
874
  <th scope="row">
875
+ <?php _e( 'Show Product Category Thumbnails', 'wpsc' ); ?>:
876
  </th>
877
  <td>
878
  <?php
898
 
899
  <tr>
900
  <th scope="row">
901
+ <?php _e( 'Show Product Count per Product Category', 'wpsc' ); ?>:
902
  </th>
903
  <td>
904
  <?php
923
  <!-- // Adrian - options for displaying category display type -->
924
 
925
  <tr>
926
+ <th scope="row"><?php _e( "Use Category Grid View", 'wpsc' ); ?>:</th>
927
  <td>
928
  <?php
929
  $wpsc_category_grid_view = get_option( 'wpsc_category_grid_view' );
947
  </table>
948
 
949
 
950
+ <h3 class="form_group"><a name='thumb_settings'><?php _e( 'Thumbnail Settings', 'wpsc' ); ?></a></h3>
951
+ <p><em><?php _e('Note: Anytime you update any of the thumbnail settings, WPeC will automatically resize all of your thumbnails for you. Depending on how many images you have, this could take awhile.','wpsc'); ?></em></p>
952
  <table class='wpsc_options form-table'>
953
  <?php if ( function_exists( "getimagesize" ) ) { ?>
954
  <tr>
955
+ <th scope="row"><?php _e( 'Default Product Thumbnail Size', 'wpsc' ); ?>:</th>
956
  <td>
957
+ <?php _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' ) ); ?>' />
958
+ <?php _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' ) ); ?>' />
959
+
 
 
 
960
  </td>
961
  </tr>
962
  <tr>
963
  <th scope="row">
964
+ <?php _e( 'Default Product Group Thumbnail Size', 'wpsc' ); ?>:
965
  </th>
966
  <td>
967
+ <?php _e( 'Width', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[category_image_width]' value='<?php esc_attr_e( get_option( 'category_image_width' ) ); ?>' />
968
+ <?php _e( 'Height', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[category_image_height]' value='<?php esc_attr_e( get_option( 'category_image_height' ) ); ?>' />
 
 
 
 
969
  </td>
970
  </tr>
971
  <tr>
972
  <th scope="row">
973
+ <?php _e( 'Single Product Image Size', 'wpsc' ); ?>:
974
  </th>
975
  <td>
976
+ <?php _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' ) ); ?>' />
977
+ <?php _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' ) ); ?>' />
 
 
 
 
978
  </td>
979
  </tr>
980
  <tr>
981
+ <th scope="row">
982
+ <?php
983
  $cropthumbs = get_option( 'wpsc_crop_thumbnails' );
984
  $crop1 = "";
985
  $crop2 = "";
993
  break;
994
  }
995
  ?>
996
+ <?php _e( "Crop Thumbnails", 'wpsc' ); ?>:
997
  </th>
998
  <td>
999
+ <input type='radio' value='1' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails1' <?php echo $crop1; ?> /> <label for='crop1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1000
  <input type='radio' value='0' name='wpsc_options[wpsc_crop_thumbnails]' id='wpsc_crop_thumbnails2' <?php echo $crop2; ?> /> <label for='crop2'><?php _e( 'No', 'wpsc' ); ?></label><br />
1001
+ <?php _e( 'Choosing "Yes" means that thumbnails are cropped to exact dimensions (normally thumbnails are proportional)', 'wpsc' ); ?>
1002
  </td>
1003
  </tr>
1004
  <?php
1006
  ?>
1007
 
1008
  <tr>
1009
+ <th scope="row"><?php _e( 'Show Thumbnails', 'wpsc' ); ?>:</th>
1010
  <td>
1011
  <?php
1012
  $show_thumbnails = get_option( 'show_thumbnails' );
1027
  </td>
1028
  </tr>
1029
  <tr>
1030
+ <th scope="row"><?php _e( 'Use Lightbox Effect for product images', 'wpsc' ); ?>:</th>
1031
  <td>
1032
  <?php
1033
  $show_thumbnails_thickbox = get_option( 'show_thumbnails_thickbox' );
1045
  ?>
1046
  <input type='radio' value='1' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox1' <?php echo $show_thumbnails_thickbox1; ?> /> <label for='show_thumbnails_thickbox1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1047
  <input type='radio' value='0' name='wpsc_options[show_thumbnails_thickbox]' id='show_thumbnails_thickbox2' <?php echo $show_thumbnails_thickbox2; ?> /> <label for='show_thumbnails_thickbox2'><?php _e( 'No', 'wpsc' ); ?></label><br />
1048
+ <?php _e( 'Using lightbox means that when clicking on a product image, a larger version will be displayed in a "lightbox" style window. If you are using a plugin such as Shutter Reloaded, you may want to disable lightbox.', 'wpsc' ); ?>
1049
  </td>
1050
  </tr>
1051
  <tr>
1052
+ <th scope="row"><?php _e( 'Lightbox script to use', 'wpsc' ); ?>:</th>
1053
  <td>
1054
  <?php
1055
  $wpsc_lightbox = get_option( 'wpsc_lightbox', 'thickbox' );
1070
  ?>
1071
  <tr>
1072
  <th scope="row">
1073
+ <?php _e( 'Show Thumbnail Gallery', 'wpsc' ); ?>:
1074
  </th>
1075
  <td>
1076
  <?php
1094
 
1095
  <tr>
1096
  <th scope="row">
1097
+ <?php _e( "Gallery Thumbnail Image Size", 'wpsc' ); ?>:
1098
  </th>
1099
  <td>
1100
+ <?php _e( 'Width', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_width]' value='<?php esc_attr_e( get_option( 'wpsc_gallery_image_width' ) ); ?>' />
1101
+ <?php _e( 'Height', 'wpsc' ); ?>:<input type='text' size='6' name='wpsc_options[wpsc_gallery_image_height]' value='<?php esc_attr_e( get_option( 'wpsc_gallery_image_height' ) ); ?>' /><br />
1102
 
1103
  </td>
1104
  </tr>
1109
  </table>
1110
 
1111
 
1112
+ <h3 class="form_group"><?php _e( 'Pagination settings', 'wpsc' ); ?></h3>
1113
  <table class='wpsc_options form-table'>
1114
  <tr>
1115
  <th scope="row">
1116
+ <?php _e( 'Use Pagination', 'wpsc' ); ?>:
1117
  </th>
1118
  <td>
1119
  <?php
1142
 
1143
  <tr>
1144
  <th scope="row">
1145
+ <?php _e( 'Page Number position', 'wpsc' ); ?>:
1146
  </th>
1147
  <td>
1148
  <input type='radio' value='1' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position1' <?php if ( get_option( 'wpsc_page_number_position' ) == 1 ) {
1149
  echo "checked='checked'";
1150
+ } ?> />&nbsp;<label for='wpsc_page_number_position1'><?php _e( 'Top', 'wpsc' ); ?></label> &nbsp;
1151
  <input type='radio' value='2' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position2' <?php if ( get_option( 'wpsc_page_number_position' ) == 2 ) {
1152
  echo "checked='checked'";
1153
+ } ?> />&nbsp;<label for='wpsc_page_number_position2'><?php _e( 'Bottom', 'wpsc' ); ?></label>&nbsp;
1154
  <input type='radio' value='3' name='wpsc_options[wpsc_page_number_position]' id='wpsc_page_number_position3' <?php if ( get_option( 'wpsc_page_number_position' ) == 3 ) {
1155
  echo "checked='checked'";
1156
+ } ?> />&nbsp;<label for='wpsc_page_number_position3'><?php _e( 'Both', 'wpsc' ); ?></label>
1157
  <br />
1158
  </td>
1159
  </tr>
1160
  </table>
1161
 
1162
 
1163
+ <h3 class="form_group"><?php _e( 'Comment Settings', 'wpsc' ); ?></h3>
1164
  <table class='wpsc_options form-table'>
1165
  <tr>
1166
  <th scope="row">
1167
+ <?php _e( 'Use IntenseDebate Comments', 'wpsc' ); ?>:
1168
+ <a href="http://intensedebate.com/" title="IntenseDebate comments enhance and encourage conversation on your blog or website" target="_blank"><img src="<?php echo WPSC_CORE_IMAGES_URL; ?>/intensedebate-logo.png" alt="intensedebate-logo" title="IntenseDebate"/></a>
1169
  </th>
1170
  <td>
1171
  <?php
1188
  <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").show()' type='radio' value='1' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments1' <?php echo $enable_comments1; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
1189
  <input onclick='jQuery("#wpsc_enable_comments,.wpsc_comments_details").hide()' type='radio' value='0' name='wpsc_options[wpsc_enable_comments]' id='wpsc_enable_comments2' <?php echo $enable_comments2; ?> /> <label for='wpsc_enable_comments1'><?php _e( 'No', 'wpsc' ); ?></label><br />
1190
  <div id='wpsc_enable_comments' <?php echo $intense_debate_account_id_display_state; ?> >
1191
+ <?php _e( 'IntenseDebate Account ID', 'wpsc' ); ?>:<br/>
1192
  <input type='text' size='30' name='wpsc_options[wpsc_intense_debate_account_id]' value='<?php esc_attr_e( get_option( 'wpsc_intense_debate_account_id' ) ); ?>' /><br/>
1193
+ <small><a href='http://intensedebate.com/sitekey/' title='Help finding the Account ID'><?php _e( 'Help on finding the Account ID', 'wpsc' ); ?></a></small>
1194
  </div>
1195
  </td>
1196
  </tr>
1199
 
1200
  <th scope="row">
1201
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1202
+ <?php _e( 'By Default Display Comments on', 'wpsc' ); ?>:
1203
  </div>
1204
  </th>
1205
  <td>
1206
  <div class='wpsc_comments_details' <?php echo $intense_debate_account_id_display_state ?> >
1207
  <input type='radio' value='1' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products1' <?php if ( get_option( 'wpsc_comments_which_products' ) == 1 || !get_option( 'wpsc_comments_which_products' ) ) {
1208
  echo "checked='checked'";
1209
+ } ?> /><label for='wpsc_comments_which_products1'><?php _e( 'All Products', 'wpsc' ); ?></label>&nbsp;
1210
  <input type='radio' value='2' name='wpsc_options[wpsc_comments_which_products]' id='wpsc_comments_which_products2' <?php if ( get_option( 'wpsc_comments_which_products' ) == 2 ) {
1211
  echo "checked='checked'";
1212
+ } ?> /><label for='wpsc_comments_which_products2'><?php _e( 'Per Product', 'wpsc' ); ?></label>&nbsp;
1213
  <br />
1214
  </div>
1215
  </td>
wpsc-admin/includes/settings-tabs/shipping.php CHANGED
@@ -1,101 +1,44 @@
1
  <?php
2
- class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
 
3
  public function __construct() {
4
  parent::__construct();
5
 
6
  if ( isset( $_REQUEST['shipping_module_id'] ) )
7
  update_user_option( get_current_user_id(), 'wpsc_settings_selected_shipping_module', $_REQUEST['shipping_module_id'] );
8
-
9
- add_action( 'admin_notices', array( $this, 'no_shipping_notice' ) );
10
- }
11
-
12
- /**
13
- * Hooks shipping notice into admin_notice if shipping is enabled but no shipping methods are selected
14
- *
15
- * @since 3.8.9
16
- * @return null
17
- */
18
- public function no_shipping_notice() {
19
- if ( ! empty( $_GET['shipping_disabled'] ) ) {
20
- ?>
21
-
22
- <div class="error fade">
23
- <p><?php _e( '<strong>Shipping has been disabled.</strong> You enabled shipping but none of the shipping methods were selected. Please re-enable shipping, select and configure a shipping method, and then update your settings.', 'wpsc' ); ?></p>
24
- </div>
25
-
26
- <?php
27
- }
28
- }
29
-
30
- public function callback_submit_options() {
31
- global $wpsc_shipping_modules;
32
-
33
- foreach ( $wpsc_shipping_modules as $shipping ) {
34
- if ( is_object( $shipping ) )
35
- $shipping->submit_form();
36
- }
37
-
38
- //This is for submitting shipping details to the shipping module
39
- if ( ! isset( $_POST['update_gateways'] ) )
40
- $_POST['update_gateways'] = '';
41
-
42
- if ( ! isset( $_POST['custom_shipping_options'] ) )
43
- $_POST['custom_shipping_options'] = null;
44
-
45
- update_option( 'custom_shipping_options', $_POST['custom_shipping_options'] );
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,243 +47,232 @@ 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() {
114
  global $wpdb, $wpsc_shipping_modules, $external_shipping_modules, $internal_shipping_modules;
115
-
116
  // sort into external and internal arrays.
117
  foreach ( $GLOBALS['wpsc_shipping_modules'] as $key => $module ) {
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab
3
+ {
4
  public function __construct() {
5
  parent::__construct();
6
 
7
  if ( isset( $_REQUEST['shipping_module_id'] ) )
8
  update_user_option( get_current_user_id(), 'wpsc_settings_selected_shipping_module', $_REQUEST['shipping_module_id'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
10
 
11
+ public function display_shipping_module_settings_form() {
12
  global $wpsc_shipping_modules;
13
+ $classes = array( 'wpsc-module-settings' );
14
+ $selected_module_id = (string) get_user_option( 'wpsc_settings_selected_shipping_module', get_current_user_id() );
 
 
15
  $found_selected_module = array_key_exists( $selected_module_id, $wpsc_shipping_modules );
 
16
  if ( $found_selected_module ) {
17
  $selected_module = $wpsc_shipping_modules[$selected_module_id];
18
+ $title = $selected_module->name;
19
+ $content = $selected_module->getForm();
20
+ $classes[] = 'wpsc-shipping-module-settings-' . $selected_module_id;
21
  } else {
22
  $title = __( 'Edit Shipping Module Settings', 'wpsc' );
23
  $content = __( 'To configure a shipping module select one on the left.', 'wpsc' );
24
  }
25
+ $classes = implode( ' ', $classes );
26
  ?>
27
+ <td id="wpsc-shipping-module-settings" class="<?php echo esc_attr( $classes ); ?>" rowspan='2'>
28
+ <div class='postbox'>
29
+ <h3 class='hndle'><?php echo esc_html( $title ); ?></h3>
30
+ <div class='inside'>
31
+ <table class='form-table'>
32
+ <?php echo $content; ?>
33
+ </table>
34
+ <?php if ( $found_selected_module ): ?>
35
+ <p class="submit">
36
+ <input type="submit" value="<?php _e( 'Update &raquo;', 'wpsc' ); ?>" />
37
+ </p>
38
+ <?php endif; ?>
39
+ </div>
40
+ </div>
41
+ </td>
42
  <?php
43
  }
44
 
47
  $location = add_query_arg( array(
48
  'tab' => 'shipping',
49
  'page' => 'wpsc-settings',
50
+ 'shipping_module_id' => $shipping->internal_name,
51
  ), $location );
52
  $location .= '#wpsc-shipping-module-options';
53
+ return esc_url( $location );
54
  }
55
 
56
  public function display() {
57
  global $wpdb, $wpsc_shipping_modules, $external_shipping_modules, $internal_shipping_modules;
 
58
  // sort into external and internal arrays.
59
  foreach ( $GLOBALS['wpsc_shipping_modules'] as $key => $module ) {
60
+ if(empty($module))continue;
61
+ if ( isset( $module->is_external ) && ($module->is_external == true) ) {
 
 
62
  $external_shipping_modules[$key] = $module;
63
  } else {
64
  $internal_shipping_modules[$key] = $module;
65
  }
66
  }
67
+ $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 );
68
+ if ( $currency_data['symbol'] != '' ) {
69
+ $currency_sign = $currency_data['symbol_html'];
70
+ } else {
71
+ $currency_sign = $currency_data['code'];
72
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  //get shipping options that are selected
74
  $selected_shippings = get_option( 'custom_shipping_options' );
75
+ ?>
76
+ <div class="metabox-holder">
77
+ <input type='hidden' name='shipping_submits' value='true' />
78
+ <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
79
+ <input type='hidden' name='wpsc_admin_action' value='submit_options' />
80
 
81
+ <?php
 
 
 
82
 
83
+ if ( get_option( 'custom_gateway' ) == 1 ) {
84
+ $custom_gateway_hide = "style='display:block;'";
85
+ $custom_gateway1 = 'checked="checked"';
86
+ } else {
87
+ $custom_gateway_hide = "style='display:none;'";
88
+ $custom_gateway2 = 'checked="checked"';
89
+ }
90
+ /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
91
+ wpsc_settings_page_update_notification(); ?>
92
+ <div class='postbox'>
93
+ <h3 class='hndle'><?php _e( 'General Settings', 'wpsc' ); ?></h3>
94
+ <div class='inside'>
95
+
96
+ <table class='wpsc_options form-table'>
97
+ <tr>
98
+ <th scope="row">
99
+ <?php _e( 'Use Shipping', 'wpsc' ); ?>:
100
+ </th>
101
+ <td>
102
+ <?php
103
+ $do_not_use_shipping = get_option( 'do_not_use_shipping' );
104
+ $do_not_use_shipping1 = "";
105
+ $do_not_use_shipping2 = "";
106
+ if( $do_not_use_shipping )
107
+ $do_not_use_shipping1 = "checked ='checked'";
108
+ else
109
+ $do_not_use_shipping2 = "checked ='checked'";
110
+ ?>
111
+ <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;
112
+ <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 />
113
+ <?php _e( 'If you are only selling digital downloads, you should select no to disable the shipping on your site.', 'wpsc' ); ?>
114
+ </td>
115
+ </tr>
116
+
117
+ <tr>
118
+ <th><?php _e( 'Base City:', 'wpsc' ); ?></th>
119
+ <td>
120
+ <input type='text' name='wpsc_options[base_city]' value='<?php esc_attr_e( get_option( 'base_city' ) ); ?>' />
121
+ <br /><?php _e( 'Please provide for more accurate rates', 'wpsc' ); ?>
122
+ </td>
123
+ </tr>
124
+ <tr>
125
+ <th><?php _e( 'Base Zipcode/Postcode:', 'wpsc' ); ?></th>
126
+ <td>
127
+ <input type='text' name='wpsc_options[base_zipcode]' value='<?php esc_attr_e( get_option( 'base_zipcode' ) ); ?>' />
128
+ <br /><?php _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' ); ?>
129
+ </td>
130
+ </tr>
131
+ <?php
132
+ $shipwire1 = "";
133
+ $shipwire2 = "";
134
+ switch ( get_option( 'shipwire' ) ) {
135
+ case 1:
136
+ $shipwire_settings = 'style=\'display: block;\'';
137
+ break;
138
+
139
+ case 0:
140
+ default:
141
+ $shipwire_settings = '';
142
+ break;
143
+ }
144
+ ?>
145
+
146
+ <tr>
147
+ <th scope="row">
148
+ <?php _e( 'ShipWire Settings', 'wpsc' ); ?><span style='color: red;'></span> :
149
+ </th>
150
+ <td>
151
+ <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;
152
+ <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>
153
+ <div id='wpsc_shipwire_setting' <?php echo $shipwire_settings; ?>>
154
+ <table>
155
+ <tr><td><?php _e( 'ShipWire Email', 'wpsc' ); ?> :</td><td> <input type="text" name='wpsc_options[shipwireemail]' value="<?php esc_attr_e( get_option( 'shipwireemail' ) ); ?>" /></td></tr>
156
+ <tr><td><?php _e( 'ShipWire Password', 'wpsc' ); ?> :</td><td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php esc_attr_e( get_option( 'shipwirepassword' ) ); ?>" /></td></tr>
157
+ <tr><td><a class="shipwire_sync">Sync product</a></td></tr>
158
+ </table>
159
+ </div>
160
+ </td>
161
+ </tr>
162
+ <tr>
163
+ <th scope="row">
164
+ <?php _e( 'Enable Free Shipping Discount', 'wpsc' ); ?>
165
+ </th>
166
+ <td>
167
+ <?php
168
+ if ( get_option( 'shipping_discount' ) == 1 ) {
169
+ $selected2 = '';
170
+ $selected1 = 'checked="checked"';
171
+ $shipping_discount_settings = 'style=\'display: block;\'';
172
+ } else {
173
+ $selected2 = 'checked="checked"';
174
+ $selected1 = '';
175
+ $shipping_discount_settings = '';
176
+ }
177
+ ?>
178
+ <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;
179
+ <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>
180
+
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <td>&nbsp;</td>
185
+ <td colspan="2">
186
+ <?php
187
+ $value = esc_attr ( get_option( 'shipping_discount_value' ) );
188
+ ?>
189
+ <div <?php echo $shipping_discount_settings; ?> id='shipping_discount_value'>
190
+
191
+ <?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 ); ?>
192
+ </div>
193
+
194
+
195
+ </td>
196
+
197
+ </tr>
198
+ </table>
199
+ </div>
200
+ </div>
201
+ <table id='wpsc-shipping-module-options' class='wpsc-edit-module-options'>
202
+ <tr>
203
+ <td class='select_gateway'>
204
+ <a name="gateway_options"></a>
205
+ <div class='postbox'>
206
+ <h3 class='hndle'><?php _e( 'Shipping Modules', 'wpsc' ) ?></h3>
207
+ <div class='inside'>
208
+
209
+ <p>
210
+ <?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' ); ?>
211
+ </p>
212
+ <br />
213
+ <p>
214
+ <strong><?php _e( 'Internal Shipping Calculators', 'wpsc' ); ?></strong>
215
+ </p>
216
+ <?php
217
+ foreach ( $internal_shipping_modules as $shipping ) {
218
+
219
+ $shipping->checked = '';
220
+ if ( is_object( $shipping ) && in_array( $shipping->getInternalName(), (array)$selected_shippings ) )
221
+ $shipping->checked = ' checked = "checked" ';
222
+ ?>
223
+
224
+ <div class='wpsc_shipping_options'>
225
+ <div class='wpsc-shipping-actions'>
226
+ <span class="edit"