WP eCommerce - Version 3.8.7.7

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

Code changes from version 3.9.2 to 3.8.7.7

Files changed (79) hide show
  1. .phptidy-config.php +24 -0
  2. images/google_checkout.gif +0 -0
  3. readme.txt +288 -657
  4. screenshot-1.png +0 -0
  5. screenshot-2.png +0 -0
  6. screenshot-3.png +0 -0
  7. screenshot-4.png +0 -0
  8. woo-integration/css/main_frame_style.css +12 -0
  9. woo-integration/css/style.css +155 -0
  10. woo-integration/js/script.js +50 -0
  11. woo-integration/options_presentation.php +16 -0
  12. woo-integration/woo_integration.php +62 -0
  13. wp-shopping-cart.php +35 -165
  14. wpsc-admin/admin-form-functions.php +268 -69
  15. wpsc-admin/admin.php +267 -1000
  16. wpsc-admin/ajax-and-init.php +1677 -126
  17. wpsc-admin/ajax.php +0 -926
  18. wpsc-admin/css/admin.css +928 -1648
  19. wpsc-admin/css/arrows.png +0 -0
  20. wpsc-admin/css/jquery.ui.datepicker-classic.css +0 -579
  21. wpsc-admin/css/jquery.ui.datepicker-fresh.css +0 -579
  22. wpsc-admin/css/loading-small.gif +0 -0
  23. wpsc-admin/css/media.css +0 -26
  24. wpsc-admin/css/settingspage.css +38 -307
  25. wpsc-admin/css/ui-images/ui-icons_21759b_256x240.png +0 -0
  26. wpsc-admin/css/ui-images/ui-icons_333333_256x240.png +0 -0
  27. wpsc-admin/css/ui-images/ui-icons_999999_256x240.png +0 -0
  28. wpsc-admin/css/ui-images/ui-icons_cc0000_256x240.png +0 -0
  29. wpsc-admin/css/xit.gif +0 -0
  30. wpsc-admin/db-upgrades/routines/1.php +0 -142
  31. wpsc-admin/db-upgrades/routines/10.php +0 -134
  32. wpsc-admin/db-upgrades/routines/11.php +0 -83
  33. wpsc-admin/db-upgrades/routines/12.php +0 -55
  34. wpsc-admin/db-upgrades/routines/13.php +0 -54
  35. wpsc-admin/db-upgrades/routines/14.php +0 -28
  36. wpsc-admin/db-upgrades/routines/2.php +0 -430
  37. wpsc-admin/db-upgrades/routines/3.php +0 -18
  38. wpsc-admin/db-upgrades/routines/4.php +0 -43
  39. wpsc-admin/db-upgrades/routines/5.php +0 -49
  40. wpsc-admin/db-upgrades/routines/6.php +0 -12
  41. wpsc-admin/db-upgrades/routines/7.php +0 -36
  42. wpsc-admin/db-upgrades/routines/8.php +0 -12
  43. wpsc-admin/db-upgrades/routines/9.php +0 -13
  44. wpsc-admin/db-upgrades/upgrade.php +0 -155
  45. wpsc-admin/db-upgrades/views/main.php +0 -11
  46. wpsc-admin/display-coupon-add.php +0 -133
  47. wpsc-admin/display-coupon-edit.php +0 -182
  48. wpsc-admin/display-coupons.php +371 -121
  49. wpsc-admin/display-debug.page.php +7 -12
  50. wpsc-admin/display-items.page.php +267 -428
  51. wpsc-admin/display-options-settings.page.php +247 -10
  52. wpsc-admin/display-sales-logs.php +569 -414
  53. wpsc-admin/display-update.page.php +20 -16
  54. wpsc-admin/display-upgrades.page.php +137 -43
  55. wpsc-admin/includes/coupon-list-table-class.php +0 -478
  56. wpsc-admin/includes/display-items-functions.php +793 -1229
  57. wpsc-admin/includes/product-functions.php +399 -485
  58. wpsc-admin/includes/product-variation-list-table.class.php +0 -675
  59. wpsc-admin/includes/product-variations-manage.page.php +0 -13
  60. wpsc-admin/includes/product-variations-page.class.php +0 -423
  61. wpsc-admin/includes/product-variations-setup.page.php +0 -40
  62. wpsc-admin/includes/product-variations.page.php +0 -59
  63. wpsc-admin/includes/products.php +390 -0
  64. wpsc-admin/includes/purchase-log-action-links.php +0 -482
  65. wpsc-admin/includes/purchase-log-list-table-class.php +0 -573
  66. wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php +0 -9
  67. wpsc-admin/includes/purchase-logs-page/item-details.php +0 -165
  68. wpsc-admin/includes/purchase-logs-page/list-table.php +0 -83
  69. wpsc-admin/includes/purchase-logs-page/packing-slip.php +0 -162
  70. wpsc-admin/includes/purchase-logs-page/upgrade.php +0 -45
  71. wpsc-admin/includes/purchlogs_upgrade.php +103 -0
  72. wpsc-admin/includes/save-data.functions.php +484 -425
  73. wpsc-admin/includes/settings-pages/admin.php +176 -0
  74. wpsc-admin/includes/settings-pages/checkout.php +231 -0
  75. wpsc-admin/includes/settings-pages/gateway.php +151 -0
  76. wpsc-admin/includes/settings-pages/general.php +193 -0
  77. wpsc-admin/includes/settings-pages/import.php +170 -0
  78. wpsc-admin/includes/settings-pages/marketing.php +108 -0
  79. wpsc-components/theme-engine-v1/classes/settings-tab-presentation.php → wpsc-admin/includes/settings-pages/presentation.php +286 -257
.phptidy-config.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // This is a config file for PHPtidy
3
+ // http://developer.berlios.de/projects/phptidy/
4
+
5
+ $project_files = array('*.php',
6
+ 'merchants/*.php',
7
+ 'shipping/*.php',
8
+ 'merchants/*.php',
9
+ 'updates/*.php',
10
+ 'widgets/*.php',
11
+ 'wpsc-includes/*.php',
12
+ 'wpsc-admin/*.php',
13
+ 'wpsc-admin/includes/*.php',
14
+ 'wpsc-admin/includes/settings-pages/*.php');
15
+
16
+ $default_package = "WP e-Commerce";
17
+ $add_file_docblock = TRUE;
18
+ $add_functions_docblock = TRUE;
19
+ $add_doctags = TRUE;
20
+ $fix_docblock_format = TRUE;
21
+ $fix_docblock_space = TRUE;
22
+ $add_blank_lines = FALSE;
23
+
24
+ ?>
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,614 +154,15 @@ 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.
566
- * Fix: PHP preg_replace warning.
567
-
568
- = 3.8.8.4 =
569
- * Fix: Also bought product image doesn't display correctly.
570
- * Fix: Pagination fails when hierarchical category URL is enabled.
571
- * Fix: Product Specials Widget causes 404 errors. Props Chris Jean.
572
- * Fix: Product category slug beginning with a digit doesn't work.
573
- * Updated localization.
574
-
575
- = 3.8.8.3 =
576
- * Fix: Incompatibility between WPEC products page pagination and WordPress 3.4.
577
-
578
- = 3.8.8.2 =
579
- * Change: CSV sales export now puts the item quanity in a separate column from the product title.
580
- * Fix: Core checkout fields cannot be restored if they were deleted before upgrading to 3.8.8.
581
- * Fix: Insecure SSL resources when WordPress is using SSL, or "Force SSL Checkout" is enabled.
582
- * Fix: Issue with WPML and Variations.
583
- * Fix: Shipping & Total Order values are wrong on Sales Log page.
584
- * Fix: Terms and Conditions - Checkout page breaks if you read the terms and conditions.
585
- * Fix: Total shipping value and total price incorrect in transaction results.
586
- * Fix: Variation sales prices are inaccurate in Product Specials Widget
587
-
588
- = 3.8.8.1 =
589
- * Fix: CSV import not working in 3.8.8.
590
- * Fix: Category page display setting does not override default Presentation settings.
591
- * Fix: Clicking All/None in Category target market settings doesn't work.
592
- * Fix: Non-SSL stylesheet is loaded even when force SSL for checkout page is on.
593
- * Fix: PHP Warning and Notice in sales log page.
594
- * Fix: PayPal currency converter is wrong.
595
- * Fix: Sales logs are not displayed for some installations.
596
- * Fix: Sales logs page sometimes display empty customers' names.
597
- * Fix: Saving payment gateway settings erase Shipping settings.
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.
604
- * New: Extra hooks during checkout cart display: wpsc_before_checkout_cart_row, wpsc_before_checkout_cart_item_image, wpsc_after_checkout_cart_item_image, wpsc_before_checkout_cart_item_name, wpsc_after_checkout_cart_item_name, wpsc_after_checkout_cart_row
605
- * New: Filter for ordering the sales logs: wpsc_purchase_logs_orderby.
606
- * New: Filter wpsc_cart_shipping.
607
- * New: Filter wpsc_default_shipping_quote.
608
- * New: Filter wpsc_item_shipping_amount_db.
609
- * New: Filter wpsc_paypal_standard_post_data.
610
- * New: Filter wpsc_product_permalink_cat_slug.
611
- * New: Filter wpsc_product_postage_and_packaging.
612
- * New: Filter wpsc_shipping_quote_value.
613
- * New: Filters wpsc_calculate_total_tax, wpsc_coupons_amount.
614
- * New: 4 new filters for user meta in profile page and during checkout.class.php - wpsc_checkout_user_profile_get - wpsc_checkout_user_profile_update - wpsc_user_log_get - wpsc_user_log_update.
615
- * New: Settings Page API.
616
- * New: Some helpful filters to download_csv function: wpsc_purchase_log_start_end_csv, wpsc_purchase_log_month_year_csv, wpsc_purchase_log_month_year_csv, wpsc_purchase_log_csv_headers, wpsc_purchas_log_csv_output
617
- * New: Variation Drag & Drop sorting.
618
- * Change: Display file names instead of the product name on the downloads page.
619
- * Change: Improved variation UI in Product Edit page.
620
- * Change: In General Settings page, when changing country, load region / state list using AJAX instead of page reload.
621
- * Change: Only display variants' associated terms in Product Edit page rather than including the parent product name, which is redundant and cluttered.
622
- * Change: PayPal Standard settings now just offer dropdown of "live" / "sandbox" rather than URL entry.
623
- * Change: Subtle UX tweaks for Store Settings page.
624
- * Fix: %-based shipping cost is not working internationally.
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.
643
- * Fix: settings page JS compatibility issue with Firefox.
644
- * Fix: wpsc_get_template_file_url() function is inefficient and causes 10 extra SQL queries per page load.
645
 
646
  = 3.8.7.6.1 =
647
  * Fix: PHP Warning for 'wpsc_load_settings_page' callback.
@@ -774,44 +295,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, jghazally, valentinas, mychelle, garyc40
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.0
6
+ Tested up to: 3.3.1
7
+ Stable tag: 3.8.7.7
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.5 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.7.7 =
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.7.6.2 =
165
+ * Fix: Session ID is overridden.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
  = 3.8.7.6.1 =
168
  * Fix: PHP Warning for 'wpsc_load_settings_page' callback.
295
  * Fix: Checking (or unchecking) Stock checkbox when editing product causes variation table columns to break.
296
  * Fix: jQuery 1.6 incompatibility with attr( 'className' ).
297
 
 
 
 
 
 
 
 
298
 
299
+ = 3.8.5 =
300
+ * New: Added hooks to support WPML.
301
+ * New: Links to WP e-Commerce documentation for individual payment gateways.
302
+ * Change: User can specify 0 in thumbnail width or height to make it scale proportional.
303
+ * Change: Show display name, not internal name for shipping method on purchase log view.
304
+ * Change: Presentation settings page is restored to WPEC Settings page when WooTheme is activated.
305
+ * Fix: Add to cart using Donation widget causes the page to reload and the item is added twice.
306
+ * Fix: Free-shipping discount causes tax to be calculated incorrectly.
307
+ * Fix: Paypal Buy Now button passes the wrong price to Paypal if product is on sale.
308
+ * Fix: Thumbnail sizes are not generated correctly.
309
+ * Fix: Broken output buffering rendering wpsc_add_advanced_options hook useless.
310
+ * Fix: Paypal Pro doesn't properly account for discount and coupon.
311
+ * Fix: IPN doesn't work on Paypal Standard.
312
+ * Fix: IPN doesn't work on Paypal Pro gateway.
313
+ * Fix: Paypal Express doesn't handle discounts.
314
+ * Fix: Paypal Express doesn't handle IPN.
315
+ * Fix: Paypal Express doesn't send purchase receipt after a payment is accepted on Paypal.
316
+ * Fix: Paypal Express doesn't include item description, quantity, tax etc. in email receipts.
317
+ * Fix: Invalid country code in Paypal Pro and Express, should be GB instead of UK
318
+ * Fix: Take Discount into account when DoExpressCheckout in Paypal Express gateway.
319
+ * Fix: Category checkout form sets don't work.
320
+ * Fix: Incorrect Product display mode selected when ['view_type'] is set and 'show_advanced_search' is disabled.
321
+ * Fix: PHP notice in wpsc-transaction_results_functions.php.
322
+ * Fix: attr('checked') == true always evaluates to false. Use is(':checked') instead.
323
+ * Fix: jQuery 1.6 select by attribute incompatibility.
324
+ * Fix: Price tag is added to RSS even when there is no price.
325
+ * Fix: Span tag is not closed in issue 598.
326
+ * Fix: Faulty php tag in template (issue 589).
327
+ * Fix: PHP Notices when checking out with shipping disabled.
328
+
329
+ = 3.8.4 =
330
+ * Add: User can duplicate a product in admin panel
331
+ * Add: WooThemes integration support
332
+ * Change: Total in Cart widget now excludes shipping and tax
333
+ * Fix: Invalid country code in paypal-standard.merchant.php
334
+ * Fix: Tax is not passed properly to Paypal Pro
335
+ * Fix: Currency code preference not correctly selected in Paypal gateways
336
+ * Fix: Paypal gateways doesn't check whether the currency being sent to Paypal is accepted or not, resulting in wrong currency
337
+ * Fix: Checkout form selecting the wrong field when a previous field with the same uniquename was deleted
338
+ * Fix: Various issues with Google Checkout
339
+ * Fix: State data outside of US is not passed to payment gateways
340
+ * Fix: State is not displaying correctly in the users purchase history
341
+ * Fix: Wrong generated product permalink when a product is assigned multiple cats, and a product category is being viewed
342
+ * Fix: Submitting a checkout form with mandatory billing state only refreshes the form although everything is filled out correctly
343
+ * Fix: Billing Country is trimmed, and Billing State is not properly decoded
344
+ * Fix: Billing and shipping state no longer stored correctly
345
+ * Fix: Checkout form validation skips mandatory custom checkout fields on default form set
346
+ * Fix: Paystation does not properly update purchase logs
347
+ * 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
348
+ * Fix: Store sub-pages return 404 error
349
+ * Fix: Only Purchase History in Your Account show the login option
350
+ * Fix: Weight on Variations contain too many decimals
351
+ * Fix: Add to Cart in grid view bypasses Variations selection
352
+ * Fix: get_queried_object() requires WP 3.1
353
+ * Fix: Invalid version number in display-update.page.php
354
+ * Fix: Correct HTML, to stop Free Shipping Discount getting blanked
355
+ * Fix: Support taxonomy archives for product_tag taxonomy
356
+
357
+ = 3.8.3 =
358
+ * New: Individual item details are sent to Paypal Express Checkout
359
+ * Change: Automatically reload database update page when PHP maximum execution time is detected
360
+ * Change: Add progress bar and estimated time remaining for database update tasks
361
+ * 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
362
+ * Change: Paypal Express Checkout API is updated to ver 71.0
363
+ * Fix: Tax is calculated incorrectly when a coupon is used
364
+ * Fix: Update a large database of products and variations take ages
365
+ * Fix: Reloading database update page makes wpec scan the records from the beginning instead of continuing where it left off
366
+ * 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)
367
+ * Fix: Purchase logs' statuses are not properly updated when upgrading from 3.7.x
368
+ * Fix: Billing state is not sent to checkout
369
+ * Fix: Country name is truncated when sending to payment gateway
370
+ * Fix: Billing state code is not properly converted before sending to payment gateway
371
+ * Fix: Wrong USA country code is sent to Paypal Standard Payment
372
+ * Fix: Wrong sandbox gateway URL for Paypal Pro
373
+ * Fix: SSLVERIFY error when connecting to Paypal Pro Gateway
374
+ * Fix: Template hierarchy error with child themes
375
+ * Fix: Total amount is not visible when checking out with Paypal Express Checkout
376
+ * Fix: Transaction result page is inaccurate after checking out with Paypal Express Checkout
377
+ * Fix: Incompatibility with Thesis theme's loop when viewing product category, or paginated product listing
378
+
379
+ = 3.8.2 =
380
+ * Add: Currency display for Google RSS feed
381
+ * Add: Third-party plugins can now filter 'wpsc-tax_rate' to provide their own tax solution
382
+ * Change: Merchant subclasses now have access to $this->address_keys
383
+ * Change: Grid Settings are now always visible
384
+ * Change: Total Shipping is no longer included in notification email when shipping is disabled
385
+ * Change: Thumbnail size for single product view now defaults to Single Product Page thumbnail size option
386
+ * Change: wpsc_the_product_thumbnail() defaults to 'medium-single-product' size when in single product view
387
+ * Fix: Update notice being displayed when it has already been completed
388
+ * Fix: Broken image in latest products widget
389
+ * Fix: Custom checkout field not always saved
390
+ * Fix: Downloadable file list not updated after existing files are selected
391
+ * Fix: Already attached downloadable files are duplicated each time you select an existing downloadable file
392
+ * Fix: Inconsistent behavior when adding a new field to a checkout form set
393
+ * Fix: Custom product slug not editable
394
+ * Fix: Incompatibility issues with shipping helper and modules
395
+ * Fix: Product meta are not included in Google product feed
396
+ * Fix: Incorrect variation "from" price
397
+ * Fix: Shortcode not working in single product description
398
+ * Fix: Item cost not correctly calculated in paypal-standard-merchant
399
+ * Fix: Invalid SSL URL for some images
400
+ * Fix: Select from wrong table in WPSC_Merchant::get_authcode()
401
+ * Fix: Wrong use of get_query_var() in wpsc_category_id()
402
+ * Fix: Table `wordpress.wp_wpsc_product_list` doesn't exist
403
+ * Fix: ?items_per_page=all is ignored
404
+ * Fix: Duplicate transaction result emails
405
+ * Fix: Wrong filter in wpsc_item_add_preview_file()
406
+ * Fix: Wrong display type when using advanced search view mode and viewing a category
407
+ * Fix: Category list is displayed in tag archive
408
+ * Fix: wpsc_display_products_page() outputs "Fail" when the product shortcode is used 10 times (no kidding)
409
+ * Fix: Single product view's thumbnail size is incorrect
410
+ * Fix: Wrong featured thumbnail is displayed in Single Product View when there are multiple attached product images
411
+ * Fix: Incorrect condition statements in WPSC_Coupons::compare_logic()
412
+ * Fix: Can't add new field to checkout form set in IE
413
+ * Fix: Missing trash icon when adding custom options to dropdowns in checkout form
414
+ * Fix: Custom select, checkbox and radio fields are displayed as textbox on [userlog] page
415
+ * Fix: Custom checkboxes, radios and select fields are not properly populated in Checkout form
416
+ * Fix: Attachment metadata are not properly generated when converting product thumbnails from 3.7.x to 3.8
417
 
418
+ = 3.8.1 =
419
+ * Fix: Special price mix-up when ugprade to 3.8
420
+ * Fix: Missing database update notice
421
+ * Fix: Breadcrumb markup and style fixes
422
+ * Fix: Deprecate WPSC_Query()
423
+ * Fix: Deprecate wpsc_total_product_count()
424
+ * Fix: Deprecate wpsc_print_product_list()
425
+ * Change: Warning message for PHP 4 users. GoldCart requires PHP 5 or above.
426
+ * Change: Don't display categories when there's a search
427
+
428
+ = 3.8 =
429
+ * Utilize custom post types for products
430
+ * Utilize custom taxonomy for categories and variations
431
+ * Database optimization
432
+ * Redesigned taxes and shipping systems
433
+ * New user interface
434
+ * Integrates with WordPress Media Manager
435
+ * Better template integration for designers
436
+ * Optimized for ticketing (Tikipress)
437
 
 
438
 
439
+ == Frequently Asked Questions ==
 
 
 
440
 
441
+ = How do I customize WP e-Commerce =
442
 
443
+ First of all you should check out the Presentation settings which are in the Settings->Store page.
444
 
445
+ 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/").
446
 
447
  == Screenshots ==
448
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
woo-integration/css/main_frame_style.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CSS Document */
2
+
3
+ li.wpsc_presentation a{
4
+ padding-left: 40px !important;
5
+ background: url(../../wpsc-core/images/credit_cards.png) no-repeat;
6
+ background-position: 12px center;
7
+ }
8
+
9
+ iframe#wpsc-presentation{
10
+ height: 2210px;
11
+ width: 100%;
12
+ }
woo-integration/css/style.css ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CSS Document */
2
+
3
+ *{
4
+ font-family: 'Lucida Grande', Verdana, sans-serif;
5
+ font-size: 11px;
6
+ color: #666;
7
+ list-style: none;
8
+ }
9
+
10
+ h3{
11
+ font-size: 14px;
12
+ color: #333;
13
+ display: block;
14
+ border-bottom: solid 1px #e7e7e7;
15
+ padding-bottom: 7px;
16
+ }
17
+
18
+ tr{
19
+ display: block;
20
+ padding-bottom: 10px;
21
+ }
22
+
23
+ th[scope=row], th[score=row]{
24
+ text-align: left;
25
+ }
26
+
27
+ input[type=text]{
28
+ border: solid #CCC #EEE #EEE #CCC;
29
+ border-width: 1px;
30
+ background-color: #fafafa;
31
+ -moz-border-radius: 3px;
32
+ -webkit-border-radius: 3px;
33
+ -border-radius: 3px;
34
+ padding: 5px;
35
+ -webkit-bor
36
+ }
37
+
38
+ input[type=text]:hover{
39
+ background-color: #FFF;
40
+ }
41
+
42
+ .allign_top{
43
+ vertical-align: top;
44
+ }
45
+
46
+ .button_settings_th{
47
+ width: 180px;
48
+ }
49
+
50
+ .button_settings_desc{
51
+ width: 260px;
52
+ padding-left: 20px;
53
+ }
54
+
55
+ .product_settings_th{
56
+ width: 350px;
57
+ }
58
+
59
+ .product_page_settings_th, .product_category_settings_th, .thumbnail_settings_th{
60
+ width: 260px;
61
+ padding-right: 10px;
62
+ }
63
+
64
+ .shopping_cart_settings_th{
65
+ width: 240px;
66
+ padding-right: 10px;
67
+ }
68
+
69
+ .pagination_settings_th{
70
+ width: 200px;
71
+ }
72
+
73
+ .wpsc_select_wrapper{
74
+ -moz-border-radius: 4px;
75
+ -webkit-border-radius: 4px;
76
+ border-radius: 4px;
77
+ font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
78
+ font-size: 12px;
79
+ background: #FAFAFA url(../../functions/images/select.png) no-repeat right center;
80
+ border-color: #CCC #EEE #EEE #CCC;
81
+ border-style: solid;
82
+ border-width: 1px;
83
+ float: left;
84
+ height: 26px;
85
+ width: 280px;
86
+ margin: 0;
87
+ margin-bottom: 9px !important;
88
+ display: block;
89
+ color: #555;
90
+ }
91
+
92
+ .wpsc_select{
93
+ cursor: pointer;
94
+ height: 28px;
95
+ margin: 0;
96
+ opacity: 0;
97
+ padding: 0;
98
+ position: relative;
99
+ width: inherit;
100
+ z-index: 4;
101
+
102
+ }
103
+
104
+ .wpsc_select_span{
105
+ height: 26px;
106
+ line-height: 26px;
107
+ position: absolute;
108
+ z-index: 2;
109
+ padding-left: 6px;
110
+ }
111
+
112
+ .wpsc_select:hover{
113
+ color: #333;
114
+ background: white;
115
+ }
116
+
117
+ input[type=submit][name=updateoption]{
118
+ border-color: #BBB !important;
119
+ cursor: pointer;
120
+ background-color: #FAFAFA;
121
+ border: 1px solid;
122
+ padding: 5px;
123
+ font-family: "Lucida Grande", Verdana, sans-serif;
124
+ color: #555;
125
+ -moz-border-radius: 4px;
126
+ -webkit-border-radius: 4px;
127
+ -border-radius: 4px;
128
+ border-style: solid;
129
+ border-width: 1px;
130
+ position: fixed;
131
+ bottom: 10px;
132
+ }
133
+
134
+ input[type=submit][name=updateoption]:hover{
135
+ border-color: #666 !important;
136
+ color: black;
137
+ }
138
+
139
+ .comment_settings_th{
140
+ width: 250px;
141
+ }
142
+
143
+ #message{
144
+ position: fixed;
145
+ bottom: 10px;
146
+ right: 0px;
147
+ display: block;
148
+ width: 400px;
149
+ text-align: center;
150
+ background-color: #FFFFE0;
151
+ border: 1px solid #E6DB55;
152
+ -moz-border-radius: 4px;
153
+ -webkit-border-radius: 4px;
154
+ -border-radius: 4px;
155
+ }
woo-integration/js/script.js ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // JavaScript Document
2
+ (function($){
3
+ $(document).ready(function() {
4
+ //Button Settings Block
5
+ $("h3:contains('Button Settings')").next().find('th[scope="row"]').addClass('button_settings_th allign_top');
6
+
7
+ var i = $("h3:contains('Button Settings')").next().find('td').first();
8
+ i.html(i.html().replace('Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.',''));
9
+ i.after("<td class='button_settings_desc'>Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.</td>");
10
+ i.addClass('allign_top');
11
+
12
+ //Products Settings Block
13
+ $("h3:contains('Product Settings')").next().find('th[scope="row"]').addClass('product_settings_th allign_top');
14
+ $("h3:contains('Product Settings')").next().find('th[score="row"]').addClass('product_settings_th allign_top');
15
+
16
+ //Product Page Settings
17
+ $("h3:contains('Product Page Settings')").next().find('th[scope="row"]').addClass('product_page_settings_th allign_top');
18
+
19
+ //Shopping Cart Settings
20
+ $("h3:contains('Shopping Cart Settings')").next().find('th[scope="row"]').addClass('shopping_cart_settings_th allign_top');
21
+
22
+ //Product category Settings
23
+ $("h3:contains('Product Category Settings')").next().find('th[scope="row"]').addClass('product_category_settings_th allign_top');
24
+
25
+ //Thumbnail Settings
26
+ $("h3:contains('Thumbnail Settings')").next().next().find('th[scope="row"]').addClass('thumbnail_settings_th');
27
+
28
+ //Pagination Settings
29
+ $("h3:contains('Pagination settings')").next().find('th[scope="row"]').addClass('pagination_settings_th');
30
+
31
+ //Comment Settings
32
+ $("h3:contains('Comment Settings')").next().find('th[scope="row"]').addClass('comment_settings_th');
33
+
34
+ //Select control
35
+ $("select").wrap('<div class="wpsc_select_wrapper" />');
36
+ $("select").before('<span class="wpsc_select_span"></span>');
37
+ $("select").addClass("wpsc_select");
38
+ $("select").change(function (){
39
+ $(this).prev().text($(this).find('option:selected').text());
40
+ });
41
+
42
+ //Initialize select valua
43
+ $("select").each(function(index, element) {
44
+ $(this).prev().text($(this).find('option:selected').text());
45
+ });
46
+
47
+ //Remove Advanced Theme Setting
48
+ $('#themes_and_appearance').remove();
49
+ });
50
+ })(jQuery);
woo-integration/options_presentation.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <link rel="stylesheet" type="text/css" href="<?php echo WPSC_URL; ?>/woo-integration/css/style.css"/>
6
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
7
+ <script type="text/javascript" src="<?php echo WPSC_URL; ?>/woo-integration/js/script.js"></script>
8
+ <title>Dirty Options Presentaion</title>
9
+ </head>
10
+ <body>
11
+ <?php
12
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/presentation.php' );
13
+ echo wpsc_options_presentation();
14
+ ?>
15
+ </body>
16
+ </html>
woo-integration/woo_integration.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //Remove presentation tab on wpsc option menu
4
+ function woo_wpsc_remove_presentation_tab($default_tabs){
5
+ unset( $default_tabs['presentation'] );
6
+ return $default_tabs;
7
+ }
8
+
9
+ //Filter redirect url so that WPSC presentation page will loac correctly after update
10
+ function woo_wpsc_filter_redirect_url($query){
11
+ if ($_GET['page']=='woothemes'){
12
+ $query = remove_query_arg('tab', $query);
13
+ $query = add_query_arg( 'page' , 'woothemes' , $query);
14
+ }
15
+ return esc_url( $query );
16
+ }
17
+
18
+ //Print presentation menu subpage
19
+ function woo_wpsc_filter_option($return){
20
+ $return[1] .= '<li class="wpsc_presentation">
21
+ <a title="WPSC_presentation" href="#wpsc-option-presentation">
22
+ WPSC Presentation
23
+ </a>
24
+ </li>';
25
+
26
+ $return[0] .= ' <div class="group" id="wpsc-option-presentation">
27
+ <iframe id="wpsc-presentation" src="'.get_bloginfo('wpurl').'/wp-admin/admin-ajax.php?action=print_wpsc_presentation">
28
+ </iframe>
29
+ </div>';
30
+
31
+ return $return;
32
+ }
33
+
34
+ //Ajax respond for wp_ajax_print_wpsc_presentation
35
+ function woo_wpsc_presentation_menu(){
36
+ require_once( WPSC_FILE_PATH . '/woo-integration/options_presentation.php' );
37
+ die();
38
+ }
39
+
40
+ //Add main frame style sheet
41
+ function add_my_stylesheet() {
42
+ wp_register_style('gb_admin_style', get_bloginfo('template_url') . '/wpsc/css/main_frame_style.css' );
43
+ wp_enqueue_style('gb_admin_style');
44
+ }
45
+
46
+
47
+ function woo_wpsc_integration(){
48
+ //add_filter( 'wpsc_settings_tabs' , 'woo_wpsc_remove_presentation_tab');
49
+ add_filter( 'woo_before_option_page' , 'woo_wpsc_filter_option');
50
+ add_filter( 'wpsc_settings_redirect_url' , 'woo_wpsc_filter_redirect_url');
51
+ add_action( 'wp_ajax_print_wpsc_presentation' , 'woo_wpsc_presentation_menu');
52
+ add_action( 'admin_init' , 'add_my_stylesheet');
53
+ }
54
+
55
+ function wpsc_detect_woo(){
56
+ if (function_exists('woo_version')){
57
+ woo_wpsc_integration();
58
+ }
59
+ }
60
+
61
+ add_action('after_setup_theme', 'wpsc_detect_woo');
62
+ ?>
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.7.7
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
+
283
+ $delivery_region_count = $wpdb->get_var("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('".$wpdb->escape( $purch_data['billing_country'])."')");
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,30 @@ 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 +51,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 +69,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 +91,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 +105,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 +135,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
 
@@ -189,22 +148,17 @@ function wpsc_admin_pages() {
189
  }
190
 
191
  // Add to Dashboard
192
- // $page_hooks[] = $purchase_log_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), 'administrator', 'wpsc-sales-logs', 'wpsc_display_sales_logs' );
193
 
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' );
@@ -230,9 +184,8 @@ function wpsc_admin_pages() {
230
  add_action( 'load-' . $page_hook, 'wpsc_admin_include_optionspage_css_and_js' );
231
  break;
232
 
233
- case $purchase_logs_page :
234
  add_action( 'admin_head', 'wpsc_product_log_rss_feed' );
235
- add_action( 'load-' . $page_hook, 'wpsc_admin_include_purchase_logs_css_and_js' );
236
  break;
237
 
238
  case $edit_coupons_page :
@@ -247,24 +200,14 @@ function wpsc_admin_pages() {
247
  update_option( 'wpsc_trackingid_message', __( "Track & Trace means you may track the progress of your parcel with our online parcel tracker, just login to our website and enter the following Tracking ID to view the status of your order.\n\nTracking ID: %trackid%\n", 'wpsc' ) );
248
  }
249
 
250
- add_action( 'load-' . $edit_options_page, 'wpsc_load_settings_page', 1 );
251
-
252
- // only load the purchase log list table and page classes when it's necessary
253
- // also, the WPSC_Purchase_Logs_List_Table needs to be initializied before admin_header.php
254
- // is loaded, therefore wpsc_load_purchase_logs_page needs to do this as well
255
- add_action( 'load-' . $purchase_logs_page, 'wpsc_load_purchase_logs_page', 1 );
256
-
257
  // Help tabs
258
  add_action( 'load-' . $edit_options_page , 'wpsc_add_help_tabs' );
259
- add_action( 'load-' . $purchase_logs_page , 'wpsc_add_help_tabs' );
260
  add_action( 'load-' . $edit_coupons_page , 'wpsc_add_help_tabs' );
261
  add_action( 'load-edit.php' , 'wpsc_add_help_tabs' );
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,13 +215,9 @@ 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(
283
  // Store Settings Page
284
  'settings_page_wpsc-settings' => array(
@@ -310,7 +249,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
  ),
@@ -348,192 +287,62 @@ function wpsc_add_help_tabs() {
348
  ),
349
  );
350
 
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 +350,37 @@ 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 +396,140 @@ 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 +538,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 +551,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 +566,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 +574,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 +595,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 +652,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 +673,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 +734,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 +758,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 +773,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 +804,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 +831,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 +858,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 +866,35 @@ 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() {
@@ -1202,19 +906,15 @@ function wpsc_ajax_ie_save() {
1202
  die();
1203
  }
1204
 
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'],
1212
- 'post_title' => $parent->post_title . ' (' . implode( ', ', $terms ) . ')',
1213
  );
1214
 
1215
  $id = wp_update_post( $product );
1216
  if ( $id > 0 ) {
1217
  //need parent meta to know which weight unit we are using
 
1218
  $parent_meta = get_product_meta($post->post_parent, 'product_metadata', true );
1219
  $product_meta = get_product_meta( $product['ID'], 'product_metadata', true );
1220
  if ( is_numeric( $_POST['weight'] ) || empty( $_POST['weight'] ) ){
@@ -1231,6 +931,7 @@ function wpsc_ajax_ie_save() {
1231
  else
1232
  update_product_meta( $product['ID'], 'stock', absint( $_POST['stock'] ) );
1233
 
 
1234
  $meta = get_product_meta( $id, 'product_metadata', true );
1235
  $price = get_product_meta( $id, 'price', true );
1236
  $special_price = get_product_meta( $id, 'special_price', true );
@@ -1247,458 +948,24 @@ 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
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/display-sales-logs.php' );
 
 
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
 
29
+ //Woothemes integration
30
+ require_once( WPSC_FILE_PATH . '/woo-integration/woo_integration.php' );
31
 
32
+ //settings pages include
33
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/general.php' );
34
+
35
+ if ( !get_option( 'wpsc_checkout_form_sets' ) ) {
36
+ $form_sets = array( 'Default Checkout Forms' );
37
+ update_option( 'wpsc_checkout_form_sets', $form_sets );
38
+ }
39
  /**
40
  * wpsc_query_vars_product_list sets the ordering for the edit-products page list
 
 
41
  * @access public
42
  *
43
+ * @since 3.8
44
+ * @param $vars (array) - default query arguments
45
+ * @return $vars (array) - modified query arguments
 
46
  */
47
  function wpsc_query_vars_product_list( $vars ){
48
 
51
 
52
  $vars['posts_per_archive_page'] = 0;
53
 
54
+ if( is_admin() && isset( $vars['orderby'] ) ) {
55
+ $vars['orderby'] = 'date';
56
+ $vars['order'] = 'desc';
57
+ $vars['nopaging'] = false;
58
+ $posts_per_page = (int)get_user_option( 'edit_wpsc_product_per_page' );
59
+ $vars['posts_per_page'] = ( $posts_per_page ) ? $posts_per_page : 20;
60
+ }
61
+
62
  if( 'dragndrop' == get_option( 'wpsc_sort_by' ) ){
63
  $vars['orderby'] = 'menu_order title';
64
  $vars['order'] = 'desc';
69
  }
70
 
71
  /**
72
+ * setting the screen option to between 1 and 999
 
 
73
  * @access public
74
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  * @since 3.8
76
+ * @param $status
77
+ * @param $option (string) name of option being saved
78
+ * @param $value (string) value of option being saved
 
 
 
 
79
  * @return $value after changes...
80
  */
81
  function wpsc_set_screen_option($status, $option, $value){
82
+ if( in_array($option, array ("edit_wpsc_variation_per_page","edit_wpsc_product_per_page" )) ){
83
  if ( "edit_wpsc_variation_per_page" == $option ){
84
  global $user_ID;
85
  update_user_option($user_ID,'edit_wpsc-variation_per_page',$value);
91
 
92
  /**
93
  * When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
94
+ * @access public (wp-admin)
95
  *
96
  * @since 3.8
97
+ * @param $per_page (int) number of products per page
98
+ * @param $post_type (string) name of current post type
 
 
 
 
99
  * @return $per_page after changes...
100
  */
101
  function wpsc_drag_and_drop_ordering($per_page, $post_type){
105
  return $per_page;
106
  }
107
  add_filter( 'request', 'wpsc_query_vars_product_list' );
108
+ add_filter('edit_posts_per_page' , 'wpsc_drag_and_drop_ordering', 10, 2 );
 
109
  /**
110
  * Checks whether to display or hide the update wp-e-commerce link
111
  *
 
112
  * @access public
113
  *
114
+ * @since 3.8
 
115
  * @return boolean true - show link, false- hide link
116
  */
117
  function wpsc_show_update_link() {
135
  *
136
  * If the permissions are changed here, they will likewise need to be changed for the other sections of the admin that either use ajax
137
  * or bypass the normal download system.
 
 
 
 
 
 
 
 
 
 
 
 
138
  */
139
  function wpsc_admin_pages() {
140
 
148
  }
149
 
150
  // Add to Dashboard
151
+ $page_hooks[] = $purchase_log_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), 'administrator', 'wpsc-sales-logs', 'wpsc_display_sales_logs' );
152
 
153
  if ( wpsc_show_update_link() )
154
  $page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wpsc' ), __( 'Store Update', 'wpsc' ), 'administrator', 'wpsc-update', 'wpsc_display_update_page' );
155
 
156
+ $page_hooks[] = add_submenu_page( 'index.php', __( 'Store Upgrades', 'wpsc' ), __( 'Store Upgrades', 'wpsc' ), 'administrator', 'wpsc-upgrades', 'wpsc_display_upgrades_page' );
 
 
 
 
157
 
158
  // Set the base page for Products
159
  $products_page = 'edit.php?post_type=wpsc-product';
160
 
161
+ $page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page , __( 'Coupons', 'wpsc' ), __( 'Coupons', 'wpsc' ), 'administrator', 'wpsc-edit-coupons', 'wpsc_display_coupons_page' );
 
162
 
163
  // Add Settings pages
164
  $page_hooks[] = $edit_options_page = add_options_page( __( 'Store Settings', 'wpsc' ), __( 'Store', 'wpsc' ), 'administrator', 'wpsc-settings', 'wpsc_display_settings_page' );
184
  add_action( 'load-' . $page_hook, 'wpsc_admin_include_optionspage_css_and_js' );
185
  break;
186
 
187
+ case $purchase_log_page :
188
  add_action( 'admin_head', 'wpsc_product_log_rss_feed' );
 
189
  break;
190
 
191
  case $edit_coupons_page :
200
  update_option( 'wpsc_trackingid_message', __( "Track & Trace means you may track the progress of your parcel with our online parcel tracker, just login to our website and enter the following Tracking ID to view the status of your order.\n\nTracking ID: %trackid%\n", 'wpsc' ) );
201
  }
202
 
 
 
 
 
 
 
 
203
  // Help tabs
204
  add_action( 'load-' . $edit_options_page , 'wpsc_add_help_tabs' );
205
+ add_action( 'load-' . $purchase_log_page, 'wpsc_add_help_tabs' );
206
  add_action( 'load-' . $edit_coupons_page , 'wpsc_add_help_tabs' );
207
  add_action( 'load-edit.php' , 'wpsc_add_help_tabs' );
208
  add_action( 'load-post.php' , 'wpsc_add_help_tabs' );
209
  add_action( 'load-post-new.php' , 'wpsc_add_help_tabs' );
210
  add_action( 'load-edit-tags.php' , 'wpsc_add_help_tabs' );
 
 
 
211
  }
212
 
213
  /**
215
  * add_contextual_help() is supported as well as $screen->add_help_tab().
216
  *
217
  * @since 3.8.8
 
 
 
 
 
218
  */
219
  function wpsc_add_help_tabs() {
220
+ global $current_screen;
221
  $tabs = array(
222
  // Store Settings Page
223
  'settings_page_wpsc-settings' => array(
249
  'wpsc-product' => array(
250
  'title' => _x( 'Add and Edit Product', 'contextual help tab', 'wpsc' ),
251
  'links' => array(
252
+ 'category/managing-your-store/' => _x( 'Managing Your Store', 'contextual help link', 'wpsc' ),
253
  'resource/video-adding-products/' => _x( 'Video: Adding Products', 'contextual help link', 'wpsc' ),
254
  ),
255
  ),
287
  ),
288
  );
289
 
290
+ $screen = $current_screen;
291
  if ( array_key_exists( $screen->id, $tabs ) ) {
292
  $tab = $tabs[$screen->id];
293
  $content = '<p><strong>' . __( 'For More Information', 'wpsc' ) . '</strong></p>';
294
  $links = array();
295
  foreach( $tab['links'] as $link => $link_title ) {
296
+ $link = 'http://docs.getshopped.org/' . $link;
297
  $links[] = '<a target="_blank" href="' . esc_url( $link ) . '">' . esc_html( $link_title ) . '</a>';
298
  }
299
  $content .= '<p>' . implode( '<br />', $links ) . '</p>';
300
 
301
+ if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
302
+ add_contextual_help( $screen->id, $content );
303
+ } else {
304
+ $screen->add_help_tab( array(
305
+ 'id' => $screen->id . '_help',
306
+ 'title' => $tab['title'],
307
+ 'content' => $content,
308
+ ) );
309
+ }
310
  }
311
  }
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  function wpsc_product_log_rss_feed() {
314
+ 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'/>";
315
  }
 
 
 
 
 
 
 
316
  function wpsc_admin_include_coupon_js() {
317
 
318
  // Variables
319
+ $siteurl = get_option( 'siteurl' );
320
+ $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
 
 
321
 
322
  // Coupon CSS
323
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
324
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
325
 
326
  // Coupon JS
327
+ wp_enqueue_script( 'wp-e-commerce-admin-parameters', $siteurl . '/wp-admin/admin.php?wpsc_admin_dynamic_js=true', false, $version_identifier );
328
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
329
+ wp_enqueue_script( 'datepicker-ui', WPSC_CORE_JS_URL . '/ui.datepicker.js', array( 'jquery-ui-core' ), $version_identifier );
330
+ 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 );
 
 
 
 
 
 
 
331
  }
332
 
333
  /**
334
+ * wpsc_admin_include_optionspage_css_and_js function, includes the wpsc_admin CSS and JS for the specific options page
335
+ * No parameters, returns nothing
 
 
 
 
 
336
  */
337
  function wpsc_admin_include_optionspage_css_and_js() {
 
 
 
338
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
339
+ wp_enqueue_script( 'wp-e-commerce-js-ajax', WPSC_URL . '/wpsc-core/js/ajax.js', false, $version_identifier );
340
+ wp_enqueue_script( 'wp-e-commerce-js-ui-tabs', WPSC_URL . '/wpsc-admin/js/jquery-ui.js', false, $version_identifier );
341
+ wp_enqueue_script( 'wp-e-commerce-js-dimensions', WPSC_URL . '/wpsc-admin/js/dimensions.js', false, $version_identifier );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL . '/wpsc-admin/css/settingspage.css', false, false, 'all' );
343
  wp_enqueue_style( 'wp-e-commerce-ui-tabs', WPSC_URL . '/wpsc-admin/css/jquery.ui.tabs.css', false, $version_identifier, 'all' );
344
  }
345
 
 
 
 
 
 
 
346
  function wpsc_meta_boxes() {
347
  global $post;
348
  $pagename = 'wpsc-product';
350
 
351
  //if a variation page do not show these metaboxes
352
  if ( is_object( $post ) && $post->post_parent == 0 ) {
353
+ add_meta_box( 'wpsc_product_variation_forms', __('Variations', 'wpsc'), 'wpsc_product_variation_forms', $pagename, 'normal', 'high' );
354
+ add_meta_box( 'wpsc_product_external_link_forms', __('Off Site Product link', 'wpsc'), 'wpsc_product_external_link_forms', $pagename, 'normal', 'high' );
355
  } else if( is_object( $post ) && $post->post_status == "inherit" ) {
356
+ remove_meta_box( 'tagsdiv-product_tag', 'wpsc-product', 'core' );
357
+ remove_meta_box( 'wpsc_product_external_link_forms', 'wpsc-product', 'core' );
358
+ remove_meta_box( 'wpsc_product_categorydiv', 'wpsc-product', 'core' );
359
  }
360
 
361
+ add_meta_box( 'wpsc_price_control_forms', __('Price Control', 'wpsc'), 'wpsc_price_control_forms', $pagename, 'side', 'low' );
362
+ add_meta_box( 'wpsc_stock_control_forms', __('Stock Control', 'wpsc'), 'wpsc_stock_control_forms', $pagename, 'side', 'low' );
363
  add_meta_box( 'wpsc_product_taxes_forms', __('Taxes', 'wpsc'), 'wpsc_product_taxes_forms', $pagename, 'side', 'low' );
364
+ add_meta_box( 'wpsc_additional_desc', __('Additional Description', 'wpsc'), 'wpsc_additional_desc', $pagename, 'normal', 'high' );
365
+ add_meta_box( 'wpsc_product_download_forms', __('Product Download', 'wpsc'), 'wpsc_product_download_forms', $pagename, 'normal', 'high' );
366
+ add_meta_box( 'wpsc_product_image_forms', __('Product Images', 'wpsc'), 'wpsc_product_image_forms', $pagename, 'normal', 'high' );
367
+ add_meta_box( 'wpsc_product_shipping_forms', __('Shipping', 'wpsc'), 'wpsc_product_shipping_forms', $pagename, 'normal', 'high' );
368
+ add_meta_box( 'wpsc_product_advanced_forms', __('Advanced Settings', 'wpsc'), 'wpsc_product_advanced_forms', $pagename, 'normal', 'high' );
369
+
370
  }
371
 
372
  add_action( 'admin_footer', 'wpsc_meta_boxes' );
373
  add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
375
+ global $post_type, $current_screen;
376
+ $siteurl = get_option( 'siteurl' );
377
+ if ( is_ssl ( ) )
378
+ $siteurl = str_replace( "http://", "https://", $siteurl );
379
 
380
+ if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) )
381
+ wp_admin_css( 'dashboard' );
382
 
383
+ if($current_screen->id == 'dashboard_page_wpsc-sales-logs'){
384
  // jQuery
385
  wp_enqueue_script( 'jquery' );
386
  wp_enqueue_script( 'jquery-ui-draggable' );
396
  $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
397
  $pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
398
 
399
+ 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 == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' ) {
 
 
 
400
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
401
+ wp_enqueue_script( 'wp-e-commerce-admin-parameters', $siteurl . '/wp-admin/admin.php?wpsc_admin_dynamic_js=true', false, $version_identifier );
402
  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 );
403
+ wp_enqueue_script( 'wp-e-commerce-legacy-ajax', WPSC_URL . '/wpsc-admin/js/ajax.js', false, $version_identifier ); // needs removing
404
+ wp_enqueue_script( 'wp-e-commerce-variations', WPSC_URL . '/wpsc-admin/js/variations.js', array( 'jquery' ), $version_identifier );
405
+ if ( $current_screen->id == 'edit-wpsc_product_category' ) {
406
+ wp_dequeue_script( 'wp-ajax-response' );
407
+ wp_dequeue_script( 'admin-tags' );
408
+ wp_dequeue_script( 'inline-edit-post' );
409
+ } else {
410
+ wp_enqueue_script( 'inline-edit-post' );
 
 
 
411
  }
412
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
413
+ wp_enqueue_style( 'wp-e-commerce-admin-dynamic', $siteurl . "/wp-admin/admin.php?wpsc_admin_dynamic_css=true", false, $version_identifier, 'all' );
414
+ // Localize scripts
415
+ wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
416
+ 'unsaved_changes_detected' => __( 'Unsaved changes have been detected. Click OK to lose these changes and continue.', 'wpsc' ),
417
+ 'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
418
+ 'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  ) );
420
+ }
421
+ if ( 'dashboard_page_wpsc-upgrades' == $pagehook || 'dashboard_page_wpsc-update' == $pagehook )
422
+ wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
423
+ }
424
 
425
+ function wpsc_admin_dynamic_js() {
426
+ header( 'Content-Type: text/javascript' );
427
+ header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
428
+ header( 'Cache-Control: public, must-revalidate, max-age=86400' );
429
+ header( 'Pragma: public' );
430
 
431
+ $siteurl = get_option( 'siteurl' );
432
+ $hidden_boxes = get_option( 'wpsc_hidden_box' );
 
 
 
 
 
 
 
 
433
 
434
+ $form_types1 = get_option( 'wpsc_checkout_form_fields' );
435
+ $unique_names1 = get_option( 'wpsc_checkout_unique_names' );
436
 
437
+ $form_types = '';
438
+ foreach ( (array)$form_types1 as $form_type ) {
439
+ $form_types .= "<option value='" . $form_type . "'>" . $form_type . "</option>";
440
+ }
441
 
442
+ $unique_names = "<option value='-1'>" . __('Select a Unique Name', 'wpsc') . "</option>";
443
+ foreach ( (array)$unique_names1 as $unique_name ) {
444
+ $unique_names.= "<option value='" . $unique_name . "'>" . $unique_name . "</option>";
 
 
 
 
 
 
 
445
  }
446
 
447
+ $hidden_boxes = implode( ',', (array)$hidden_boxes );
448
+ echo "var base_url = '" . esc_js( $siteurl ) . "';\n\r";
449
+ echo "var WPSC_URL = '" . esc_js( WPSC_URL ) . "';\n\r";
450
+ echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
451
+ echo "var WPSC_DIR_NAME = '" . esc_js( WPSC_DIR_NAME ) . "';\n\r";
452
+ echo "var WPSC_IMAGE_URL = '" . esc_js( WPSC_IMAGE_URL ) . "';\n\r";
453
 
454
+ // LightBox Configuration start
455
+ echo "var fileLoadingImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/loading.gif';\n\r";
456
+ echo "var fileBottomNavCloseImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/closelabel.gif';\n\r";
457
+ echo "var fileThickboxLoadingImage = '" . esc_js( WPSC_CORE_IMAGES_URL ) . "/loadingAnimation.gif';\n\r";
458
 
459
+ echo "var resizeSpeed = 9;\n\r";
 
 
 
 
 
 
 
 
460
 
461
+ echo "var borderSize = 10;\n\r";
 
462
 
463
+ echo "var hidden_boxes = '" . esc_js( $hidden_boxes ) . "';\n\r";
464
+ echo "var IS_WP27 = '" . esc_js( IS_WP27 ) . "';\n\r";
465
+ echo "var TXT_WPSC_DELETE = '" . esc_js( __( 'Delete', 'wpsc' ) ) . "';\n\r";
466
+ echo "var TXT_WPSC_TEXT = '" . esc_js( __( 'Text', 'wpsc' ) ) . "';\n\r";
467
+ echo "var TXT_WPSC_EMAIL = '" . esc_js( __( 'Email', 'wpsc' ) ) . "';\n\r";
468
+ echo "var TXT_WPSC_COUNTRY = '" . esc_js( __( 'Country', 'wpsc' ) ) . "';\n\r";
469
+ echo "var TXT_WPSC_TEXTAREA = '" . esc_js( __( 'Textarea', 'wpsc' ) ) . "';\n\r";
470
+ echo "var TXT_WPSC_HEADING = '" . esc_js( __( 'Heading', 'wpsc' ) ) . "';\n\r";
471
+ echo "var TXT_WPSC_COUPON = '" . esc_js( __( 'Coupon', 'wpsc' ) ) . "';\n\r";
472
 
473
+ echo "var HTML_FORM_FIELD_TYPES =\" " . esc_js( $form_types ) . "; \" \n\r";
474
+ echo "var HTML_FORM_FIELD_UNIQUE_NAMES = \" " . esc_js( $unique_names ) . "; \" \n\r";
 
 
475
 
476
+ echo "var TXT_WPSC_LABEL = '" . esc_js( __( 'Label', 'wpsc' ) ) . "';\n\r";
477
+ echo "var TXT_WPSC_LABEL_DESC = '" . esc_js( __( 'Label Description', 'wpsc' ) ) . "';\n\r";
478
+ echo "var TXT_WPSC_ITEM_NUMBER = '" . esc_js( __( 'Item Number', 'wpsc' ) ) . "';\n\r";
479
+ echo "var TXT_WPSC_LIFE_NUMBER = '" . esc_js( __( 'Life Number', 'wpsc' ) ) . "';\n\r";
480
+ echo "var TXT_WPSC_PRODUCT_CODE = '" . esc_js( __( 'Product Code', 'wpsc' ) ) . "';\n\r";
481
+ echo "var TXT_WPSC_PDF = '" . esc_js( __( 'PDF', 'wpsc' ) ) . "';\n\r";
482
 
483
+ echo "var TXT_WPSC_AND_ABOVE = '" . esc_js( __( ' and above', 'wpsc' ) ) . "';\n\r";
484
+ echo "var TXT_WPSC_IF_PRICE_IS = '" . esc_js( __( 'If price is ', 'wpsc' ) ) . "';\n\r";
485
+ echo "var TXT_WPSC_IF_WEIGHT_IS = '" . esc_js( __( 'If weight is ', 'wpsc' ) ) . "';\n\r";
 
486
 
487
+ exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  }
489
 
490
+ if ( isset( $_GET['wpsc_admin_dynamic_js'] ) && ( $_GET['wpsc_admin_dynamic_js'] == 'true' ) ) {
491
+ add_action( "admin_init", 'wpsc_admin_dynamic_js' );
492
+ }
493
+
494
+ function wpsc_admin_dynamic_css() {
495
+ header( 'Content-Type: text/css' );
496
+ header( 'Expires: ' . gmdate( 'r', mktime( 0, 0, 0, date( 'm' ), ( date( 'd' ) + 12 ), date( 'Y' ) ) ) . '' );
497
+ header( 'Cache-Control: public, must-revalidate, max-age=86400' );
498
+ header( 'Pragma: public' );
499
+ $flash = 0;
500
+ $flash = apply_filters( 'flash_uploader', $flash );
501
+
502
+ if ( $flash = 1 ) {
503
+ ?>
504
+ div.flash-image-uploader {
505
+ display: block;
506
+ }
507
+
508
+ div.browser-image-uploader {
509
+ display: none;
510
+ }
511
+ <?php
512
+ } else {
513
+ ?>
514
+ div.flash-image-uploader {
515
+ display: none;
516
+ }
517
+
518
+ div.browser-image-uploader {
519
+ display: block;
520
+ }
521
+ <?php
522
  }
523
+ exit();
524
+ }
525
+
526
+ if ( isset( $_GET['wpsc_admin_dynamic_css'] ) && ( $_GET['wpsc_admin_dynamic_css'] == 'true' ) ) {
527
+ add_action( "admin_init", 'wpsc_admin_dynamic_css' );
528
  }
529
 
530
  add_action( 'admin_menu', 'wpsc_admin_pages' );
531
 
532
+
 
 
 
 
 
 
 
 
 
 
533
  function wpsc_admin_latest_activity() {
534
  global $wpdb;
535
  $totalOrders = $wpdb->get_var( "SELECT COUNT(*) FROM `" . WPSC_TABLE_PURCHASE_LOGS . "`" );
538
  * This is the right hand side for the past 30 days revenue on the wp dashboard
539
  */
540
  echo "<div id='leftDashboard'>";
541
+ echo "<strong class='dashboardHeading'>" . __( 'Current Month', 'wpsc' ) . "</strong><br />";
542
  echo "<p class='dashboardWidgetSpecial'>";
543
  // calculates total amount of orders for the month
544
  $year = date( "Y" );
551
  //calculates amount of money made for the month
552
  $currentMonthsSales = wpsc_currency_display( admin_display_total_price( $start_timestamp, $end_timestamp ) );
553
  echo $currentMonthsSales;
554
+ echo "<span class='dashboardWidget'>" . _x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
555
  echo "</p>";
556
  echo "<p class='dashboardWidgetSpecial'>";
557
  echo "<span class='pricedisplay'>";
566
  echo wpsc_currency_display( $monthsAverage );
567
  }
568
  //echo "</span>";
569
+ echo "<span class='dashboardWidget'>" . __( 'Avg Order', 'wpsc' ) . "</span>";
570
  echo "</p>";
571
  echo "</div>";
572
  /*
574
  */
575
 
576
  echo "<div id='rightDashboard' >";
577
+ echo "<strong class='dashboardHeading'>" . __( 'Total Income', 'wpsc' ) . "</strong><br />";
578
 
579
  echo "<p class='dashboardWidgetSpecial'>";
580
  echo wpsc_currency_display( admin_display_total_price() );
581
+ echo "<span class='dashboardWidget'>" . _x( 'Sales', 'the total value of sales in dashboard widget', 'wpsc' ) . "</span>";
582
  echo "</p>";
583
  echo "<p class='dashboardWidgetSpecial'>";
584
  echo "<span class='pricedisplay'>";
595
  }
596
  echo wpsc_currency_display( $totalAverage );
597
  //echo "</span>";
598
+ echo "<span class='dashboardWidget'>" . __( 'Avg Order', 'wpsc' ) . "</span>";
599
  echo "</p>";
600
  echo "</div>";
601
  echo "<div style='clear:both'></div>";
602
  }
603
+
604
  add_action( 'wpsc_admin_pre_activity', 'wpsc_admin_latest_activity' );
605
 
606
+
607
  /*
608
  * Dashboard Widget Setup
609
  * Adds the dashboard widgets if the user is an admin
 
610
  * Since 3.6
 
 
 
 
 
611
  */
612
+
613
  function wpsc_dashboard_widget_setup() {
614
+ if ( is_admin() && current_user_can( 'manage_options' ) ) {
615
+ $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
616
+ // Enqueue the styles and scripts necessary
617
+ wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
618
+ wp_enqueue_script( 'datepicker-ui', WPSC_URL . "/wpsc-core/js/ui.datepicker.js", array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier );
619
+ // Add the dashboard widgets
620
+ wp_add_dashboard_widget( 'wpsc_dashboard_news', __( 'Getshopped News' , 'wpsc' ), 'wpsc_dashboard_news' );
 
 
 
 
 
 
 
621
  wp_add_dashboard_widget( 'wpsc_dashboard_widget', __( 'Sales Summary', 'wpsc' ), 'wpsc_dashboard_widget' );
 
622
  wp_add_dashboard_widget( 'wpsc_quarterly_dashboard_widget', __( 'Sales by Quarter', 'wpsc' ), 'wpsc_quarterly_dashboard_widget' );
 
623
  wp_add_dashboard_widget( 'wpsc_dashboard_4months_widget', __( 'Sales by Month', 'wpsc' ), 'wpsc_dashboard_4months_widget' );
624
 
625
+ // Sort the Dashboard widgets so ours it at the top
626
+ global $wp_meta_boxes;
627
+ $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
628
+ // Backup and delete our new dashbaord widget from the end of the array
629
+ $wpsc_widget_backup = array( 'wpsc_dashboard_news' => $normal_dashboard['wpsc_dashboard_news'] );
630
+ $wpsc_widget_backup += array( 'wpsc_dashboard_widget' => $normal_dashboard['wpsc_dashboard_widget'] );
631
+ $wpsc_widget_backup += array( 'wpsc_quarterly_dashboard_widget' => $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
632
+ $wpsc_widget_backup += array( 'wpsc_dashboard_4months_widget' => $normal_dashboard['wpsc_dashboard_4months_widget'] );
633
 
 
 
 
 
 
 
634
  unset( $normal_dashboard['wpsc_dashboard_news'] );
 
 
 
635
  unset( $normal_dashboard['wpsc_dashboard_widget'] );
 
 
 
636
  unset( $normal_dashboard['wpsc_quarterly_dashboard_widget'] );
 
 
 
637
  unset( $normal_dashboard['wpsc_dashboard_4months_widget'] );
 
638
 
639
+ // Merge the two arrays together so our widget is at the beginning
 
640
 
641
+ $sorted_dashboard = array_merge( $wpsc_widget_backup, $normal_dashboard );
642
 
643
+ // Save the sorted array back into the original metaboxes
644
+
645
+ $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
646
+ }
647
  }
648
 
649
  /*
652
 
653
  add_action( 'wp_dashboard_setup', 'wpsc_dashboard_widget_setup' );
654
 
 
 
 
 
 
 
655
  function wpsc_dashboard_news() {
656
+ $rss = fetch_feed( 'http://getshopped.org/category/wp-e-commerce-plugin/' );
657
+ $args = array( 'show_author' => 1, 'show_date' => 1, 'show_summary' => 1, 'items'=>3 );
658
  wp_widget_rss_output( $rss, $args );
659
 
660
  }
661
 
 
 
 
 
 
 
 
 
662
  function wpsc_get_quarterly_summary() {
663
+ (int)$firstquarter = get_option( 'wpsc_first_quart' );
664
+ (int)$secondquarter = get_option( 'wpsc_second_quart' );
665
+ (int)$thirdquarter = get_option( 'wpsc_third_quart' );
666
+ (int)$fourthquarter = get_option( 'wpsc_fourth_quart' );
667
+ (int)$finalquarter = get_option( 'wpsc_final_quart' );
668
 
669
  $results[] = admin_display_total_price( $thirdquarter + 1, $fourthquarter );
670
  $results[] = admin_display_total_price( $secondquarter + 1, $thirdquarter );
673
  return $results;
674
  }
675
 
 
 
 
 
 
 
676
  function wpsc_quarterly_dashboard_widget() {
677
  if ( get_option( 'wpsc_business_year_start' ) == false ) {
678
  ?>
679
  <form action='' method='post'>
680
+ <label for='date_start'><?php _e( 'Financial Year End' , 'wpsc' ); ?>: </label>
681
  <input id='date_start' type='text' class='pickdate' size='11' value='<?php echo get_option( 'wpsc_last_date' ); ?>' name='add_start' />
682
  <!--<select name='add_start[day]'>
683
  <?php
734
  ?>
735
  <div id='box'>
736
  <p class='atglance'>
737
+ <span class='wpsc_quart_left'><?php _e( 'At a Glance' , 'wpsc' ); ?></span>
738
+ <span class='wpsc_quart_right'><?php _e( 'Revenue' , 'wpsc' ); ?></span>
739
  </p>
740
  <div style='clear:both'></div>
741
  <p class='quarterly'>
758
  }
759
  }
760
 
761
+
 
 
 
 
 
762
  function wpsc_dashboard_widget() {
763
+ if ( current_user_can( 'manage_options' ) ) {
764
+ do_action( 'wpsc_admin_pre_activity' );
765
+ do_action( 'wpsc_admin_post_activity' );
766
+ }
767
  }
768
 
769
  /*
773
 
774
  /*
775
  * Dashboard Widget Last Four Month Sales.
 
 
 
 
 
776
  */
777
+
778
  function wpsc_dashboard_4months_widget() {
779
  global $wpdb;
780
 
804
  $timeranges[2]["start"] = mktime( 0, 0, 0, $this_month - 1, 1, $this_year );
805
  $timeranges[2]["end"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
806
  $timeranges[3]["start"] = mktime( 0, 0, 0, $this_month, 1, $this_year );
807
+ $timeranges[3]["end"] = mktime();
808
 
809
  $prod_data = array( );
810
  foreach ( (array)$products as $product ) { //run through products and get each product income amounts and name
831
  $tablerow = 1;
832
  ob_start();
833
  ?>
834
+ <div style="padding-bottom:15px; "><?php _e('Last four months of sales on a per product basis:', 'wpsc'); ?></div>
835
  <table style="width:100%" border="0" cellspacing="0">
836
  <tr style="font-style:italic; color:#666;" height="20">
837
+ <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>
838
  <?php foreach ( $months as $mnth ): ?>
839
  <td align="center" style=" font-family:\'Times New Roman\'; font-size:15px; border-bottom:solid 1px #000;"><?php echo date( "M", $mnth ); ?></td>
840
  <?php endforeach; ?>
858
 
859
  //Modification to allow for multiple column layout
860
 
 
 
 
 
 
 
861
  function wpec_two_columns( $columns, $screen ) {
862
  if ( $screen == 'toplevel_page_wpsc-edit-products' )
863
  $columns['toplevel_page_wpsc-edit-products'] = 2;
866
  }
867
  add_filter( 'screen_layout_columns', 'wpec_two_columns', 10, 2 );
868
 
 
 
 
 
 
869
  function wpsc_fav_action( $actions ) {
870
  $actions['post-new.php?post_type=wpsc-product'] = array( 'New Product', 'manage_options' );
871
  return $actions;
872
  }
873
  add_filter( 'favorite_actions', 'wpsc_fav_action' );
874
 
875
+ function wpsc_print_admin_scripts() {
876
+ wp_enqueue_script( 'wp-e-commerce-dynamic', get_bloginfo( 'url' ) . "/index.php?wpsc_user_dynamic_js=true" );
877
+ }
878
+
879
  /**
880
+ * wpsc_update_permalinks update the product pages permalinks when WordPress permalinks are changed
881
+ *
882
+ * @public
883
  *
884
+ * @3.8
885
+ * @returns nothing
886
  */
887
+ function wpsc_update_permalinks( $return = '' ) {
888
+ wpsc_update_page_urls( true );
889
+ return $return;
 
890
  }
891
 
892
  /**
893
  * wpsc_ajax_ie_save save changes made using inline edit
894
  *
895
+ * @public
 
 
 
 
 
 
 
 
 
 
 
 
896
  *
897
+ * @3.8
898
  * @returns nothing
899
  */
900
  function wpsc_ajax_ie_save() {
906
  die();
907
  }
908
 
 
 
 
 
 
909
  $product = array(
910
  'ID' => $_POST['id'],
911
+ 'post_title' => $_POST['title']
912
  );
913
 
914
  $id = wp_update_post( $product );
915
  if ( $id > 0 ) {
916
  //need parent meta to know which weight unit we are using
917
+ $post = get_post( $id );
918
  $parent_meta = get_product_meta($post->post_parent, 'product_metadata', true );
919
  $product_meta = get_product_meta( $product['ID'], 'product_metadata', true );
920
  if ( is_numeric( $_POST['weight'] ) || empty( $_POST['weight'] ) ){
931
  else
932
  update_product_meta( $product['ID'], 'stock', absint( $_POST['stock'] ) );
933
 
934
+ $post = get_post( $id );
935
  $meta = get_product_meta( $id, 'product_metadata', true );
936
  $price = get_product_meta( $id, 'price', true );
937
  $special_price = get_product_meta( $id, 'special_price', true );
948
  die();
949
  }
950
 
 
 
 
 
 
951
  function wpsc_add_meta_boxes(){
952
+ add_meta_box( 'dashboard_right_now', __('Current Month', 'wpsc'), 'wpsc_right_now', 'dashboard_page_wpsc-sales-logs', 'top' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
953
  }
954
 
955
+ function wpsc_check_permalink_notice(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
 
957
+ ?>
958
+ <div id="notice" class="error fade"><p>
959
+ <?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' ); ?>
960
+ </p></div>
961
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
962
 
 
963
  }
964
 
965
+ add_action( 'permalink_structure_changed' , 'wpsc_check_permalink_notice' );
966
+ add_action( 'permalink_structure_changed' , 'wpsc_update_permalinks' );
967
+ /* add_action( 'get_sample_permalink_html' , 'wpsc_update_permalinks' ); // this just seems unnecessary and produces PHP notices */
968
+ add_action( 'wp_ajax_category_sort_order', 'wpsc_ajax_set_category_order' );
969
+ add_action( 'wp_ajax_wpsc_ie_save', 'wpsc_ajax_ie_save' );
970
+ add_action('in_admin_header', 'wpsc_add_meta_boxes');
971
+ ?>
wpsc-admin/ajax-and-init.php CHANGED
@@ -7,22 +7,332 @@
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 +363,33 @@ 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' ) {
@@ -64,13 +401,13 @@ function wpsc_admin_ajax() {
64
  exit();
65
  } else {
66
 
67
- $log_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '%d' LIMIT 1", $_POST['id'] ), ARRAY_A );
68
  if ( ($newvalue == 2) && function_exists( 'wpsc_member_activate_subscriptions' ) ) {
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,146 +428,1360 @@ 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'];
112
- } else {
113
- $currency_sign = $currency_data[0]['code'];
 
 
114
  }
115
- echo $currency_sign;
 
 
 
116
  }
117
  }
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'] );
134
- $timestamp = time();
135
 
136
- $new_main_image = null;
137
- $have_set_first_item = false;
138
- $i = 0;
139
- foreach ( $images as $image ) {
140
- if ( $image > 0 ) {
141
- $wpdb->update(
142
- $wpdb->posts,
143
- array(
144
- 'menu_order' => $i
145
- ),
146
- array(
147
- 'ID' => $image
148
- ),
149
- '%d',
150
- '%d'
151
- );
152
- $i++;
153
  }
154
- }
155
- $output = wpsc_main_product_image_menu( $product_id );
156
- echo "image_menu = '';\n\r";
157
- echo "image_id = '" . $new_main_image . "';\n\r";
158
- exit();
159
- }
160
- if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'rearrange_images') )
161
- add_action( 'admin_init', 'wpsc_rearrange_images' );
162
 
163
- /**
164
- * @todo docs
165
- *
166
- * @uses $wpdb WordPress database object for queries
167
- * @uses $wp_rewrite Global variable instance of the WP_Rewrite Class
168
- * @uses wp_get_referer() Retrieve referer from '_wp_http_referer' or HTTP referer.
169
- * @uses add_query_arg() Retrieve a modified URL query string.
170
- * @uses wp_redirect() Redirects to string given as argument
171
- */
172
- function wpsc_clean_categories() {
173
 
174
- if ( ! wpsc_is_store_admin() ) {
175
- return;
 
 
 
 
 
 
 
 
176
  }
 
177
 
178
- global $wpdb, $wp_rewrite;
179
- $sql_query = "SELECT `id`, `name`, `active` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`";
180
- $sql_data = $wpdb->get_results( $sql_query, ARRAY_A );
181
- foreach ( (array)$sql_data as $datarow ) {
182
- if ( $datarow['active'] == 1 ) {
183
- $tidied_name = strtolower( trim( $datarow['name'] ) );
184
- $url_name = sanitize_title( $tidied_name );
185
- $similar_names = $wpdb->get_row( $wpdb->prepare( "SELECT COUNT(*) AS `count`, MAX(REPLACE(`nice-name`, '%s', '')) AS `max_number` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `nice-name` REGEXP '^( " . esc_sql( $url_name ) . " ){1}(\d)*$' AND `id` NOT IN (%d) ", $url_name, $datarow['id'] ), ARRAY_A );
186
- $extension_number = '';
187
 
188
- if ( $similar_names['count'] > 0 )
189
- $extension_number = (int)$similar_names['max_number'] + 2;
190
 
191
- $url_name .= $extension_number;
 
 
192
 
193
- $wpdb->update(
194
- WPSC_TABLE_PRODUCT_CATEGORIES,
195
- array(
196
- 'nice-name' => $url_name
197
- ),
198
- array(
199
- 'id' => $datarow['id']
200
- ),
201
- '%s',
202
- '%d'
203
- );
204
 
205
- } else if ( $datarow['active'] == 0 ) {
206
- $wpdb->update(
207
- WPSC_TABLE_PRODUCT_CATEGORIES,
208
- array(
209
- 'nice-name' => ''
210
- ),
211
- array(
212
- 'id' => $datarow['id']
213
- ),
214
- '%s',
215
- '%d'
216
- );
 
 
217
  }
218
  }
219
- $wp_rewrite->flush_rules();
220
  $sendback = wp_get_referer();
221
-
222
  if ( isset( $updated ) ) {
223
  $sendback = add_query_arg( 'updated', $updated, $sendback );
224
  }
225
- if ( isset( $_SESSION['wpsc_settings_curr_page'] ) ) {
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
+ function wpsc_ajax_add_tracking() {
12
+ global $wpdb;
13
+ foreach ( $_POST as $key => $value ) {
14
+ $parts = preg_split( '/^wpsc_trackingid/', $key );
15
+ if ( count( $parts ) > '1' ) {
16
+ $id = $parts[1];
17
+ $trackingid = $value;
18
+ $sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `track_id`='" . $trackingid . "' WHERE `id`=" . $id;
19
+ $wpdb->query( $sql );
20
+ }
21
 
 
 
22
  }
23
+ }
24
+
25
+ if ( isset( $_REQUEST['submit'] ) && ($_REQUEST['submit'] == 'Add Tracking ID') ) {
26
+ add_action( 'admin_init', 'wpsc_ajax_add_tracking' );
27
+ }
28
+
29
+ function wpsc_purchlog_email_trackid() {
30
+ global $wpdb;
31
+ $id = absint( $_POST['purchlog_id'] );
32
+ $trackingid = $wpdb->get_var( "SELECT `track_id` FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE `id`={$id} LIMIT 1" );
33
+
34
+ $message = get_option( 'wpsc_trackingid_message' );
35
+ $message = str_replace( '%trackid%', $trackingid, $message );
36
+ $message = str_replace( '%shop_name%', get_option( 'blogname' ), $message );
37
+
38
+ $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" );
39
+ $email = $wpdb->get_var( "SELECT `value` FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id`=" . $id . " AND `form_id` = '$email_form_field' LIMIT 1" );
40
+
41
+
42
+ $subject = get_option( 'wpsc_trackingid_subject' );
43
+ $subject = str_replace( '%shop_name%', get_option( 'blogname' ), $subject );
44
+
45
+ add_filter( 'wp_mail_from', 'wpsc_replace_reply_address', 0 );
46
+ add_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name', 0 );
47
+
48
+ wp_mail( $email, $subject, $message);
49
+
50
+ remove_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name' );
51
+ remove_filter( 'wp_mail_from', 'wpsc_replace_reply_address' );
52
+
53
+ exit( true );
54
+ }
55
+
56
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'purchlog_email_trackid') ) {
57
+ add_action( 'admin_init', 'wpsc_purchlog_email_trackid' );
58
+ }
59
+
60
+ function wpsc_ajax_sales_quarterly() {
61
+ $lastdate = $_POST['add_start'];
62
+ $date = preg_split( '/-/', $lastdate );
63
+ if ( !isset( $date[0] ) )
64
+ $date[0] = 0;
65
+ if ( !isset( $date[1] ) )
66
+ $date[1] = 0;
67
+ if ( !isset( $date[2] ) )
68
+ $date[2] = 0;
69
+ $lastquart = mktime( 0, 0, 0, $date[1], $date[2], $date[0] );
70
+ if ( $lastquart != get_option( 'wpsc_last_quarter' ) ) {
71
+ update_option( 'wpsc_last_date', $lastdate );
72
+ update_option( 'wpsc_fourth_quart', $lastquart );
73
+ $thirdquart = mktime( 0, 0, 0, $date[1] - 3, $date[2], $date[0] );
74
+ update_option( 'wpsc_third_quart', $thirdquart );
75
+ $secondquart = mktime( 0, 0, 0, $date[1] - 6, $date[2], $date[0] );
76
+ update_option( 'wpsc_second_quart', $secondquart );
77
+ $firstquart = mktime( 0, 0, 0, $date[1] - 9, $date[2], $date[0] );
78
+ update_option( 'wpsc_first_quart', $firstquart );
79
+ $finalquart = mktime( 0, 0, 0, $date[1], $date[2], $date[0] - 1 );
80
+ update_option( 'wpsc_final_quart', $finalquart );
81
+ }
82
+ }
83
+
84
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'wpsc_quarterly') ) {
85
+ add_action( 'admin_init', 'wpsc_ajax_sales_quarterly' );
86
+ }
87
+
88
+
89
+ function wpsc_delete_file() {
90
+ global $wpdb;
91
+ $output = 0;
92
+ $row_number = absint( $_GET['row_number'] );
93
+ $product_id = absint( $_GET['product_id'] );
94
+ $file_name = basename( $_GET['file_name'] );
95
+ check_admin_referer( 'delete_file_' . $file_name );
96
+
97
+ $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 );
98
+ $product_id_to_delete = $wpdb->get_var( $sql );
99
+
100
+ wp_delete_post( $product_id_to_delete, true );
101
+
102
+ if ( $_POST['ajax'] !== 'true' ) {
103
+ $sendback = wp_get_referer();
104
+ wp_redirect( $sendback );
105
+ }
106
+
107
+ echo "jQuery('#select_product_file_row_$row_number').fadeOut('fast',function() {\n";
108
+ echo " jQuery(this).remove();\n";
109
+ echo " jQuery('div.select_product_file p:even').removeClass('alt');\n";
110
+ echo " jQuery('div.select_product_file p:odd').addClass('alt');\n";
111
+ echo "});\n";
112
+
113
+ exit( "" );
114
+ }
115
+
116
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'delete_file') ) {
117
+ add_action( 'admin_init', 'wpsc_delete_file' );
118
+ }
119
+
120
+ /**
121
+ * Function and action for publishing or unpublishing single products
122
+ */
123
+ function wpsc_ajax_toggle_published() {
124
+ $product_id = absint( $_GET['product'] );
125
+ check_admin_referer( 'toggle_publish_' . $product_id );
126
+
127
+ $status = (wpsc_toggle_publish_status( $product_id )) ? ('true') : ('false');
128
+ $sendback = add_query_arg( 'flipped', "1", wp_get_referer() );
129
+ wp_redirect( $sendback );
130
+ exit();
131
+ }
132
+
133
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'toggle_publish') ) {
134
+ add_action( 'admin_init', 'wpsc_ajax_toggle_published' );
135
+ }
136
+
137
+ /**
138
+ * Function and action for duplicating products,
139
+ * Refactored for 3.8
140
+ * Purposely not duplicating stick post status (logically, products are most often duplicated because they share many attributes, where products are generally 'featured' uniquely.)
141
+ */
142
+ function wpsc_duplicate_product() {
143
+
144
+ // Get the original post
145
+ $id = absint( $_GET['product'] );
146
+ $post = get_post( $id );
147
+
148
+ // Copy the post and insert it
149
+ if ( isset( $post ) && $post != null ) {
150
+ $new_id = wpsc_duplicate_product_process( $post );
151
+
152
+ $duplicated = true;
153
+ $sendback = wp_get_referer();
154
+ $sendback = add_query_arg( 'duplicated', (int)$duplicated, $sendback );
155
+
156
+ wp_redirect( $sendback );
157
+ exit();
158
+ } else {
159
+ 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: ' ) . $id );
160
+ }
161
+ }
162
+
163
+ function wpsc_duplicate_product_process( $post, $new_parent_id = false ) {
164
+ $new_post_date = $post->post_date;
165
+ $new_post_date_gmt = get_gmt_from_date( $new_post_date );
166
+
167
+ $new_post_type = $post->post_type;
168
+ $post_content = str_replace( "'", "''", $post->post_content );
169
+ $post_content_filtered = str_replace( "'", "''", $post->post_content_filtered );
170
+ $post_excerpt = str_replace( "'", "''", $post->post_excerpt );
171
+ $post_title = str_replace( "'", "''", $post->post_title ) . " (Duplicate)";
172
+ $post_name = str_replace( "'", "''", $post->post_name );
173
+ $comment_status = str_replace( "'", "''", $post->comment_status );
174
+ $ping_status = str_replace( "'", "''", $post->ping_status );
175
+
176
+ $defaults = array(
177
+ 'post_status' => $post->post_status,
178
+ 'post_type' => $new_post_type,
179
+ 'ping_status' => $ping_status,
180
+ 'post_parent' => $new_parent_id ? $new_parent_id : $post->post_parent,
181
+ 'menu_order' => $post->menu_order,
182
+ 'to_ping' => $post->to_ping,
183
+ 'pinged' => $post->pinged,
184
+ 'post_excerpt' => $post_excerpt,
185
+ 'post_title' => $post_title,
186
+ 'post_content' => $post_content,
187
+ 'post_content_filtered' => $post_content_filtered,
188
+ 'import_id' => 0
189
+ );
190
+
191
+ // Insert the new template in the post table
192
+ $new_post_id = wp_insert_post($defaults);
193
+
194
+ // Copy the taxonomies
195
+ wpsc_duplicate_taxonomies( $post->ID, $new_post_id, $post->post_type );
196
+
197
+ // Copy the meta information
198
+ wpsc_duplicate_product_meta( $post->ID, $new_post_id );
199
+
200
+ // Finds children (Which includes product files AND product images), their meta values, and duplicates them.
201
+ wpsc_duplicate_children( $post->ID, $new_post_id );
202
+
203
+ return $new_post_id;
204
+ }
205
+
206
+ /**
207
+ * Copy the taxonomies of a post to another post
208
+ */
209
+ function wpsc_duplicate_taxonomies( $id, $new_id, $post_type ) {
210
+ $taxonomies = get_object_taxonomies( $post_type ); //array("category", "post_tag");
211
+ foreach ( $taxonomies as $taxonomy ) {
212
+ $post_terms = wp_get_object_terms( $id, $taxonomy );
213
+ for ( $i = 0; $i < count( $post_terms ); $i++ ) {
214
+ wp_set_object_terms( $new_id, $post_terms[$i]->slug, $taxonomy, true );
215
+ }
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Copy the meta information of a post to another post
221
+ */
222
+ function wpsc_duplicate_product_meta( $id, $new_id ) {
223
+ global $wpdb;
224
+ $post_meta_infos = $wpdb->get_results( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$id" );
225
+
226
+ if ( count( $post_meta_infos ) != 0 ) {
227
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
228
+ $values = array();
229
+ foreach ( $post_meta_infos as $meta_info ) {
230
+ $meta_key = $meta_info->meta_key;
231
+ $meta_value = addslashes( $meta_info->meta_value );
232
+
233
+ $sql_query_sel[] = "( $new_id, '$meta_key', '$meta_value' )";
234
+ $values[] = $new_id;
235
+ $values[] = $meta_key;
236
+ $values[] = $meta_value;
237
+ $values += array( $new_id, $meta_key, $meta_value );
238
+ }
239
+ $sql_query.= implode( ",", $sql_query_sel );
240
+ $sql_query = $wpdb->prepare( $sql_query, $values );
241
+ $wpdb->query( $sql_query );
242
+ }
243
+ }
244
+
245
+ /**
246
+ * Duplicates children product and children meta
247
+ */
248
+ function wpsc_duplicate_children( $old_parent_id, $new_parent_id ) {
249
+ global $wpdb;
250
+
251
+ //Get children products and duplicate them
252
+ $child_posts = get_posts( array(
253
+ 'post_parent' => $old_parent_id,
254
+ 'post_type' => 'any',
255
+ 'post_status' => 'any',
256
+ 'numberposts' => -1,
257
+ ) );
258
+
259
+ foreach ( $child_posts as $child_post ) {
260
+ wpsc_duplicate_product_process( $child_post, $new_parent_id );
261
+ }
262
+ }
263
+
264
+ function wpsc_purchase_log_csv() {
265
+ global $wpdb, $wpsc_gateways;
266
+ get_currentuserinfo();
267
+ $count = 0;
268
+ if ( ($_GET['rss_key'] == 'key') && is_numeric( $_GET['start_timestamp'] ) && is_numeric( $_GET['end_timestamp'] ) && current_user_can( 'manage_options' ) ) {
269
+ $form_sql = "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `type` != 'heading' ORDER BY `checkout_order` DESC;";
270
+ $form_data = $wpdb->get_results( $form_sql, ARRAY_A );
271
+
272
+ $start_timestamp = $_GET['start_timestamp'];
273
+ $end_timestamp = $_GET['end_timestamp'];
274
+ $data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date` BETWEEN '$start_timestamp' AND '$end_timestamp' ORDER BY `date` DESC", ARRAY_A );
275
+ $csv = 'Purchase ID, Price, Firstname, Lastname, Email, Order Status, Data, ';
276
+ header( 'Content-Type: text/csv' );
277
+ header( 'Content-Disposition: inline; filename="Purchase Log ' . date( "M-d-Y", $start_timestamp ) . ' to ' . date( "M-d-Y", $end_timestamp ) . '.csv"' );
278
+ $headers = "\"Purchase ID\",\"Purchase Total\","; //capture the headers
279
+
280
+ $headers2 ="\"Payment Gateway\",";
281
+ $headers2 .="\"Payment Status\",\"Purchase Date\",";
282
+
283
+
284
+ foreach ( (array)$data as $purchase ) {
285
+ $form_headers = '';
286
+ $output .= "\"" . $purchase['id'] . "\","; //Purchase ID
287
+ $output .= "\"" . $purchase['totalprice'] . "\","; //Purchase Total
288
+ foreach ( (array)$form_data as $form_field ) {
289
+ $form_headers .="\"".$form_field['unique_name']."\",";
290
+ $collected_data_sql = "SELECT * FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` = '" . $purchase['id'] . "' AND `form_id` = '" . $form_field['id'] . "' LIMIT 1";
291
+ $collected_data = $wpdb->get_results( $collected_data_sql, ARRAY_A );
292
+ $collected_data = $collected_data[0];
293
+ $output .= "\"" . $collected_data['value'] . "\","; // get form fields
294
+ }
295
+
296
+ $output .= "\"" . $wpsc_gateways[$purchase['gateway']]['display_name'] . "\","; //get gateway name
297
+
298
+
299
+ $status_name = wpsc_find_purchlog_status_name( $purchase['processed'] );
300
+
301
+ $output .= "\"" . $status_name . "\","; //get purchase status
302
+ $output .= "\"" . date( "jS M Y", $purchase['date'] ) . "\","; //date
303
+
304
+ $cartsql = "SELECT `prodid`, `quantity`, `name` FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`=" . $purchase['id'] . "";
305
+ $cart = $wpdb->get_results( $cartsql, ARRAY_A );
306
+
307
+ if($count < count($cart))
308
+ $count = count($cart);
309
+ // Go through all products in cart and display quantity and sku
310
+ foreach ( (array)$cart as $item ) {
311
+ $skuvalue = get_product_meta($item['prodid'], 'sku', true);
312
+ if(empty($skuvalue)) $skuvalue = __('N/A', 'wpsc');
313
+ $output .= "\"" . $item['quantity'] . " x " . str_replace( '"', '\"', $item['name'] ) . "\"";
314
+ $output .= "," . $skuvalue."," ;
315
+ }
316
+ $output .= "\n"; // terminates the row/line in the CSV file
317
+ }
318
+ // Get the most number of products and create a header for them
319
+ $headers3 = "";
320
+ for($i = 0; $i < $count ;$i++){
321
+ $headers3 .= "\"Quantity - Product Name \", \" SKU \"";
322
+ if($i < ($count-1))
323
+ $headers3 .= ",";
324
+ }
325
+
326
+ echo $headers . $form_headers . $headers2 . $headers3 . "\n". $output;
327
+ exit();
328
+ }
329
+ }
330
+
331
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'wpsc_downloadcsv') ) {
332
+ add_action( 'admin_init', 'wpsc_purchase_log_csv' );
333
+ }
334
 
335
+ function wpsc_admin_ajax() {
336
  global $wpdb;
337
 
338
  if ( isset( $_POST['action'] ) && $_POST['action'] == 'product-page-order' ) {
363
  exit();
364
  }
365
 
366
+ if ( isset( $_POST['remove_form_field'] ) && $_POST['remove_form_field'] == "true" && is_numeric( $_POST['form_id'] ) ) {
367
+ if ( current_user_can( 'manage_options' ) ) {
368
+ $wpdb->query( $wpdb->prepare( "UPDATE `" . WPSC_TABLE_CHECKOUT_FORMS . "` SET `active` = '0' WHERE `id` = %d LIMIT 1 ;", $_POST['form_id'] ) );
369
+ exit( ' ' );
370
+ }
371
+ }
372
+
373
+
374
+ if ( isset( $_POST['hide_ecom_dashboard'] ) && $_POST['hide_ecom_dashboard'] == 'true' ) {
375
+ require_once (ABSPATH . WPINC . '/rss.php');
376
+ $rss = fetch_rss( 'http://www.instinct.co.nz/feed/' );
377
+ $rss->items = array_slice( $rss->items, 0, 5 );
378
+ $rss_hash = sha1( serialize( $rss->items ) );
379
+ update_option( 'wpsc_ecom_news_hash', $rss_hash );
380
+ exit( 1 );
381
+ }
382
+
383
+ if ( isset( $_POST['remove_meta'] ) && $_POST['remove_meta'] == 'true' && is_numeric( $_POST['meta_id'] ) ) {
384
+ $meta_id = (int)$_POST['meta_id'];
385
+ if ( delete_meta( $meta_id ) ) {
386
+ echo $meta_id;
387
+ exit();
388
+ }
389
+ echo 0;
390
+ exit();
391
+ }
392
+
393
  if ( isset( $_REQUEST['log_state'] ) && $_REQUEST['log_state'] == "true" && is_numeric( $_POST['id'] ) && is_numeric( $_POST['value'] ) ) {
394
  $newvalue = $_POST['value'];
395
  if ( $_REQUEST['suspend'] == 'true' ) {
401
  exit();
402
  } else {
403
 
404
+ $log_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '" . $_POST['id'] . "' LIMIT 1", ARRAY_A );
405
  if ( ($newvalue == 2) && function_exists( 'wpsc_member_activate_subscriptions' ) ) {
406
  wpsc_member_activate_subscriptions( $_POST['id'] );
407
  }
408
 
409
+ $update_sql = "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET `processed` = '" . $newvalue . "' WHERE `id` = '" . $_POST['id'] . "' LIMIT 1";
410
+ $wpdb->query( $update_sql );
411
  if ( ($newvalue > $log_data['processed']) && ($log_data['processed'] < 2) ) {
412
  transaction_results( $log_data['sessionid'], false );
413
  }
428
  }
429
  }
430
 
431
+ function wpsc_admin_sale_rss() {
432
+ global $wpdb;
433
+ if ( ($_GET['rss'] == "true") && ($_GET['rss_key'] == 'key') && ($_GET['action'] == "purchase_log") ) {
434
+ $sql = "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `date`!='' ORDER BY `date` DESC";
435
+ $purchase_log = $wpdb->get_results( $sql, ARRAY_A );
436
+ header( "Content-Type: application/xml; charset=UTF-8" );
437
+ header( 'Content-Disposition: inline; filename="WP_E-Commerce_Purchase_Log.rss"' );
438
+ $output = '';
439
+ $output .= "<?xml version='1.0'?>\n\r";
440
+ $output .= "<rss version='2.0'>\n\r";
441
+ $output .= " <channel>\n\r";
442
+ $output .= " <title>WP e-Commerce Product Log</title>\n\r";
443
+ $output .= " <link>" . get_option( 'siteurl' ) . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php</link>\n\r";
444
+ $output .= " <description>This is the WP e-Commerce Product Log RSS feed</description>\n\r";
445
+ $output .= " <generator>WP e-Commerce Plugin</generator>\n\r";
446
 
447
+ foreach ( (array)$purchase_log as $purchase ) {
448
+ $purchase_link = get_option( 'siteurl' ) . "/wp-admin/admin.php?page=" . WPSC_DIR_NAME . "/display-log.php&amp;purchaseid=" . $purchase['id'];
449
+ $output .= " <item>\n\r";
450
+ $output .= " <title>Purchase # " . $purchase['id'] . "</title>\n\r";
451
+ $output .= " <link>$purchase_link</link>\n\r";
452
+ $output .= " <description>This is an entry in the purchase log.</description>\n\r";
453
+ $output .= " <pubDate>" . date( "r", $purchase['date'] ) . "</pubDate>\n\r";
454
+ $output .= " <guid>$purchase_link</guid>\n\r";
455
+ $output .= " </item>\n\r";
456
  }
457
+ $output .= " </channel>\n\r";
458
+ $output .= "</rss>";
459
+ echo $output;
460
+ exit();
461
  }
462
  }
463
+
464
+ function wpsc_display_invoice() {
465
+ $purchase_id = (int)$_GET['purchaselog_id'];
466
+ add_action('wpsc_packing_slip', 'wpsc_packing_slip');
467
+ do_action('wpsc_before_packing_slip', $purchase_id);
468
+ do_action('wpsc_packing_slip', $purchase_id);
469
+ exit();
470
+ }
471
+ //other actions are here
472
+ if ( isset( $_GET['display_invoice'] ) && ( 'true' == $_GET['display_invoice'] ) )
473
+ add_action( 'admin_init', 'wpsc_display_invoice', 0 );
474
+
475
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc_display_invoice' == $_REQUEST['wpsc_admin_action'] ) )
476
+ add_action( 'admin_init', 'wpsc_display_invoice' );
477
 
478
  /**
479
+ * Purchase log ajax code starts here
 
480
  */
481
+ function wpsc_purchlog_resend_email() {
482
+ global $wpdb;
483
+ $log_id = $_GET['email_buyer_id'];
484
+ $wpec_taxes_controller = new wpec_taxes_controller();
485
+ if ( is_numeric( $log_id ) ) {
486
+ $selectsql = "SELECT `sessionid` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`= " . $log_id . " LIMIT 1";
487
+ $purchase_log = $wpdb->get_var( $selectsql );
488
+ transaction_results( $purchase_log, false);
489
+ $sent = true;
490
  }
491
+ $sendback = wp_get_referer();
492
+ if ( isset( $sent ) ) {
493
+ $sendback = add_query_arg( 'sent', $sent, $sendback );
494
+ }
495
+ wp_redirect( $sendback );
496
+ exit();
497
+ }
498
+
499
+ if ( isset( $_REQUEST['email_buyer_id'] ) && is_numeric( $_REQUEST['email_buyer_id'] ) ) {
500
+ add_action( 'admin_init', 'wpsc_purchlog_resend_email' );
501
+ }
502
 
503
+ function wpsc_purchlog_clear_download_items() {
504
  global $wpdb;
505
+ if ( is_numeric( $_GET['purchaselog_id'] ) ) {
506
+ $purchase_id = (int)$_GET['purchaselog_id'];
507
+ $downloadable_items = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `purchid` IN ('$purchase_id')", ARRAY_A );
508
 
509
+ $clear_locks_sql = "UPDATE`" . WPSC_TABLE_DOWNLOAD_STATUS . "` SET `ip_number` = '' WHERE `purchid` IN ('$purchase_id')";
510
+ $wpdb->query( $clear_locks_sql );
511
+ $cleared = true;
512
+
513
+ $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" );
514
+ $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" );
515
+
516
+ foreach ( (array)$downloadable_items as $downloadable_item ) {
517
+ $download_links .= $siteurl . "?downloadid=" . $downloadable_item['uniqueid'] . "\n";
 
 
 
 
 
 
 
 
518
  }
 
 
 
 
 
 
 
 
519
 
 
 
 
 
 
 
 
 
 
 
520
 
521
+ 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' ) . "" );
522
+
523
+
524
+ $sendback = wp_get_referer();
525
+
526
+ if ( isset( $cleared ) ) {
527
+ $sendback = add_query_arg( 'cleared', $cleared, $sendback );
528
+ }
529
+ wp_redirect( $sendback );
530
+ exit();
531
  }
532
+ }
533
 
534
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clear_locks') ) {
535
+ add_action( 'admin_init', 'wpsc_purchlog_clear_download_items' );
536
+ }
 
 
 
 
 
 
537
 
538
+ //call to change view for purchase log
 
539
 
540
+ function wpsc_purchlog_filter_by() {
541
+ wpsc_change_purchlog_view( $_POST['view_purchlogs_by'], $_POST['view_purchlogs_by_status'] );
542
+ }
543
 
544
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'purchlog_filter_by') ) {
545
+ add_action( 'admin_init', 'wpsc_purchlog_filter_by' );
546
+ }
 
 
 
 
 
 
 
 
547
 
548
+ //bulk actions for purchase log
549
+ function wpsc_purchlog_bulk_modify() {
550
+ if ( $_POST['purchlog_multiple_status_change'] != -1 ) {
551
+ if ( is_numeric( $_POST['purchlog_multiple_status_change'] ) && $_POST['purchlog_multiple_status_change'] != 'delete' ) {
552
+ foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
553
+ wpsc_purchlog_edit_status( $purchlogid, $_POST['purchlog_multiple_status_change'] );
554
+ $updated++;
555
+ }
556
+ } elseif ( $_POST['purchlog_multiple_status_change'] == 'delete' ) {
557
+ foreach ( (array)$_POST['purchlogids'] as $purchlogid ) {
558
+
559
+ wpsc_delete_purchlog( $purchlogid );
560
+ $deleted++;
561
+ }
562
  }
563
  }
 
564
  $sendback = wp_get_referer();
 
565
  if ( isset( $updated ) ) {
566
  $sendback = add_query_arg( 'updated', $updated, $sendback );
567
  }
568
+ if ( isset( $deleted ) ) {
569
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
570
+ }
571
+ if ( isset( $_POST['view_purchlogs_by'] ) ) {
572
+ $sendback = add_query_arg( 'view_purchlogs_by', $_POST['view_purchlogs_by'], $sendback );
573
+ }
574
+ if ( isset( $_POST['view_purchlogs_by_status'] ) ) {
575
+ $sendback = add_query_arg( 'view_purchlogs_by_status', $_POST['view_purchlogs_by_status'], $sendback );
576
  }
 
577
  wp_redirect( $sendback );
 
578
  exit();
579
  }
 
 
580
 
581
+ if ( isset( $_REQUEST['wpsc_admin_action2'] ) && ($_REQUEST['wpsc_admin_action2'] == 'purchlog_bulk_modify') ) {
582
+ add_action( 'admin_init', 'wpsc_purchlog_bulk_modify' );
583
+ }
584
+
585
+ //edit purchase log status function
586
+ function wpsc_purchlog_edit_status( $purchlog_id='', $purchlog_status='' ) {
587
+ global $wpdb;
588
+ if ( empty($purchlog_id) && empty($purchlog_status) ) {
589
+ $purchlog_id = absint( $_POST['purchlog_id'] );
590
+ $purchlog_status = absint( $_POST['purchlog_status'] );
591
+ }
592
+
593
+ $log_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = '{$purchlog_id}' LIMIT 1", ARRAY_A );
594
+ $is_transaction = wpsc_check_purchase_processed($log_data['processed']);
595
+ if ( $is_transaction && function_exists('wpsc_member_activate_subscriptions')) {
596
+ wpsc_member_activate_subscriptions( $_POST['id'] );
597
+ }
598
+
599
+ //in the future when everyone is using the 2.0 merchant api, we should use the merchant class to update the staus,
600
+ // then you can get rid of this hook and have each person overwrite the method that updates the status.
601
+ do_action('wpsc_edit_order_status', array('purchlog_id'=>$purchlog_id, 'purchlog_data'=>$log_data, 'new_status'=>$purchlog_status));
602
+
603
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET processed='{$purchlog_status}' WHERE id='{$purchlog_id}'" );
604
+
605
+ wpsc_clear_stock_claims();
606
+ wpsc_decrement_claimed_stock($purchlog_id);
607
+
608
+ if ( $purchlog_status == 3 )
609
+ transaction_results($log_data['sessionid'],false,null);
610
+ }
611
+
612
+ add_action( 'wp_ajax_purchlog_edit_status', 'wpsc_purchlog_edit_status' );
613
+
614
+ function wpsc_save_product_order() {
615
+ global $wpdb;
616
+
617
+ $products = array( );
618
+ foreach ( $_POST['post'] as $product ) {
619
+ $products[] = absint( $product );
620
+ }
621
+
622
+ print_r( $products );
623
+
624
+ foreach ( $products as $order => $product_id ) {
625
+
626
+ $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->posts}` SET `menu_order`='%d' WHERE `ID`='%d' LIMIT 1", $order, $product_id ) );
627
+ }
628
+ $success = true;
629
+
630
+ exit( (string)$success );
631
+ }
632
+
633
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'save_product_order') ) {
634
+ add_action( 'admin_init', 'wpsc_save_product_order' );
635
+ }
636
+
637
+ function wpsc_save_checkout_order() {
638
+ global $wpdb;
639
+ $checkoutfields = $_POST['checkout'];
640
+ $order = 1;
641
+ foreach ( $checkoutfields as $checkoutfield ) {
642
+ $checkoutfield = absint( $checkoutfield );
643
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_CHECKOUT_FORMS . "` SET `checkout_order` = '" . $order . "' WHERE `id`=" . $checkoutfield );
644
 
645
+ $order++;
646
+ }
647
+ $success = true;
648
+
649
+ exit( (string)$success );
650
+ }
651
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'save_checkout_order') )
652
+ add_action( 'admin_init', 'wpsc_save_checkout_order' );
653
+
654
+ /* Start Order Notes (by Ben) */
655
+ function wpsc_purchlogs_update_notes( $purchlog_id = '', $purchlog_notes = '' ) {
656
+ global $wpdb;
657
+ if ( wp_verify_nonce( $_POST['wpsc_purchlogs_update_notes_nonce'], 'wpsc_purchlogs_update_notes' ) ) {
658
+ if ( ($purchlog_id == '') && ($purchlog_notes == '') ) {
659
+ $purchlog_id = absint( $_POST['purchlog_id'] );
660
+ $purchlog_notes = $wpdb->escape( $_POST['purchlog_notes'] );
661
+ }
662
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_PURCHASE_LOGS . "` SET notes='{$purchlog_notes}' WHERE id='{$purchlog_id}'" );
663
+ }
664
+ }
665
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'purchlogs_update_notes' ) )
666
+ add_action( 'admin_init', 'wpsc_purchlogs_update_notes' );
667
+
668
+ /* End Order Notes (by Ben) */
669
+
670
+ //delete a purchase log
671
+ function wpsc_delete_purchlog( $purchlog_id='' ) {
672
+ global $wpdb;
673
+ $deleted = 0;
674
+ if ( $purchlog_id == '' ) {
675
+ $purchlog_id = absint( $_GET['purchlog_id'] );
676
+ check_admin_referer( 'delete_purchlog_' . $purchlog_id );
677
+ }
678
+
679
+ if ( is_numeric( $purchlog_id ) ) {
680
+ $delete_log_form_sql = "SELECT * FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='$purchlog_id'";
681
+ $cart_content = $wpdb->get_results( $delete_log_form_sql, ARRAY_A );
682
+ }
683
+
684
+ $purchlog_status = $wpdb->get_var( "SELECT `processed` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`=" . $purchlog_id );
685
+ if ( $purchlog_status == 5 || $purchlog_status == 1 ) {
686
+ $wpdb->query( "DELETE FROM `" . WPSC_TABLE_CLAIMED_STOCK . "` WHERE `cart_id` = '{$purchlog_id}' AND `cart_submitted` = '1'" );
687
+ }
688
+
689
+ $wpdb->query( "DELETE FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid`='$purchlog_id'" );
690
+ $wpdb->query( "DELETE FROM `" . WPSC_TABLE_SUBMITED_FORM_DATA . "` WHERE `log_id` IN ('$purchlog_id')" );
691
+ $wpdb->query( "DELETE FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`='$purchlog_id' LIMIT 1" );
692
+
693
+ $deleted = 1;
694
+
695
+ if ( is_numeric( $_GET['purchlog_id'] ) ) {
696
+ $sendback = wp_get_referer();
697
+ $sendback = esc_url( remove_query_arg( 'purchaselog_id', $sendback ) );
698
+ if ( isset( $deleted ) ) {
699
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
700
+ }
701
+ wp_redirect( $sendback );
702
+ exit();
703
+ }
704
+ }
705
+
706
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'delete_purchlog') ) {
707
+ add_action( 'admin_init', 'wpsc_delete_purchlog' );
708
+ }
709
+
710
+ /*
711
+ * Get Shipping Form ajax call
712
+ */
713
+
714
+ function wpsc_ajax_get_shipping_form() {
715
+ $shippingname = $_REQUEST['shippingname'];
716
+ $_SESSION['previous_shipping_name'] = $shippingname;
717
+ $shipping_data = wpsc_get_shipping_form( $shippingname );
718
+ $html_shipping_name = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $shipping_data['name'] ) );
719
+ $shipping_form = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $shipping_data['form_fields'] ) );
720
+ echo "shipping_name_html = '$html_shipping_name'; \n\r";
721
+ echo "shipping_form_html = '$shipping_form'; \n\r";
722
+ echo "has_submit_button = '{$shipping_data['has_submit_button']}'; \n\r";
723
+ exit();
724
+ }
725
+
726
+ function wpsc_ajax_get_payment_form() {
727
+ $paymentname = $_REQUEST['paymentname'];
728
+ $_SESSION['previous_payment_name'] = $paymentname;
729
+ $payment_data = wpsc_get_payment_form( $paymentname );
730
+ $html_payment_name = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $payment_data['name'] ) );
731
+ $payment_form = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $payment_data['form_fields'] ) );
732
+ echo "payment_name_html = '$html_payment_name'; \n\r";
733
+ echo "payment_form_html = '$payment_form'; \n\r";
734
+ echo "has_submit_button = '{$payment_data['has_submit_button']}'; \n\r";
735
+ exit();
736
+ }
737
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'get_shipping_form') )
738
+ add_action( 'admin_init', 'wpsc_ajax_get_shipping_form' );
739
+
740
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'get_payment_form') )
741
+ add_action( 'admin_init', 'wpsc_ajax_get_payment_form' );
742
+
743
+
744
+ /*
745
+ * Submit Options from Settings Pages,
746
+ * takes an array of options checks to see whether it is empty or the same as the exisiting values
747
+ * and if its not it updates them.
748
+ */
749
+
750
+ function wpsc_submit_options( $selected='' ) {
751
+ global $wpdb, $wpsc_gateways;
752
+ $updated = 0;
753
+
754
+ //This is to change the Overall target market selection
755
+ check_admin_referer( 'update-options', 'wpsc-update-options' );
756
+ if ( isset( $_POST['change-settings'] ) ) {
757
+ if ( isset( $_POST['wpsc_also_bought'] ) && $_POST['wpsc_also_bought'] == 'on' )
758
+ update_option( 'wpsc_also_bought', 1 );
759
+ else
760
+ update_option( 'wpsc_also_bought', 0 );
761
+
762
+ if ( isset( $_POST['display_find_us'] ) && $_POST['display_find_us'] == 'on' )
763
+ update_option( 'display_find_us', 1 );
764
+ else
765
+ update_option( 'display_find_us', 0 );
766
+
767
+ if ( isset( $_POST['wpsc_share_this'] ) && $_POST['wpsc_share_this'] == 'on' )
768
+ update_option( 'wpsc_share_this', 1 );
769
+ else
770
+ update_option( 'wpsc_share_this', 0 );
771
+
772
+ }
773
+ if (empty($_POST['countrylist2']) && !empty($_POST['wpsc_options']['currency_sign_location']))
774
+ $selected = 'none';
775
+
776
+ if ( !isset( $_POST['countrylist2'] ) )
777
+ $_POST['countrylist2'] = '';
778
+ if ( !isset( $_POST['country_id'] ) )
779
+ $_POST['country_id'] = '';
780
+ if ( !isset( $_POST['country_tax'] ) )
781
+ $_POST['country_tax'] = '';
782
+
783
+ if ( $_POST['countrylist2'] != null || !empty($selected) ) {
784
+ $AllSelected = false;
785
+ if ( $selected == 'all' ) {
786
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = '1'" );
787
+ $AllSelected = true;
788
+ }
789
+ if ( $selected == 'none' ) {
790
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = '0'" );
791
+ $AllSelected = true;
792
+ }
793
+ if ( $AllSelected != true ) {
794
+ $countrylist = $wpdb->get_col( "SELECT id FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC " );
795
+ //find the countries not selected
796
+ $unselectedCountries = array_diff( $countrylist, $_POST['countrylist2'] );
797
+ foreach ( $unselectedCountries as $unselected ) {
798
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = 0 WHERE id = '" . $unselected . "' LIMIT 1" );
799
+ }
800
+
801
+ //find the countries that are selected
802
+ $selectedCountries = array_intersect( $countrylist, $_POST['countrylist2'] );
803
+ foreach ( $selectedCountries as $selected ) {
804
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = 1 WHERE id = '" . $selected . "' LIMIT 1" );
805
+ }
806
+ }
807
+ }
808
+ $previous_currency = get_option( 'currency_type' );
809
+
810
+ //To update options
811
+ if ( isset( $_POST['wpsc_options'] ) ) {
812
+ // make sure stock keeping time is a number
813
+ if ( isset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] ) ) {
814
+ $skt =& $_POST['wpsc_options']['wpsc_stock_keeping_time']; // I hate repeating myself
815
+ $skt = (float) $skt;
816
+ if ( $skt <= 0 || ( $skt < 1 && $_POST['wpsc_options']['wpsc_stock_keeping_interval'] == 'hour' ) ) {
817
+ unset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] );
818
+ unset( $_POST['wpsc_options']['wpsc_stock_keeping_interval'] );
819
+ }
820
+ }
821
+
822
+ foreach ( $_POST['wpsc_options'] as $key => $value ) {
823
+ if ( $value != get_option( $key ) ) {
824
+ update_option( $key, $value );
825
+ $updated++;
826
+
827
+ }
828
+ }
829
+ }
830
+
831
+ if ( $previous_currency != get_option( 'currency_type' ) ) {
832
+ $currency_code = $wpdb->get_var( "SELECT `code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id` IN ('" . absint( get_option( 'currency_type' ) ) . "')" );
833
+
834
+ $selected_gateways = get_option( 'custom_gateway_options' );
835
+ $already_changed = array( );
836
+ foreach ( $selected_gateways as $selected_gateway ) {
837
+ if ( isset( $wpsc_gateways[$selected_gateway]['supported_currencies'] ) ) {
838
+ if ( in_array( $currency_code, $wpsc_gateways[$selected_gateway]['supported_currencies']['currency_list'] ) ) {
839
+
840
+ $option_name = $wpsc_gateways[$selected_gateway]['supported_currencies']['option_name'];
841
+
842
+ if ( !in_array( $option_name, $already_changed ) ) {
843
+ update_option( $option_name, $currency_code );
844
+ $already_changed[] = $option_name;
845
+ }
846
+ }
847
+ }
848
+ }
849
+ }
850
+
851
+ foreach ( $GLOBALS['wpsc_shipping_modules'] as $shipping ) {
852
+ if ( is_object( $shipping ) )
853
+ $shipping->submit_form();
854
+ }
855
+
856
+
857
+ //This is for submitting shipping details to the shipping module
858
+ if ( !isset( $_POST['update_gateways'] ) )
859
+ $_POST['update_gateways'] = '';
860
+ if ( !isset( $_POST['custom_shipping_options'] ) )
861
+ $_POST['custom_shipping_options'] = null;
862
+ if ( $_POST['update_gateways'] == 'true' ) {
863
+
864
+ update_option( 'custom_shipping_options', $_POST['custom_shipping_options'] );
865
+
866
+ $shipadd = 0;
867
+ foreach ( $GLOBALS['wpsc_shipping_modules'] as $shipping ) {
868
+ foreach ( (array)$_POST['custom_shipping_options'] as $shippingoption ) {
869
+ if ( $shipping->internal_name == $shippingoption ) {
870
+ $shipadd++;
871
+ }
872
+ }
873
+ }
874
+ }
875
+
876
+ $sendback = wp_get_referer();
877
+
878
+ if ( isset( $updated ) ) {
879
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
880
+ }
881
+ if ( isset( $shipadd ) ) {
882
+ $sendback = add_query_arg( 'shipadd', $shipadd, $sendback );
883
+ }
884
+
885
+ if ( !isset( $_SESSION['wpsc_settings_curr_page'] ) )
886
+ $_SESSION['wpsc_settings_curr_page'] = '';
887
+ if ( !isset( $_POST['page_title'] ) )
888
+ $_POST['page_title'] = '';
889
+ if ( isset( $_SESSION['wpsc_settings_curr_page'] ) ) {
890
+ $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
891
+ }
892
+
893
+ $sendback = add_query_arg( 'page', 'wpsc-settings', $sendback );
894
+ $sendback = esc_url( apply_filters( 'wpsc_settings_redirect_url', $sendback ) );
895
+ wp_redirect( $sendback );
896
+ exit();
897
+ }
898
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'submit_options') )
899
+ add_action( 'admin_init', 'wpsc_submit_options' );
900
+
901
+ add_action( 'update_option_product_category_hierarchical_url', 'wpsc_update_option_product_category_hierarchical_url' );
902
+
903
+ function wpsc_update_option_product_category_hierarchical_url() {
904
+ flush_rewrite_rules( false );
905
+ }
906
+
907
+ function wpsc_change_currency() {
908
+ if ( is_numeric( $_POST['currencyid'] ) ) {
909
+ $currency_data = $wpdb->get_results( "SELECT `symbol`,`symbol_html`,`code` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `id`='" . $_POST['currencyid'] . "' LIMIT 1", ARRAY_A );
910
+ $price_out = null;
911
+ if ( $currency_data[0]['symbol'] != '' ) {
912
+ $currency_sign = $currency_data[0]['symbol_html'];
913
+ } else {
914
+ $currency_sign = $currency_data[0]['code'];
915
+ }
916
+ echo $currency_sign;
917
+ }
918
+ }
919
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_currency') )
920
+ add_action( 'admin_init', 'wpsc_change_currency' );
921
+
922
+ function wpsc_rearrange_images() {
923
+ global $wpdb;
924
+ $images = explode( ",", $_POST['order'] );
925
+ $product_id = absint( $_POST['product_id'] );
926
+ $timestamp = time();
927
+
928
+ $new_main_image = null;
929
+ $have_set_first_item = false;
930
+ $i = 0;
931
+ foreach ( $images as $image ) {
932
+ if ( $image > 0 ) {
933
+ $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->posts}` SET `menu_order`='%d' WHERE `ID`='%d' LIMIT 1", $i, $image ) );
934
+ $i++;
935
+ }
936
+ }
937
+ $output = wpsc_main_product_image_menu( $product_id );
938
+ echo "image_menu = '';\n\r";
939
+ echo "image_id = '" . $new_main_image . "';\n\r";
940
+ exit();
941
+ }
942
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'rearrange_images') )
943
+ add_action( 'admin_init', 'wpsc_rearrange_images' );
944
+
945
+ /**
946
+ * wpsc_update_page_urls gets the permalinks for products pages and stores them in the options for quick reference
947
+ * @public
948
+ *
949
+ * @since 3.6
950
+ * @param $auto (Boolean) true if coming from WordPress Permalink Page, false otherwise
951
+ * @return nothing
952
+ */
953
+ function wpsc_update_page_urls($auto = false) {
954
+ global $wpdb;
955
+
956
+ $wpsc_pageurl_option['product_list_url'] = '[productspage]';
957
+ $wpsc_pageurl_option['shopping_cart_url'] = '[shoppingcart]';
958
+ $check_chekout = $wpdb->get_var( "SELECT `guid` FROM `{$wpdb->posts}` WHERE `post_content` LIKE '%[checkout]%' LIMIT 1" );
959
+ if ( $check_chekout != null ) {
960
+ $wpsc_pageurl_option['checkout_url'] = '[checkout]';
961
+ } else {
962
+ $wpsc_pageurl_option['checkout_url'] = '[checkout]';
963
+ }
964
+ $wpsc_pageurl_option['transact_url'] = '[transactionresults]';
965
+ $wpsc_pageurl_option['user_account_url'] = '[userlog]';
966
+ $changes_made = false;
967
+ foreach ( $wpsc_pageurl_option as $option_key => $page_string ) {
968
+ $post_id = $wpdb->get_var( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` IN('page','post') AND `post_content` LIKE '%$page_string%' LIMIT 1" );
969
+ if ( ! $post_id )
970
+ continue;
971
+ $the_new_link = _get_page_link( $post_id );
972
+ if ( stristr( get_option( $option_key ), "https://" ) ) {
973
+ $the_new_link = str_replace( 'http://', "https://", $the_new_link );
974
+ }
975
+
976
+ update_option( $option_key, $the_new_link );
977
+ }
978
+
979
+ if(!$auto){
980
+ $sendback = wp_get_referer();
981
+ if ( isset( $updated ) )
982
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
983
+
984
+ if ( isset( $_SESSION['wpsc_settings_curr_page'] ) )
985
+ $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
986
+
987
+ wp_redirect( $sendback );
988
+ exit();
989
+ }
990
+ }
991
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'update_page_urls') )
992
+ add_action( 'admin_init', 'wpsc_update_page_urls' );
993
+
994
+ function wpsc_clean_categories() {
995
+ global $wpdb, $wp_rewrite;
996
+ $sql_query = "SELECT `id`, `name`, `active` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`";
997
+ $sql_data = $wpdb->get_results( $sql_query, ARRAY_A );
998
+ foreach ( (array)$sql_data as $datarow ) {
999
+ if ( $datarow['active'] == 1 ) {
1000
+ $tidied_name = trim( $datarow['name'] );
1001
+ $tidied_name = strtolower( $tidied_name );
1002
+ $url_name = sanitize_title( $tidied_name );
1003
+ $similar_names = $wpdb->get_row( "SELECT COUNT(*) AS `count`, MAX(REPLACE(`nice-name`, '$url_name', '')) AS `max_number` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `nice-name` REGEXP '^($url_name){1}(\d)*$' AND `id` NOT IN ('{$datarow['id']}') ", ARRAY_A );
1004
+ $extension_number = '';
1005
+ if ( $similar_names['count'] > 0 ) {
1006
+ $extension_number = (int)$similar_names['max_number'] + 2;
1007
+ }
1008
+ $url_name .= $extension_number;
1009
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` SET `nice-name` = '$url_name' WHERE `id` = '{$datarow['id']}' LIMIT 1 ;" );
1010
+ $updated;
1011
+ } else if ( $datarow['active'] == 0 ) {
1012
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` SET `nice-name` = '' WHERE `id` = '{$datarow['id']}' LIMIT 1 ;" );
1013
+ $updated;
1014
+ }
1015
+ }
1016
+ $wp_rewrite->flush_rules();
1017
+ $sendback = wp_get_referer();
1018
+
1019
+ if ( isset( $updated ) ) {
1020
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
1021
+ }
1022
+ if ( isset( $_SESSION['wpsc_settings_curr_page'] ) ) {
1023
+ $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
1024
+ }
1025
+ wp_redirect( $sendback );
1026
+
1027
+ exit();
1028
+ }
1029
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'clean_categories') )
1030
+ add_action( 'admin_init', 'wpsc_clean_categories' );
1031
+
1032
+ //change the regions tax settings
1033
+ function wpsc_change_region_tax() {
1034
+ global $wpdb;
1035
+ if ( is_array( $_POST['region_tax'] ) ) {
1036
+ foreach ( $_POST['region_tax'] as $region_id => $tax ) {
1037
+ if ( is_numeric( $region_id ) && is_numeric( $tax ) ) {
1038
+ $previous_tax = $wpdb->get_var( "SELECT `tax` FROM `" . WPSC_TABLE_REGION_TAX . "` WHERE `id` = '$region_id' LIMIT 1" );
1039
+ if ( $tax != $previous_tax ) {
1040
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_REGION_TAX . "` SET `tax` = '$tax' WHERE `id` = '$region_id' LIMIT 1" );
1041
+ $changes_made = true;
1042
+ }
1043
+ }
1044
+ }
1045
+ $sendback = wp_get_referer();
1046
+ wp_redirect( $sendback );
1047
+ }
1048
+ }
1049
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'change_region_tax') )
1050
+ add_action( 'admin_init', 'wpsc_change_region_tax' );
1051
+
1052
+ function wpsc_product_files_existing() {
1053
+ //List all product_files, with checkboxes
1054
+
1055
+ $product_id = absint( $_GET["product_id"] );
1056
+ $file_list = wpsc_uploaded_files();
1057
+
1058
+ $args = array(
1059
+ 'post_type' => 'wpsc-product-file',
1060
+ 'post_parent' => $product_id,
1061
+ 'numberposts' => -1,
1062
+ 'post_status' => 'all'
1063
+ );
1064
+ $attached_files = (array)get_posts( $args );
1065
+
1066
+ foreach ( $attached_files as $key => $attached_file ) {
1067
+ $attached_files_by_file[$attached_file->post_title] = & $attached_files[$key];
1068
+ }
1069
+
1070
+ $output = "<span class='admin_product_notes select_product_note '>" . __( 'Choose a downloadable file for this product:', 'wpsc' ) . "</span><br>";
1071
+ $output .= "<form method='post' class='product_upload'>";
1072
+ $output .= "<div class='ui-widget-content multiple-select select_product_file'>";
1073
+ $num = 0;
1074
+ foreach ( (array)$file_list as $file ) {
1075
+ $num++;
1076
+ $checked_curr_file = "";
1077
+ if ( isset( $attached_files_by_file[$file['display_filename']] ) ) {
1078
+ $checked_curr_file = "checked='checked'";
1079
+ }
1080
+
1081
+ $output .= "<p " . ((($num % 2) > 0) ? '' : "class='alt'") . " id='select_product_file_row_$num'>\n";
1082
+ $output .= " <input type='checkbox' name='select_product_file[]' value='" . $file['real_filename'] . "' id='select_product_file_$num' " . $checked_curr_file . " />\n";
1083
+ $output .= " <label for='select_product_file_$num'>" . $file['display_filename'] . "</label>\n";
1084
+ $output .= "</p>\n";
1085
+ }
1086
+
1087
+ $output .= "</div>";
1088
+ $output .= "<input type='hidden' id='hidden_id' value='$product_id' />";
1089
+ $output .= "<input type='submit' name='save' name='product_files_submit' class='button-primary prdfil' value='Save Product Files' />";
1090
+ $output .= "</form>";
1091
+ $output .= "<div class='" . ((is_numeric( $product_id )) ? "edit_" : "") . "select_product_handle'><div></div></div>";
1092
+ $output .= "<script type='text/javascript'>\n\r";
1093
+ $output .= "var select_min_height = " . (25 * 3) . ";\n\r";
1094
+ $output .= "var select_max_height = " . (25 * ($num + 1)) . ";\n\r";
1095
+ $output .= "</script>";
1096
+
1097
+
1098
+ echo $output;
1099
+ }
1100
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'product_files_existing') )
1101
+ add_action( 'admin_init', 'wpsc_product_files_existing' );
1102
+
1103
+ function prod_upload() {
1104
+ global $wpdb;
1105
+ $product_id = absint( $_POST["product_id"] );
1106
+ $output = '';
1107
+ foreach ( $_POST["select_product_file"] as $selected_file ) {
1108
+ // if we already use this file, there is no point doing anything more.
1109
+
1110
+ $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()
1111
+ $file_post_data = $wpdb->get_row( $sql, ARRAY_A );
1112
+ $selected_file_path = WPSC_FILE_DIR . basename( $selected_file );
1113
+
1114
+ if ( empty( $file_post_data ) ) {
1115
+ $type = wpsc_get_mimetype( $selected_file_path );
1116
+ $attachment = array(
1117
+ 'post_mime_type' => $type,
1118
+ 'post_parent' => $product_id,
1119
+ 'post_title' => $selected_file,
1120
+ 'post_content' => '',
1121
+ 'post_type' => "wpsc-product-file",
1122
+ 'post_status' => 'inherit'
1123
+ );
1124
+ $id = wp_insert_post( $attachment );
1125
+ } else {
1126
+ // already attached
1127
+ if ( $file_post_data['post_parent'] == $product_id )
1128
+ continue;
1129
+ $type = $file_post_data["post_mime_type"];
1130
+ $url = $file_post_data["guid"];
1131
+ $title = $file_post_data["post_title"];
1132
+ $content = $file_post_data["post_content"];
1133
+ // Construct the attachment
1134
+ $attachment = array(
1135
+ 'post_mime_type' => $type,
1136
+ 'guid' => $url,
1137
+ 'post_parent' => absint( $product_id ),
1138
+ 'post_title' => $title,
1139
+ 'post_content' => $content,
1140
+ 'post_type' => "wpsc-product-file",
1141
+ 'post_status' => 'inherit'
1142
+ );
1143
+ // Save the data
1144
+ $id = wp_insert_post( $attachment );
1145
+ }
1146
+
1147
+ $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'] );
1148
+
1149
+ $output .= "<p id='select_product_file_row_id_" . $id . "'>\n";
1150
+ $output .= " <a class='file_delete_button' href='{$deletion_url}' >\n";
1151
+ $output .= " <img src='" . WPSC_CORE_IMAGES_URL . "/cross.png' />\n";
1152
+ $output .= " </a>\n";
1153
+ $output .= " <label for='select_product_file_row_id_" . $id . "'>" . $attachment['post_title'] . "</label>\n";
1154
+ $output .= "</p>\n";
1155
+ }
1156
+
1157
+ echo $output;
1158
+ }
1159
+ if ( isset( $_GET['wpsc_admin_action'] ) && ($_GET['wpsc_admin_action'] == 'product_files_upload') )
1160
+ add_action( 'admin_init', 'prod_upload' );
1161
+
1162
+ //change the gateway settings
1163
+ function wpsc_gateway_settings() {
1164
+ //To update options
1165
+ if ( isset( $_POST['wpsc_options'] ) ) {
1166
+ foreach ( $_POST['wpsc_options'] as $key => $value ) {
1167
+ if ( $value != get_option( $key ) ) {
1168
+ update_option( $key, $value );
1169
+ }
1170
+ }
1171
+ unset( $_POST['wpsc_options'] );
1172
+ }
1173
+
1174
+
1175
+
1176
+ if ( isset( $_POST['user_defined_name'] ) && is_array( $_POST['user_defined_name'] ) ) {
1177
+ $payment_gateway_names = get_option( 'payment_gateway_names' );
1178
+
1179
+ if ( !is_array( $payment_gateway_names ) ) {
1180
+ $payment_gateway_names = array( );
1181
+ }
1182
+ $payment_gateway_names = array_merge( $payment_gateway_names, (array)$_POST['user_defined_name'] );
1183
+ update_option( 'payment_gateway_names', $payment_gateway_names );
1184
+ }
1185
+ $custom_gateways = get_option( 'custom_gateway_options' );
1186
+
1187
+ $nzshpcrt_gateways = nzshpcrt_get_gateways();
1188
+ foreach ( $nzshpcrt_gateways as $gateway ) {
1189
+ if ( in_array( $gateway['internalname'], $custom_gateways ) ) {
1190
+ if ( isset( $gateway['submit_function'] ) ) {
1191
+ call_user_func_array( $gateway['submit_function'], array( ) );
1192
+ $changes_made = true;
1193
+ }
1194
+ }
1195
+ }
1196
+ if ( (isset( $_POST['payment_gw'] ) && $_POST['payment_gw'] != null ) ) {
1197
+ update_option( 'payment_gateway', $_POST['payment_gw'] );
1198
+ }
1199
+ $sendback = wp_get_referer();
1200
+
1201
+ if ( isset( $updated ) ) {
1202
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
1203
+ }
1204
+ if ( isset( $_SESSION['wpsc_settings_curr_page'] ) ) {
1205
+ $sendback = add_query_arg( 'page', 'wpsc-settings', $sendback );
1206
+ $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
1207
+ }
1208
+ wp_redirect( $sendback );
1209
+ exit();
1210
+ }
1211
+ if ( isset( $_REQUEST['wpsc_gateway_settings'] ) && ($_REQUEST['wpsc_gateway_settings'] == 'gateway_settings') )
1212
+ add_action( 'admin_init', 'wpsc_gateway_settings' );
1213
+
1214
+ function wpsc_check_form_options() {
1215
+ global $wpdb;
1216
+
1217
+ $id = $wpdb->escape( $_POST['form_id'] );
1218
+ $sql = 'SELECT `options` FROM `' . WPSC_TABLE_CHECKOUT_FORMS . '` WHERE `id`=' . $id;
1219
+ $options = $wpdb->get_var( $sql );
1220
+ if ( $options != '' ) {
1221
+ $options = maybe_unserialize( $options );
1222
+ if ( !is_array( $options ) ) {
1223
+ $options = unserialize( $options );
1224
+ }
1225
+ $output = "<tr class='wpsc_grey'><td></td><td colspan='5'>Please Save your changes before trying to Order your Checkout Forms again.</td></tr>\r\n<tr class='wpsc_grey'><td></td><th>Label</th><th >Value</th><td colspan='3'><a href='' class='wpsc_add_new_checkout_option' title='form_options[" . $id . "]'>+ New Layer</a></td></tr>";
1226
+
1227
+ foreach ( (array)$options as $key => $value ) {
1228
+ $output .="<tr class='wpsc_grey'><td></td><td><input type='text' value='" . $key . "' name='wpsc_checkout_option_label[" . $id . "][]' /></td><td colspan='4'><input type='text' value='" . $value . "' name='wpsc_checkout_option_value[" . $id . "][]' />&nbsp;<a class='wpsc_delete_option' href='' <img src='" . WPSC_CORE_IMAGES_URL . "/trash.gif' alt='" . __( 'Delete', 'wpsc' ) . "' title='" . __( 'Delete', 'wpsc' ) . "' /></a></td></tr>";
1229
+ }
1230
+ } else {
1231
+ $output = '';
1232
+ }
1233
+ exit( $output );
1234
+ }
1235
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'check_form_options') )
1236
+ add_action( 'admin_init', 'wpsc_check_form_options' );
1237
+
1238
+ //handles the editing and adding of new checkout fields
1239
+ function wpsc_checkout_settings() {
1240
+ global $wpdb;
1241
+ $updated = 0;
1242
+ $wpdb->show_errors = true;
1243
+ $filter = isset( $_POST['selected_form_set'] ) ? $_POST['selected_form_set'] : '0';
1244
+ if ( ! isset( $_POST['new_form_mandatory'] ) )
1245
+ $_POST['new_form_mandatory'] = array();
1246
+
1247
+ if ( $_POST['new_form_set'] != null ) {
1248
+ $checkout_sets = get_option( 'wpsc_checkout_form_sets' );
1249
+ $checkout_sets[] = $_POST['new_form_set'];
1250
+ update_option( 'wpsc_checkout_form_sets', $checkout_sets );
1251
+ }
1252
+
1253
+ /*
1254
+ // Save checkout options
1255
+ */
1256
+ $options = array( );
1257
+ if ( isset($_POST['wpsc_checkout_option_label']) && is_array( $_POST['wpsc_checkout_option_label'] ) ) {
1258
+ foreach ( $_POST['wpsc_checkout_option_label'] as $form_id => $values ) {
1259
+ $options = array( );
1260
+ foreach ( (array)$values as $key => $form_option ) {
1261
+ $form_option = str_ireplace( "'", "", $form_option );
1262
+ $form_val = str_ireplace( "'", "", esc_attr( $_POST['wpsc_checkout_option_value'][$form_id][$key] ) );
1263
+ $options[$form_option] = $form_val;
1264
+ }
1265
+
1266
+ $options = serialize( $options );
1267
+ $wpdb->update(
1268
+ WPSC_TABLE_CHECKOUT_FORMS,
1269
+ array( 'options' => $options ),
1270
+ array( 'id' => $form_id ),
1271
+ '%s',
1272
+ '%d'
1273
+ );
1274
+ }
1275
+ }
1276
+
1277
+
1278
+ if ( $_POST['form_name'] != null ) {
1279
+ foreach ( $_POST['form_name'] as $form_id => $form_name ) {
1280
+ $form_type = $_POST['form_type'][$form_id];
1281
+ $form_mandatory = 0;
1282
+ if ( isset( $_POST['form_mandatory'][$form_id] ) && ($_POST['form_mandatory'][$form_id] == 1) ) {
1283
+ $form_mandatory = 1;
1284
+ }
1285
+ $form_display_log = 0;
1286
+ if ( isset( $_POST['form_display_log'][$form_id] ) && ($_POST['form_display_log'][$form_id] == 1) ) {
1287
+ $form_display_log = 1;
1288
+ }
1289
+ $unique_name = '';
1290
+ if ( $_POST['unique_names'][$form_id] != '-1' ) {
1291
+ $unique_name = $_POST['unique_names'][$form_id];
1292
+ }
1293
+ $wpdb->update(
1294
+ WPSC_TABLE_CHECKOUT_FORMS,
1295
+ array(
1296
+ 'name' => $form_name,
1297
+ 'type' => $form_type,
1298
+ 'mandatory' => $form_mandatory,
1299
+ 'display_log' => $form_display_log,
1300
+ 'unique_name' => $unique_name,
1301
+ ),
1302
+ array( 'id' => $form_id ),
1303
+ '%s',
1304
+ '%d'
1305
+ );
1306
+ }
1307
+ }
1308
+
1309
+ if ( isset( $_POST['new_form_name'] ) ) {
1310
+ $added = 0;
1311
+ foreach ( $_POST['new_form_name'] as $form_id => $form_name ) {
1312
+ $form_type = $_POST['new_form_type'][$form_id];
1313
+ $form_mandatory = 0;
1314
+ if ( ! empty( $_POST['new_form_mandatory'][$form_id] ) ) {
1315
+ $form_mandatory = 1;
1316
+ }
1317
+ $form_display_log = 0;
1318
+ if ( isset( $_POST['new_form_display_log'][$form_id] ) && $_POST['new_form_display_log'][$form_id] == 1 ) {
1319
+ $form_display_log = 1;
1320
+ }
1321
+ $form_unique_name = '';
1322
+ if ( $_POST['new_form_unique_name'][$form_id] != '-1' ) {
1323
+ $form_unique_name = $_POST['new_form_unique_name'][$form_id];
1324
+ }
1325
+
1326
+ $max_order_sql = "SELECT MAX(`checkout_order`) AS `checkout_order` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1';";
1327
+
1328
+ if ( isset( $_POST['new_form_order'][$form_id] ) && $_POST['new_form_order'][$form_id] != '' ) {
1329
+ $order_number = $_POST['new_form_order'][$form_id];
1330
+ } else {
1331
+ $max_order_sql = $wpdb->get_results( $max_order_sql, ARRAY_A );
1332
+ $order_number = $max_order_sql[0]['checkout_order'] + 1;
1333
+ }
1334
+
1335
+ $wpdb->insert(
1336
+ WPSC_TABLE_CHECKOUT_FORMS,
1337
+ array(
1338
+ 'name' => $form_name,
1339
+ 'type' => $form_type,
1340
+ 'mandatory' => $form_mandatory,
1341
+ 'display_log' => $form_display_log,
1342
+ 'default' => '',
1343
+ 'active' => '1',
1344
+ 'checkout_order' => $order_number,
1345
+ 'unique_name' => $form_unique_name,
1346
+ 'checkout_set' => $filter,
1347
+ ),
1348
+ array( '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s' )
1349
+ );
1350
+
1351
+ $added++;
1352
+ }
1353
+ }
1354
+
1355
+ if ( isset( $_POST['wpsc_options'] ) ) {
1356
+ foreach ( $_POST['wpsc_options'] as $key => $value ) {
1357
+ if ( $value != get_option( $key ) ) {
1358
+ update_option( $key, $value );
1359
+ $updated++;
1360
+ }
1361
+ }
1362
+ }
1363
+
1364
+ $sendback = wp_get_referer();
1365
+ if ( isset( $form_set_key ) ) {
1366
+ $sendback = add_query_arg( 'checkout-set', $form_set_key, $sendback );
1367
+ } else if ( isset( $_POST['wpsc_form_set'] ) ) {
1368
+ $filter = $_POST['wpsc_form_set'];
1369
+ $sendback = add_query_arg( 'checkout-set', $filter, $sendback );
1370
+ }
1371
+
1372
+ if ( isset( $updated ) ) {
1373
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
1374
+ }
1375
+ if ( ! empty( $added ) ) {
1376
+ $sendback = add_query_arg( 'added', $added, $sendback );
1377
+ }
1378
+ if ( isset( $_SESSION['wpsc_settings_curr_page'] ) ) {
1379
+ $sendback = add_query_arg( 'tab', $_SESSION['wpsc_settings_curr_page'], $sendback );
1380
+ }
1381
+ $sendback = add_query_arg( 'page', 'wpsc-settings', $sendback );
1382
+ wp_redirect( $sendback );
1383
+ exit();
1384
+ }
1385
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'checkout_settings') )
1386
+ add_action( 'admin_init', 'wpsc_checkout_settings' );
1387
+
1388
+ function wpsc_google_shipping_settings() {
1389
+ if ( isset( $_POST['submit'] ) ) {
1390
+ foreach ( (array)$_POST['google_shipping'] as $key => $country ) {
1391
+ if ( $country == 'on' ) {
1392
+ $google_shipping_country[] = $key;
1393
+ $updated++;
1394
+ }
1395
+ }
1396
+ update_option( 'google_shipping_country', $google_shipping_country );
1397
+ $sendback = wp_get_referer();
1398
+ $sendback = esc_url( remove_query_arg( 'googlecheckoutshipping', $sendback ) );
1399
+
1400
+ if ( isset( $updated ) ) {
1401
+ $sendback = add_query_arg( 'updated', $updated, $sendback );
1402
+ }
1403
+
1404
+ wp_redirect( $sendback );
1405
+ exit();
1406
+ }
1407
+ }
1408
+
1409
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'google_shipping_settings') ) {
1410
+ add_action( 'admin_init', 'wpsc_google_shipping_settings' );
1411
+ }
1412
+
1413
+ //for ajax call of settings page tabs
1414
+ function wpsc_settings_page_ajax() {
1415
+ $html = '';
1416
+ $modified_page_title = $_POST['page_title'];
1417
+ $page_title = str_replace( "tab-", "", $modified_page_title );
1418
+
1419
+ check_admin_referer( $modified_page_title );
1420
+ switch ( $page_title ) {
1421
+ case 'checkout' :
1422
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/checkout.php' );
1423
+ wpsc_options_checkout();
1424
+ break;
1425
+
1426
+ case 'gateway' :
1427
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/gateway.php' );
1428
+ wpsc_options_gateway();
1429
+ break;
1430
+
1431
+ case 'shipping' :
1432
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/shipping.php' );
1433
+ wpsc_options_shipping();
1434
+ break;
1435
+
1436
+ case 'admin' :
1437
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/admin.php' );
1438
+ wpsc_options_admin();
1439
+ break;
1440
+
1441
+ case 'presentation' :
1442
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/presentation.php' );
1443
+ wpsc_options_presentation();
1444
+ break;
1445
+
1446
+ case 'taxes' :
1447
+ wpec_taxes_settings_page(); //see wpec-taxes view
1448
+ break;
1449
+
1450
+ case 'marketing' :
1451
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/marketing.php' );
1452
+ wpsc_options_marketing();
1453
+ break;
1454
+
1455
+ case 'import' :
1456
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/import.php' );
1457
+ wpsc_options_import();
1458
+ break;
1459
+
1460
+ case 'general' :
1461
+ default;
1462
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/general.php' );
1463
+ wpsc_options_general();
1464
+ break;
1465
+ }
1466
+
1467
+ $_SESSION['wpsc_settings_curr_page'] = $page_title;
1468
+
1469
+ exit( $html );
1470
+ }
1471
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'settings_page_ajax') )
1472
+ add_action( 'admin_init', 'wpsc_settings_page_ajax' );
1473
+
1474
+ function wpsc_update_variations() {
1475
+ $product_id = absint( $_POST["product_id"] );
1476
+ $product_type_object = get_post_type_object('wpsc-product');
1477
+ if (!current_user_can($product_type_object->cap->edit_post, $product_id))
1478
+ return;
1479
+
1480
+ //Setup postdata
1481
+ $post_data = array( );
1482
+ $post_data['edit_var_val'] = isset( $_POST['edit_var_val'] ) ? $_POST["edit_var_val"] : '';
1483
+ $post_data['description'] = isset( $_POST['description'] ) ? $_POST["description"] : '';
1484
+ $post_data['additional_description'] = isset( $_POST['additional_description'] ) ? $_POST['additional_description'] : '';
1485
+ $post_data['name'] = (!empty($_POST['name']))?$_POST['name']:$_POST["post_title"];
1486
+
1487
+ //Add or delete variations
1488
+ wpsc_edit_product_variations( $product_id, $post_data );
1489
+ if (defined('DOING_AJAX') && DOING_AJAX) {
1490
+ wpsc_admin_product_listing( $product_id );
1491
+ die();
1492
+ }
1493
+ }
1494
+
1495
+ if ( isset($_POST["edit_var_val"]) )
1496
+ add_action( 'admin_init', 'wpsc_update_variations', 50 );
1497
+ add_action('wp_ajax_wpsc_update_variations', 'wpsc_update_variations', 50 );
1498
+
1499
+ function wpsc_delete_variation_set() {
1500
+ check_admin_referer( 'delete-variation' );
1501
+
1502
+ if ( is_numeric( $_GET['deleteid'] ) ) {
1503
+ $variation_id = absint( $_GET['deleteid'] );
1504
+
1505
+ $variation_set = get_term( $variation_id, 'wpsc-variation', ARRAY_A );
1506
+
1507
+
1508
+ $variations = get_terms( 'wpsc-variation', array(
1509
+ 'hide_empty' => 0,
1510
+ 'parent' => $variation_id
1511
+ ) );
1512
+
1513
+ foreach ( (array)$variations as $variation ) {
1514
+ $return_value = wp_delete_term( $variation->term_id, 'wpsc-variation' );
1515
+ }
1516
+
1517
+ if ( !empty( $variation_set ) ) {
1518
+ $return_value = wp_delete_term( $variation_set['term_id'], 'wpsc-variation' );
1519
+ }
1520
+ $deleted = 1;
1521
+ }
1522
+
1523
+ $sendback = wp_get_referer();
1524
+ if ( isset( $deleted ) ) {
1525
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
1526
+ }
1527
+ $sendback = esc_url( remove_query_arg( array(
1528
+ 'deleteid',
1529
+ 'variation_id'
1530
+ ), $sendback ) );
1531
+
1532
+ wp_redirect( $sendback );
1533
+ exit();
1534
+ }
1535
+
1536
+ function wpsc_force_flush_theme_transients() {
1537
+ // Flush transients
1538
+ wpsc_flush_theme_transients( true );
1539
+
1540
+ // Bounce back
1541
+ $sendback = wp_get_referer();
1542
+ wp_redirect( $sendback );
1543
+
1544
+ exit();
1545
+ }
1546
+ if ( isset( $_REQUEST['wpsc_flush_theme_transients'] ) && ( $_REQUEST['wpsc_flush_theme_transients'] == 'true' ) )
1547
+ add_action( 'admin_init', 'wpsc_force_flush_theme_transients' );
1548
+
1549
+ function wpsc_backup_theme() {
1550
+ $wp_theme_path = get_stylesheet_directory();
1551
+ wpsc_recursive_copy( $wp_theme_path, WPSC_THEME_BACKUP_DIR );
1552
+ $_SESSION['wpsc_themes_backup'] = true;
1553
+ $sendback = wp_get_referer();
1554
+ wp_redirect( $sendback );
1555
+
1556
+ exit();
1557
+ }
1558
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'backup_themes' ) )
1559
+ add_action( 'admin_init', 'wpsc_backup_theme' );
1560
+
1561
+
1562
+ function wpsc_delete_coupon(){
1563
+ global $wpdb;
1564
+
1565
+ check_admin_referer( 'delete-coupon' );
1566
+ $coupon_id = (int)$_GET['delete_id'];
1567
+
1568
+ if(isset($coupon_id)) {
1569
+ $wpdb->query("DELETE FROM `".WPSC_TABLE_COUPON_CODES."` WHERE `id` = '$coupon_id' LIMIT 1;");
1570
+
1571
+ $deleted = 1;
1572
+ }
1573
+ $sendback = wp_get_referer();
1574
+ if ( isset( $deleted ) )
1575
+ $sendback = add_query_arg( 'deleted', $deleted, $sendback );
1576
+
1577
+ $sendback = remove_query_arg( array('deleteid',), $sendback );
1578
+ wp_redirect( esc_url( $sendback ) );
1579
+ exit();
1580
+ }
1581
+
1582
+ if ( isset( $_GET['action'] ) && ( 'purchase_log' == $_GET['action'] ) )
1583
+ add_action( 'admin_init', 'wpsc_admin_sale_rss' );
1584
+
1585
+ if ( isset( $_GET['purchase_log_csv'] ) && ( 'true' == $_GET['purchase_log_csv'] ) )
1586
+ add_action( 'admin_init', 'wpsc_purchase_log_csv' );
1587
+
1588
+ if ( isset( $_REQUEST['ajax'] ) && isset( $_REQUEST['admin'] ) && ($_REQUEST['ajax'] == "true") && ($_REQUEST['admin'] == "true") )
1589
+ add_action( 'admin_init', 'wpsc_admin_ajax' );
1590
+
1591
+ // Variation set deleting init code starts here
1592
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-variation-set' == $_REQUEST['wpsc_admin_action'] ) )
1593
+ add_action( 'admin_init', 'wpsc_delete_variation_set' );
1594
+
1595
+ //Delete Coupon
1596
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc-delete-coupon' == $_REQUEST['wpsc_admin_action'] ) )
1597
+ add_action( 'admin_init', 'wpsc_delete_coupon' );
1598
+
1599
+
1600
+ function flat_price( $price ) {
1601
+ if ( ! empty( $price ) && strchr( $price, '-' ) === false && strchr( $price, '+' ) === false && strchr( $price, '%' ) === false )
1602
+ return true;
1603
+ }
1604
+
1605
+ function percentile_price( $price ) {
1606
+ if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) )
1607
+ return true;
1608
+ }
1609
+
1610
+ function differential_price( $price ) {
1611
+ if ( ! empty( $price ) && ( strchr( $price, '-' ) || strchr( $price, '+' ) ) && strchr( $price, '%' ) === false )
1612
+ return true;
1613
+ }
1614
+
1615
+ /**
1616
+ * If it doesn't exist, let's create a multi-dimensional associative array
1617
+ * that will contain all of the term/price associations
1618
+ *
1619
+ * @param <type> $variation
1620
+ */
1621
+ function variation_price_field( $variation ) {
1622
+ $term_prices = get_option( 'term_prices' );
1623
+
1624
+ if ( is_object( $variation ) )
1625
+ $term_id = $variation->term_id;
1626
+
1627
+ if ( empty( $term_prices ) || !is_array( $term_prices ) ) {
1628
+
1629
+ $term_prices = array( );
1630
+ if ( isset( $term_id ) ) {
1631
+ $term_prices[$term_id] = array( );
1632
+ $term_prices[$term_id]["price"] = '';
1633
+ $term_prices[$term_id]["checked"] = '';
1634
+ }
1635
+ add_option( 'term_prices', $term_prices );
1636
+ }
1637
+
1638
+ if ( isset( $term_id ) && is_array( $term_prices ) && array_key_exists( $term_id, $term_prices ) )
1639
+ $price = esc_attr( $term_prices[$term_id]["price"] );
1640
+ else
1641
+ $price = '';
1642
+
1643
+ if( !isset( $_GET['action'] ) ) {
1644
+ ?>
1645
+ <div class="form-field">
1646
+ <label for="variation_price"><?php _e( 'Variation Price', 'wpsc' ); ?></label>
1647
+ <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1648
+ <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>
1649
+ </div>
1650
+ <script type="text/javascript">
1651
+ jQuery('#parent option:contains("   ")').remove();
1652
+ jQuery('#parent').mousedown(function(){
1653
+ jQuery('#parent option:contains("   ")').remove();
1654
+ });
1655
+ </script>
1656
+ <?php
1657
+ } else{
1658
+ ?>
1659
+ <tr class="form-field">
1660
+ <th scope="row" valign="top">
1661
+ <label for="variation_price"><?php _e( 'Variation Price', 'wpsc' ); ?></label>
1662
+ </th>
1663
+ <td>
1664
+ <input type="text" name="variation_price" id="variation_price" style="width:50px;" value="<?php echo $price; ?>"><br />
1665
+ <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>
1666
+ </td>
1667
+ </tr>
1668
+ <?php
1669
+ }
1670
+
1671
+ }
1672
+ add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field' );
1673
+ add_action( 'wpsc-variation_add_form_fields', 'variation_price_field' );
1674
+
1675
+ function variation_price_field_check( $variation ) {
1676
+
1677
+ $term_prices = get_option( 'term_prices' );
1678
+
1679
+ if ( is_array( $term_prices ) && array_key_exists( $variation->term_id, $term_prices ) )
1680
+ $checked = ($term_prices[$variation->term_id]["checked"] == 'checked') ? 'checked' : '';
1681
+ else
1682
+ $checked = ''; ?>
1683
+
1684
+ <tr class="form-field">
1685
+ <th scope="row" valign="top"><label for="apply_to_current"><?php _e( 'Apply to current variations?' ) ?></label></th>
1686
+ <td>
1687
+ <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>
1688
+ </td>
1689
+ </tr>
1690
+ <?php
1691
+ }
1692
+ add_action( 'wpsc-variation_edit_form_fields', 'variation_price_field_check' );
1693
+
1694
+ /**
1695
+ * @todo - Should probably refactor this at some point - very procedural,
1696
+ * WAY too many foreach loops for my liking :) But it does the trick
1697
+ *
1698
+ * @param <type> $term_id
1699
+ */
1700
+ function save_term_prices( $term_id ) {
1701
+
1702
+ // First - Saves options from input
1703
+ if ( isset( $_POST['variation_price'] ) || isset( $_POST["apply_to_current"] ) ) {
1704
+
1705
+ $term_prices = get_option( 'term_prices' );
1706
+
1707
+ $term_prices[$term_id]["price"] = $_POST["variation_price"];
1708
+ $term_prices[$term_id]["checked"] = (isset( $_POST["apply_to_current"] )) ? "checked" : "unchecked";
1709
+
1710
+ update_option( 'term_prices', $term_prices );
1711
+ }
1712
+
1713
+ // 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
1714
+ if ( isset( $_POST["apply_to_current"] ) ) {
1715
+
1716
+ //Check for flat, percentile or differential
1717
+ $var_price_type = '';
1718
+
1719
+ if ( flat_price( $_POST["variation_price"] ) )
1720
+ $var_price_type = 'flat';
1721
+ elseif ( differential_price( $_POST["variation_price"] ) )
1722
+ $var_price_type = 'differential';
1723
+ elseif ( percentile_price( $_POST["variation_price"] ) )
1724
+ $var_price_type = 'percentile';
1725
+
1726
+ //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)
1727
+ $products_to_mod = get_objects_in_term( $term_id, "wpsc-variation" );
1728
+ $product_parents = array( );
1729
+
1730
+ foreach ( (array)$products_to_mod as $get_parent ) {
1731
+
1732
+ $post = get_post( $get_parent );
1733
+
1734
+ if ( !$post->post_parent )
1735
+ $product_parents[] = $post->ID;
1736
+ }
1737
+
1738
+ //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)
1739
+
1740
+ foreach ( $product_parents as $parent ) {
1741
+ $args = array(
1742
+ 'post_parent' => $parent,
1743
+ 'post_type' => 'wpsc-product'
1744
+ );
1745
+ $children = get_children( $args, ARRAY_A );
1746
+
1747
+ foreach ( $children as $childrens ) {
1748
+ $parent = $childrens["post_parent"];
1749
+ $children_ids[$parent][] = $childrens["ID"];
1750
+ $children_ids[$parent] = array_intersect( $children_ids[$parent], $products_to_mod );
1751
+ }
1752
+ }
1753
+
1754
+ //Got the right kids, let's grab their parent pricing and modify their pricing based on var_price_type
1755
+
1756
+ foreach ( (array)$children_ids as $parents => $kids ) {
1757
+
1758
+ $kids = array_values( $kids );
1759
+
1760
+ foreach ( $kids as $kiddos ) {
1761
+ $price = wpsc_determine_variation_price( $kiddos );
1762
+ update_product_meta( $kiddos, 'price', $price );
1763
+ }
1764
+ }
1765
+ }
1766
+ }
1767
+ add_action( 'edited_wpsc-variation', 'save_term_prices' );
1768
+ add_action( 'created_wpsc-variation', 'save_term_prices' );
1769
+
1770
+ function wpsc_delete_variations( $postid ) {
1771
+ $post = get_post( $postid );
1772
+ if ( $post->post_type != 'wpsc-product' || $post->post_parent != 0 )
1773
+ return;
1774
+ $variations = get_posts( array(
1775
+ 'post_type' => 'wpsc-product',
1776
+ 'post_parent' => $postid,
1777
+ 'post_status' => 'any',
1778
+ 'numberposts' => -1,
1779
+ ) );
1780
+
1781
+ if ( ! empty( $variations ) )
1782
+ foreach ( $variations as $variation ) {
1783
+ wp_delete_post( $variation->ID, true );
1784
+ }
1785
+ }
1786
+ add_action( 'delete_post', 'wpsc_delete_variations' );
1787
+ ?>
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,260 @@
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,26 +262,23 @@ 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;
525
  border-color: #bbb;
526
  background-color: #eaeaea !important;
527
- height: 38px;
 
528
  }
529
 
530
  div#poststuff table tr td {
531
- vertical-align: top;
532
  }
533
 
534
  div#poststuff textarea {
@@ -542,15 +292,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 +310,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 +327,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 +409,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 +564,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 +596,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 +620,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 +638,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 +656,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 +678,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 {
@@ -875,27 +712,38 @@ div.variation_checkboxes {
875
  margin-bottom: 4px;
876
  }
877
 
 
 
 
 
 
 
 
 
 
 
 
878
  a.variation_edit_button {
879
  display: block;
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 {
@@ -903,154 +751,101 @@ div.select_variation_file p input {
903
  top: 2px;
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;
994
- }
995
-
996
- img.wpsc_add_download {
997
- display: inline;
998
- position: relative;
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 +858,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 +954,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 +981,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 +1025,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 +1035,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 +1053,7 @@ a.edit_categorisation_group,
1269
 
1270
  label.select_categorisation_group {
1271
  padding-top: 4px;
 
1272
  font-size: 11px;
1273
  }
1274
 
@@ -1280,38 +1065,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 +1106,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 +1133,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 +1200,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 +1237,14 @@ p.add_new_form_set_forms {
1453
  td.product-image a img.attachment-thumbnail {
1454
  height: 38px;
1455
  width: 38px;
 
1456
  }
1457
 
1458
  #wpsc_product_category_and_tag_forms .tagchecklist {
1459
- font-size: 11px;
1460
  }
1461
 
1462
- #categorydiv div {
1463
  margin-top: 4px;
1464
  }
1465
 
@@ -1469,134 +1254,290 @@ a.variation_handle {
1469
  font-size: 15px;
1470
  }
1471
 
1472
- .toplevel_page_wpsc-edit-products .wrap h2 {
1473
- padding-bottom: 0px;
1474
- border-bottom: 1px solid #CCC;
 
1475
  }
1476
-
1477
- #post-body #advanced-sortables {
1478
- margin-right: 300px
1479
  }
1480
-
1481
- #media-buttons #add_audio,
1482
- #media-buttons #add_video,
1483
  #media-buttons #add_media {
1484
- display: none;
1485
- }
1486
-
1487
  .meta-box-sortables-wpec .postbox:hover .handlediv {
1488
  background: transparent url(../../wpsc-core/images/menu-bits.gif) no-repeat scroll 0% -111px;
1489
  }
1490
-
1491
-
1492
- /**
1493
- * Marketing / coupon page styling
1494
- */
1495
-
1496
- div.modify_coupon {
1497
- border: 1px solid #eeeeee;
 
 
1498
  display: none;
1499
- width: 100%;
 
1500
  }
1501
-
1502
- table.coupon_data {
1503
- width: 100%;
 
1504
  }
1505
-
1506
- table.add-coupon {
1507
- width: 100%;
1508
  }
1509
-
1510
- table.add-coupon tr th {
1511
- text-align: left;
1512
- padding: 2px 5px 0px 5px;
1513
- border: none;
1514
  }
1515
-
1516
- table.add-coupon tr td {
1517
- text-align: left;
1518
- padding: 2px 5px 2px 5px;
1519
- border: none;
1520
  }
1521
-
1522
- table.add-coupon tr td p {
1523
- padding: 0;
1524
- margin: 5px;
1525
  }
1526
- #table_header {
1527
- font-size: 16px;
1528
- margin-top: 20px;
1529
- font-weight: bold;
 
1530
  }
1531
-
1532
- table.coupon-list {
1533
- width: 100%;
1534
  }
1535
-
1536
- table.coupon-list th {
1537
- text-align: left;
 
 
1538
  }
1539
-
1540
- table.coupon-list tr.toprow td {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1541
  text-align: left;
 
 
 
 
 
1542
  font-weight: bold;
 
1543
  }
1544
-
1545
- table.coupon-list tr td {
1546
- padding: 5px 5px 10px 10px;
1547
- vertical-align: middle;
 
1548
  }
1549
-
1550
- table.coupon-list tr.alt {
1551
- background-color: #eeeeee;
 
1552
  }
1553
-
1554
- table.coupon-list tr.alt td {
1555
- background-color: #eeeeee;
1556
  }
1557
-
1558
- table.coupon-list tr.coupon_edit td {
1559
- padding: 0;
1560
  }
1561
-
1562
- td#order_summary_container {
1563
- width: 80px;
1564
  }
1565
-
1566
- table.category_forms a.delete_button,
1567
- span.delete_button {
1568
- color: #FF0000;
 
 
 
 
 
 
 
 
 
1569
  display: block;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1570
  float: left;
1571
- font-size: 11px;
1572
- margin: 3px 0 0 8px;
1573
- text-decoration: underline;
 
1574
  }
 
 
 
 
 
 
 
 
 
 
 
 
1575
 
1576
- p span.input_label {
1577
- font-size: 1.2em;
1578
- width: 180px;
1579
- float: left;
1580
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1582
  a.wpsc_featured_product_toggle {
1583
  display: block;
1584
  height: 18px;
1585
  width: 18px;
1586
- margin: 4px 0px 0px 0px;
1587
  }
1588
 
1589
- .column-featured a {
1590
- background: url(../../wpsc-core/images/core-sprite.png) no-repeat 0 -32px transparent;
1591
- }
1592
-
1593
- .column-featured a.gold-star {
1594
- background-position: 0 -16px;
1595
- }
1596
 
1597
- .column-featured a:active,
1598
- .column-featured a.gold-star:active {
1599
- background-position: 0 0;
1600
  }
1601
 
1602
  div.wpsc_clear {
@@ -1610,6 +1551,7 @@ div.wpsc_clear {
1610
  position: relative;
1611
  }
1612
 
 
1613
  .wpsc_featured .item_text {
1614
  float: left;
1615
  height: 240px;
@@ -1628,12 +1570,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 +1587,219 @@ 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
+ .wpsc_trackingid_row{
6
+ margin-left:20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  }
8
 
9
+ ul.children{
10
+ padding-left:5px;
11
  }
12
+ .category_indenter{
13
 
14
+ float:left;
15
+ width:auto;
 
16
 
 
 
 
17
  }
 
 
18
  /**
19
+ *Dashboard Widget CSS
20
+ *
21
+ */
22
+ #leftDashboard{
23
+ width:45%;
24
+ float:left;
25
+ text-align:right;
26
+ border-right:1px #999999 solid;
27
+
28
+ }
29
+ #leftDashboard strong{
30
+ float:left;
 
31
  padding-left: 40px;
32
  }
33
+ #rightDashboard strong{
34
+ float:left;
 
35
  padding-left: 40px;
36
  }
37
+ #rightDashboard{
38
+ width:45%;
39
+ float:right;
40
+ text-align:right;
41
 
 
 
 
 
42
  }
43
+ .pricedisplay, .salespricedisplay{
44
+ /* width:40%; */
45
+ /*float:left;*/
46
+ }
47
+ .dashboardWidgetSpecial{
48
+ font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
49
+ color:#21759B;
50
+ font-size:15px!important;
51
  margin: 5px 0 5px 0;
52
  }
53
+ .dashboardWidget{
54
+ color:#777777;
55
+ padding-left:10px;
 
56
  padding-right: 30px;
 
57
 
 
 
 
58
  }
59
+ span.wpsc_quart_left{
60
+ width:40%;
61
+ float:left;
 
 
 
62
  }
63
+ p.atglance{
64
+ color:#777777;
65
+ font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
66
+ font-size:13px;
67
+ font-style:italic;
68
+ }
69
+ span.wpsc_quart_right{
70
+ width:60%;
71
+ float:right;
72
  text-align: right;
73
  }
74
+ #box span{
 
75
  border-bottom: 1px solid #999999;
76
  }
77
+ p.quarterly{
78
+ color:#21759B;
79
+ font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;
80
+ font-size:12px;
 
81
  line-height: 140%;
82
+ margin:5px 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
+ /* end of dashboard widget css */
85
+ /*
86
+ *Display Purchase log Details CSS is HERE
87
+ */
88
+ #purchlogs_customfields{
89
+ clear:both;
 
 
 
 
 
 
 
 
 
90
  }
91
+ th#date{
92
+ width:120px;
 
93
  }
94
+ th#purchid{
95
+ width:60px;
 
96
  }
97
+ th#details{
98
+ width:100px;
 
 
99
  }
100
+ th#amount{
101
+ width:75px;
 
102
  }
103
+ th#name{
104
+ /* width:220px; */
 
 
 
 
105
  }
106
+ th#track{
107
+ width:75px;
 
 
108
  }
109
+ th#delete{
110
+ width:60px;
 
111
  }
112
+ th#status{
113
+ width:200px;
 
114
  }
115
+ .google_checkout_logo{
116
+ padding-right:10px;
 
 
 
 
 
 
117
  }
118
+ #wpsc_items_ordered{
119
+ clear:both;
 
120
  }
121
+ #wpsc_items_ordered h3{
122
+ margin-bottom:0em;
 
123
  }
124
+ .wpsc_pushdown_img {
125
+ float:left;
 
 
126
  }
127
+ #wpsc_purchlogitems_links{
128
+ clear:both;
129
 
 
 
 
130
  }
131
+ #wpsc_purchlog_order_status{
132
+ float:right;
133
+ width:250px;
134
  }
135
+ #wpsc_purchlog_order_status .selector{
136
+ margin-top:-.2em;
 
137
  }
138
 
139
+ #wpsc_purchlogitems_links a{
140
+ text-decoration:none;
141
+ line-height:14pt;
142
  }
143
+ #wpsc_purchlogitems_links img{
144
+ padding-top:2px;
145
+ float:left;
146
  }
147
+ #wpsc_shipping_details_box{
148
+ width:45%;
149
+ float:left;
150
+ border:1px #d3d3d3 solid;
151
+ margin:.4em;
152
+ padding:.6em;
153
+ margin-right:5em;
154
  }
155
+ #wpsc_billing_details_box{
156
+ width:35%;
157
+ float:left;
158
+ margin:.4em;
159
+ padding:.6em;
 
160
  }
161
+ #wpsc_purchlog_searchbox{
162
+ width:100%;
163
+ text-align:right;
164
 
 
 
 
 
165
 
 
 
 
166
  }
167
+ /*
168
+ * Display Purchase log Details CSS ends HERE
 
169
  * Display Products CSS starts here
170
+ */
 
171
  .tablenav select[name="bulkAction"] {
172
+ width:100px;
173
  }
174
+ textarea#additional_description{
 
175
  border: 1px solid #dfdfdf;
176
+ /* width:465px !important; */
177
+ }
178
+ .wpsc-separator {
179
+ background:transparent url(../../images/menu-arrows.gif) no-repeat scroll left 5px;
180
+ cursor:w-resize;
181
+ height:21px;
182
+ margin:0;
183
+ padding:0;
184
  }
185
 
186
  #poststuff h3.form_heading {
187
+ font-size:1.1em;
188
  margin: 40px 0px 10px 0px;
189
  padding-left: 0px;
190
  }
191
 
192
  #poststuff h3.form_heading span {
193
+ font-size:0.8em;
194
  }
195
 
196
  div.search-box input#page-search-input {
197
  width: 129px;
198
+
199
  }
200
 
201
+
202
  #wpsc_product_list,
203
  table.widefat {
204
+ width:100%;
205
  }
206
 
207
  table.widefat .column-hidden_alerts {
208
+ display:none;
209
  }
210
 
211
  #wpsc_product_list .column-cb,
212
  table.widefat .column-cb {
213
+ /* width:24px; */
214
  vertical-align: middle;
215
  }
216
+ #wpsc_product_list .column-image, #wpsc_product_list .product-image,
217
+ table.widefat .column-image, table.widefat .product-image {
 
 
 
218
  padding-right: 0px;
219
+ /* width: 42px; */
 
 
 
 
 
 
 
220
  }
221
 
222
  #wpsc_product_list .column-categories,
223
+ table.widefat .column-categories{
224
+ /* width: 70px; */
225
  padding-right:18px;
226
  }
227
 
228
  #wpsc_product_list tbody tr td.column-title,
229
  table.widefat tbody tr td.column-title {
230
+ border-right:none;
231
  }
232
 
233
  #wpsc_product_list tbody tr td.product-image img,
234
  table.widefat tbody tr td.product-image img {
235
  margin-top: 4px;
236
+ cursor:move;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
 
239
+ .newCurrency{
240
+ width:150px;
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
242
+ div.wpsc_floatleft{
243
+ width:161px;
244
+ float:left;
 
245
  }
 
246
  div.wpsc_floatleft label {
247
+ line-height: 18px;
248
+ white-space: nowrap;
 
249
  }
250
 
251
+ /* Sortable product styling*/
 
 
 
252
 
253
  table.product_editform {
254
+ width:100%;
255
  }
256
 
257
+
258
  #wpsc_product_list .ui-sortable-helper,
259
  table.widefat .ui-sortable-helper {
260
  width: 410px;
262
  background-color: #FEFEFE;
263
  }
264
 
265
+ #wpsc_product_list .ui-sortable-helper td, #wpsc_product_list .ui-sortable-helper th,
266
+ table.widefat .ui-sortable-helper td, table.widefat .ui-sortable-helper th{
 
 
267
  border-top: 1px solid #DFDFDF;
268
  opacity: .4;
269
  }
 
 
270
  .product-placeholder {
271
  border-width: 1px;
272
  border-style: dashed;
273
  z-index: 900;
274
  border-color: #bbb;
275
  background-color: #eaeaea !important;
276
+ margin: -2px 0 0 -2px;
277
+ height: 50px;
278
  }
279
 
280
  div#poststuff table tr td {
281
+ vertical-align:top;
282
  }
283
 
284
  div#poststuff textarea {
292
 
293
  div.admin_product_name {
294
  position: relative;
295
+
296
+ height: 30px;
297
  background: #ffffff;
298
+
299
  border: 1px solid #dfdfdf;
300
+ -moz-border-radius: 6px;
301
+ -khtml-border-radius: 6px;
302
  -webkit-border-radius: 6px;
303
+ border-radius: 6px;
 
 
304
  }
 
305
  div.admin_product_name input.wpsc_product_name {
306
  border: none;
307
  }
310
  position: absolute;
311
  top: 0px;
312
  right: 0px;
313
+ background:url(../../wpsc-core/images/info_icon.jpg) no-repeat scroll 5px 8px;
314
+ border-left:1px solid #DFDFDF;
315
+ display:block;
316
+ height:100%;
317
+ padding:0px 3px 0px 3px;
318
+ width:18px;
319
  }
320
 
321
+ div#icon_card
322
+ {
323
  float: left;
324
  height: 36px;
325
  margin: 7px 8px 0 0;
327
  background: url(../../wpsc-core/images/icon32.png) no-repeat center center;
328
  }
329
 
 
 
330
  div.admin_product_shorttags {
331
+ width:93%;
332
+ min-width:396px;
333
+ max-width:558px;
334
+
335
  clear: both;
336
  padding: 6px;
337
  font-size: 8pt;
338
+ margin:0 0 0 6px !important;
339
+ border-left:1px solid #DFDFDF;
340
+ border-right:1px solid #DFDFDF;
341
+ border-bottom:1px solid #DFDFDF;
342
+ /* height: 28px; */
343
  display: none;
344
+ _width:396px;
345
  background-color: #ffffff;
346
  }
347
 
348
  #description {
349
+ margin:0;
350
+ /* width:100%; */
351
  }
352
 
353
  h4.product_action_link {
354
+ margin:4px 0px 0px 0px;
355
+ display:block;
356
+ font-weight:bold;
357
+ }
358
+
359
+
360
+
361
+ /* custom meta styling */
362
+ div.product_custom_meta {
363
  display: block;
364
+ width: 100%;
365
+ vertical-align: top;
366
+ }
367
+ div#poststuff div.product_custom_meta input, div#poststuff div.product_custom_meta textarea {
368
+ width: 100%;
369
  }
370
 
371
 
372
+ div.product_custom_meta a.add_more_meta {
373
+ display: block;
374
+ float: left;
375
+ margin-top: 18px;
376
+ margin-left: 4px;
377
+ }
378
+
379
+ div.product_custom_meta a.remove_meta {
380
+ display: block;
381
+ margin-left: 4px;
382
+ }
383
+
384
+
385
+ div.product_custom_meta label {
386
+ display: block;
387
+ width: 170px;
388
+ float: left;
389
+ }
390
+
391
+ div.product_custom_meta label input {
392
+ font-size:13px;
393
+ width: 160px !important;
394
+ margin:1px !important;
395
+ padding:3px !important;
396
+ display: block;
397
+ }
398
 
399
+ div.product_custom_meta br {
400
+ clear: both;
401
+ }
402
+
403
+ /* image form styling */
404
  div.flash-image-uploader {
405
  display: none;
406
  }
409
  position: relative;
410
  border: none;
411
  }
412
+ #wpbody-content div.flash-image-uploader #media-items .progress{
 
413
  position: static;
414
+ margin:0 0 6px;
415
  height: 16px;
416
  }
417
 
418
+
419
+ button#add-product-image {
420
+ float: left;
421
  }
422
 
423
+ div#swfupload_img_indicator {
424
+ float: left;
425
+ height: 20px;
426
+ width: 20px;
427
  display: none;
428
+ }
429
+
430
+ div#swfupload_img_indicator img{
431
+ margin: 4px 2px 2px 4px;
432
+ }
433
+
434
+ ul#gallery_list{
435
+ clear:both;
436
+ list-style-type:none;
437
+ list-style-position: inside;
438
  cursor: pointer;
439
+ min-height:70px;
440
+ _height:70px;
441
+ padding-left:0px;
442
+ margin: 6px 0px 0px 6px;
443
+ }
444
+
445
+ ul#gallery_list li{
446
+ float:left;
447
+ }
448
+
449
+ ul#gallery_list li *{
450
+ z-index:79;
451
+ }
452
+ ul#gallery_list li.first *{
453
+ z-index:80;
454
+ }
455
+ .ui-selected {
456
+ border:2px dashed #969696;
457
  }
458
 
459
+ img.deleteButton {
460
+ display:none;
461
+ position:absolute;
462
+ top:-5px;
463
+ right: -1px;
464
+ width:16px;
465
+ height:16px;
466
+ cursor:pointer;
467
+ }
468
  a.editButton {
469
+ background:#FFFFFF none repeat scroll 0%;
470
+ height:20px;
471
+ display:none;
472
+ position:absolute;
473
+ right:0px;
474
+ top:0px;
475
+ padding-bottom:3px;
476
+ padding-left:3px;
477
+ cursor:pointer;
478
  }
479
 
480
  div.image_settings_box {
481
+ position:absolute;
482
+ width:150px;
483
+ display:none;
484
  margin: -66px 0px 0px 36px;
485
+ _margin: 0px 0px 0px -30px;
486
+ padding-top:2px;
487
+ width:252px;
488
+ z-index:69;
489
+ _z-index:80;
490
  }
491
 
492
  a.thickbox img {
493
+ border:medium none;
494
  }
495
 
496
  img.previewimage {
497
+ cursor:move;
498
+ height:60px;
499
+ margin-right:4px;
500
+ width:60px;
501
  }
502
 
503
  div.lower_settings_box {
504
+ width:234px;
505
+ background-color:white;
506
+ border:1px solid black;
507
+ border-top:1px solid #CCCCCC;
508
+ float:right;
509
  margin: -1px -6px 0px 0px;
510
  padding: 2px 0 0 4px;
511
+ background-color:#EAF3FA;
512
  }
513
 
514
  div.upper_settings_box {
515
+ width:250px;
516
+ background-color:white;
517
+ border:1px solid black;
518
+ padding:3px 1px 2px 5px;
519
  }
520
 
521
  div.upper_image {
522
+ float:left;
523
+ /* border-bottom:1px solid black; */
524
+ padding-left:5px;
525
+ margin-left:-5px;
526
+ _margin-left:-3px;
527
+ margin-right:-7px;
528
+ padding-bottom:4px;
529
+ _padding-bottom:6px;
530
+ _margin-bottom:-2px;
531
  }
532
 
533
+ div.upper_txt{
534
+ padding-left:22px;
535
+ color:#666666;
536
  }
537
 
538
  div.previewimage {
539
+ position:relative;
540
+ }
541
+
542
+ tr.edit_product_image *{
543
+ z-index:80;
544
+ }
545
+
546
+ a.closeimagesettings{
547
+ cursor:pointer;
548
+ margin-left:90px;
549
  }
550
 
551
+ div.browser-image-uploader {
552
+
553
  }
554
 
555
+ div.browser-image-uploader h4{
556
  margin-bottom: 8px;
557
  }
558
 
564
  width: 100%;
565
  }
566
 
567
+ #wpsc_product_category_and_tag_forms table td.itemfirstcol{
568
+ padding-left:3pt;
569
  width: 50%;
570
  }
571
 
572
+ /* variations CSS starts */
573
 
574
+ table.product_variation_listing{
 
 
 
 
575
  margin-bottom: 12px;
576
  }
577
 
578
+ table.product_variation_listing th.variation_name{
579
  color: #71A4C8;
580
  font-style: italic;
581
  text-align: left;
582
  padding-bottom: 1px;
583
  }
584
 
585
+ table.product_variation_grid{
586
  margin-top: 12px;
587
  }
588
 
589
+ table.product_variation_grid th.variation_name{
590
  color: #71A4C8;
591
  font-style: italic;
592
  text-align: left;
596
  div#edit_variations_container {
597
  margin-top: 12px;
598
  }
 
599
  table.product_variation_grid {
600
  border-collapse: collapse;
601
  margin-top: 0px;
602
  }
603
 
604
+ table.product_variation_grid tr td, table.product_variation_grid tr th {
 
605
  border: 1px solid #cccccc;
606
  border-collapse: collapse;
607
  text-align: left;
620
  width: 78px;
621
  }
622
 
623
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th {
 
624
  padding: 4px 0px 4px 10px;
625
  }
626
 
627
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th.variations {
 
628
  width: 300px;
629
  }
630
 
631
+
632
+ table.product_variation_grid tr td input{
633
  padding: 0px 3px 0px 3px;
634
  }
635
 
638
  }
639
 
640
  a.about_this_page_sub {
641
+ text-decoration:underline;
642
  }
643
 
644
+ table.product_variation_grid tr td, table.product_variation_grid tr th {
 
645
  border: 1px solid #cccccc;
646
  border-collapse: collapse;
647
  text-align: left;
656
  padding: 0px !important;
657
  }
658
 
659
+
660
  table.product_variation_grid tr.settings_row td div.variation_settings {
661
  display: none;
662
  border-top: 1px dotted #cccccc;
663
  width: 100%;
664
  min-height: 30px;
665
  padding: 4px 10px;
 
666
 
667
+ }
668
  table.product_variation_grid tr th {
669
  border-bottom: 1px solid #969696;
670
  }
678
  width: 78px;
679
  }
680
 
681
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th {
 
682
  padding: 4px 0px 4px 10px;
683
  }
684
 
685
+ table.product_variation_grid tr td.variations, table.product_variation_grid tr th.variations {
 
686
  width: 300px;
687
  }
688
 
689
+
690
+ table.product_variation_grid tr td input{
691
  padding: 0px 3px 0px 3px;
692
  }
693
 
694
+ table.product_variation_grid tr td input.checkbox{
695
  display: block;
696
+ margin:6px auto;
697
  }
698
 
699
  table.product_variation_grid tr.group_boundary td {
712
  margin-bottom: 4px;
713
  }
714
 
715
+ div.variation_checkboxes label {
716
+ display: block;
717
+ margin-bottom: 2px;
718
+ }
719
+
720
+ div.variation_checkboxes label input {
721
+ position: relative;
722
+ top: 2px;
723
+ margin-right: 3px;
724
+ }
725
+
726
  a.variation_edit_button {
727
  display: block;
728
  height: 16px;
729
  width: 16px;
730
  margin: 4px auto 0px auto;
731
+
732
  }
733
 
734
+ div.variation_settings div.variation_settings_contents{
735
  padding-left: 10px;
736
  }
737
 
738
  div.select_variation_file {
739
  padding-left: 6px;
740
  }
 
741
  div.select_variation_file p {
742
+ margin:0 0 3px;
743
  }
744
 
745
  div.select_variation_file p {
746
+ margin:0 0 3px;
747
  }
748
 
749
  div.select_variation_file p input {
751
  top: 2px;
752
  }
753
 
 
 
 
 
 
 
 
 
 
 
 
754
 
755
+ label.variation_checkbox {
756
  display: block;
757
  }
758
 
759
+ div.variation_set{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
760
  }
761
+ div.variation{
762
+ padding-left: 10px;
 
763
  }
764
+ /* variations CSS ends */
765
 
 
766
 
767
  div#side-sortables input[type="file"] {
768
+ width:250px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
769
  }
770
+ div.select_product_file, div.edit_select_product_file {
771
+ margin-bottom:0;
772
+ margin-top:3px;
773
+ overflow-x:hidden;
774
+ overflow-y:auto;
775
+ padding:2px 2px 6px;
776
+ position:relative;
 
 
777
  }
778
 
779
  a.file_delete_button {
780
+ cursor:pointer;
781
+ float:right;
782
+ color:red;
783
  display: block;
784
  }
785
 
786
  a.delete_button {
787
+ border-color:-moz-use-text-color -moz-use-text-color #FF0000;
788
+ border-style:none none solid;
789
+ border-width:medium medium 1px;
790
+ color:#FF0000;
791
+ font-size:11px;
792
+ padding:1px 2px;
793
+ text-decoration:none;
794
+ }
795
+ .greytext{
796
+ color:#666666;
797
+ }
798
+ span.small_italic{
799
+ font-style: italic;
800
  }
801
+ /* Product details form styling ends */
802
+ /*
803
+ * Display Products CSS ends here
804
+ */
805
 
806
+ /* shipping options start here */
807
+ div.wpsc_shipping_options{
808
+ width:100%;
809
+ padding:3px 0;
810
  }
811
+ .wpsc-shipping-actions{
812
+ visibility:hidden;
813
+ font-size: 10px;
814
+ margin:2px 9em 0 0;
815
+ float:right;
816
+ }
817
+ div.wpsc_shipping_options:hover .wpsc-shipping-actions{
818
+ font-size:10px;
819
+ visibility:visible;
820
  }
821
 
822
+ /*
823
+ * Product Groups styles start here
824
+ */
825
+ td.firstcol div.postbox div.inside{
 
 
 
 
 
 
826
  margin: 0px;
827
  padding: 0px;
828
  }
829
 
830
+ table#productpage{
831
  width: 100%;
832
  clear: both;
833
  border-collapse: collapse;
834
  }
835
 
836
+ table#productpage tr td{
837
  vertical-align: top;
838
+ /* padding: 0px 0px 0px 6px; */
839
  }
840
 
841
+ table#productpage tr td.secondcol{
842
+ /* width: 60%; */
843
+ /* margin-left: 20px; */
844
  padding: 0px 2px 0px 16px;
845
+
846
  }
847
 
848
+
849
  table.category-edit {
850
  border-collapse: collapse;
851
  width: 100%;
858
  width: 450px;
859
  }
860
 
861
+
862
  div.category-image-container {
863
  width: 55px;
864
  height: 30px;
865
+
866
  }
867
 
868
  div.category-image-container img {
869
  float: left;
870
  }
 
871
  div.category-image-container img.category_indenter {
872
  margin-right: 3px;
873
+ width:auto;
874
+ float:left;
875
  }
876
 
 
 
 
 
877
 
 
 
 
 
878
 
 
 
 
879
 
 
 
 
880
 
881
+ div#productform{ display: none; width: 99.5%; }
882
+
883
+ div#edititem27{ display: none; width: 586px; }
884
+
885
+ div#productform table tr td{ height: 11px !important; }
886
+
887
+
888
+
889
+
890
+ div#blank_item{ display: block;}
891
+
892
+ #poststuff div#blank_item h3{
893
  margin-top: 0px;
 
894
 
 
 
895
  }
896
 
897
+ div#additem{ display: none;}
 
 
 
898
 
899
+ div#productform td.itemfirstcol{ padding-left:4px; vertical-align: top; }
900
+
901
+
902
+
903
+
904
+ div#productform input.text, div#additem input.text{
905
+ width:386px;
906
+ border:1px solid #bbb;
907
  }
908
 
909
+
910
  table.category_forms {
911
  width: 100%;
912
  }
 
913
  table.category_forms tr td {
914
  padding: 0px;
915
  padding-right: 8px;
916
  }
917
+ table.category_forms tr td textarea {
 
918
  width: 386px;
919
  }
920
 
921
+ div#edit_variation_values input.text{width:286px !important;border:1px solid #bbb;}
 
 
 
922
 
923
+ input.image_resize{ position: relative; top: 4px; }
 
 
 
924
 
925
+ div#additem table.additem input.wpsc_tag{
926
+ width:180px;
927
  }
928
+ div#additem label{
 
929
  font-style: normal;
930
  font-size: 0.95em;
931
  }
932
 
933
+
934
+
935
+
936
+
937
+ .groupItem{
938
+ border-top:1px solid #bbb;
939
+ width:385px;
940
+ height:35px;
941
  clear: both;
942
+ /* margin-left:-6px; */
943
  padding: 0px 0px 4px 0px;
944
  }
945
 
946
+ .groupItem .itemHeader{
947
+ width:65px;
948
  line-height: 15px;
949
  color: #000;
950
  padding: 4px;
954
  clear: both;
955
  }
956
 
957
+ .groupItem .itemHeader a{
958
  margin: 4px 0px 4px 0px;
959
  font-weight: normal;
960
  font-size: 11px;
961
  text-decoration: none;
962
  }
963
+ .sortHelper{
 
964
  border: 3px dashed #666;
965
  width: auto;
966
  }
967
+ .groupWrapper p{
 
968
  height: 1px;
969
  overflow: hidden;
970
  margin: 0;
971
  padding: 0;
972
  }
973
 
974
+
975
  table#productpage tr td.secondcol.product_groups_page {
976
  padding-left: 16px;
977
  }
981
  margin-top: 20px;
982
  }
983
 
984
+ td.product_groups_page #additem .inside, td.product_groups_page #productform .inside {
 
985
  margin: 0px 0px 15px 0px;
986
  }
987
 
988
  div.editing_this_group {
989
  margin-top: 8px;
990
  margin-bottom: 8px;
991
+ /* border-bottom:1px dotted black; */
992
+ width:100%;
993
  }
994
 
995
  td.product_groups_page h4 {
996
  margin-bottom: 1ex;
997
  }
998
+ #editorcontainer{
999
+ clear:both;
 
1000
  }
 
1001
  td.product_groups_page td.category_presentation_settings {
1002
  padding-bottom: 1ex;
1003
  }
1004
 
1005
  div.editing_this_group {
1006
+ font-size:8pt;
1007
  }
1008
 
1009
  div.editing_this_group p {
1010
+ padding:4px 4px 4px 8px;
1011
  }
1012
 
1013
  div.editing_this_group dl {
1014
+ padding:4px 4px 4px 8px;
1015
  }
1016
 
1017
+
1018
+ #blank_item a.add_category_link{
1019
  display: block;
1020
  margin: 8px 8px 8px 0px;
1021
  text-decoration: underline;
1025
  margin: 12px 0px 10px 0px;
1026
  }
1027
 
1028
+
1029
  table#wpsc_category_list td div.subcategory img.category_indenter {
1030
  float: left;
1031
  margin: 8px 0px 0px 0px;
1035
  float: left;
1036
  }
1037
 
1038
+
1039
+ label.select_categorisation_group, select#select_categorisation_group, a.add_categorisation_group, a.edit_categorisation_group, #submit_categorisation_form span {
 
 
 
1040
  display: block;
1041
  float: left;
1042
  }
1053
 
1054
  label.select_categorisation_group {
1055
  padding-top: 4px;
1056
+ /* color: #336699; */
1057
  font-size: 11px;
1058
  }
1059
 
1065
  margin-left: 30px;
1066
  }
1067
 
1068
+
1069
+
1070
+ div#add_categorisation, div#edit_categorisation{
1071
  display: none;
1072
  border: 1px solid #BBBBBB;
1073
  padding: 4px;
1074
  margin-top: 6px;
1075
  }
1076
 
1077
+ div#add_categorisation br, div#edit_categorisation br{
 
1078
  clear: both;
1079
  }
1080
 
1081
+
1082
+ div#add_categorisation fieldset, div#edit_categorisation fieldset{
1083
  width: 230px;
1084
  float: left;
1085
  border: none;
1086
  }
1087
 
1088
+ div#add_categorisation fieldset label, div#edit_categorisation fieldset label{
 
1089
  display: block;
1090
  }
1091
 
1092
+ ul.categorisation_links{
1093
  list-style-type: none;
1094
  clear: both;
1095
  padding: 0px;
1096
  }
1097
+ .wpsc_add_new_currency{
1098
+ text-decoration: none;
1099
+ }
1100
+ ul.categorisation_links li{
1101
  display: block;
1102
  float: left;
1103
  list-style-type: none;
1106
  padding: 4px;
1107
  }
1108
 
1109
+ ul.categorisation_links li.selected a{
1110
  color: #D54E21;
1111
  }
1112
 
 
 
 
 
1113
  .multiple-select {
1114
  background: white none repeat scroll 0px 0px;
1115
  border: 1px solid #DFDFDF;
1116
  display: inline-block;
1117
  height: 120px;
1118
+ margin: 10px 0;
1119
  overflow-x: hidden;
1120
  overflow-y: auto;
1121
+ padding: 0px;
1122
  position: relative;
1123
+ width:98%
1124
  }
1125
 
1126
+ table.category_forms a.delete_button {
 
 
 
 
 
 
 
 
1127
  display: block;
1128
  margin: 3px 0px 0px 8px;
1129
  float: left;
1133
  padding: 16px 0px 0px 0px;
1134
  }
1135
 
1136
+ .wpsc_gold_float{
1137
+ min-width:45%;
1138
+ float:left;
1139
+ max-width:450px;
1140
+ _width:450px;
1141
  }
1142
+ .wpsc_gold_side{
1143
+ margin-top:90px;
1144
+ float:right;
1145
+ width:35%;
1146
+ }
1147
+ .wpsc_gold_text{
1148
+ width:70%;
1149
+ float:left;
1150
+ clear:both;
1151
  }
1152
 
1153
+ .wpsc_gold_info{
1154
+ width:30%;
1155
+ float:right;
1156
  text-align: center;
1157
+ font-size:20px;
1158
  }
1159
+ .wpsc_gold_module{
1160
+ width:100%;
1161
+ float:left;
1162
 
 
 
 
1163
  border-bottom: 1px solid #DFDFDF;
1164
  }
1165
+ .wpsc_gold_module strong{
1166
+ width:auto;
1167
+ float:left;
 
1168
  }
1169
+ #visitInstinct{
1170
+ float:right;
1171
+ margin:5px 20px 0 0;
 
1172
  }
1173
 
 
 
 
1174
 
1175
+ #gold_cart_form .postbox p img{
1176
+ padding-bottom:10px;
1177
  }
1178
+ #wpsc_gold_options_outside{
1179
+ width:400px;
1180
+ }
1181
+ #gold_cart_form .postbox p{
1182
  padding-left: 4px;
1183
  }
1184
+ #gold_cart_form .postbox{
1185
+ width:100%;
1186
+ max-width:500px;
 
1187
  }
1188
+ #gold_cart_form .postbox p{
1189
+ padding-left:10px;
 
1190
  }
1191
+ #gold_cart_form .postbox p label{
1192
+ width:80px;
1193
+ float:left;
 
1194
  }
1195
 
1196
  a.admin_download {
1200
  text-decoration: none;
1201
  }
1202
 
1203
+ a.admin_download img{
1204
  margin-right: 3px;
1205
  }
1206
 
1207
+ a.admin_download span{
1208
  text-decoration: underline;
1209
  }
1210
 
1211
+ /*
1212
+ * Product Groups styles end here
1213
+ */
1214
+ .wpsc_td_note{
1215
+ padding-bottom:0 !important;
 
 
1216
  }
1217
 
1218
  .wpsc_purchaselogs_options {
1219
  margin: 0px 0px 8px 0px;
1220
+
1221
+ }
1222
+
1223
+
1224
+ .add_new_form_set {
1225
+ /* display: block;
1226
+ float: left;*/
1227
+ text-decoration: underline;
1228
+ font-weight: bold;
1229
+ font-size:0.9em;
1230
  }
1231
 
1232
+
1233
  p.add_new_form_set_forms {
1234
  display: none;
1235
  }
1237
  td.product-image a img.attachment-thumbnail {
1238
  height: 38px;
1239
  width: 38px;
1240
+
1241
  }
1242
 
1243
  #wpsc_product_category_and_tag_forms .tagchecklist {
1244
+ font-size:11px;
1245
  }
1246
 
1247
+ #categorydiv div{
1248
  margin-top: 4px;
1249
  }
1250
 
1254
  font-size: 15px;
1255
  }
1256
 
1257
+ .toplevel_page_wpsc-edit-products .wrap h2
1258
+ {
1259
+ padding-bottom:0px;
1260
+ border-bottom:1px solid #CCC;
1261
  }
1262
+ #post-body #advanced-sortables
1263
+ {
1264
+ margin-right:300px
1265
  }
1266
+ #media-buttons #add_audio,
1267
+ #media-buttons #add_video,
 
1268
  #media-buttons #add_media {
1269
+ display:none;
1270
+ }
 
1271
  .meta-box-sortables-wpec .postbox:hover .handlediv {
1272
  background: transparent url(../../wpsc-core/images/menu-bits.gif) no-repeat scroll 0% -111px;
1273
  }
1274
+ /* Main Flora Style Sheet for jQuery UI ui-datepicker */
1275
+ #ui-datepicker-div, .ui-datepicker-inline {
1276
+ font-family: Arial,Helvetica,sans-serif;
1277
+ font-size: 14px;
1278
+ padding: 0;
1279
+ margin: 0;
1280
+ background: #E0F4D7;
1281
+ width: 185px;
1282
+ }
1283
+ #ui-datepicker-div {
1284
  display: none;
1285
+ border: 1px solid #21759B;
1286
+ z-index: 10;
1287
  }
1288
+ .ui-datepicker-inline {
1289
+ float: left;
1290
+ display: block;
1291
+ border: 0;
1292
  }
1293
+ .ui-datepicker-rtl {
1294
+ direction: rtl;
 
1295
  }
1296
+ .ui-datepicker-dialog {
1297
+ padding: 5px !important;
1298
+ border: 4px ridge #fff !important;
 
 
1299
  }
1300
+ button.ui-datepicker-trigger {
1301
+ width: 25px;
 
 
 
1302
  }
1303
+ img.ui-datepicker-trigger {
1304
+ margin: 2px;
1305
+ vertical-align: middle;
 
1306
  }
1307
+ .ui-datepicker-prompt {
1308
+ float: left;
1309
+ padding: 2px;
1310
+ background: #fff;
1311
+ color: #000;
1312
  }
1313
+ *html .ui-datepicker-prompt {
1314
+ width: 185px;
 
1315
  }
1316
+ .ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {
1317
+ clear: both;
1318
+ float: left;
1319
+ width: 100%;
1320
+ color: #FFF;
1321
  }
1322
+ .ui-datepicker-control {
1323
+ background: #fff;
1324
+ padding: 2px 0px;
1325
+ display:none;
1326
+ }
1327
+ .ui-datepicker-links {
1328
+ background: #fff;
1329
+ padding: 2px 0px;
1330
+ }
1331
+ .ui-datepicker-control, .ui-datepicker-links {
1332
+ font-weight: bold;
1333
+ font-size: 80%;
1334
+ letter-spacing: 1px;
1335
+ }
1336
+ .ui-datepicker-links label {
1337
+ padding: 2px 5px;
1338
+ color: #fff;
1339
+ }
1340
+ .ui-datepicker-clear, .ui-datepicker-prev {
1341
+ float: left;
1342
+ width: 34%;
1343
+ }
1344
+ .ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {
1345
+ float: right;
1346
+ text-align: right;
1347
+ }
1348
+ .ui-datepicker-current {
1349
+ float: left;
1350
+ width: 30%;
1351
+ text-align: center;
1352
+ }
1353
+ .ui-datepicker-close, .ui-datepicker-next {
1354
+ float: right;
1355
+ width: 34%;
1356
+ text-align: right;
1357
+ }
1358
+ .ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {
1359
+ float: left;
1360
  text-align: left;
1361
+ }
1362
+ .ui-datepicker-header {
1363
+ padding: 1px 0 3px;
1364
+ background: #fff;
1365
+ text-align: center;
1366
  font-weight: bold;
1367
+ height: 1.3em;
1368
  }
1369
+ .ui-datepicker-header select {
1370
+ background: #fff;
1371
+ color: #000;
1372
+ border: 0px;
1373
+ font-weight: bold;
1374
  }
1375
+ .ui-datepicker {
1376
+ background: #fff;
1377
+ text-align: center;
1378
+ font-size: 100%;
1379
  }
1380
+ .ui-datepicker a {
1381
+ display: block;
1382
+ width: 100%;
1383
  }
1384
+ .ui-datepicker-title-row {
1385
+ background: #fff;
1386
+ color: #000;
1387
  }
1388
+ .ui-datepicker-title-row .ui-datepicker-week-end-cell {
1389
+ background: #fff;
 
1390
  }
1391
+ .ui-datepicker-days-row {
1392
+ background: #FFF;
1393
+ color: #666;
1394
+ }
1395
+ .ui-datepicker-week-col {
1396
+ background: #ededed;
1397
+ color: #000;
1398
+ }
1399
+ .ui-datepicker-days-cell {
1400
+ color: #000;
1401
+ border: 1px solid #DDD;
1402
+ }
1403
+ .ui-datepicker-days-cell a {
1404
  display: block;
1405
+ }
1406
+ .ui-datepicker-week-end-cell {
1407
+ background: #EAF2FA;
1408
+ }
1409
+ .ui-datepicker-unselectable {
1410
+ color: #888;
1411
+ }
1412
+ .ui-datepicker-week-over, .ui-datepicker-week-over .ui-datepicker-week-end-cell {
1413
+ background: #B1DB87 !important;
1414
+ }
1415
+ .ui-datepicker-days-cell-over, .ui-datepicker-days-cell-over.ui-datepicker-week-end-cell {
1416
+ background: #FFF !important;
1417
+ border: 1px solid #777;
1418
+ }
1419
+ * html .ui-datepicker-title-row .ui-datepicker-week-end-cell {
1420
+ background: #ddd !important;
1421
+ }
1422
+ * html .ui-datepicker-week-end-cell {
1423
+ background: #ddd !important;
1424
+ border: 1px solid #DDD !important;
1425
+ }
1426
+ * html .ui-datepicker-days-cell-over {
1427
+ background: #FFF !important;
1428
+ border: 1px solid #777 !important;
1429
+ }
1430
+ * html .ui-datepicker-current-day {
1431
+ background: #d3d3d3 !important;
1432
+ }
1433
+ .ui-datepicker-today {
1434
+ background: #dddddd !important;
1435
+ }
1436
+ .ui-datepicker-current-day {
1437
+ background: #d3d3d3 !important;
1438
+ }
1439
+ .ui-datepicker-status {
1440
+ background: #fff;
1441
+ width: 100%;
1442
+ font-size: 80%;
1443
+ text-align: center;
1444
+ }
1445
+ #ui-datepicker-div a, .ui-datepicker-inline a {
1446
+ cursor: pointer;
1447
+ margin: 0;
1448
+ padding: 0;
1449
+ background: none;
1450
+ color: #000;
1451
+ }
1452
+ .ui-datepicker-inline .ui-datepicker-links a {
1453
+ padding: 0 5px !important;
1454
+ }
1455
+ .ui-datepicker-control a, .ui-datepicker-links a {
1456
+ padding: 2px 5px !important;
1457
+ color: #000 !important;
1458
+ }
1459
+ .ui-datepicker-title-row a {
1460
+ color: #000 !important;
1461
+ }
1462
+ .ui-datepicker-control a:hover {
1463
+ background: #f1f1f1 !important;
1464
+ color: #333 !important;
1465
+ }
1466
+ .ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {
1467
+ background: #FFF !important;
1468
+ color: #333 !important;
1469
+ }
1470
+ .ui-datepicker-multi .ui-datepicker {
1471
+ /* border: 1px solid #83C948; */
1472
+ }
1473
+ .ui-datepicker-one-month {
1474
  float: left;
1475
+ width: 185px;
1476
+ }
1477
+ .ui-datepicker-new-row {
1478
+ clear: left;
1479
  }
1480
+ .ui-datepicker-cover {
1481
+ display: none;
1482
+ display: block;
1483
+ position: absolute;
1484
+ z-index: -1;
1485
+ filter: mask();
1486
+ top: -4px;
1487
+ left: -4px;
1488
+ width: 193px;
1489
+ height: 200px;
1490
+ }
1491
+ /* marketing / coupon page styling */
1492
 
1493
+ div.modify_coupon{ border: 1px solid #eeeeee; display: none; width: 100%; }
1494
+ table.coupon_data{
1495
+ width: 100%;
 
1496
  }
1497
+ table.add-coupon{width:100%;}
1498
+ table.add-coupon tr th{ text-align: left; padding: 2px 5px 0px 5px; border: none;}
1499
+ table.add-coupon tr td{ text-align: left; padding: 2px 5px 2px 5px; border: none;}
1500
+ table.add-coupon tr td p{padding:0;margin:5px;}
1501
+ #table_header{
1502
+ font-size:16px;
1503
+ margin-top:20px;
1504
+ font-weight: bold;
1505
+ }
1506
+ table.coupon-list{ width: 100%; }
1507
+ table.coupon-list th{ text-align:left;}
1508
+ table.coupon-list tr.toprow td{ text-align: left; font-weight:bold; }
1509
+
1510
+ table.coupon-list tr td{ padding: 5px 5px 10px 10px; vertical-align: middle;}
1511
+
1512
+ table.coupon-list tr.alt{ background-color: #eeeeee; }
1513
 
1514
+ table.coupon-list tr.alt td{ background-color: #eeeeee; }
1515
+ table.coupon-list tr.coupon_edit td{ padding:0; }
1516
+ td#order_summary_container{ width: 80px; }
1517
+ table.category_forms a.delete_button, span.delete_button {
1518
+ color:#FF0000;
1519
+ display:block;
1520
+ float:left;
1521
+ font-size:11px;
1522
+ margin:3px 0 0 8px;
1523
+ text-decoration:underline;
1524
+ }
1525
+ p span.input_label{
1526
+ font-size:1.2em;
1527
+ width:180px;
1528
+ float:left;
1529
+ }
1530
  a.wpsc_featured_product_toggle {
1531
  display: block;
1532
  height: 18px;
1533
  width: 18px;
1534
+ margin: 4px 0px 0px 6px;
1535
  }
1536
 
1537
+ a.wpsc_featured_product_toggle img {
1538
+ display: block;
1539
+ margin: 0px auto 0px auto;
 
 
 
 
1540
 
 
 
 
1541
  }
1542
 
1543
  div.wpsc_clear {
1551
  position: relative;
1552
  }
1553
 
1554
+
1555
  .wpsc_featured .item_text {
1556
  float: left;
1557
  height: 240px;
1570
  height: 240px;
1571
  width: 340px;
1572
  border: 1px solid #FEFAF1;
1573
+ border-radius: 18px;
1574
+ -moz-border-radius: 18px;
1575
  -webkit-border-radius: 18px;
 
 
1576
  background-repeat: no-repeat;
1577
  }
1578
 
1579
+
1580
  .wpsc_featured .item_text h3 {
1581
  font-size: 1.4em;
1582
  margin: 0px 0px 8px 0px;
1587
  line-height: normal;
1588
  display: block;
1589
  margin: 0px 0px 4px 0px;
1590
+
1591
  }
1592
 
1593
  .wpsc_featured .item_text .wpsc_description {
1594
  font-size: 1em;
1595
+ line-height:24px;
1596
+ display:block;
1597
+ float:left;
1598
  width: auto;
1599
  color: #9B9A96;
1600
+ font-family: Georgia,"Bitstream Charter",serif;
1601
  }
1602
 
1603
  .wpsc_featured .item_text .wpsc_description p {
1604
  margin-bottom: 0px;
1605
  }
1606
 
1607
+
1608
  .wpsc_featured .item_text .wpsc_description a {
1609
+ color:#9B9A96;
1610
  }
1611
 
1612
  ul.wpsc_categories {
1613
  clear: both;
1614
  }
1615
 
1616
+ a.update_variations, a.update_variations_action
1617
+ {
1618
+ float:left;
1619
+ margin:10px;
1620
+ }
1621
  a.update_variations_action {
1622
+ display:none;
1623
  }
1624
+ #search-products{
1625
+ width:auto;
1626
+ float:right;
 
1627
  }
1628
+ .productnav{
1629
+ height: 30px;
1630
+ margin: 6px 0px 4px;
1631
+ vertical-align: middle;
1632
  }
1633
 
1634
+ .wpsc_stock_control_forms .edit_stock {
1635
+ margin-top:0.5em;
1636
+ line-height:16px;
 
1637
  }
1638
+ .wpsc_stock_control_forms .unpublish_when_none_left {
1639
+ margin:0.5em 0;
 
 
1640
  }
1641
+ #media-upload form p.help {
1642
+ text-align:left;
1643
+ clear:both;
 
1644
  }
1645
+ ul#category_list_li, ul.poll-options {
1646
+ }
1647
+ ul#category_list_li li div,
1648
+ ul#category_list_li li div ul li div {
1649
+ }
1650
+ ul#category_list_li li div div,
1651
+ ul#category_list_li li div ul li div div {
1652
 
1653
+ }
1654
+ ul#category_list_li li div:hover div{
 
1655
  }
1656
 
1657
+ ul#category_list_li li div ul li div:hover div {
1658
+ }
1659
+ ul#category_list_li li {
1660
+ }
1661
  ul#category_list_li li:hover span.handle {
1662
+ cursor: move;
1663
+ }
1664
+ .edit{
1665
  }
 
1666
  ul#category_list_li li span.handle {
1667
+ float:left;
1668
+
1669
  padding: 5px;
1670
+
1671
  }
1672
 
1673
+ .category_admin_list_img a.row-title{
1674
  text-decoration: none;
1675
  }
1676
 
1677
+
1678
  .category_admin_list_img:hover div.row-actions {
1679
+ visibility:visible;
1680
  }
1681
 
1682
  ul#category_list_li ul {
1683
+ margin-left:15px;
1684
  }
1685
 
1686
  .row-title img {
1687
+ width:30px;
1688
+ float:left;
1689
+ padding-right:10px;
1690
  }
 
1691
  .row-title {
1692
+ margin-right:5px;
1693
  }
 
1694
  body.edit-php form#posts-filter {
1695
+ min-width:830px;
1696
  }
 
1697
  input.wpsc_cat_image_size {
1698
+ width:40px
1699
  }
 
1700
  input.wpsc_cat_box {
1701
+ width:auto;
1702
+ margin:6px;
 
1703
  }
1704
+ .wpsc_ie_field, .wpsc_inline_actions {
1705
+ display:none;
1706
+ }
1707
+ .wpsc_ie_field{
1708
+ width:100%;
1709
  }
 
1710
  .wpsc_inline_actions .loading_indicator {
1711
+ position:relative;
1712
+ top:3px;
1713
+ left:2px;
1714
  visibility: hidden;
1715
  }
 
1716
  table.tags th#image {
1717
+ width:60px;
 
 
 
 
 
 
 
 
 
 
1718
  }
1719
+ /* quick edit product */
1720
+ fieldset.wpsc-cols {
1721
+ width:30% !important;
1722
+ float:left !important;
1723
  }
1724
 
1725
+ .inline-edit-col-left {
1726
+ width:35% !important;
 
1727
  }
1728
 
1729
  .wpsc-quick-edit {
1730
+ width: 30%;
1731
+ float:left;
1732
  }
1733
 
1734
  textarea.tax_input_product_tag {
1735
+ width:50% !important;
1736
+ height: 95px !important;
1737
  }
1738
 
1739
  ul.wpsc_product_category-checklist {
1740
+ height: 280px;
1741
  }
1742
 
1743
+ span.wpsc-quick-edit{
1744
+ width:75px;
1745
+ display: block;
1746
+ float: left;
1747
  }
1748
+ .wpsc_var_description{
1749
+ margin:20px 0 0 20px !important;
1750
+ color:red;
 
1751
  }
1752
 
1753
  .ajax-loading {
1754
  visibility: hidden;
1755
  }
1756
 
 
 
 
 
 
 
 
 
 
1757
  .dashboard_page_wpsc-update .wpsc-progress-bar {
1758
+ position:relative;
1759
+ height:20px;
1760
+ width:300px;
1761
+ border:1px solid #3a58cf;
1762
+ margin:-0.75em 0 27px;
1763
  }
1764
 
1765
  .dashboard_page_wpsc-update .wpsc-progress-bar * {
1766
+ position:absolute;
1767
+ left:0;
1768
+ top:0;
1769
+ background:#f9f9f9;
1770
+ font-size:12px;
1771
  }
1772
 
1773
  .dashboard_page_wpsc-update .wpsc-progress-bar .block {
1774
+ background-color:#527dff;
1775
+ z-index:-1;
1776
+ height:20px;
1777
  }
1778
 
1779
  .dashboard_page_wpsc-update .wpsc-progress-bar span {
1780
+ display:block;
1781
+ left:310px;
1782
+ line-height:20px;
1783
+ width:200px;
1784
  }
1785
 
1786
  .dashboard_page_wpsc-update .wpsc-progress-bar .eta {
1787
+ top:22px;
1788
+ line-height:15px;
1789
+ width:100%;
1790
  }
1791
 
1792
+ .downloadables_float{
1793
  float: right;
1794
+ width:80px;
1795
  vertical-align: middle;
1796
+
1797
  }
1798
 
1799
+ .downloadables_headding1{
1800
  display: inline;
1801
+ float:left;
1802
  text-align: left;
1803
  vertical-align: middle;
1804
  width: auto;
1805
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/arrows.png DELETED
Binary file
wpsc-admin/css/jquery.ui.datepicker-classic.css DELETED
@@ -1,579 +0,0 @@
1
- /*
2
- * jQuery UI CSS Framework 1.8.16
3
- *
4
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- * http://jquery.org/license
7
- *
8
- * http://docs.jquery.com/UI/Theming/API
9
- *
10
- * Credit goes to Helen Hou-Sandi:
11
- * https://github.com/helenhousandi/wp-admin-jquery-ui
12
- *
13
- */
14
-
15
- /* Layout helpers
16
- ----------------------------------*/
17
- .ui-helper-hidden { display: none; }
18
- .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
19
- .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
20
- .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21
- .ui-helper-clearfix { display: inline-block; }
22
- /* required comment for clearfix to work in Opera \*/
23
- * html .ui-helper-clearfix { height:1%; }
24
- .ui-helper-clearfix { display:block; }
25
- /* end clearfix */
26
- .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
27
-
28
-
29
- /* Interaction Cues
30
- ----------------------------------*/
31
- .ui-state-disabled { cursor: default !important; }
32
-
33
-
34
- /* Icons
35
- ----------------------------------*/
36
-
37
- /* states and images */
38
- .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
39
-
40
-
41
- /* Misc visuals
42
- ----------------------------------*/
43
-
44
- /* Overlays */
45
- .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
46
-
47
-
48
- /*
49
- * jQuery UI CSS Framework 1.8.16
50
- *
51
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
52
- * Dual licensed under the MIT or GPL Version 2 licenses.
53
- * http://jquery.org/license
54
- *
55
- * http://docs.jquery.com/UI/Theming/API
56
- *
57
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=sans-serif&fwDefault=normal&fsDefault=12px&cornerRadius=3px&bgColorHeader=eff8ff&bgTextureHeader=04_highlight_hard.png&bgImgOpacityHeader=75&borderColorHeader=d1e5ee&fcHeader=333333&iconColorHeader=21759b&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=d1e5ee&fcContent=333333&iconColorContent=333333&bgColorDefault=eff8ff&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=75&borderColorDefault=d1e5ee&fcDefault=333333&iconColorDefault=333333&bgColorHover=f7fcfe&bgTextureHover=06_inset_hard.png&bgImgOpacityHover=75&borderColorHover=b8d7e5&fcHover=000000&iconColorHover=333333&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=d1e5ee&fcActive=333333&iconColorActive=333333&bgColorHighlight=ffffe0&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=e6db55&fcHighlight=333333&iconColorHighlight=21759b&bgColorError=ffebe8&bgTextureError=01_flat.png&bgImgOpacityError=95&borderColorError=cc0000&fcError=cc0000&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=3px
58
- */
59
-
60
-
61
- /* Component containers
62
- ----------------------------------*/
63
- .ui-widget { font-family: sans-serif; font-size: 12px; }
64
- .ui-widget .ui-widget { font-size: 1em; }
65
- .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: sans-serif; font-size: 1em; }
66
- .ui-widget-content { border: 1px solid #d1e5ee; background: #ffffff; color: #333333; }
67
- .ui-widget-header { border: 1px solid #d1e5ee; background-color: #f5fafd; background-image: -ms-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -moz-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -o-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -webkit-gradient(linear, left top, left bottom, from(#f7fcfe), to(#eff8ff)); background-image: -webkit-linear-gradient(top, #f7fcfe, #eff8ff); background-image: linear-gradient(top, #f7fcfe, #eff8ff); color: #333333; font-weight: bold; }
68
- .ui-widget-header a { color: #333333; }
69
-
70
- /* Interaction states
71
- ----------------------------------*/
72
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d1e5ee; background-color: #f5fafd; background-image: -ms-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -moz-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -o-linear-gradient(top, #f7fcfe, #eff8ff); background-image: -webkit-gradient(linear, left top, left bottom, from(#f7fcfe), to(#eff8ff)); background-image: -webkit-linear-gradient(top, #f7fcfe, #eff8ff); background-image: linear-gradient(top, #f7fcfe, #eff8ff); font-weight: normal; color: #333333; }
73
- .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #333333; text-decoration: none; }
74
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #b8d7e5; background-color: #f7fcfe; background-image: -ms-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -moz-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -o-linear-gradient(top, #eff8ff, #f7fcfe); background-image: -webkit-gradient(linear, left top, left bottom, from(#eff8ff), to(#f7fcfe)); background-image: -webkit-linear-gradient(top, #eff8ff, #f7fcfe); background-image: linear-gradient(top, #eff8ff, #f7fcfe);; font-weight: normal; color: #000000; }
75
- .ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; }
76
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #d1e5ee; background: #ffffff; font-weight: normal; color: #333333; }
77
- .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #333333; text-decoration: none; }
78
- .ui-widget :active { outline: none; }
79
-
80
- /* Interaction Cues
81
- ----------------------------------*/
82
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #e6db55; background: #ffffe0; color: #333333; }
83
- .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #333333; }
84
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cc0000; background: #ffebe8; color: #cc0000; }
85
- .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc0000; }
86
- .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc0000; }
87
- .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
88
- .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
89
- .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
90
-
91
- /* Icons
92
- ----------------------------------*/
93
-
94
- /* states and images */
95
- .ui-icon { width: 16px; height: 16px; background-image: url(ui-images/ui-icons_333333_256x240.png); }
96
- .ui-widget-content .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
97
- .ui-widget-header .ui-icon {background-image: url(ui-images/ui-icons_999999_256x240.png); }
98
- .ui-state-default .ui-icon { background-image: url(ui-images/ui-icons_333333_256x240.png); }
99
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
100
- .ui-state-active .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
101
- .ui-state-highlight .ui-icon {background-image: url(ui-images/ui-icons_21759b_256x240.png); }
102
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-images/ui-icons_cc0000_256x240.png); }
103
-
104
- /* positioning */
105
- .ui-icon-carat-1-n { background-position: 0 0; }
106
- .ui-icon-carat-1-ne { background-position: -16px 0; }
107
- .ui-icon-carat-1-e { background-position: -32px 0; }
108
- .ui-icon-carat-1-se { background-position: -48px 0; }
109
- .ui-icon-carat-1-s { background-position: -64px 0; }
110
- .ui-icon-carat-1-sw { background-position: -80px 0; }
111
- .ui-icon-carat-1-w { background-position: -96px 0; }
112
- .ui-icon-carat-1-nw { background-position: -112px 0; }
113
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
114
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
115
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
116
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
117
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
118
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
119
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
120
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
121
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
122
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
123
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
124
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
125
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
126
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
127
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
128
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
129
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
130
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
131
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
132
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
133
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
134
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
135
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
136
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
137
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
138
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
139
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
140
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
141
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
142
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
143
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
144
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
145
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
146
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
147
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
148
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
149
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
150
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
151
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
152
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
153
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
154
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
155
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
156
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
157
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
158
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
159
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
160
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
161
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
162
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
163
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
164
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
165
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
166
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
167
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
168
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
169
- .ui-icon-arrow-4 { background-position: 0 -80px; }
170
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
171
- .ui-icon-extlink { background-position: -32px -80px; }
172
- .ui-icon-newwin { background-position: -48px -80px; }
173
- .ui-icon-refresh { background-position: -64px -80px; }
174
- .ui-icon-shuffle { background-position: -80px -80px; }
175
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
176
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
177
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
178
- .ui-icon-folder-open { background-position: -16px -96px; }
179
- .ui-icon-document { background-position: -32px -96px; }
180
- .ui-icon-document-b { background-position: -48px -96px; }
181
- .ui-icon-note { background-position: -64px -96px; }
182
- .ui-icon-mail-closed { background-position: -80px -96px; }
183
- .ui-icon-mail-open { background-position: -96px -96px; }
184
- .ui-icon-suitcase { background-position: -112px -96px; }
185
- .ui-icon-comment { background-position: -128px -96px; }
186
- .ui-icon-person { background-position: -144px -96px; }
187
- .ui-icon-print { background-position: -160px -96px; }
188
- .ui-icon-trash { background-position: -176px -96px; }
189
- .ui-icon-locked { background-position: -192px -96px; }
190
- .ui-icon-unlocked { background-position: -208px -96px; }
191
- .ui-icon-bookmark { background-position: -224px -96px; }
192
- .ui-icon-tag { background-position: -240px -96px; }
193
- .ui-icon-home { background-position: 0 -112px; }
194
- .ui-icon-flag { background-position: -16px -112px; }
195
- .ui-icon-calendar { background-position: -32px -112px; }
196
- .ui-icon-cart { background-position: -48px -112px; }
197
- .ui-icon-pencil { background-position: -64px -112px; }
198
- .ui-icon-clock { background-position: -80px -112px; }
199
- .ui-icon-disk { background-position: -96px -112px; }
200
- .ui-icon-calculator { background-position: -112px -112px; }
201
- .ui-icon-zoomin { background-position: -128px -112px; }
202
- .ui-icon-zoomout { background-position: -144px -112px; }
203
- .ui-icon-search { background-position: -160px -112px; }
204
- .ui-icon-wrench { background-position: -176px -112px; }
205
- .ui-icon-gear { background-position: -192px -112px; }
206
- .ui-icon-heart { background-position: -208px -112px; }
207
- .ui-icon-star { background-position: -224px -112px; }
208
- .ui-icon-link { background-position: -240px -112px; }
209
- .ui-icon-cancel { background-position: 0 -128px; }
210
- .ui-icon-plus { background-position: -16px -128px; }
211
- .ui-icon-plusthick { background-position: -32px -128px; }
212
- .ui-icon-minus { background-position: -48px -128px; }
213
- .ui-icon-minusthick { background-position: -64px -128px; }
214
- .ui-icon-close { background-position: -80px -128px; }
215
- .ui-icon-closethick { background-position: -96px -128px; }
216
- .ui-icon-key { background-position: -112px -128px; }
217
- .ui-icon-lightbulb { background-position: -128px -128px; }
218
- .ui-icon-scissors { background-position: -144px -128px; }
219
- .ui-icon-clipboard { background-position: -160px -128px; }
220
- .ui-icon-copy { background-position: -176px -128px; }
221
- .ui-icon-contact { background-position: -192px -128px; }
222
- .ui-icon-image { background-position: -208px -128px; }
223
- .ui-icon-video { background-position: -224px -128px; }
224
- .ui-icon-script { background-position: -240px -128px; }
225
- .ui-icon-alert { background-position: 0 -144px; }
226
- .ui-icon-info { background-position: -16px -144px; }
227
- .ui-icon-notice { background-position: -32px -144px; }
228
- .ui-icon-help { background-position: -48px -144px; }
229
- .ui-icon-check { background-position: -64px -144px; }
230
- .ui-icon-bullet { background-position: -80px -144px; }
231
- .ui-icon-radio-off { background-position: -96px -144px; }
232
- .ui-icon-radio-on { background-position: -112px -144px; }
233
- .ui-icon-pin-w { background-position: -128px -144px; }
234
- .ui-icon-pin-s { background-position: -144px -144px; }
235
- .ui-icon-play { background-position: 0 -160px; }
236
- .ui-icon-pause { background-position: -16px -160px; }
237
- .ui-icon-seek-next { background-position: -32px -160px; }
238
- .ui-icon-seek-prev { background-position: -48px -160px; }
239
- .ui-icon-seek-end { background-position: -64px -160px; }
240
- .ui-icon-seek-start { background-position: -80px -160px; }
241
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
242
- .ui-icon-seek-first { background-position: -80px -160px; }
243
- .ui-icon-stop { background-position: -96px -160px; }
244
- .ui-icon-eject { background-position: -112px -160px; }
245
- .ui-icon-volume-off { background-position: -128px -160px; }
246
- .ui-icon-volume-on { background-position: -144px -160px; }
247
- .ui-icon-power { background-position: 0 -176px; }
248
- .ui-icon-signal-diag { background-position: -16px -176px; }
249
- .ui-icon-signal { background-position: -32px -176px; }
250
- .ui-icon-battery-0 { background-position: -48px -176px; }
251
- .ui-icon-battery-1 { background-position: -64px -176px; }
252
- .ui-icon-battery-2 { background-position: -80px -176px; }
253
- .ui-icon-battery-3 { background-position: -96px -176px; }
254
- .ui-icon-circle-plus { background-position: 0 -192px; }
255
- .ui-icon-circle-minus { background-position: -16px -192px; }
256
- .ui-icon-circle-close { background-position: -32px -192px; }
257
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
258
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
259
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
260
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
261
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
262
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
263
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
264
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
265
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
266
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
267
- .ui-icon-circle-check { background-position: -208px -192px; }
268
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
269
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
270
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
271
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
272
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
273
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
274
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
275
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
276
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
277
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
278
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
279
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
280
-
281
-
282
- /* Misc visuals
283
- ----------------------------------*/
284
-
285
- /* Corner radius */
286
- .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; -khtml-border-top-left-radius: 3px; border-top-left-radius: 3px; }
287
- .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; -khtml-border-top-right-radius: 3px; border-top-right-radius: 3px; }
288
- .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; -khtml-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
289
- .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; -khtml-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
290
-
291
- /* Overlays */
292
- .ui-widget-overlay { background: #000000; opacity: .6;filter:Alpha(Opacity=60); }
293
- .ui-widget-shadow { box-shadow: 0 0 16px rgba(0, 0, 0, 0.3); }/*
294
- * jQuery UI Resizable 1.8.16
295
- *
296
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
297
- * Dual licensed under the MIT or GPL Version 2 licenses.
298
- * http://jquery.org/license
299
- *
300
- * http://docs.jquery.com/UI/Resizable#theming
301
- */
302
- .ui-resizable { position: relative;}
303
- .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
304
- .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
305
- .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
306
- .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
307
- .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
308
- .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
309
- .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
310
- .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
311
- .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
312
- .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
313
- * jQuery UI Selectable 1.8.16
314
- *
315
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
316
- * Dual licensed under the MIT or GPL Version 2 licenses.
317
- * http://jquery.org/license
318
- *
319
- * http://docs.jquery.com/UI/Selectable#theming
320
- */
321
- .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
322
- /*
323
- * jQuery UI Accordion 1.8.16
324
- *
325
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
326
- * Dual licensed under the MIT or GPL Version 2 licenses.
327
- * http://jquery.org/license
328
- *
329
- * http://docs.jquery.com/UI/Accordion#theming
330
- */
331
- /* IE/Win - Fix animation bug - #4615 */
332
- .ui-accordion { width: 100%; }
333
- .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
334
- .ui-accordion .ui-accordion-li-fix { display: inline; }
335
- .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
336
- .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
337
- .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
338
- .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
339
- .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
340
- .ui-accordion .ui-accordion-content-active { display: block; }
341
- /*
342
- * jQuery UI Autocomplete 1.8.16
343
- *
344
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
345
- * Dual licensed under the MIT or GPL Version 2 licenses.
346
- * http://jquery.org/license
347
- *
348
- * http://docs.jquery.com/UI/Autocomplete#theming
349
- */
350
- .ui-autocomplete { position: absolute; cursor: default; }
351
-
352
- /* workarounds */
353
- * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
354
-
355
- /*
356
- * jQuery UI Menu 1.8.16
357
- *
358
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
359
- * Dual licensed under the MIT or GPL Version 2 licenses.
360
- * http://jquery.org/license
361
- *
362
- * http://docs.jquery.com/UI/Menu#theming
363
- */
364
- .ui-menu {
365
- list-style:none;
366
- padding: 2px;
367
- margin: 0;
368
- display:block;
369
- float: left;
370
- }
371
- .ui-menu .ui-menu {
372
- margin-top: -3px;
373
- }
374
- .ui-menu .ui-menu-item {
375
- margin:0;
376
- padding: 0;
377
- zoom: 1;
378
- float: left;
379
- clear: left;
380
- width: 100%;
381
- }
382
- .ui-menu .ui-menu-item a {
383
- text-decoration:none;
384
- display:block;
385
- padding:.2em .4em;
386
- line-height:1.5;
387
- zoom:1;
388
- }
389
- .ui-menu .ui-menu-item a.ui-state-hover,
390
- .ui-menu .ui-menu-item a.ui-state-active {
391
- font-weight: normal;
392
- margin: -1px;
393
- }
394
- /*
395
- * jQuery UI Button 1.8.16
396
- *
397
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
398
- * Dual licensed under the MIT or GPL Version 2 licenses.
399
- * http://jquery.org/license
400
- *
401
- * http://docs.jquery.com/UI/Button#theming
402
- */
403
- .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
404
- .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
405
- button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
406
- .ui-button-icons-only { width: 3.4em; }
407
- button.ui-button-icons-only { width: 3.7em; }
408
-
409
- /*button text element */
410
- .ui-button .ui-button-text { display: block; line-height: 1.4; }
411
- .ui-button-text-only .ui-button-text { padding: .4em 1em; }
412
- .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
413
- .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
414
- .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
415
- .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
416
- /* no icon support for input elements, provide padding by default */
417
- input.ui-button { padding: .4em 1em; }
418
-
419
- /*button icon element(s) */
420
- .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
421
- .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
422
- .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
423
- .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
424
- .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
425
-
426
- /*button sets*/
427
- .ui-buttonset { margin-right: 7px; }
428
- .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
429
-
430
- /* workarounds */
431
- button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
432
- /*
433
- * jQuery UI Dialog 1.8.16
434
- *
435
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
436
- * Dual licensed under the MIT or GPL Version 2 licenses.
437
- * http://jquery.org/license
438
- *
439
- * http://docs.jquery.com/UI/Dialog#theming
440
- */
441
- .ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
442
- .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
443
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
444
- .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
445
- .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
446
- .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
447
- .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
448
- .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
449
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
450
- .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
451
- .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
452
- .ui-draggable .ui-dialog-titlebar { cursor: move; }
453
- /*
454
- * jQuery UI Slider 1.8.16
455
- *
456
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
457
- * Dual licensed under the MIT or GPL Version 2 licenses.
458
- * http://jquery.org/license
459
- *
460
- * http://docs.jquery.com/UI/Slider#theming
461
- */
462
- .ui-slider { position: relative; text-align: left; }
463
- .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
464
- .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
465
-
466
- .ui-slider-horizontal { height: .8em; }
467
- .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
468
- .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
469
- .ui-slider-horizontal .ui-slider-range-min { left: 0; }
470
- .ui-slider-horizontal .ui-slider-range-max { right: 0; }
471
-
472
- .ui-slider-vertical { width: .8em; height: 100px; }
473
- .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
474
- .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
475
- .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
476
- .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
477
- * jQuery UI Tabs 1.8.16
478
- *
479
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
480
- * Dual licensed under the MIT or GPL Version 2 licenses.
481
- * http://jquery.org/license
482
- *
483
- * http://docs.jquery.com/UI/Tabs#theming
484
- */
485
- .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
486
- .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
487
- .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
488
- .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
489
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
490
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
491
- .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
492
- .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
493
- .ui-tabs .ui-tabs-hide { display: none !important; }
494
- /*
495
- * jQuery UI Datepicker 1.8.16
496
- *
497
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
498
- * Dual licensed under the MIT or GPL Version 2 licenses.
499
- * http://jquery.org/license
500
- *
501
- * http://docs.jquery.com/UI/Datepicker#theming
502
- */
503
- .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
504
- .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
505
- .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
506
- .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
507
- .ui-datepicker .ui-datepicker-prev { left:2px; }
508
- .ui-datepicker .ui-datepicker-next { right:2px; }
509
- .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
510
- .ui-datepicker .ui-datepicker-next-hover { right:1px; }
511
- .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
512
- .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
513
- .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
514
- .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
515
- .ui-datepicker select.ui-datepicker-month,
516
- .ui-datepicker select.ui-datepicker-year { width: 49%;}
517
- .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
518
- .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
519
- .ui-datepicker td { border: 0; padding: 1px; }
520
- .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
521
- .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
522
- .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
523
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
524
-
525
- /* with multiple calendars */
526
- .ui-datepicker.ui-datepicker-multi { width:auto; }
527
- .ui-datepicker-multi .ui-datepicker-group { float:left; }
528
- .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
529
- .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
530
- .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
531
- .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
532
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
533
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
534
- .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
535
- .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
536
-
537
- /* RTL support */
538
- .ui-datepicker-rtl { direction: rtl; }
539
- .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
540
- .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
541
- .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
542
- .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
543
- .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
544
- .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
545
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
546
- .ui-datepicker-rtl .ui-datepicker-group { float:right; }
547
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
548
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
549
-
550
- /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
551
- .ui-datepicker-cover {
552
- display: none; /*sorry for IE5*/
553
- display/**/: block; /*sorry for IE5*/
554
- position: absolute; /*must have*/
555
- z-index: -1; /*must have*/
556
- filter: mask(); /*must have*/
557
- top: -4px; /*must have*/
558
- left: -4px; /*must have*/
559
- width: 200px; /*must have*/
560
- height: 200px; /*must have*/
561
- }/*
562
- * jQuery UI Progressbar 1.8.16
563
- *
564
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
565
- * Dual licensed under the MIT or GPL Version 2 licenses.
566
- * http://jquery.org/license
567
- *
568
- * http://docs.jquery.com/UI/Progressbar#theming
569
- */
570
- .ui-progressbar { height:2em; text-align: left; }
571
- .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
572
- .ui-progressbar .ui-widget-header {
573
- background-color: #83B4D8;
574
- background-image: linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
575
- background-image: -o-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
576
- background-image: -moz-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
577
- background-image: -webkit-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
578
- background-image: -ms-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
579
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/jquery.ui.datepicker-fresh.css DELETED
@@ -1,579 +0,0 @@
1
- /*
2
- * jQuery UI CSS Framework 1.8.16
3
- *
4
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- * http://jquery.org/license
7
- *
8
- * http://docs.jquery.com/UI/Theming/API
9
- *
10
- * Credit goes to Helen Hou-Sandi:
11
- * https://github.com/helenhousandi/wp-admin-jquery-ui
12
- *
13
- */
14
-
15
- /* Layout helpers
16
- ----------------------------------*/
17
- .ui-helper-hidden { display: none; }
18
- .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
19
- .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
20
- .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21
- .ui-helper-clearfix { display: inline-block; }
22
- /* required comment for clearfix to work in Opera \*/
23
- * html .ui-helper-clearfix { height:1%; }
24
- .ui-helper-clearfix { display:block; }
25
- /* end clearfix */
26
- .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
27
-
28
-
29
- /* Interaction Cues
30
- ----------------------------------*/
31
- .ui-state-disabled { cursor: default !important; }
32
-
33
-
34
- /* Icons
35
- ----------------------------------*/
36
-
37
- /* states and images */
38
- .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
39
-
40
-
41
- /* Misc visuals
42
- ----------------------------------*/
43
-
44
- /* Overlays */
45
- .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
46
-
47
-
48
- /*
49
- * jQuery UI CSS Framework 1.8.16
50
- *
51
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
52
- * Dual licensed under the MIT or GPL Version 2 licenses.
53
- * http://jquery.org/license
54
- *
55
- * http://docs.jquery.com/UI/Theming/API
56
- *
57
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=sans-serif&fwDefault=normal&fsDefault=12px&cornerRadius=4px&bgColorHeader=ececec&bgTextureHeader=04_highlight_hard.png&bgImgOpacityHeader=75&borderColorHeader=dfdfdf&fcHeader=333333&iconColorHeader=999999&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=dfdfdf&fcContent=333333&iconColorContent=333333&bgColorDefault=ececec&bgTextureDefault=04_highlight_hard.png&bgImgOpacityDefault=75&borderColorDefault=dfdfdf&fcDefault=333333&iconColorDefault=333333&bgColorHover=ececec&bgTextureHover=06_inset_hard.png&bgImgOpacityHover=75&borderColorHover=ccc&fcHover=000000&iconColorHover=333333&bgColorActive=ffffff&bgTextureActive=01_flat.png&bgImgOpacityActive=65&borderColorActive=dfdfdf&fcActive=333333&iconColorActive=333333&bgColorHighlight=ffffe0&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=e6db55&fcHighlight=333333&iconColorHighlight=21759b&bgColorError=ffebe8&bgTextureError=01_flat.png&bgImgOpacityError=95&borderColorError=cc0000&fcError=cc0000&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=3px
58
- */
59
-
60
-
61
- /* Component containers
62
- ----------------------------------*/
63
- .ui-widget { font-family: sans-serif; font-size: 12px; }
64
- .ui-widget .ui-widget { font-size: 1em; }
65
- .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: sans-serif; font-size: 1em; }
66
- .ui-widget-content { border: 1px solid #dfdfdf; background: #ffffff; color: #333333; }
67
- .ui-widget-header { border: 1px solid #dfdfdf; color: #333333; font-weight: bold; background-color: #f1f1f1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); }
68
- .ui-widget-header a { color: #333333; }
69
-
70
- /* Interaction states
71
- ----------------------------------*/
72
- .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #dfdfdf; background-color: #f1f1f1; background-image: -ms-linear-gradient(top, #f9f9f9, #ececec); background-image: -moz-linear-gradient(top, #f9f9f9, #ececec); background-image: -o-linear-gradient(top, #f9f9f9, #ececec); background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec)); background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec); background-image: linear-gradient(top, #f9f9f9, #ececec); font-weight: normal; color: #333333; }
73
- .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #333333; text-decoration: none; }
74
- .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #ccc; background-color: #ececec; background-image: -ms-linear-gradient(top, #ececec, #f9f9f9); background-image: -moz-linear-gradient(top, #ececec, #f9f9f9); background-image: -o-linear-gradient(top, #ececec, #f9f9f9); background-image: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#f9f9f9)); background-image: -webkit-linear-gradient(top, #ececec, #f9f9f9); background-image: linear-gradient(top, #ececec, #f9f9f9); font-weight: normal; color: #000000; }
75
- .ui-state-hover a, .ui-state-hover a:hover { color: #000000; text-decoration: none; }
76
- .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #dfdfdf; background: #ffffff; font-weight: normal; color: #333333; }
77
- .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #333333; text-decoration: none; }
78
- .ui-widget :active { outline: none; }
79
-
80
- /* Interaction Cues
81
- ----------------------------------*/
82
- .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #e6db55; background: #ffffe0; color: #333333; }
83
- .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #333333; }
84
- .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cc0000; background: #ffebe8; color: #cc0000; }
85
- .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cc0000; }
86
- .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cc0000; }
87
- .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
88
- .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
89
- .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
90
-
91
- /* Icons
92
- ----------------------------------*/
93
-
94
- /* states and images */
95
- .ui-icon { width: 16px; height: 16px; background-image: url(ui-images/ui-icons_333333_256x240.png); }
96
- .ui-widget-content .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
97
- .ui-widget-header .ui-icon {background-image: url(ui-images/ui-icons_999999_256x240.png); }
98
- .ui-state-default .ui-icon { background-image: url(ui-images/ui-icons_333333_256x240.png); }
99
- .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
100
- .ui-state-active .ui-icon {background-image: url(ui-images/ui-icons_333333_256x240.png); }
101
- .ui-state-highlight .ui-icon {background-image: url(ui-images/ui-icons_21759b_256x240.png); }
102
- .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(ui-images/ui-icons_cc0000_256x240.png); }
103
-
104
- /* positioning */
105
- .ui-icon-carat-1-n { background-position: 0 0; }
106
- .ui-icon-carat-1-ne { background-position: -16px 0; }
107
- .ui-icon-carat-1-e { background-position: -32px 0; }
108
- .ui-icon-carat-1-se { background-position: -48px 0; }
109
- .ui-icon-carat-1-s { background-position: -64px 0; }
110
- .ui-icon-carat-1-sw { background-position: -80px 0; }
111
- .ui-icon-carat-1-w { background-position: -96px 0; }
112
- .ui-icon-carat-1-nw { background-position: -112px 0; }
113
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
114
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
115
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
116
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
117
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
118
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
119
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
120
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
121
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
122
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
123
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
124
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
125
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
126
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
127
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
128
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
129
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
130
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
131
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
132
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
133
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
134
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
135
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
136
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
137
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
138
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
139
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
140
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
141
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
142
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
143
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
144
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
145
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
146
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
147
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
148
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
149
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
150
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
151
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
152
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
153
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
154
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
155
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
156
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
157
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
158
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
159
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
160
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
161
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
162
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
163
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
164
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
165
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
166
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
167
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
168
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
169
- .ui-icon-arrow-4 { background-position: 0 -80px; }
170
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
171
- .ui-icon-extlink { background-position: -32px -80px; }
172
- .ui-icon-newwin { background-position: -48px -80px; }
173
- .ui-icon-refresh { background-position: -64px -80px; }
174
- .ui-icon-shuffle { background-position: -80px -80px; }
175
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
176
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
177
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
178
- .ui-icon-folder-open { background-position: -16px -96px; }
179
- .ui-icon-document { background-position: -32px -96px; }
180
- .ui-icon-document-b { background-position: -48px -96px; }
181
- .ui-icon-note { background-position: -64px -96px; }
182
- .ui-icon-mail-closed { background-position: -80px -96px; }
183
- .ui-icon-mail-open { background-position: -96px -96px; }
184
- .ui-icon-suitcase { background-position: -112px -96px; }
185
- .ui-icon-comment { background-position: -128px -96px; }
186
- .ui-icon-person { background-position: -144px -96px; }
187
- .ui-icon-print { background-position: -160px -96px; }
188
- .ui-icon-trash { background-position: -176px -96px; }
189
- .ui-icon-locked { background-position: -192px -96px; }
190
- .ui-icon-unlocked { background-position: -208px -96px; }
191
- .ui-icon-bookmark { background-position: -224px -96px; }
192
- .ui-icon-tag { background-position: -240px -96px; }
193
- .ui-icon-home { background-position: 0 -112px; }
194
- .ui-icon-flag { background-position: -16px -112px; }
195
- .ui-icon-calendar { background-position: -32px -112px; }
196
- .ui-icon-cart { background-position: -48px -112px; }
197
- .ui-icon-pencil { background-position: -64px -112px; }
198
- .ui-icon-clock { background-position: -80px -112px; }
199
- .ui-icon-disk { background-position: -96px -112px; }
200
- .ui-icon-calculator { background-position: -112px -112px; }
201
- .ui-icon-zoomin { background-position: -128px -112px; }
202
- .ui-icon-zoomout { background-position: -144px -112px; }
203
- .ui-icon-search { background-position: -160px -112px; }
204
- .ui-icon-wrench { background-position: -176px -112px; }
205
- .ui-icon-gear { background-position: -192px -112px; }
206
- .ui-icon-heart { background-position: -208px -112px; }
207
- .ui-icon-star { background-position: -224px -112px; }
208
- .ui-icon-link { background-position: -240px -112px; }
209
- .ui-icon-cancel { background-position: 0 -128px; }
210
- .ui-icon-plus { background-position: -16px -128px; }
211
- .ui-icon-plusthick { background-position: -32px -128px; }
212
- .ui-icon-minus { background-position: -48px -128px; }
213
- .ui-icon-minusthick { background-position: -64px -128px; }
214
- .ui-icon-close { background-position: -80px -128px; }
215
- .ui-icon-closethick { background-position: -96px -128px; }
216
- .ui-icon-key { background-position: -112px -128px; }
217
- .ui-icon-lightbulb { background-position: -128px -128px; }
218
- .ui-icon-scissors { background-position: -144px -128px; }
219
- .ui-icon-clipboard { background-position: -160px -128px; }
220
- .ui-icon-copy { background-position: -176px -128px; }
221
- .ui-icon-contact { background-position: -192px -128px; }
222
- .ui-icon-image { background-position: -208px -128px; }
223
- .ui-icon-video { background-position: -224px -128px; }
224
- .ui-icon-script { background-position: -240px -128px; }
225
- .ui-icon-alert { background-position: 0 -144px; }
226
- .ui-icon-info { background-position: -16px -144px; }
227
- .ui-icon-notice { background-position: -32px -144px; }
228
- .ui-icon-help { background-position: -48px -144px; }
229
- .ui-icon-check { background-position: -64px -144px; }
230
- .ui-icon-bullet { background-position: -80px -144px; }
231
- .ui-icon-radio-off { background-position: -96px -144px; }
232
- .ui-icon-radio-on { background-position: -112px -144px; }
233
- .ui-icon-pin-w { background-position: -128px -144px; }
234
- .ui-icon-pin-s { background-position: -144px -144px; }
235
- .ui-icon-play { background-position: 0 -160px; }
236
- .ui-icon-pause { background-position: -16px -160px; }
237
- .ui-icon-seek-next { background-position: -32px -160px; }
238
- .ui-icon-seek-prev { background-position: -48px -160px; }
239
- .ui-icon-seek-end { background-position: -64px -160px; }
240
- .ui-icon-seek-start { background-position: -80px -160px; }
241
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
242
- .ui-icon-seek-first { background-position: -80px -160px; }
243
- .ui-icon-stop { background-position: -96px -160px; }
244
- .ui-icon-eject { background-position: -112px -160px; }
245
- .ui-icon-volume-off { background-position: -128px -160px; }
246
- .ui-icon-volume-on { background-position: -144px -160px; }
247
- .ui-icon-power { background-position: 0 -176px; }
248
- .ui-icon-signal-diag { background-position: -16px -176px; }
249
- .ui-icon-signal { background-position: -32px -176px; }
250
- .ui-icon-battery-0 { background-position: -48px -176px; }
251
- .ui-icon-battery-1 { background-position: -64px -176px; }
252
- .ui-icon-battery-2 { background-position: -80px -176px; }
253
- .ui-icon-battery-3 { background-position: -96px -176px; }
254
- .ui-icon-circle-plus { background-position: 0 -192px; }
255
- .ui-icon-circle-minus { background-position: -16px -192px; }
256
- .ui-icon-circle-close { background-position: -32px -192px; }
257
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
258
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
259
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
260
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
261
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
262
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
263
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
264
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
265
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
266
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
267
- .ui-icon-circle-check { background-position: -208px -192px; }
268
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
269
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
270
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
271
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
272
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
273
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
274
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
275
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
276
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
277
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
278
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
279
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
280
-
281
-
282
- /* Misc visuals
283
- ----------------------------------*/
284
-
285
- /* Corner radius */
286
- .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; }
287
- .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
288
- .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
289
- .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
290
-
291
- /* Overlays */
292
- .ui-widget-overlay { background: #000000; opacity: .6;filter:Alpha(Opacity=60); }
293
- .ui-widget-shadow { box-shadow: 0 0 16px rgba(0, 0, 0, 0.3); }/*
294
- * jQuery UI Resizable 1.8.16
295
- *
296
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
297
- * Dual licensed under the MIT or GPL Version 2 licenses.
298
- * http://jquery.org/license
299
- *
300
- * http://docs.jquery.com/UI/Resizable#theming
301
- */
302
- .ui-resizable { position: relative;}
303
- .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
304
- .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
305
- .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
306
- .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
307
- .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
308
- .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
309
- .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
310
- .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
311
- .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
312
- .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
313
- * jQuery UI Selectable 1.8.16
314
- *
315
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
316
- * Dual licensed under the MIT or GPL Version 2 licenses.
317
- * http://jquery.org/license
318
- *
319
- * http://docs.jquery.com/UI/Selectable#theming
320
- */
321
- .ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
322
- /*
323
- * jQuery UI Accordion 1.8.16
324
- *
325
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
326
- * Dual licensed under the MIT or GPL Version 2 licenses.
327
- * http://jquery.org/license
328
- *
329
- * http://docs.jquery.com/UI/Accordion#theming
330
- */
331
- /* IE/Win - Fix animation bug - #4615 */
332
- .ui-accordion { width: 100%; }
333
- .ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
334
- .ui-accordion .ui-accordion-li-fix { display: inline; }
335
- .ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
336
- .ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
337
- .ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
338
- .ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
339
- .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
340
- .ui-accordion .ui-accordion-content-active { display: block; }
341
- /*
342
- * jQuery UI Autocomplete 1.8.16
343
- *
344
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
345
- * Dual licensed under the MIT or GPL Version 2 licenses.
346
- * http://jquery.org/license
347
- *
348
- * http://docs.jquery.com/UI/Autocomplete#theming
349
- */
350
- .ui-autocomplete { position: absolute; cursor: default; }
351
-
352
- /* workarounds */
353
- * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
354
-
355
- /*
356
- * jQuery UI Menu 1.8.16
357
- *
358
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
359
- * Dual licensed under the MIT or GPL Version 2 licenses.
360
- * http://jquery.org/license
361
- *
362
- * http://docs.jquery.com/UI/Menu#theming
363
- */
364
- .ui-menu {
365
- list-style:none;
366
- padding: 2px;
367
- margin: 0;
368
- display:block;
369
- float: left;
370
- }
371
- .ui-menu .ui-menu {
372
- margin-top: -3px;
373
- }
374
- .ui-menu .ui-menu-item {
375
- margin:0;
376
- padding: 0;
377
- zoom: 1;
378
- float: left;
379
- clear: left;
380
- width: 100%;
381
- }
382
- .ui-menu .ui-menu-item a {
383
- text-decoration:none;
384
- display:block;
385
- padding:.2em .4em;
386
- line-height:1.5;
387
- zoom:1;
388
- }
389
- .ui-menu .ui-menu-item a.ui-state-hover,
390
- .ui-menu .ui-menu-item a.ui-state-active {
391
- font-weight: normal;
392
- margin: -1px;
393
- }
394
- /*
395
- * jQuery UI Button 1.8.16
396
- *
397
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
398
- * Dual licensed under the MIT or GPL Version 2 licenses.
399
- * http://jquery.org/license
400
- *
401
- * http://docs.jquery.com/UI/Button#theming
402
- */
403
- .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
404
- .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
405
- button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
406
- .ui-button-icons-only { width: 3.4em; }
407
- button.ui-button-icons-only { width: 3.7em; }
408
-
409
- /*button text element */
410
- .ui-button .ui-button-text { display: block; line-height: 1.4; }
411
- .ui-button-text-only .ui-button-text { padding: .4em 1em; }
412
- .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
413
- .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
414
- .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
415
- .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
416
- /* no icon support for input elements, provide padding by default */
417
- input.ui-button { padding: .4em 1em; }
418
-
419
- /*button icon element(s) */
420
- .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
421
- .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
422
- .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
423
- .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
424
- .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
425
-
426
- /*button sets*/
427
- .ui-buttonset { margin-right: 7px; }
428
- .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
429
-
430
- /* workarounds */
431
- button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
432
- /*
433
- * jQuery UI Dialog 1.8.16
434
- *
435
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
436
- * Dual licensed under the MIT or GPL Version 2 licenses.
437
- * http://jquery.org/license
438
- *
439
- * http://docs.jquery.com/UI/Dialog#theming
440
- */
441
- .ui-dialog { position: fixed; padding: .2em; width: 300px; overflow: hidden; }
442
- .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
443
- .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
444
- .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
445
- .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
446
- .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
447
- .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
448
- .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
449
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
450
- .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
451
- .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
452
- .ui-draggable .ui-dialog-titlebar { cursor: move; }
453
- /*
454
- * jQuery UI Slider 1.8.16
455
- *
456
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
457
- * Dual licensed under the MIT or GPL Version 2 licenses.
458
- * http://jquery.org/license
459
- *
460
- * http://docs.jquery.com/UI/Slider#theming
461
- */
462
- .ui-slider { position: relative; text-align: left; }
463
- .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
464
- .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
465
-
466
- .ui-slider-horizontal { height: .8em; }
467
- .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
468
- .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
469
- .ui-slider-horizontal .ui-slider-range-min { left: 0; }
470
- .ui-slider-horizontal .ui-slider-range-max { right: 0; }
471
-
472
- .ui-slider-vertical { width: .8em; height: 100px; }
473
- .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
474
- .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
475
- .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
476
- .ui-slider-vertical .ui-slider-range-max { top: 0; }/*
477
- * jQuery UI Tabs 1.8.16
478
- *
479
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
480
- * Dual licensed under the MIT or GPL Version 2 licenses.
481
- * http://jquery.org/license
482
- *
483
- * http://docs.jquery.com/UI/Tabs#theming
484
- */
485
- .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
486
- .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
487
- .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
488
- .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
489
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
490
- .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
491
- .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
492
- .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
493
- .ui-tabs .ui-tabs-hide { display: none !important; }
494
- /*
495
- * jQuery UI Datepicker 1.8.16
496
- *
497
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
498
- * Dual licensed under the MIT or GPL Version 2 licenses.
499
- * http://jquery.org/license
500
- *
501
- * http://docs.jquery.com/UI/Datepicker#theming
502
- */
503
- .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
504
- .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
505
- .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
506
- .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
507
- .ui-datepicker .ui-datepicker-prev { left:2px; }
508
- .ui-datepicker .ui-datepicker-next { right:2px; }
509
- .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
510
- .ui-datepicker .ui-datepicker-next-hover { right:1px; }
511
- .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
512
- .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
513
- .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
514
- .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
515
- .ui-datepicker select.ui-datepicker-month,
516
- .ui-datepicker select.ui-datepicker-year { width: 49%;}
517
- .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
518
- .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
519
- .ui-datepicker td { border: 0; padding: 1px; }
520
- .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
521
- .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
522
- .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
523
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
524
-
525
- /* with multiple calendars */
526
- .ui-datepicker.ui-datepicker-multi { width:auto; }
527
- .ui-datepicker-multi .ui-datepicker-group { float:left; }
528
- .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
529
- .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
530
- .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
531
- .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
532
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
533
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
534
- .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
535
- .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
536
-
537
- /* RTL support */
538
- .ui-datepicker-rtl { direction: rtl; }
539
- .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
540
- .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
541
- .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
542
- .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
543
- .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
544
- .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
545
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
546
- .ui-datepicker-rtl .ui-datepicker-group { float:right; }
547
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
548
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
549
-
550
- /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
551
- .ui-datepicker-cover {
552
- display: none; /*sorry for IE5*/
553
- display/**/: block; /*sorry for IE5*/
554
- position: absolute; /*must have*/
555
- z-index: -1; /*must have*/
556
- filter: mask(); /*must have*/
557
- top: -4px; /*must have*/
558
- left: -4px; /*must have*/
559
- width: 200px; /*must have*/
560
- height: 200px; /*must have*/
561
- }/*
562
- * jQuery UI Progressbar 1.8.16
563
- *
564
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
565
- * Dual licensed under the MIT or GPL Version 2 licenses.
566
- * http://jquery.org/license
567
- *
568
- * http://docs.jquery.com/UI/Progressbar#theming
569
- */
570
- .ui-progressbar { height:2em; text-align: left; }
571
- .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
572
- .ui-progressbar .ui-widget-header {
573
- background-color: #83B4D8;
574
- background-image: linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
575
- background-image: -o-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
576
- background-image: -moz-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
577
- background-image: -webkit-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
578
- background-image: -ms-linear-gradient(bottom, rgb(114,167,207) 0%, rgb(144,197,238) 100%);
579
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/css/loading-small.gif DELETED
Binary file
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/settingspage.css CHANGED
@@ -1,13 +1,8 @@
1
  table#wpsc_checkout_list{
2
  width:100%;
3
  }
4
-
5
- table#wpsc_checkout_list tbody {
6
- position:relative;
7
- }
8
-
9
- th#actions{
10
- width:65px;
11
  }
12
  th#drag{
13
  width:50px;
@@ -16,78 +11,27 @@ tr.wpsc_grey{
16
  background-color: #ededed;
17
  }
18
  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{
54
  display: none;
55
  }
56
 
57
- #wpsc_checkout_list td {
58
- vertical-align:middle;
59
  }
60
-
61
- #wpsc_checkout_list .uniquenamecol small {
62
- color:#999;
63
  }
64
-
65
- td.drag a img {
66
- vertical-align:middle;
67
- }
68
-
69
- #wpsc_checkout_list_body .ajax-feedback {
70
- display:none;
71
- }
72
-
73
- #wpsc_checkout_list_body .ajax-feedback-active {
74
- display:inline-block;
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 {
87
- float:right !important;
88
- }
89
-
90
- tr.checkout-placeholder td {
91
  border-width: 1px;
92
  border-style: dashed;
93
  z-index: 900;
@@ -95,6 +39,10 @@ tr.checkout-placeholder td {
95
  background-color: #f5f5f5;
96
  margin: -2px 0 0 -2px;
97
  }
 
 
 
 
98
 
99
  /* Removed to prevent overlapping the Contextual Help tab
100
  #wpsc_options {
@@ -113,70 +61,46 @@ tr.checkout-placeholder td {
113
  }
114
 
115
  #options_presentation{
116
- margin-right: 370px;
117
  }
118
 
119
- table.wpsc-edit-module-options tr td {
120
  padding: 0;
121
  vertical-align: top;
122
  }
123
- .wpsc-module-settings {
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 {
176
  display: none;
177
  }
178
 
179
- table.wpsc-edit-module-options {
180
  margin:0;
181
  width:100%;
182
  }
@@ -189,9 +113,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 +160,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 {
@@ -271,195 +193,4 @@ div#themes_and_appearance ol {
271
 
272
  div#themes_and_appearance ol li {
273
  font-size: 11px;
274
- }
275
-
276
- a.nav-tab-loading {
277
- color:#D54E21;
278
- }
279
-
280
- #wpsc_options h2 .nav-tab {
281
- font-size:16px;
282
- line-height:20px;
283
- padding:3px 6px 3px;
284
- margin-right:0;
285
- }
286
-
287
- #wpsc_options h2.nav-tab-wrapper {
288
- padding-left:7px;
289
- }
290
-
291
- #wpsc_options .postbox .inside p.submit {
292
- margin-top:5px;
293
- padding:0;
294
- }
295
-
296
- #wpsc-shipping-module-settings td small {
297
- color:#666;
298
- font-style:italic;
299
- }
300
-
301
- .wpsc-shipping-module-settings-tablerate .postbox .inside, .wpsc-shipping-module-settings-weightrate .postbox .inside {
302
- padding: 0;
303
- }
304
-
305
- .wpsc-shipping-module-settings-tablerate .form-table th, .wpsc-shipping-module-settings-weightrate .form-table th {
306
- border-bottom:1px solid #dfdfdf;
307
- font-size:12px;
308
- font-weight:bold;
309
- padding:7px 10px 7px 20px;
310
- }
311
-
312
- .wpsc-shipping-module-settings-tablerate .form-table, .wpsc-shipping-module-settings-weightrate .form-table {
313
- margin-top:0;
314
- }
315
-
316
- .wpsc-shipping-module-settings-tablerate .total {
317
- width:120px;
318
- }
319
-
320
- .wpsc-shipping-module-settings-weightrate .form-table th.total-weight {
321
- padding-left:10px;
322
- width:140px;
323
- }
324
-
325
- .wpsc-shipping-module-settings-tablerate .form-table td, .wpsc-shipping-module-settings-weightrate .form-table td {
326
- border-bottom:1px solid #dfdfdf;
327
- padding:0 10px;
328
- }
329
-
330
- .wpsc-shipping-module-settings-tablerate .form-table td .cell-wrapper, .wpsc-shipping-module-settings-weightrate .form-table td .cell-wrapper {
331
- padding:7px 0;
332
- width:100%;
333
- }
334
-
335
- #wpsc_options .wpsc-shipping-module-settings-tablerate .postbox .inside .submit, #wpsc_options .wpsc-shipping-module-settings-weightrate .postbox .inside .submit {
336
- padding:0 10px 0 20px;
337
- }
338
-
339
- .wpsc-shipping-module-settings-tablerate td .actions, .wpsc-shipping-module-settings-weightrate td .actions {
340
- float:right;
341
- margin-right:10px;
342
- }
343
-
344
- #wpsc_options .action {
345
- display:none;
346
- }
347
-
348
- .js #wpsc_options .js-warning {
349
- display:none;
350
- }
351
-
352
- .js #wpsc_options .wpsc-shipping-module-settings-tablerate td .action,
353
- .js #wpsc_options .wpsc-shipping-module-settings-weightrate td .action,
354
- .js #wpsc_checkout_list .action {
355
- background-image:url(plus-minus.png);
356
- background-repeat:no-repeat;
357
- display:inline-block;
358
- height:20px;
359
- margin-left:3px;
360
- text-indent:-9999em;
361
- width:20px;
362
- }
363
-
364
- .js #wpsc_options .wpsc-shipping-module-settings-tablerate td span.action,
365
- .js #wpsc_options .wpsc-shipping-module-settings-weightrate td span.action,
366
- .js #wpsc_checkout_list span.action {
367
- opacity:0.3;
368
- }
369
-
370
- #wpsc_checkout_list .wpsc-field-options-table {
371
- border-collapse:collapse;
372
- margin-bottom:1em;
373
- width:100%;
374
- }
375
-
376
- #wpsc_checkout_list .wpsc-field-options-table th {
377
- background:none;
378
- border-top:none;
379
- color:#000;
380
- font-family:sans-serif;
381
- font-size:12px;
382
- font-weight:bold;
383
- padding:0 5px;
384
- }
385
-
386
- #wpsc_checkout_list .wpsc-field-options-table input {
387
- width:100%;
388
- }
389
-
390
- #wpsc_checkout_list .wpsc-field-options-table td {
391
- border:none;
392
- padding:0 5px;
393
- }
394
-
395
- .js #wpsc_checkout_list .edit-options {
396
- display: none;
397
- }
398
-
399
- .js .form-field-options {
400
- display:none;
401
- }
402
-
403
- #wpsc_checkout_list .form-field-options td {
404
- border-top:none;
405
- }
406
-
407
- #wpsc_checkout_list tr.editing-options td {
408
- border-bottom:none;
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 {
416
- width:65px;
417
- }
418
-
419
- #wpsc_checkout_list .wpsc-field-options-table .column-actions .field-option-cell-wrapper {
420
- float:right;
421
- }
422
-
423
- .js #wpsc_checkout_list .new-field {
424
- display:none;
425
- }
426
-
427
- /* shipping options start here */
428
- div.wpsc_shipping_options, div.wpsc-select-gateway {
429
- border-top: 1px solid #e9e9e9;
430
- width:100%;
431
- padding:3px 0;
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 {
444
- margin: 0px 15px 4px 5px;
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
  }
1
  table#wpsc_checkout_list{
2
  width:100%;
3
  }
4
+ th#trash{
5
+ width:60px;
 
 
 
 
 
6
  }
7
  th#drag{
8
  width:50px;
11
  background-color: #ededed;
12
  }
13
  td.drag a:hover{
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ /*background-image: url(../../images/roll-over-drag.jpg);
16
+ background-repeat: no-repeat;
17
+ background-position: center;*/
18
+ cursor: move;
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
+ th#mandatory{
21
+ width:90px;
22
  }
23
 
24
  #checkout_message{
25
  display: none;
26
  }
27
 
28
+ #wpsc_checkout_list th#name{
29
+ width:180px;
30
  }
31
+ td.mandatorycol{
32
+ text-align: center;
 
33
  }
34
+ tr.checkout-placeholder {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  border-width: 1px;
36
  border-style: dashed;
37
  z-index: 900;
39
  background-color: #f5f5f5;
40
  margin: -2px 0 0 -2px;
41
  }
42
+ #wpsc_checkout_list tbody {
43
+ width: 700px;
44
+ border-collapse:collapse;
45
+ }
46
 
47
  /* Removed to prevent overlapping the Contextual Help tab
48
  #wpsc_options {
61
  }
62
 
63
  #options_presentation{
64
+ min-width:850px;
65
  }
66
 
67
+ table#gateway_options tr td {
68
  padding: 0;
69
  vertical-align: top;
70
  }
71
+ table#gateway_options tr td.gateway_settings {
72
  padding: 0 0 8px 8px;
73
  width:394px;
74
  }
75
+ td.gateway_settings input[type=text]{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  width: 200px;
77
  }
 
 
 
 
 
78
  tr.rate_row td input[type=text]{
79
  width:50px;
80
  }
81
  div.wpsc_newlayer input[type=text]{
82
  width:50px;
83
  }
84
+ td.gateway_settings textarea{
85
  width:100%;
86
  }
87
+ td.gateway_settings h4{
88
+ margin-top:0;
89
+ }
90
+
91
+ .wpsc_shipping_options{
92
+ border-top: 1px solid #e9e9e9;
93
+
94
+ }
95
+ td.select_gateway p {
96
+ margin: 0px 15px 4px 5px;
97
  }
98
 
99
  div#wpsc_shipwire_setting, div#shipping_discount_value {
100
  display: none;
101
  }
102
 
103
+ table#gateway_options {
104
  margin:0;
105
  width:100%;
106
  }
113
  table#form_field_table tr *.namecol{ width: 170px; padding-right: 8px; }
114
  table#form_field_table tr *.namecol input{ width: 160px; }
115
 
 
 
 
116
  table#form_field_table tr *.typecol{ width: 120px; }
117
  table#form_field_table tr *.typecol select{ width: 115px; }
118
 
160
  }
161
 
162
  h3.form_group {
163
+ clear: both;
164
  }
165
  h3.form_group a{
166
  color: #000;
167
  }
168
  div.product_and_button_settings {
169
+ width: 450px;
170
+ float: left;
171
+
172
  }
173
 
174
  div#themes_and_appearance {
175
  border: 1px solid #DFDFDF;
176
  width: 360px;
177
+ float: left;
 
178
  }
179
 
180
  div#themes_and_appearance p {
193
 
194
  div#themes_and_appearance ol li {
195
  font-size: 11px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
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,396 @@ 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
+ if ( $wpdb->query( "INSERT INTO `" . WPSC_TABLE_COUPON_CODES . "` ( `coupon_code` , `value` , `is-percentage` , `use-once` , `is-used` , `active` , `every_product` , `start` , `expiry`, `condition` ) VALUES ( '$coupon_code', '$discount', '$discount_type', '$use_once', '0', '$is_active', '$every_product', '$start_date' , '$end_date' , '" . serialize( $new_rule ) . "' );" ) )
32
+ echo "<div class='updated'><p align='center'>" . __( 'Thanks, the coupon has been added.', 'wpsc' ) . "</p></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  }
35
 
 
36
  if ( isset( $_POST['is_edit_coupon'] ) && ($_POST['is_edit_coupon'] == 'true') && !(isset( $_POST['delete_condition'] )) && !(isset( $_POST['submit_condition'] )) ) {
37
 
38
+ foreach ( (array)$_POST['edit_coupon'] as $coupon_id => $coupon_data ) {
39
 
40
+ $coupon_id = (int)$coupon_id;
41
+ $coupon_data['start'] = $coupon_data['start'] . " 00:00:00";
42
+ $coupon_data['expiry'] = $coupon_data['expiry'] . " 00:00:00";
43
+ $check_values = $wpdb->get_row( "SELECT `id`, `coupon_code`, `value`, `is-percentage`, `use-once`, `active`, `start`, `expiry`,`every_product` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '$coupon_id'", ARRAY_A );
44
 
45
+ // Sort both arrays to make sure that if they contain the same stuff,
46
+ // that they will compare to be the same, may not need to do this, but what the heck
47
+ if ( $check_values != null )
48
+ ksort( $check_values );
49
+
50
+ ksort( $coupon_data );
51
+
52
+ if ( $check_values != $coupon_data ) {
53
+
54
+ $insert_array = array();
55
+
56
+ foreach ( $coupon_data as $coupon_key => $coupon_value ) {
57
+ if ( ($coupon_key == "submit_coupon") || ($coupon_key == "delete_coupon") )
58
+ continue;
59
+
60
+ if ( isset( $check_values[$coupon_key] ) && $coupon_value != $check_values[$coupon_key] )
61
+ $insert_array[] = "`$coupon_key` = '$coupon_value'";
62
+
63
+ }
64
+
65
+ if ( isset( $check_values['every_product'] ) && $coupon_data['add_every_product'] != $check_values['every_product'] )
66
+ $insert_array[] = "`every_product` = '$coupon_data[add_every_product]'";
67
+
68
+ if ( count( $insert_array ) > 0 )
69
+ $wpdb->query( "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET " . implode( ", ", $insert_array ) . " WHERE `id` = '$coupon_id' LIMIT 1;" );
70
+
71
+ unset( $insert_array );
72
+ $rules = $_POST['rules'];
73
+
74
+ foreach ( (array)$rules as $key => $rule ) {
75
+ foreach ( $rule as $k => $r ) {
76
+ $new_rule[$k][$key] = $r;
77
+ }
78
+ }
79
+
80
+ foreach ( (array)$new_rule as $key => $rule ) {
81
+ if ( $rule['value'] == '' ) {
82
+ unset( $new_rule[$key] );
83
+ }
84
+ }
85
+
86
+ $conditions = $wpdb->get_var( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1" );
87
+ $conditions = unserialize( $conditions );
88
+ $new_cond = array();
89
+
90
+ if ( $_POST['rules']['value'][0] != '' ) {
91
+ $new_cond['property'] = $_POST['rules']['property'][0];
92
+ $new_cond['logic'] = $_POST['rules']['logic'][0];
93
+ $new_cond['value'] = $_POST['rules']['value'][0];
94
+ $conditions [] = $new_cond;
95
+ }
96
+
97
+ $sql = "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET `condition`='" . serialize( $conditions ) . "' WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1";
98
+ $wpdb->query( $sql );
99
  }
100
  }
101
+ }
102
 
103
+ if ( isset( $_POST['delete_condition'] ) ) {
 
 
 
104
 
105
+ $conditions = $wpdb->get_var( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1" );
106
+ $conditions = unserialize( $conditions );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
+ unset( $conditions[(int)$_POST['delete_condition']] );
109
+
110
+ $sql = "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET `condition`='" . serialize( $conditions ) . "' WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1";
111
+ $wpdb->query( $sql );
112
+ }
113
+
114
+ if ( isset( $_POST['submit_condition'] ) ) {
115
+ $conditions = $wpdb->get_var( "SELECT `condition` FROM `" . WPSC_TABLE_COUPON_CODES . "` WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1" );
116
+ $conditions = unserialize( $conditions );
117
+
118
+ $new_cond = array();
119
+ $new_cond['property'] = $_POST['rules']['property'][0];
120
+ $new_cond['logic'] = $_POST['rules']['logic'][0];
121
+ $new_cond['value'] = $_POST['rules']['value'][0];
122
+ $conditions[] = $new_cond;
123
+
124
+ $sql = "UPDATE `" . WPSC_TABLE_COUPON_CODES . "` SET `condition`='" . serialize( $conditions ) . "' WHERE `id` = '" . (int)$_POST['coupon_id'] . "' LIMIT 1";
125
+ $wpdb->query( $sql );
126
+ }
127
+ } ?>
128
+
129
+ <script type='text/javascript'>
130
+ jQuery(".pickdate").datepicker();
131
+ /* jQuery datepicker selector */
132
+ if (typeof jQuery('.pickdate').datepicker != "undefined") {
133
+ jQuery('.pickdate').datepicker({ dateFormat: 'yy-mm-dd' });
134
  }
135
+ </script>
136
+
137
+ <div class="wrap">
138
+ <h2>
139
+ <?php _e( 'Coupons', 'wpsc' ); ?>
140
+ <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' );">
141
+ <?php _e( 'Add New', 'wpsc' ); ?>
142
+ </a>
143
+ </h2>
144
+
145
+ <table style="width: 100%;">
146
+ <tr>
147
+ <td id="coupon_data">
148
+ <div id='add_coupon_box' class='modify_coupon' >
149
+ <form name='add_coupon' method='post' action=''>
150
+ <table class='add-coupon' >
151
+ <tr>
152
+ <th><?php _e( 'Coupon Code', 'wpsc' ); ?></th>
153
+ <th><?php _e( 'Discount', 'wpsc' ); ?></th>
154
+ <th><?php _e( 'Start', 'wpsc' ); ?></th>
155
+ <th><?php _e( 'Expiry', 'wpsc' ); ?></th>
156
+ <!--
157
+ <th><?php _e( 'Use Once', 'wpsc' ); ?></th>
158
+ <th><?php _e( 'Active', 'wpsc' ); ?></th>
159
+ <th><?php _e( 'Apply On All Products', 'wpsc' ); ?></th>
160
+ -->
161
+
162
+ </tr>
163
+ <tr>
164
+ <td>
165
+ <input type='text' value='' name='add_coupon_code' />
166
+ </td>
167
+ <td>
168
+ <input type='text' value='' size='3' name='add_discount' />
169
+ <select name='add_discount_type'>
170
+ <option value='0' >$</option>
171
+ <option value='1' >%</option>
172
+ <option value='2' ><?php _e( 'Free shipping', 'wpsc' ); ?></option>
173
+ </select>
174
+ </td>
175
+ <td>
176
+ <input type='text' class='pickdate' size='11' value="<?php echo date('Y-m-d'); ?>" name='add_start' />
177
+ </td>
178
+ <td>
179
+ <input type='text' class='pickdate' size='11' name='add_end' value="<?php echo (date('Y')+1) . date('-m-d') ; ?>">
180
+ </td>
181
+ <td>
182
+ <input type='hidden' value='true' name='add_coupon' />
183
+ <input type='submit' value='Add Coupon' name='submit_coupon' class='button-primary' />
184
+ </td>
185
+ </tr>
186
+
187
+ <tr>
188
+ <td colspan='3' scope="row">
189
+ <p>
190
+ <span class='input_label'><?php _e( 'Active', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_active' />
191
+ <input type='checkbox' value='1' checked='checked' name='add_active' />
192
+ <span class='description'><?php _e( 'Activate coupon on creation.', 'wpsc' ) ?></span>
193
+ </p>
194
+ </td>
195
+ </tr>
196
+
197
+ <tr>
198
+ <td colspan='3' scope="row">
199
+ <p>
200
+ <span class='input_label'><?php _e( 'Use Once', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_use-once' />
201
+ <input type='checkbox' value='1' name='add_use-once' />
202
+ <span class='description'><?php _e( 'Deactivate coupon after it has been used.', 'wpsc' ) ?></span>
203
+ </p>
204
+ </td>
205
+ </tr>
206
+
207
+ <tr>
208
+ <td colspan='3' scope="row">
209
+ <p>
210
+ <span class='input_label'><?php _e( 'Apply On All Products', 'wpsc' ); ?></span><input type='hidden' value='0' name='add_every_product' />
211
+ <input type="checkbox" value="1" name='add_every_product'/>
212
+ <span class='description'><?php _e( 'This coupon affects each product at checkout.', 'wpsc' ) ?></span>
213
+ </p>
214
+ </td>
215
+ </tr>
216
+
217
+ <tr><td colspan='3'><span id='table_header'>Conditions</span></td></tr>
218
+ <tr>
219
+ <td colspan="8">
220
+ <div class='coupon_condition' >
221
+ <div class='first_condition'>
222
+ <select class="ruleprops" name="rules[property][]">
223
+ <option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
224
+ <option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
225
+ <option value="total_quantity" rel="order"><?php _e( 'Total quantity', 'wpsc' ); ?></option>
226
+ <option value="subtotal_amount" rel="order"><?php _e( 'Subtotal amount', 'wpsc' ); ?></option>
227
+ <?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>
228
+ </select>
229
+
230
+ <select name="rules[logic][]">
231
+ <option value="equal"><?php _e( 'Is equal to', 'wpsc' ); ?></option>
232
+ <option value="greater"><?php _e( 'Is greater than', 'wpsc' ); ?></option>
233
+ <option value="less"><?php _e( 'Is less than', 'wpsc' ); ?></option>
234
+ <option value="contains"><?php _e( 'Contains', 'wpsc' ); ?></option>
235
+ <option value="not_contain"><?php _e( 'Does not contain', 'wpsc' ); ?></option>
236
+ <option value="begins"><?php _e( 'Begins with', 'wpsc' ); ?></option>
237
+ <option value="ends"><?php _e( 'Ends with', 'wpsc' ); ?></option>
238
+ <option value="category"><?php _e( 'In Category', 'wpsc' ); ?></option>
239
+ </select>
240
+
241
+ <span><input type="text" name="rules[value][]"/></span>
242
+
243
+ <span>
244
+ <script>
245
+ var coupon_number=1;
246
+ function add_another_property(this_button){
247
+ var new_property='<div class="coupon_condition">\n'+
248
+ '<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'+
249
+ '<select class="ruleprops" name="rules[property][]"> \n'+
250
+ '<option value="item_name" rel="order">Item name</option> \n'+
251
+ '<option value="item_quantity" rel="order">Item quantity</option>\n'+
252
+ '<option value="total_quantity" rel="order">Total quantity</option>\n'+
253
+ '<option value="subtotal_amount" rel="order">Subtotal amount</option>\n'+
254
+ '<?php echo apply_filters( 'wpsc_coupon_rule_property_options', '' ); ?>'+
255
+ '</select> \n'+
256
+ '<select name="rules[logic][]"> \n'+
257
+ '<option value="equal">Is equal to</option> \n'+
258
+ '<option value="greater">Is greater than</option> \n'+
259
+ '<option value="less">Is less than</option> \n'+
260
+ '<option value="contains">Contains</option> \n'+
261
+ '<option value="not_contain">Does not contain</option> \n'+
262
+ '<option value="begins">Begins with</option> \n'+
263
+ '<option value="ends">Ends with</option> \n'+
264
+ '</select> \n'+
265
+ '<span> \n'+
266
+ '<input type="text" name="rules[value][]"/> \n'+
267
+ '</span> \n'+
268
+ '</div> \n'+
269
+ '</div> ';
270
+
271
+ jQuery('.coupon_condition :first').after(new_property);
272
+ coupon_number++;
273
+ }
274
+ </script>
275
+ </span>
276
+ </div>
277
+ </div>
278
+ </tr>
279
+
280
+ <tr>
281
+ <td>
282
+ <a class="wpsc_coupons_condition_add" onclick="add_another_property(jQuery(this));">
283
+ <?php _e( 'Add New Condition', 'wpsc' ); ?>
284
+ </a>
285
+ </td>
286
+ </tr>
287
+ </table>
288
+ </form>
289
+ </div>
290
+ </td>
291
+ </tr>
292
+ </table>
293
+
294
  <?php
295
+ $columns = array(
296
+ 'coupon_code' => __( 'Coupon Code', 'wpsc' ),
297
+ 'discount' => __( 'Discount', 'wpsc' ),
298
+ 'start' => __( 'Start', 'wpsc' ),
299
+ 'expiry' => __( 'Expiry', 'wpsc' ),
300
+ 'active' => __( 'Active', 'wpsc' ),
301
+ 'apply_on_prods' => __( 'Apply On All Products', 'wpsc' ),
302
+ 'edit' => __( 'Edit', 'wpsc' )
303
+ );
304
+ register_column_headers( 'display-coupon-details', $columns );
305
+ ?>
306
+
307
+ <table class="coupon-list widefat" cellspacing="0">
308
+ <thead>
309
+ <tr>
310
+ <?php print_column_headers( 'display-coupon-details' ); ?>
311
+ </tr>
312
+ </thead>
313
+
314
+ <tfoot>
315
+ <tr>
316
+ <?php print_column_headers( 'display-coupon-details', false ); ?>
317
+ </tr>
318
+ </tfoot>
319
+
320
+ <tbody>
321
+ <?php
322
+ $i = 0;
323
+ $coupon_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_COUPON_CODES . "` ", ARRAY_A );
324
+
325
+ foreach ( (array)$coupon_data as $coupon ) {
326
+ $alternate = "";
327
+ $i++;
328
+ if ( ($i % 2) != 0 ) {
329
+ $alternate = "class='alt'";
330
+ }
331
+ echo "<tr $alternate>\n\r";
332
+
333
+ echo " <td>\n\r";
334
+ esc_attr_e( $coupon['coupon_code'] );
335
+ echo " </td>\n\r";
336
+
337
+ echo " <td>\n\r";
338
+ if ( $coupon['is-percentage'] == 1 )
339
+ echo esc_attr( $coupon['value'] ) . "%";
340
+
341
+ else if ( $coupon['is-percentage'] == 2 )
342
+ echo __("Free Shipping", 'wpsc');
343
+
344
+ else
345
+ echo wpsc_currency_display( esc_attr( $coupon['value'] ) );
346
+
347
+ echo " </td>\n\r";
348
+
349
+ echo " <td>\n\r";
350
+ echo date( "d/m/Y", strtotime( esc_attr( $coupon['start'] ) ) );
351
+ echo " </td>\n\r";
352
+
353
+ echo " <td>\n\r";
354
+ echo date( "d/m/Y", strtotime( esc_attr( $coupon['expiry'] ) ) );
355
+ echo " </td>\n\r";
356
+
357
+ echo " <td>\n\r";
358
+ switch ( $coupon['active'] ) {
359
+ case 1:
360
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
361
+ break;
362
+
363
+ case 0: default:
364
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
365
+ break;
366
+ }
367
+ echo " </td>\n\r";
368
+
369
+ echo " <td>\n\r";
370
+ switch ( $coupon['every_product'] ) {
371
+ case 1:
372
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/yes_stock.gif' alt='' title='' />";
373
+ break;
374
+
375
+ case 0: default:
376
+ echo "<img src='" . WPSC_CORE_IMAGES_URL . "/no_stock.gif' alt='' title='' />";
377
+ break;
378
+ }
379
+
380
+ echo " </td>\n\r";
381
+ echo " <td>\n\r";
382
+ echo "<a title='" . esc_attr( $coupon['coupon_code'] ). "' href='#' rel='" . $coupon['id'] . "' class='wpsc_edit_coupon' >" . __( 'Edit', 'wpsc' ) . "</a>";
383
+ echo " </td>\n\r";
384
+ echo " </tr>\n\r";
385
+ echo " <tr class='coupon_edit'>\n\r";
386
+ echo " <td colspan='7' style='padding-left:0px;'>\n\r";
387
+ echo " <div id='coupon_box_" . $coupon['id'] . "' class='displaynone modify_coupon' >\n\r";
388
+ coupon_edit_form( $coupon );
389
+ echo " </div>\n\r";
390
+ echo " </td>\n\r";
391
+ echo " </tr>\n\r";
392
+ }
393
+ ?>
394
+ </tbody>
395
+ </table>
396
+
397
+ <p style='margin: 10px 0px 5px 0px;'>
398
+ <?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' ); ?>
399
+ </p>
400
+
401
+ </div>
402
+
403
+ <?php
404
+
405
  }
406
+
407
+ ?>
wpsc-admin/display-debug.page.php CHANGED
@@ -8,19 +8,12 @@
8
  *
9
  * @package wp-e-commerce
10
  * @since 3.7
11
- *
12
- * @uses wp_die() Kill WordPress execution and display HTML message with error message.
13
- * @uses $wpdb WordPress database variable for queries
14
- * @uses admin_url() Gets URL to the admin of the current site
15
- * @uses wp_nonce_url() Retrieve URL with nonce added to URL query.
16
- * @uses wpsc_convert_products_to_posts() Converts legacy data format to post_types
17
- * @todo docs
18
  */
19
  function wpsc_debug_page() {
20
  if ( !current_user_can('manage_options') )
21
  wp_die("You don't look like an administrator.");
22
-
23
- $fixpage = admin_url( 'admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs' );
24
  ?>
25
  <div class="wrap">
26
  <h2>Debugging Page</h2>
@@ -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 = get_option( 'siteurl' ) . '/wp-admin/admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs';
17
  ?>
18
  <div class="wrap">
19
  <h2>Debugging Page</h2>
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,378 +21,282 @@ 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',
371
  'orderby' => 'meta_value_num'
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 +311,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,73 +329,41 @@ 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
  /**
451
  * wpsc_sortable_column_load
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 +371,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
 
68
+ add_filter( 'get_user_option_managewpsc-product_variantscolumnshidden', 'wpsc_variation_form_hidden_columns' );
 
 
 
 
69
 
70
+ return apply_filters( 'wpsc_variation_column_headers', $columns);
 
 
 
 
 
 
 
 
 
71
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
+ function wpsc_variation_form_hidden_columns( $return ) {
74
+ global $post;
75
 
76
+ if ( isset( $post ) && $post->post_parent == 0 && ! is_numeric( get_post_meta( $post->ID, '_wpsc_stock', true ) ) )
77
+ $return = array(
78
+ 'stock',
79
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
+ return $return;
 
 
 
82
  }
 
 
83
 
84
  /**
85
+ * wpsc_additional_column_data.
86
  *
87
  * @access public
 
88
  * @param (array) $column
89
  * @return void
 
90
  * @todo Need to check titles / alt tags ( I don't think thumbnails have any in this code )
91
  * @desc Switch function to generate columns the right way...no more UI hacking!
92
  *
 
 
 
93
  */
94
+ function wpsc_additional_column_data( $column ) {
95
+ global $post;
96
+
97
+ $is_parent = ( bool )wpsc_product_has_children($post->ID);
98
+ switch ( $column ) :
99
+
100
+ case 'image' :
101
+
102
+ $attached_images = get_posts( array(
103
+ 'post_type' => 'attachment',
104
+ 'numberposts' => 1,
105
+ 'post_parent' => $post->ID,
106
+ 'orderby' => 'menu_order',
107
+ 'order' => 'ASC'
108
+ ) );
109
+
110
+ if( isset( $post->ID ) && has_post_thumbnail( $post->ID ) )
111
+ echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
112
+ else if( !empty( $attached_images ) ) {
113
+ $attached_image = $attached_images[0];
114
+ $src = wp_get_attachment_url( $attached_image->ID );
115
+ ?>
116
+ <div style='width:38px; height:38px; overflow:hidden;'>
117
+ <img src='<?php echo $src; ?>' alt='<?php _e( 'Drag to a new position', 'wpsc' ); ?>' width='38' height='38' />
118
+ </div>
119
+ <?php
120
+ } else {
121
+ $image_url = WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif";
122
+ ?>
123
+ <img src='<?php echo $image_url; ?>' alt='<?php _e( 'Drag to a new position', 'wpsc' ); ?>' width='38' height='38' />
124
+ <?php
125
+ }
126
+ break;
127
+ case 'weight' :
128
+
129
+ if( $is_parent ) :
130
+ _e( 'N/A', 'wpsc' );
131
+ else :
132
+ $product_data['meta'] = array();
133
+ $product_data['meta'] = get_post_meta( $post->ID, '' );
134
+ foreach( $product_data['meta'] as $meta_name => $meta_value )
135
+ $product_data['meta'][$meta_name] = maybe_unserialize( array_pop( $meta_value ) );
136
+
137
+ $product_data['transformed'] = array();
138
+ if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight'] ) )
139
+ $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
140
+ if( !isset( $product_data['meta']['_wpsc_product_metadata']['weight_unit'] ) )
141
+ $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
142
+
143
+ $product_data['transformed']['weight'] = wpsc_convert_weight( $product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'] );
144
+
145
+ $weight = $product_data['transformed']['weight'];
146
+ if( $weight == '' )
147
+ $weight = '0';
148
+
149
+ $unit = $product_data['meta']['_wpsc_product_metadata']['weight_unit'];
150
+
151
+ switch( $unit ) {
152
+ case "pound":
153
+ $unit = __(" lbs.", "wpsc");
154
+ break;
155
+ case "ounce":
156
+ $unit = __(" oz.", "wpsc");
157
+ break;
158
+ case "gram":
159
+ $unit = __(" g", "wpsc");
160
+ break;
161
+ case "kilograms":
162
+ case "kilogram":
163
+ $unit = __(" kgs.", "wpsc");
164
+ break;
165
+ }
166
+ echo $weight.$unit;
167
+ echo '<div id="inline_' . $post->ID . '_weight" class="hidden">' . $weight . '</div>';
168
+
169
+ endif;
170
+ break;
171
+ case 'stock' :
172
+ $stock = get_post_meta( $post->ID, '_wpsc_stock', true );
173
+ if( $stock == '' )
174
+ $stock = __('N/A', 'wpsc');
175
+ if( !$is_parent ) {
176
+ echo $stock;
177
+ echo '<div id="inline_' . $post->ID . '_stock" class="hidden">' . $stock . '</div>';
178
+ }
179
+ else
180
+ echo '~'.wpsc_variations_stock_remaining( $post->ID );
181
+ break;
182
+ case 'price' :
183
+ $price = get_post_meta( $post->ID, '_wpsc_price', true );
184
+ $has_var = '1';
185
+ if( !$is_parent ) {
186
+ echo wpsc_currency_display( $price );
187
+ echo '<div id="inline_' . $post->ID . '_price" class="hidden">' . trim($price) . '</div>';
188
+ $has_var = '0';
189
+ }
190
+ else
191
+ echo wpsc_product_variation_price_available( $post->ID ).'+';
192
+ echo '<input type="hidden" value="'.$has_var.'" id="inline_' . $post->ID . '_has_var" />';
193
+
194
+ break;
195
+ case 'sale_price' :
196
+ $price = get_post_meta( $post->ID, '_wpsc_special_price', true );
197
+ if( !$is_parent ) {
198
+ echo wpsc_currency_display( $price );
199
+ echo '<div id="inline_' . $post->ID . '_sale_price" class="hidden">' . $price . '</div>';
200
+ } else
201
+ echo wpsc_product_variation_price_available( $post->ID ).'+';
202
+ break;
203
+ case 'SKU' :
204
+ $sku = get_post_meta( $post->ID, '_wpsc_sku', true );
205
+ if( $sku == '' )
206
+ $sku = __('N/A', 'wpsc');
207
+
208
+ echo $sku;
209
+ echo '<div id="inline_' . $post->ID . '_sku" class="hidden">' . $sku . '</div>';
210
+ break;
211
+ case 'cats' :
212
+ $categories = get_the_product_category( $post->ID );
213
+ if ( !empty( $categories ) ) {
214
+ $out = array();
215
+ foreach ( $categories as $c )
216
+ $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>";
217
+ echo join( ', ', $out );
218
+ } else {
219
+ _e('Uncategorized', 'wpsc');
220
+ }
221
+ break;
222
+ case 'featured' :
223
+ $featured_product_url = wp_nonce_url( "index.php?wpsc_admin_action=update_featured_product&amp;product_id=$post->ID", 'feature_product_' . $post->ID);
224
+ ?>
225
+ <a class="wpsc_featured_product_toggle featured_toggle_<?php echo $post->ID; ?>" href='<?php echo $featured_product_url; ?>' >
226
+ <?php if ( in_array( $post->ID, (array)get_option( 'sticky_products' ) ) ) : ?>
227
+ <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' ); ?>' />
228
+ <?php else: ?>
229
+ <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' ); ?>' />
230
+ <?php endif; ?>
231
+ </a>
232
+ <?php
233
+ break;
234
+ case 'hidden_alerts' :
235
+ $product_alert = apply_filters( 'wpsc_product_alert', array( false, '' ), $post );
236
+ if( !empty( $product_alert['messages'] ) )
237
+ $product_alert['messages'] = implode( "\n",( array )$product_alert['messages'] );
238
+
239
+ if( $product_alert['state'] === true ) {
240
+ ?>
241
+ <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='' />
242
+ <?php
243
+ }
244
+
245
+ // If a product alert has stuff to display, show it.
246
+ // Can be used to add extra icons etc
247
+ if ( !empty( $product_alert['display'] ) )
248
+ echo $product_alert['display'];
249
+ break;
250
+ endswitch;
251
 
 
 
 
252
  }
 
 
 
 
 
253
  function wpsc_column_sql_orderby( $vars ) {
254
+
255
  if ( ! isset( $vars['post_type'] ) || 'wpsc-product' != $vars['post_type'] || ! isset( $vars['orderby'] ) )
256
+ return $vars;
257
+
258
+ switch ( $vars['orderby'] ) :
259
+ case 'stock' :
260
+ $vars = array_merge(
261
  $vars,
262
  array(
263
  'meta_key' => '_wpsc_stock',
264
  'orderby' => 'meta_value_num'
265
  )
266
  );
267
+ break;
268
  case 'price' :
269
+ $vars = array_merge(
270
  $vars,
271
  array(
272
  'meta_key' => '_wpsc_price',
273
  'orderby' => 'meta_value_num'
274
  )
275
  );
276
+ break;
277
+ case 'sale_price' :
278
+ $vars = array_merge(
279
  $vars,
280
  array(
281
  'meta_key' => '_wpsc_special_price',
282
  'orderby' => 'meta_value_num'
283
  )
284
  );
285
+
286
+ break;
287
  case 'SKU' :
288
+ $vars = array_merge(
289
  $vars,
290
  array(
291
  'meta_key' => '_wpsc_sku',
292
  'orderby' => 'meta_value'
293
  )
294
  );
295
+ break;
296
  endswitch;
297
+
298
  return $vars;
299
  }
 
 
 
 
 
 
300
  function wpsc_cats_restrict_manage_posts() {
301
  global $typenow;
302
 
311
  // retrieve array of term objects per taxonomy
312
  // output html for taxonomy dropdown filter
313
  echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
314
+ echo "<option value=''>" . sprintf(_x('Show All %s', 'Show all [category name]', 'wpsc'), $tax_name) . "</option>";
315
  wpsc_cats_restrict_manage_posts_print_terms($tax_slug);
316
  echo "</select>";
317
  }
318
  }
319
  }
320
 
321
+ function wpsc_cats_restrict_manage_posts_print_terms($taxonomy, $parent = 0, $level = 0){
 
 
 
 
 
 
 
 
322
  $prefix = str_repeat( '&nbsp;&nbsp;&nbsp;' , $level );
323
  $terms = get_terms( $taxonomy, array( 'parent' => $parent, 'hide_empty' => false ) );
324
  if( !($terms instanceof WP_Error) && !empty($terms) )
329
  }
330
 
331
  /**
332
+ * wpsc no minors allowed
333
  * Restrict the products page to showing only parent products and not variations.
 
334
  * @since 3.8
335
  */
336
+
337
  function wpsc_no_minors_allowed( $vars ) {
338
+ global $current_screen;
339
 
340
+ if( $current_screen->post_type != 'wpsc-product' )
341
+ return $vars;
342
 
343
+ $vars['post_parent'] = 0;
344
 
345
+ return $vars;
346
  }
347
 
348
  /**
349
  * wpsc_sortable_column_load
350
+ *
351
  * Only sorts columns on edit.php page.
352
  * @since 3.8.8
 
 
353
  */
 
 
 
 
354
 
355
+ function wpsc_sortable_column_load() {
356
+ add_filter( 'request', 'wpsc_no_minors_allowed' );
357
+ add_filter( 'request', 'wpsc_column_sql_orderby', 8 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
  }
359
 
360
+ add_action( 'load-edit.php', 'wpsc_sortable_column_load' );
361
+ add_action( 'admin_head', 'wpsc_additional_column_name_variations' );
362
+ add_action( 'restrict_manage_posts', 'wpsc_cats_restrict_manage_posts' );
363
+ add_action( 'manage_pages_custom_column', 'wpsc_additional_column_data', 10, 2 );
 
364
  add_filter( 'manage_edit-wpsc-product_sortable_columns', 'wpsc_additional_sortable_column_names' );
365
+ add_filter( 'manage_edit-wpsc-product_columns', 'wpsc_additional_column_names' );
366
+ add_filter( 'manage_wpsc-product_posts_columns', 'wpsc_additional_column_names' );
367
 
368
 
369
 
371
  * wpsc_update_featured_products function.
372
  *
373
  * @access public
374
+ * @todo Should be refactored to e
375
  * @return void
 
 
 
 
 
 
376
  */
377
  function wpsc_update_featured_products() {
378
+ $is_ajax = (int)(bool)$_POST['ajax'];
379
+ $product_id = absint( $_GET['product_id'] );
380
+ check_admin_referer( 'feature_product_' . $product_id );
 
 
 
 
 
 
 
 
 
 
381
  $status = get_option( 'sticky_products' );
382
 
383
+ $new_status = (in_array( $product_id, $status )) ? false : true;
384
 
385
  if ( $new_status ) {
386
+
387
  $status[] = $product_id;
388
  } else {
389
  $status = array_diff( $status, array( $product_id ) );
390
  $status = array_values( $status );
391
  }
392
+ update_option( 'sticky_products', $status );
393
 
394
+ if ( $is_ajax == true ) {
395
+ if ( $new_status == true ) : ?>
396
+ 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' ); ?>' />");
397
+ <?php else: ?>
398
+ 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' ); ?>' />");
399
+ <?php
400
+ endif;
 
 
 
 
 
 
 
401
  exit();
402
  }
403
  wp_redirect( wp_get_referer() );
404
+ exit();
405
  }
406
 
407
+ add_filter( 'page_row_actions','my_action_row', 10, 2 );
408
 
409
+ function my_action_row( $actions, $post ) {
 
 
 
 
 
 
 
 
 
 
410
 
411
+ if ( $post->post_type != "wpsc-product" )
412
+ return $actions;
413
 
414
+ $url = admin_url( 'edit.php' );
415
+ $url = add_query_arg( array( 'wpsc_admin_action' => 'duplicate_product', 'product' => $post->ID ), $url );
416
 
417
+ $actions['duplicate'] = '<a href="'.esc_url( $url ).'">'._x( 'Duplicate', 'row-actions', 'wpsc' ).'</a>';
418
+
419
+ return $actions;
420
  }
421
 
422
+ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( $_REQUEST['wpsc_admin_action'] == 'update_featured_product' ) )
423
+ add_action( 'admin_init', 'wpsc_update_featured_products' );
424
+
425
+ if ( isset( $_GET['wpsc_admin_action'] ) && ( $_GET['wpsc_admin_action'] == 'duplicate_product' ) )
426
+ add_action( 'admin_init', 'wpsc_duplicate_product' );
wpsc-admin/display-options-settings.page.php CHANGED
@@ -3,8 +3,100 @@
3
  * Display Settings page
4
  */
5
 
6
- function wpsc_display_settings_page() {
7
- WPSC_Settings_Page::get_instance()->display();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
  /*
@@ -12,7 +104,19 @@ function wpsc_display_settings_page() {
12
  */
13
 
14
  function wpsc_settings_tabs() {
15
- return WPSC_Settings_Page::get_instance()->get_tabs();
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
  /*
@@ -20,7 +124,140 @@ function wpsc_settings_tabs() {
20
  */
21
 
22
  function wpsc_the_settings_tabs() {
23
- WPSC_Settings_Page::get_instance()->output_tabs();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
  function wpsc_settings_page_update_notification() {
@@ -31,30 +268,30 @@ function wpsc_settings_page_update_notification() {
31
  <?php
32
 
33
  if ( isset( $_GET['updated'] ) && (int)$_GET['updated'] ) {
34
- printf( _n( '%s Setting options updated.', ' %s Settings options updated.', $_GET['updated'], 'wpsc' ), absint( $_GET['updated'] ) );
35
  unset( $_GET['updated'] );
36
  $message = true;
37
  }
38
  if ( isset( $_GET['deleted'] ) && (int)$_GET['deleted'] ) {
39
- printf( _n( '%s Setting option deleted.', '%s Setting option deleted.', $_GET['deleted'], 'wpsc' ), absint( $_GET['deleted'] ) );
40
  unset( $_GET['deleted'] );
41
  $message = true;
42
  }
43
  if ( isset( $_GET['shipadd'] ) && (int)$_GET['shipadd'] ) {
44
- printf( _n( '%s Shipping option updated.', '%s Shipping option updated.', $_GET['shipadd'], 'wpsc' ), absint( $_GET['shipadd'] ) );
45
  unset( $_GET['shipadd'] );
46
  $message = true;
47
  }
48
  if ( isset( $_GET['added'] ) && (int)$_GET['added'] ) {
49
- printf( _n( '%s Checkout field added.', '%s Checkout fields added.', $_GET['added'], 'wpsc' ), absint( $_GET['added'] ) );
50
  unset( $_GET['added'] );
51
  $message = true;
52
  }
53
 
54
- if ( ! isset( $message ) )
55
  _e( 'Settings successfully updated.', 'wpsc' );
56
 
57
- $_SERVER['REQUEST_URI'] = 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
3
  * Display Settings page
4
  */
5
 
6
+ // Clear the previously selected shipping form session variable if you are not on the shipping page
7
+ if ( isset( $_GET['tab'] ) )
8
+ if( $_GET['tab'] == 'shipping' )
9
+ if( isset( $_GET['shipping_module'] ) )
10
+ $_SESSION['previous_shipping_name'] = $_GET['shipping_module'];
11
+
12
+ function wpsc_display_settings_page() { ?>
13
+
14
+ <div id="wpsc_options" class="wrap">
15
+ <div id="icon_card" class="icon32"></div>
16
+ <?php
17
+
18
+ wpsc_the_settings_tabs();
19
+
20
+ if ( isset( $_GET['tab'] ) )
21
+ $page = $_GET['tab'];
22
+ else
23
+ $page = 'general';
24
+
25
+ if ( !isset( $_GET['isocode'] ) )
26
+ $_GET['isocode'] = '';
27
+
28
+ if ( preg_match( "/[a-zA-Z]{2,4}/", $_GET['isocode'] ) ) {
29
+ include(WPSC_FILE_PATH . '/wpsc-admin/includes/tax_and_shipping.php');
30
+ return;
31
+ }
32
+
33
+ if ( isset( $_GET['googlecheckoutshipping'] ) ) {
34
+ include(WPSC_FILE_PATH . '/wpsc-merchants/library/google_shipping_country.php');
35
+ return;
36
+ exit();
37
+ }
38
+
39
+ if ( isset( $_GET['selected_all'] ) )
40
+ wpsc_submit_options( $_GET['selected_all'] );
41
+
42
+ ?>
43
+
44
+ <div id='wpsc_options_page'>
45
+
46
+ <?php
47
+ switch ( $page ) {
48
+ case 'checkout' :
49
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/checkout.php' );
50
+ wpsc_options_checkout();
51
+ break;
52
+
53
+ case 'gateway' :
54
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/gateway.php' );
55
+ wpsc_options_gateway();
56
+ break;
57
+
58
+ case 'shipping' :
59
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/shipping.php' );
60
+ wpsc_options_shipping();
61
+ break;
62
+
63
+ case 'admin' :
64
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/admin.php' );
65
+ wpsc_options_admin();
66
+ break;
67
+
68
+ case 'presentation' :
69
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/presentation.php' );
70
+ wpsc_options_presentation();
71
+ break;
72
+
73
+ case 'taxes' :
74
+ wpec_taxes_settings_page();
75
+ break;
76
+
77
+ case 'marketing' :
78
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/marketing.php' );
79
+ wpsc_options_marketing();
80
+ break;
81
+
82
+ case 'import' :
83
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/import.php' );
84
+ wpsc_options_import();
85
+ break;
86
+
87
+ case 'general' :
88
+ default :
89
+ require_once( WPSC_FILE_PATH . '/wpsc-admin/includes/settings-pages/general.php' );
90
+ wpsc_options_general();
91
+ break;
92
+ }
93
+
94
+ $_SESSION['wpsc_settings_curr_page'] = $page; ?>
95
+
96
+ </div>
97
+ </div>
98
+
99
+ <?php
100
  }
101
 
102
  /*
104
  */
105
 
106
  function wpsc_settings_tabs() {
107
+ $_default_tabs = array(
108
+ 'general' => _x( 'General', 'General settings tab in Settings->Store page', 'wpsc' ),
109
+ 'presentation' => _x( 'Presentation', 'Presentation settings tab in Settings->Store page', 'wpsc' ),
110
+ 'admin' => _x( 'Admin', 'Admin settings tab in Settings->Store page', 'wpsc' ),
111
+ 'taxes' => _x( 'Taxes', 'Taxes settings tab in Settings->Store page', 'wpsc' ),
112
+ 'shipping' => _x( 'Shipping', 'Shipping settings tab in Settings->Store page', 'wpsc' ),
113
+ 'gateway' => _x( 'Payments', 'Payments settings tab in Settings->Store page', 'wpsc' ),
114
+ 'checkout' => _x( 'Checkout', 'Checkout settings tab in Settings->Store page', 'wpsc' ),
115
+ 'marketing' => _x( 'Marketing', 'Marketing settings tab in Settings->Store page', 'wpsc' ),
116
+ 'import' => _x( 'Import', 'Import settings tab in Settings->Store page', 'wpsc' )
117
+ );
118
+
119
+ return apply_filters( 'wpsc_settings_tabs', $_default_tabs );
120
  }
121
 
122
  /*
124
  */
125
 
126
  function wpsc_the_settings_tabs() {
127
+ global $redir_tab;
128
+
129
+ $tabs = wpsc_settings_tabs();
130
+
131
+ if ( !empty( $tabs ) ) {
132
+ echo '<h2 class="nav-tab-wrapper">';
133
+
134
+ if ( isset( $redir_tab ) && array_key_exists( $redir_tab, $tabs ) ) {
135
+ $current = $redir_tab;
136
+ } elseif ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ) {
137
+ $current = $_GET['tab'];
138
+ } else {
139
+ $keys = array_keys( $tabs );
140
+ $current = array_shift( $keys );
141
+ }
142
+
143
+ foreach ( $tabs as $callback => $text ) {
144
+ $class = ' class="nav-tab"';
145
+
146
+ if ( $current == $callback )
147
+ $class = ' class="nav-tab nav-tab-active"';
148
+
149
+ $href = add_query_arg( array( 'tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false ) );
150
+ $href = remove_query_arg( 'isocode', $href );
151
+ $href = wp_nonce_url( $href, "tab-$callback" );
152
+ $link = "<a href='" . esc_url( $href ) . "'$class>$text</a>";
153
+
154
+ echo $link;
155
+ }
156
+ echo '</h2>';
157
+ }
158
+ }
159
+
160
+ function country_list( $selected_country = null ) {
161
+ global $wpdb;
162
+
163
+ $output = '';
164
+ $output .= "<option value=''></option>";
165
+ $country_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
166
+
167
+ foreach ( (array)$country_data as $country ) {
168
+ $selected = '';
169
+
170
+ if ( $selected_country == $country['isocode'] )
171
+ $selected = "selected='selected'";
172
+
173
+ $output .= "<option value='" . $country['isocode'] . "' $selected>" . htmlspecialchars( $country['country'] ) . "</option>";
174
+ }
175
+
176
+ return $output;
177
+ }
178
+
179
+ /*
180
+ * Get Shipping Form for wp-admin
181
+ */
182
+ function wpsc_get_shipping_form( $shippingname ) {
183
+ global $wpsc_shipping_modules;
184
+
185
+ if ( array_key_exists( $shippingname, $wpsc_shipping_modules ) ) {
186
+ $shipping_forms = $wpsc_shipping_modules[$shippingname]->getForm();
187
+ $shipping_module_name = $wpsc_shipping_modules[$shippingname]->name;
188
+ $output = array( 'name' => $shipping_module_name, 'form_fields' => $shipping_forms, 'has_submit_button' => 1 );
189
+ } else {
190
+ $output = array( 'name' => '&nbsp;', 'form_fields' => __( 'To configure a shipping module select one on the left.', 'wpsc' ), 'has_submit_button' => 0 );
191
+ }
192
+
193
+ return $output;
194
+ }
195
+
196
+ /***
197
+ * Get Payment Form for wp-admin
198
+ */
199
+ function wpsc_get_payment_form( $paymentname ,$selected_gateway_data='') {
200
+ global $nzshpcrt_gateways;
201
+
202
+ $payment_gateway_names = get_option('payment_gateway_names');
203
+ $form = array();
204
+ $output = array( 'name' => '&nbsp;', 'form_fields' => __( 'To configure a payment module select one on the left.', 'wpsc' ), 'has_submit_button' => 0 );
205
+
206
+ foreach ( $nzshpcrt_gateways as $gateway ) {
207
+ if ( $gateway["internalname"] != $paymentname ) {
208
+ continue;
209
+ } else {
210
+ $selected_gateway_data = $gateway;
211
+ $form = $gateway;
212
+ }
213
+ }
214
+
215
+ if ( $form ) {
216
+ $output ='';
217
+ $output .="<tr>
218
+ <td style='border-top: none;'>
219
+ ".__("Display Name", 'wpsc')."
220
+ </td>
221
+ <td style='border-top: none;'>";
222
+
223
+ if (isset($payment_gateway_names[$paymentname]) ) {
224
+ $display_name = $payment_gateway_names[$paymentname];
225
+ } elseif(!empty($selected_gateway_data['display_name'])){
226
+ $display_name =$selected_gateway_data['display_name'];
227
+ }else{
228
+ switch($selected_gateway_data['payment_type']) {
229
+ case "paypal";
230
+ $display_name = "PayPal";
231
+ break;
232
+
233
+ case "manual_payment":
234
+ $display_name = "Manual Payment";
235
+ break;
236
+
237
+ case "google_checkout":
238
+ $display_name = "Google Checkout";
239
+ break;
240
+
241
+ case "credit_card":
242
+ default:
243
+ $display_name = "Credit Card";
244
+ break;
245
+ }
246
+ }
247
+
248
+ $output .="<input type='text' name='user_defined_name[".$paymentname."]' value='". $display_name ."' /><br />
249
+ <span class='small description'>".__('The text that people see when making a purchase', 'wpsc')."</span>
250
+ </td>
251
+ </tr>";
252
+ $payment_forms = $form["form"]();
253
+ $payment_module_name = $form["name"];
254
+
255
+ $output = array( 'name' => $payment_module_name, 'form_fields' => $output.$payment_forms, 'has_submit_button' => 1 );
256
+ } else {
257
+ $output = array( 'name' => '&nbsp;', 'form_fields' => __( 'To configure a payment module select one on the left.', 'wpsc' ), 'has_submit_button' => 0 );
258
+ }
259
+
260
+ return $output;
261
  }
262
 
263
  function wpsc_settings_page_update_notification() {
268
  <?php
269
 
270
  if ( isset( $_GET['updated'] ) && (int)$_GET['updated'] ) {
271
+ printf( _n( '%s Setting options updated.', ' %s Settings options updated.', $_GET['updated'] ), absint( $_GET['updated'] ) );
272
  unset( $_GET['updated'] );
273
  $message = true;
274
  }
275
  if ( isset( $_GET['deleted'] ) && (int)$_GET['deleted'] ) {
276
+ printf( _n( '%s Setting option deleted.', '%s Setting option deleted.', $_GET['deleted'] ), absint( $_GET['deleted'] ) );
277
  unset( $_GET['deleted'] );
278
  $message = true;
279
  }
280
  if ( isset( $_GET['shipadd'] ) && (int)$_GET['shipadd'] ) {
281
+ printf( _n( '%s Shipping option updated.', '%s Shipping option updated.', $_GET['shipadd'] ), absint( $_GET['shipadd'] ) );
282
  unset( $_GET['shipadd'] );
283
  $message = true;
284
  }
285
  if ( isset( $_GET['added'] ) && (int)$_GET['added'] ) {
286
+ printf( _n( '%s Checkout field added.', '%s Checkout fields added.', $_GET['added'] ), absint( $_GET['added'] ) );
287
  unset( $_GET['added'] );
288
  $message = true;
289
  }
290
 
291
+ if ( !isset( $message ) )
292
  _e( 'Settings successfully updated.', 'wpsc' );
293
 
294
+ $_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'] ) ); ?>
295
  </p></div>
296
 
297
  <?php
wpsc-admin/display-sales-logs.php CHANGED
@@ -5,444 +5,599 @@
5
  * These are the main WPSC sales page functions
6
  *
7
  * @package wp-e-commerce
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
  }
 
5
  * These are the main WPSC sales page functions
6
  *
7
  * @package wp-e-commerce
8
+ * @since 3.7
9
  */
10
+ global $purchlogs;
11
+ if(!isset($purchlogs)){
12
+ $purchlogs = new wpsc_purchaselogs();
13
+ }
14
 
15
+ function wpsc_display_sales_logs() {
16
+ $subpage = empty( $_GET['subpage'] ) ? '' : $_GET['subpage'];
 
 
 
 
 
 
17
 
18
+ switch( $subpage ) {
19
+ case 'upgrade-purchase-logs':
20
+ wpsc_upgrade_purchase_logs();
21
+ break;
22
 
23
+ case 'update-purchase-logs-3.8':
24
+ wpsc_update_purchase_logs_3dot8();
25
+ break;
 
 
 
 
26
 
27
+ default:
28
+ wpsc_display_sales_log_index();
29
+ break;
30
  }
31
+ }
32
 
33
+ function wpsc_update_purchase_logs_3dot8() {
34
+ if ( _wpsc_purchlogs_need_update() )
35
+ wpsc_update_purchase_logs();
36
 
37
+ ?>
38
+ <div class="wrap">
39
+ <h2><?php echo esc_html( __('Sales', 'wpsc') ); ?> </h2>
40
+ <p><?php printf( __( 'Your purchase logs have been updated! <a href="%s">Click here</a> to return.'), esc_url( remove_query_arg( 'subpage' ) ) ); ?></p>
41
+ </div>
42
+ <?php
43
+ }
44
 
45
+ function _wpsc_purchlogs_need_update() {
46
+ global $wpdb;
 
47
 
48
+ if ( get_option( '_wpsc_purchlogs_3.8_updated' ) )
49
  return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
+ $c = $wpdb->get_var( "SELECT COUNT(*) FROM " . WPSC_TABLE_PURCHASE_LOGS . " WHERE plugin_version IN ('3.6', '3.7')" );
52
+ if ( $c > 0 )
53
+ return true;
54
 
55
+ update_option( '_wpsc_purchlogs_3.8_updated', true );
56
+ return false;
57
+ }
58
 
59
+ function wpsc_display_sales_log_index() {
60
+
61
+ global $purchlogitem;
62
+
63
+ ?>
64
+ <div class="wrap">
65
+ <h2><?php echo esc_html( __('Sales', 'wpsc') ); ?> </h2>
66
+ <?php //START OF PURCHASE LOG DEFAULT VIEW ?>
67
+ <?php
68
+ if(isset($_GET['view_purchlogs_by']) || isset($_GET['view_purchlogs_by_status']))
69
+ wpsc_change_purchlog_view($_GET['view_purchlogs_by'], $_GET['view_purchlogs_by_status']);
70
+
71
+ if(isset($_POST['purchlogs_searchbox']))
72
+ wpsc_search_purchlog_view($_POST['purchlogs_searchbox']);
73
+
74
+ if(!isset($_REQUEST['purchaselog_id'])){
75
+ $columns = array(
76
+ 'cb' => '<input type="checkbox" />',
77
+ 'purchid' => __( 'Order ID', 'wpsc' ),
78
+ 'date' => __( 'Date / Time', 'wpsc' ),
79
+ 'name' => '',
80
+ 'amount' => __( 'Amount', 'wpsc' ),
81
+ 'details' => __( 'Details', 'wpsc' ),
82
+ 'status' => __( 'Status', 'wpsc' ),
83
+ 'delete' => __( 'Delete', 'wpsc' ),
84
+ 'track' => __( 'Tracking ID', 'wpsc' )
85
+ );
86
+ register_column_headers('display-sales-list', $columns);
87
+ ///// start of update message section //////
88
+
89
+ $fixpage = get_option('siteurl').'/wp-admin/admin.php?page=wpsc-sales-logs&amp;subpage=upgrade-purchase-logs';
90
+ if (isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['locked']) ) { ?>
91
+ <div id="message" class="updated fade"><p>
92
+ <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
93
+ printf( _n( '%s Purchase Log updated.', '%s Purchase Logs updated.', $_GET['updated'], 'wpsc' ), absint( $_GET['updated'] ) );
94
+ unset($_GET['updated']);
95
+ }
96
+
97
+ if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
98
+ unset($_GET['skipped']);
99
+
100
+ if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
101
+ printf( _n( '%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $_GET['locked'], 'wpsc' ), absint( $_GET['locked'] ) );
102
+ unset($_GET['locked']);
103
+ }
104
+
105
+ if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
106
+ printf( _n( '%s Purchase Log deleted.', '%s Purchase Logs deleted.', $_GET['deleted'], 'wpsc' ), absint( $_GET['deleted'] ) );
107
+ unset($_GET['deleted']);
108
+ }
109
+ ?>
110
+ </p></div>
111
+ <?php }
112
+
113
+ if(get_option('wpsc_purchaselogs_fixed')== false || (wpsc_check_uniquenames()) ){ ?>
114
+ <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'), $fixpage); ?></span></div>
115
+ <?php }
116
+
117
+ if ( _wpsc_purchlogs_need_update() ) {
118
  ?>
119
+ <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, add_query_arg( 'subpage', 'update-purchase-logs-3.8' ) ); ?></span></div>
120
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
 
123
+ ///// end of update message section //////?>
124
+ <div id='dashboard-widgets' style='min-width: 825px;'>
125
+ <?php /* end of sidebar start of main column */ ?>
126
+ <div id='post-body' class='has-sidebar metabox-holder' style='width:95%;'>
127
+ <div id='dashboard-widgets-main-content-wpsc' class='has-sidebar-content'>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
+ <?php
130
+ wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
131
+ do_meta_boxes('dashboard_page_wpsc-sales-logs', 'top', true);
132
+ ?>
133
+ </div><br />
134
+ <div id='wpsc_purchlog_searchbox'>
135
+ <?php wpsc_purchaselogs_searchbox(); ?>
136
+ </div><br />
137
+ <?php wpsc_purchaselogs_displaylist(); ?>
138
+
139
+ </div>
140
+ <script type="text/javascript">
141
+ jQuery(document).ready(function(){postboxes.add_postbox_toggles(pagenow);});
142
+ </script>
143
+ </div>
144
+ <?php }else{ //NOT IN GENERIC PURCHASE LOG PAGE, IN DETAILS PAGE PER PURCHASE LOG
145
+
146
+ if(isset($_REQUEST['purchaselog_id'])){
147
+ $purchlogitem = new wpsc_purchaselogs_items((int)$_REQUEST['purchaselog_id']);
148
+ }
149
+ if (isset($_GET['cleared']) || isset($_GET['cleared'])) { ?>
150
+ <div id="message" class="updated fade"><p>
151
+ <?php
152
+ if ( isset($_GET['cleared']) && $_GET['cleared']==true ) {
153
+ _e('Downloads for this log have been released.', 'wpsc' );
154
+ unset($_GET['cleared']);
155
+ }
156
+ if ( isset($_GET['sent']) && (int) $_GET['sent'] ) {
157
+ _e( 'Receipt has been resent ', 'wpsc' );
158
+ unset($_GET['sent']);
159
+ }
160
+ ?> </p></div>
161
+ <?php
162
+ }
163
+ ?>
164
+
165
+
166
+ <?php
167
+ $page_back = esc_url( remove_query_arg( array('locked', 'skipped', 'updated', 'deleted','purchaselog_id'), $_SERVER['REQUEST_URI'] ) );
168
+
169
+ $columns = array(
170
+ 'title' => __('Name','wpsc'),
171
+ 'sku' => __('SKU','wpsc'),
172
+ 'quantity' => __('Quantity','wpsc'),
173
+ 'price' => __('Price','wpsc'),
174
+ 'shipping' => __('Shipping','wpsc'),
175
+ 'tax' => '',
176
+ 'total' => __('Total','wpsc')
177
+ );
178
+
179
+ if(wpec_display_product_tax())
180
+ {
181
+ $columns['tax'] = __('Tax Included','wpsc');
182
+ }// if
183
+
184
+ register_column_headers('display-purchaselog-details', $columns);
185
+ ?>
186
+ <div id='post-body' class='has-sidebar' style='width:95%;'>
187
+ <?php if(wpsc_has_purchlog_shipping()) { ?>
188
+ <div id='wpsc_shipping_details_box'>
189
+ <h3><?php _e('Shipping Address','wpsc'); ?></h3>
190
+ <p><strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong></p>
191
+ <p>
192
+ <?php echo wpsc_display_purchlog_shipping_address(); ?><br />
193
+ <?php echo wpsc_display_purchlog_shipping_city(); ?><br />
194
+ <?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?><br />
195
+ <?php echo wpsc_display_purchlog_shipping_country(); ?><br />
196
+ </p>
197
+ <strong><?php _e('Shipping Options','wpsc'); ?></strong>
198
+ <p>
199
+
200
+ <?php _e('Shipping Method:','wpsc'); ?> <?php echo wpsc_display_purchlog_shipping_method(); ?><br />
201
+ <?php _e('Shipping Option:','wpsc'); ?> <?php echo wpsc_display_purchlog_shipping_option(); ?><br />
202
+ <?php if(wpsc_purchlogs_has_tracking()) : ?>
203
+ <?php _e('Tracking ID:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackid(); ?><br />
204
+ <?php _e('Shipping Status:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackstatus(); ?><br />
205
+ <?php _e('Track History:','wpsc'); ?> <?php echo wpsc_purchlogitem_trackhistory(); ?>
206
+ <?php endif; ?>
207
+ </p>
208
+ </div>
209
+ <?php } ?>
210
+ <div id='wpsc_billing_details_box'>
211
+ <?php do_action( 'wpsc_billing_details_top'); ?>
212
+ <h3><?php _e('Billing Details','wpsc'); ?></h3>
213
+ <p><strong><?php _e('Purchase Log Date:','wpsc'); ?> </strong><?php echo wpsc_purchaselog_details_date(); ?> </p>
214
+ <p><strong><?php _e('Purchase Number:','wpsc'); ?> </strong><?php echo wpsc_purchaselog_details_purchnumber(); ?> </p>
215
+ <p><strong><?php _e('Buyers Name:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_name(); ?></p>
216
+ <p><strong><?php _e('Address:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_address(); ?></p>
217
+
218
+ <p><strong><?php _e('Phone:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_buyers_phone(); ?></p>
219
+ <p><strong><?php _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>
220
+ <p><strong><?php _e('Payment Method:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_paymentmethod(); ?></p>
221
+ <?php if(wpsc_display_purchlog_display_howtheyfoundus()) : ?>
222
+ <p><strong><?php _e('How User Found Us:','wpsc'); ?> </strong><?php echo wpsc_display_purchlog_howtheyfoundus(); ?></p>
223
+ <?php endif; ?>
224
+ <?php do_action( 'wpsc_billing_details_bottom'); ?>
225
+ </div>
226
+
227
+ <div id='wpsc_items_ordered'>
228
+ <br />
229
+ <h3><?php _e('Items Ordered','wpsc'); ?></h3>
230
+ <table class="widefat" cellspacing="0">
231
+ <thead>
232
+ <tr>
233
+ <?php print_column_headers('display-purchaselog-details'); ?>
234
+ </tr>
235
+ </thead>
236
+
237
+ <tbody>
238
+ <?php wpsc_display_purchlog_details(); ?>
239
+
240
+ <tr class="wpsc_purchaselog_start_totals">
241
+ <td colspan="5">
242
+ <?php if ( wpsc_purchlog_has_discount_data() ) { ?>
243
+ <?php _e('Coupon Code','wpsc'); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
244
+ <?php } ?>
245
+ </td>
246
+ <th><?php _e('Discount','wpsc'); ?> </th>
247
+ <td><?php echo wpsc_display_purchlog_discount(); ?></td>
248
+ </tr>
249
+
250
+ <?php if(!wpec_display_product_tax()) { ?>
251
+ <tr>
252
+ <td colspan='5'></td>
253
+ <th><?php _e('Taxes','wpsc'); ?> </th>
254
+ <td><?php echo wpsc_display_purchlog_taxes(); ?></td>
255
+ </tr>
256
+ <?php } ?>
257
+
258
+ <tr>
259
+ <td colspan='5'></td>
260
+ <th><?php _e('Shipping','wpsc'); ?> </th>
261
+ <td><?php echo wpsc_display_purchlog_shipping(); ?></td>
262
+ </tr>
263
+ <tr>
264
+ <td colspan='5'></td>
265
+ <th><?php _e('Total','wpsc'); ?> </th>
266
+ <td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
267
+ </tr>
268
+ </tbody>
269
+ </table>
270
+ <div id='wpsc_purchlog_order_status'>
271
+ <form action='' method='post'>
272
+ <p><label for='purchaselog-<?php echo absint( $_GET['purchaselog_id'] ); ?>'><?php _e('Order Status:','wpsc'); ?></label><select id='purchaselog-<?php echo absint( $_GET['purchaselog_id'] ); ?>' class='selector' name='<?php echo absint( $_GET['purchaselog_id'] ); ?>' title='<?php echo absint( $_GET['purchaselog_id'] ); ?>' >
273
+ <?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
274
+ <option value='<?php echo wpsc_the_purch_status_id(); ?>' <?php echo wpsc_purchlog_is_checked_status(); ?> ><?php echo wpsc_the_purch_status_name(); ?> </option>
275
+ <?php endwhile; ?>
276
+ </select></p>
277
+ </form>
278
+ </div>
279
+ <br style="clear: both;" />
280
+ <?php wpsc_purchlogs_custom_fields(); ?>
281
+
282
+
283
+ <!-- Start Order Notes (by Ben) -->
284
+ <?php wpsc_purchlogs_notes(); ?>
285
+ <!-- End Order Notes (by Ben) -->
286
+
287
+ <?php wpsc_custom_checkout_fields(); ?>
288
+
289
+ </div>
290
+ </div>
291
+
292
+ <div id='wpsc_purchlogitems_links'>
293
+ <h3><?php _e('Actions','wpsc'); ?></h3>
294
+ <?php do_action( 'wpsc_purchlogitem_links_start' ); ?>
295
+ <?php if(wpsc_purchlogs_have_downloads_locked() != false): ?>
296
+ <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' />
297
+ <?php endif; ?>
298
+ <img src='<?php echo WPSC_CORE_IMAGES_URL; ?>/printer.png' alt='printer icon' />&ensp;<a href='<?php echo esc_url( add_query_arg('wpsc_admin_action','wpsc_display_invoice') ); ?>'><?php _e('View Packing Slip', 'wpsc'); ?></a>
299
+
300
+ <br /><br class='small' /><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',absint( $_GET['purchaselog_id'] ) ) ); ?>'><?php _e('Resend Receipt to Buyer', 'wpsc'); ?></a>
301
+
302
+ <br /><br class='small' /><a class='submitdelete' title='<?php echo esc_attr(__( 'Delete this log', 'wpsc' )); ?>' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&amp;purchlog_id=".absint( $_GET['purchaselog_id'] ), 'delete_purchlog_' . absint( $_GET['purchaselog_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>
303
+
304
+ <br /><br class='small' />&emsp;&ensp; <a href='<?php echo $page_back ?>'><?php _e('Go Back', 'wpsc'); ?></a>
305
+ <br /><br />
306
+ </div>
307
+ <br />
308
+ <?php } ?>
309
+ </div>
310
+ <?php
311
+
312
+ }
313
+
314
+ function wpsc_purchaselogs_displaylist(){
315
+ global $purchlogs;
316
+ ?>
317
+ <form method='post' action=''>
318
+ <div class='wpsc_purchaselogs_options'>
319
+ <select id='purchlog_multiple_status_change' name='purchlog_multiple_status_change' class='purchlog_multiple_status_change'>
320
+ <option selected='selected' value='-1'><?php _e('Bulk Actions', 'wpsc'); ?></option>
321
+ <?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
322
+ <option value='<?php echo wpsc_the_purch_status_id(); ?>' >
323
+ <?php echo wpsc_the_purch_status_name(); ?>
324
+ </option>
325
+ <?php endwhile; ?>
326
+ <option value="delete"><?php _e('Delete', 'wpsc'); ?></option>
327
+ </select>
328
+ <input type='hidden' value='purchlog_bulk_modify' name='wpsc_admin_action2' />
329
+ <input type="submit" value="<?php _e('Apply', 'wpsc'); ?>" name="doaction" id="doaction" class="button-secondary action" />
330
+ <?php /* View functions for purchlogs */?>
331
+ <label for='view_purchlogs_by'><?php _e('View:'); ?></label>
332
+
333
+ <select id='view_purchlogs_by' name='view_purchlogs_by'>
334
+ <?php
335
+ $date_is_selected['3mnths'] = '';
336
+ $date_is_selected['all'] = '';
337
+ if( !isset($_GET['view_purchlogs_by']) )
338
+ $_GET['view_purchlogs_by'] = '';
339
+ switch($_GET['view_purchlogs_by']) {
340
+ case 'all':
341
+ $date_is_selected['all'] = 'selected="selected"';
342
+ break;
343
+
344
+ default:
345
+ case '3mnths':
346
+ case '':
347
+ $date_is_selected['3mnths'] = 'selected="selected"';
348
+ break;
349
+ }
350
+
351
+ ?>
352
+ <option value='all' <?php echo $date_is_selected['all']; ?>><?php echo _x('All', 'all sales', 'wpsc'); ?></option>
353
+ <option value='3mnths' <?php echo $date_is_selected['3mnths']; ?>><?php _e('Three Months', 'wpsc'); ?></option>
354
+ <?php echo wpsc_purchlogs_getfirstdates(); ?>
355
+ </select>
356
+ <select id='view_purchlogs_by_status' name='view_purchlogs_by_status'>
357
+ <option value='-1'><?php _e('Status: All', 'wpsc'); ?></option>
358
+
359
+ <?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
360
+
361
+ <?php
362
+
363
+ $current_status = wpsc_the_purch_status_id();
364
+ $is_selected = '';
365
+ if(isset($_GET['view_purchlogs_by_status']) && $_GET['view_purchlogs_by_status'] == $current_status) {
366
+ $is_selected = 'selected="selected"';
367
+ }
368
+ ?>
369
+ <option value='<?php echo $current_status; ?>' <?php echo $is_selected; ?> >
370
+ <?php echo wpsc_the_purch_status_name(); ?>
371
+ </option>
372
+ <?php endwhile; ?>
373
+ </select>
374
+ <input type='hidden' value='purchlog_filter_by' name='wpsc_admin_action' />
375
+ <input type="submit" value="<?php _e('Filter', 'wpsc'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
376
+ </div>
377
+ <?php if( isset( $_POST['purchlogs_searchbox'] ) && wpsc_have_purch_items() == false ): ?>
378
+ <div class="updated settings-error"><p><?php _e('There are no purchase logs for your selection, please try again.', 'wpsc'); ?></p></div>
379
+ <?php endif;?>
380
+ <table class="widefat page fixed" cellspacing="0">
381
+ <thead>
382
+ <tr>
383
+ <?php print_column_headers('display-sales-list'); ?>
384
+ </tr>
385
+ </thead>
386
+ <tfoot>
387
+ <tr>
388
+ <?php print_column_headers('display-sales-list', false); ?>
389
+ </tr>
390
+ </tfoot>
391
+ <tbody>
392
+ <?php get_purchaselogs_content(); ?>
393
+ </tbody>
394
+ </table>
395
+ <p><strong><?php _e('Total:', 'wpsc'); ?></strong> <?php echo wpsc_currency_display( wpsc_the_purch_total() ); ?></p>
396
+ <?php
397
+ if(!isset($purchlogs->current_start_timestamp) && !isset($purchlogs->current_end_timestamp)){
398
+ $purchlogs->current_start_timestamp = $purchlogs->earliest_timestamp;
399
+ $purchlogs->current_end_timestamp = $purchlogs->current_timestamp;
400
+ }
401
+ $arr_params = array('wpsc_admin_action' => 'wpsc_downloadcsv',
402
+ 'rss_key' => 'key',
403
+ 'start_timestamp' => $purchlogs->current_start_timestamp,
404
+ 'end_timestamp' => $purchlogs->current_end_timestamp);
405
+
406
+ $piggy_url = 'http://www.bravenewcode.com/store/plugins/piggy/?utm_source=affiliate-6331&utm_medium=affiliates&utm_campaign=wpec#1';
407
+ ?>
408
+ <br />
409
+ <p><a class='admin_download' href='<?php echo esc_url(add_query_arg($arr_params) ) ; ?>' ><img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/download.gif' alt='' title='' /> <span> <?php _e('Download CSV', 'wpsc'); ?></span></a>
410
+ <a target="_blank" class='admin_download' href='<?php echo htmlentities( $piggy_url, ENT_QUOTES, 'UTF-8') ; ?>'><img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL; ?>/mobile.png' alt='' title='' /> <span> <?php _e('Mobile Sales App', 'wpsc'); ?></span></a></p>
411
+ </form>
412
+ <br />
413
+ <script type="text/javascript">
414
+ /* <![CDATA[ */
415
+ (function($){
416
+ $(document).ready(function(){
417
+ $('#doaction, #doaction2').click(function(){
418
+ if ( $('select[name^="purchlog_multiple_status_change"]').val() == 'delete' ) {
419
+ var m = '<?php echo esc_js(__("You are about to delete the selected purchase logs.\n 'Cancel' to stop, 'OK' to delete.", "wpsc")); ?>';
420
+ return showNotice.warn(m);
421
+ }
422
+ });
423
+ });
424
+ })(jQuery);
425
+ //columns.init('edit');
426
+ /* ]]> */
427
+ </script>
428
 
429
+ <?php
430
+ unset($_SESSION['newlogs']);
431
+ }
432
+
433
+ function get_purchaselogs_content(){
434
+ while(wpsc_have_purch_items()) : wpsc_the_purch_item();
435
+ ?>
436
+ <tr>
437
+ <th class="check-column" scope="row"><input type='checkbox' name='purchlogids[]' class='editcheckbox' value='<?php echo wpsc_the_purch_item_id(); ?>' /></th>
438
+ <td><?php echo wpsc_the_purch_item_id(); ?></td><!-- purchase ID -->
439
+ <td><?php echo wpsc_the_purch_item_date(); ?></td> <!--Date -->
440
+ <td><?php echo wpsc_the_purch_item_name(); ?></td> <!--Name/email -->
441
+ <td><?php echo wpsc_currency_display( wpsc_the_purch_item_price() ); ?></td><!-- Amount -->
442
+ <td><a href='<?php echo esc_url( add_query_arg( 'purchaselog_id', wpsc_the_purch_item_id() ) ) ; ?>'><?php
443
+ $number_of_items = wpsc_the_purch_item_details();
444
+ printf( _n( '%s Item', '%s Items', $number_of_items, 'wpsc' ), $number_of_items );
445
+ ?></a></td><!-- Details -->
446
+ <td>
447
+ <?php if(!wpsc_purchlogs_is_google_checkout()){ ?>
448
+ <img src="<?php echo admin_url('images/wpspin_light.gif'); ?>" class="ajax-loading" alt="" style="position:relative; top:3px;" />
449
+ <select class='selector' name='<?php echo wpsc_the_purch_item_id(); ?>' title='<?php echo wpsc_the_purch_item_id(); ?>' >
450
+ <?php while(wpsc_have_purch_items_statuses()) : wpsc_the_purch_status(); ?>
451
+ <option value='<?php echo wpsc_the_purch_status_id(); ?>' <?php echo wpsc_is_checked_status(); ?> ><?php echo wpsc_the_purch_status_name(); ?> </option>
452
+ <?php endwhile; ?>
453
+ </select>
454
+ <?php }else { ?>
455
+ <a href='http://checkout.google.com/' rel=''><img class='google_checkout_logo' src='<?php echo WPSC_CORE_IMAGES_URL . "/checkout_logo.jpg"; ?>' alt='google checkout' /></a>
456
+ <?php } ?>
457
+ </td><!-- Status -->
458
+ <td><a class='submitdelete' title='<?php echo esc_attr(__('Delete this log', 'wpsc')); ?>' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=delete_purchlog&amp;purchlog_id=".wpsc_the_purch_item_id(), 'delete_purchlog_' . wpsc_the_purch_item_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_the_purch_item_date() )) ?>') ) { return true;}return false;"><img class='wpsc_pushdown_img' src='<?php echo WPSC_CORE_IMAGES_URL . "/cross.png"; ?>' alt='delete icon' /></a></td><!-- Delete -->
459
+ <td>
460
+ <a class='wpsc_show_trackingid' title='<?php echo wpsc_the_purch_item_id(); ?>' href=''><?php echo wpsc_display_tracking_id(); ?></a>
461
+ </td>
462
+ </tr>
463
+ <tr class='log<?php echo wpsc_the_purch_item_id(); ?> wpsc_trackingid_row'>
464
+ <td class='wpsc_trackingid_row' colspan='2'>
465
+
466
+ <label for='wpsc_trackingid<?php echo wpsc_the_purch_item_id(); ?>'><?php _e('Tracking ID','wpsc');?> :</label>
467
+ </td>
468
+ <td class='wpsc_trackingid_row' colspan='2'>
469
+ <input type='text' name='wpsc_trackingid<?php echo wpsc_the_purch_item_id(); ?>' value='<?php echo wpsc_trackingid_value(); ?>' size='20' />
470
+ <input type='submit' name='submit' class='button' value='Add Tracking ID' />
471
+ </td>
472
+ <td colspan='4'>
473
+ <img src="<?php echo admin_url('images/wpspin_light.gif'); ?>" class="ajax-loading" alt="" style="position:relative; top:3px;" />
474
+ <a href='' title='<?php echo wpsc_the_purch_item_id(); ?>' class='sendTrackingEmail'><?php _e( 'Send Custom Message', 'wpsc' ); ?></a>
475
+ </td>
476
+ </tr>
477
+
478
+ <?php
479
+ endwhile;
480
+ }
481
+ function wpsc_purchaselogs_searchbox(){
482
+ ?>
483
+ <form action='' method='post'>
484
+ <input type='hidden' name='wpsc_admin_action' value='purchlogs_search' />
485
+ <input type='text' value='<?php if(isset($_POST['purchlogs_searchbox'])) echo esc_attr( $_POST['purchlogs_searchbox'] ); ?>' name='purchlogs_searchbox' id='purchlogs_searchbox' />
486
+ <input type="submit" value="<?php _e('Search Logs', 'wpsc'); ?>" class="button-secondary action" />
487
+ </form>
488
+ <?php
489
+ }
490
+
491
+ function wpsc_display_purchlog_details(){
492
+ while( wpsc_have_purchaselog_details() ) : wpsc_the_purchaselog_item(); ?>
493
+ <tr>
494
+ <td><?php echo wpsc_purchaselog_details_name(); ?></td> <!-- NAME! -->
495
+ <td><?php echo wpsc_purchaselog_details_SKU(); ?></td> <!-- SKU! -->
496
+ <td><?php echo wpsc_purchaselog_details_quantity(); ?></td> <!-- QUANTITY! -->
497
+ <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_price() ); ?></td> <!-- PRICE! -->
498
+ <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_shipping() ); ?></td> <!-- SHIPPING! -->
499
+ <td><?php if(wpec_display_product_tax()) { echo wpsc_currency_display(wpsc_purchaselog_details_tax()); } ?></td> <!-- TAX! -->
500
+ <!-- <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_discount() ); ?></td> --> <!-- DISCOUNT! -->
501
+ <td><?php echo wpsc_currency_display( wpsc_purchaselog_details_total() ); ?></td> <!-- TOTAL! -->
502
+ </tr>
503
+ <?php
504
+ endwhile;
505
+ }
506
 
507
+ function wpsc_purchlogs_custom_fields(){
508
+ if(wpsc_purchlogs_has_customfields()){?>
509
+ <div class='metabox-holder'>
510
+ <div id='purchlogs_customfields' class='postbox'>
511
+ <h3 class='hndle'><?php _e( 'Users Custom Fields' , 'wpsc' ); ?></h3>
512
+ <div class='inside'>
513
+ <?php $messages = wpsc_purchlogs_custommessages(); ?>
514
+ <?php $files = wpsc_purchlogs_customfiles(); ?>
515
+ <?php if(count($files) > 0){ ?>
516
+ <h4><?php _e( 'Cart Items with Custom Files' , 'wpsc' ); ?>:</h4>
517
+ <?php
518
+ foreach($files as $file){
519
+ echo "<p>".esc_html($file)."</p>";
520
+ }
521
+ }?>
522
+ <?php if(count($messages) > 0){ ?>
523
+ <h4><?php _e( 'Cart Items with Custom Messages' , 'wpsc' ); ?>:</h4>
524
+ <?php
525
+ foreach($messages as $message){
526
+ echo "<p>".esc_html($message)."</p>";
527
+ }
528
+ } ?>
529
+ </div>
530
+ </div>
531
+ </div>
532
+ <?php }
533
 
534
+ }
 
 
535
 
 
 
 
 
 
536
 
537
+ /* Start Order Notes (by Ben) */
538
+ function wpsc_purchlogs_notes() {
539
+
540
+ if ( true ) { // Need to check if notes column exists in DB and plugin version? ?>
541
+ <div class="metabox-holder">
542
+ <div id="purchlogs_notes" class="postbox">
543
+ <h3 class='hndle'><?php _e( 'Order Notes' , 'wpsc' ); ?></h3>
544
+ <div class='inside'>
545
+ <form method="post" action="">
546
+ <input type='hidden' name='wpsc_admin_action' value='purchlogs_update_notes' />
547
+ <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' ); ?>" />
548
+ <input type='hidden' name='purchlog_id' value='<?php echo absint( $_GET['purchaselog_id'] ); ?>' />
549
+ <p><textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php if ( isset($_POST['purchlog_notes']) ) { echo esc_html($_POST['purchlog_notes']); } else { echo esc_html( wpsc_display_purchlog_notes() ); } ?></textarea></p>
550
+ <p><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></p>
551
+ </form>
552
+ </div>
553
+ </div>
554
+ </div>
555
+ <?php }
556
 
557
+ }
558
+ /* End Order Notes (by Ben) */
559
+ function wpsc_custom_checkout_fields(){
560
+ global $purchlogitem;
561
+ if(!empty($purchlogitem->customcheckoutfields)){
562
+ ?>
563
+ <div class="metabox-holder">
564
+ <div id="custom_checkout_fields" class="postbox">
565
+ <h3 class='hndle'><?php _e( 'Additional Checkout Fields' , 'wpsc' ); ?></h3>
566
+ <div class='inside'>
567
+ <?php
568
+ foreach((array)$purchlogitem->customcheckoutfields as $key=>$value){
569
+ $value['value'] = maybe_unserialize($value['value']);
570
+ if(is_array($value['value'])){
571
+ ?>
572
+ <p><strong><?php echo $key; ?> :</strong> <?php echo implode(stripslashse($value['value']), ','); ?></p>
573
+ <?php
574
+
575
+
576
+ }else{
577
+ ?>
578
+ <p><strong><?php echo $key; ?> :</strong> <?php echo stripslashes($value['value']); ?></p>
579
+ <?php
580
+ }
581
+ }
582
+ ?>
583
+ </div>
584
+ </div>
585
+ </div>
586
+ <?php
587
+ }
588
+ }
589
 
590
+ /**
591
+ * @description: determines whether or not to display the product tax or not
592
+ * @return: boolean
593
+ **/
594
+ function wpec_display_product_tax()
595
+ {
596
+ global $purchlogitem;
597
+ return ($purchlogitem->extrainfo->wpec_taxes_total == 0.00) ? true : false;
598
+ }// wpec_display_product_tax
599
+
600
+ function wpsc_upgrade_purchase_logs() {
601
+ include(WPSC_FILE_PATH.'/wpsc-admin/includes/purchlogs_upgrade.php');
602
  }
603
+ ?>
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." ), 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
@@ -1,77 +1,171 @@
1
  <?php
2
 
3
  function wpsc_display_upgrades_page() {
4
-
5
  do_action( 'wpsc_gold_module_activation' ); ?>
6
 
7
  <div class='wrap'>
8
  <div class='metabox-holder wpsc_gold_side'>
 
 
9
 
10
- <h2><?php esc_html_e( 'Upgrades', 'wpsc' ); ?></h2>
11
- <div>
12
- <?php if ( defined( 'WPSC_GOLD_MODULE_PRESENT' ) && ( true == WPSC_GOLD_MODULE_PRESENT ) ) {?>
13
- <p><?php esc_html_e( 'Enter your API Username and API Key below.', 'wpsc' ); ?></p>
14
- <p><a href="http://docs.wpecommerce.org/category/extending-your-store/premium-plugins/gold-cart/"><?php esc_html_e( 'For more information visit our documentation page.', 'wpsc' ); ?></a></p>
15
- <?php } ?>
16
- <div class='metabox-holder'>
17
- <form method='post' id='gold_cart_form' action=''>
18
-
19
- <?php
20
- if ( defined( 'WPSC_GOLD_MODULE_PRESENT' ) && ( true == WPSC_GOLD_MODULE_PRESENT ) ) {
21
- do_action( 'wpsc_gold_module_activation_forms' );
22
- } else {
23
- ?>
24
-
25
- <div id='wpsc_gold_options_outside'>
26
- <div class='form-wrap' >
27
- <p>
28
- <?php esc_html_e( "You don't have any Upgrades yet!", 'wpsc' ); ?>
29
- </p>
30
- </div>
31
- </div>
32
- <?php } ?>
33
- </form>
34
- <?php do_meta_boxes('wpsc_upgrade_page', 'top', true); ?>
35
- </div>
36
  </div>
37
 
38
- <strong><?php esc_html_e( 'WP eCommerce Upgrades', 'wpsc' ); ?></strong><br />
39
-
40
- <span><?php esc_html_e( 'Add more functionality to your eCommerce site. Prices may be subject to change.', 'wpsc' ); ?><input type='button' class='button-primary' onclick='window.open ("http://wpecommerce.org/store/premium-plugins/","mywindow");' value='<?php esc_html_e( 'Buy Now', 'wpsc' ); ?>' id='visitInstinct' name='visitInstinct' /></span>
41
-
42
- <br />
43
  <div class='wpsc_gold_module'>
44
  <br />
45
- <a href="https://wpecommerce.org/store/premium-plugins/gold-cart/" target="_blank"><strong><?php esc_html_e( 'Gold Cart', 'wpsc' ); ?></strong></a>
46
- <p class='wpsc_gold_text'><?php esc_html_e( 'Add product search, multiple image upload, gallery view, Grid View and multiple payment gateway options to your shop', 'wpsc' ); ?></p>
 
47
  </div>
48
 
49
  <div class='wpsc_gold_module'>
50
  <br />
51
- <a href="https://wpecommerce.org/store/premium-plugins/membership-subscriptions/" target="_blank"><strong><?php esc_html_e( 'Members Access Plugin', 'wpsc' ); ?></strong></a>
52
- <p class='wpsc_gold_text'><?php esc_html_e( 'Create product memberships and sell them in your store. Use these memberships to restrict premium content on your posts and pages creating a "members only" area perfect for: Forums, Images and Movies and Podcasts', 'wpsc' ); ?></p>
 
53
  </div>
54
 
55
  <div class='wpsc_gold_module'>
56
  <br />
57
- <a href="https://wpecommerce.org/store/premium-plugins/nextgen-gallery-buy-now-buttons/" target="_blank"><strong><?php esc_html_e( 'NextGen Gallery Buy Now Buttons', 'wpsc' ); ?> </strong></a>
58
- <p class='wpsc_gold_text'><?php esc_html_e( 'Make your Online photo gallery into an eCommerce solution.', 'wpsc' ); ?></p>
 
59
  </div>
60
 
61
  <div class='wpsc_gold_module'>
62
  <br />
63
- <a href="https://wpecommerce.org/store/premium-plugins/mp3-player-plugin/" target="_blank"><strong><?php esc_html_e( 'JPlayer - MP3 Plugin', 'wpsc' ); ?> </strong></a>
64
- <p class='wpsc_gold_text'><?php esc_html_e( 'MP3 Player Plugin for WordPress', 'wpsc' ); ?></p>
 
 
 
 
 
 
 
 
65
  </div>
66
  <div class='wpsc_gold_module'>
67
  <br />
68
- <a href="https://wpecommerce.org/store/premium-plugins/fedex-shipping-module/" target="_blank"><strong><?php esc_html_e( 'FedEx Plugin', 'wpsc' ); ?> </strong></a>
69
- <p class='wpsc_gold_text'><?php esc_html_e( 'This plugin offers shop owners the ability to provide Fedex Shipping Quotes for products with weights.', 'wpsc' ); ?></p>
 
70
  </div>
 
 
 
 
 
 
 
71
  </div>
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  </div>
74
 
75
  <?php
76
  }
77
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
  function wpsc_display_upgrades_page() {
4
+
5
  do_action( 'wpsc_gold_module_activation' ); ?>
6
 
7
  <div class='wrap'>
8
  <div class='metabox-holder wpsc_gold_side'>
9
+ <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://getshopped.org/resources/docs/installation/gold-files/"><?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,285 @@ 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 +637,250 @@ 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 +895,54 @@ 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 +950,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 +976,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 +996,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 +1011,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 +1028,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 +1202,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
+ ?>
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
+ // Get variation data from WP Terms
389
+ $product_term_data = wp_get_object_terms( $post->ID, 'wpsc-variation' );
390
+ if ( !empty( $product_term_data ) ) {
391
+ foreach ( $product_term_data as $product_term )
392
+ $product_terms[] = $product_term->term_id;
393
+ } else {
394
+ $product_terms = array();
395
  }
396
+ ?>
397
+ <?php if ( empty( $post->post_title ) ) : ?>
398
+ <p><?php _e( 'You must first save this Product as a Draft before adding variations', 'wpsc' ); ?></p>
399
+ <?php else : ?>
400
+ <div id="product_variations">
401
+ <div class="variation_checkboxes">
402
+ <?php
403
+
404
+ wp_terms_checklist( $post->ID, array(
405
+ 'taxonomy' => 'wpsc-variation',
406
+ 'selected_cats' => $product_terms,
407
+ 'walker' => new WPSC_Walker_Variation_Checklist,
408
+ 'checked_ontop' => false
409
+ ) );
410
+
411
+ ?>
412
+ </div>
413
+ <a class="preview button update_variations_action" href='#'><?php _e( 'Update Variations &rarr;', 'wpsc' ); ?></a>
414
 
415
+ </div>
416
+ <?php
417
+ $parent_product = $post->ID;
 
 
 
418
 
419
+ $query = array(
420
+ 'post_type' => 'wpsc-product',
421
+ 'orderby' => 'menu_order post_title',
422
+ 'post_parent' => $parent_product,
423
+ 'post_status' => 'publish, inherit',
424
+ 'order' => "ASC"
 
 
 
 
 
 
425
  );
 
426
 
427
+ $args = array(
428
+ 'post_type' => 'attachment',
429
+ 'numberposts' => 1,
430
+ 'post_status' => null,
431
+ 'post_parent' => $parent_product,
432
+ 'orderby' => 'menu_order',
433
+ 'order' => 'ASC'
 
 
 
 
 
 
434
  );
 
435
 
436
+ $image_data = (array)get_posts( $args );
437
+ $parent_product_data['image'] = array_shift( $image_data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
 
439
+ $wp_query = new WP_Query( $query );
440
+ if ( !isset( $parent_product_data ) )
441
+ $parent_product_data = null;
442
+ ?>
 
 
 
 
 
 
 
 
 
 
 
443
 
444
+ <p><a name='variation_control'>&nbsp;</a><?php _e( 'Check or uncheck variation boxes and then click Update Variations to add or remove variations.', 'wpsc' ) ?></p>
445
 
446
+ <table class="widefat page" id='wpsc_product_list' cellspacing="0">
447
+ <thead>
448
+ <tr>
449
+ <?php print_column_headers( 'wpsc-product_variants' ); ?>
450
+ </tr>
451
+ </thead>
452
 
453
+ <tfoot>
454
+ <tr>
455
+ <?php print_column_headers( 'wpsc-product_variants', false ); ?>
456
+ </tr>
457
+ </tfoot>
458
 
459
+ <tbody>
460
+ <?php
461
+ wpsc_admin_product_listing( $parent_product_data );
462
+ ?>
463
+ <?php
464
+ if ( count( $wp_query->posts ) < 1 ) :
465
+ ?>
466
+ <tr>
467
+ <td colspan="8">
468
+ <?php _e( 'You have no Variations added.', 'wpsc' ); ?>
469
+ </td>
470
+ </tr>
 
 
 
471
 
472
+ <?php endif; ?>
473
+ </tbody>
474
 
475
+ </table>
 
 
476
 
477
+ <?php
478
+ endif;
479
  }
480
+ function wpsc_product_shipping_forms() {
481
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
482
 
483
+ $product_data = get_post_custom( $post->ID );
484
+ $product_data['meta'] = maybe_unserialize( $product_data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
 
486
+ foreach ( $product_data['meta'] as $meta_key => $meta_value )
487
+ $product_data['meta'][$meta_key] = $meta_value[0];
488
 
489
+ $product_meta = array();
490
+ if ( !empty( $product_data["_wpsc_product_metadata"] ) )
491
+ $product_meta = maybe_unserialize( $product_data["_wpsc_product_metadata"][0] );
492
 
493
+ $product_data['transformed'] = array();
494
+ if ( !isset( $product_meta['weight'] ) )
495
+ $product_meta['weight'] = "";
496
 
497
+ if( !isset( $product_meta['weight_unit'] ) )
498
+ $product_meta['weight_unit'] = '';
499
 
500
+ $product_data['transformed']['weight'] = wpsc_convert_weight( $product_meta['weight'], "pound", $product_meta['weight_unit']);
 
 
 
 
501
 
502
+ // Fix wp_debug notices
503
+ if(!isset($product_meta['dimensions'])){
504
+ $product_meta['dimensions'] = array(
505
+ 'height' => 0,
506
+ 'width' => 0,
507
+ 'length' => 0
508
+ );
509
+ }
510
+ if( !isset($product_meta['display_weight_as']) )
511
+ $product_meta['display_weight_as'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
 
513
+ if( !isset( $product_meta['dimensions']['height_unit'] ) )
514
+ $product_meta['dimensions']['height_unit'] = '';
515
 
516
+ if( !isset( $product_meta['dimensions']['width_unit'] ) )
517
+ $product_meta['dimensions']['width_unit'] = '';
 
518
 
519
+ if( !isset( $product_meta['dimensions']['length_unit'] ) )
520
+ $product_meta['dimensions']['length_unit'] = '';
521
 
522
+ if( !isset( $product_meta['shipping'] ) ){
523
+ $product_meta['shipping']['local'] = '';
524
+ $product_meta['shipping']['international'] = '';
525
+ }
526
+ if( !isset( $product_meta['no_shipping'] ) )
527
+ $product_meta['no_shipping'] = '';
528
+ ?>
529
+ <table>
530
+
531
+ <!--USPS shipping changes-->
532
+ <tr>
533
+ <td>
534
+ <?php _e( 'Weight', 'wpsc' ); ?>
535
+ </td>
536
+ <td>
537
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][weight]' value='<?php echo $product_data['transformed']['weight']; ?>' />
538
+ <select name='meta[_wpsc_product_metadata][weight_unit]'>
539
+ <option value='pound' <?php echo ( ( $product_meta['display_weight_as'] == 'pound' ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Pounds', 'wpsc' ); ?></option>
540
+ <option value='ounce' <?php echo ( ( preg_match( "/o(u)?nce/", $product_meta['display_weight_as'] ) ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Ounces', 'wpsc' ); ?></option>
541
+ <option value='gram' <?php echo ( ( $product_meta['display_weight_as'] == 'gram' ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Grams', 'wpsc' ); ?></option>
542
+ <option value='kilogram' <?php echo ( ( $product_meta['display_weight_as'] == 'kilogram' || $product_meta['display_weight_as'] == 'kilograms' ) ? 'selected="selected"' : '' ); ?> ><?php _e( 'Kilograms', 'wpsc' ); ?></option>
543
+ </select>
544
+ </td>
545
+ </tr>
546
+ <!--dimension-->
547
+ <tr>
548
+ <td>
549
+ <?php _e( 'Height', 'wpsc' ); ?>
550
+ </td>
551
+ <td>
552
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][dimensions][height]' value= '<?php echo $product_meta['dimensions']['height'] ; ?>'>
553
+ <select name='meta[_wpsc_product_metadata][dimensions][height_unit]'>
554
+ <option value='in' <?php echo ( ( $product_meta['dimensions']['height_unit'] == 'in' ) ? 'selected' : '' ); ?> ><?php _e( 'inches', 'wpsc' ); ?></option>
555
+ <option value='cm' <?php echo ( ( $product_meta['dimensions']['height_unit'] == 'cm' ) ? 'selected' : '' ); ?> ><?php _e( 'cm', 'wpsc' ); ?></option>
556
+ <option value='meter' <?php echo ( ( $product_meta['dimensions']['height_unit'] == 'meter' ) ? 'selected' : '' ); ?> ><?php _e( 'meter', 'wpsc' ); ?></option>
557
+ </select>
558
+ </td>
559
+ </tr>
560
+ <tr>
561
+ <td>
562
+ <?php _e( 'Width', 'wpsc' ); ?>
563
+ </td>
564
+ <td>
565
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][dimensions][width]' value='<?php echo $product_meta['dimensions']['width']; ?> '>
566
+ <select name='meta[_wpsc_product_metadata][dimensions][width_unit]'>
567
+ <option value='in' <?php echo( ( $product_meta['dimensions']['width_unit'] == 'in' ) ? 'selected' : '' ); ?> ><?php _e( 'inches', 'wpsc' ); ?></option>
568
+ <option value='cm' <?php echo ( ( $product_meta['dimensions']['width_unit'] == 'cm' ) ? 'selected' : '' ); ?> ><?php _e( 'cm', 'wpsc' ); ?></option>
569
+ <option value='meter' <?php echo ( ( $product_meta['dimensions']['width_unit'] == 'meter' ) ? 'selected' : '' ); ?> ><?php _e( 'meter', 'wpsc' ); ?></option>
570
+ </select>
571
+ </td>
572
+ </tr>
573
+ <tr>
574
+ <td>
575
+ <?php _e( 'Length', 'wpsc' ); ?>
576
+ </td>
577
+ <td>
578
+ <input type='text' size='5' name='meta[_wpsc_product_metadata][dimensions][length]' value='<?php echo $product_meta['dimensions']['length']; ?>'>
579
+ <select name='meta[_wpsc_product_metadata][dimensions][length_unit]'>
580
+ <option value='in' <?php echo( ( $product_meta['dimensions']['length_unit'] == 'in' ) ? 'selected' : '' ); ?> ><?php _e( 'inches', 'wpsc' ); ?></option>
581
+ <option value='cm' <?php echo( ( $product_meta['dimensions']['length_unit'] == 'cm' ) ? 'selected' : '' ); ?> ><?php _e( 'cm', 'wpsc' ); ?></option>
582
+ <option value='meter' <?php echo ( ( $product_meta['dimensions']['length_unit'] == 'meter' ) ? 'selected' : '' ); ?> ><?php _e( 'meter', 'wpsc' ); ?></option>
583
+ </select>
584
+ </td>
585
+ </tr>
586
+
587
+ <!--//dimension-->
588
+ <!--USPS shipping changes ends-->
589
+ <tr>
590
+ <td colspan='2'>
591
+ <strong><?php _e( 'Flat Rate Settings', 'wpsc' ); ?></strong>
592
+ </td>
593
+ </tr>
594
+ <tr>
595
+ <td>
596
+ <?php _e( 'Local Shipping Fee', 'wpsc' ); ?>
597
+ </td>
598
+ <td>
599
+ <input type='text' size='10' name='meta[_wpsc_product_metadata][shipping][local]' value='<?php echo number_format( (float)$product_meta['shipping']['local'], 2, '.', '' ); ?>' />
600
+ </td>
601
+ </tr>
602
 
603
+ <tr>
604
+ <td>
605
+ <?php _e( 'International Shipping Fee', 'wpsc' ); ?>
606
+ </td>
607
+ <td>
608
+ <input type='text' size='10' name='meta[_wpsc_product_metadata][shipping][international]' value='<?php echo number_format( (float)$product_meta['shipping']['international'], 2, '.', '' ); ?>' />
609
+ </td>
610
+ </tr>
611
+ <tr>
612
+ <td>
613
+ <br />
614
+ <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>
615
+ </td>
616
+ </tr>
617
+ </table>
618
+ <?php
619
  }
 
 
 
 
 
 
 
620
  function wpsc_product_advanced_forms() {
621
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
622
+ $product_data = get_post_custom( $post->ID );
623
 
624
+ $product_data['meta'] = $product_meta = array();
625
+ if ( !empty( $product_data['_wpsc_product_metadata'] ) )
626
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
627
 
628
  $custom_fields = $wpdb->get_results( "
629
  SELECT
637
  ORDER BY
638
  LOWER(meta_key)", ARRAY_A
639
  );
640
+ if( !isset( $product_meta['engraved'] ) )
641
+ $product_meta['engraved'] = '';
642
 
643
+ if( !isset( $product_meta['can_have_uploaded_image'] ) )
644
+ $product_meta['can_have_uploaded_image'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
645
 
646
+ ?>
 
 
 
 
 
647
 
648
+ <table>
649
+ <tr>
650
+ <td colspan='2' class='itemfirstcol'>
651
+ <strong><?php _e( 'Custom Meta', 'wpsc' ); ?>:</strong><br />
652
+ <a href='#' class='add_more_meta' onclick="return add_more_meta(this)"> + <?php _e( 'Add Custom Meta', 'wpsc' );?> </a><br /><br />
653
 
654
+ <?php
655
+ foreach ( (array)$custom_fields as $custom_field ) {
656
+ $i = $custom_field['meta_id'];
657
 
658
+ ?>
659
+ <div class='product_custom_meta' id='custom_meta_<?php echo $i; ?>'>
660
+ <?php _e( 'Name', 'wpsc' ); ?>
661
+ <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; ?>'>
662
+ <?php _e( 'Value', 'wpsc' ); ?>
663
+ <textarea class='text' name='custom_meta[<?php echo $i; ?>][value]' id='custom_meta_value_<?php echo $i; ?>'><?php echo $custom_field['meta_value']; ?></textarea>
664
+ <a href='#' class='remove_meta' onclick='return remove_meta(this, <?php echo $i; ?>)'><?php _e( 'Delete', 'wpsc' ); ?></a>
665
+ <br />
666
+ </div>
667
+ <?php
668
+ }
669
+ ?>
670
+ <div class='product_custom_meta'>
671
+ <?php _e( 'Name', 'wpsc' ); ?>: <br />
672
+ <input type='text' name='new_custom_meta[name][]' value='' class='text'/><br />
673
+ <?php _e( 'Description', 'wpsc' ); ?>: <br />
674
+ <textarea name='new_custom_meta[value][]' cols='40' rows='10' class='text' ></textarea>
675
+ <br />
676
+ </div>
677
+ </td>
678
+ </tr>
679
+ <tr>
680
+ <td class='itemfirstcol' colspan='2'><br /> <strong><?php _e( 'Merchant Notes:', 'wpsc' ); ?></strong><br />
681
+
682
+ <textarea cols='40' rows='3' name='meta[_wpsc_product_metadata][merchant_notes]' id='merchant_notes'><?php
683
+ if ( isset( $product_meta['merchant_notes'] ) )
684
+ echo stripslashes( trim( $product_meta['merchant_notes'] ) );
685
+ ?></textarea>
686
+ <small><?php _e( 'These notes are only available here.', 'wpsc' ); ?></small>
687
+ </td>
688
+ </tr>
689
+ <tr>
690
+ <td class='itemfirstcol' colspan='2'><br />
691
+ <strong><?php _e( 'Personalisation Options', 'wpsc' ); ?>:</strong><br />
692
+ <input type='hidden' name='meta[_wpsc_product_metadata][engraved]' value='0' />
693
+ <input type='checkbox' name='meta[_wpsc_product_metadata][engraved]' <?php echo ( ( $product_meta['engraved'] == true ) ? 'checked="checked"' : '' ); ?> id='add_engrave_text' />
694
+ <label for='add_engrave_text'><?php _e( 'Users can personalize this Product by leaving a message on single product page', 'wpsc' ); ?></label>
695
+ <br />
696
+ </td>
697
+ </tr>
698
+ <tr>
699
+ <td class='itemfirstcol' colspan='2'>
700
+ <input type='hidden' name='meta[_wpsc_product_metadata][can_have_uploaded_image]' value='0' />
701
+ <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' />
702
+ <label for='can_have_uploaded_image'> <?php _e( 'Users can upload images on single product page to purchase logs.', 'wpsc' ); ?> </label>
703
+ <br />
704
+ </td>
705
+ </tr>
706
+ <?php
707
+ if ( get_option( 'payment_gateway' ) == 'google' ) {
708
+ ?>
709
+ <tr>
710
+ <td class='itemfirstcol' colspan='2'>
711
 
712
+ <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'>
713
+ <?php _e( 'Prohibited <a href="http://checkout.google.com/support/sell/bin/answer.py?answer=75724">by Google?</a>', 'wpsc' ); ?>
714
+ </label><br />
715
+ </td>
716
+ </tr>
717
+ <?php
718
+ }
719
+ do_action( 'wpsc_add_advanced_options', $post->ID );
720
+ ?>
721
+ <tr>
722
+ <td class='itemfirstcol' colspan='2'><br />
723
+ <strong><?php _e( 'Enable Comments', 'wpsc' ); ?>:</strong><br />
724
+ <select name='meta[_wpsc_product_metadata][enable_comments]'>
725
+ <option value='' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '' ) ? 'selected' : '' ); ?> ><?php _e( 'Use Default', 'wpsc' ); ?></option>
726
+ <option value='1' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '1' ) ? 'selected' : '' ); ?> ><?php _e( 'Yes', 'wpsc' ); ?></option>
727
+ <option value='0' <?php echo ( ( isset( $product_meta['enable_comments'] ) && $product_meta['enable_comments'] == '0' ) ? 'selected' : '' ); ?> ><?php _e( 'No', 'wpsc' ); ?></option>
728
+ </select>
729
+ <br/><?php _e( 'Allow users to comment on this Product.', 'wpsc' ); ?>
730
+ </td>
731
+ </tr>
732
+ </table>
733
+ <?php
734
  }
 
 
 
 
 
 
735
  function wpsc_product_external_link_forms() {
736
 
737
+ global $post, $wpdb, $variations_processor, $wpsc_product_defaults;
738
+ $product_data = get_post_custom( $post->ID );
739
 
740
+ $product_data['meta'] = $product_meta = array();
741
+ if ( !empty( $product_data['_wpsc_product_metadata'] ) )
742
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
 
744
+ // Get External Link Values
745
+ $external_link_value = isset( $product_meta['external_link'] ) ? $product_meta['external_link'] : '';
746
+ $external_link_text_value = isset( $product_meta['external_link_text'] ) ? $product_meta['external_link_text'] : '';
747
+ $external_link_target_value = isset( $product_meta['external_link_target'] ) ? $product_meta['external_link_target'] : '';
748
+ $external_link_target_value_selected[$external_link_target_value] = ' selected="selected"';
749
+ if ( !isset( $external_link_target_value_selected['_self'] ) ) $external_link_target_value_selected['_self'] = '';
750
+ if ( !isset( $external_link_target_value_selected['_blank'] ) ) $external_link_target_value_selected['_blank'] = '';
751
 
752
+ ?>
753
+ <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' ); ?>
754
+ <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
755
+ <tbody>
756
+ <tr class="form-field">
757
+ <th valign="top" scope="row"><label for="external_link"><?php _e( 'External Link', 'wpsc' ); ?></label></th>
758
+ <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>
759
+ </tr>
760
+ <tr class="form-field">
761
+ <th valign="top" scope="row"><label for="external_link_text"><?php _e( 'External Link Text', 'wpsc' ); ?></label></th>
762
+ <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>
763
+ </tr>
764
+ <tr class="form-field">
765
+ <th valign="top" scope="row"><label for="external_link_target"><?php _e( 'External Link Target', 'wpsc' ); ?></label></th>
766
+ <td>
767
+ <select id="external_link_target" name="meta[_wpsc_product_metadata][external_link_target]">
768
+ <option value=""><?php _ex( 'Default (set by theme)', 'External product link target', 'wpsc' ); ?></option>
769
+ <option value="_self" <?php echo $external_link_target_value_selected['_self'] ; ?>><?php _e( 'Open link in the same window', 'wpsc' ); ?></option>
770
+ <option value="_blank" <?php echo $external_link_target_value_selected['_blank'] ; ?>><?php _e( 'Open link in a new window', 'wpsc' ); ?></option>
771
+ </select>
772
+ </td>
773
+ </tr>
774
+ </tbody>
775
+ </table>
776
+ <?php
777
  }
778
+ function wpsc_product_image_forms() {
779
+
780
+ global $post;
781
+
782
+ edit_multiple_image_gallery( $post );
783
 
 
784
  ?>
 
 
 
785
 
786
+ <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>
787
+ <?php
788
  }
789
+ function wpsc_additional_desc() {
790
+ global $post;
791
+ ?>
792
+ <textarea name='additional_description' id='additional_description' cols='40' rows='5' ><?php echo stripslashes( $post->post_excerpt ); ?></textarea>
793
+ <?php
794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
795
  }
 
 
796
  function wpsc_product_download_forms() {
797
  global $post, $wpdb, $wpsc_product_defaults;
798
  $product_data = get_post_custom( $post->ID );
799
  $output = '';
800
+ $product_data['meta'] = $product_meta = array();
 
801
  if ( !empty( $product_data['_wpsc_product_metadata'] ) )
802
+ $product_data['meta'] = $product_meta = maybe_unserialize( $product_data['_wpsc_product_metadata'][0] );
803
 
804
  $upload_max = wpsc_get_max_upload_size();
805
  ?>
806
  <?php echo wpsc_select_product_file( $post->ID ); ?>
807
+ <h4><?php _e( 'Upload New File', 'wpsc' ); ?>:</h4>
808
+ <input type='file' name='file' value='' /><br /><?php _e( 'Max Upload Size', 'wpsc' ); ?>:<span><?php echo $upload_max; ?></span><br /><br />
809
+ <h4><a href="admin.php?wpsc_admin_action=product_files_existing&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>
810
+ <?php
 
 
 
 
 
 
811
  if ( function_exists( "make_mp3_preview" ) || function_exists( "wpsc_media_player" ) ) {
812
  ?>
813
+ <br />
814
+ <h4><?php _e( "Select an MP3 file to upload as a preview", 'wpsc' ) ?></h4>
815
+ <input type='file' name='preview_file' value='' /><br />
816
+
817
+ <h4><?php _e( "Your preview for this product:", 'wpsc' ) ?></h4>
818
+
819
+ <?php
820
+ $args = array(
821
+ 'post_type' => 'wpsc-preview-file',
822
+ 'post_parent' => $post->ID,
823
+ 'numberposts' => -1,
824
+ 'post_status' => 'all'
825
+ );
826
 
827
+ $preview_files = (array)get_posts( $args );
828
 
829
+ foreach ($preview_files as $preview)
830
  echo $preview->post_title . '<br />';
 
831
 
832
  ?>
 
 
 
833
 
834
+ <br />
835
+ <?php
836
+ }
837
  $output = apply_filters( 'wpsc_downloads_metabox', $output );
838
  }
839
+ function wpsc_product_label_forms() {
840
+ _deprecated_function( __FUNCTION__, '3.8' );
841
+ return false;
842
+ }
843
  /**
844
+ * Adding function to change text for media buttons
 
 
845
  */
846
+ function change_context( $context ) {
847
+ global $current_screen;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
848
 
849
+ if ( $current_screen->id != 'wpsc-product' )
850
+ return $context;
851
+ return __( 'Upload Image%s', 'wpsc' );
852
  }
853
+ function change_link( $link ) {
854
+ global $post_ID, $current_screen;
855
 
856
+ if ( $current_screen->id != 'wpsc-product' )
857
+ return $link;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
858
 
859
+ $uploading_iframe_ID = $post_ID;
860
+ $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
 
861
 
862
+ return $media_upload_iframe_src . "&amp;type=image&parent_page=wpsc-edit-products";
 
 
 
 
863
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
864
  function wpsc_form_multipart_encoding() {
865
  echo ' enctype="multipart/form-data"';
866
  }
867
 
868
  add_action( 'post_edit_form_tag', 'wpsc_form_multipart_encoding' );
869
+ add_filter( 'media_buttons_context', 'change_context' );
870
+ add_filter( 'image_upload_iframe_src', "change_link" );
871
  /*
872
  * Modifications to Media Gallery
873
  */
874
 
875
+ if ( ( isset( $_REQUEST['parent_page'] ) && ( $_REQUEST['parent_page'] == 'wpsc-edit-products' ) ) ) {
876
+ add_filter( 'media_upload_tabs', 'wpsc_media_upload_tab_gallery', 12 );
877
+ add_filter( 'attachment_fields_to_save', 'wpsc_save_attachment_fields', 9, 2 );
878
+ add_filter( 'media_upload_form_url', 'wpsc_media_upload_url', 9, 1 );
879
+ add_action( 'admin_head', 'wpsc_gallery_css_mods' );
880
+ }
881
+ add_filter( 'gettext', 'wpsc_filter_delete_text', 12 , 3 );
882
  add_filter( 'attachment_fields_to_edit', 'wpsc_attachment_fields', 11, 2 );
883
+ add_filter( 'gettext', 'wpsc_filter_feature_image_text', 12, 3 );
884
  add_filter( 'gettext_with_context', 'wpsc_filter_gettex_with_context', 12, 4);
885
 
886
  /*
895
  function wpsc_filter_gettex_with_context( $translation, $text, $context, $domain ) {
896
 
897
  if ( 'Taxonomy Parent' == $context && 'Parent' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ) {
898
+ $translations = &get_translations_for_domain( $domain );
899
+ return $translations->translate( 'Variation set', 'wpsc' );
900
+ //this will never happen, this is here only for gettex to pick up the translation
901
+ return __( 'Variation set', 'wpsc' );
902
  }
903
  return $translation;
904
  }
905
 
906
+ /*
907
+ * This filter translates string before it is displayed
908
+ * specifically for the words 'Use as featured image' with 'Use as Product Thumbnail' when the user is selecting a Product Thumbnail
909
+ * using media gallery.
910
+ *
911
+ * @param $translation The current translation
912
+ * @param $text The text being translated
913
+ * @param $domain The domain for the translation
914
+ * @return string The translated / filtered text.
915
+ */
916
+ function wpsc_filter_feature_image_text( $translation, $text, $domain ) {
917
+
918
+ if ( 'Use as featured image' == $text && isset( $_REQUEST['post_id'] ) ) {
919
+ $post = get_post( $_REQUEST['post_id'] );
920
+ if ( $post->post_type != 'wpsc-product' ) return $translation;
921
+ $translations = &get_translations_for_domain( $domain );
922
+ return $translations->translate( 'Use as Product Thumbnail', 'wpsc' );
923
+ //this will never happen, this is here only for gettex to pick up the translation
924
+ return __( 'Use as Product Thumbnail', 'wpsc' );
925
+ }
926
+ if ( 'The name is how it appears on your site.' == $text && isset($_GET['taxonomy']) && 'wpsc-variation' == $_GET['taxonomy'] ){
927
+ $translations = &get_translations_for_domain( $domain );
928
+ 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>None</strong> in <strong>Variation set</strong> drop-down menu.</div>', 'wpsc' );
929
+ //this will never happen, this is here only for gettex to pick up the translation
930
+ 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' );
931
+ }
932
+
933
+ return $translation;
934
+ }
935
  function wpsc_attachment_fields( $form_fields, $post ) {
936
  $out = '';
937
+ if(isset($_GET["post_id"]))
938
+ $parent_post = get_post( absint($_GET["post_id"]) );
 
939
  else
940
  $parent_post = get_post( $post->post_parent );
941
 
942
+ if ( $parent_post->post_type == "wpsc-product" ) {
 
943
 
944
  //Unfortunate hack, as I'm not sure why the From Computer tab doesn't process filters the same way the Gallery does
945
+
946
  echo '
947
  <script type="text/javascript">
948
 
950
 
951
  jQuery("a.wp-post-thumbnail").each(function(){
952
  var product_image = jQuery(this).text();
953
+ if (product_image == "' . __('Use as featured image') . '") {
954
+ jQuery(this).text("' . __('Use as Product Thumbnail', 'wpsc') . '");
955
  }
956
  });
957
 
958
  var trash = jQuery("#media-upload a.del-link").text();
959
 
960
+ if (trash == "Delete") {
961
+ jQuery("#media-upload a.del-link").text("Trash");
962
  }
963
 
964
 
965
  });
966
 
967
  </script>';
 
 
968
  $size_names = array( 'small-product-thumbnail' => __( 'Default Product Thumbnail Size', 'wpsc' ), 'medium-single-product' => __( 'Single Product Image Size', 'wpsc' ), 'full' => __( 'Full Size', 'wpsc' ) );
969
 
970
  $check = get_post_meta( $post->ID, '_wpsc_selected_image_size', true );
976
  $settings_height = get_option( 'single_view_image_height' );
977
 
978
  // regenerate size metadata in case it's missing
979
+ if ( ! $check || $current_size['width'] != $settings_width || $current_size['height'] != $settings_height ) {
980
+ if ( ! $metadata = wp_get_attachment_metadata( $post->ID ) )
981
+ $metadata = array();
982
+ if ( empty( $metadata['sizes'] ) )
983
+ $metadata['sizes'] = array();
984
+ $file = get_attached_file( $post->ID );
985
+ $generated = wp_generate_attachment_metadata( $post->ID, $file );
986
+ $metadata['sizes'] = array_merge((array) $metadata['sizes'], (array) $generated['sizes'] );
987
+
988
+ wp_update_attachment_metadata( $post->ID, $metadata );
989
  }
990
 
991
  //This loop attaches the custom thumbnail/single image sizes to this page
996
  $css_id = "image-size-{$size}-{$post->ID}";
997
  // if this size is the default but that's not available, don't select it
998
 
999
+ $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 ) . " />";
1000
 
1001
  $html .= "<label for='{$css_id}'>$name</label>";
1002
  // only show the dimensions if that choice is available
1011
  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"] );
1012
  $form_fields['image_alt']['helps'] = __( 'Alt text for the product image, e.g. &#8220;Rockstar T-Shirt&#8221;', 'wpsc' );
1013
 
1014
+ $form_fields["image-size"] = array(
1015
  'label' => __( 'Single Product Page Thumbnail:', 'wpsc' ),
1016
  'input' => 'html',
1017
  'html' => $out,
1028
 
1029
  ";
1030
  $form_fields["wpsc_custom_thumb"] = array(
1031
+ "label" => __( "Products Page Thumbnail Size:", 'wpsc' ),
1032
  "input" => "html", // this is default if "input" is omitted
1033
  "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>",
1034
  "html" => $custom_thumb_html
1035
  );
1036
+
1037
  }
1038
  return $form_fields;
1039
 
1040
  }
1041
  function wpsc_save_attachment_fields( $post, $attachment ) {
1042
 
1043
+ if ( isset ( $attachment['wpsc_custom_thumb_w'] ) )
1044
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_w', $attachment['wpsc_custom_thumb_w'] );
 
1045
 
1046
+ if ( isset ( $attachment['wpsc_custom_thumb_h'] ) )
1047
  update_post_meta( $post['ID'], '_wpsc_custom_thumb_h', $attachment['wpsc_custom_thumb_h'] );
 
1048
 
1049
+ if ( isset ( $attachment['image-size'] ) )
1050
+ update_post_meta( $post['ID'], '_wpsc_selected_image_size', $attachment['image-size'] );
 
1051
 
1052
  return $post;
1053
  }
1054
+ function wpsc_media_upload_url( $form_action_url ) {
1055
 
1056
+ $form_action_url = esc_url( add_query_arg( array( 'parent_page'=>'wpsc-edit-products' ) ) );
 
 
 
 
 
 
 
 
 
 
 
1057
 
1058
+ return $form_action_url;
1059
 
1060
+ }
1061
+ function wpsc_gallery_css_mods() {
 
 
1062
 
1063
+ print '<style type="text/css">
1064
+ #gallery-settings *{
1065
+ display:none;
1066
+ }
1067
+ a.wp-post-thumbnail {
1068
+ color:green;
1069
+ }
1070
+ #media-upload a.del-link {
1071
+ color:red;
1072
+ }
1073
+ #media-upload a.wp-post-thumbnail {
1074
+ margin-left:0px;
1075
+ }
1076
+ td.savesend input.button {
1077
+ display:none;
1078
+ }
1079
+ </style>';
1080
+ print '
1081
+ <script type="text/javascript">
1082
+ jQuery(function(){
1083
+ jQuery("td.A1B1").each(function(){
1084
 
1085
+ var target = jQuery(this).next();
1086
+ jQuery("p > input.button", this).appendTo(target);
 
 
 
 
 
 
1087
 
1088
+ });
 
 
 
 
 
 
1089
 
1090
+ jQuery("a.wp-post-thumbnail").each(function(){
1091
+ var product_image = jQuery(this).text();
1092
+ if (product_image == "' . __('Use as featured image') . '") {
1093
+ jQuery(this).text("' . __('Use as Product Thumbnail', 'wpsc') . '");
1094
+ }
1095
+ });
1096
+ });
1097
 
1098
+ </script>';
1099
+ }
1100
+ function wpsc_media_upload_tab_gallery( $tabs ) {
 
1101
 
1102
+ unset( $tabs['gallery'] );
1103
+ $tabs['gallery'] = __( 'Product Image Gallery', 'wpsc' );
 
 
 
1104
 
1105
+ return $tabs;
1106
+ }
1107
+ function wpsc_filter_delete_text( $translation, $text, $domain ) {
 
 
 
1108
 
1109
+ if ( 'Delete' == $text && isset( $_REQUEST['post_id'] ) && isset( $_REQUEST["parent_page"] ) ) {
1110
+ $translations = &get_translations_for_domain( $domain );
1111
+ return $translations->translate( 'Trash' ) ;
1112
+ }
1113
+ return $translation;
1114
+ }
1115
+ function edit_multiple_image_gallery( $post ) {
1116
+ global $wpdb;
1117
+ //Make sure thumbnail isn't duplicated
1118
+ $siteurl = get_option( 'siteurl' );
1119
 
1120
+ if ( $post->ID > 0 ) {
1121
+ if ( has_post_thumbnail( $post->ID ) )
1122
+ echo get_the_post_thumbnail( $post->ID, 'admin-product-thumbnails' );
1123
+
1124
+ $args = array(
1125
+ 'post_type' => 'attachment',
1126
+ 'numberposts' => -1,
1127
+ 'post_status' => null,
1128
+ 'post_parent' => $post->ID,
1129
+ 'orderby' => 'menu_order',
1130
+ 'order' => 'ASC'
1131
+ );
1132
 
1133
+ $attached_images = (array)get_posts( $args );
 
 
 
 
1134
 
1135
+ if ( count( $attached_images ) > 0 ) {
1136
+ foreach ( $attached_images as $images ) {
1137
+ $attached_image = wp_get_attachment_image( $images->ID, 'admin-product-thumbnails' );
1138
+ echo $attached_image. '&nbsp;';
1139
+ }
1140
+ }
1141
 
1142
+ }
1143
+ }
 
1144
 
1145
+ /**
1146
+ * wpsc_save_quickedit_box function
1147
+ * Saves input for the various meta in the quick edit boxes
1148
+ *
1149
+ * @todo UI
1150
+ * @todo Data validation / sanitization / security
1151
+ * @todo AJAX should probably return weight unit
1152
+ * @return $post_id (int) Post ID
1153
+ */
1154
 
1155
+ function wpsc_save_quickedit_box( $post_id ) {
1156
+ global $current_screen;
1157
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || empty( $current_screen ) || $current_screen->id != 'edit-wpsc-product' || ! defined( 'DOING_AJAX' ) || ! DOING_AJAX )
1158
+ return;
1159
 
1160
+ $is_parent = ( bool )wpsc_product_has_children( $post_id );
1161
+ $product_meta = get_post_meta( $post_id, '_wpsc_product_metadata', true );
 
 
 
1162
 
1163
+ $weight_unit = $product_meta["weight_unit"];
1164
+ $weight = wpsc_convert_weight( $_POST["weight"], $weight_unit, "pound", true );
 
 
 
1165
 
1166
+ if ( isset( $product_meta["weight"] ) )
1167
+ unset( $product_meta["weight"] );
1168
 
1169
+ $product_meta["weight"] = $weight;
1170
+
1171
+ if ( !$is_parent ) {
1172
+ update_post_meta( $post_id, '_wpsc_product_metadata', $product_meta );
1173
+ if(is_numeric($_POST['stock']))
1174
+ update_post_meta( $post_id, '_wpsc_stock', $_POST['stock'] );
1175
+ else
1176
+ update_post_meta( $post_id, '_wpsc_stock', '' );
1177
+ update_post_meta( $post_id, '_wpsc_price', $_POST['price'] );
1178
+ update_post_meta( $post_id, '_wpsc_special_price', $_POST['sale_price'] );
1179
  }
1180
+ if($_POST['sku'] == __('N/A', 'wpsc'))
1181
+ update_post_meta( $post_id, '_wpsc_sku', '' );
1182
+ else
1183
+ update_post_meta( $post_id, '_wpsc_sku', $_POST['sku'] );
1184
 
1185
  return $post_id;
 
1186
  }
1187
 
1188
  /**
1202
  ?>
1203
 
1204
  <fieldset class="inline-edit-col-left wpsc-cols">
1205
+ <div class="inline-edit-col">
1206
+ <div class="inline-edit-group">
1207
+ <?php
1208
  switch ( $col_name ) :
1209
  case 'SKU' :
1210
  ?>
1211
+ <label class="alignleft">
1212
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'SKU:', 'wpsc' ); ?> </span>
1213
+ <input type="text" name="sku" class="wpsc_ie_sku" />
1214
+ </label>
1215
+ <?php
 
 
1216
  break;
1217
  case 'weight' :
1218
  ?>
1219
+ <label class="alignleft">
1220
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Weight:', 'wpsc' ); ?> </span>
1221
+ <input type="text" name="weight" class="wpsc_ie_weight" />
1222
+ </label>
1223
+ <?php
 
1224
  break;
1225
  case 'stock' :
1226
  ?>
1227
+ <label class="alignleft">
1228
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Stock:', 'wpsc' ); ?> </span>
1229
+ <input type="text" name="stock" class="wpsc_ie_stock" />
1230
+ </label>
1231
+ <?php
 
1232
  break;
1233
  case 'price' :
1234
  ?>
1235
+ <label class="alignleft">
1236
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Price:', 'wpsc' ); ?> </span>
1237
+ <input type="text" name="price" class="wpsc_ie_price" />
1238
+ </label>
1239
+ <?php
 
1240
  break;
1241
  case 'sale_price' :
1242
  ?>
1243
+ <label class="alignleft">
1244
+ <span class="checkbox-title wpsc-quick-edit"><?php _e( 'Sale Price:', 'wpsc' ); ?> </span>
1245
+ <input type="text" name="sale_price" class="wpsc_ie_sale_price" />
1246
+ </label>
1247
+ <?php
 
1248
  break;
1249
  endswitch;
1250
  ?>
1251
+ </div>
1252
+ </div>
1253
  </fieldset>
1254
  <?php
1255
  }
1256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1257
  /*
1258
+ * Remove bulk edit as it is broken,
1259
+ * ToDo : Fix Bulk Edit for Products
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1260
  */
1261
+ function wpsc_remove_bulk_edit($options){
1262
+ unset($options['edit']);
1263
+ return $options;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1264
  }
1265
+ add_action( 'quick_edit_custom_box', 'wpsc_quick_edit_boxes', 10, 2 );
1266
+ add_action( 'save_post', 'wpsc_save_quickedit_box' );
1267
+ add_action( 'bulk_actions-edit-wpsc-product', 'wpsc_remove_bulk_edit');
1268
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/product-functions.php CHANGED
@@ -7,48 +7,60 @@
7
  */
8
 
9
  function wpsc_get_max_upload_size(){
10
- return size_format( wp_max_upload_size() );
 
 
 
11
  }
12
 
 
13
  /**
14
- * wpsc_admin_submit_product function
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  * @internal Was going to completely refactor sanitise forms and wpsc_insert_product, but they are also used by the import system
16
- * which I'm not really familiar with...so I'm not touching them :) Erring on the side of redundancy and caution I'll just
17
  * refactor this to do the job.
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,148 +68,56 @@ 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
 
203
  if(isset($post_data['post_title']) && $post_data['post_title'] != '') {
@@ -227,40 +147,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 +191,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 +207,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 +223,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
  /**
@@ -315,28 +235,28 @@ function wpsc_variation_remove_metaboxes() {
315
  global $post;
316
  if ( ! $post->post_parent )
317
  return;
318
-
319
  remove_meta_box( 'wpsc_product_categorydiv', 'wpsc-product', 'side' );
320
  }
321
  add_action( 'add_meta_boxes_wpsc-product', 'wpsc_variation_remove_metaboxes', 99 );
322
 
323
  function wpsc_admin_submit_notices() {
324
  global $current_screen, $post;
325
-
326
  if( $current_screen->id != 'wpsc-product' || !isset( $_SESSION['product_error_messages'] ) )
327
  return;
328
  foreach ( $_SESSION['product_error_messages'] as $error )
329
  echo "<div id=\"message\" class=\"updated below-h2\"><p>".$error."</p></div>";
330
  unset( $_SESSION['product_error_messages'] );
331
  }
332
-
333
  /**
334
  * wpsc_add_product_category_default, if there is no category assigned assign first product category as default
335
  *
336
  * @since 3.8
337
  * @param $product_id (int) the Post ID
338
  * @return null
339
- */
340
  function wpsc_add_product_category_default( $product_id ){
341
  $terms = get_terms( 'wpsc_product_category', array( 'orderby' => 'id', 'hide_empty' => 0 ) );
342
  if ( ! empty( $terms ) ) {
@@ -345,31 +265,43 @@ function wpsc_add_product_category_default( $product_id ){
345
  }
346
  }
347
  /**
348
- * wpsc_sanitise_product_forms function
349
- *
350
  * @return array - Sanitised product details
351
  */
352
  function wpsc_sanitise_product_forms($post_data = null) {
353
  if ( empty($post_data) ) {
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'] : '';
362
  $post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
363
- $post_data['post_status'] = 'draft';
364
 
365
- if(isset($post_data['publish'])) {
366
- $post_data['post_status'] = 'publish';
 
 
 
 
 
 
 
 
367
  } else if(isset($post_data['unpublish'])) {
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,42 +311,78 @@ 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'];
392
  $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['no_shipping'];
393
-
394
  // Product Weight
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;
404
  return $post_data;
405
  }
406
-
407
  /**
408
- * wpsc_insert_product function
409
  *
410
- * @param unknown
411
  * @return unknown
412
- */
413
  function wpsc_insert_product($post_data, $wpsc_error = false) {
414
  global $wpdb, $user_ID;
415
  $adding = false;
416
  $update = false;
417
-
 
 
 
 
 
 
 
418
  $product_columns = array(
419
  'name' => '',
420
  'description' => '',
@@ -439,15 +407,21 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
439
  'thumbnail_image' => null,
440
  'thumbnail_state' => null
441
  );
442
-
443
-
444
- foreach ( $product_columns as $column => $default ) {
445
- if ( ! isset( $post_data[ $column ] ) ) {
446
- $post_data[ $column ] = '';
 
 
 
 
 
447
  }
448
  }
449
-
450
  $product_post_values = array(
 
451
  'post_author' => $user_ID,
452
  'post_content' => $post_data['description'],
453
  'post_excerpt' => $post_data['additional_description'],
@@ -456,33 +430,83 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
456
  'post_type' => "wpsc-product",
457
  'post_name' => sanitize_title($post_data['name'])
458
  );
459
- $product_post_values["comment_status"] = "open";
460
-
 
 
 
 
461
  if(isset($sku) && ($sku != '')) {
462
  $product_post_array['guid'] = $sku;
463
  }
464
 
465
 
466
-
467
- $product_id = wp_insert_post($product_post_values);
468
- if ( isset ( $post_data["sticky"] ) ) {
469
- stick_post($product_id);
470
- }else {
471
- unstick_post($product_id);
472
- }
473
-
474
- $adding = true;
475
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  // if we succeed, we can do further editing
477
-
478
  // and the meta
479
  wpsc_update_product_meta($product_id, $post_data['meta']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  do_action('wpsc_edit_product', $product_id);
 
481
  return $product_id;
482
  }
483
 
484
  /**
485
- * term_id_price function
486
  * Retreives associated price, if any, with term_id
487
  * @param integer term ID
488
  * @param integer parent product price
@@ -492,16 +516,16 @@ function wpsc_insert_product($post_data, $wpsc_error = false) {
492
  function term_id_price($term_id, $parent_price) {
493
 
494
  $term_price_arr = get_option( 'term_prices' );
495
-
496
  if ( isset($term_price_arr[$term_id]) ) {
497
- $price = $term_price_arr[$term_id]["price"];
498
  } else {
499
  $price = 0;
500
  }
501
-
502
  //Check for flat, percentile or differential
503
  $var_price_type = '';
504
-
505
  if (flat_price($price)) {
506
  $var_price_type = 'flat';
507
  $price = floatval($price);
@@ -510,15 +534,15 @@ function term_id_price($term_id, $parent_price) {
510
  } elseif (percentile_price($price)) {
511
  $var_price_type = 'percentile';
512
  }
513
-
514
  if (strchr($price, '-') ) {
515
- $positive = false;
516
  } else {
517
  $positive = true;
518
  }
519
-
520
  if ($positive) {
521
-
522
  if ( $var_price_type == 'differential' ) {
523
  $differential = (floatval($price));
524
  $price = $parent_price + $differential;
@@ -526,10 +550,10 @@ function term_id_price($term_id, $parent_price) {
526
  $percentage = (floatval($price) / 100);
527
  $price = $parent_price + ($parent_price * $percentage);
528
  }
529
-
530
  } else {
531
 
532
- if ( $var_price_type == 'differential' ) {
533
  $differential = (floatval($price));
534
  $price = $parent_price - $differential;
535
  } elseif ( $var_price_type == 'percentile' ) {
@@ -554,19 +578,19 @@ function term_id_price($term_id, $parent_price) {
554
  function wpsc_determine_variation_price( $variation_id, $term_ids = false ) {
555
  $flat = array();
556
  $diff = 0;
557
-
558
  $variation = get_post( $variation_id );
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 ) {
566
  if ( isset( $term_price_arr[$term_id] ) )
567
  $term_price = trim( $term_price_arr[$term_id]['price'] );
568
  else
569
- continue;
570
  if ( flat_price( $term_price ) ) {
571
  $flat[] = $term_price;
572
  } elseif ( differential_price( $term_price ) ) {
@@ -584,7 +608,7 @@ function wpsc_determine_variation_price( $variation_id, $term_ids = false ) {
584
 
585
  /**
586
  * wpsc_edit_product_variations function.
587
- * this is the function to make child products using variations
588
  *
589
  * @access public
590
  * @param mixed $product_id
@@ -592,53 +616,48 @@ function wpsc_determine_variation_price( $variation_id, $term_ids = false ) {
592
  * @return void
593
  */
594
  function wpsc_edit_product_variations($product_id, $post_data) {
595
- global $user_ID;
596
-
597
- $parent = get_post_field( 'post_parent', $product_id );
598
-
599
- if( ! empty( $parent ) )
600
  return;
601
-
602
  $variations = array();
603
  $product_children = array();
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);
611
-
612
  // Retrieve the array containing the variation set IDs
613
  $variation_sets = $wpsc_combinator->return_variation_sets();
614
-
615
  // Retrieve the array containing the combinations of each variation set to be associated with this product.
616
  $variation_values = $wpsc_combinator->return_variation_values();
617
-
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
-
640
  $child_product_meta = get_post_custom($product_id);
641
-
642
  // here we loop through the combinations, get the term data and generate custom product names
643
  foreach($combinations as $combination) {
644
  $term_names = array();
@@ -651,7 +670,7 @@ function wpsc_edit_product_variations($product_id, $post_data) {
651
  'include' => implode(",", $combination),
652
  'orderby' => 'parent',
653
  ));
654
-
655
  foreach($combination_terms as $term) {
656
  $term_ids[] = $term->term_id;
657
  $term_slugs[] = $term->slug;
@@ -674,9 +693,9 @@ function wpsc_edit_product_variations($product_id, $post_data) {
674
  if($child_product_id == false) {
675
  $already_a_variation = false;
676
  if($selected_post != null) {
677
- $child_product_id = $selected_post->ID;
678
  } else {
679
- $child_product_id = wp_insert_post($product_values);
680
  }
681
  } else {
682
  // sometimes there have been problems saving the variations, this gets the correct product ID
@@ -697,16 +716,16 @@ function wpsc_edit_product_variations($product_id, $post_data) {
697
  } else {
698
  update_post_meta($child_product_id, $meta_key, $meta_value[0]);
699
  }
700
-
701
  endforeach;
702
-
703
  if ( is_array( $term_ids ) && $price = wpsc_determine_variation_price( $child_product_id, $term_ids ) )
704
  update_product_meta( $child_product_id, 'price', $price );
705
  }
706
  }
 
707
 
708
-
709
- //For reasons unknown, this code did not previously deal with variation deletions.
710
  //Basically, we'll just check if any existing term associations are missing from the posted variables, delete if they are.
711
  //Get posted terms (multi-dimensional array, first level = parent var, second level = child var)
712
  $posted_term = $variations;
@@ -716,37 +735,29 @@ function wpsc_edit_product_variations($product_id, $post_data) {
716
  foreach ($currently_associated_var as $current) {
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)) {
725
  foreach($val as $term2=>$val2) {
726
- $posted_terms[] = $term2;
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
-
747
  // Whatever remains, find child products of current product with that term, in the variation taxonomy, and delete
748
  $post_ids_to_delete = wpsc_get_child_object_in_terms_var($_REQUEST["product_id"], $term_ids_to_delete, 'wpsc-variation');
749
-
750
  if(is_array($post_ids_to_delete) && !empty($post_ids_to_delete)) {
751
  foreach($post_ids_to_delete as $object_ids) {
752
  foreach($object_ids as $object_id) {
@@ -754,12 +765,11 @@ function wpsc_edit_product_variations($product_id, $post_data) {
754
  }
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){
@@ -767,24 +777,22 @@ function wpsc_edit_product_variations($product_id, $post_data) {
767
  }
768
  if(!empty($childs)){
769
  $old_ids_to_delete = array_diff($childs, $product_children);
770
- $old_ids_to_delete = apply_filters('wpsc_edit_product_variations_deletion', $old_ids_to_delete);
771
  if(is_array($old_ids_to_delete) && !empty($old_ids_to_delete)) {
772
  foreach($old_ids_to_delete as $object_ids) {
773
  wp_delete_post($object_ids);
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){
782
  global $wpdb;
783
-
784
  $old_curr = get_product_meta($product_id, 'currency',true);
785
- $sql = $wpdb->prepare( "SELECT `isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`= %d", $newCurrency );
786
  $isocode = $wpdb->get_var($sql);
787
-
788
  $newCurrency = 'currency';
789
  $old_curr[$isocode] = $newPrice;
790
  if(($newPrice != '') && ($newPrice > 0.00)){
@@ -797,7 +805,7 @@ function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
797
  }
798
 
799
  }
800
-
801
  /**
802
  * wpsc_update_product_meta function
803
  *
@@ -830,17 +838,17 @@ 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) {
844
  foreach((array)$post_data['custom_meta'] as $key => $values) {
845
  if(($values['name'] != '') && ($values['value'] != '')) {
846
  update_post_meta($product_id, $values['name'], $values['value']);
@@ -850,46 +858,50 @@ function wpsc_update_custom_meta($product_id, $post_data) {
850
  }
851
 
852
  /**
853
- * wpsc_item_process_file function
854
  *
855
  * @param integer product ID
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) {
@@ -900,20 +912,20 @@ function wpsc_modify_upload_directory($input) {
900
  $input['subdir'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['subdir']),'',-1);
901
  return $input;
902
  }
903
-
904
  function wpsc_modify_preview_directory($input) {
905
  $previous_subdir = $input['subdir'];
906
  $download_subdir = str_replace($input['basedir'], '', WPSC_PREVIEW_DIR);
907
-
908
  $input['path'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['path']),'',-1);
909
  $input['url'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['url']),'',-1);
910
  $input['subdir'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['subdir']),'',-1);
911
-
912
  return $input;
913
  }
914
-
915
  /**
916
- * wpsc_item_reassign_file function
917
  *
918
  * @param integer product ID
919
  * @param string the selected file name;
@@ -923,36 +935,37 @@ function wpsc_item_reassign_file($product_id, $selected_files) {
923
  $product_file_list = array();
924
  // initialise $idhash to null to prevent issues with undefined variables and error logs
925
  $idhash = null;
926
-
927
  $args = array(
928
  'post_type' => 'wpsc-product-file',
929
  'post_parent' => $product_id,
930
  'numberposts' => -1,
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];
939
  }
940
-
941
- /* if we are editing, grab the current file and ID hash */
942
  if(!$selected_files) {
943
  // unlikely that anyone will ever upload a file called .none., so its the value used to signify clearing the product association
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;
950
  $selected_file_path = WPSC_FILE_DIR.basename($selected_file);
951
-
952
  if(isset($attached_files_by_file[$selected_file])) {
953
  $file_is_attached = true;
954
  }
955
-
956
  if($file_is_attached == false ) {
957
  $type = wpsc_get_mimetype($selected_file_path);
958
  $attachment = array(
@@ -969,11 +982,11 @@ function wpsc_item_reassign_file($product_id, $selected_files) {
969
  'ID' => $attached_files_by_file[$selected_file]->ID,
970
  'post_status' => 'inherit'
971
  );
972
- wp_update_post($product_post_values);
973
  }
974
  }
975
-
976
-
977
  foreach($attached_files as $attached_file) {
978
  if(!in_array($attached_file->post_title, $selected_files)) {
979
  $product_post_values = array(
@@ -984,15 +997,15 @@ function wpsc_item_reassign_file($product_id, $selected_files) {
984
  }
985
  }
986
 
987
- return true;
988
  }
989
 
990
  /**
991
- * wpsc_delete_preview_file
992
  *
993
  * @param integer product ID
994
  */
995
-
996
  function wpsc_delete_preview_file($product_id) {
997
 
998
  $args = array(
@@ -1001,9 +1014,9 @@ function wpsc_delete_preview_file($product_id) {
1001
  'numberposts' => -1,
1002
  'post_status' => 'all'
1003
  );
1004
-
1005
  $preview_files = (array)get_posts( $args );
1006
-
1007
  foreach( $preview_files as $preview ) {
1008
  $preview_id = $preview->ID;
1009
  wp_delete_post($preview_id);
@@ -1012,16 +1025,16 @@ function wpsc_delete_preview_file($product_id) {
1012
  }
1013
 
1014
  /**
1015
- * wpsc_item_add_preview_file function
1016
  *
1017
  * @param integer product ID
1018
  * @param array the preview file array from $_FILES
1019
  */
1020
  function wpsc_item_add_preview_file($product_id, $preview_file) {
1021
  global $wpdb;
1022
-
1023
  wpsc_delete_preview_file($product_id);
1024
-
1025
  add_filter('upload_dir', 'wpsc_modify_preview_directory');
1026
  $overrides = array('test_form'=>false);
1027
 
@@ -1053,14 +1066,14 @@ function wpsc_item_add_preview_file($product_id, $preview_file) {
1053
  'post_title' => $title,
1054
  'post_content' => $content,
1055
  'post_type' => "wpsc-preview-file",
1056
- 'post_status' => 'inherit'
1057
  );
1058
 
1059
  // Save the data
1060
  $id = wp_insert_post($attachment, $file, $product_id);
1061
  remove_filter('upload_dir', 'wpsc_modify_preview_directory');
1062
  return $id;
1063
-
1064
 
1065
  }
1066
 
@@ -1075,8 +1088,8 @@ class wpsc_variation_combinator {
1075
  var $variation_sets = array();
1076
  var $variation_values = array();
1077
  var $reprocessed_array = array();
1078
- var $combinations= array();
1079
-
1080
  function wpsc_variation_combinator($variation_sets) {
1081
  if( $variation_sets ) {
1082
  foreach($variation_sets as $variation_set_id => $variation_set) {
@@ -1095,148 +1108,49 @@ function wpsc_variation_combinator($variation_sets) {
1095
  $this->get_combinations(array(), $this->reprocessed_array, 0);
1096
  }
1097
  }
1098
-
1099
-
1100
  function get_combinations($batch, $elements, $i) {
1101
  if ($i >= count($elements)) {
1102
  $this->combinations[] = $batch;
1103
- } else {
1104
  foreach ($elements[$i] as $element) {
1105
  $this->get_combinations(array_merge($batch, $element), $elements, $i + 1);
1106
- }
1107
- }
1108
  }
1109
-
1110
  function return_variation_sets() {
1111
  return $this->variation_sets;
1112
  }
1113
-
1114
  function return_variation_values() {
1115
  return $this->variation_values;
1116
  }
1117
-
1118
  function return_combinations() {
1119
  return $this->combinations;
1120
-
1121
  }
1122
- }
1123
 
1124
  function wpsc_variations_stock_remaining($product_id){
1125
  global $wpdb;
1126
- return $wpdb->get_var( $wpdb->prepare( '
1127
- SELECT
1128
- sum(`pm`.`meta_value`)
1129
- FROM
1130
- `' . $wpdb->postmeta . '` `pm`
1131
- JOIN
1132
- `' . $wpdb->posts . '` `p`
1133
- ON
1134
- `pm`.`post_id` = `p`.`id`
1135
- WHERE
1136
  `p`.`post_type`= "wpsc-product"
1137
  AND
1138
- `p`.`post_parent` = %d
1139
  AND
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
+ // Get PHP Max Upload Size
11
+ if( ini_get( 'upload_max_filesize' ) ) $upload_max = ini_get( 'upload_max_filesize' );
12
+ else $upload_max = __( 'N/A', 'wpsc' );
13
+ return $upload_max;
14
  }
15
 
16
+
17
  /**
18
+ * wpsc_product_has_children function
19
+ * Checks whether a product has variations or not
20
+ *
21
+ * @return boolean true if product does have variations, false otherwise
22
+ */
23
+ function wpsc_product_has_children($id){
24
+ $args = array(
25
+ 'post_parent' => $id,
26
+ 'post_type' => 'wpsc-product',
27
+ 'post_status' => 'inherit publish'
28
+ );
29
+ $children = get_children($args);
30
+ if( empty($children) )
31
+ return false;
32
+ else
33
+ return true;
34
+ }
35
+
36
+ /**
37
+ * wpsc_admin_submit_product function
38
  * @internal Was going to completely refactor sanitise forms and wpsc_insert_product, but they are also used by the import system
39
+ * which I'm not really familiar with...so I'm not touching them :) Erring on the side of redundancy and caution I'll just
40
  * refactor this to do the job.
41
  * @return nothing
42
  */
43
  function wpsc_admin_submit_product( $post_ID, $post ) {
44
+ global $current_screen, $wpdb;
45
 
46
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || empty( $current_screen ) || $current_screen->id != 'wpsc-product' || $post->post_type != 'wpsc-product' || empty( $_POST['meta'] ) )
47
+ return $post_ID;
 
48
 
49
  //Type-casting ( not so much sanitization, which would be good to do )
50
+ $post_data = $_POST;
51
  $product_id = $post_ID;
52
+ $post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
53
+ $post_meta['meta'] = (array)$_POST['meta'];
 
 
 
 
 
 
54
  if ( isset( $post_data['meta']['_wpsc_price'] ) )
55
+ $post_data['meta']['_wpsc_price'] = abs( (float) str_replace( ',', '', $post_data['meta']['_wpsc_price'] ) );
 
56
  if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
57
+ $post_data['meta']['_wpsc_special_price'] = abs((float)str_replace( ',','',$post_data['meta']['_wpsc_special_price'] ));
58
+ if($post_data['meta']['_wpsc_sku'] == __('N/A', 'wpsc'))
 
59
  $post_data['meta']['_wpsc_sku'] = '';
60
+ if( isset( $post_data['meta']['_wpsc_is_donation'] ) )
61
+ $post_data['meta']['_wpsc_is_donation'] = 1;
62
+ else
63
+ $post_data['meta']['_wpsc_is_donation'] = 0;
 
 
 
64
  if ( ! isset( $post_data['meta']['_wpsc_limited_stock'] ) ){
65
  $post_data['meta']['_wpsc_stock'] = false;
66
  } else {
68
  }
69
 
70
  unset($post_data['meta']['_wpsc_limited_stock']);
71
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = '';
72
+ if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
73
+ if(!isset($post_data['special'])) $post_data['special'] = '';
74
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['no_shipping'])) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = '';
75
+
76
+ $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
77
  $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
78
  $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
79
+ $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['no_shipping'];
80
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  // Product Weight
82
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
83
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
84
+
85
+ $weight = wpsc_convert_weight($post_data['meta']['_wpsc_product_metadata']['weight'], $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
86
+ $post_data['meta']['_wpsc_product_metadata']['weight'] = (float)$weight;
 
87
  $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
88
+
89
+ // table rate price
90
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = isset( $post_data['table_rate_price'] ) ? $post_data['table_rate_price'] : array();
91
+
92
+ // if table_rate_price is unticked, wipe the table rate prices
93
+ if ( empty( $post_data['table_rate_price']['state'] ) ) {
94
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = array();
95
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = array();
96
  }
97
+
98
+ if ( ! empty( $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] ) ) {
99
+ foreach ( (array) $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value ){
100
+ if(empty($value)){
101
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][$key]);
102
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][$key]);
103
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
+
108
+ $post_data['meta']['_wpsc_product_metadata']['shipping']['local'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['local'];
109
+ $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['international'];
110
+
111
+
112
  // Advanced Options
113
+ $post_data['meta']['_wpsc_product_metadata']['engraved'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['engraved'];
114
+ $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'];
115
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
 
 
 
 
 
 
 
 
 
 
 
116
  $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
117
+
118
+ $post_data['meta']['_wpsc_product_metadata']['enable_comments'] = $post_data['meta']['_wpsc_product_metadata']['enable_comments'];
119
+ $post_data['meta']['_wpsc_product_metadata']['merchant_notes'] = $post_data['meta']['_wpsc_product_metadata']['merchant_notes'];
120
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  $post_data['files'] = $_FILES;
122
 
123
  if(isset($post_data['post_title']) && $post_data['post_title'] != '') {
147
  'thumbnail_state' => null
148
  );
149
 
150
+ foreach($product_columns as $column => $default)
151
+ {
152
+ if (!isset($post_data[$column])) $post_data[$column] = '';
153
+
154
+ if($post_data[$column] !== null) {
155
+ $update_values[$column] = stripslashes($post_data[$column]);
156
+ } else if(($update != true) && ($default !== null)) {
157
+ $update_values[$column] = stripslashes($default);
158
  }
159
  }
 
160
  // if we succeed, we can do further editing (todo - if_wp_error)
161
+
162
  // if we have no categories selected, assign one.
163
+ 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){
164
  $post_data['tax_input']['wpsc_product_category'][1] = wpsc_add_product_category_default($product_id);
165
+
166
  }
 
167
  // and the meta
168
  wpsc_update_product_meta($product_id, $post_data['meta']);
169
 
170
  // and the custom meta
171
  wpsc_update_custom_meta($product_id, $post_data);
172
 
173
+ // sort out the variations
174
+ wpsc_edit_product_variations( $product_id, $post_data );
175
 
176
+ //and the alt currency
177
+ if ( ! empty( $post_data['newCurrency'] ) ) {
178
+ foreach( (array) $post_data['newCurrency'] as $key =>$value ){
179
+ wpsc_update_alt_product_currency( $product_id, $value, $post_data['newCurrPrice'][$key] );
 
 
 
 
 
 
180
  }
181
  }
182
 
183
+ if($post_data['files']['file']['tmp_name'] != '') {
184
  wpsc_item_process_file($product_id, $post_data['files']['file']);
185
  } else {
186
  if (!isset($post_data['select_product_file'])) $post_data['select_product_file'] = null;
191
  wpsc_item_add_preview_file($product_id, $post_data['files']['preview_file']);
192
  }
193
  do_action('wpsc_edit_product', $product_id);
194
+ wpsc_ping();
195
  }
196
  return $product_id;
197
  }
207
  $data["post_parent"] = $postarr["parent_post"];
208
 
209
  // Sanitize status for variations (see #324)
210
+ if ( $data['post_parent'] && ( ! isset( $data['ID'] ) || $data['post_parent'] != $data['ID'] ) ) {
211
  $data['post_status'] = 'inherit';
212
  }
213
 
214
+ if ( !empty( $postarr['meta'] ) && ( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] == 0 || empty( $postarr['meta']['_wpsc_product_metadata']['enable_comments'] ) ) )
215
+ $data["comment_status"] = "closed";
216
+ else
217
+ $data["comment_status"] = "open";
 
218
 
219
  //Can anyone explain to me why this is here?
220
  if ( isset( $sku ) && ( $sku != '' ) )
223
  return $data;
224
  }
225
  add_filter( 'wp_insert_post_data','wpsc_pre_update', 99, 2 );
226
+ add_action( 'save_post', 'wpsc_admin_submit_product', 10, 2 );
227
  add_action( 'admin_notices', 'wpsc_admin_submit_notices' );
228
 
229
  /**
235
  global $post;
236
  if ( ! $post->post_parent )
237
  return;
238
+
239
  remove_meta_box( 'wpsc_product_categorydiv', 'wpsc-product', 'side' );
240
  }
241
  add_action( 'add_meta_boxes_wpsc-product', 'wpsc_variation_remove_metaboxes', 99 );
242
 
243
  function wpsc_admin_submit_notices() {
244
  global $current_screen, $post;
245
+
246
  if( $current_screen->id != 'wpsc-product' || !isset( $_SESSION['product_error_messages'] ) )
247
  return;
248
  foreach ( $_SESSION['product_error_messages'] as $error )
249
  echo "<div id=\"message\" class=\"updated below-h2\"><p>".$error."</p></div>";
250
  unset( $_SESSION['product_error_messages'] );
251
  }
252
+
253
  /**
254
  * wpsc_add_product_category_default, if there is no category assigned assign first product category as default
255
  *
256
  * @since 3.8
257
  * @param $product_id (int) the Post ID
258
  * @return null
259
+ */
260
  function wpsc_add_product_category_default( $product_id ){
261
  $terms = get_terms( 'wpsc_product_category', array( 'orderby' => 'id', 'hide_empty' => 0 ) );
262
  if ( ! empty( $terms ) ) {
265
  }
266
  }
267
  /**
268
+ * wpsc_sanitise_product_forms function
269
+ *
270
  * @return array - Sanitised product details
271
  */
272
  function wpsc_sanitise_product_forms($post_data = null) {
273
  if ( empty($post_data) ) {
274
  $post_data = &$_POST;
275
  }
276
+
277
+ $product = get_post(absint($post_data['post_ID']));
278
+
279
  $post_data['name'] = isset($post_data['post_title']) ? $post_data['post_title'] : '';
280
  $post_data['title'] = $post_data['name'];
281
  $post_data['description'] = isset($post_data['content']) ? $post_data['content'] : '';
282
  $post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
 
283
 
284
+ if($product != null) {
285
+ $post_data['post_status'] = $product->post_status;
286
+ } else {
287
+ $post_data['post_status'] = 'draft';
288
+ }
289
+
290
+ if(isset($post_data['save']) && $product->post_status == 'inherit' && ( $product->post_parent == 0 || $product->post_parent == $product->ID ) ) {
291
+ $post_data['post_status'] = 'draft';
292
+ } else if(isset($post_data['publish'])) {
293
+ $post_data['post_status'] = 'publish';
294
  } else if(isset($post_data['unpublish'])) {
295
  $post_data['post_status'] = 'draft';
296
  }
297
 
298
+
299
+
300
+ $post_meta['meta'] = (array)$_POST['meta'];
301
+
302
+ $post_data['meta']['_wpsc_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_price'] );
303
+ $post_data['meta']['_wpsc_special_price'] = (float)str_replace( ',','',$post_data['meta']['_wpsc_special_price'] );
304
+ $post_data['meta']['_wpsc_sku'] = $post_data['meta']['_wpsc_sku'];
305
  if (!isset($post_data['meta']['_wpsc_is_donation'])) $post_data['meta']['_wpsc_is_donation'] = '';
306
  $post_data['meta']['_wpsc_is_donation'] = (int)(bool)$post_data['meta']['_wpsc_is_donation'];
307
  $post_data['meta']['_wpsc_stock'] = (int)$post_data['meta']['_wpsc_stock'];
311
  $post_data['meta']['_wpsc_stock'] = false;
312
  }
313
  unset($post_data['meta']['_wpsc_limited_stock']);
 
314
  if(!isset($post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'])) $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = '';
315
  if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
316
  if(!isset($post_data['special'])) $post_data['special'] = '';
317
  if(!isset($post_data['meta']['_wpsc_product_metadata']['no_shipping'])) $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = '';
318
+
 
319
  $post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['unpublish_when_none_left'];
320
  $post_data['meta']['_wpsc_product_metadata']['quantity_limited'] = (int)(bool)$post_data['quantity_limited'];
321
  $post_data['meta']['_wpsc_product_metadata']['special'] = (int)(bool)$post_data['special'];
322
  $post_data['meta']['_wpsc_product_metadata']['no_shipping'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['no_shipping'];
323
+
324
  // Product Weight
325
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
326
  if(!isset($post_data['meta']['_wpsc_product_metadata']['display_weight_as'])) $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = '';
327
+
328
+ $weight = wpsc_convert_weight($post_data['meta']['_wpsc_product_metadata']['weight'], $post_data['meta']['_wpsc_product_metadata']['weight_unit'], "pound", true);
329
+ $post_data['meta']['_wpsc_product_metadata']['weight'] = (float)$weight;
330
+ $post_data['meta']['_wpsc_product_metadata']['display_weight_as'] = $post_data['meta']['_wpsc_product_metadata']['weight_unit'];
331
+
332
+ // table rate price
333
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price'] = $post_data['table_rate_price'];
334
+ // if table_rate_price is unticked, wipe the table rate prices
335
+ if(!isset($post_data['table_rate_price']['state'])) $post_data['table_rate_price']['state'] = '';
336
+ if($post_data['table_rate_price']['state'] != 1) {
337
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'] = null;
338
+ $post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] = null;
339
+ }
340
+ foreach((array)$post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'] as $key => $value){
341
+ if(empty($value)){
342
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['table_price'][$key]);
343
+ unset($post_data['meta']['_wpsc_product_metadata']['table_rate_price']['quantity'][$key]);
344
+ }
345
+ }
346
 
347
+
348
+ $post_data['meta']['_wpsc_product_metadata']['shipping']['local'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['local'];
349
+ $post_data['meta']['_wpsc_product_metadata']['shipping']['international'] = (float)$post_data['meta']['_wpsc_product_metadata']['shipping']['international'];
350
+
351
+
352
+ // Advanced Options
353
+ $post_data['meta']['_wpsc_product_metadata']['engraved'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['engraved'];
354
+ $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'];
355
+ if(!isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
356
+ $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
357
+ $post_data['meta']['_wpsc_product_metadata']['external_link'] = (string)$post_data['meta']['_wpsc_product_metadata']['external_link'];
358
+ $post_data['meta']['_wpsc_product_metadata']['external_link_text'] = (string)$post_data['meta']['_wpsc_product_metadata']['external_link_text'];
359
+ $post_data['meta']['_wpsc_product_metadata']['external_link_target'] = (string)$post_data['meta']['_wpsc_product_metadata']['external_link_target'];
360
+
361
+ $post_data['meta']['_wpsc_product_metadata']['enable_comments'] = $post_data['meta']['_wpsc_product_metadata']['enable_comments'];
362
+ $post_data['meta']['_wpsc_product_metadata']['merchant_notes'] = $post_data['meta']['_wpsc_product_metadata']['merchant_notes'];
363
+
364
  $post_data['files'] = $_FILES;
365
  return $post_data;
366
  }
367
+
368
  /**
369
+ * wpsc_insert_product function
370
  *
371
+ * @param unknown
372
  * @return unknown
373
+ */
374
  function wpsc_insert_product($post_data, $wpsc_error = false) {
375
  global $wpdb, $user_ID;
376
  $adding = false;
377
  $update = false;
378
+ if((int)$post_data['post_ID'] > 0) {
379
+ $product_id = absint($post_data['post_ID']);
380
+ $update = true;
381
+ } else if((int)$post_data['product_id'] > 0) {
382
+ $product_id = absint($post_data['product_id']);
383
+ $update = true;
384
+ }
385
+
386
  $product_columns = array(
387
  'name' => '',
388
  'description' => '',
407
  'thumbnail_image' => null,
408
  'thumbnail_state' => null
409
  );
410
+
411
+
412
+ foreach($product_columns as $column => $default)
413
+ {
414
+ if (!isset($post_data[$column])) $post_data[$column] = '';
415
+
416
+ if($post_data[$column] !== null) {
417
+ $update_values[$column] = stripslashes($post_data[$column]);
418
+ } else if(($update != true) && ($default !== null)) {
419
+ $update_values[$column] = stripslashes($default);
420
  }
421
  }
422
+
423
  $product_post_values = array(
424
+ 'ID' => $product_id,
425
  'post_author' => $user_ID,
426
  'post_content' => $post_data['description'],
427
  'post_excerpt' => $post_data['additional_description'],
430
  'post_type' => "wpsc-product",
431
  'post_name' => sanitize_title($post_data['name'])
432
  );
433
+ if ($post_data['meta']['_wpsc_product_metadata']['enable_comments'] == 0) {
434
+ $product_post_values["comment_status"] = "closed";
435
+ }else {
436
+ $product_post_values["comment_status"] = "open";
437
+ }
438
+
439
  if(isset($sku) && ($sku != '')) {
440
  $product_post_array['guid'] = $sku;
441
  }
442
 
443
 
444
+
445
+ if($update === true) {
446
+ $where = array( 'id' => $product_id );
447
+ $product_id = wp_update_post($product_post_values);
448
+ if ( isset ( $post_data["sticky"] ) ) {
449
+ stick_post($product_id);
450
+ }else {
451
+ unstick_post($product_id);
452
+ }
453
+ if ($product_id == 0) {
454
+ if ( $wpsc_error ) {
455
+ return new WP_Error('db_update_error', __( 'Could not update product in the database', 'wpsc' ), $wpdb->last_error);
456
+ } else {
457
+ return false;
458
+ }
459
+ }
460
+ } else {
461
+ $product_post_values += array(
462
+ 'post_date' => $product['date_added']
463
+ );
464
+ $product_id = wp_insert_post($product_post_values);
465
+ if ( isset ( $post_data["sticky"] ) ) {
466
+ stick_post($product_id);
467
+ }else {
468
+ unstick_post($product_id);
469
+ }
470
+ if ($product_id == 0 ) {
471
+ if ( $wp_error ) {
472
+ return new WP_Error('db_insert_error', __( 'Could not insert product into the database', 'wpsc' ), $wpdb->last_error);
473
+ } else {
474
+ return 0;
475
+ }
476
+ }
477
+ $adding = true;
478
+ }
479
+
480
  // if we succeed, we can do further editing
481
+
482
  // and the meta
483
  wpsc_update_product_meta($product_id, $post_data['meta']);
484
+
485
+ // and the custom meta
486
+ wpsc_update_custom_meta($product_id, $post_data);
487
+
488
+ //and the alt currency
489
+ foreach((array)$post_data['newCurrency'] as $key =>$value){
490
+ wpsc_update_alt_product_currency($product_id, $value, $post_data['newCurrPrice'][$key]);
491
+ }
492
+
493
+ if($post_data['files']['file']['tmp_name'] != '') {
494
+ wpsc_item_process_file($product_id, $post_data['files']['file']);
495
+ } else {
496
+ if (!isset($post_data['select_product_file'])) $post_data['select_product_file'] = null;
497
+ wpsc_item_reassign_file($product_id, $post_data['select_product_file']);
498
+ }
499
+
500
+ if(isset($post_data['files']['preview_file']['tmp_name']) && ($post_data['files']['preview_file']['tmp_name'] != '')) {
501
+ wpsc_item_add_preview_file($product_id, $post_data['files']['preview_file']);
502
+ }
503
  do_action('wpsc_edit_product', $product_id);
504
+ wpsc_ping();
505
  return $product_id;
506
  }
507
 
508
  /**
509
+ * term_id_price function
510
  * Retreives associated price, if any, with term_id
511
  * @param integer term ID
512
  * @param integer parent product price
516
  function term_id_price($term_id, $parent_price) {
517
 
518
  $term_price_arr = get_option( 'term_prices' );
519
+
520
  if ( isset($term_price_arr[$term_id]) ) {
521
+ $price = $term_price_arr[$term_id]["price"];
522
  } else {
523
  $price = 0;
524
  }
525
+
526
  //Check for flat, percentile or differential
527
  $var_price_type = '';
528
+
529
  if (flat_price($price)) {
530
  $var_price_type = 'flat';
531
  $price = floatval($price);
534
  } elseif (percentile_price($price)) {
535
  $var_price_type = 'percentile';
536
  }
537
+
538
  if (strchr($price, '-') ) {
539
+ $negative = true;
540
  } else {
541
  $positive = true;
542
  }
543
+
544
  if ($positive) {
545
+
546
  if ( $var_price_type == 'differential' ) {
547
  $differential = (floatval($price));
548
  $price = $parent_price + $differential;
550
  $percentage = (floatval($price) / 100);
551
  $price = $parent_price + ($parent_price * $percentage);
552
  }
553
+
554
  } else {
555
 
556
+ if ( $var_price_type == 'differential' ) {
557
  $differential = (floatval($price));
558
  $price = $parent_price - $differential;
559
  } elseif ( $var_price_type == 'percentile' ) {
578
  function wpsc_determine_variation_price( $variation_id, $term_ids = false ) {
579
  $flat = array();
580
  $diff = 0;
581
+
582
  $variation = get_post( $variation_id );
583
  $price = (float) get_product_meta( $variation->post_parent, 'price', true );
584
+
585
  if ( ! $term_ids )
586
+ $term_ids = wp_get_object_terms( $variation_id, 'wpsc-variation', array( 'fields' => 'ids' ) );
587
 
588
  $term_price_arr = get_option( 'term_prices' );
589
  foreach ( $term_ids as $term_id ) {
590
  if ( isset( $term_price_arr[$term_id] ) )
591
  $term_price = trim( $term_price_arr[$term_id]['price'] );
592
  else
593
+ continue;
594
  if ( flat_price( $term_price ) ) {
595
  $flat[] = $term_price;
596
  } elseif ( differential_price( $term_price ) ) {
608
 
609
  /**
610
  * wpsc_edit_product_variations function.
611
+ * this is the function to make child products using variations
612
  *
613
  * @access public
614
  * @param mixed $product_id
616
  * @return void
617
  */
618
  function wpsc_edit_product_variations($product_id, $post_data) {
619
+ global $wpdb, $user_ID;
620
+ $parent = $wpdb->get_var('SELECT post_parent FROM ' . $wpdb->posts . ' WHERE ID = '.$product_id);
621
+ if(!empty($parent))
 
 
622
  return;
 
623
  $variations = array();
624
  $product_children = array();
625
  if (!isset($post_data['edit_var_val']))
626
  $post_data['edit_var_val'] = '';
627
+
628
+ $variations = (array)$post_data['edit_var_val'];
629
 
630
  // Generate the arrays for variation sets, values and combinations
631
  $wpsc_combinator = new wpsc_variation_combinator($variations);
632
+
633
  // Retrieve the array containing the variation set IDs
634
  $variation_sets = $wpsc_combinator->return_variation_sets();
635
+
636
  // Retrieve the array containing the combinations of each variation set to be associated with this product.
637
  $variation_values = $wpsc_combinator->return_variation_values();
638
+
639
  // Retrieve the array containing the combinations of each variation set to be associated with this product.
640
  $combinations = $wpsc_combinator->return_combinations();
641
+
642
+ $product_terms = wp_get_object_terms($product_id, 'wpsc-variation');
643
+
644
  $variation_sets_and_values = array_merge($variation_sets, $variation_values);
645
+ $variation_sets_and_values = apply_filters('wpsc_edit_product_variation_sets_and_values', $variation_sets_and_values, $product_id);
646
+ wp_set_object_terms($product_id, $variation_sets_and_values, 'wpsc-variation');
647
+
 
 
 
648
  $child_product_template = array(
649
  'post_author' => $user_ID,
650
+ 'post_content' => $post_data['description'],
651
+ 'post_excerpt' => $post_data['additional_description'],
652
+ 'post_title' => $post_data['name'],
653
  'post_status' => 'inherit',
654
  'post_type' => "wpsc-product",
655
+ 'post_name' => sanitize_title($post_data['name']),
656
  'post_parent' => $product_id
657
  );
658
+
659
  $child_product_meta = get_post_custom($product_id);
660
+
661
  // here we loop through the combinations, get the term data and generate custom product names
662
  foreach($combinations as $combination) {
663
  $term_names = array();
670
  'include' => implode(",", $combination),
671
  'orderby' => 'parent',
672
  ));
673
+
674
  foreach($combination_terms as $term) {
675
  $term_ids[] = $term->term_id;
676
  $term_slugs[] = $term->slug;
693
  if($child_product_id == false) {
694
  $already_a_variation = false;
695
  if($selected_post != null) {
696
+ $child_product_id = $selected_post->ID;
697
  } else {
698
+ $child_product_id = wp_update_post($product_values);
699
  }
700
  } else {
701
  // sometimes there have been problems saving the variations, this gets the correct product ID
716
  } else {
717
  update_post_meta($child_product_id, $meta_key, $meta_value[0]);
718
  }
719
+
720
  endforeach;
721
+
722
  if ( is_array( $term_ids ) && $price = wpsc_determine_variation_price( $child_product_id, $term_ids ) )
723
  update_product_meta( $child_product_id, 'price', $price );
724
  }
725
  }
726
+
727
 
728
+ //For reasons unknown, this code did not previously deal with variation deletions.
 
729
  //Basically, we'll just check if any existing term associations are missing from the posted variables, delete if they are.
730
  //Get posted terms (multi-dimensional array, first level = parent var, second level = child var)
731
  $posted_term = $variations;
735
  foreach ($currently_associated_var as $current) {
736
  $currently_associated_vars[] = $current->term_id;
737
  }
738
+
 
 
739
  foreach ($posted_term as $term=>$val) {
740
  $posted_terms[] = $term;
741
  if(is_array($val)) {
742
  foreach($val as $term2=>$val2) {
743
+ $posted_terms[] = $term2;
744
  }
745
  }
746
  }
747
+ if(!empty($currently_associated_vars)){
748
+ $term_ids_to_delete = array();
 
749
  $term_ids_to_delete = array_diff($currently_associated_vars, $posted_terms);
750
  }
751
+ if(isset($_REQUEST["post_ID"]))
 
752
  $post_id = $_REQUEST["post_ID"];
753
+ elseif(isset($_REQUEST["product_id"]))
754
  $post_id = $_REQUEST["product_id"];
 
 
 
 
755
  if(!empty($term_ids_to_delete) && (isset($_REQUEST["product_id"]) || isset($post_id))) {
756
  $post_ids_to_delete = array();
757
+
758
  // Whatever remains, find child products of current product with that term, in the variation taxonomy, and delete
759
  $post_ids_to_delete = wpsc_get_child_object_in_terms_var($_REQUEST["product_id"], $term_ids_to_delete, 'wpsc-variation');
760
+
761
  if(is_array($post_ids_to_delete) && !empty($post_ids_to_delete)) {
762
  foreach($post_ids_to_delete as $object_ids) {
763
  foreach($object_ids as $object_id) {
765
  }
766
  }
767
  }
768
+ }
769
+ $current_children = query_posts(array(
770
  'post_parent' => $post_id,
771
+ 'post_type' => "wpsc-product",
772
+ 'post_status' => 'all'
 
773
  ));
774
 
775
  foreach((array)$current_children as $child_prod){
777
  }
778
  if(!empty($childs)){
779
  $old_ids_to_delete = array_diff($childs, $product_children);
780
+ $old_ids_to_delete = apply_filters('wpsc_edit_product_variations_deletion', $old_ids_to_delete);
781
  if(is_array($old_ids_to_delete) && !empty($old_ids_to_delete)) {
782
  foreach($old_ids_to_delete as $object_ids) {
783
  wp_delete_post($object_ids);
784
  }
785
  }
786
  }
 
 
787
  }
788
 
789
  function wpsc_update_alt_product_currency($product_id, $newCurrency, $newPrice){
790
  global $wpdb;
791
+ // exit($newCurrency.' '.$newPrice);
792
  $old_curr = get_product_meta($product_id, 'currency',true);
793
+ $sql = "SELECT `isocode` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`=".$newCurrency;
794
  $isocode = $wpdb->get_var($sql);
795
+
796
  $newCurrency = 'currency';
797
  $old_curr[$isocode] = $newPrice;
798
  if(($newPrice != '') && ($newPrice > 0.00)){
805
  }
806
 
807
  }
808
+
809
  /**
810
  * wpsc_update_product_meta function
811
  *
838
 
839
  function wpsc_update_custom_meta($product_id, $post_data) {
840
 
841
+ if($post_data['new_custom_meta'] != null) {
842
  foreach((array)$post_data['new_custom_meta']['name'] as $key => $name) {
843
  $value = $post_data['new_custom_meta']['value'][(int)$key];
844
  if(($name != '') && ($value != '')) {
845
  add_post_meta($product_id, $name, $value);
846
  }
847
  }
848
+ }
849
+
850
  if (!isset($post_data['custom_meta'])) $post_data['custom_meta'] = '';
851
+ if($post_data['custom_meta'] != null) {
852
  foreach((array)$post_data['custom_meta'] as $key => $values) {
853
  if(($values['name'] != '') && ($values['value'] != '')) {
854
  update_post_meta($product_id, $values['name'], $values['value']);
858
  }
859
 
860
  /**
861
+ * wpsc_item_process_file function
862
  *
863
  * @param integer product ID
864
+ * @param array the file array from $_FILES
865
  * @param array the preview file array from $_FILES
866
  */
867
+ function wpsc_item_process_file($product_id, $submitted_file, $preview_file = null) {
868
+ global $wpdb;
869
+ add_filter('upload_dir', 'wpsc_modify_upload_directory');
870
+ $overrides = array('test_form'=>false);
 
871
 
872
+ $time = current_time('mysql');
873
+ if ( $post = get_post($product_id) ) {
874
  if ( substr( $post->post_date, 0, 4 ) > 0 )
875
  $time = $post->post_date;
876
  }
877
 
878
+ $file = wp_handle_upload($submitted_file, $overrides, $time);
879
+ if ( isset($file['error']) )
 
880
  return new WP_Error( 'upload_error', $file['error'] );
 
881
 
882
+ $name_parts = pathinfo($file['file']);
883
+ $name = $name_parts['basename'];
884
+
885
+ $url = $file['url'];
886
+ $type = $file['type'];
887
+ $file = $file['file'];
888
+ $title = $name;
889
+ $content = '';
890
 
891
  // Construct the attachment array
892
  $attachment = array(
893
+ 'post_mime_type' => $type,
894
+ 'guid' => $url,
895
+ 'post_parent' => $product_id,
896
+ 'post_title' => $title,
897
+ 'post_content' => $content,
898
+ 'post_type' => "wpsc-product-file",
899
+ 'post_status' => 'inherit'
900
  );
901
 
902
  // Save the data
903
+ $id = wp_insert_post($attachment, $file, $product_id);
904
+ remove_filter('upload_dir', 'wpsc_modify_upload_directory');
 
905
  }
906
 
907
  function wpsc_modify_upload_directory($input) {
912
  $input['subdir'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['subdir']),'',-1);
913
  return $input;
914
  }
915
+
916
  function wpsc_modify_preview_directory($input) {
917
  $previous_subdir = $input['subdir'];
918
  $download_subdir = str_replace($input['basedir'], '', WPSC_PREVIEW_DIR);
919
+
920
  $input['path'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['path']),'',-1);
921
  $input['url'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['url']),'',-1);
922
  $input['subdir'] = substr_replace(str_replace($previous_subdir, $download_subdir, $input['subdir']),'',-1);
923
+
924
  return $input;
925
  }
926
+
927
  /**
928
+ * wpsc_item_reassign_file function
929
  *
930
  * @param integer product ID
931
  * @param string the selected file name;
935
  $product_file_list = array();
936
  // initialise $idhash to null to prevent issues with undefined variables and error logs
937
  $idhash = null;
938
+
939
  $args = array(
940
  'post_type' => 'wpsc-product-file',
941
  'post_parent' => $product_id,
942
  'numberposts' => -1,
943
  'post_status' => 'any'
944
  );
945
+
946
+ $attached_files = (array)get_posts($args);
947
+
 
948
  foreach($attached_files as $key => $attached_file) {
949
  $attached_files_by_file[$attached_file->post_title] = $attached_files[$key];
950
  }
951
+
952
+ /* if we are editing, grab the current file and ID hash */
953
  if(!$selected_files) {
954
  // unlikely that anyone will ever upload a file called .none., so its the value used to signify clearing the product association
955
  return null;
956
  }
957
+
958
+
959
 
960
  foreach($selected_files as $selected_file) {
961
  // if we already use this file, there is no point doing anything more.
962
+ $file_is_attached = false;
963
  $selected_file_path = WPSC_FILE_DIR.basename($selected_file);
964
+
965
  if(isset($attached_files_by_file[$selected_file])) {
966
  $file_is_attached = true;
967
  }
968
+
969
  if($file_is_attached == false ) {
970
  $type = wpsc_get_mimetype($selected_file_path);
971
  $attachment = array(
982
  'ID' => $attached_files_by_file[$selected_file]->ID,
983
  'post_status' => 'inherit'
984
  );
985
+ wp_update_post($product_post_values);
986
  }
987
  }
988
+
989
+
990
  foreach($attached_files as $attached_file) {
991
  if(!in_array($attached_file->post_title, $selected_files)) {
992
  $product_post_values = array(
997
  }
998
  }
999
 
1000
+ return $fileid;
1001
  }
1002
 
1003
  /**
1004
+ * wpsc_delete_preview_file
1005
  *
1006
  * @param integer product ID
1007
  */
1008
+
1009
  function wpsc_delete_preview_file($product_id) {
1010
 
1011
  $args = array(
1014
  'numberposts' => -1,
1015
  'post_status' => 'all'
1016
  );
1017
+
1018
  $preview_files = (array)get_posts( $args );
1019
+
1020
  foreach( $preview_files as $preview ) {
1021
  $preview_id = $preview->ID;
1022
  wp_delete_post($preview_id);
1025
  }
1026
 
1027
  /**
1028
+ * wpsc_item_add_preview_file function
1029
  *
1030
  * @param integer product ID
1031
  * @param array the preview file array from $_FILES
1032
  */
1033
  function wpsc_item_add_preview_file($product_id, $preview_file) {
1034
  global $wpdb;
1035
+
1036
  wpsc_delete_preview_file($product_id);
1037
+
1038
  add_filter('upload_dir', 'wpsc_modify_preview_directory');
1039
  $overrides = array('test_form'=>false);
1040
 
1066
  'post_title' => $title,
1067
  'post_content' => $content,
1068
  'post_type' => "wpsc-preview-file",
1069
+ 'post_status' => 'inherit'
1070
  );
1071
 
1072
  // Save the data
1073
  $id = wp_insert_post($attachment, $file, $product_id);
1074
  remove_filter('upload_dir', 'wpsc_modify_preview_directory');
1075
  return $id;
1076
+
1077
 
1078
  }
1079
 
1088
  var $variation_sets = array();
1089
  var $variation_values = array();
1090
  var $reprocessed_array = array();
1091
+ var $combinations= array();
1092
+
1093
  function wpsc_variation_combinator($variation_sets) {
1094
  if( $variation_sets ) {
1095
  foreach($variation_sets as $variation_set_id => $variation_set) {
1108
  $this->get_combinations(array(), $this->reprocessed_array, 0);
1109
  }
1110
  }
1111
+
1112
+
1113
  function get_combinations($batch, $elements, $i) {
1114
  if ($i >= count($elements)) {
1115
  $this->combinations[] = $batch;
1116
+ } else {
1117
  foreach ($elements[$i] as $element) {
1118
  $this->get_combinations(array_merge($batch, $element), $elements, $i + 1);
1119
+ }
1120
+ }
1121
  }
1122
+
1123
  function return_variation_sets() {
1124
  return $this->variation_sets;
1125
  }
1126
+
1127
  function return_variation_values() {
1128
  return $this->variation_values;
1129
  }
1130
+
1131
  function return_combinations() {
1132
  return $this->combinations;
1133
+
1134
  }
1135
+ }
1136
 
1137
  function wpsc_variations_stock_remaining($product_id){
1138
  global $wpdb;
1139
+ return $wpdb->get_var('
1140
+ SELECT
1141
+ sum(`pm`.`meta_value`)
1142
+ FROM
1143
+ `' . $wpdb->postmeta . '` `pm`
1144
+ JOIN
1145
+ `' . $wpdb->posts . '` `p`
1146
+ ON
1147
+ `pm`.`post_id` = `p`.`id`
1148
+ WHERE
1149
  `p`.`post_type`= "wpsc-product"
1150
  AND
1151
+ `p`.`post_parent` = ' . $product_id . '
1152
  AND
1153
  `pm`.`meta_key` = "_wpsc_stock"
1154
+ ');
1155
  }
1156
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, $wpsc_products;
18
+ add_filter('the_title','esc_html');
19
+ $args = array_merge( $wp_query->query, array( 'posts_per_page' => '-1' ) );
20
+ $wpsc_temp_query = query_posts( $args );
21
+ if ( empty($wpsc_products) )
22
+ $wpsc_products = &$wpsc_temp_query;
23
+
24
+ foreach ( (array)$wpsc_products as $product ) {
25
+ wpsc_product_row($product, $parent_product);
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Adds the -trash status in the product row of manage products page
31
+ * @access public
32
+ *
33
+ * @since 3.8
34
+ * @param $post_status (array) of current posts statuses
35
+ * @return $post_status (array)
36
+ */
37
+ function wpsc_trashed_post_status($post_status){
38
+ $post = get_post(get_the_ID());
39
+ if( !empty($post) && 'wpsc-product' == $post->post_type && 'trash' == $post->post_status && !in_array('trash', $post_status))
40
+ $post_status[] = 'Trash';
41
+
42
+ return $post_status;
43
+ }
44
+ add_filter('display_post_states','wpsc_trashed_post_status');
45
+
46
+ /**
47
+ * Spits out the current products details in a table row for manage products page and variations on edit product page.
48
+ * @access public
49
+ *
50
+ * @since 3.8
51
+ * @param $product (Object), $parent_product (Int) Note: I believe parent_product is unused
52
+ */
53
+ function wpsc_product_row(&$product, $parent_product = null) {
54
+ global $mode, $current_user;
55
+
56
+ //is this good practice? <v.bakaitis@gmail.com>
57
+ static $rowclass;
58
+
59
+ $global_product = $product;
60
+ setup_postdata($product);
61
+ $product_post_type_object = get_post_type_object('wpsc-product');
62
+ $current_user_can_edit_this_product = current_user_can( $product_post_type_object->cap->edit_post, $product->ID );
63
+
64
+ $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
65
+ $post_owner = ( $current_user->ID == $product->post_author ? 'self' : 'other' );
66
+ $edit_link = get_edit_post_link( $product->ID );
67
+
68
+ $title = get_the_title( $product->ID );
69
+
70
+ if ( empty( $title ) )
71
+ $title = __('(no title)', 'wpsc');
72
+
73
+ ?>
74
+
75
+ <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">
76
+ <?php
77
+ $posts_columns = get_column_headers( 'wpsc-product_variants' );
78
+ $hidden_columns = get_hidden_columns( 'wpsc-product_variants' );
79
+
80
+ if(empty($posts_columns))
81
+ $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' => '');
82
+
83
+ foreach ( $posts_columns as $column_name=>$column_display_name ) {
84
+ $attributes = "class=\"$column_name column-$column_name\"";
85
+
86
+ if ( in_array( $column_name, $hidden_columns ) )
87
+ $attributes .= ' style="display:none;"';
88
+
89
+ switch ($column_name) {
90
+
91
+ case 'date': /* !date case */
92
+ if ( '0000-00-00 00:00:00' == $product->post_date && 'date' == $column_name ) {
93
+ $t_time = $h_time = __('Unpublished', 'wpsc');
94
+ $time_diff = 0;
95
+ } else {
96
+ $t_time = get_the_time(__('Y/m/d g:i:s A', 'wpsc'));
97
+ $m_time = $product->post_date;
98
+ $time = get_post_time('G', true, $post);
99
+
100
+ $time_diff = time() - $time;
101
+
102
+ if ( $time_diff > 0 && $time_diff < 24*60*60 )
103
+ $h_time = sprintf( __('%s ago', 'wpsc'), human_time_diff( $time ) );
104
+ else
105
+ $h_time = mysql2date(__('Y/m/d', 'wpsc'), $m_time);
106
+ }
107
+
108
+ echo '<td ' . $attributes . '>';
109
+ if ( 'excerpt' == $mode )
110
+ echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
111
+ else
112
+ echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
113
+ echo '<br />';
114
+ if ( 'publish' == $product->post_status ) {
115
+ _e('Published', 'wpsc');
116
+ } elseif ( 'future' == $product->post_status ) {
117
+ if ( $time_diff > 0 )
118
+ echo '<strong class="attention">' . __('Missed schedule', 'wpsc') . '</strong>';
119
+ else
120
+ _e('Scheduled', 'wpsc');
121
+ } else {
122
+ _e('Last Modified', 'wpsc');
123
+ }
124
+ echo '</td>';
125
+ break;
126
+
127
+ case 'title': /* !title case */
128
+ $attributes = 'class="post-title column-title"';
129
+
130
+ $edit_link = wp_nonce_url( $edit_link, 'edit-product_'.$product->ID );
131
+ ?>
132
+ <td <?php echo $attributes ?>>
133
+ <strong>
134
+ <?php if ( $current_user_can_edit_this_product && $product->post_status != 'trash' ) { ?>
135
+ <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>
136
+ <?php if($parent_product): ?>
137
+ <input type="hidden" class="wpsc_ie_id wpsc_ie_field" value="<?php echo $product->ID ?>">
138
+ <input type="text" class="wpsc_ie_title wpsc_ie_field" value="<?php echo $title ?>">
139
+ <div class="wpsc_inline_actions"><input type="button" class="button-primary wpsc_ie_save" value="Save"><img src="<?php bloginfo('url') ?>/wp-admin/images/wpspin_light.gif" class="loading_indicator"><br/><input type="button" class="button-secondary cancel wpsc_ie_cancel" value="<?php _e('Cancel', 'wpsc'); ?>"></div>
140
+ <?php endif; ?>
141
+ <?php } else {
142
+ echo $title;
143
+ };
144
+
145
+ _post_states($product);
146
+ $product_alert = apply_filters('wpsc_product_alert', array(false, ''), $product);
147
+ if(!empty($product_alert['messages']))
148
+ $product_alert['messages'] = implode("\n",(array)$product_alert['messages']);
149
+
150
+ if($product_alert['state'] === true) {
151
+ ?>
152
+ <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='' />
153
+ <?php
154
+ }
155
+
156
+ // If a product alert has stuff to display, show it.
157
+ // Can be used to add extra icons etc
158
+ if ( !empty( $product_alert['display'] ) ) {
159
+ echo $product_alert['display'];
160
+ }
161
+
162
+ ?>
163
+ </strong>
164
+ <?php
165
+ $has_var = '';
166
+ if(! $parent_product && wpsc_product_has_children($product->ID))
167
+ $has_var = 'wpsc_has_variation';
168
+ $actions = array();
169
+ if ( $current_user_can_edit_this_product && 'trash' != $product->post_status ) {
170
+ $actions['edit'] = '<a class="edit-product" href="'.$edit_link.'" title="' . esc_attr(__('Edit this product', 'wpsc')) . '">'. __('Edit', 'wpsc') . '</a>';
171
+ $actions['quick_edit'] = "<a class='wpsc_editinline ".$has_var."' title='".esc_attr(__('Quick Edit', 'wpsc'))."' href='#'>".__('Quick Edit', 'wpsc')."</a>";
172
+ }
173
+
174
+ $actions = apply_filters('post_row_actions', $actions, $product);
175
+ $action_count = count($actions);
176
+ $i = 0;
177
+ echo '<div class="row-actions">';
178
+
179
+ foreach ( $actions as $action => $link ) {
180
+ ++$i;
181
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
182
+ echo "<span class='$action'>$link$sep</span>";
183
+ }
184
+
185
+ echo '</div>';
186
+ ?>
187
+ </td>
188
+ <?php
189
+ break;
190
+
191
+
192
+
193
+ case 'image': /* !image case */
194
+ ?>
195
+ <td class="product-image ">
196
+ <?php
197
+ $attachment_args = array(
198
+ 'post_type' => 'attachment',
199
+ 'numberposts' => 1,
200
+ 'post_status' => null,
201
+ 'post_parent' => $product->ID,
202
+ 'orderby' => 'menu_order',
203
+ 'order' => 'ASC'
204
+ );
205
+
206
+
207
+
208
+
209
+ if(isset($product->ID) && has_post_thumbnail($product->ID)){
210
+ echo get_the_post_thumbnail($product->ID, 'admin-product-thumbnails');
211
+ } else {
212
+ $image_url = WPSC_CORE_IMAGES_URL . "/no-image-uploaded.gif";
213
+ ?>
214
+ <img title='Drag to a new position' src='<?php echo $image_url; ?>' alt='<?php echo $title; ?>' width='38' height='38' />
215
+ <?php
216
+
217
+
218
+ }
219
+
220
+ ?>
221
+ </td>
222
+ <?php
223
+ break;
224
+
225
+
226
+
227
+ case 'price': /* !price case */
228
+
229
+ $price = get_product_meta($product->ID, 'price', true);
230
+ ?>
231
+ <td <?php echo $attributes ?>>
232
+ <?php echo wpsc_currency_display( $price ); ?>
233
+ <input type="text" class="wpsc_ie_field wpsc_ie_price" value="<?php echo $price; ?>">
234
+ </td>
235
+ <?php
236
+ break;
237
+
238
+ case 'weight' :
239
+
240
+ $product_data['meta'] = array();
241
+ $product_data['meta'] = get_post_meta($product->ID, '');
242
+ foreach($product_data['meta'] as $meta_name => $meta_value) {
243
+ $product_data['meta'][$meta_name] = maybe_unserialize(array_pop($meta_value));
244
+ }
245
+ $product_data['transformed'] = array();
246
+ if(!isset($product_data['meta']['_wpsc_product_metadata']['weight'])) $product_data['meta']['_wpsc_product_metadata']['weight'] = "";
247
+ if(!isset($product_data['meta']['_wpsc_product_metadata']['weight_unit'])) $product_data['meta']['_wpsc_product_metadata']['weight_unit'] = "";
248
+
249
+ $product_data['transformed']['weight'] = wpsc_convert_weight($product_data['meta']['_wpsc_product_metadata']['weight'], "pound", $product_data['meta']['_wpsc_product_metadata']['weight_unit'], false);
250
+ $weight = $product_data['transformed']['weight'];
251
+ if($weight == ''){
252
+ $weight = '0';
253
+ }
254
+ ?>
255
+ <td <?php echo $attributes ?>>
256
+ <span><?php echo $weight; ?></span>
257
+ <input type="text" class="wpsc_ie_field wpsc_ie_weight" value="<?php echo $weight; ?>">
258
+ </td>
259
+ <?php
260
+
261
+ break;
262
+
263
+ case 'stock' :
264
+ $stock = get_post_meta($product->ID, '_wpsc_stock', true);
265
+ ?>
266
+ <td <?php echo $attributes ?>>
267
+ <span><?php echo $stock ? $stock : __('N/A', 'wpsc') ; ?></span>
268
+ <input type="text" class="wpsc_ie_field wpsc_ie_stock" value="<?php echo $stock; ?>">
269
+ </td>
270
+ <?php
271
+ break;
272
+
273
+ case 'categories': /* !categories case */
274
+ ?>
275
+ <td <?php echo $attributes ?>><?php
276
+ $categories = get_the_product_category($product->ID);
277
+ if ( !empty( $categories ) ) {
278
+ $out = array();
279
+ foreach ( $categories as $c )
280
+ $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>";
281
+ echo join( ', ', $out );
282
+ } else {
283
+ _e('Uncategorized', 'wpsc');
284
+ }
285
+ ?></td>
286
+ <?php
287
+ break;
288
+
289
+
290
+
291
+ case 'tags': /* !tags case */
292
+ ?>
293
+ <td <?php echo $attributes ?>><?php
294
+ $tags = get_the_tags($product->ID);
295
+ if ( !empty( $tags ) ) {
296
+ $out = array();
297
+ foreach ( $tags as $c )
298
+ $out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
299
+ echo join( ', ', $out );
300
+ } else {
301
+ _e('No Tags', 'wpsc');
302
+ }
303
+ ?></td>
304
+ <?php
305
+ break;
306
+ case 'SKU':
307
+ $sku = get_post_meta($product->ID, '_wpsc_sku', true);
308
+ ?>
309
+ <td <?php echo $attributes ?>>
310
+ <span><?php echo $sku ? $sku : __('N/A', 'wpsc'); ?></span>
311
+ <input type="text" class="wpsc_ie_field wpsc_ie_sku" value="<?php echo $sku; ?>">
312
+ </td>
313
+ <?php
314
+ break;
315
+ case 'sale_price':
316
+
317
+ $price = get_post_meta($product->ID, '_wpsc_special_price', true);
318
+ ?>
319
+ <td <?php echo $attributes ?>>
320
+ <span><?php echo wpsc_currency_display( $price ); ?></span>
321
+ <input type="text" class="wpsc_ie_field wpsc_ie_special_price" value="<?php echo $price; ?>">
322
+ </td>
323
+ <?php
324
+
325
+ break;
326
+
327
+
328
+ case 'comments': /* !comments case */
329
+ ?>
330
+ <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
331
+ <?php
332
+ $pending_phrase = sprintf( __('%s pending', 'wpsc'), number_format( $pending_comments ) );
333
+ if ( $pending_comments )
334
+ echo '<strong>';
335
+ 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>');
336
+ if ( $pending_comments )
337
+ echo '</strong>';
338
+ ?>
339
+ </div></td>
340
+ <?php
341
+ break;
342
+
343
+
344
+
345
+ case 'author': /* !author case */
346
+ ?>
347
+ <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
348
+ <?php
349
+ break;
350
+
351
+
352
+ case 'control_view': /* !control view case */
353
+ ?>
354
+ <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View', 'wpsc'); ?></a></td>
355
+ <?php
356
+ break;
357
+
358
+
359
+
360
+ case 'control_edit': /* !control edit case */
361
+ ?>
362
+ <td><?php if ( $current_user_can_edit_this_product ) { echo "<a href='$edit_link' class='edit'>" . __('Edit', 'wpsc') . "</a>"; } ?></td>
363
+ <?php
364
+ break;
365
+
366
+
367
+
368
+ case 'control_delete': /* !control delete case */
369
+ ?>
370
+ <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>
371
+ <?php
372
+ break;
373
+
374
+ case 'featured': /* !control featured case */
375
+ ?>
376
+ <td><?php do_action('manage_posts_featured_column', $product->ID); ?></td>
377
+ <?php
378
+ break;
379
+ default: /* !default case */
380
+ ?>
381
+ <td <?php echo $attributes ?>><?php do_action('manage_posts_custom_column', $column_name, $product->ID); ?></td>
382
+ <?php
383
+ break;
384
+ }
385
+ }
386
+ ?>
387
+ </tr>
388
+ <?php
389
+ $product = $global_product;
390
+ }
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 DELETED
@@ -1,573 +0,0 @@
1
- <?php
2
- /* The WP_List_Table class isn't automatically available to plugins, so we need
3
- * to check if it's available and load it if necessary.
4
- */
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() {
33
- $this->sortable = false;
34
- }
35
-
36
- public function disable_search_box() {
37
- $this->search_box = false;
38
- }
39
-
40
- public function disable_bulk_actions() {
41
- $this->bulk_actions = false;
42
- }
43
-
44
- public function disable_month_filter() {
45
- $this->month_filter = false;
46
- }
47
-
48
- public function disable_views() {
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
- }
63
-
64
- public function prepare_items() {
65
- global $wpdb;
66
-
67
- $page = $this->get_pagenum();
68
- $offset = ( $page - 1 ) * $this->per_page;
69
-
70
- $checkout_fields_sql = "
71
- SELECT id, unique_name FROM " . WPSC_TABLE_CHECKOUT_FORMS . " WHERE unique_name IN ('billingfirstname', 'billinglastname', 'billingemail') AND active='1' AND checkout_set='0'
72
- ";
73
- $checkout_fields = $wpdb->get_results( $checkout_fields_sql );
74
-
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++;
117
- }
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
-
128
- if ( $search_sql ) {
129
- $where[] = $search_sql;
130
- }
131
-
132
- // filter by status
133
- if ( ! empty( $_REQUEST['status'] ) && $_REQUEST['status'] != 'all' ) {
134
- $this->status = absint( $_REQUEST['status'] );
135
- $where[] = 'processed = ' . $this->status;
136
- }
137
-
138
- $this->where_no_filter = implode( ' AND ', $where );
139
-
140
- // filter by month
141
- if ( ! empty( $_REQUEST['m'] ) ) {
142
- $year = (int) substr( $_REQUEST['m'], 0, 4);
143
- $month = (int) substr( $_REQUEST['m'], -2 );
144
- $where[] = "YEAR(FROM_UNIXTIME(date)) = " . esc_sql( $year );
145
- $where[] = "MONTH(FROM_UNIXTIME(date)) = " . esc_sql( $month );
146
- }
147
-
148
- $selects = apply_filters( 'wpsc_manage_purchase_logs_selects', implode( ', ', $selects ) );
149
- $this->joins = apply_filters( 'wpsc_manage_purchase_logs_joins' , implode( ' ', $joins ) );
150
- $this->where = apply_filters( 'wpsc_manage_purchase_logs_where' , implode( ' AND ', $where ) );
151
-
152
- $limit = ( $this->per_page !== 0 ) ? "LIMIT {$offset}, {$this->per_page}" : '';
153
-
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
-
174
- $this->set_pagination_args( array(
175
- 'total_items' => $total_items,
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() {
197
- return $this->per_page !== 0;
198
- }
199
-
200
- public function is_sortable() {
201
- return $this->sortable;
202
- }
203
-
204
- public function is_views_enabled() {
205
- return $this->views;
206
- }
207
-
208
- public function is_search_box_enabled() {
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" />',
222
- 'id' => __( 'Order ID', 'wpsc' ),
223
- 'customer' => __( 'Customer', 'wpsc' ),
224
- 'amount' => __( 'Amount', 'wpsc' ),
225
- 'status' => _x( 'Status', 'sales log list table column', 'wpsc' ),
226
- 'date' => __( 'Date', 'wpsc' ),
227
- 'tracking' => _x( 'Tracking ID', 'purchase log', 'wpsc' ),
228
- ) ;
229
- }
230
-
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();
241
-
242
- return array(
243
- 'date' => 'id',
244
- 'status' => 'processed',
245
- 'amount' => 'totalprice',
246
- ) ;
247
- }
248
-
249
- private function get_months() {
250
- global $wpdb;
251
-
252
- // "date" column is not indexed. Might be better to use transient just in case
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
-
267
- $months = $wpdb->get_results( $sql );
268
- set_transient( $transient_key, $months, 60 * 24 * 7 );
269
- return $months;
270
- }
271
-
272
- public function get_views() {
273
- global $wpdb;
274
-
275
- $view_labels = array(
276
- 1 => _nx_noop( 'Incomplete <span class="count">(%s)</span>', 'Incomplete <span class="count">(%s)</span>', 'purchase logs' ),
277
- 2 => _nx_noop( 'Received <span class="count">(%s)</span>' , 'Received <span class="count">(%s)</span>' , 'purchase logs' ),
278
- 3 => _nx_noop( 'Accepted <span class="count">(%s)</span>' , 'Accepted <span class="count">(%s)</span>' , 'purchase logs' ),
279
- 4 => _nx_noop( 'Dispatched <span class="count">(%s)</span>', 'Dispatched <span class="count">(%s)</span>', 'purchase logs' ),
280
- 5 => _nx_noop( 'Closed <span class="count">(%s)</span>' , 'Closed <span class="count">(%s)</span>' , 'purchase logs' ),
281
- 6 => _nx_noop( 'Declined <span class="count">(%s)</span>' , 'Declined <span class="count">(%s)</span>' , 'purchase logs' ),
282
- );
283
-
284
- $sql = "SELECT DISTINCT processed, COUNT(*) AS count FROM " . WPSC_TABLE_PURCHASE_LOGS . " GROUP BY processed ORDER BY processed";
285
- $results = $wpdb->get_results( $sql );
286
- $statuses = array();
287
- $total_count = 0;
288
-
289
- if ( ! empty( $results ) ) {
290
- foreach ( $results as $status ) {
291
- $statuses[$status->processed] = $status->count;
292
- }
293
-
294
- $total_count = array_sum( $statuses );
295
- }
296
-
297
- $all_text = sprintf(
298
- _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_count, 'purchase logs', 'wpsc' ),
299
- number_format_i18n( $total_count )
300
- );
301
-
302
- $all_href = remove_query_arg( array(
303
- 'status',
304
- 'paged',
305
- 'action',
306
- 'action2',
307
- 'm',
308
- 'deleted',
309
- 'updated',
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>',
317
- esc_url( $all_href ),
318
- $all_class,
319
- $all_text
320
- ),
321
- );
322
-
323
- foreach ( $statuses as $status => $count ) {
324
- if ( ! isset( $view_labels[$status] ) )
325
- continue;
326
- $text = sprintf(
327
- translate_nooped_plural( $view_labels[$status], $count, 'wpsc' ),
328
- number_format_i18n( $count )
329
- );
330
- $href = add_query_arg( 'status', $status );
331
- $href = remove_query_arg( array(
332
- 'deleted',
333
- 'updated',
334
- 'action',
335
- 'action2',
336
- 'm',
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 ),
344
- $class,
345
- $text
346
- );
347
- }
348
-
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
- }
363
-
364
- $months = $this->get_months();
365
- if ( ! empty( $months ) ) {
366
- ?>
367
- <select name="m">
368
- <option <?php selected( 0, $m ); ?> value="0"><?php _e( 'Show all dates' ); ?></option>
369
- <?php
370
- foreach ( $months as $arc_row ) {
371
- $month = zeroise( $arc_row->month, 2 );
372
- $year = $arc_row->year;
373
-
374
- printf( "<option %s value='%s'>%s</option>\n",
375
- selected( $arc_row->year . $month, $m, false ),
376
- esc_attr( $arc_row->year . $month ),
377
- $wp_locale->get_month( $month ) . ' ' . $year
378
- );
379
- }
380
- ?>
381
- </select>
382
- <?php
383
- submit_button( _x( 'Filter', 'extra navigation in purchase log page', 'wpsc' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
384
- }
385
- }
386
-
387
- public function extra_tablenav( $which ) {
388
- if ( 'top' == $which ) {
389
- echo '<div class="alignleft actions">';
390
- $this->months_dropdown();
391
- do_action( 'wpsc_sales_log_extra_tablenav' );
392
- echo '</div>';
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(
414
- '<input type="checkbox" ' . $checked . ' name="%1$s[]" value="%2$s" />',
415
- /*$1%s*/ 'post',
416
- /*$2%s*/ $item->id
417
- );
418
- }
419
-
420
- private function item_url( $item ) {
421
- $location = remove_query_arg( array(
422
- 'paged',
423
- 'order',
424
- 'orderby',
425
- 's',
426
- 'updated',
427
- 'deleted',
428
- ) );
429
- $location = add_query_arg( array(
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
-
466
- private function delete_url( $item ) {
467
- $nonce = wp_create_nonce( 'bulk-' . $this->_args['plural'] );
468
- $location = add_query_arg( array(
469
- '_wpnonce' => $nonce,
470
- '_wp_http_referer' => urlencode( $_SERVER['REQUEST_URI'] ),
471
- 'action' => 'delete',
472
- urlencode( 'post[]' ) => $item->id,
473
- ) );
474
- $location = remove_query_arg( array(
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
- }
490
-
491
- public function column_date( $item ) {
492
- $format = __( 'Y/m/d g:i:s A' );
493
- $timestamp = (int) $item->date;
494
- $full_time = date( $format, $timestamp );
495
- $time_diff = time() - $timestamp;
496
- if ( $time_diff > 0 && $time_diff < 24 * 60 * 60 )
497
- $h_time = $h_time = sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
498
- else
499
- $h_time = date( __( get_option( 'date_format', 'Y/m/d' ) ), $timestamp );
500
-
501
- echo '<abbr title="' . $full_time . '">' . $h_time . '</abbr>';
502
- }
503
-
504
- public function column_amount( $item ) {
505
- echo '<a href="' . esc_attr( $this->item_url( $item ) ) . '" title="' . esc_attr__( 'View order details', 'wpsc' ) . '">';
506
- echo wpsc_currency_display( $item->amount ) . "<br />";
507
- echo '<small>' . sprintf( _n( '1 item', '%s items', $item->item_count, 'wpsc' ), number_format_i18n( $item->item_count ) ) . '</small>';
508
- echo '</a>';
509
- }
510
-
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 = '';
523
- if ( $status['order'] == $item->status ) {
524
- $current_status = esc_html( $status['label'] );
525
- $selected = 'selected="selected"';
526
- }
527
- $dropdown_options .= '<option value="' . esc_attr( $status['order'] ) . '" ' . $selected . '>' . esc_html( $status['label'] ) . '</option>';
528
- }
529
-
530
- echo '<span>' . $current_status . '</span>';
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 ) {
538
- $classes = array( 'wpsc-purchase-log-tracking-id' );
539
- $empty = empty( $item->track_id );
540
- ?>
541
- <div data-log-id="<?php echo esc_attr( $item->id ); ?>" <?php echo $empty ? ' class="empty"' : ''; ?>>
542
- <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wpsc' ); ?></a>
543
- <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
544
- <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wpsc' ); ?></a>
545
- <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
546
- <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wpsc' ); ?></a></small>
547
- </div>
548
- <?php
549
- }
550
-
551
- public function get_bulk_actions() {
552
- if ( ! $this->bulk_actions )
553
- return array();
554
-
555
- $actions = array(
556
- 'delete' => _x( 'Delete', 'bulk action', 'wpsc' ),
557
- '1' => __( 'Incomplete Sale', 'wpsc' ),
558
- '2' => __( 'Order Received', 'wpsc' ),
559
- '3' => __( 'Accepted Payment', 'wpsc' ),
560
- '4' => __( 'Job Dispatched', 'wpsc' ),
561
- '5' => __( 'Closed Order', 'wpsc' ),
562
- '6' => __( 'Payment Declined', 'wpsc' ),
563
- );
564
- return $actions;
565
- }
566
-
567
- public function search_box( $text, $input_id ) {
568
- if ( ! $this->search_box )
569
- return '';
570
-
571
- parent::search_box( $text, $input_id );
572
- }
573
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/purchase-logs-page/bulk-delete-confirm.php DELETED
@@ -1,9 +0,0 @@
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>
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/purchase-logs-page/item-details.php DELETED
@@ -1,165 +0,0 @@
1
- <div class="wrap">
2
- <div id="icon-users" class="icon32"><br/></div>
3
- <h2>
4
- <?php esc_html_e( 'Sales Log Details', 'wpsc' ); ?>
5
- <span class="subtitle">#<?php echo $this->log_id; ?> – <?php echo wpsc_purchaselog_details_date_time(); ?></span>
6
- <?php $this->purchase_logs_pagination() ?>
7
- </h2>
8
- <?php if ( $receipt_sent ): ?>
9
- <div class="updated">
10
- <p><?php esc_html_e( 'Receipt has been resent successfully.', 'wpsc' ); ?></p>
11
- </div>
12
- <?php elseif ( $receipt_not_sent ) : ?>
13
- <div class="error">
14
- <p><?php esc_html_e( 'Receipt could not be sent to buyer. Please contact your hosting service and make sure your server can send emails.', 'wpsc' ); ?></p>
15
- </div>
16
- <?php endif; ?>
17
-
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'>
88
- <h3><?php esc_html_e( 'Items Ordered', 'wpsc' ); ?></h3>
89
- <table class="widefat" cellspacing="0">
90
- <thead>
91
- <tr>
92
- <?php print_column_headers( 'wpsc_purchase_log_item_details' ); ?>
93
- </tr>
94
- </thead>
95
-
96
- <tbody>
97
- <?php $this->purchase_log_cart_items(); ?>
98
-
99
- <tr class="wpsc_purchaselog_start_totals">
100
- <td colspan="<?php echo $cols; ?>">
101
- <?php if ( wpsc_purchlog_has_discount_data() ): ?>
102
- <?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
103
- <?php endif; ?>
104
- </td>
105
- <th class='right-col'><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
106
- <td><?php echo wpsc_display_purchlog_discount(); ?></td>
107
- </tr>
108
-
109
- <?php if( ! wpec_display_product_tax() ): ?>
110
- <tr>
111
- <td colspan='<?php echo $cols; ?>'></td>
112
- <th class='right-col'><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
113
- <td><?php echo wpsc_display_purchlog_taxes(); ?></td>
114
- </tr>
115
- <?php endif; ?>
116
-
117
- <tr>
118
- <td colspan='<?php echo $cols; ?>'></td>
119
- <th class='right-col'><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
120
- <td><?php echo wpsc_display_purchlog_shipping(); ?></td>
121
- </tr>
122
- <tr>
123
- <td colspan='<?php echo $cols; ?>'></td>
124
- <th class='right-col'><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
125
- <td><?php echo wpsc_display_purchlog_totalprice(); ?></td>
126
- </tr>
127
- </tbody>
128
- </table>
129
-
130
- <?php $this->purchase_log_custom_fields(); ?>
131
-
132
- <div class="metabox-holder">
133
- <div id="purchlogs_notes" class="postbox">
134
- <h3 class='hndle'><?php _e( 'Order Notes' , 'wpsc' ); ?></h3>
135
- <div class='inside'>
136
- <form method="post" action="">
137
- <input type='hidden' name='wpsc_admin_action' value='purchlogs_update_notes' />
138
- <input type="hidden" name="wpsc_purchlogs_update_notes_nonce" id="wpsc_purchlogs_update_notes_nonce" value="<?php echo wp_create_nonce( 'wpsc_purchlogs_update_notes' ); ?>" />
139
- <input type='hidden' name='purchlog_id' value='<?php echo $this->log_id; ?>' />
140
- <p><textarea name="purchlog_notes" rows="3" wrap="virtual" id="purchlog_notes" style="width:100%;"><?php echo esc_textarea( wpsc_display_purchlog_notes() ); ?></textarea></p>
141
- <div><input class="button" type="submit" name="button" id="button" value="<?php _e( 'Update Notes', 'wpsc' ); ?>" /></div>
142
- </form>
143
- </div>
144
- </div>
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/purchase-logs-page/list-table.php DELETED
@@ -1,83 +0,0 @@
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'] ) ): ?>
12
- <div id="message" class="updated">
13
- <p>
14
- <?php
15
- if ( ! empty( $_REQUEST['updated'] ) )
16
- printf( _n( '%s item updated.', '%s items updated.', $_REQUEST['updated'] ), number_format_i18n( $_REQUEST['updated'] ) );
17
- ?>
18
- <?php
19
- if ( ! empty( $_REQUEST['deleted'] ) )
20
- printf( _n( '%s item deleted.', '%s items deleted.', $_REQUEST['deleted'] ), number_format_i18n( $_REQUEST['deleted'] ) );
21
- ?>
22
- </p>
23
- </div>
24
- <?php endif ?>
25
-
26
- <?php if( get_option( 'wpsc_purchaselogs_fixed' ) == false || ( wpsc_check_uniquenames() ) ): ?>
27
- <div class='error' style='padding:8px;line-spacing:8px;'><span ><?php printf( __( 'When upgrading the WP eCommerce Plugin from 3.6.* to 3.7, it is required that you associate your checkout form fields with the new Purchase Logs system. To do so please <a href="%s">click here</a>', 'wpsc' ), 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 ?>
40
- </form>
41
-
42
-
43
- <?php
44
- if ( $this->list_table->is_views_enabled() )
45
- $this->list_table->views();
46
- ?>
47
- <br class="clear" />
48
-
49
- <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
50
- <form id="purchase-logs-filter" method="get" action="">
51
- <?php do_action( 'wpsc_purchase_logs_list_table_before' ); ?>
52
- <!-- For plugins, we also need to ensure that the form posts back to our current page -->
53
- <!-- Now we can render the completed list table -->
54
-
55
- <?php $this->list_table->display() ?>
56
- <input type="hidden" name="page" value="wpsc-purchase-logs" />
57
-
58
- <?php if ( ! $this->list_table->is_pagination_enabled() && $this->list_table->get_pagenum() ):?>
59
- <input type="hidden" name="last_paged" value="<?php echo esc_attr( $this->list_table->get_pagenum() ); ?>" />
60
- <?php endif ?>
61
-
62
- <?php if ( ! $this->list_table->is_sortable() && isset( $_REQUEST['orderby'] ) && isset( $_REQUEST['order'] ) ): ?>
63
- <input type="hidden" name="orderby" value="<?php echo esc_attr( $_REQUEST['orderby'] ); ?>" />
64
- <input type="hidden" name="order" value="<?php echo esc_attr( $_REQUEST['order'] ); ?>" />
65
- <?php endif; ?>
66
-
67
- <?php if ( isset( $_REQUEST['s'] ) ): ?>
68
- <input type="hidden" name="s" value="<?php echo esc_attr( $_REQUEST['s'] ); ?>" />
69
- <?php endif; ?>
70
-
71
- <?php if ( ! empty( $_REQUEST['status'] ) ): ?>
72
- <input type="hidden" name="status" value="<?php echo esc_attr( $_REQUEST['status'] ); ?>" />
73
- <?php endif ?>
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/purchase-logs-page/packing-slip.php DELETED
@@ -1,162 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wpsc' ), $this->log_id ); ?></title>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <style type="text/css">
7
- body {
8
- font-family:"Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
9
- }
10
-
11
- h1 span {
12
- font-size:0.75em;
13
- }
14
-
15
- h2 {
16
- color: #333;
17
- }
18
-
19
- #wrapper {
20
- margin:0 auto;
21
- width:95%;
22
- }
23
-
24
- #header {
25
- }
26
-
27
- #customer {
28
- overflow:hidden;
29
- }
30
-
31
- #customer .shipping, #customer .billing {
32
- float: left;
33
- width: 50%;
34
- }
35
-
36
- table {
37
- border:1px solid #000;
38
- border-collapse:collapse;
39
- margin-top:1em;
40
- width:100%;
41
- }
42
-
43
- th {
44
- background-color:#efefef;
45
- text-align:center;
46
- }
47
-
48
- th, td {
49
- padding:5px;
50
- }
51
-
52
- td {
53
- text-align:center;
54
- }
55
-
56
- #cart-items td.amount {
57
- text-align:right;
58
- }
59
-
60
- td, tbody th {
61
- border-top:1px solid #ccc;
62
- }
63
- th.column-total {
64
- width:90px;
65
- }
66
- th.column-shipping {
67
- width:120px;
68
- }
69
- th.column-price {
70
- width:100px;
71
- }
72
- </style>
73
- </head>
74
- <body onload="window.print()">
75
- <div id="wrapper">
76
- <div id="header">
77
- <h1>
78
- <?php bloginfo( 'name' ); ?><br />
79
- <span><?php printf( esc_html__( 'Packing Slip for Order #%s', 'wpsc' ), $this->log_id ); ?></span>
80
- </h1>
81
- </div>
82
- <div id="customer">
83
- <div class="shipping">
84
- <h2><?php echo esc_html_x( 'Ship To:', 'packing slip', 'wpsc' ); ?></h2>
85
- <strong><?php echo wpsc_display_purchlog_shipping_name(); ?></strong><br />
86
- <?php echo wpsc_display_purchlog_shipping_address(); ?><br />
87
- <?php echo wpsc_display_purchlog_shipping_city(); ?><br />
88
- <?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?><br />
89
- <?php echo wpsc_display_purchlog_shipping_country(); ?><br />
90
- </div>
91
- <div class="billing">
92
- <h2><?php echo esc_html_x( 'Bill To:', 'packing slip', 'wpsc' ); ?></h2>
93
- <strong><?php echo wpsc_display_purchlog_buyers_name(); ?></strong><br />
94
- <?php echo wpsc_display_purchlog_buyers_address(); ?><br />
95
- <?php echo wpsc_display_purchlog_buyers_city(); ?><br />
96
- <?php echo wpsc_display_purchlog_buyers_state_and_postcode(); ?><br />
97
- <?php echo wpsc_display_purchlog_buyers_country(); ?><br />
98
- </div>
99
- </div>
100
- <table id="order">
101
- <thead>
102
- <tr>
103
- <th><?php echo esc_html_x( 'Order Date', 'packing slip', 'wpsc' ); ?></th>
104
- <th><?php echo esc_html_x( 'Order ID', 'packing slip', 'wpsc' ); ?></th>
105
- <th><?php echo esc_html_x( 'Shipping Method', 'packing slip', 'wpsc' ); ?></th>
106
- <th><?php echo esc_html_x( 'Payment Method', 'packing slip', 'wpsc' ); ?></th>
107
- <?php wpsc_purchaselog_order_summary_headers(); ?>
108
- </tr>
109
- </thead>
110
- <tbody>
111
- <tr>
112
- <td><?php echo wpsc_purchaselog_details_date(); ?></td>
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>
120
- <table id="cart-items" class="widefat" cellspacing="0">
121
- <thead>
122
- <tr>
123
- <?php print_column_headers( 'wpsc_purchase_log_item_details' ); ?>
124
- </tr>
125
- </thead>
126
-
127
- <tbody>
128
- <?php $this->purchase_log_cart_items(); ?>
129
-
130
- <tr class="wpsc_purchaselog_start_totals">
131
- <td colspan="<?php echo $cols; ?>">
132
- <?php if ( wpsc_purchlog_has_discount_data() ): ?>
133
- <?php esc_html_e( 'Coupon Code', 'wpsc' ); ?>: <?php echo wpsc_display_purchlog_discount_data(); ?>
134
- <?php endif; ?>
135
- </td>
136
- <th><?php esc_html_e( 'Discount', 'wpsc' ); ?> </th>
137
- <td class="amount"><?php echo wpsc_display_purchlog_discount(); ?></td>
138
- </tr>
139
-
140
- <?php if( ! wpec_display_product_tax() ): ?>
141
- <tr>
142
- <td colspan='<?php echo $cols; ?>'></td>
143
- <th><?php esc_html_e( 'Taxes', 'wpsc' ); ?> </th>
144
- <td class="amount"><?php echo wpsc_display_purchlog_taxes(); ?></td>
145
- </tr>
146
- <?php endif; ?>
147
-
148
- <tr>
149
- <td colspan='<?php echo $cols; ?>'></td>
150
- <th><?php esc_html_e( 'Shipping', 'wpsc' ); ?> </th>
151
- <td class="amount"><?php echo wpsc_display_purchlog_shipping(); ?></td>
152
- </tr>
153
- <tr>
154
- <td colspan='<?php echo $cols; ?>'></td>
155
- <th><?php esc_html_e( 'Total', 'wpsc' ); ?> </th>
156
- <td class="amount"><?php echo wpsc_display_purchlog_totalprice(); ?></td>
157
- </tr>
158
- </tbody>
159
- </table>
160
- </div>
161
- </body>
162
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/purchase-logs-page/upgrade.php DELETED
@@ -1,45 +0,0 @@
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'>
14
-
15
- <?php
16
-
17
- $duplicate = array();
18
- foreach($formfields as $fields){
19
- if(!in_array($fields->name,$duplicate) && $fields->name != 'State'){
20
- echo '<div class="postbox" style="width:70%">';
21
- echo '<h3 class="handle">Billing '.$fields->name.'</h3>';
22
- echo '<div class="inside" style="padding:20px;">';
23
- echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
24
- echo $this->purchase_logs_fix_options( $fields->id );
25
- echo '</div>';
26
- echo '</div>';
27
- $duplicate[] = $fields->name;
28
- }else{
29
- echo '<div class="postbox" style="width:70%">';
30
- echo '<h3 class="handle">Shipping '.$fields->name.'</h3>';
31
- echo '<div class="inside" style="padding:20px;">';
32
- echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
33
- echo $this->purchase_logs_fix_options( $fields->id );
34
- echo '</div>';
35
- echo '</div>';
36
-
37
- }
38
-
39
- }
40
- ?>
41
- <input type='submit' value='<?php _e( 'Apply', 'wpsc' ); ?>' class='button-secondary action' />
42
- </form>
43
- </div>
44
- <?php endif; ?>
45
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-admin/includes/purchlogs_upgrade.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $wpdb;
3
+ $numChanged = 0;
4
+ $numQueries = 0;
5
+ $purchlog = "SELECT DISTINCT id FROM `".WPSC_TABLE_PURCHASE_LOGS."` LIMIT 1";
6
+ $id = $wpdb->get_var($purchlog);
7
+ $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`" ;
8
+ $formfields = $wpdb->get_results($usersql);
9
+
10
+
11
+
12
+ if(count($formfields) < 1){
13
+ $usersql = "SELECT DISTINCT `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` != 'heading'";
14
+ $formfields = $wpdb->get_results($usersql);
15
+
16
+ }
17
+ if(isset($_POST)){
18
+ foreach($_POST as $key=>$value){
19
+ if($value != '-1'){
20
+ $sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='".$value."' WHERE id=".$key;
21
+ $complete = $wpdb->query($sql);
22
+ }
23
+ $numChaged++;
24
+ $numQueries ++;
25
+ }
26
+
27
+ $sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'";
28
+ $wpdb->query($sql);
29
+
30
+ add_option('wpsc_purchaselogs_fixed',true);
31
+ }
32
+ function wpsc_select_options_purchlogs_fix($id){
33
+ ?>
34
+ <select name='<?php echo $id; ?>'>
35
+ <option value='-1'><?php _e( 'Select an Option', 'wpsc' ); ?>'</option>
36
+ <option value='billingfirstname'><?php _e( 'Billing First Name', 'wpsc' ); ?></option>
37
+ <option value='billinglastname'><?php _e( 'Billing Last Name', 'wpsc' ); ?></option>
38
+ <option value='billingaddress'><?php _e( 'Billing Address', 'wpsc' ); ?></option>
39
+ <option value='billingcity'><?php _e( 'Billing City', 'wpsc' ); ?></option>
40
+ <option value='billingstate'><?php _e( 'Billing State', 'wpsc' ); ?></option>
41
+ <option value='billingcountry'><?php _e( 'Billing Country', 'wpsc' ); ?></option>
42
+ <option value='billingemail'><?php _e( 'Billing Email', 'wpsc' ); ?></option>
43
+ <option value='billingphone'><?php _e( 'Billing Phone', 'wpsc' ); ?></option>
44
+ <option value='billingpostcode'><?php _e( 'Billing Post Code', 'wpsc' ); ?></option>
45
+ <option value='shippingfirstname'><?php _e( 'Shipping First Name', 'wpsc' ); ?></option>
46
+ <option value='shippinglastname'><?php _e( 'Shipping Last Name', 'wpsc' ); ?></option>
47
+ <option value='shippingaddress'><?php _e( 'Shipping Address', 'wpsc' ); ?></option>
48
+ <option value='shippingcity'><?php _e( 'Shipping City', 'wpsc' ); ?></option>
49
+ <option value='shippingstate'><?php _e( 'Shipping State', 'wpsc' ); ?></option>
50
+ <option value='shippingcountry'><?php _e( 'Shipping Country', 'wpsc' ); ?></option>
51
+ <option value='shippingpostcode'><?php _e( 'Shipping Post Code', 'wpsc' ); ?></option>
52
+
53
+ </select>
54
+ <?php
55
+ }
56
+ ?>
57
+
58
+ <div class='wrap'>
59
+
60
+ <?php if ( $numChanged != 0 && $numQueries != 0 ) {
61
+ echo '<div id="message" class="updated fade"><p>';
62
+ _e( 'Check Out Form Fields updated.', 'wpsc' );
63
+ echo '</p></div>';
64
+ }
65
+
66
+ ?>
67
+
68
+ <h2><?php echo esc_html( __('Sales Upgrade Fix', 'wpsc') ); ?> </h2>
69
+ <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>
70
+
71
+ <div class="metabox-holder" style="width:700px">
72
+ <form action='' method='post'>
73
+
74
+ <?php
75
+
76
+ $duplicate = array();
77
+ foreach($formfields as $fields){
78
+ if(!in_array($fields->name,$duplicate) && $fields->name != 'State'){
79
+ echo '<div class="postbox" style="width:70%">';
80
+ echo '<h3 class="handle">Billing '.$fields->name.'</h3>';
81
+ echo '<div class="inside" style="padding:20px;">';
82
+ echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
83
+ echo wpsc_select_options_purchlogs_fix($fields->id);
84
+ echo '</div>';
85
+ echo '</div>';
86
+ $duplicate[] = $fields->name;
87
+ }else{
88
+ echo '<div class="postbox" style="width:70%">';
89
+ echo '<h3 class="handle">Shipping '.$fields->name.'</h3>';
90
+ echo '<div class="inside" style="padding:20px;">';
91
+ echo '<label style="width:120px;float:left;" for="'.$fields->id.'">'.$fields->value.'</label>';
92
+ echo wpsc_select_options_purchlogs_fix($fields->id);
93
+ echo '</div>';
94
+ echo '</div>';
95
+
96
+ }
97
+
98
+ }
99
+ ?>
100
+ <input type='submit' value='<?php _e('Apply', 'wpsc'); ?>' class='button-secondary action' />
101
+ </form>
102
+ </div>
103
+ </div>
wpsc-admin/includes/save-data.functions.php CHANGED
@@ -6,25 +6,6 @@
6
  * @since 3.8
7
  * @todo UI needs a lot of loving - lots of padding issues, if we have these boxes, they should be sortable, closable, hidable, etc.
8
  */
9
- function wpsc_ajax_set_variation_order(){
10
- global $wpdb;
11
- $sort_order = $_POST['sort_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
  /**
30
  * WP eCommerce edit and add product category page functions
@@ -41,15 +22,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 +49,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 +91,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 +122,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 +313,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
  }
6
  * @since 3.8
7
  * @todo UI needs a lot of loving - lots of padding issues, if we have these boxes, they should be sortable, closable, hidable, etc.
8
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  /**
11
  * WP eCommerce edit and add product category page functions
22
  $parent_id = $_POST['parent_id'];
23
 
24
  $result = true;
25
+ foreach( $sort_order as $key=>$value ){
26
  if ( empty( $value ) )
27
  continue;
28
 
29
  $value = preg_replace( '/[^0-9]/', '', $value );
30
 
31
+ if( !wpsc_update_meta( $value, 'sort_order', $key, 'wpsc_category' ) )
32
  $result = false;
33
+ }
34
  }
35
 
36
  add_filter( 'manage_edit-wpsc_product_category_columns', 'wpsc_custom_category_columns' );
49
  */
50
 
51
  function wpsc_custom_category_columns( $columns ) {
52
+ // Doing it this funny way to ensure that image stays in far left, even if other items are added via plugin.
53
+ unset( $columns["cb"] );
54
+
55
+ $custom_array = array(
56
+ 'cb' => '<input type="checkbox" />',
57
+ 'image' => __( 'Image', 'wpsc' )
58
+ );
59
+
60
+ $columns = array_merge( $custom_array, $columns );
61
+
62
+ return $columns;
63
  }
 
64
  /**
65
+ * wpsc_custom_category_column_data
66
+ * Adds images to the custom category column
67
+ * @param (array) column_name | column name
68
+ * @return nada
 
 
 
 
69
  */
70
+
71
  function wpsc_custom_category_column_data( $string, $column_name, $term_id ) {
72
+ global $wpdb;
73
+
74
+ $image = wpsc_get_categorymeta( $term_id, 'image' );
75
+ $name = get_term_by( 'id', $term_id, 'wpsc_product_category' );
76
+ $name = $name->name;
77
+
78
+ if( !empty( $image ) )
79
+ $image = "<img src=\"".WPSC_CATEGORY_URL.stripslashes( $image )."\" title='".$name."' alt='".$name."' width='30' height='30' />";
80
+ else
81
+ $image = "<img src='".WPSC_CORE_IMAGES_URL."/no-image-uploaded.gif' title='".$name."' alt='".$name."' width='30' height='30' />";
82
+
83
+
84
+ return $image;
85
 
 
 
 
 
 
 
 
 
86
  }
87
 
88
  /**
91
  * for use in other list functions
92
  * @param int $parent_id
93
  */
94
+ function wpsc_admin_get_category_array($parent_id = null){
95
+ global $wpdb;
96
+ $orderedList = array();
97
+ if(!isset($parent_id)) $parent_id = 0;
98
+ $category_list = get_terms('wpsc_product_category','hide_empty=0&parent='.$parent_id);
99
+ if(!is_array($category_list)){
100
+ return false;
101
+ }
102
+ foreach($category_list as $category){
103
+ $category_order = wpsc_get_categorymeta($category->term_id, 'order');
104
+ $category_image = wpsc_get_categorymeta($category->term_id, 'image');
105
+ if(!isset($category_order) || $category_order == 0) $category_order = (count($orderedList) +1);
106
+ print "<!-- setting category Order number to ".$category_order."-->";
107
+ $orderedList[$category_order]['id'] = $category->term_id;
108
+ $orderedList[$category_order]['name'] = $category->name;
109
+ $orderedList[$category_order]['image'] = $category_image;
110
+ $orderedList[$category_order]['parent_id'] = $parent_id;
111
+ $orderedList[$category_order]['children'] = wpsc_admin_get_category_array($category->term_id);
112
+ }
113
+
114
+ ksort($orderedList);
115
+ return($orderedList);
 
 
 
 
 
 
 
 
116
  }
117
 
118
  /**
122
  function wpsc_admin_category_forms_add() {
123
  global $wpdb;
124
  $category_value_count = 0;
 
125
  ?>
126
 
127
+ <h3><?php _e('Advanced Settings', 'wpsc'); ?></h3>
128
+
129
+ <div id="poststuff" class="postbox">
130
+ <h3 class="hndle"><?php _e('Presentation Settings', 'wpsc'); ?></h3>
131
+
132
+ <div class="inside">
133
+ <tr>
134
+ <td>
135
+ <label for='image'><?php _e( 'Category Image' , 'wpsc' ); ?></label>
136
+ </td>
137
+ <td>
138
+ <input type='file' name='image' value='' /><br /><br />
139
+ </td>
140
+ </tr>
141
+ <tr>
142
+ <td>
143
+ <?php _e('Catalog View', 'wpsc'); ?>
144
+ </td>
145
+ <td>
146
+ <?php
147
+ if (!isset($category['display_type'])) $category['display_type'] = '';
148
+
149
+ if ($category['display_type'] == 'grid') {
150
+ $display_type1="selected='selected'";
151
+ } else if ($category['display_type'] == 'default') {
152
+ $display_type2="selected='selected'";
153
+ }
154
 
155
+ switch($category['display_type']) {
156
+ case "default":
157
+ $category_view1 = "selected ='selected'";
158
+ break;
159
+
160
+ case "grid":
161
+ if(function_exists('product_display_grid')) {
162
+ $category_view3 = "selected ='selected'";
163
+ break;
164
+ }
165
+
166
+ case "list":
167
+ if(function_exists('product_display_list')) {
168
+ $category_view2 = "selected ='selected'";
169
+ break;
170
+ }
171
+
172
+ default:
173
+ $category_view0 = "selected ='selected'";
174
+ break;
175
+ }?>
176
+
177
+
178
+ <select name='display_type'>
179
+ <option value=''<?php echo $category_view0; ?> ><?php _e('Please select', 'wpsc'); ?></option>
180
+ <option value='default' <?php if (isset($category_view1)) echo $category_view1; ?> ><?php _e('Default View', 'wpsc'); ?></option>
181
+
182
+ <?php if(function_exists('product_display_list')) {?>
183
+ <option value='list' <?php echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
184
+ <?php } else { ?>
185
+ <option value='list' disabled='disabled' <?php if (isset($category_view2)) echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
186
+ <?php } ?>
187
+ <?php if(function_exists('product_display_grid')) { ?>
188
+ <option value='grid' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e('Grid View', 'wpsc'); ?></option>
189
+ <?php } else { ?>
190
+ <option value='grid' disabled='disabled' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e('Grid View', 'wpsc'); ?></option>
191
+ <?php } ?>
192
+ </select><br /><br />
193
+ </td>
194
+ </tr>
195
+ <tr>
196
+ <td>
197
+ <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 />
198
+ </td>
199
+ </tr>
200
+
201
+ <?php if(function_exists("getimagesize")) { ?>
202
+ <tr>
203
+ <td>
204
+ <?php _e('Thumbnail&nbsp;Size', 'wpsc'); ?>
205
+ </td>
206
+ <td>
207
+ <?php _e('Width', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_width'])) echo $category['image_width']; ?>' name='image_width' size='6'/>
208
+ <?php _e('Height', 'wpsc'); ?> <input type='text' value='<?php if (isset($category['image_height'])) echo $category['image_height']; ?>' name='image_height' size='6'/><br/>
209
+ </td>
210
+ </tr>
211
+ <?php
212
+ }
213
+ ?>
214
+ </div>
215
+ </div>
216
 
217
+ <!-- START OF TARGET MARKET SELECTION -->
218
+ <div id="poststuff" class="postbox">
219
+ <h3 class="hndle"><?php _e('Target Market Restrictions'); ?></h3>
220
+ <div class="inside"><?php
221
  $category_id = '';
222
+ if (isset($_GET["tag_ID"])) $category_id = $_GET["tag_ID"];
223
+ $countrylist = $wpdb->get_results("SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A);
224
+ $selectedCountries = wpsc_get_meta($category_id,'target_market','wpsc_category');
225
+ $output = '';
226
+ $output .= " <tr>\n\r";
227
+ $output .= " <td>\n\r";
228
+ $output .= __('Target Markets', 'wpsc').":\n\r";
229
+ $output .= " </td>\n\r";
230
+ $output .= " <td>\n\r";
231
+
232
+ if(@extension_loaded('suhosin')) {
233
+ $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.
234
+ ",'wpsc')."</em>";
235
 
236
+ } else {
237
+ $output .= "<span>Select: <a href='' class='wpsc_select_all'>All</a>&nbsp; <a href='' class='wpsc_select_none'>None</a></span><br />";
238
+ $output .= " <div id='resizeable' class='ui-widget-content multiple-select'>\n\r";
239
+ foreach($countrylist as $country){
240
+ if(in_array($country['id'], (array)$selectedCountries)){
241
+ $output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />\n\r";
242
+ } else {
243
+ $output .= " <input type='checkbox' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />\n\r";
244
+ }
245
+ }
246
+ $output .= " </div><br /><br />";
247
+ $output .= " <span class='wpscsmall description'>Select the markets you are selling this category to.<span>\n\r";
248
  }
249
+ $output .= " </td>\n\r";
250
+ $output .= " </tr>\n\r";
251
 
252
+ echo $output;
253
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  </div>
255
+ </div>
256
 
257
+ <!-- Checkout settings -->
258
+ <div id="poststuff" class="postbox">
259
+ <h3 class="hndle"><?php _e('Checkout Settings', 'wpsc'); ?></h3>
260
+ <div class="inside">
261
+ <table class='category_forms'>
 
 
 
 
 
 
262
  <?php
263
+ if (!isset($category['term_id'])) $category['term_id'] = '';
264
+ $used_additonal_form_set = wpsc_get_categorymeta($category['term_id'], 'use_additional_form_set'); ?>
265
+ <tr>
266
+ <td>
267
+ <?php _e("This category requires additional checkout form fields",'wpsc'); ?>
268
+ </td>
269
+ <td>
270
+ <select name='use_additional_form_set'>
271
+ <option value=''><?php _e("None",'wpsc'); ?></option>
272
+ <?php
273
+ $checkout_sets = get_option('wpsc_checkout_form_sets');
274
+ unset($checkout_sets[0]);
275
+
276
+ foreach((array)$checkout_sets as $key => $value) {
277
+ $selected_state = "";
278
+ if($used_additonal_form_set == $key)
279
+ $selected_state = "selected='selected'";
280
+ ?>
281
+ <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo stripslashes($value); ?></option>
282
+ <?php
283
+ }
284
+ ?>
285
+ </select>
286
+ </td>
287
+ </tr>
288
+ <?php $uses_billing_address = (bool)wpsc_get_categorymeta($category['term_id'], 'uses_billing_address'); ?>
289
+ <tr>
290
+ <td>
291
+ <?php _e("Products in this category use the billing address to calculate shipping",'wpsc'); ?>
292
+ </td>
293
+ <td>
294
+ <input type='radio' value='1' name='uses_billing_address' <?php echo (($uses_billing_address == true) ? "checked='checked'" : ""); ?> /><?php _e("Yes",'wpsc'); ?>
295
+ <input type='radio' value='0' name='uses_billing_address' <?php echo (($uses_billing_address != true) ? "checked='checked'" : ""); ?> /><?php _e("No",'wpsc'); ?>
296
+ </td>
297
+ </tr>
298
+ </table>
299
  </div>
300
+ </div>
301
 
302
+ <table class="category_forms">
303
+ <tr>
 
 
 
 
 
304
 
305
+ </tr>
306
+ </table>
307
+ <?php
 
 
 
 
 
 
 
 
308
  }
309
 
310
  function wpsc_admin_category_forms_edit() {
313
  $category_value_count = 0;
314
  $category_name = '';
315
  $category = array();
316
+
317
+ $category_id = absint( $_REQUEST["tag_ID"] );
318
+ $category = get_term($category_id, 'wpsc_product_category', ARRAY_A);
319
+ $category['nice-name'] = wpsc_get_categorymeta($category['term_id'], 'nice-name');
320
+ $category['description'] = wpsc_get_categorymeta($category['term_id'], 'description');
321
+ $category['image'] = wpsc_get_categorymeta($category['term_id'], 'image');
322
+ $category['fee'] = wpsc_get_categorymeta($category['term_id'], 'fee');
323
+ $category['active'] = wpsc_get_categorymeta($category['term_id'], 'active');
324
+ $category['order'] = wpsc_get_categorymeta($category['term_id'], 'order');
325
+ $category['display_type'] = wpsc_get_categorymeta($category['term_id'], 'display_type');
326
+ $category['image_height'] = wpsc_get_categorymeta($category['term_id'], 'image_height');
327
+ $category['image_width'] = wpsc_get_categorymeta($category['term_id'], 'image_width');
328
+ $category['use_additional_form_set'] = wpsc_get_categorymeta($category['term_id'], 'use_additional_form_set');
329
+
330
 
331
  ?>
332
 
333
+ <tr>
334
+ <td colspan="2">
335
+ <h3><?php _e( 'Advanced Settings', 'wpsc' ); ?></h3>
336
+
337
+ </td>
338
+ </tr>
 
 
339
 
340
  <tr class="form-field">
341
+ <th scope="row" valign="top">
342
+ <label for="display_type"><?php _e( 'Catalog View', 'wpsc' ); ?></label>
343
+ </th>
344
+ <td>
345
+ <?php
346
+ //Could probably be *heavily* refactored later just to use do_action here and in GoldCart. Baby steps.
347
+ if (!isset($category['display_type'])) $category['display_type'] = '';
348
+
349
+ if ($category['display_type'] == 'grid') {
350
+ $display_type1="selected='selected'";
351
+ } else if ($category['display_type'] == 'default') {
352
+ $display_type2="selected='selected'";
353
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
355
+ switch($category['display_type']) {
356
+ case "default":
357
+ $category_view1 = "selected ='selected'";
358
+ break;
359
+
360
+ case "grid":
361
+ if(function_exists('product_display_grid')) {
362
+ $category_view3 = "selected ='selected'";
363
+ break;
364
+ }
365
+
366
+ case "list":
367
+ if(function_exists('product_display_list')) {
368
+ $category_view2 = "selected ='selected'";
369
+ break;
370
+ }
371
+
372
+ default:
373
+ $category_view0 = "selected ='selected'";
374
+ break;
375
+ }
376
+ ?>
377
+ <select name='display_type'>
378
+ <option value=''<?php echo $category_view0; ?> ><?php _e('Please select', 'wpsc'); ?></option>
379
+ <option value='default' <?php if (isset($category_view1)) echo $category_view1; ?> ><?php _e( 'Default View', 'wpsc' ); ?></option>
380
+
381
+ <?php if(function_exists('product_display_list')) {?>
382
+ <option value='list' <?php echo $category_view2; ?>><?php _e('List View', 'wpsc'); ?></option>
383
+ <?php } else { ?>
384
+ <option value='list' disabled='disabled' <?php if (isset($category_view2)) echo $category_view2; ?>><?php _e( 'List View', 'wpsc' ); ?></option>
385
+ <?php } ?>
386
+ <?php if(function_exists('product_display_grid')) { ?>
387
+ <option value='grid' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
388
+ <?php } else { ?>
389
+ <option value='grid' disabled='disabled' <?php if (isset($category_view3)) echo $category_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
390
+ <?php } ?>
391
+ </select><br />
392
+ <span class="description"><?php _e( 'To over-ride the presentation settings for this group you can enter in your prefered settings here', 'wpsc' ); ?></span>
393
+ </td>
394
  </tr>
395
+ <tr class="form-field">
396
+ <th scope="row" valign="top">
397
+ <label for="image"><?php _e( 'Category Image', 'wpsc' ); ?></label>
398
+ </th>
399
+ <td>
400
+ <input type='file' name='image' value='' /><br />
401
+ <label><input type='checkbox' name='deleteimage' class="wpsc_cat_box" value='1' /><?php _e( 'Delete Image', 'wpsc' ); ?></label><br/>
402
+ <span class="description"><?php _e( 'You can set an image for the category here. If one exists, check the box to delete.', 'wpsc' ); ?></span>
403
+ </td>
404
  </tr>
405
+ <?php if( function_exists( "getimagesize" ) ) : ?>
406
+ <tr class="form-field">
407
+ <th scope="row" valign="top">
408
+ <label for="image"><?php _e( 'Thumbnail Size', 'wpsc' ); ?></label>
409
+ </th>
410
+ <td>
411
+ <?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' />
412
+ <?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/>
413
+ </td>
414
  </tr>
415
+ <?php endif; // 'getimagesize' condition ?>
 
 
416
  <tr>
417
+ <td colspan="2"><h3><?php _e( 'Shortcodes and Template Tags', 'wpsc' ); ?></h3></td>
418
+ </tr>
419
+
420
+ <tr class="form-field">
421
+ <th scope="row" valign="top">
422
+ <label for="image"><?php _e( 'Display Category Shortcode', 'wpsc' ); ?>:</label>
423
+ </th>
424
+ <td>
425
+ <span>[wpsc_products category_url_name='<?php echo $category["slug"]; ?>']</span><br />
426
+ <span class="description"><?php _e( 'Shortcodes are used to display a particular category or group within any WordPress page or post.', 'wpsc' ); ?></span>
427
+ </td>
428
  </tr>
429
+ <tr class="form-field">
430
+ <th scope="row" valign="top">
431
+ <label for="image"><?php _e( 'Display Category Template Tag', 'wpsc' ); ?>:</label>
432
+ </th>
433
+ <td>
434
+ <span>&lt;?php echo wpsc_display_products_page( array( 'category_url_name'=>'<?php echo $category["slug"]; ?>' ) ); ?&gt;</span><br />
435
+ <span class="description"><?php _e( 'Template tags are used to display a particular category or group within your theme / template.', 'wpsc' ); ?></span>
436
+ </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  </tr>
438
 
439
+ <!-- START OF TARGET MARKET SELECTION -->
440
+
441
+ <tr>
442
+ <td colspan="2">
443
+ <h3><?php _e( 'Target Market Restrictions', 'wpsc' ); ?></h3>
444
+ </td>
445
+ </tr>
446
+ <?php
447
+ $countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A );
448
+ $selectedCountries = wpsc_get_meta( $category_id,'target_market','wpsc_category' );
449
+ ?>
450
+ <tr class="form-field">
451
+ <th scope="row" valign="top">
452
+ <label for="image"><?php _e( 'Target Markets', 'wpsc' ); ?>:</label>
453
+ </th>
454
+ <td>
455
+ <?php
456
+ if ( @extension_loaded( 'suhosin' ) ) :
457
+ ?>
458
+ <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>
459
+
460
+ <?php
461
+ else :
462
+ ?>
463
+ <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 />
464
+ <div id='resizeable' class='ui-widget-content multiple-select'>
465
+ <?php
466
+ foreach( $countrylist as $country ) {
467
+ if( in_array( $country['id'], (array)$selectedCountries ) )
468
+ echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' checked='".$country['visible']."' />".$country['country']."<br />";
469
+ else
470
+ echo " <input type='checkbox' class='wpsc_cat_box' name='countrylist2[]' value='".$country['id']."' />".$country['country']."<br />";
471
+ }
472
+ ?>
473
+ </div>
474
+ <?php
475
+ endif;
476
+ ?><br />
477
+ <span class="description"><?php _e( 'Select the markets you are selling this category to.', 'wpsc' ); ?></span>
478
+ </td>
479
  </tr>
480
+ <!-- Checkout settings -->
481
+
482
+ <tr>
483
+ <td colspan="2">
484
+ <h3><?php _e( 'Checkout Settings', 'wpsc' ); ?></h3>
485
+ </td>
486
+ </tr>
487
+ <?php
488
+ if ( !isset( $category['term_id'] ) )
489
+ $category['term_id'] = '';
490
+ $used_additonal_form_set = wpsc_get_categorymeta( $category['term_id'], 'use_additional_form_set' );
491
+ $checkout_sets = get_option('wpsc_checkout_form_sets');
492
+ unset($checkout_sets[0]);
493
+ $uses_billing_address = (bool)wpsc_get_categorymeta( $category['term_id'], 'uses_billing_address' );
494
+ ?>
495
+ <tr class="form-field">
496
+ <th scope="row" valign="top">
497
+ <label for="image"><?php _e( 'Category requires additional checkout form fields', 'wpsc' ); ?></label>
498
+ </th>
499
+ <td>
500
+ <select name='use_additional_form_set'>
501
+ <option value=''><?php _e( 'None', 'wpsc' ); ?></option>
502
+ <?php
503
+ foreach( (array) $checkout_sets as $key => $value ) {
504
+ $selected_state = "";
505
+ if( $used_additonal_form_set == $key )
506
+ $selected_state = "selected='selected'";
507
+ ?>
508
+ <option <?php echo $selected_state; ?> value='<?php echo $key; ?>'><?php echo stripslashes( $value ); ?></option>
509
+ <?php
510
+ }
511
+ ?>
512
+ </select><br />
513
+ </td>
514
  </tr>
515
 
516
+ <tr class="form-field">
517
+ <th scope="row" valign="top">
518
+ <label for="image"><?php _e( 'Products in this category use the billing address to calculate shipping', 'wpsc' ); ?></label>
519
+ </th>
520
+ <td>
521
+ <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' ); ?>
522
+ <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' ); ?>
523
+ <br />
524
+ </td>
525
  </tr>
526
 
527
+ <?php
528
+ }
529
 
530
  /**
531
  * wpsc_save_category_set, Saves the category set data
532
  * @param nothing
533
  * @return nothing
534
  */
535
+ function wpsc_save_category_set($category_id, $tt_id) {
536
  global $wpdb;
537
+ if( !empty( $_POST ) ) {
 
538
  /* Image Processing Code*/
539
+ if( !empty( $_FILES['image'] ) && preg_match( "/\.(gif|jp(e)*g|png){1}$/i", $_FILES['image']['name'] ) ) {
540
+ if( function_exists( "getimagesize" ) ) {
541
+ if( ( (int) $_POST['width'] > 10 && (int) $_POST['width'] < 512 ) && ((int)$_POST['height'] > 10 && (int)$_POST['height'] < 512) ) {
542
  $width = (int) $_POST['width'];
543
  $height = (int) $_POST['height'];
544
+ image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ), $width, $height );
545
  } else {
546
+ image_processing( $_FILES['image']['tmp_name'], ( WPSC_CATEGORY_DIR.$_FILES['image']['name'] ) );
547
+ }
548
+ $image = $wpdb->escape( $_FILES['image']['name'] );
549
  } else {
550
  $new_image_path = ( WPSC_CATEGORY_DIR.basename($_FILES['image']['name'] ) );
551
  move_uploaded_file( $_FILES['image']['tmp_name'], $new_image_path );
552
  $stat = stat( dirname( $new_image_path ) );
553
  $perms = $stat['mode'] & 0000666;
554
+ @ chmod( $new_image_path, $perms );
555
+ $image = $wpdb->escape( $_FILES['image']['name'] );
556
  }
557
  } else {
558
  $image = '';
559
  }
560
+ //Good to here
561
+
562
+ if( isset( $_POST['tag_ID'] ) ) {
563
+ //Editing
564
+ $category_id= $_POST['tag_ID'];
565
+ $category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
566
+ $url_name=$category->slug;
567
+
568
+ }
569
+ if(isset($_POST['deleteimage']) && $_POST['deleteimage'] == 1) {
570
+ wpsc_delete_categorymeta($category_id, 'image');
571
+ } else if($image != '') {
572
+ wpsc_update_categorymeta($category_id, 'image', $image);
573
  }
574
+
575
+ if ( !empty( $_POST['height'] ) && is_numeric( $_POST['height'] ) && !empty( $_POST['width'] ) && is_numeric( $_POST['width'] ) && $image == null ) {
576
+ $imagedata = wpsc_get_categorymeta($category_id, 'image');
577
+ if($imagedata != null) {
578
+ $height = $_POST['height'];
579
+ $width = $_POST['width'];
580
+ $imagepath = WPSC_CATEGORY_DIR . $imagedata;
581
  $image_output = WPSC_CATEGORY_DIR . $imagedata;
582
+ image_processing($imagepath, $image_output, $width, $height);
583
  }
584
  }
585
+
586
+ wpsc_update_categorymeta($category_id, 'fee', '0');
587
+ wpsc_update_categorymeta($category_id, 'active', '1');
588
+ wpsc_update_categorymeta($category_id, 'order', '0');
589
+
590
+ if ( isset( $_POST['display_type'] ) )
591
+ wpsc_update_categorymeta($category_id, 'display_type',$wpdb->escape(stripslashes($_POST['display_type'])));
592
+
593
+ if ( isset( $_POST['image_height'] ) )
594
+ wpsc_update_categorymeta($category_id, 'image_height', $wpdb->escape(stripslashes($_POST['image_height'])));
595
+
596
+ if ( isset( $_POST['image_width'] ) )
597
+ wpsc_update_categorymeta($category_id, 'image_width', $wpdb->escape(stripslashes($_POST['image_width'])));
598
+
599
+
 
 
600
  if ( ! empty( $_POST['use_additional_form_set'] ) ) {
601
+ wpsc_update_categorymeta($category_id, 'use_additional_form_set', $_POST['use_additional_form_set']);
602
+ //exit('<pre>'.print_r($_POST,1).'</pre>');
603
  } else {
604
+ wpsc_delete_categorymeta($category_id, 'use_additional_form_set');
605
  }
606
 
607
  if ( ! empty( $_POST['uses_billing_address'] ) ) {
608
+ wpsc_update_categorymeta($category_id, 'uses_billing_address', 1);
609
  $uses_additional_forms = true;
610
  } else {
611
+ wpsc_update_categorymeta($category_id, 'uses_billing_address', 0);
612
  $uses_additional_forms = false;
613
+ }
614
+
615
+ if( ! empty( $_POST['countrylist2'] ) && ($category_id > 0)){
616
+ $AllSelected = false;
617
+ $countryList = $wpdb->get_col("SELECT `id` FROM `".WPSC_TABLE_CURRENCY_LIST."`");
618
+
619
+ if($AllSelected != true){
620
+ $unselectedCountries = array_diff($countryList, $_POST['countrylist2']);
 
621
  //find the countries that are selected
622
+ $selectedCountries = array_intersect($countryList, $_POST['countrylist2']);
623
+ wpsc_update_categorymeta( $category_id, 'target_market', $selectedCountries);
624
  }
625
+
626
+ } elseif ( ! isset($_POST['countrylist2'] ) ){
627
+ wpsc_update_categorymeta( $category_id, 'target_market','');
628
+ $AllSelected = true;
629
  }
630
 
631
  }
wpsc-admin/includes/settings-pages/admin.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wpsc_options_admin(){
3
+ global $wpdb;
4
+ ?>
5
+ <form name='cart_options' id='cart_options' method='post' action='' class='wpsc_form_track'>
6
+ <div id="options_admin">
7
+ <h3><?php _e('Admin Settings', 'wpsc'); ?></h3>
8
+ <?php
9
+ /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
10
+ wpsc_settings_page_update_notification(); ?>
11
+ <table class='wpsc_options form-table'>
12
+ <tr>
13
+ <th scope="row"><?php _e('Max downloads per file', 'wpsc');?>: </th>
14
+ <td>
15
+ <input type='text' size='10' value='<?php esc_attr_e( get_option('max_downloads') ); ?>' name='wpsc_options[max_downloads]' />
16
+ </td>
17
+ </tr>
18
+ <?php
19
+ $wpsc_ip_lock_downloads1 = "";
20
+ $wpsc_ip_lock_downloads2 = "";
21
+ switch( esc_attr( get_option('wpsc_ip_lock_downloads') ) ) {
22
+ case 1:
23
+ $wpsc_ip_lock_downloads1 = "checked ='checked'";
24
+ break;
25
+
26
+ case 0:
27
+ default:
28
+ $wpsc_ip_lock_downloads2 = "checked ='checked'";
29
+ break;
30
+ }
31
+
32
+ ?>
33
+ <tr>
34
+ <th scope="row">
35
+ <?php _e('Lock downloads to IP address', 'wpsc');?>:
36
+ </th>
37
+ <td>
38
+ <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;
39
+ <input type='radio' value='0' name='wpsc_options[wpsc_ip_lock_downloads]' id='wpsc_ip_lock_downloads1' <?php echo $wpsc_ip_lock_downloads2; ?> /> <label for='wpsc_ip_lock_downloads1'><?php _e('No', 'wpsc');?></label><br />
40
+ </td>
41
+ </tr>
42
+
43
+
44
+ <?php
45
+ $wpsc_check_mime_types1 = "";
46
+ $wpsc_check_mime_types2 = "";
47
+ switch( esc_attr( get_option('wpsc_check_mime_types') ) ) {
48
+ case 1:
49
+ $wpsc_check_mime_types2 = "checked ='checked'";
50
+ break;
51
+
52
+ case 0:
53
+ default:
54
+ $wpsc_check_mime_types1 = "checked ='checked'";
55
+ break;
56
+ }
57
+
58
+ ?>
59
+ <tr>
60
+ <th scope="row">
61
+ <?php _e('Check MIME types on file uploads', 'wpsc');?>:
62
+ </th>
63
+ <td>
64
+ <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;
65
+ <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 />
66
+
67
+ <span class="wpscsmall description">
68
+ <?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'); ?>
69
+ </span>
70
+ </td>
71
+ </tr>
72
+
73
+
74
+ <tr>
75
+ <th scope="row">
76
+ <?php _e('Purchase Log Email', 'wpsc');?>:
77
+ </th>
78
+ <td>
79
+ <input class='text' name='wpsc_options[purch_log_email]' type='text' size='40' value='<?php esc_attr_e( get_option('purch_log_email') ); ?>' />
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <th scope="row">
84
+ <?php _e('Purchase Receipt - Reply Address', 'wpsc');?>:
85
+ </th>
86
+ <td>
87
+ <input class='text' name='wpsc_options[return_email]' type='text' size='40' value='<?php esc_attr_e( get_option('return_email') ); ?>' />
88
+ </td>
89
+ </tr>
90
+
91
+ <tr>
92
+ <th scope="row">
93
+ <?php _e('Purchase Receipt - Reply Name', 'wpsc');?>:
94
+ </th>
95
+ <td>
96
+ <input class='text' name='wpsc_options[return_name]' type='text' size='40' value='<?php esc_attr_e( get_option('return_name') ); ?>' />
97
+ </td>
98
+ </tr>
99
+
100
+ <tr>
101
+ <th scope="row">
102
+ <?php _e('Terms and Conditions', 'wpsc');?>:
103
+ </th>
104
+ <td>
105
+ <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>
106
+ </td>
107
+ </tr>
108
+
109
+ </table>
110
+ <h3 class="form_group"><?php _e('Custom Messages', 'wpsc');?>:</h3>
111
+ <table class='wpsc_options form-table'>
112
+ <tr>
113
+ <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>
114
+ </tr>
115
+ <tr>
116
+ <td class='wpsc_td_note' colspan='2'>
117
+ <span class="wpscsmall description">
118
+ <?php _e('Note: The purchase receipt is the message e-mailed to users after purchasing products from your shop.' , 'wpsc'); ?>
119
+ <br />
120
+ <?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'); ?>
121
+ </span>
122
+ </td>
123
+ </tr>
124
+ <tr>
125
+ <th><strong><?php _e('Purchase Receipt', 'wpsc');?></strong></th>
126
+ <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>
127
+ </tr>
128
+ <tr>
129
+ <td class='wpsc_td_note' colspan='2'>
130
+ <span class="wpscsmall description">
131
+ <?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'); ?>
132
+ </span>
133
+ </td>
134
+ </tr>
135
+ <tr>
136
+ <th><strong><?php _e('Admin Report', 'wpsc');?></strong></th>
137
+ <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>
138
+ </tr>
139
+ </table>
140
+
141
+ <h3 class="form_group"><?php _e("Track and Trace settings", 'wpsc');?>:</h3>
142
+ <table class='wpsc_options form-table'>
143
+ <tr>
144
+ <td class='wpsc_td_note' colspan='2'>
145
+ <span class="wpscsmall description">
146
+ <?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'); ?>
147
+ </span>
148
+ </td>
149
+ </tr>
150
+ <tr>
151
+ <th><strong><?php _e('Tracking Email Subject', 'wpsc');?></strong></th>
152
+ <td><input name="wpsc_options[wpsc_trackingid_subject]" type='text' value='<?php esc_attr_e( stripslashes(get_option('wpsc_trackingid_subject') ) );?>' /></td>
153
+ </tr>
154
+ <tr>
155
+ <th><strong><?php _e('Tracking Email Message', 'wpsc');?></strong></th>
156
+ <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>
157
+ </tr>
158
+ </table>
159
+
160
+ <?php
161
+ /* here end the admin options */
162
+ ?>
163
+ <?php do_action('wpsc_admin_settings_page'); ?>
164
+ <div class="submit">
165
+ <input type='hidden' name='wpsc_admin_action' value='submit_options' />
166
+
167
+ <?php wp_nonce_field('update-options', 'wpsc-update-options'); ?>
168
+ <input type="submit" value="<?php _e('Update &raquo;', 'wpsc');?>" name="updateoption"/>
169
+ </div>
170
+ </div>
171
+ </form>
172
+
173
+ <?php
174
+ }
175
+
176
+ ?>
wpsc-admin/includes/settings-pages/checkout.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wpsc_options_checkout(){
3
+ global $wpdb;
4
+ $form_types = get_option('wpsc_checkout_form_fields');
5
+ $unique_names = get_option('wpsc_checkout_unique_names');
6
+
7
+ do_action('wpsc_checkout_form_fields_page');
8
+ $columns = array(
9
+ 'drag' => __('Drag', 'wpsc'),
10
+ 'name' => __('Name', 'wpsc'),
11
+ 'type' => __('Type', 'wpsc'),
12
+ 'unique_names' => __('Unique Names', 'wpsc'),
13
+ 'mandatory' => __('Mandatory', 'wpsc'),
14
+ 'trash' => __('Trash', 'wpsc'),
15
+ );
16
+ register_column_headers('display-checkout-list', $columns);
17
+
18
+
19
+ ?>
20
+
21
+ <form name='cart_options' id='cart_options' method='post' action='' class='wpsc_form_track'>
22
+ <div class="wrap">
23
+ <?php
24
+ /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
25
+ wpsc_settings_page_update_notification(); ?>
26
+
27
+ <div class='metabox-holder' style='width:95%;'>
28
+ <div class='postbox'>
29
+ <input type='hidden' name='checkout_submits' value='true' />
30
+ <h3 class='hndle'><?php _e( 'Misc Checkout Options' , 'wpsc' ); ?></h3>
31
+ <div class='inside'>
32
+ <table>
33
+ <tr>
34
+ <td><?php _e('Users must register before checking out', 'wpsc'); ?>:</td>
35
+ <td>
36
+ <?php
37
+ $require_register = esc_attr( get_option('require_register') );
38
+ $require_register1 = "";
39
+ $require_register2 = "";
40
+ switch($require_register) {
41
+ case 0:
42
+ $require_register2 = "checked ='checked'";
43
+ break;
44
+
45
+ case 1:
46
+ $require_register1 = "checked ='checked'";
47
+ break;
48
+ }
49
+ ?>
50
+ <input type='radio' value='1' name='wpsc_options[require_register]' id='require_register1' <?php echo $require_register1; ?> /> <label for='require_register1'><?php _e('Yes', 'wpsc');?></label> &nbsp;
51
+ <input type='radio' value='0' name='wpsc_options[require_register]' id='require_register2' <?php echo $require_register2; ?> /> <label for='require_register2'><?php _e('No', 'wpsc');?></label>
52
+ </td>
53
+ <td>
54
+ <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>
55
+ </td>
56
+ </tr>
57
+
58
+ <tr>
59
+ <?php
60
+ $shippingBilling = get_option('shippingsameasbilling');
61
+ $shippingBilling1 = $shippingBilling2 = '';
62
+ switch($shippingBilling) {
63
+ case 1:
64
+ $shippingBilling1 = "checked ='checked'";
65
+ break;
66
+
67
+ case 0:
68
+ $shippingBilling2 = "checked ='checked'";
69
+ break;
70
+ }
71
+ ?>
72
+ <td scope="row"><?php _e('Enable Shipping Same as Billing Option: ', 'wpsc'); ?>:</td>
73
+ <td>
74
+ <input type='radio' value='1' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling1' <?php if (!empty($shippingBilling1)) echo $shippingBilling1; ?> />
75
+ <label for='shippingsameasbilling1'><?php _e('Yes', 'wpsc');?></label> &nbsp;
76
+ <input type='radio' value='0' name='wpsc_options[shippingsameasbilling]' id='shippingsameasbilling2' <?php if (!empty($shippingBilling2)) echo $shippingBilling2; ?> />
77
+ <label for='shippingsameasbilling2'><?php _e('No', 'wpsc');?></label>
78
+ </td>
79
+
80
+ </tr>
81
+ <tr>
82
+ <td><?php _e('Force users to use SSL', 'wpsc'); ?>:</td>
83
+ <td>
84
+ <?php
85
+ $wpsc_force_ssl = esc_attr( get_option('wpsc_force_ssl') );
86
+ $wpsc_force_ssl1 = "";
87
+ $wpsc_force_ssl2 = "";
88
+ switch($wpsc_force_ssl) {
89
+ case 0:
90
+ $wpsc_force_ssl2 = "checked ='checked'";
91
+ break;
92
+
93
+ case 1:
94
+ $wpsc_force_ssl1 = "checked ='checked'";
95
+ break;
96
+ }
97
+ ?>
98
+ <input type='radio' value='1' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl1' <?php echo $wpsc_force_ssl1; ?> /> <label for='wpsc_force_ssl1'><?php _e('Yes', 'wpsc');?></label> &nbsp;
99
+ <input type='radio' value='0' name='wpsc_options[wpsc_force_ssl]' id='wpsc_force_ssl2' <?php echo $wpsc_force_ssl2; ?> /> <label for='wpsc_force_ssl2'><?php _e('No', 'wpsc');?></label>
100
+ </td>
101
+ <td>
102
+ <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>
103
+ </td>
104
+ </tr>
105
+ <?php do_action('wpsc_checkout_settings_page'); ?>
106
+ </table>
107
+ </div>
108
+ </div>
109
+ </div>
110
+ <h3><?php _e('Form Fields', 'wpsc'); ?></h3>
111
+ <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>
112
+
113
+ <p>
114
+ <label for='wpsc_form_set'><?php _e('Select a Form Set' , 'wpsc'); ?>:</label>
115
+ <select id='wpsc_form_set' name='wpsc_form_set'>
116
+ <?php
117
+ $checkout_sets = get_option('wpsc_checkout_form_sets');
118
+ foreach((array)$checkout_sets as $key => $value) {
119
+ $selected_state = "";
120
+ if(isset($_GET['checkout-set']) && $_GET['checkout-set'] == $key) {
121
+ $selected_state = "selected='selected'";
122
+ }
123
+ echo "<option {$selected_state} value='{$key}'>".esc_attr( stripslashes( $value ) )."</option>";
124
+ }
125
+ ?>
126
+ </select>
127
+ <input type='submit' value='Filter' name='wpsc_checkout_set_filter' class='button-secondary' />
128
+ <a href='#' class='add_new_form_set'><?php _e("+ Add New Form Set", 'wpsc'); ?></a>
129
+ </p>
130
+
131
+ <p class='add_new_form_set_forms'>
132
+ <label><?php _e("Add new Form Set",'wpsc'); ?>: <input type="text" value="" name="new_form_set" /></label>
133
+ <input type="submit" value="<?php _e('Add', 'wpsc'); ?>" class="button-secondary" id="formset-add-sumbit"/>
134
+ </p>
135
+
136
+ <?php
137
+ if(!isset($_GET['checkout-set']) || ($_GET['checkout-set'] == 0)) {
138
+ $form_sql = "SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1' AND `checkout_set` IN ('0', '') ORDER BY `checkout_order`;";
139
+ } else {
140
+ $filter = $wpdb->escape($_GET['checkout-set']);
141
+ $form_sql = "SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1' AND `checkout_set` IN ('".$filter."') ORDER BY `checkout_order`;";
142
+ }
143
+ $email_form_field = $wpdb->get_row("SELECT `id` FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` IN ('email') AND `active` = '1' ORDER BY `checkout_order` ASC LIMIT 1",ARRAY_A);
144
+
145
+
146
+ $form_data = $wpdb->get_results($form_sql,ARRAY_A);
147
+ if (!isset($_GET['checkout-set'])) $_GET['checkout-set'] = '';
148
+
149
+ $selected_checkout_set = esc_attr($_GET['checkout-set']);
150
+ echo "<input type='hidden' name='selected_form_set' value='".$selected_checkout_set."' />";
151
+ ?>
152
+ <table id="wpsc_checkout_list" class="widefat page fixed" cellspacing="0">
153
+ <thead>
154
+ <tr>
155
+ <?php print_column_headers('display-checkout-list'); ?>
156
+ </tr>
157
+ </thead>
158
+
159
+ <tfoot>
160
+ <tr>
161
+ <?php print_column_headers('display-checkout-list', false); ?>
162
+ </tr>
163
+ </tfoot>
164
+
165
+ <tbody id='wpsc_checkout_list_body'>
166
+ <?php
167
+ foreach((array)$form_data as $form_field) {
168
+ echo "<tr id='checkout_".$form_field['id']."' class='checkout_form_field'>\n\r";
169
+ echo '<td class="drag"><a href="" onclick="return false;" title="' . __('Click and Drag to Order Checkout Fields', 'wpsc') . '"><img src="' . WPSC_CORE_IMAGES_URL . '/roll-over-drag.jpg" alt="roll-over-drag" /></a></td>';
170
+ echo "<td class='namecol'><input type='text' name='form_name[".$form_field['id']."]' value='".esc_attr(htmlentities(stripslashes($form_field['name']), ENT_QUOTES, "UTF-8"))."' /></td>";
171
+
172
+ echo " <td class='typecol'>";
173
+ echo "<select class='wpsc_checkout_selectboxes' name='form_type[".$form_field['id']."]'>";
174
+ foreach($form_types as $form_type_name => $form_type) {
175
+ $selected = '';
176
+ if($form_type === $form_field['type']) {
177
+ $selected = "selected='selected'";
178
+ }
179
+ echo "<option value='".$form_type."' ".$selected.">" . $form_type_name . "</option>";
180
+ }
181
+
182
+ echo "</select>";
183
+ if(in_array($form_field['type'], array('select','radio','checkbox'))){
184
+ echo "<a class='wpsc_edit_checkout_options' rel='form_options[".$form_field['id']."]' href=''>" . __('more options', 'wpsc') . "</a>";
185
+ }
186
+ echo "</td>";
187
+ $checked = "";
188
+ echo "<td><select name='unique_names[".$form_field['id']."]'>";
189
+ echo "<option value='-1'>" . __('Select a Unique Name', 'wpsc') . "</option>";
190
+ foreach($unique_names as $unique_name){
191
+ $selected = "";
192
+ if($unique_name == $form_field['unique_name']) {
193
+ $selected = "selected='selected'";
194
+ }
195
+ echo "<option ".$selected." value='".$unique_name."'>".$unique_name."</option>";
196
+ }
197
+ echo "</select></td>";
198
+ if($form_field['mandatory']) {
199
+ $checked = "checked='checked'";
200
+ }
201
+ echo " <td class='mandatorycol'><input $checked type='checkbox' name='form_mandatory[".$form_field['id']."]' value='1' /></td>";
202
+
203
+
204
+ echo " <td><a class='image_link' href='#' onclick='return remove_form_field(\"checkout_".$form_field['id']."\",".$form_field['id'].");'><img src='" . WPSC_CORE_IMAGES_URL . "/trash.gif' alt='".__('Delete', 'wpsc')."' title='".__('Delete', 'wpsc')."' /></a>";
205
+
206
+ if($email_form_field['id'] == $form_field['id']) {
207
+ echo "<a title='".__('This will be the Email address that the Purchase Reciept is sent to.', 'wpsc')."' class='flag_email' href='#' ><img src='" . WPSC_CORE_IMAGES_URL . "/help.png' alt='' /> </a>";
208
+ }
209
+ echo "</td>";
210
+
211
+ echo "
212
+ </tr>";
213
+
214
+ }
215
+ ?>
216
+
217
+ </tbody>
218
+ </table>
219
+ <?php ?>
220
+ <p>
221
+ <input type='hidden' name='wpsc_admin_action' value='checkout_settings' />
222
+
223
+ <?php wp_nonce_field('update-options', 'wpsc-update-options'); ?>
224
+ <input class='button-primary' type='submit' name='submit' value='<?php _e('Save Changes', 'wpsc');?>' />
225
+ <a href='#' onclick='return add_form_field();'><?php _e('Add New Form Field', 'wpsc');?></a></p>
226
+ <div id="checkout_message">Note: Any new form fields will appear in your sales logs and on your checkout page but this data will not be sent to the payment gateway.</div>
227
+ </div>
228
+ </form>
229
+ <?php
230
+ }
231
+ ?>
wpsc-admin/includes/settings-pages/gateway.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wpsc_options_gateway() {
4
+ global $wpdb, $nzshpcrt_gateways;
5
+
6
+ $curgateway = get_option( 'payment_gateway' );
7
+
8
+ $payment_gateway_names = get_option( 'payment_gateway_names' );
9
+
10
+ if ( empty( $nzshpcrt_gateways ) )
11
+ $nzshpcrt_gateways = nzshpcrt_get_gateways();
12
+
13
+ if ( is_array( $nzshpcrt_gateways ) ) {
14
+ $selected_gateways = get_option( 'custom_gateway_options' );
15
+ foreach ( $nzshpcrt_gateways as $gateway ) {
16
+ if ( $gateway['internalname'] == $curgateway ) {
17
+ $selected = "selected='selected'";
18
+ $form = $gateway['form']();
19
+ $selected_gateway_data = $gateway;
20
+ } else {
21
+ $selected = '';
22
+ }
23
+
24
+ if ( isset( $gateway['admin_name'] ) )
25
+ $gateway['name'] = $gateway['admin_name'];
26
+
27
+ $disabled = '';
28
+
29
+ if ( !in_array( $gateway['internalname'], (array)$selected_gateways ) )
30
+ $disabled = "disabled='disabled'";
31
+
32
+ if ( !isset( $gateway['internalname'] ) )
33
+ $gateway['internalname'] = '';
34
+
35
+ $gatewaylist = '';
36
+ $gatewaylist .= "<option $disabled value='" . esc_attr( $gateway['internalname'] ) . "' " . $selected . " >" . esc_attr( $gateway['name'] ) . "</option>";
37
+ }
38
+ }
39
+ $nogw = '';
40
+ $gatewaylist = "<option value='" . $nogw . "'>" . __( 'Please Select A Payment Gateway', 'wpsc' ) . "</option>" . $gatewaylist;
41
+ ?>
42
+
43
+ <script language='javascript' type='text/javascript'>
44
+ function selectgateway() {
45
+ document.forms.gateway_opt.submit();
46
+ }
47
+ </script>
48
+
49
+ <div class="wrap">
50
+ <div class='metabox-holder'>
51
+ <form name='gatewayopt' method='post' id='gateway_opt' action='' class='wpsc_form_track'>
52
+ <input type='hidden' name='gateway_submits' value='true' />
53
+ <input type='hidden' name='wpsc_gateway_settings' value='gateway_settings' />
54
+ <?php
55
+ if ( get_option( 'custom_gateway' ) == 1 ) {
56
+ $custom_gateway_hide = "style='display:block;'";
57
+ $custom_gateway1 = 'checked="checked"';
58
+ } else {
59
+ $custom_gateway_hide = "style='display:none;'";
60
+ $custom_gateway2 = 'checked="checked"';
61
+ }
62
+ /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
63
+ wpsc_settings_page_update_notification(); ?>
64
+ <table id='gateway_options' >
65
+ <tr>
66
+ <td class='select_gateway'>
67
+ <div class='postbox'>
68
+ <h3 class='hndle'><?php _e( 'General Settings', 'wpsc' ); ?></h3>
69
+ <div class='inside'>
70
+ <p><?php _e( 'Activate the payment gateways that you want to make available to your customers by selecting them below.', 'wpsc' ); ?></p>
71
+ <br />
72
+ <?php
73
+ $selected_gateways = get_option( 'custom_gateway_options' );
74
+ foreach ( $nzshpcrt_gateways as $gateway ) {
75
+ if ( isset( $gateway['admin_name'] ) )
76
+ $gateway['name'] = $gateway['admin_name'];
77
+
78
+ if ( in_array( $gateway['internalname'], (array)$selected_gateways ) ) {
79
+ ?>
80
+
81
+ <div class="wpsc_shipping_options">
82
+ <div class='wpsc-shipping-actions wpsc-payment-actions'>
83
+ | <span class="edit">
84
+ <a class='edit-payment-module' rel="<?php echo $gateway['internalname']; ?>" onclick="event.preventDefault();" title="Edit this Payment Module" href='<?php echo esc_url( add_query_arg( 'payment_module', $gateway['internalname'] ) ); ?>' style="cursor:pointer;">Edit</a>
85
+ </span> |
86
+ </div>
87
+ <p><input name='wpsc_options[custom_gateway_options][]' checked='checked' type='checkbox' value='<?php esc_attr_e( $gateway['internalname'] ); ?>' id='<?php esc_attr_e( $gateway['internalname'] ); ?>_id' />
88
+ <label for='<?php esc_attr_e( $gateway['internalname'] ); ?>_id'><?php esc_attr_e( $gateway['name'] ); ?></label></p>
89
+ </div>
90
+ <?php } else { ?>
91
+ <div class="wpsc_shipping_options">
92
+ <div class='wpsc-shipping-actions wpsc-payment-actions'>
93
+ | <span class="edit">
94
+ <a class='edit-payment-module' rel="<?php echo $gateway['internalname']; ?>" onclick="event.preventDefault();" title="Edit this Payment Module" href='<?php echo esc_url( add_query_arg( 'payment_module', $gateway['internalname'] ) ); ?>' style="cursor:pointer;"><?php _e( 'Edit' , 'wpsc' ); ?></a>
95
+ </span> |
96
+ </div>
97
+ <p><input name='wpsc_options[custom_gateway_options][]' type='checkbox' value='<?php echo $gateway['internalname']; ?>' id='<?php echo $gateway['internalname']; ?>_id' />
98
+ <label for='<?php echo $gateway['internalname']; ?>_id'><?php echo $gateway['name']; ?></label></p></div>
99
+ <?php
100
+ }
101
+ }
102
+ ?>
103
+ <div class='submit gateway_settings'>
104
+ <input type='hidden' value='true' name='update_gateways' />
105
+ <input type='submit' value='<?php _e( 'Update &raquo;', 'wpsc' ) ?>' name='updateoption' />
106
+ </div>
107
+ </div>
108
+ </div>
109
+
110
+ <h4><?php _e( 'We Recommend', 'wpsc' ); ?></h4>
111
+ <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 />
112
+ <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>
113
+
114
+ </td>
115
+
116
+ <td class='gateway_settings' rowspan='2'>
117
+ <div class='postbox'>
118
+ <?php
119
+
120
+ if ( !isset( $_SESSION['previous_payment_name'] ) )
121
+ $_SESSION['previous_payment_name'] = "";
122
+ if ( !isset( $selected_gateway_data ) )
123
+ $selected_gateway_data = "";
124
+ $payment_data = wpsc_get_payment_form( $_SESSION['previous_payment_name'], $selected_gateway_data );
125
+ ?>
126
+ <h3 class='hndle'><?php echo $payment_data['name']; ?></h3>
127
+ <div class='inside'>
128
+ <table class='form-table'>
129
+ <?php echo $payment_data['form_fields']; ?>
130
+ </table>
131
+ <?php
132
+ if ( $payment_data['has_submit_button'] == 0 )
133
+ $update_button_css = 'style= "display: none;"';
134
+ else
135
+ $update_button_css = '';
136
+ ?>
137
+ <div class='submit' <?php echo $update_button_css; ?>>
138
+ <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
139
+ <input type='submit' value='<?php _e( 'Update &raquo;', 'wpsc' ) ?>' name='updateoption' />
140
+ </div>
141
+ </div>
142
+ </td>
143
+ </tr>
144
+ </table>
145
+ </form>
146
+ </div>
147
+ </div>
148
+
149
+ <?php
150
+ }
151
+ ?>
wpsc-admin/includes/settings-pages/general.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function wpsc_options_general() {
4
+ global $wpdb;
5
+ ?>
6
+ <form method='post' action='' id='cart_options' name='cart_options' class='wpsc_form_track'>
7
+ <div id="options_general">
8
+ <h3><?php _e( 'General Settings', 'wpsc' ); ?></h3>
9
+ <?php
10
+ /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
11
+ wpsc_settings_page_update_notification();
12
+ ?>
13
+ <table class='wpsc_options form-table'>
14
+ <tr>
15
+ <th scope="row"><?php _e( 'Base Country/Region', 'wpsc' ); ?>: </th>
16
+ <td>
17
+ <select name='wpsc_options[base_country]' onchange='submit_change_country();'>
18
+
19
+ <?php echo country_list( esc_attr( get_option( 'base_country' ) ) ); ?>
20
+
21
+ </select>
22
+ <span id='options_country'>
23
+ <?php
24
+ $region_list = $wpdb->get_results( "SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`, `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `" . WPSC_TABLE_CURRENCY_LIST . "`.`isocode` IN('" . esc_attr( get_option( 'base_country' ) ) . "') AND `" . WPSC_TABLE_CURRENCY_LIST . "`.`id` = `" . WPSC_TABLE_REGION_TAX . "`.`country_id`", ARRAY_A );
25
+ if ( !empty( $region_list ) ) { ?>
26
+
27
+ <select name='wpsc_options[base_region]'>
28
+ <?php
29
+ foreach ( $region_list as $region ) {
30
+ if ( esc_attr( get_option( 'base_region' ) ) == $region['id'] ) {
31
+ $selected = "selected='selected'";
32
+ } else {
33
+ $selected = "";
34
+ }
35
+ ?>
36
+ <option value='<?php echo $region['id']; ?>' <?php echo $selected; ?> ><?php echo esc_attr( $region['name'] ); ?></option> <?php
37
+ }
38
+ ?>
39
+ </select>
40
+
41
+ <?php } ?>
42
+ </span>
43
+ <br /><?php _e( 'Select your primary business location.', 'wpsc' ); ?>
44
+ </td>
45
+ </tr>
46
+ <?php
47
+ /* START OF TARGET MARKET SELECTION */
48
+ $countrylist = $wpdb->get_results( "SELECT id,country,visible FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ", ARRAY_A );
49
+ ?>
50
+ <tr>
51
+ <th scope="row">
52
+ <?php _e( 'Target Markets', 'wpsc' ); ?>:
53
+ </th>
54
+ <td>
55
+ <?php
56
+ // check for the suhosin module
57
+ if ( @extension_loaded( 'suhosin' ) && (@ini_get( 'suhosin.post.max_vars' ) > 0) && (@ini_get( 'suhosin.post.max_vars' ) < 500) ) {
58
+ 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>";
59
+ } else {
60
+ ?>
61
+ <span><?php printf(__('Select: <a href="%1$s" class="wpsc_select_all" title="All">All</a> <a href="%1$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' ) ) ) ); ?></span><br />
62
+ <div id='resizeable' class='ui-widget-content multiple-select'>
63
+ <?php
64
+ foreach ( (array)$countrylist as $country ) {
65
+ $country['country'] = htmlspecialchars( $country['country'] );
66
+ if ( $country['visible'] == 1 ) {
67
+ ?>
68
+ <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 />
69
+ <?php } else {
70
+ ?>
71
+ <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 />
72
+ <?php }
73
+ } ?>
74
+ </div><br />
75
+ <?php _e( 'Select the markets you are selling products to.' , 'wpsc');
76
+ }
77
+ ?>
78
+ </td>
79
+ </tr>
80
+ <?php
81
+ $stock_keeping_time = get_option( 'wpsc_stock_keeping_time', 1 );
82
+ $stock_keeping_interval = get_option( 'wpsc_stock_keeping_interval', 'day' );
83
+ ?>
84
+ <tr>
85
+ <th scope="row">
86
+ <label for="wpsc-stock-keeping-time"><?php _e( 'Keep stock in cart for' ); ?>:</label>
87
+ </th>
88
+ <td>
89
+ <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 ); ?>" />
90
+ <select name="wpsc_options[wpsc_stock_keeping_interval]">
91
+ <option value="hour" <?php selected( 'hour', $stock_keeping_interval ); ?>><?php echo _n( 'hour', 'hours', $stock_keeping_time, 'wpsc' ); ?></option>
92
+ <option value="day" <?php selected( 'day', $stock_keeping_interval ); ?>><?php echo _n( 'day', 'days', $stock_keeping_time, 'wpsc' ) ?></option>
93
+ <option value="week" <?php selected( 'week', $stock_keeping_interval ); ?>><?php echo _n( 'week', 'weeks', $stock_keeping_time, 'wpsc' ) ?></option>
94
+ </select><br />
95
+ <?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.") ?>
96
+ </td>
97
+ </tr>
98
+ <?php $hierarchical_category = get_option( 'product_category_hierarchical_url', 0 ); ?>
99
+ <tr>
100
+ <th scope="row">
101
+ <?php _e( 'Use Hierarchical Product Category URL:' ); ?>
102
+ </th>
103
+ <td>
104
+ <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;
105
+ <label><input type="radio" <?php checked( $hierarchical_category, 0 ); ?>name="wpsc_options[product_category_hierarchical_url]" value="0" /> <?php _e( 'No', 'wpsc' ); ?></label><br />
106
+ <?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' ); ?>
107
+ </td>
108
+ </tr>
109
+ </table>
110
+
111
+ <h3 class="form_group"><?php _e( 'Currency Settings', 'wpsc' ); ?>:</h3>
112
+ <table class='wpsc_options form-table'>
113
+ <tr>
114
+ <th scope="row"><?php _e( 'Currency Type', 'wpsc' ); ?>:</th>
115
+ <td>
116
+ <select name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
117
+ <?php
118
+ $currency_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY `country` ASC", ARRAY_A );
119
+ foreach ( $currency_data as $currency ) {
120
+ if ( esc_attr( get_option( 'currency_type' ) ) == $currency['id'] ) {
121
+ $selected = "selected='selected'";
122
+ } else {
123
+ $selected = "";
124
+ } ?>
125
+ <option value='<?php echo $currency['id']; ?>' <?php echo $selected; ?> ><?php echo htmlspecialchars( $currency['country'] ); ?> (<?php echo $currency['currency']; ?>)</option>
126
+ <?php
127
+ }
128
+ $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 );
129
+ if ( $currency_data['symbol'] != '' ) {
130
+ $currency_sign = esc_attr( $currency_data['symbol_html'] );
131
+ } else {
132
+ $currency_sign = esc_attr( $currency_data['code'] );
133
+ }
134
+ ?>
135
+ </select>
136
+ </td>
137
+ </tr>
138
+ <tr>
139
+ <th scope="row"><?php _e( 'Currency Sign Location', 'wpsc' ); ?>:</th>
140
+ <td>
141
+ <?php
142
+ $currency_sign_location = esc_attr( get_option( 'currency_sign_location' ) );
143
+ $csl1 = "";
144
+ $csl2 = "";
145
+ $csl3 = "";
146
+ $csl4 = "";
147
+ switch ( $currency_sign_location ) {
148
+ case 1:
149
+ $csl1 = "checked ='checked'";
150
+ break;
151
+
152
+ case 2:
153
+ $csl2 = "checked ='checked'";
154
+ break;
155
+
156
+ case 3:
157
+ $csl3 = "checked ='checked'";
158
+ break;
159
+
160
+ case 4:
161
+ $csl4 = "checked ='checked'";
162
+ break;
163
+ } ?>
164
+ <input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
165
+ <label for='csl1'>100<span id='cslchar1'><?php echo $currency_sign; ?></span></label> &nbsp;
166
+ <input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
167
+ <label for='csl2'>100 <span id='cslchar2'><?php echo $currency_sign; ?></span></label> &nbsp;
168
+ <input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
169
+ <label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span>100</label> &nbsp;
170
+ <input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
171
+ <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> 100</label>
172
+ </td>
173
+ </tr>
174
+ <tr>
175
+ <th scope="row"><?php _e( 'Thousands and decimal separators', 'wpsc' ); ?>:</th>
176
+ <td>
177
+ <?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 />
178
+ <?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 />
179
+ <?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
180
+ </td>
181
+ </tr>
182
+ </table>
183
+ <?php do_action('wpsc_general_settings_page'); ?>
184
+ <div class="submit">
185
+ <input type='hidden' name='wpsc_admin_action' value='submit_options' />
186
+ <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
187
+ <input type="submit" value="<?php _e( 'Update &raquo;', 'wpsc' ); ?>" name="updateoption" />
188
+ </div>
189
+ </div>
190
+ </form>
191
+ <?php
192
+ }
193
+ ?>
wpsc-admin/includes/settings-pages/import.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This file handles the standard importing of products through a csv file upload. Access this page via WP-admin Settings>Import
5
+ * @package WP e-Commerce
6
+ */
7
+ function wpsc_options_import() {
8
+ global $wpdb;
9
+ ?>
10
+ <form name='cart_options' enctype='multipart/form-data' id='cart_options' method='post' action='<?php echo 'admin.php?page=wpsc-settings&tab=import'; ?>' class='wpsc_form_track'>
11
+ <div class="wrap">
12
+ <?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' ); ?>
13
+
14
+ <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
15
+ <input type='hidden' name='MAX_FILE_SIZE' value='5000000' />
16
+ <input type='file' name='csv_file' />
17
+ <input type='submit' value='Import' class='button-primary'>
18
+ <?php
19
+ if ( isset( $_FILES['csv_file']['name'] ) && ($_FILES['csv_file']['name'] != '') ) {
20
+ ini_set( "auto_detect_line_endings", 1 );
21
+ $file = $_FILES['csv_file'];
22
+ if ( move_uploaded_file( $file['tmp_name'], WPSC_FILE_DIR . $file['name'] ) ) {
23
+ $content = file_get_contents( WPSC_FILE_DIR . $file['name'] );
24
+ $handle = @fopen( WPSC_FILE_DIR . $file['name'], 'r' );
25
+ while ( ($csv_data = @fgetcsv( $handle, filesize( $handle ), "," )) !== false ) {
26
+ $fields = count( $csv_data );
27
+ for ( $i = 0; $i < $fields; $i++ ) {
28
+ if ( !is_array( $data1[$i] ) ) {
29
+ $data1[$i] = array( );
30
+ }
31
+ array_push( $data1[$i], $csv_data[$i] );
32
+ }
33
+ }
34
+
35
+ $_SESSION['cvs_data'] = $data1;
36
+ $categories = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $category_id );
37
+ ?>
38
+
39
+ <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>
40
+ <div class='metabox-holder' style='width:90%'>
41
+ <input type='hidden' name='csv_action' value='import'>
42
+
43
+ <div style='width:100%;' class='postbox'>
44
+ <h3 class='hndle'><?php _e('Product Status' , 'wpsc' ); ?></h3>
45
+ <div class='inside'>
46
+ <table>
47
+ <tr><td style='width:80%;'>
48
+ <?php _e( 'Select if you would like to import your products in as Drafts or Publish them right away.' , 'wpsc' ); ?>
49
+ <br />
50
+ </td><td>
51
+ <select name='post_status'>
52
+ <option value='publish'><?php _e('Publish', 'wpsc'); ?></option>
53
+ <option value='draft'><?php _e('Draft', 'wpsc'); ?></option>
54
+ </select>
55
+ </td></tr>
56
+ </table>
57
+ </div>
58
+ </div>
59
+
60
+ <?php
61
+ foreach ( (array)$data1 as $key => $datum ) {
62
+ ?>
63
+ <div style='width:100%;' class='postbox'>
64
+ <h3 class='hndle'><?php printf(__('Column (%s)', 'wpsc'), ($key + 1)); ?></h3>
65
+ <div class='inside'>
66
+ <table>
67
+ <tr><td style='width:80%;'>
68
+ <input type='hidden' name='column[]' value='<?php echo $key + 1; ?>'>
69
+ <?php
70
+ foreach ( $datum as $column ) {
71
+ echo $column;
72
+ break;
73
+ } ?>
74
+ <br />
75
+ </td><td>
76
+ <select name='value_name[]'>
77
+ <!-- /* These are the current fields that can be imported with products, to add additional fields add more <option> to this dorpdown list */ -->
78
+ <option value='name'><?php _e('Product Name', 'wpsc'); ?></option>
79
+ <option value='description'><?php _e('Description', 'wpsc'); ?></option>
80
+ <option value='additional_description'><?php _e('Additional Description', 'wpsc'); ?></option>
81
+ <option value='price'><?php _e('Price', 'wpsc'); ?></option>
82
+ <option value='sku'><?php _e('SKU', 'wpsc'); ?></option>
83
+ <option value='weight'><?php _e('Weight', 'wpsc'); ?></option>
84
+ <option value='weight_unit'><?php _e('Weight Unit', 'wpsc'); ?></option>
85
+ <option value='quantity'><?php _e('Stock Quantity', 'wpsc'); ?></option>
86
+ <option value='quantity_limited'><?php _e('Stock Quantity Limit', 'wpsc'); ?></option>
87
+ </select>
88
+ </td></tr>
89
+ </table>
90
+ </div>
91
+ </div>
92
+ <?php } ?>
93
+ <label for='category'><?php _e('Please select a category you would like to place all products from this CSV into' , 'wpsc' ); ?>:</label>
94
+ <select id='category' name='category'>
95
+ <?php
96
+ foreach ( $categories as $category ) {
97
+ echo '<option value="' . $category->term_id . '">' . $category->name . '</option>';
98
+ }
99
+ ?>
100
+ </select>
101
+ <input type='submit' value='Import' class='button-primary'>
102
+ </div>
103
+ <?php
104
+ } else {
105
+ echo "<br /><br />" . __('There was an error while uploading your csv file.', 'wpsc');
106
+ }
107
+ }
108
+ if ( isset( $_POST['csv_action'] ) && ('import' == $_POST['csv_action']) ) {
109
+ global $wpdb;
110
+ $cvs_data = $_SESSION['cvs_data'];
111
+ $column_data = $_POST['column'];
112
+ $value_data = $_POST['value_name'];
113
+
114
+ $status = esc_attr($_POST['post_status']);
115
+
116
+ $name = array( );
117
+ foreach ( $value_data as $key => $value ) {
118
+
119
+ $cvs_data2[$value] = $cvs_data[$key];
120
+ }
121
+ $num = count( $cvs_data2['name'] );
122
+
123
+ for ( $i = 0; $i < $num; $i++ ) {
124
+ $product_columns = array(
125
+ 'post_title' => esc_attr( $cvs_data2['name'][$i] ),
126
+ 'content' => esc_attr( $cvs_data2['description'][$i] ),
127
+ 'additional_description' => esc_attr( $cvs_data2['additional_description'][$i] ),
128
+ 'price' => esc_attr( str_replace( '$', '', $cvs_data2['price'][$i] ) ),
129
+ 'weight' => esc_attr( $cvs_data2['weight'][$i] ),
130
+ 'weight_unit' => esc_attr( $cvs_data2['weight_unit'][$i] ),
131
+ 'pnp' => null,
132
+ 'international_pnp' => null,
133
+ 'file' => null,
134
+ 'image' => '0',
135
+ 'quantity_limited' => esc_attr( $cvs_data2['quantity_limited'][$i] ),
136
+ 'quantity' => esc_attr( $cvs_data2['quantity'][$i] ),
137
+ 'special' => null,
138
+ 'special_price' => null,
139
+ 'display_frontpage' => null,
140
+ 'notax' => null,
141
+ 'active' => null,
142
+ 'donation' => null,
143
+ 'no_shipping' => null,
144
+ 'thumbnail_image' => null,
145
+ 'thumbnail_state' => null,
146
+ 'meta' => array(
147
+ '_wpsc_price' => esc_attr( str_replace( '$', '', $cvs_data2['price'][$i] ) ),
148
+ '_wpsc_sku' => esc_attr( $cvs_data2['sku'][$i] ),
149
+ '_wpsc_stock' => esc_attr( $cvs_data2['quantity'][$i] ),
150
+ '_wpsc_limited_stock' => esc_attr( $cvs_data2['quantity_limited'][$i] ),
151
+ '_wpsc_product_metadata' => array(
152
+ 'weight' => esc_attr( $cvs_data2['weight'][$i] ),
153
+ 'weight_unit' => esc_attr( $cvs_data2['weight_unit'][$i] ),
154
+ )
155
+ )
156
+ );
157
+ $product_columns = wpsc_sanitise_product_forms( $product_columns );
158
+ // status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
159
+ $product_columns['post_status'] = $status;
160
+ $product_id = wpsc_insert_product( $product_columns );
161
+ wp_set_object_terms( $product_id , array( (int)$_POST['category'] ) , 'wpsc_product_category' );
162
+ }
163
+ echo "<br /><br />". sprintf(__("Success, your <a href='%s'>products</a> have been upload.", "wpsc"), admin_url('edit.php?post_type=wpsc-product'));
164
+ }
165
+ ?>
166
+ </div>
167
+ </form>
168
+ <?php
169
+ }
170
+ ?>
wpsc-admin/includes/settings-pages/marketing.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * options marketing is the main function for displaying the WP-Admin : Settings > Marketing page
4
+ * @access public
5
+ *
6
+ * @since 3.8
7
+ * @param null
8
+ * @return null
9
+ */
10
+ function wpsc_options_marketing() {
11
+
12
+ /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
13
+ wpsc_settings_page_update_notification(); ?>
14
+
15
+ <div class='metabox-holder'>
16
+ <?php
17
+ add_meta_box( 'wpsc_marketing_settings', __( 'Marketing Section', 'wpsc' ), 'wpsc_marketing_meta_box', 'wpsc' );
18
+ add_meta_box( 'wpsc_rss_address', __( 'RSS Address', 'wpsc' ), 'wpsc_rss_address_meta_box', 'wpsc' );
19
+ add_meta_box( 'wpsc_google_merch_center', __( 'Google Merchant Centre / Google Product Search', 'wpsc' ), 'wpsc_google_merch_center_meta_box', 'wpsc' );
20
+
21
+ do_meta_boxes( 'wpsc', 'advanced', null );
22
+ ?>
23
+
24
+ </div>
25
+
26
+ <?php
27
+
28
+ }
29
+
30
+ function wpsc_marketing_meta_box() {
31
+
32
+ $wpsc_also_bought = get_option( 'wpsc_also_bought' );
33
+ $wpsc_also_bought1 = '';
34
+
35
+ if ( '1' == $wpsc_also_bought )
36
+ $wpsc_also_bought1 = "checked ='checked'";
37
+
38
+ $wpsc_share_this = get_option( 'wpsc_share_this' );
39
+ $wpsc_share_this1 = '';
40
+
41
+ if ( '1' == $wpsc_share_this )
42
+ $wpsc_share_this1 = "checked ='checked'";
43
+
44
+ $facebook_like = get_option( 'wpsc_facebook_like' );
45
+ $facebook_like1 = '';
46
+ if ( 'on' == $facebook_like )
47
+ $facebook_like1 = "checked ='checked'";
48
+
49
+ $display_find_us = get_option( 'display_find_us' );
50
+ $display_find_us1 = '';
51
+
52
+ if ( '1' == $display_find_us )
53
+ $display_find_us1 = "checked ='checked'"; ?>
54
+
55
+
56
+ <form method='post' action='' id='cart_options' name='cart_options' class='wpsc_form_track'>
57
+ <input type='hidden' name='change-settings' value='true' />
58
+ <p>
59
+ <span class='input_label'><?php _e( 'Display Cross Sales', 'wpsc' ); ?></span>
60
+ <input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
61
+ <span class='description'> <?php _e( 'Adds the \'Users who bought this also bought\' item to the single products page.', 'wpsc' ); ?></span>
62
+ </p><br />
63
+ <p>
64
+ <span class='input_label'><?php _e( 'Show Share This (Social Bookmarks)', 'wpsc' ); ?></span>
65
+ <input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
66
+ <span class='description'> <?php _e( 'Adds the \'Share this link\' item to the single products page.', 'wpsc' ); ?></span>
67
+ </p><br />
68
+ <p>
69
+ <span class='input_label'> <?php _e( 'Display How Customer Found Us Survey', 'wpsc' ) ?></span>
70
+ <input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
71
+ <span class='description'> <?php _e( 'Adds the \'How did you find out about us\' drop-down option at checkout.', 'wpsc' ) ?></span>
72
+ </p><br />
73
+ <p>
74
+ <span class='input_label'> <?php _e( 'Display Facebook Like', 'wpsc' ) ?></span>
75
+ <input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
76
+ <input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
77
+ <span class='description'> <?php _e( 'Adds the Facebook Like button on your single products page.', 'wpsc' ) ?></span>
78
+ </p><br />
79
+ <div class="submit">
80
+ <input type='hidden' name='wpsc_admin_action' value='submit_options' />
81
+ <?php wp_nonce_field( 'update-options', 'wpsc-update-options' ); ?>
82
+ <input type='submit' class='button-primary' value='<?php _e( 'Update &raquo;', 'wpsc' ); ?>' name='form_submit' />
83
+ </div>
84
+ </form>
85
+
86
+ <?php
87
+ }
88
+
89
+ function wpsc_rss_address_meta_box() { ?>
90
+
91
+ <p><?php _e( 'People can use this RSS feed to keep up to date with your product list.', 'wpsc' ); ?></p>
92
+ <p><?php _e( 'RSS Feed Address', 'wpsc' ) ?> : <?php echo get_bloginfo( 'url' ) . "/index.php?rss=true&amp;action=product_list"; ?></p>
93
+
94
+ <?php
95
+ }
96
+
97
+ function wpsc_google_merch_center_meta_box() { ?>
98
+
99
+ <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>
100
+
101
+ <?php $google_feed_url = get_bloginfo( 'url' ) . "/index.php?rss=true&action=product_list&xmlformat=google"; ?>
102
+
103
+ <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>
104
+
105
+ <?php
106
+ }
107
+
108
+ ?>
wpsc-components/theme-engine-v1/classes/settings-tab-presentation.php → wpsc-admin/includes/settings-pages/presentation.php RENAMED
@@ -1,191 +1,223 @@
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
  }
7
 
8
- public function category_list() {
9
- global $wpdb;
10
-
11
- $current_default = esc_attr( get_option( 'wpsc_default_category' ) );
12
- $group_data = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=0' );
13
- $categorylist = "<select name='wpsc_options[wpsc_default_category]'>";
14
-
15
- if ( $current_default == 'all' )
16
- $selected = "selected='selected'";
17
- else
18
- $selected = '';
19
-
20
- $categorylist .= "<option value='all' " . $selected . " >" . __( 'Show All Products', 'wpsc' ) . "</option>";
21
 
22
- if ( $current_default == 'list' )
23
- $selected = "selected='selected'";
24
- else
25
- $selected = '';
26
-
27
- $categorylist .= "<option value='list' " . $selected . " >" . __( 'Show list of product categories', 'wpsc' ) . "</option>";
28
-
29
- $categorylist .= "<optgroup label='" . __( 'Product Categories', 'wpsc' ) . "'>";
30
- foreach ( $group_data as $group ) {
31
- $selected = "";
32
- if ( $current_default == $group->term_id )
33
- $selected = "selected='selected'";
34
- else
35
- $selected = "";
36
-
37
- $categorylist .= "<option value='" . $group->term_id . "' " . $selected . " >" . $group->name . "</option>";
38
- $category_data = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $group->term_id );
39
- if ( $category_data != null ) {
40
- foreach ( $category_data as $category ) {
41
- if ( $current_default == $category->term_id )
42
- $selected = "selected='selected'";
43
- else
44
- $selected = "";
45
- $categorylist .= "<option value='" . $category->term_id . "' " . $selected . " >" . $category->name . "</option>";
46
  }
47
- }
48
- }
49
- $categorylist .= "</optgroup>";
50
- $categorylist .= "</select>";
51
- return $categorylist;
52
- }
53
-
54
- private function theme_metabox(){
55
-
56
- $wpsc_templates = wpsc_list_product_templates();
57
- $themes_location = wpsc_check_theme_location();
58
- $themes_copied = false; //Check to see whether themes have been copied to selected Theme Folder
59
- $themes_backedup = false; //Check to see whether themes have recently been backedup
60
- $themes_in_uploads = false; //Check to see whether themes live in the uploads directory
61
-
62
- if ( isset( $_SESSION['wpsc_themes_copied'] ) && ( true == $_SESSION['wpsc_themes_copied'] ) )
63
- $themes_copied = true;
64
-
65
- if ( isset( $_SESSION['wpsc_themes_backup'] ) && ( true == $_SESSION['wpsc_themes_backup'] ) )
66
- $themes_backedup = true;
67
-
68
- if ( wpsc_count_themes_in_uploads_directory() > 0 ) {
69
- $themes_in_uploads = true;
70
-
71
- foreach( (array)$themes_location as $location )
72
- $new_location[] = str_ireplace( 'wpsc-','', $location );
73
-
74
- $themes_location = $new_location;
75
- }
76
-
77
- // Used to flush transients - @since 3.8-development
78
- if ( true === $themes_copied )
79
- do_action( 'wpsc_move_theme' );
80
-
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
-
88
- if( isset( $_SESSION['wpsc_theme_empty'] ) && ($_SESSION['wpsc_theme_empty'] == true) ) {
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;
96
- $themes_copied = false;
97
  }
98
- if ( isset( $_SESSION['wpsc_themes_copied'] ) && ($_SESSION['wpsc_themes_copied'] == true) ) {
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
108
- unset($_SESSION['wpsc_themes_copied']);
109
- unset($_SESSION['wpsc_themes_copied_results']);
110
- }
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;
119
- }
120
  ?>
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
138
- foreach($wpsc_templates as $file){
139
- $id = str_ireplace('.', '_', $file);
140
- $selected = '';
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' ) ); ?>
165
- <br style="clear:both" />
166
- </p>
167
-
168
- <br style="clear:both" />
169
- <p><?php esc_html_e( 'If you have moved your files in some other way i.e FTP, you may need to click the Flush Theme Cache. This will refresh the locations WordPress looks for your templates.' ,'wpsc' ); ?></p>
170
- <p><?php printf( __( '<a href="%s" class="button">Flush Theme Cache</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_flush_theme_transients=true', 'wpsc_flush_theme_transients' ) ); ?></p>
171
- <br style="clear:both" />
 
 
 
 
 
 
 
172
  <br style="clear:both" />
173
- </div>
174
- </div>
 
 
 
 
 
 
175
  </div>
176
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
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 +234,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 +249,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 +271,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' );
@@ -271,10 +303,10 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
271
  if ( get_option( 'list_view_quantity' ) == 1 )
272
  $list_view_quantity_value1 = 'checked="checked"';
273
  else
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 +315,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 +339,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 +361,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 +385,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 +410,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,89 +469,88 @@ 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'))
501
  $selected1 = 'checked="checked"';
502
  else
503
- $selected2 = 'checked="checked"';
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>
521
  </tr>
522
  <?php
@@ -547,24 +581,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 +618,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 +635,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 +667,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' );
@@ -672,7 +701,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
672
  } else {
673
  $dis = "";
674
  }
675
-
676
  $embed_live_search_results = get_option( 'embed_live_search_results', '0' ) == '1' ? ' checked="checked"' : '';
677
  ?>
678
  <input type='radio' onclick='jQuery("#wpsc_advanced_search").show()' value='1' name='wpsc_options[show_search]' id='show_search1' <?php echo $show_search1; ?> /> <label for='show_search1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
@@ -681,13 +710,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 +726,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 +747,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 +770,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 +799,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 +832,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 +855,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 +878,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 +906,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 +932,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 +957,7 @@ class WPSC_Settings_Tab_Presentation extends WPSC_Settings_Tab {
928
  <!-- // Adrian - options for
1
  <?php
2
+ /**
3
+ * WP e Commerce Presentation page for WP-Admin : Settings > Presentation
4
+ *
5
+ * @package wp-e-commerce
6
+ * @since 3.7
7
+ */
8
+
9
+ /**
10
+ * Metabox for theme moving
11
+ * Location: Settings > Presentation page in WP-Admin
12
+ * @access public
13
+ *
14
+ * @since 3.8
15
+ * @param null
16
+ * @return null
17
+ */
18
+ function wpsc_theme_presentation_page_metabox(){
19
+
20
+ $wpsc_templates = wpsc_list_product_templates();
21
+ $themes_location = wpsc_check_theme_location();
22
+ $themes_copied = false; //Check to see whether themes have been copied to selected Theme Folder
23
+ $themes_backedup = false; //Check to see whether themes have recently been backedup
24
+ $themes_in_uploads = false; //Check to see whether themes live in the uploads directory
25
+
26
+ if ( isset( $_SESSION['wpsc_themes_copied'] ) && ( true == $_SESSION['wpsc_themes_copied'] ) )
27
+ $themes_copied = true;
28
+
29
+ if ( isset( $_SESSION['wpsc_themes_backup'] ) && ( true == $_SESSION['wpsc_themes_backup'] ) )
30
+ $themes_backedup = true;
31
+
32
+ if ( wpsc_count_themes_in_uploads_directory() > 0 ) {
33
+ $themes_in_uploads = true;
34
+
35
+ foreach( (array)$themes_location as $location )
36
+ $new_location[] = str_ireplace( 'wpsc-','', $location );
37
+
38
+ $themes_location = $new_location;
39
  }
40
 
41
+ // Used to flush transients - @since 3.8-development
42
+ if ( true === $themes_copied )
43
+ do_action( 'wpsc_move_theme' );
 
 
 
 
 
 
 
 
 
 
44
 
45
+ ?>
46
+ <div id="poststuff" class="metabox-holder">
47
+ <div id="themes_and_appearance" class='postbox'>
48
+ <h3 class="hndle"><span><?php _e( "Advanced Theme Settings", 'wpsc' ); ?></span></h3>
49
+ <div class="inside">
50
+ <?php
51
+
52
+ if( isset( $_SESSION['wpsc_theme_empty'] ) && ($_SESSION['wpsc_theme_empty'] == true) ) {
53
+ ?>
54
+
55
+ <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
56
+ <p><?php _e('You did not specify any template files to be moved.','wpsc'); ?></p>
57
+ </div>
58
+ <?php
59
+ $_SESSION['wpsc_theme_empty'] = false;
60
+ $themes_copied = false;
 
 
 
 
 
 
 
 
61
  }
62
+ if ( isset( $_SESSION['wpsc_themes_copied'] ) && ($_SESSION['wpsc_themes_copied'] == true) ) {
63
+ ?>
64
+ <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
65
+ <?php if(in_array(false, $_SESSION['wpsc_themes_copied_results'], true)): ?>
66
+ <p style="color:red;"><?php _e( "Error: some files could not be copied. Please make sure that theme folder is writable.", 'wpsc' ); ?></p>
67
+ <?php else: ?>
68
+ <p><?php _e( "Thanks, the themes have been copied.", 'wpsc' ); ?></p>
69
+ <?php endif; ?>
70
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  <?php
72
+ unset($_SESSION['wpsc_themes_copied']);
73
+ unset($_SESSION['wpsc_themes_copied_results']);
 
 
 
 
 
 
 
 
74
  }
75
+ if ( isset( $_SESSION['wpsc_themes_backup'] ) && ($_SESSION['wpsc_themes_backup'] == true) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  ?>
77
+ <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);">
78
+ <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>
79
+ <p>URL: <?php echo "/" . str_replace( ABSPATH, "", WPSC_THEME_BACKUP_DIR ); ?></p>
80
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
81
  <?php
82
+ $_SESSION['wpsc_themes_backup'] = false;
83
+ }
84
+ ?>
85
+ <p>
86
+ <?php if(false !== $themes_location)
87
+ //Some themes have been moved to the themes folder
88
+ _e('Some Theme files have been moved to your WordPress Theme Folder.','wpsc');
89
+ else
90
+ _e('No Theme files have been moved to your WordPress Theme Folder.','wpsc');
91
+
92
+ ?>
93
+
94
+ </p>
95
+ <p>
96
+ <?php _e('WP e-Commerce provides you the ability to move your theme files to a safe place for theming control.
97
+
98
+ 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'); ?>
99
+ </p>
100
+ <ul>
101
+ <?php
102
+ foreach($wpsc_templates as $file){
103
+ $id = str_ireplace('.', '_', $file);
104
+ $selected = '';
105
+ if(false !== array_search($file, (array)$themes_location))
106
+ $selected = 'checked="checked"';
107
  ?>
108
+ <li><input type='checkbox' id='<?php echo $id; ?>' <?php echo $selected; ?> value='<?php esc_attr_e( $file ); ?>' name='wpsc_templates_to_port[]' />
109
+ <label for='<?php echo $id; ?>'><?php esc_attr_e( $file ); ?></label></li>
110
+ <?php } ?>
111
+ </ul>
112
+ <p>
113
+ <?php if(false !== $themes_location){
114
+ _e('To change the look of certain aspects of your shop, you can edit the moved files that are found here:','wpsc');
115
+ ?>
116
+ </p>
117
+ <p class="howto"> <?php echo get_stylesheet_directory(); ?></p>
118
+ <?php } ?>
119
+ <p><?php
120
+ wp_nonce_field('wpsc_copy_themes');
121
+ ?>
122
+ <input type='submit' value='Move Template Files &rarr;' class="button" name='wpsc_move_themes' />
123
+ </p>
124
+ <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>
125
+ <p class="howto"> /wp-content/uploads/wpsc/theme_backup/ </p>
126
+ <p>
127
+ <?php
128
+ printf( __( '<a href="%s" class="button">Backup Your WordPress Theme</a>', 'wpsc' ), wp_nonce_url( 'admin.php?wpsc_admin_action=backup_themes', 'backup_themes' ) ); ?>
129
  <br style="clear:both" />
130
+ </p>
131
+
132
+ <br style="clear:both" />
133
+ <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>
134
+ <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>
135
+ <br style="clear:both" />
136
+ <br style="clear:both" />
137
+ </div>
138
  </div>
139
+ </div>
140
+ <?php
141
+ }
142
+
143
+ /**
144
+ * options categorylist provides a drop down of different options for displaying the products page
145
+ * @access public
146
+ *
147
+ * @since 3.7
148
+ * @param null
149
+ * @return $categorylist XHTML markup
150
+ */
151
+ function options_categorylist() {
152
+ global $wpdb;
153
+
154
+ $current_default = esc_attr( get_option( 'wpsc_default_category' ) );
155
+ $group_data = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=0' );
156
+ $categorylist = "<select name='wpsc_options[wpsc_default_category]'>";
157
+
158
+ if ( $current_default == 'all' )
159
+ $selected = "selected='selected'";
160
+ else
161
+ $selected = '';
162
+
163
+ $categorylist .= "<option value='all' " . $selected . " >" . __( 'Show All Products', 'wpsc' ) . "</option>";
164
+
165
+ if ( $current_default == 'list' )
166
+ $selected = "selected='selected'";
167
+ else
168
+ $selected = '';
169
+
170
+ $categorylist .= "<option value='list' " . $selected . " >" . __( 'Show list of product categories', 'wpsc' ) . "</option>";
171
+
172
+ $categorylist .= "<optgroup label='Product Categories'>";
173
+ foreach ( $group_data as $group ) {
174
+ $selected = "";
175
+ if ( $current_default == $group->term_id )
176
+ $selected = "selected='selected'";
177
+ else
178
+ $selected = "";
179
+
180
+ $categorylist .= "<option value='" . $group->term_id . "' " . $selected . " >" . $group->name . "</option>";
181
+ $category_data = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $group->term_id );
182
+ if ( $category_data != null ) {
183
+ foreach ( $category_data as $category ) {
184
+ if ( $current_default == $category->term_id )
185
+ $selected = "selected='selected'";
186
+ else
187
+ $selected = "";
188
+ $categorylist .= "<option value='" . $category->term_id . "' " . $selected . " >" . $category->name . "</option>";
189
+ }
190
+ }
191
  }
192
+ $categorylist .= "</optgroup>";
193
+ $categorylist .= "</select>";
194
+ return $categorylist;
195
+ }
196
+
197
+ /**
198
+ * options presentation is the main function for displaying the WP-Admin : Settings > Presentation page
199
+ * @access public
200
+ *
201
+ * @since 3.7
202
+ * @param null
203
+ * @return null
204
+ */
205
+ function wpsc_options_presentation() {
206
+ global $wpdb;
207
+
208
+ ?>
209
+
210
+ <form name='cart_options' id='cart_options' method='post' action='' class='wpsc_form_track'>
211
+ <div id="options_presentation">
212
 
213
+ <?php wpsc_settings_page_update_notification(); ?>
 
 
214
 
215
+ <div class='product_and_button_settings'>
216
+ <h3 class="form_group"><?php _e( 'Button Settings', 'wpsc' ); ?></h3>
217
 
218
+ <table class='wpsc_options form-table'>
 
219
  <tr>
220
+ <th scope="row"><?php _e( 'Button Type', 'wpsc' ); ?>:</th>
221
  <td>
222
  <?php
223
  $addtocart_or_buynow = get_option( 'addtocart_or_buynow' );
234
  }
235
  ?>
236
  <input type='radio' value='0' name='wpsc_options[addtocart_or_buynow]' id='addtocart_or_buynow1' <?php echo $addtocart_or_buynow1; ?> />
237
+ <label for='addtocart_or_buynow1'><?php _e( 'Add To Cart', 'wpsc' ); ?></label> &nbsp;<br />
238
  <?php $selected_gateways = get_option( 'custom_gateway_options' );
239
  $disable_buy_now = '';
240
  $message = '';
241
+ if (!in_array( 'wpsc_merchant_paypal_standard', (array)$selected_gateways )){
242
  $disable_buy_now = 'disabled="disabled"';
243
+ $message = __('Buy Now Button only works for Paypal Standard, please activate Paypal Standard to enable this option.','wpsc');
244
  } ?>
245
  <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; ?> />
246
  <label for='addtocart_or_buynow2'><?php _e( 'Buy Now', 'wpsc' ); ?></label><br />
249
  </tr>
250
 
251
  <tr>
252
+ <th scope="row"><?php _e( 'Hide "Add to cart" button', 'wpsc' ); ?>: </th>
253
  <td>
254
  <?php
255
  $hide_addtocart_button = get_option( 'hide_addtocart_button' );
271
  </tr>
272
  </table>
273
 
274
+ <h3 class="form_group"><?php _e( 'Product Settings', 'wpsc' ); ?></h3>
275
 
276
  <table class='wpsc_options form-table'>
277
 
278
  <tr>
279
+ <th scope="row"><?php _e( 'Show Product Ratings', 'wpsc' ); ?>:</th>
280
  <td>
281
  <?php
282
  $display_pnp = get_option( 'product_ratings' );
303
  if ( get_option( 'list_view_quantity' ) == 1 )
304
  $list_view_quantity_value1 = 'checked="checked"';
305
  else
306
+ $list_view_quantity_value2 = 'checked="checked"';
307
  ?>
308
  <th scope="row">
309
+ <?php _e('Show Stock Availability','wpsc'); ?>
310
  </th>
311
  <td>
312
  <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;
315
  </tr>
316
  <tr>
317
  <th scope="row">
318
+ <?php _e( 'Display Fancy Purchase Notifications', 'wpsc' ); ?>:
319
  </th>
320
  <td>
321
  <?php
339
 
340
 
341
  <tr>
342
+ <th scope="row"><?php _e( 'Display per item shipping', 'wpsc' ); ?>:</th>
343
  <td>
344
  <?php
345
  $display_pnp = get_option( 'display_pnp' );
361
  </tr>
362
 
363
  <tr>
364
+ <th scope="row"><?php _e( 'Disable link in Title', 'wpsc' ); ?>: </th>
365
  <td>
366
  <?php
367
  $hide_name_link = get_option( 'hide_name_link' );
385
  </tr>
386
 
387
  <tr>
388
+ <th scope="row"><?php _e( 'Add quantity field to each product description', 'wpsc' ); ?>:</th>
389
  <td>
390
  <?php
391
  $multi_adding = get_option( 'multi_add' );
410
  </table>
411
  </div>
412
 
413
+ <?php wpsc_theme_presentation_page_metabox(); ?>
414
 
415
+ <div style='clear:both;'></div>
416
+
417
+ <h3 class="form_group"><?php _e( 'Product Page Settings', 'wpsc' ); ?></h3>
418
  <table class='wpsc_options form-table'>
419
  <tr>
420
+ <th scope="row"><?php _e( 'Product Display', 'wpsc' ); ?>:</th>
421
  <td>
422
  <?php
423
  $display_pnp = get_option( 'product_view' );
469
  }
470
  ?>
471
  <select name='wpsc_options[product_view]'>
472
+ <option value='default' <?php echo $product_view1; ?>><?php _e( 'Default View', 'wpsc' ); ?></option>
473
  <?php
474
  if ( function_exists( 'product_display_list' ) ) {
475
  ?>
476
+ <option value='list' <?php echo $product_view2; ?>><?php _e( 'List View', 'wpsc' ); ?></option>
477
  <?php
478
  } else {
479
  ?>
480
+ <option value='list' disabled='disabled' <?php echo $product_view2; ?>><?php _e( 'List View', 'wpsc' ); ?></option>
481
  <?php
482
  }
483
 
484
  if ( function_exists( 'product_display_grid' ) ) {
485
  ?>
486
+ <option value='grid' <?php echo $product_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
487
  <?php
488
  } else {
489
  ?>
490
+ <option value='grid' disabled='disabled' <?php echo $product_view3; ?>><?php _e( 'Grid View', 'wpsc' ); ?></option>
491
  <?php
492
  }
493
  ?>
494
  </select>
495
  <?php
496
+ if ( !function_exists( 'product_display_grid' ) ) {
497
+ ?><a href='http://getshopped.org/extend/premium-upgrades'><?php _e( 'Purchase unavailable options', 'wpsc' ); ?></a> <?php
 
 
498
  }
499
  ?>
500
  </td>
501
  </tr>
502
+
503
+
504
  <tr id="wpsc-grid-settings">
505
+ <th scope="row"><?php _e( 'Grid view settings:', 'wpsc' ) ?></th>
506
  <td>
507
+ <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' ) ); ?>' />
508
+ <label for='grid_number_per_row'><?php _e( 'Products Per Row', 'wpsc' ); ?></label><br />
509
 
510
  <input type='hidden' value='0' name='wpsc_options[show_images_only]' />
511
+ <input type='checkbox' value='1' name='wpsc_options[show_images_only]' id='show_images_only' <?php echo $show_images_only_value; ?> />
512
+ <label for='show_images_only'><?php _e( 'Show images only', 'wpsc' ); ?></label><br />
513
 
514
  <input type='hidden' value='0' name='wpsc_options[display_variations]' />
515
+ <input type='checkbox' value='1' name='wpsc_options[display_variations]' id='display_variations' <?php echo $display_variations; ?> />
516
+ <label for='display_variations'><?php _e( 'Display Variations', 'wpsc' ); ?></label><br />
517
 
518
  <input type='hidden' value='0' name='wpsc_options[display_description]' />
519
+ <input type='checkbox' value='1' name='wpsc_options[display_description]' id='display_description' <?php echo $display_description; ?> />
520
+ <label for='display_description'><?php _e( 'Display Description', 'wpsc' ); ?></label><br />
521
 
522
  <input type='hidden' value='0' name='wpsc_options[display_addtocart]' />
523
+ <input type='checkbox' value='1' name='wpsc_options[display_addtocart]' id='display_addtocart' <?php echo $display_addtocart; ?> />
524
+ <label for='display_addtocart'><?php _e( 'Display "Add To Cart" Button', 'wpsc' ); ?></label><br />
525
 
526
  <input type='hidden' value='0' name='wpsc_options[display_moredetails]' />
527
+ <input type='checkbox' value='1' name='wpsc_options[display_moredetails]' id='display_moredetails' <?php echo $display_moredetails; ?> />
528
+ <label for='display_moredetails'><?php _e( 'Display "More Details" Button', 'wpsc' ); ?></label>
529
  </td>
530
  </tr>
531
+
532
+
533
  <?php
534
  $selected1 = $selected2 = '';
535
  if(get_option('wpsc_display_categories'))
536
  $selected1 = 'checked="checked"';
537
  else
538
+ $selected2 = 'checked="checked"';
539
  ?>
540
+
541
  <tr>
542
+ <th scope="row"><?php _e('Show list of categories','wpsc'); ?></th>
543
  <td>
544
+ <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>
 
545
  <input type='radio' value='0' name='wpsc_options[wpsc_display_categories]' id='display_categories1' <?php echo $selected2; ?> />
546
  <label for='display_categories1'><?php _e( 'No', 'wpsc' ); ?></label><br />
547
  </td>
548
  </tr>
549
+
550
  <tr>
551
+ <th scope="row"><?php _e( 'Select what product category you want to display on the products page', 'wpsc' ); ?>:</th>
552
  <td>
553
+ <?php echo options_categorylist(); ?>
554
  </td>
555
  </tr>
556
  <?php
581
  <td>
582
  <select name='wpsc_options[wpsc_sort_by]'>
583
  <option <?php if ( isset( $wpsc_sort_by1 ) )
584
+ echo $wpsc_sort_by1; ?> value='name'><?php _e( 'Name', 'wpsc' ); ?></option>
585
  <option <?php if ( isset( $wpsc_sort_by2 ) )
586
+ echo $wpsc_sort_by2; ?> value='price'><?php _e( 'Price', 'wpsc' ); ?></option>
587
  <option <?php if ( isset( $wpsc_sort_by4 ) )
588
+ echo $wpsc_sort_by4; ?> value='dragndrop'><?php _e( 'Drag &amp; Drop', 'wpsc' ); ?></option>
589
  <option <?php if ( isset( $wpsc_sort_by3 ) )
590
+ echo $wpsc_sort_by3; ?> value='id'><?php _e( 'Time Uploaded', 'wpsc' ); ?></option>
591
  </select>
 
 
 
 
 
592
  </td>
593
  </tr>
594
 
595
  <tr>
596
+ <th scope="row"><?php _e( 'Show Breadcrumbs', 'wpsc' ); ?>:</th>
597
  <td>
598
  <?php
599
  $show_breadcrumbs = get_option( 'show_breadcrumbs' );
618
 
619
  <tr>
620
  <th scope="row">
621
+ <?php _e( 'Product Groups/Products Display', 'wpsc' ); ?>:
622
  </th>
623
  <td>
624
  <?php
635
  break;
636
  }
637
  ?>
638
+ <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;
639
  <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>
640
  </td>
641
  </tr>
642
+
643
  <tr>
644
  <th scope="row">
645
+ <?php echo __( 'Show Subcategory Products in Parent Category', 'wpsc' ); ?>:
646
  </th>
647
  <td>
648
  <?php
667
  if ( function_exists( 'gold_shpcrt_search_form' ) ) {
668
  ?>
669
  <tr>
670
+ <th scope="row"><?php _e( 'Show Search', 'wpsc' ); ?>:</th>
671
  <td>
672
  <?php
673
  $display_pnp = get_option( 'show_search' );
701
  } else {
702
  $dis = "";
703
  }
704
+
705
  $embed_live_search_results = get_option( 'embed_live_search_results', '0' ) == '1' ? ' checked="checked"' : '';
706
  ?>
707
  <input type='radio' onclick='jQuery("#wpsc_advanced_search").show()' value='1' name='wpsc_options[show_search]' id='show_search1' <?php echo $show_search1; ?> /> <label for='show_search1'><?php _e( 'Yes', 'wpsc' ); ?></label> &nbsp;
710
  <div <?php echo $dis; ?> id='wpsc_advanced_search'>
711
  <input type='hidden' name='wpsc_options[show_advanced_search]' value='0' />
712
  <input type='checkbox' name='wpsc_options[show_advanced_search]' id='show_advanced_search' <?php echo $show_advanced_search; ?> value='1' />
713
+ <?php _e( 'Show Advanced Search', 'wpsc' ); ?><br />
714
  <input type='hidden' name='wpsc_options[show_live_search]' value='0' />
715
  <input type='checkbox' name='wpsc_options[show_live_search]' id='show_live_search' <?php echo $show_live_search; ?> value='1' />
716
+ <?php _e( 'Use Live Search', 'wpsc' ); ?><br />
717
  <input type='hidden' name='wpsc_options[embed_live_search_results]' value='0' />
718
  <input type='checkbox' name='wpsc_options[embed_live_search_results]' id='embed_live_search_results'<?php echo $embed_live_search_results; ?> value='1' />
719
+ <?php _e( 'Dynamically replace search results into product list' ); ?>
720
  </div>
721
  </td>
722
  </tr>
726
 
727
 
728
  <tr>
729
+ <th scope="row"><?php _e( 'Replace Page Title With Product/Category Name', 'wpsc' ); ?>:</th>
730
  <td>
731
  <?php
732
  $wpsc_replace_page_title = get_option( 'wpsc_replace_page_title' );
747
  </td>
748
  </tr>
749
  <tr>
750
+ <th scope="row"><?php _e( 'Display Featured Product above Product Pages', 'wpsc' ); ?>:</th>
751
  <td>
752
  <?php
753
  $wpsc_hide_featured_products = get_option( 'wpsc_hide_featured_products' );
770
  </tr>
771
  </table>
772
 
773
+ <h3 class="form_group"><?php _e( 'Shopping Cart Settings', 'wpsc' ); ?></h3>
774
  <table class='wpsc_options form-table'>
775
  <tr>
776
+ <th scope="row"><?php _e( 'Cart Location', 'wpsc' ); ?>:</th>
777
  <td>
778
  <?php
779
  $cart_location = get_option( 'cart_location' );
799
  break;
800
  }
801
  ?>
802
+ <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;
803
  <?php
804
  if ( function_exists( 'wp_register_sidebar_widget' ) ) {
805
  ?>
806
+ <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;
807
  <?php
808
  } else {
809
  ?>
810
+ <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;
811
  <?php
812
  }
813
 
814
  if ( function_exists( 'drag_and_drop_cart_ajax' ) ) {
815
  ?>
816
+ <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;
817
  <?php
818
  } else {
819
  ?>
820
+ <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 ) )
821
+ 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;
822
  <?php
823
  }
824
  ?>
825
  <input type='radio' onclick='hideelement1("dropshop_option", this.value)' value='3' name='wpsc_options[cart_location]' id='cart3' <?php if ( isset( $cart3 ) )
826
+ 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>
827
  <div style='display: <?php if ( !empty( $cart5 ) ) {
828
  echo "block";
829
  } else {
832
  <p>
833
  <input type="radio" id="drop1" value="all" <?php if ( get_option( 'dropshop_display' ) == 'all' ) {
834
  echo "checked='checked'";
835
+ } ?> name="wpsc_options[dropshop_display]" /><label for="drop1"><?php _e( 'Show Dropshop on every page', 'wpsc' ); ?></label>
836
  <input type="radio" id="drop2" value="product" <?php if ( get_option( 'dropshop_display' ) == 'product' ) {
837
  echo "checked='checked'";
838
+ } ?> name="wpsc_options[dropshop_display]"/><label for="drop2"><?php _e( 'Show Dropshop only on product page', 'wpsc' ); ?></label>
839
  </p>
840
  <p>
841
  <input type="radio" id="wpsc_dropshop_theme1" value="light" <?php if ( get_option( 'wpsc_dropshop_theme' ) != 'dark' ) {
842
  echo "checked='checked'";
843
+ } ?> name="wpsc_options[wpsc_dropshop_theme]" /><label for="wpsc_dropshop_theme1"><?php _e( 'Use light Dropshop style', 'wpsc' ); ?></label>
844
  <input type="radio" id="wpsc_dropshop_theme2" value="dark" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'dark' ) {
845
  echo "checked='checked'";
846
+ } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php _e( 'Use dark Dropshop style', 'wpsc' ); ?></label>
847
  <input type="radio" id="wpsc_dropshop_theme3" value="craftyc" <?php if ( get_option( 'wpsc_dropshop_theme' ) == 'craftyc' ) {
848
  echo "checked='checked'";
849
+ } ?> name="wpsc_options[wpsc_dropshop_theme]"/><label for="wpsc_dropshop_theme2"><?php _e( 'Crafty', 'wpsc' ); ?></label>
850
 
851
  </p>
852
  </div>
855
 
856
  <tr>
857
  <th scope="row">
858
+ <?php _e( 'Display "+ Postage & Tax"', 'wpsc' ); ?>:
859
  </th>
860
  <td>
861
  <?php
878
  </tr>
879
  </table>
880
 
881
+ <h3 class="form_group"><?php _e( 'Product Category Settings', 'wpsc' ); ?></h3>
882
  <table class='wpsc_options form-table'>
883
 
884
  <tr>
885
+ <th scope="row"><?php _e( 'Show Product Category Description', 'wpsc' ); ?>:</th>
886
  <td>
887
  <?php
888
  $wpsc_category_description = get_option( 'wpsc_category_description' );
906
 
907
  <tr>
908
  <th scope="row">
909
+ <?php _e( 'Show Product Category Thumbnails', 'wpsc' ); ?>:
910
  </th>
911
  <td>
912
  <?php
932
 
933
  <tr>
934
  <th scope="row">
935
+ <?php _e( 'Show Product Count per Product Category', 'wpsc' ); ?>:
936
  </th>
937
  <td>
938
  <?php
957
  <!-- // Adrian - options for