WP eCommerce - Version 3.8.13.1

Version Description

  • Security and maintenance release.
Download this release

Release Info

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

Code changes from version 3.8.13-beta to 3.8.13.1

Files changed (63) hide show
  1. .gitignore +0 -2
  2. readme.md +4 -4
  3. readme.txt +13 -3
  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. wp-shopping-cart.php +1 -1
  9. wpsc-admin/db-upgrades/routines/8.php +13 -0
  10. wpsc-admin/display-coupon-add.php +1 -1
  11. wpsc-admin/display-coupon-edit.php +1 -1
  12. wpsc-admin/includes/display-items-functions.php +3 -3
  13. wpsc-admin/includes/product-functions.php +34 -17
  14. wpsc-admin/includes/product-variations-setup.page.php +1 -1
  15. wpsc-admin/includes/purchase-log-list-table-class.php +3 -3
  16. wpsc-admin/includes/settings-tabs/checkout.php +2 -2
  17. wpsc-admin/includes/settings-tabs/gateway.php +1 -1
  18. wpsc-admin/includes/settings-tabs/general.php +1 -1
  19. wpsc-admin/includes/settings-tabs/shipping.php +2 -2
  20. wpsc-admin/init.php +1 -1
  21. wpsc-admin/js/admin.js +1 -1
  22. wpsc-admin/settings-page.php +6 -3
  23. wpsc-components/marketplace-core-v1/library/Sputnik.php +11 -16
  24. wpsc-components/marketplace-core-v1/library/Sputnik/API.php +8 -10
  25. wpsc-components/marketplace-core-v1/library/Sputnik/API/Auth.php +7 -1
  26. wpsc-components/marketplace-core-v1/library/Sputnik/Admin.php +11 -4
  27. wpsc-components/marketplace-core-v1/library/Sputnik/List/Account.php +2 -2
  28. wpsc-components/marketplace-core-v1/library/Sputnik/List/Install.php +6 -7
  29. wpsc-components/marketplace-core-v1/library/Sputnik/OAuth/Server.php +3 -0
  30. wpsc-components/marketplace-core-v1/library/Sputnik/Upgrader/Skin.php +2 -2
  31. wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser/Grid.php +2 -2
  32. wpsc-components/marketplace-core-v1/static/admin.css +26 -21
  33. wpsc-components/marketplace-core-v1/static/admin.js +6 -0
  34. wpsc-components/marketplace-core-v1/static/modal.css +2 -2
  35. wpsc-components/theme-engine-v1/helpers/ajax.php +67 -106
  36. wpsc-components/theme-engine-v1/helpers/page.php +1 -1
  37. wpsc-components/theme-engine-v1/helpers/product.php +16 -10
  38. wpsc-components/theme-engine-v1/templates/wpsc-shopping_cart_page.php +1 -1
  39. wpsc-core/js/wp-e-commerce.js +29 -0
  40. wpsc-core/wpsc-constants.php +28 -7
  41. wpsc-core/wpsc-deprecated.php +6 -2
  42. wpsc-core/wpsc-functions.php +12 -7
  43. wpsc-core/wpsc-installer.php +2 -2
  44. wpsc-includes/cart-item.class.php +61 -46
  45. wpsc-includes/cart.class.php +43 -33
  46. wpsc-includes/checkout.class.php +7 -1
  47. wpsc-includes/currency.helpers.php +25 -15
  48. wpsc-includes/currency_converter.inc.php +19 -44
  49. wpsc-includes/customer.php +46 -33
  50. wpsc-includes/merchant.class.php +1 -1
  51. wpsc-includes/misc.functions.php +40 -0
  52. wpsc-includes/page-about.php +136 -0
  53. wpsc-includes/purchase-log-notification.class.php +12 -9
  54. wpsc-includes/wpsc-meta-cart-item.php +2 -2
  55. wpsc-includes/wpsc-meta-functions-template.txt +0 -186
  56. wpsc-includes/wpsc-meta-visitor.php +0 -194
  57. wpsc-merchants/GoogleCheckout-XML.php +0 -2
  58. wpsc-merchants/paypal-pro.merchant.php +1 -1
  59. wpsc-merchants/paypal-standard.merchant.php +1 -1
  60. wpsc-shipping/flatrate.php +2 -2
  61. wpsc-shipping/usps_20.php +1 -3
  62. wpsc-taxes/controllers/taxes_controller.class.php +1 -1
  63. wpsc-updates/currency_list.php +2 -2
.gitignore DELETED
@@ -1,2 +0,0 @@
1
- cookbooks
2
- tmp
 
 
readme.md CHANGED
@@ -15,10 +15,10 @@ If you're looking for general user support, please submit your support request o
15
  Development status
16
  -------------------------
17
 
18
- * The latest stable version is [3.8.12](http://wordpress.org/extend/plugins/wp-e-commerce).
19
- * Active development version: 3.8.13-dev (branch [master](https://github.com/wp-e-commerce/WP-e-Commerce))
20
- * [Roadmap for 3.8.13](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Roadmap)
21
- * [3.8.13 tickets](https://github.com/wp-e-commerce/wp-e-commerce/issues?milestone=11&sort=updated&state=open)
22
 
23
  How to contribute code
24
  -----------------------------
15
  Development status
16
  -------------------------
17
 
18
+ * The latest stable version is [3.8.13](http://wordpress.org/extend/plugins/wp-e-commerce).
19
+ * Active development version: 3.8.14-dev (branch [master](https://github.com/wp-e-commerce/WP-e-Commerce))
20
+ * [Roadmap for 3.8.14](https://github.com/wp-e-commerce/wp-e-commerce/wiki/Roadmap)
21
+ * [3.8.14 tickets](https://github.com/wp-e-commerce/wp-e-commerce/issues?milestone=12&sort=updated&state=open)
22
 
23
  How to contribute code
24
  -----------------------------
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: mufasa, garyc40, JustinSainton
3
  Donate link: http://getshopped.org
4
  Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
- Requires at least: 3.5
6
- Tested up to: 3.7
7
- Stable tag: 3.8.12.1
8
 
9
  WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
10
 
@@ -146,6 +146,10 @@ After upgrading from earlier versions look for link "Update Store". This will up
146
 
147
  == Changelog ==
148
 
 
 
 
 
149
  = 3.8.13 =
150
 
151
  * New: Product Media UI.
@@ -162,6 +166,7 @@ After upgrading from earlier versions look for link "Update Store". This will up
162
  * Change: Replace default noimage.png with a better image.
163
  * Change: Updated NL language
164
  * Change: Updated german language strings
 
165
  * 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.
166
  * Fix: Change wpsc_get_remaining_quantity() to call the method dynamically, rather than statically. The previous behaviour caused a strict standards warning.
167
  * Fix: Database Upgrade Routine to rename old _wpsc_* product metadata array keys so they no longer include the '_wpsc_' prefix
@@ -178,6 +183,11 @@ After upgrading from earlier versions look for link "Update Store". This will up
178
  * Fix: redundant product thumbnail is displayed on category / single product list.
179
  * Fix: variation checkbox column width in WP 3.7.
180
  * Fix: Out of stock message for variations now correctly shows variation of product for the title, rather than main product.
 
 
 
 
 
181
 
182
  = 3.8.12.1 =
183
  * Fix: Fatal error in wpsc_product_list_exclude_child_categories() due to other themes
2
  Contributors: mufasa, garyc40, JustinSainton
3
  Donate link: http://getshopped.org
4
  Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
+ Requires at least: 3.7
6
+ Tested up to: 3.8
7
+ Stable tag: 3.8.13.1
8
 
9
  WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
10
 
146
 
147
  == Changelog ==
148
 
149
+ = 3.8.13.1 =
150
+
151
+ * Security and maintenance release.
152
+
153
  = 3.8.13 =
154
 
155
  * New: Product Media UI.
166
  * Change: Replace default noimage.png with a better image.
167
  * Change: Updated NL language
168
  * Change: Updated german language strings
169
+ * Change: Use new spinner image in WordPress 3.8
170
  * 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.
171
  * Fix: Change wpsc_get_remaining_quantity() to call the method dynamically, rather than statically. The previous behaviour caused a strict standards warning.
172
  * Fix: Database Upgrade Routine to rename old _wpsc_* product metadata array keys so they no longer include the '_wpsc_' prefix
183
  * Fix: redundant product thumbnail is displayed on category / single product list.
184
  * Fix: variation checkbox column width in WP 3.7.
185
  * Fix: Out of stock message for variations now correctly shows variation of product for the title, rather than main product.
186
+ * Fix: Use proper link in checkout for variation products.
187
+ * Fix: Return tax information in switchmethod() JS function.
188
+ * Fix: Resolve conflict with Advanced Custom Fields on save_post hook for products.
189
+ * Fix: Update Bulgarian Currency symbol.
190
+ * Fix: Resolve issue where updating pages causes rewrite rule conflicts when pretty permalinks are enabled.
191
 
192
  = 3.8.12.1 =
193
  * Fix: Fatal error in wpsc_product_list_exclude_child_categories() due to other themes
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
wp-shopping-cart.php CHANGED
@@ -3,7 +3,7 @@
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.13-beta
7
  * Author: Instinct Entertainment
8
  * Author URI: http://getshopped.org/
9
  **/
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.13.1
7
  * Author: Instinct Entertainment
8
  * Author URI: http://getshopped.org/
9
  **/
wpsc-admin/db-upgrades/routines/8.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
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( 'BG', 'isocode' );
9
+ $country->set( array(
10
+ 'code' => __( 'BGN', 'wpsc' ),
11
+ ) );
12
+ $country->save();
13
+ }
wpsc-admin/display-coupon-add.php CHANGED
@@ -90,7 +90,7 @@
90
  </th>
91
  <td>
92
  <input type="hidden" name="rules[operator][]" value="" />
93
- <div class='coupon-condition' >
94
  <select class="ruleprops" name="rules[property][]">
95
  <option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
96
  <option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
90
  </th>
91
  <td>
92
  <input type="hidden" name="rules[operator][]" value="" />
93
+ <div class='coupon-condition'>
94
  <select class="ruleprops" name="rules[property][]">
95
  <option value="item_name" rel="order"><?php _e( 'Item name', 'wpsc' ); ?></option>
96
  <option value="item_quantity" rel="order"><?php _e( 'Item quantity', 'wpsc' ); ?></option>
wpsc-admin/display-coupon-edit.php CHANGED
@@ -7,7 +7,7 @@ if( !defined( 'ABSPATH' ) )
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
 
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
 
wpsc-admin/includes/display-items-functions.php CHANGED
@@ -727,15 +727,15 @@ function wpsc_product_advanced_forms() {
727
  <td class='itemfirstcol' colspan='2'><br />
728
  <strong><?php esc_html_e( 'Personalisation Options', 'wpsc' ); ?>:</strong><br />
729
  <input type='hidden' name='meta[_wpsc_product_metadata][engraved]' value='0' />
730
- <input type='checkbox' name='meta[_wpsc_product_metadata][engraved]' <?php echo ( ( $product_meta['engraved'] == true ) ? 'checked="checked"' : '' ); ?> id='add_engrave_text' />
731
- <label for='add_engrave_text'><?php esc_html_e( 'Users can personalize this Product by leaving a message on single product page', 'wpsc' ); ?></label>
732
  <br />
733
  </td>
734
  </tr>
735
  <tr>
736
  <td class='itemfirstcol' colspan='2'>
737
  <input type='hidden' name='meta[_wpsc_product_metadata][can_have_uploaded_image]' value='0' />
738
- <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' />
739
  <label for='can_have_uploaded_image'> <?php esc_html_e( 'Users can upload images on single product page to purchase logs.', 'wpsc' ); ?> </label>
740
  <br />
741
  </td>
727
  <td class='itemfirstcol' colspan='2'><br />
728
  <strong><?php esc_html_e( 'Personalisation Options', 'wpsc' ); ?>:</strong><br />
729
  <input type='hidden' name='meta[_wpsc_product_metadata][engraved]' value='0' />
730
+ <input type='checkbox' name='meta[_wpsc_product_metadata][engraved]' <?php checked( $product_meta['engraved'], '1' ); ?> id='add_engrave_text' />
731
+ <label for='add_engrave_text'><?php esc_html_e( 'Users can personalize this product by leaving a message on single product page', 'wpsc' ); ?></label>
732
  <br />
733
  </td>
734
  </tr>
735
  <tr>
736
  <td class='itemfirstcol' colspan='2'>
737
  <input type='hidden' name='meta[_wpsc_product_metadata][can_have_uploaded_image]' value='0' />
738
+ <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' />
739
  <label for='can_have_uploaded_image'> <?php esc_html_e( 'Users can upload images on single product page to purchase logs.', 'wpsc' ); ?> </label>
740
  <br />
741
  </td>
wpsc-admin/includes/product-functions.php CHANGED
@@ -18,28 +18,39 @@ function wpsc_get_max_upload_size(){
18
  * @return nothing
19
  */
20
  function wpsc_admin_submit_product( $post_ID, $post ) {
21
- global $wpdb;
 
22
 
23
- $current_screen = get_current_screen();
24
 
25
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || empty( $current_screen ) || $current_screen->id != 'wpsc-product' || $post->post_type != 'wpsc-product' || empty( $_POST['meta'] ) )
26
- return $post_ID;
27
 
28
  //Type-casting ( not so much sanitization, which would be good to do )
29
- $post_data = stripslashes_deep( $_POST );
30
  $product_id = $post_ID;
31
- $post_data['additional_description'] = isset($post_data['additional_description']) ? $post_data['additional_description'] : '';
32
- $post_meta['meta'] = (array)$_POST['meta'];
 
 
 
 
 
33
  if ( isset( $post_data['meta']['_wpsc_price'] ) )
34
  $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
 
35
  if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
36
  $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
37
- if($post_data['meta']['_wpsc_sku'] == __('N/A', 'wpsc'))
 
38
  $post_data['meta']['_wpsc_sku'] = '';
 
 
39
  if( isset( $post_data['meta']['_wpsc_is_donation'] ) )
40
  $post_data['meta']['_wpsc_is_donation'] = 1;
41
  else
42
  $post_data['meta']['_wpsc_is_donation'] = 0;
 
43
  if ( ! isset( $post_data['meta']['_wpsc_limited_stock'] ) ){
44
  $post_data['meta']['_wpsc_stock'] = false;
45
  } else {
@@ -108,13 +119,20 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
108
  );
109
 
110
  // Advanced Options
111
- $post_data['meta']['_wpsc_product_metadata']['engraved'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['engraved'];
112
- $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'];
113
- if(!isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
114
- $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
 
115
 
116
- $post_data['meta']['_wpsc_product_metadata']['enable_comments'] = $post_data['meta']['_wpsc_product_metadata']['enable_comments'];
117
- $post_data['meta']['_wpsc_product_metadata']['merchant_notes'] = $post_data['meta']['_wpsc_product_metadata']['merchant_notes'];
 
 
 
 
 
 
118
 
119
  $post_data['files'] = $_FILES;
120
 
@@ -158,9 +176,8 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
158
  // if we succeed, we can do further editing (todo - if_wp_error)
159
 
160
  // if we have no categories selected, assign one.
161
- if( isset( $post_data['tax_input']['wpsc_product_category'] ) && count( $post_data['tax_input']['wpsc_product_category'] ) == 1 && $post_data['tax_input']['wpsc_product_category'][0] == 0){
162
  $post_data['tax_input']['wpsc_product_category'][1] = wpsc_add_product_category_default($product_id);
163
-
164
  }
165
 
166
  // and the meta
@@ -218,7 +235,7 @@ function wpsc_pre_update( $data , $postarr ) {
218
  return $data;
219
  }
220
  add_filter( 'wp_insert_post_data','wpsc_pre_update', 99, 2 );
221
- add_action( 'save_post', 'wpsc_admin_submit_product', 10, 2 );
222
  add_action( 'admin_notices', 'wpsc_admin_submit_notices' );
223
 
224
  /**
18
  * @return nothing
19
  */
20
  function wpsc_admin_submit_product( $post_ID, $post ) {
21
+ if ( ! is_admin() )
22
+ return;
23
 
24
+ global $wpdb;
25
 
26
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_type != 'wpsc-product' )
27
+ return;
28
 
29
  //Type-casting ( not so much sanitization, which would be good to do )
30
+ $post_data = stripslashes_deep( $_POST );
31
  $product_id = $post_ID;
32
+
33
+ $post_data['additional_description'] = isset( $post_data['additional_description'] ) ? $post_data['additional_description'] : '';
34
+
35
+ if ( ! isset( $post_data['meta'] ) && isset( $_POST['meta'] ) ) {
36
+ $post_data['meta'] = (array) $_POST['meta'];
37
+ }
38
+
39
  if ( isset( $post_data['meta']['_wpsc_price'] ) )
40
  $post_data['meta']['_wpsc_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_price'] );
41
+
42
  if ( isset( $post_data['meta']['_wpsc_special_price'] ) )
43
  $post_data['meta']['_wpsc_special_price'] = wpsc_string_to_float( $post_data['meta']['_wpsc_special_price'] );
44
+
45
+ if ( isset( $post_data['meta']['_wpsc_sku'] ) && $post_data['meta']['_wpsc_sku'] == __('N/A', 'wpsc') ) {
46
  $post_data['meta']['_wpsc_sku'] = '';
47
+ }
48
+
49
  if( isset( $post_data['meta']['_wpsc_is_donation'] ) )
50
  $post_data['meta']['_wpsc_is_donation'] = 1;
51
  else
52
  $post_data['meta']['_wpsc_is_donation'] = 0;
53
+
54
  if ( ! isset( $post_data['meta']['_wpsc_limited_stock'] ) ){
55
  $post_data['meta']['_wpsc_stock'] = false;
56
  } else {
119
  );
120
 
121
  // Advanced Options
122
+ if ( isset( $post_data['meta']['_wpsc_product_metadata']['engraved'] ) ) {
123
+ $post_data['meta']['_wpsc_product_metadata']['engraved'] = (int) (bool) $post_data['meta']['_wpsc_product_metadata']['engraved'];
124
+ } else {
125
+ $post_data['meta']['_wpsc_product_metadata']['engraved'] = 0;
126
+ }
127
 
128
+ if ( isset( $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] ) ) {
129
+ $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = (int) (bool) $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'];
130
+ } else {
131
+ $post_data['meta']['_wpsc_product_metadata']['can_have_uploaded_image'] = 0;
132
+ }
133
+
134
+ if ( ! isset($post_data['meta']['_wpsc_product_metadata']['google_prohibited'])) $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = '';
135
+ $post_data['meta']['_wpsc_product_metadata']['google_prohibited'] = (int)(bool)$post_data['meta']['_wpsc_product_metadata']['google_prohibited'];
136
 
137
  $post_data['files'] = $_FILES;
138
 
176
  // if we succeed, we can do further editing (todo - if_wp_error)
177
 
178
  // if we have no categories selected, assign one.
179
+ 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){
180
  $post_data['tax_input']['wpsc_product_category'][1] = wpsc_add_product_category_default($product_id);
 
181
  }
182
 
183
  // and the meta
235
  return $data;
236
  }
237
  add_filter( 'wp_insert_post_data','wpsc_pre_update', 99, 2 );
238
+ add_action( 'save_post', 'wpsc_admin_submit_product', 5, 2 );
239
  add_action( 'admin_notices', 'wpsc_admin_submit_notices' );
240
 
241
  /**
wpsc-admin/includes/product-variations-setup.page.php CHANGED
@@ -14,7 +14,7 @@
14
  <p class="howto"><?php esc_html_e( "Example: Red, Green, Blue. Separate variants with commas.", 'wpsc' ); ?></p>
15
  <p>
16
  <a class="button" href="#"><?php esc_html_e( 'Add New Variants', 'wpsc' ); ?></a>
17
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
18
  </p>
19
  </div>
20
 
14
  <p class="howto"><?php esc_html_e( "Example: Red, Green, Blue. Separate variants with commas.", 'wpsc' ); ?></p>
15
  <p>
16
  <a class="button" href="#"><?php esc_html_e( 'Add New Variants', 'wpsc' ); ?></a>
17
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
18
  </p>
19
  </div>
20
 
wpsc-admin/includes/purchase-log-list-table-class.php CHANGED
@@ -327,7 +327,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
327
  return $views;
328
  }
329
 
330
- public function months_dropdown() {
331
  global $wp_locale;
332
 
333
  $m = isset( $_REQUEST['m'] ) ? $_REQUEST['m'] : 0;
@@ -488,7 +488,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
488
  echo '<select class="wpsc-purchase-log-status" data-log-id="' . $item->id . '">';
489
  echo $dropdown_options;
490
  echo '</select>';
491
- echo '<img src="' . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . '" class="ajax-feedback" title="" alt="" />';
492
  }
493
 
494
  public function column_tracking( $item ) {
@@ -499,7 +499,7 @@ class WPSC_Purchase_Log_List_Table extends WP_List_Table {
499
  <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wpsc' ); ?></a>
500
  <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
501
  <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wpsc' ); ?></a>
502
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
503
  <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wpsc' ); ?></a></small>
504
  </div>
505
  <?php
327
  return $views;
328
  }
329
 
330
+ public function months_dropdown( $post_type = '' ) {
331
  global $wp_locale;
332
 
333
  $m = isset( $_REQUEST['m'] ) ? $_REQUEST['m'] : 0;
488
  echo '<select class="wpsc-purchase-log-status" data-log-id="' . $item->id . '">';
489
  echo $dropdown_options;
490
  echo '</select>';
491
+ echo '<img src="' . esc_url( wpsc_get_ajax_spinner() ) . '" class="ajax-feedback" title="" alt="" />';
492
  }
493
 
494
  public function column_tracking( $item ) {
499
  <a class="add" href="#"><?php echo esc_html_x( 'Add Tracking ID', 'add purchase log tracking id', 'wpsc' ); ?></a>
500
  <input type="text" class="wpsc-purchase-log-tracking-id" value="<?php echo esc_attr( $item->track_id ); ?>" />
501
  <a class="button save" href="#"><?php echo esc_html_x( 'Save', 'save sales log tracking id', 'wpsc' ); ?></a>
502
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" /><br class="clear" />
503
  <small class="send-email"><a href="#"><?php echo esc_html_x( 'Send Email', 'sales log', 'wpsc' ); ?></a></small>
504
  </div>
505
  <?php
wpsc-admin/includes/settings-tabs/checkout.php CHANGED
@@ -266,7 +266,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
266
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
267
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
268
  </a>
269
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
270
  </div>
271
  </td>
272
  <td class="namecol">
@@ -440,7 +440,7 @@ class WPSC_Settings_Tab_Checkout extends WPSC_Settings_Tab {
440
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
441
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
442
  </a>
443
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
444
  </div>
445
  </td>
446
  <td class="namecol">
266
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
267
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
268
  </a>
269
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
270
  </div>
271
  </td>
272
  <td class="namecol">
440
  <a title="<?php esc_attr_e( 'Click and Drag to Order Checkout Fields', 'wpsc' ); ?>">
441
  <img src="<?php echo esc_url( WPSC_CORE_IMAGES_URL . '/drag.png' ); ?>" />
442
  </a>
443
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
444
  </div>
445
  </td>
446
  <td class="namecol">
wpsc-admin/includes/settings-tabs/gateway.php CHANGED
@@ -120,7 +120,7 @@ class WPSC_Settings_Tab_Gateway extends WPSC_Settings_Tab {
120
  <div class="row-actions-visible">
121
  <span class="edit">
122
  <a class='edit-payment-module' title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wpsc' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['id'] ) ); ?>'><?php esc_html_e( 'Settings', 'wpsc' ); ?></a>
123
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
124
  </span>
125
  </div>
126
  </td>
120
  <div class="row-actions-visible">
121
  <span class="edit">
122
  <a class='edit-payment-module' title="<?php esc_attr_e( "Edit this Payment Gateway's Settings", 'wpsc' ) ?>" href='<?php echo esc_url( $this->get_gateway_settings_url( $gateway['id'] ) ); ?>'><?php esc_html_e( 'Settings', 'wpsc' ); ?></a>
123
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
124
  </span>
125
  </div>
126
  </td>
wpsc-admin/includes/settings-tabs/general.php CHANGED
@@ -53,7 +53,7 @@ class WPSC_Settings_Tab_General extends WPSC_Settings_Tab {
53
  ?>
54
  <span id='wpsc-base-region-drop-down'>
55
  <?php $this->display_region_drop_down(); ?>
56
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
57
  </span>
58
  <p class='description'><?php esc_html_e( 'Select your primary business location.', 'wpsc' ); ?></p>
59
  </td>
53
  ?>
54
  <span id='wpsc-base-region-drop-down'>
55
  <?php $this->display_region_drop_down(); ?>
56
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
57
  </span>
58
  <p class='description'><?php esc_html_e( 'Select your primary business location.', 'wpsc' ); ?></p>
59
  </td>
wpsc-admin/includes/settings-tabs/shipping.php CHANGED
@@ -199,7 +199,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
199
  <th><?php esc_html_e( 'Force Sync with Shipwire', 'wpsc' ); ?></th>
200
  <td>
201
  <a class="shipwire_sync button"><?php esc_html_e( 'Update Tracking and Inventory', 'wpsc' ); ?></a>
202
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
203
  </td>
204
  </tr>
205
  </table>
@@ -327,7 +327,7 @@ class WPSC_Settings_Tab_Shipping extends WPSC_Settings_Tab {
327
  <div class="row-actions-visible">
328
  <span class="edit">
329
  <a class='edit-shipping-module' data-module-id="<?php echo $shipping->getInternalName(); ?>" title="<?php esc_attr_e( 'Edit this Shipping Module', 'wpsc' ); ?>" href='<?php echo esc_url( $this->get_shipping_module_url( $shipping ) ); ?>'><?php _ex( 'Settings', 'Shipping modules link to individual settings', 'wpsc' ); ?>
330
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
331
  </span>
332
  </div>
333
  </td>
199
  <th><?php esc_html_e( 'Force Sync with Shipwire', 'wpsc' ); ?></th>
200
  <td>
201
  <a class="shipwire_sync button"><?php esc_html_e( 'Update Tracking and Inventory', 'wpsc' ); ?></a>
202
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
203
  </td>
204
  </tr>
205
  </table>
327
  <div class="row-actions-visible">
328
  <span class="edit">
329
  <a class='edit-shipping-module' data-module-id="<?php echo $shipping->getInternalName(); ?>" title="<?php esc_attr_e( 'Edit this Shipping Module', 'wpsc' ); ?>" href='<?php echo esc_url( $this->get_shipping_module_url( $shipping ) ); ?>'><?php _ex( 'Settings', 'Shipping modules link to individual settings', 'wpsc' ); ?>
330
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
331
  </span>
332
  </div>
333
  </td>
wpsc-admin/init.php CHANGED
@@ -505,7 +505,7 @@ function wpsc_update_page_urls( $auto = false ) {
505
  wpsc_core_load_page_titles();
506
  wpsc_register_post_types();
507
 
508
- if( ! $auto ){
509
  $sendback = wp_get_referer();
510
  if ( isset( $updated ) )
511
  $sendback = add_query_arg( 'updated', $updated, $sendback );
505
  wpsc_core_load_page_titles();
506
  wpsc_register_post_types();
507
 
508
+ if ( ! $auto ) {
509
  $sendback = wp_get_referer();
510
  if ( isset( $updated ) )
511
  $sendback = add_query_arg( 'updated', $updated, $sendback );
wpsc-admin/js/admin.js CHANGED
@@ -343,7 +343,6 @@ jQuery(document).ready(function(){
343
  if ( jQuery( 'select[name="rules[operator][]"]', prototype ).length === 0 ) {
344
  operator_box.append("<option value='and'>" + wpsc_adminL10n.coupons_compare_and + "</option>");
345
  operator_box.append("<option value='or'>" + wpsc_adminL10n.coupons_compare_or + "</option>");
346
- prototype.prepend(operator_box);
347
  }
348
 
349
 
@@ -354,6 +353,7 @@ jQuery(document).ready(function(){
354
 
355
  margin = jQuery( 'select.ruleprops', prototype ).offset().left - prototype.offset().left;
356
  margin = parseInt( margin, 10 ) - 1;
 
357
 
358
  prototype.animate( { opacity: 1, 'margin-left': '-' + margin + 'px', height: 'show' }, 150 );
359
 
343
  if ( jQuery( 'select[name="rules[operator][]"]', prototype ).length === 0 ) {
344
  operator_box.append("<option value='and'>" + wpsc_adminL10n.coupons_compare_and + "</option>");
345
  operator_box.append("<option value='or'>" + wpsc_adminL10n.coupons_compare_or + "</option>");
 
346
  }
347
 
348
 
353
 
354
  margin = jQuery( 'select.ruleprops', prototype ).offset().left - prototype.offset().left;
355
  margin = parseInt( margin, 10 ) - 1;
356
+ prototype.find('input').focus();
357
 
358
  prototype.animate( { opacity: 1, 'margin-left': '-' + margin + 'px', height: 'show' }, 150 );
359
 
wpsc-admin/settings-page.php CHANGED
@@ -365,10 +365,13 @@ final class WPSC_Settings_Page {
365
  */
366
  public function set_current_tab( $tab_id = null ) {
367
  if ( ! $tab_id ) {
 
 
368
  if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->tabs ) )
369
  $this->current_tab_id = $_GET['tab'];
370
  else
371
- $this->current_tab_id = array_shift( array_keys( $this->tabs ) );
 
372
  } else {
373
  $this->current_tab_id = $tab_id;
374
  }
@@ -508,7 +511,7 @@ final class WPSC_Settings_Page {
508
  <div id="icon_card" class="icon32"></div>
509
  <h2 id="wpsc-settings-page-title">
510
  <?php esc_html_e( 'Store Settings', 'wpsc' ); ?>
511
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
512
  </h2>
513
  <?php $this->output_tabs(); ?>
514
  <div id='wpsc_options_page'>
@@ -640,7 +643,7 @@ final class WPSC_Settings_Page {
640
  $_POST['wpsc_options'] = stripslashes_deep( $_POST['wpsc_options'] );
641
  // make sure stock keeping time is a number
642
  if ( isset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] ) ) {
643
- $skt =& $_POST['wpsc_options']['wpsc_stock_keeping_time']; // I hate repeating myself
644
  $skt = (float) $skt;
645
  if ( $skt <= 0 || ( $skt < 1 && $_POST['wpsc_options']['wpsc_stock_keeping_interval'] == 'hour' ) ) {
646
  unset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] );
365
  */
366
  public function set_current_tab( $tab_id = null ) {
367
  if ( ! $tab_id ) {
368
+ $tabs = array_keys( $this->tabs );
369
+
370
  if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->tabs ) )
371
  $this->current_tab_id = $_GET['tab'];
372
  else
373
+ $this->current_tab_id = array_shift( $tabs );
374
+
375
  } else {
376
  $this->current_tab_id = $tab_id;
377
  }
511
  <div id="icon_card" class="icon32"></div>
512
  <h2 id="wpsc-settings-page-title">
513
  <?php esc_html_e( 'Store Settings', 'wpsc' ); ?>
514
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
515
  </h2>
516
  <?php $this->output_tabs(); ?>
517
  <div id='wpsc_options_page'>
643
  $_POST['wpsc_options'] = stripslashes_deep( $_POST['wpsc_options'] );
644
  // make sure stock keeping time is a number
645
  if ( isset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] ) ) {
646
+ $skt = $_POST['wpsc_options']['wpsc_stock_keeping_time']; // I hate repeating myself
647
  $skt = (float) $skt;
648
  if ( $skt <= 0 || ( $skt < 1 && $_POST['wpsc_options']['wpsc_stock_keeping_interval'] == 'hour' ) ) {
649
  unset( $_POST['wpsc_options']['wpsc_stock_keeping_time'] );
wpsc-components/marketplace-core-v1/library/Sputnik.php CHANGED
@@ -21,24 +21,24 @@ class Sputnik {
21
  /**
22
  * Base URI for store URLs
23
  */
24
- const SITE_BASE = 'http://www.wpeconomy.org';
25
 
26
  /**
27
  * Base URI for API URLs
28
  */
29
- const API_BASE = 'http://api.wpeconomy.org';
30
 
31
  /**
32
  * OAuth client key
33
  */
34
- const OAUTH_KEY = '2lOEJMYjLho3';
35
 
36
  /**
37
  * OAuth client secret
38
  *
39
  * Not so secret any more.
40
  */
41
- const OAUTH_SECRET = 'mPGuYG1DTt3DuoQtpimidEusg9WhoxRxJaXozkYVmf7q1QwM';
42
 
43
  /**
44
  * Path to Sputnik
@@ -66,6 +66,8 @@ class Sputnik {
66
  */
67
  protected static $suspended = array();
68
 
 
 
69
  /**
70
  * Register everything we need
71
  */
@@ -428,14 +430,12 @@ class Sputnik {
428
  * @return stdObject
429
  */
430
  public static function get_account() {
431
- $account = get_transient('sputnik_account');
432
- if ($account === false) {
433
  $account = Sputnik_API::get_account();
434
- $account = $account['body'];
435
- set_transient('sputnik_account', $account, 3600);
436
  }
437
 
438
- return $account;
439
  }
440
 
441
  /**
@@ -444,13 +444,8 @@ class Sputnik {
444
  * @return stdObject
445
  */
446
  public static function update_account() {
447
- delete_transient( 'sputnik_account' );
448
-
449
- $account = Sputnik_API::get_account();
450
-
451
- set_transient( 'sputnik_account', $account['body'], 60*60*12 );
452
-
453
- return $account['body'];
454
  }
455
 
456
  /**
21
  /**
22
  * Base URI for store URLs
23
  */
24
+ const SITE_BASE = 'http://getshopped.org';
25
 
26
  /**
27
  * Base URI for API URLs
28
  */
29
+ const API_BASE = 'http://getshopped.org/wpec';
30
 
31
  /**
32
  * OAuth client key
33
  */
34
+ const OAUTH_KEY = 'NuDmOncs1pNb';
35
 
36
  /**
37
  * OAuth client secret
38
  *
39
  * Not so secret any more.
40
  */
41
+ const OAUTH_SECRET = 'Gf25Y3G2zoPGtFfiARoHCy1tWFDYqi9E1Wrhrp3tSkR4Tuht';
42
 
43
  /**
44
  * Path to Sputnik
66
  */
67
  protected static $suspended = array();
68
 
69
+ protected static $account = null;
70
+
71
  /**
72
  * Register everything we need
73
  */
430
  * @return stdObject
431
  */
432
  public static function get_account() {
433
+ if ( is_null( self::$account ) ) {
 
434
  $account = Sputnik_API::get_account();
435
+ self::$account = $account['body'];
 
436
  }
437
 
438
+ return self::$account;
439
  }
440
 
441
  /**
444
  * @return stdObject
445
  */
446
  public static function update_account() {
447
+ self::$account = null;
448
+ return self::get_account();
 
 
 
 
 
449
  }
450
 
451
  /**
wpsc-components/marketplace-core-v1/library/Sputnik/API.php CHANGED
@@ -42,7 +42,9 @@ class Sputnik_API {
42
  $params['user'] = $user;
43
  }
44
 
45
- return self::request('/info', $params);
 
 
46
  }
47
 
48
  public static function rate_product($name, $rating) {
@@ -111,8 +113,6 @@ class Sputnik_API {
111
  $return_url = Sputnik_Admin::build_url( $args );
112
  }
113
 
114
- delete_option('sputnik_oauth_request');
115
-
116
  // Close the authentication popup ?>
117
  <!DOCTYPE html><html>
118
  <head>
@@ -171,14 +171,13 @@ class Sputnik_API {
171
 
172
  /* Purchase Methods */
173
 
174
- public static function get_checkout_token( $product_slug ) {
175
  self::authenticate();
176
 
177
- $url = '/purchase/get_checkout_token';
178
 
179
  $request = self::$auth->sign( $url, 'GET', array(
180
- 'product_slug' => $product_slug,
181
- 'redirect_uri' => Sputnik_Admin::build_url( array( '_wpnonce' => wp_create_nonce( 'sputnik_install-plugin_' . $product_slug ) ) )
182
  )
183
  );
184
 
@@ -189,7 +188,6 @@ class Sputnik_API {
189
 
190
 
191
  /* Helper Methods */
192
-
193
  public static function request($url, $params = null, $args = array()) {
194
  if ( ! empty( $params ) )
195
  $url = add_query_arg( $params, $url );
@@ -211,11 +209,11 @@ class Sputnik_API {
211
  throw new Exception($request->get_error_message());
212
  }
213
 
214
- if ($request['response']['code'] !== 200) {
215
  throw new Exception($request['body'], $request['response']['code']);
216
  }
217
-
218
  $result = json_decode($request['body']);
 
219
  if ($result === null) {
220
  throw new Exception($request['body'], $request['response']['code']);
221
  }
42
  $params['user'] = $user;
43
  }
44
 
45
+ $uri = "/info/{$name}/";
46
+
47
+ return self::request( $uri );
48
  }
49
 
50
  public static function rate_product($name, $rating) {
113
  $return_url = Sputnik_Admin::build_url( $args );
114
  }
115
 
 
 
116
  // Close the authentication popup ?>
117
  <!DOCTYPE html><html>
118
  <head>
171
 
172
  /* Purchase Methods */
173
 
174
+ public static function get_checkout_token( $product ) {
175
  self::authenticate();
176
 
177
+ $url = '/purchase/get_checkout_token/' . $product->client_product_id;
178
 
179
  $request = self::$auth->sign( $url, 'GET', array(
180
+ 'redirect_uri' => Sputnik_Admin::build_url( array( '_wpnonce' => wp_create_nonce( 'sputnik_install-plugin_' . $product->slug ) ) )
 
181
  )
182
  );
183
 
188
 
189
 
190
  /* Helper Methods */
 
191
  public static function request($url, $params = null, $args = array()) {
192
  if ( ! empty( $params ) )
193
  $url = add_query_arg( $params, $url );
209
  throw new Exception($request->get_error_message());
210
  }
211
 
212
+ if ($request['response']['code'] != 200) {
213
  throw new Exception($request['body'], $request['response']['code']);
214
  }
 
215
  $result = json_decode($request['body']);
216
+
217
  if ($result === null) {
218
  throw new Exception($request['body'], $request['response']['code']);
219
  }
wpsc-components/marketplace-core-v1/library/Sputnik/API/Auth.php CHANGED
@@ -25,6 +25,7 @@ class Sputnik_API_Auth {
25
  $parameters['oauth_callback'] = $callback;
26
  }
27
  $request = $this->request('/auth/request_token', 'GET', $parameters);
 
28
  $token = Sputnik_OAuth_Util::parse_parameters($request);
29
  $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
30
  return $token;
@@ -56,7 +57,9 @@ class Sputnik_API_Auth {
56
  if (!empty($verifier)) {
57
  $parameters['oauth_verifier'] = $verifier;
58
  }
 
59
  $request = $this->request('/auth/access_token', 'GET', $parameters);
 
60
  $token = Sputnik_OAuth_Util::parse_parameters($request);
61
  $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
62
  return $token;
@@ -69,6 +72,7 @@ class Sputnik_API_Auth {
69
  if (strpos($url, 'http') !== 0) {
70
  $url = Sputnik::API_BASE . $url;
71
  }
 
72
  $request = Sputnik_OAuth_Request::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
73
  $request->sign_request($this->sha1_method, $this->consumer, $this->token);
74
  return $request;
@@ -116,6 +120,8 @@ class Sputnik_API_Auth {
116
  break;
117
  }
118
 
 
 
119
  $response = wp_remote_request($url, $args);
120
  //echo '<pre />' . debug_print_backtrace();
121
  //echo '<pre />' . print_r( $url, 1 );
@@ -125,7 +131,7 @@ class Sputnik_API_Auth {
125
  throw new Exception($response->get_error_message());
126
  }
127
 
128
- if ($response['response']['code'] !== 200) {
129
  throw new Exception($response['body']);
130
  }
131
  return $response['body'];
25
  $parameters['oauth_callback'] = $callback;
26
  }
27
  $request = $this->request('/auth/request_token', 'GET', $parameters);
28
+
29
  $token = Sputnik_OAuth_Util::parse_parameters($request);
30
  $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
31
  return $token;
57
  if (!empty($verifier)) {
58
  $parameters['oauth_verifier'] = $verifier;
59
  }
60
+
61
  $request = $this->request('/auth/access_token', 'GET', $parameters);
62
+
63
  $token = Sputnik_OAuth_Util::parse_parameters($request);
64
  $this->token = new Sputnik_OAuth_Consumer($token['oauth_token'], $token['oauth_token_secret']);
65
  return $token;
72
  if (strpos($url, 'http') !== 0) {
73
  $url = Sputnik::API_BASE . $url;
74
  }
75
+
76
  $request = Sputnik_OAuth_Request::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
77
  $request->sign_request($this->sha1_method, $this->consumer, $this->token);
78
  return $request;
120
  break;
121
  }
122
 
123
+ $args['headers'] = array( 'X-WP-Domain' => Sputnik_API::domain() );
124
+
125
  $response = wp_remote_request($url, $args);
126
  //echo '<pre />' . debug_print_backtrace();
127
  //echo '<pre />' . print_r( $url, 1 );
131
  throw new Exception($response->get_error_message());
132
  }
133
 
134
+ if ($response['response']['code'] != 200) {
135
  throw new Exception($response['body']);
136
  }
137
  return $response['body'];
wpsc-components/marketplace-core-v1/library/Sputnik/Admin.php CHANGED
@@ -45,7 +45,6 @@ class Sputnik_Admin {
45
  if ($_GET['oauth'] == 'reset') {
46
  delete_option('sputnik_oauth_request');
47
  delete_option('sputnik_oauth_access');
48
- delete_transient('sputnik_account');
49
 
50
  wp_redirect(self::build_url());
51
  }
@@ -298,6 +297,8 @@ class Sputnik_Admin {
298
  global $tab;
299
  require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
300
 
 
 
301
  try {
302
  if ( Sputnik::account_is_linked() ) {
303
  $account = Sputnik::get_account();
@@ -328,8 +329,9 @@ class Sputnik_Admin {
328
  'changelog' => _x('Changelog', 'Plugin installer section title', 'sputnik'),
329
  'other_notes' => _x('Other Notes', 'Plugin installer section title', 'sputnik')
330
  );
 
331
  //Sanitize HTML
332
- $api->sections = (array) $api->sections;
333
  $api->author = links_add_target($api->author, '_blank');
334
  foreach ( $api->sections as $section_name => $content )
335
  $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
@@ -403,6 +405,7 @@ class Sputnik_Admin {
403
  $san_section = esc_attr($section_name);
404
  echo "\t<li><a name='$san_section' href='$href'$class>$title</a></li>\n";
405
  }
 
406
  if (!empty($api->screenshots)) {
407
  $title = $plugins_section_titles['screenshots'];
408
  $class = ( 'screenshots' == $section ) ? ' class="current"' : '';
@@ -575,6 +578,9 @@ class Sputnik_Admin {
575
  'oauth' => 'request',
576
  'oauth_buy' => $api->slug,
577
  'TB_iframe' => true,
 
 
 
578
  ) );
579
 
580
  return compact('status', 'url', 'version');
@@ -699,6 +705,7 @@ class Sputnik_Admin {
699
  public static function account() {
700
  self::$page = 'account';
701
  $account = false;
 
702
  try {
703
  $account = Sputnik::get_account();
704
  }
@@ -767,7 +774,7 @@ class Sputnik_Admin {
767
  }
768
 
769
  // Request a checkout token from the Baikonur REST API for this product (associate user ID in custom field?)
770
- $response = Sputnik_API::get_checkout_token( $plugin_id );
771
 
772
  // Redirect to PayPal with token in checkout URL
773
  wp_redirect( $response['body']->checkout_uri );
@@ -850,7 +857,7 @@ class Sputnik_Admin {
850
  ini_set( 'display_errors', '1' );
851
  error_reporting( E_ALL );
852
 
853
- if ( $api->is_theme )
854
  $upgrader = new Sputnik_ThemeUpgrader( new Sputnik_Upgrader_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
855
  else
856
  $upgrader = new Sputnik_Upgrader( new Sputnik_Upgrader_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
45
  if ($_GET['oauth'] == 'reset') {
46
  delete_option('sputnik_oauth_request');
47
  delete_option('sputnik_oauth_access');
 
48
 
49
  wp_redirect(self::build_url());
50
  }
297
  global $tab;
298
  require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
299
 
300
+ define( 'IFRAME_REQUEST', true );
301
+
302
  try {
303
  if ( Sputnik::account_is_linked() ) {
304
  $account = Sputnik::get_account();
329
  'changelog' => _x('Changelog', 'Plugin installer section title', 'sputnik'),
330
  'other_notes' => _x('Other Notes', 'Plugin installer section title', 'sputnik')
331
  );
332
+
333
  //Sanitize HTML
334
+ $api->sections = isset( $api->sections ) ? (array) $api->sections : array();
335
  $api->author = links_add_target($api->author, '_blank');
336
  foreach ( $api->sections as $section_name => $content )
337
  $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
405
  $san_section = esc_attr($section_name);
406
  echo "\t<li><a name='$san_section' href='$href'$class>$title</a></li>\n";
407
  }
408
+
409
  if (!empty($api->screenshots)) {
410
  $title = $plugins_section_titles['screenshots'];
411
  $class = ( 'screenshots' == $section ) ? ' class="current"' : '';
578
  'oauth' => 'request',
579
  'oauth_buy' => $api->slug,
580
  'TB_iframe' => true,
581
+ 'height' => 550,
582
+ 'width' => 640,
583
+ 'modal' => 'true'
584
  ) );
585
 
586
  return compact('status', 'url', 'version');
705
  public static function account() {
706
  self::$page = 'account';
707
  $account = false;
708
+
709
  try {
710
  $account = Sputnik::get_account();
711
  }
774
  }
775
 
776
  // Request a checkout token from the Baikonur REST API for this product (associate user ID in custom field?)
777
+ $response = Sputnik_API::get_checkout_token( $plugin );
778
 
779
  // Redirect to PayPal with token in checkout URL
780
  wp_redirect( $response['body']->checkout_uri );
857
  ini_set( 'display_errors', '1' );
858
  error_reporting( E_ALL );
859
 
860
+ if ( in_array( 'theme', $api->categories ) )
861
  $upgrader = new Sputnik_ThemeUpgrader( new Sputnik_Upgrader_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
862
  else
863
  $upgrader = new Sputnik_Upgrader( new Sputnik_Upgrader_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
wpsc-components/marketplace-core-v1/library/Sputnik/List/Account.php CHANGED
@@ -142,13 +142,13 @@ class Sputnik_List_Account extends Sputnik_List_Install {
142
  <?php
143
  $this->pagination($which);
144
  ?>
145
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
146
  <br class="clear" />
147
  </div>
148
  <?php } else { ?>
149
  <div class="tablenav bottom">
150
  <?php $this->pagination($which); ?>
151
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
152
  <br class="clear" />
153
  </div>
154
  <?php
142
  <?php
143
  $this->pagination($which);
144
  ?>
145
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-loading list-ajax-loading" alt="" />
146
  <br class="clear" />
147
  </div>
148
  <?php } else { ?>
149
  <div class="tablenav bottom">
150
  <?php $this->pagination($which); ?>
151
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-loading list-ajax-loading" alt="" />
152
  <br class="clear" />
153
  </div>
154
  <?php
wpsc-components/marketplace-core-v1/library/Sputnik/List/Install.php CHANGED
@@ -200,13 +200,13 @@ class Sputnik_List_Install extends WP_List_Table {
200
  <?php
201
  $this->pagination($which);
202
  ?>
203
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
204
  <br class="clear" />
205
  </div>
206
  <?php } else { ?>
207
  <div class="tablenav bottom">
208
  <?php $this->pagination($which); ?>
209
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
210
  <br class="clear" />
211
  </div>
212
  <?php
@@ -412,14 +412,13 @@ class Sputnik_List_Install extends WP_List_Table {
412
  $action_links = apply_filters( 'sputnik_install_grid_action_links', $action_links, $plugin );
413
 
414
  $thumb = false;
415
- if (isset($plugin->thumb) && $plugin->thumb !== false) {
 
 
416
  $thumb = $plugin->thumb;
417
- }
418
- if ( 'klarna-payment-gateway' == $plugin->slug )
419
- $thumb = 'https://github.com/JustinSainton/Klarna/raw/assets/thumb.png';
420
  ?>
421
  <div>
422
- <div class="sputnik-plugin<?php if ($thumb !== false) echo ' has-thumb'; ?>">
423
  <div class="sputnik-card">
424
  <?php
425
  if ( $thumb !== false ):
200
  <?php
201
  $this->pagination($which);
202
  ?>
203
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-loading list-ajax-loading" alt="" />
204
  <br class="clear" />
205
  </div>
206
  <?php } else { ?>
207
  <div class="tablenav bottom">
208
  <?php $this->pagination($which); ?>
209
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-loading list-ajax-loading" alt="" />
210
  <br class="clear" />
211
  </div>
212
  <?php
412
  $action_links = apply_filters( 'sputnik_install_grid_action_links', $action_links, $plugin );
413
 
414
  $thumb = false;
415
+ if ( empty( $plugin->thumb ) )
416
+ $thumb = WPSC_CORE_THEME_URL . '/wpsc-images/noimage.png';
417
+ else
418
  $thumb = $plugin->thumb;
 
 
 
419
  ?>
420
  <div>
421
+ <div class="sputnik-plugin<?php if ( ! empty( $plugin->thumb ) ) echo ' has-thumb'; ?>">
422
  <div class="sputnik-card">
423
  <?php
424
  if ( $thumb !== false ):
wpsc-components/marketplace-core-v1/library/Sputnik/OAuth/Server.php CHANGED
@@ -141,6 +141,8 @@ class Sputnik_OAuth_Server {
141
  ? $request->get_parameter('oauth_token')
142
  : NULL;
143
 
 
 
144
  $token = $this->data_store->lookup_token(
145
  $consumer, $token_type, $token_field
146
  );
@@ -215,6 +217,7 @@ class Sputnik_OAuth_Server {
215
  $nonce,
216
  $timestamp
217
  );
 
218
  if ($found) {
219
  throw new Sputnik_OAuth_Exception("Nonce already used: $nonce");
220
  }
141
  ? $request->get_parameter('oauth_token')
142
  : NULL;
143
 
144
+
145
+
146
  $token = $this->data_store->lookup_token(
147
  $consumer, $token_type, $token_field
148
  );
217
  $nonce,
218
  $timestamp
219
  );
220
+
221
  if ($found) {
222
  throw new Sputnik_OAuth_Exception("Nonce already used: $nonce");
223
  }
wpsc-components/marketplace-core-v1/library/Sputnik/Upgrader/Skin.php CHANGED
@@ -15,9 +15,9 @@ class Sputnik_Upgrader_Skin extends WP_Upgrader_Skin {
15
  }
16
 
17
  function before() {
18
-
19
  if ( ! empty( $this->api ) ) {
20
- $asset_type = $this->api->is_theme ? 'theme' : 'plugin';
21
  $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the %s <strong>%s %s</strong>.'), $asset_type, $this->api->name, $this->api->version);
22
  }
23
 
15
  }
16
 
17
  function before() {
18
+
19
  if ( ! empty( $this->api ) ) {
20
+ $asset_type = in_array( 'theme', $this->api->categories ) ? 'theme' : 'plugin';
21
  $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the %s <strong>%s %s</strong>.'), $asset_type, $this->api->name, $this->api->version);
22
  }
23
 
wpsc-components/marketplace-core-v1/library/Sputnik/View/Browser/Grid.php CHANGED
@@ -147,13 +147,13 @@ class Sputnik_View_Browser_Grid extends WP_List_Table {
147
  <?php
148
  $this->pagination($which);
149
  ?>
150
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
151
  <br class="clear" />
152
  </div>
153
  <?php } else { ?>
154
  <div class="tablenav bottom">
155
  <?php $this->pagination($which); ?>
156
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
157
  <br class="clear" />
158
  </div>
159
  <?php
147
  <?php
148
  $this->pagination($which);
149
  ?>
150
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-loading list-ajax-loading" alt="" />
151
  <br class="clear" />
152
  </div>
153
  <?php } else { ?>
154
  <div class="tablenav bottom">
155
  <?php $this->pagination($which); ?>
156
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-loading list-ajax-loading" alt="" />
157
  <br class="clear" />
158
  </div>
159
  <?php
wpsc-components/marketplace-core-v1/static/admin.css CHANGED
@@ -156,30 +156,24 @@
156
  padding: 0;
157
  margin: 10px 25px 5px 0;
158
  float: left;
159
- height: 210px;
160
  }
161
  .sputnik-card {
162
  width: 200px;
163
- height: 200px;
164
  border: 1px solid #cfcfcf;
165
  box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.22);
166
 
167
  position: relative;
168
  overflow: hidden;
169
  }
170
- .sputnik-plugin-thumb, .sputnik-plugin-details {
171
- position: absolute;
172
- }
173
- .sputnik-plugin-thumb {
174
- display: none;
175
- }
176
  .sputnik-plugin-details {
177
- height: 180px;
178
  width: 176px;
179
  background: #F9F9F9;
180
  padding: 10px 12px;
181
  overflow: hidden;
182
- position: relative;
183
  }
184
  .sputnik-plugin-details h4 {
185
  margin: 0 0 14px;
@@ -216,25 +210,34 @@
216
  float: right;
217
  }
218
 
219
- .sputnik-plugin.has-thumb .sputnik-card {
220
  -o-transition: 0.4s;
221
  -moz-transition: 0.4s;
222
  -webkit-transition: 0.4s;
223
  }
 
 
 
 
 
 
 
 
224
  .sputnik-plugin.has-thumb .sputnik-plugin-thumb {
225
- display: block;
226
  }
227
- .sputnik-plugin.has-thumb .sputnik-plugin-thumb img {
228
- max-width:100%;
 
229
  }
230
- .sputnik-plugin.has-thumb .sputnik-plugin-details {
231
- top: 166px;
232
  background: rgba(250,250,250,0.7);
233
  -o-transition: 0.4s;
234
  -moz-transition: 0.4s;
235
  -webkit-transition: 0.4s;
236
  }
237
- .sputnik-plugin.has-thumb:hover .sputnik-plugin-details {
238
  top: 0;
239
  background: #F9F9F9;
240
  }
@@ -300,8 +303,9 @@
300
 
301
  #sputnik-plugin-information {
302
  background: url('fyi-back.png') repeat-y #fff;
303
- height: auto;
304
  min-height: 100%;
 
 
305
  }
306
 
307
  #sputnik-plugin-information #plugin-information-header {
@@ -364,9 +368,10 @@
364
  }
365
 
366
  #sputnik-plugin-information .fyi {
 
367
  margin: 0;
368
- padding: 0 10px 50px;
369
- width: 210px;
370
  height: 100%;
371
  background-color: #333;
372
  color: #aaa;
@@ -405,7 +410,7 @@
405
 
406
  #sputnik-plugin-information #section-holder {
407
  padding: 10px;
408
- margin-left: 240px;
409
  margin-top: 0;
410
  }
411
 
156
  padding: 0;
157
  margin: 10px 25px 5px 0;
158
  float: left;
159
+ height: 244px;
160
  }
161
  .sputnik-card {
162
  width: 200px;
163
+ height: 234px;
164
  border: 1px solid #cfcfcf;
165
  box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.22);
166
 
167
  position: relative;
168
  overflow: hidden;
169
  }
 
 
 
 
 
 
170
  .sputnik-plugin-details {
171
+ height: 214px;
172
  width: 176px;
173
  background: #F9F9F9;
174
  padding: 10px 12px;
175
  overflow: hidden;
176
+ position: absolute;
177
  }
178
  .sputnik-plugin-details h4 {
179
  margin: 0 0 14px;
210
  float: right;
211
  }
212
 
213
+ .sputnik-plugin .sputnik-card {
214
  -o-transition: 0.4s;
215
  -moz-transition: 0.4s;
216
  -webkit-transition: 0.4s;
217
  }
218
+ .sputnik-plugin .sputnik-plugin-thumb {
219
+ display: table-cell;
220
+ text-align: center;
221
+ vertical-align: middle;
222
+ width: 200px;
223
+ height: 200px;
224
+ margin-top: 25px;
225
+ }
226
  .sputnik-plugin.has-thumb .sputnik-plugin-thumb {
227
+ margin-top: 0;
228
  }
229
+ .sputnik-plugin .sputnik-plugin-thumb img {
230
+ max-width: 100%;
231
+ max-height: 100%;
232
  }
233
+ .sputnik-plugin .sputnik-plugin-details {
234
+ top: 200px;
235
  background: rgba(250,250,250,0.7);
236
  -o-transition: 0.4s;
237
  -moz-transition: 0.4s;
238
  -webkit-transition: 0.4s;
239
  }
240
+ .sputnik-plugin:hover .sputnik-plugin-details {
241
  top: 0;
242
  background: #F9F9F9;
243
  }
303
 
304
  #sputnik-plugin-information {
305
  background: url('fyi-back.png') repeat-y #fff;
 
306
  min-height: 100%;
307
+ margin: 0;
308
+ padding: 0;
309
  }
310
 
311
  #sputnik-plugin-information #plugin-information-header {
368
  }
369
 
370
  #sputnik-plugin-information .fyi {
371
+ position: fixed;
372
  margin: 0;
373
+ padding: 0 10px;
374
+ width: 225px;
375
  height: 100%;
376
  background-color: #333;
377
  color: #aaa;
410
 
411
  #sputnik-plugin-information #section-holder {
412
  padding: 10px;
413
+ margin-left: 260px;
414
  margin-top: 0;
415
  }
416
 
wpsc-components/marketplace-core-v1/static/admin.js CHANGED
@@ -1,4 +1,10 @@
1
  jQuery(document).ready(function($) {
 
 
 
 
 
 
2
  if ( sputnikL10n.buy_id && sputnikL10n.buy_href ) {
3
  var dg = new PAYPAL.apps.DGFlow({trigger:sputnikL10n.buy_id});
4
  dg.startFlow(sputnikL10n.buy_href);
1
  jQuery(document).ready(function($) {
2
+ var receiveMessage = function() {
3
+ if ( event.data == 'tb_close' )
4
+ tb_remove();
5
+ }
6
+ window.addEventListener( 'message', receiveMessage ,false );
7
+
8
  if ( sputnikL10n.buy_id && sputnikL10n.buy_href ) {
9
  var dg = new PAYPAL.apps.DGFlow({trigger:sputnikL10n.buy_id});
10
  dg.startFlow(sputnikL10n.buy_href);
wpsc-components/marketplace-core-v1/static/modal.css CHANGED
@@ -1207,7 +1207,7 @@
1207
  */
1208
 
1209
  .sputnik-frame .spinner {
1210
- background: url(../images/wpspin.gif) no-repeat;
1211
  background-size: 16px 16px;
1212
  display: none;
1213
  opacity: 0.7;
@@ -1623,6 +1623,6 @@
1623
  }
1624
 
1625
  .sputnik-frame .spinner {
1626
- background-image: url(../images/wpspin-2x.gif);
1627
  }
1628
  }
1207
  */
1208
 
1209
  .sputnik-frame .spinner {
1210
+ background: url(../images/spinner.gif) no-repeat;
1211
  background-size: 16px 16px;
1212
  display: none;
1213
  opacity: 0.7;
1623
  }
1624
 
1625
  .sputnik-frame .spinner {
1626
+ background-image: url(../images/spinner-2x.gif);
1627
  }
1628
  }
wpsc-components/theme-engine-v1/helpers/ajax.php CHANGED
@@ -36,6 +36,14 @@ if ( isset( $_REQUEST['wpsc_update_quantity'] ) && ($_REQUEST['wpsc_update_quant
36
  if ( isset( $_REQUEST['wpsc_ajax_action'] ) && ($_REQUEST['wpsc_ajax_action'] == 'rate_product') )
37
  add_action( 'init', 'wpsc_update_product_rating' );
38
 
 
 
 
 
 
 
 
 
39
  add_action( 'wp_ajax_add_to_cart' , 'wpsc_add_to_cart' );
40
  add_action( 'wp_ajax_nopriv_add_to_cart', 'wpsc_add_to_cart' );
41
  add_action( 'wp_ajax_get_cart' , 'wpsc_get_cart' );
@@ -361,28 +369,19 @@ function wpsc_update_product_rating() {
361
  */
362
  function wpsc_update_shipping_price() {
363
  global $wpsc_cart;
 
364
  $quote_shipping_method = $_POST['method'];
365
  $quote_shipping_option = $_POST['option'];
366
 
367
- if(!empty($quote_shipping_option) && !empty($quote_shipping_method)){
368
- $wpsc_cart->update_shipping( $quote_shipping_method, $quote_shipping_option );
 
 
 
 
 
 
369
 
370
- echo "
371
- if(jQuery('.pricedisplay.checkout-shipping .pricedisplay')){
372
- jQuery('.pricedisplay.checkout-shipping > .pricedisplay:first').html(\"" . wpsc_cart_shipping() . "\");
373
- jQuery('.shoppingcart .pricedisplay.checkout-shipping > .pricedisplay:first').html(\"" . wpsc_cart_shipping() . "\");
374
- } else {
375
- jQuery('.pricedisplay.checkout-shipping').html(\"" . wpsc_cart_shipping() . "\");}";
376
- echo "
377
- if (jQuery('#coupons_amount .pricedisplay').size() > 0) {
378
- jQuery('#coupons_amount .pricedisplay').html(\"" . wpsc_coupon_amount() . "\");
379
- } else {
380
- jQuery('#coupons_amount').html(\"" . wpsc_coupon_amount() . "\");
381
- }
382
- ";
383
- echo "jQuery('.pricedisplay.checkout-total').html(\"" . wpsc_cart_total() . "\");\n\r";
384
- }
385
- exit();
386
  }
387
 
388
  /**
@@ -738,13 +737,13 @@ function wpsc_change_tax() {
738
  $form_id = absint( $_POST['form_id'] );
739
 
740
  $wpsc_selected_country = $wpsc_cart->selected_country;
741
- $wpsc_selected_region = $wpsc_cart->selected_region;
742
 
743
  $wpsc_delivery_country = $wpsc_cart->delivery_country;
744
- $wpsc_delivery_region = $wpsc_cart->delivery_region;
745
-
746
 
747
  $previous_country = wpsc_get_customer_meta( 'billing_country' );
 
748
  if ( isset( $_POST['billing_country'] ) ) {
749
  $wpsc_selected_country = $_POST['billing_country'];
750
  wpsc_update_customer_meta( 'billing_country', $wpsc_selected_country );
@@ -776,124 +775,86 @@ function wpsc_change_tax() {
776
  $wpsc_delivery_region = null;
777
  }
778
 
779
-
780
  $wpsc_cart->update_location();
781
  $wpsc_cart->get_shipping_method();
782
  $wpsc_cart->get_shipping_option();
 
783
  if ( $wpsc_cart->selected_shipping_method != '' ) {
784
  $wpsc_cart->update_shipping( $wpsc_cart->selected_shipping_method, $wpsc_cart->selected_shipping_option );
785
  }
786
 
787
- $tax = $wpsc_cart->calculate_total_tax();
788
- $total = wpsc_cart_total();
789
- $total_input = wpsc_cart_total(false);
790
- if($wpsc_cart->coupons_amount >= wpsc_cart_total(false) && !empty($wpsc_cart->coupons_amount)){
 
791
  $total = 0;
792
  }
 
793
  if ( $wpsc_cart->total_price < 0 ) {
794
  $wpsc_cart->coupons_amount += $wpsc_cart->total_price;
795
- $wpsc_cart->total_price = null;
796
  $wpsc_cart->calculate_total_price();
797
  }
798
- ob_start();
799
 
800
- include_once( wpsc_get_template_file_path( 'wpsc-cart_widget.php' ) );
801
- $output = ob_get_contents();
802
-
803
- ob_end_clean();
804
  $delivery_country = wpsc_get_customer_meta( 'shipping_country' );
805
- $output = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $output ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
806
  if ( get_option( 'lock_tax' ) == 1 ) {
807
- echo "jQuery('#current_country').val('" . esc_js( $delivery_country ) . "'); \n";
808
- if ( $delivery_country == 'US' && get_option( 'lock_tax' ) == 1 ) {
 
 
 
809
  $output = wpsc_shipping_region_list( $delivery_country, wpsc_get_customer_meta( 'shipping_region' ) );
810
- $output = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $output ) );
811
- echo "jQuery('#region').remove();\n\r";
812
- echo "jQuery('#change_country').append(\"" . $output . "\");\n\r";
813
  }
814
  }
815
 
816
-
817
  foreach ( $wpsc_cart->cart_items as $key => $cart_item ) {
818
- echo "jQuery('#shipping_$key').html(\"" . wpsc_currency_display( $cart_item->shipping ) . "\");\n\r";
819
- }
820
-
821
- echo "jQuery('#checkout_shipping').html(\"" . wpsc_cart_shipping() . "\");\n\r";
822
-
823
- echo "jQuery('div.shopping-cart-wrapper').html('$output');\n";
824
- if ( get_option( 'lock_tax' ) == 1 ) {
825
- echo "jQuery('.shipping_country').val('" . esc_js( $delivery_country ) . "') \n";
826
- $sql = $wpdb->prepare( "SELECT `country` FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `isocode`= '%s'", $delivery_country );
827
- $country_name = $wpdb->get_var( $sql );
828
- echo "jQuery('.shipping_country_name').html('" . $country_name . "') \n";
829
  }
830
 
831
-
832
  $form_selected_country = null;
833
- $form_selected_region = null;
834
- $onchange_function = null;
835
 
836
- if ( ! empty( $_POST['billing_country'] ) && $_POST['billing_country'] != 'undefined' && !isset( $_POST['shipping_country'] ) ) {
837
  $form_selected_country = $wpsc_selected_country;
838
- $form_selected_region = $wpsc_selected_region;
839
- $onchange_function = 'set_billing_country';
840
- } else if ( ! empty( $_POST['shipping_country'] ) && $_POST['shipping_country'] != 'undefined' && !isset( $_POST['billing_country'] ) ) {
841
  $form_selected_country = $wpsc_delivery_country;
842
- $form_selected_region = $wpsc_delivery_region;
843
- $onchange_function = 'set_shipping_country';
844
  }
845
 
846
- if ( ($form_selected_country != null) && ($onchange_function != null) ) {
847
- $region_list = $wpdb->get_results( $wpdb->prepare( "SELECT `" . WPSC_TABLE_REGION_TAX . "`.* FROM `" . WPSC_TABLE_REGION_TAX . "`, `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `" . WPSC_TABLE_CURRENCY_LIST . "`.`isocode` IN('%s') AND `" . WPSC_TABLE_CURRENCY_LIST . "`.`id` = `" . WPSC_TABLE_REGION_TAX . "`.`country_id`", $form_selected_country ), ARRAY_A );
 
 
 
848
  if ( $region_list != null ) {
849
- $title = (empty($_POST['billing_country']))?'shippingstate':'billingstate';
850
- $output = "<select name='collected_data[" . $form_id . "][1]' class='current_region' onchange='$onchange_function(\"region_country_form_$form_id\", \"$form_id\");' title='" . $title . "'>\n\r";
851
-
852
- foreach ( $region_list as $region ) {
853
- if ( $form_selected_region == $region['id'] ) {
854
- $selected = "selected='selected'";
855
- } else {
856
- $selected = "";
857
- }
858
- $output .= " <option value='" . $region['id'] . "' $selected>" . htmlspecialchars( $region['name'] ) . "</option>\n\r";
859
- }
860
- $output .= "</select>\n\r";
861
-
862
- $output = str_replace( Array( "\n", "\r" ), Array( "\\n", "\\r" ), addslashes( $output ) );
863
- echo "jQuery('#region_select_$form_id').html(\"" . $output . "\");\n\r";
864
- echo "
865
- var wpsc_checkout_table_selector = jQuery('#region_select_$form_id').parents('.wpsc_checkout_table').attr('class');
866
- wpsc_checkout_table_selector = wpsc_checkout_table_selector.replace(' ','.');
867
- wpsc_checkout_table_selector = '.'+wpsc_checkout_table_selector;
868
- jQuery(wpsc_checkout_table_selector + ' input.billing_region').attr('disabled', 'disabled');
869
- jQuery(wpsc_checkout_table_selector + ' input.shipping_region').attr('disabled', 'disabled');
870
- jQuery(wpsc_checkout_table_selector + ' .billing_region').parent().parent().hide();
871
- jQuery(wpsc_checkout_table_selector + ' .shipping_region').parent().parent().hide();
872
- ";
873
- } else {
874
- if ( get_option( 'lock_tax' ) == 1 ) {
875
- echo "jQuery('#region').hide();";
876
- }
877
- echo "jQuery('#region_select_$form_id').html('');\n\r";
878
- echo "
879
- var wpsc_checkout_table_selector = jQuery('#region_select_$form_id').parents('.wpsc_checkout_table').attr('class');
880
- wpsc_checkout_table_selector = wpsc_checkout_table_selector.replace(' ','.');
881
- wpsc_checkout_table_selector = '.'+wpsc_checkout_table_selector;
882
- jQuery(wpsc_checkout_table_selector + ' input.billing_region').removeAttr('disabled');
883
- jQuery(wpsc_checkout_table_selector + ' input.shipping_region').removeAttr('disabled');
884
- jQuery(wpsc_checkout_table_selector + ' .billing_region').parent().parent().show();
885
- jQuery(wpsc_checkout_table_selector + ' .shipping_region').parent().parent().show();
886
- ";
887
  }
888
  }
889
 
890
- if ( $tax > 0 ) {
891
- echo "jQuery(\"tr.total_tax\").show();\n\r";
892
- } else {
893
- echo "jQuery(\"tr.total_tax\").hide();\n\r";
894
- }
895
- echo "jQuery('#checkout_tax').html(\"<span class='pricedisplay'>" . wpsc_cart_tax() . "</span>\");\n\r";
896
- echo "jQuery('#checkout_total').html(\"{$total}<input id='shopping_cart_total_price' type='hidden' value='{$total_input}' />\");\n\r";
897
  exit();
898
  }
899
 
36
  if ( isset( $_REQUEST['wpsc_ajax_action'] ) && ($_REQUEST['wpsc_ajax_action'] == 'rate_product') )
37
  add_action( 'init', 'wpsc_update_product_rating' );
38
 
39
+ if ( isset( $_REQUEST['wpsc_ajax_actions'] ) && 'update_location' == $_REQUEST['wpsc_ajax_actions'] ) {
40
+ add_action( 'init', 'wpsc_update_location' );
41
+ }
42
+
43
+ if ( isset( $_REQUEST['wpsc_ajax_action'] ) && 'update_shipping_price' == $_REQUEST['wpsc_ajax_action'] ) {
44
+ add_action( 'init', 'wpsc_update_shipping_price' );
45
+ }
46
+
47
  add_action( 'wp_ajax_add_to_cart' , 'wpsc_add_to_cart' );
48
  add_action( 'wp_ajax_nopriv_add_to_cart', 'wpsc_add_to_cart' );
49
  add_action( 'wp_ajax_get_cart' , 'wpsc_get_cart' );
369
  */
370
  function wpsc_update_shipping_price() {
371
  global $wpsc_cart;
372
+
373
  $quote_shipping_method = $_POST['method'];
374
  $quote_shipping_option = $_POST['option'];
375
 
376
+ if ( ! empty( $quote_shipping_option ) && ! empty( $quote_shipping_method ) ) {
377
+ $wpsc_cart->update_shipping( $quote_shipping_method, $quote_shipping_option );
378
+ }
379
+
380
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
381
+ echo json_encode( array( 'shipping' => wpsc_cart_shipping(), 'coupon' => wpsc_coupon_amount(), 'cart_total' => wpsc_cart_total(), 'tax' => wpsc_cart_tax() ) );
382
+ exit();
383
+ }
384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  }
386
 
387
  /**
737
  $form_id = absint( $_POST['form_id'] );
738
 
739
  $wpsc_selected_country = $wpsc_cart->selected_country;
740
+ $wpsc_selected_region = $wpsc_cart->selected_region;
741
 
742
  $wpsc_delivery_country = $wpsc_cart->delivery_country;
743
+ $wpsc_delivery_region = $wpsc_cart->delivery_region;
 
744
 
745
  $previous_country = wpsc_get_customer_meta( 'billing_country' );
746
+
747
  if ( isset( $_POST['billing_country'] ) ) {
748
  $wpsc_selected_country = $_POST['billing_country'];
749
  wpsc_update_customer_meta( 'billing_country', $wpsc_selected_country );
775
  $wpsc_delivery_region = null;
776
  }
777
 
 
778
  $wpsc_cart->update_location();
779
  $wpsc_cart->get_shipping_method();
780
  $wpsc_cart->get_shipping_option();
781
+
782
  if ( $wpsc_cart->selected_shipping_method != '' ) {
783
  $wpsc_cart->update_shipping( $wpsc_cart->selected_shipping_method, $wpsc_cart->selected_shipping_option );
784
  }
785
 
786
+ $tax = $wpsc_cart->calculate_total_tax();
787
+ $total = wpsc_cart_total();
788
+ $total_input = wpsc_cart_total( false );
789
+
790
+ if ( $wpsc_cart->coupons_amount >= $total_input && ! empty( $wpsc_cart->coupons_amount ) ) {
791
  $total = 0;
792
  }
793
+
794
  if ( $wpsc_cart->total_price < 0 ) {
795
  $wpsc_cart->coupons_amount += $wpsc_cart->total_price;
796
+ $wpsc_cart->total_price = null;
797
  $wpsc_cart->calculate_total_price();
798
  }
 
799
 
 
 
 
 
800
  $delivery_country = wpsc_get_customer_meta( 'shipping_country' );
801
+ $output = _wpsc_ajax_get_cart( false );
802
+ $output = $output['widget_output'];
803
+
804
+ $json_response = array();
805
+
806
+ $json_response['delivery_country'] = esc_js( $delivery_country );
807
+ $json_response['billing_country'] = esc_js( $wpsc_selected_country );
808
+ $json_response['widget_output'] = $output;
809
+ $json_response['shipping_keys'] = array();
810
+ $json_response['cart_shipping'] = wpsc_cart_shipping();
811
+ $json_response['form_id'] = $form_id;
812
+ $json_response['tax'] = $tax;
813
+ $json_response['display_tax'] = wpsc_cart_tax();
814
+ $json_response['total'] = $total;
815
+ $json_response['total_input'] = $total_input;
816
+
817
  if ( get_option( 'lock_tax' ) == 1 ) {
818
+
819
+ $json_response['lock_tax'] = get_option( 'lock_tax' );
820
+ $json_response['country_name'] = wpsc_get_country( $delivery_country );
821
+
822
+ if ( 'US' == $delivery_country || 'CA' == $delivery_country ) {
823
  $output = wpsc_shipping_region_list( $delivery_country, wpsc_get_customer_meta( 'shipping_region' ) );
824
+ $output = str_replace( array( "\n", "\r" ), '', $output );
825
+ $json_response['shipping_region_list'] = $output;
 
826
  }
827
  }
828
 
 
829
  foreach ( $wpsc_cart->cart_items as $key => $cart_item ) {
830
+ $json_response['shipping_keys'][ $key ] = wpsc_currency_display( $cart_item->shipping );
 
 
 
 
 
 
 
 
 
 
831
  }
832
 
 
833
  $form_selected_country = null;
834
+ $form_selected_region = null;
835
+ $onchange_function = null;
836
 
837
+ if ( ! empty( $_POST['billing_country'] ) && $_POST['billing_country'] != 'undefined' && ! isset( $_POST['shipping_country'] ) ) {
838
  $form_selected_country = $wpsc_selected_country;
839
+ $form_selected_region = $wpsc_selected_region;
840
+ $onchange_function = 'set_billing_country';
841
+ } else if ( ! empty( $_POST['shipping_country'] ) && $_POST['shipping_country'] != 'undefined' && ! isset( $_POST['billing_country'] ) ) {
842
  $form_selected_country = $wpsc_delivery_country;
843
+ $form_selected_region = $wpsc_delivery_region;
844
+ $onchange_function = 'set_shipping_country';
845
  }
846
 
847
+ if ( $form_selected_country != null && $onchange_function != null ) {
848
+
849
+ $checkoutfields = 'set_shipping_country' == $onchange_function;
850
+ $region_list = wpsc_country_region_list( $form_id, false, $form_selected_country, $form_selected_region, $form_id, $checkoutfields );
851
+
852
  if ( $region_list != null ) {
853
+ $json_response['region_list'] = str_replace( array( "\n", "\r" ), '', $region_list );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
  }
855
  }
856
 
857
+ echo json_encode( $json_response );
 
 
 
 
 
 
858
  exit();
859
  }
860
 
wpsc-components/theme-engine-v1/helpers/page.php CHANGED
@@ -347,7 +347,7 @@ function wpsc_enqueue_user_script_and_css() {
347
 
348
  wp_localize_script( 'wp-e-commerce', 'wpsc_ajax', array(
349
  'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
350
- 'spinner' => esc_url( admin_url( 'images/wpspin_light.gif' ) ),
351
  'no_quotes' => __( 'It appears that there are no shipping quotes for the shipping information provided. Please check the information and try again.', 'wpsc' )
352
  )
353
  );
347
 
348
  wp_localize_script( 'wp-e-commerce', 'wpsc_ajax', array(
349
  'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
350
+ 'spinner' => esc_url( wpsc_get_ajax_spinner() ),
351
  'no_quotes' => __( 'It appears that there are no shipping quotes for the shipping information provided. Please check the information and try again.', 'wpsc' )
352
  )
353
  );
wpsc-components/theme-engine-v1/helpers/product.php CHANGED
@@ -4,6 +4,7 @@ add_action( 'wpsc_theme_footer', 'wpsc_fancy_notifications' );
4
 
5
  if ( get_option( 'wpsc_replace_page_title' ) == 1 )
6
  add_filter( 'wp_title', 'wpsc_replace_wp_title', 10, 2 );
 
7
  add_filter( 'post_type_link', 'wpsc_product_link', 10, 3 );
8
 
9
  /**
@@ -32,8 +33,14 @@ function wpsc_product_link( $permalink, $post, $leavename ) {
32
 
33
  // Only applies to WPSC products, don't stop on permalinks of other CPTs
34
  // Fixes http://code.google.com/p/wp-e-commerce/issues/detail?id=271
35
- if ($post->post_type != 'wpsc-product')
36
  return $permalink;
 
 
 
 
 
 
37
 
38
  $permalink_structure = get_option( 'permalink_structure' );
39
 
@@ -551,22 +558,21 @@ function wpsc_category_image($category_id = null) {
551
  function wpsc_category_description($category_id = null) {
552
  if($category_id < 1)
553
  $category_id = wpsc_category_id();
554
- $category = get_term_by('id', $category_id, 'wpsc_product_category');
555
- return $category->description;
556
  }
557
 
558
  function wpsc_category_name($category_id = null) {
559
- if($category_id < 1)
560
  $category_id = wpsc_category_id();
561
- $category = get_term_by('id', $category_id, 'wpsc_product_category');
562
- return $category->name;
 
563
  }
564
 
565
  function nzshpcrt_display_categories_groups() {
566
- global $wpdb;
567
-
568
- return $output;
569
- }
570
 
571
  /** wpsc list subcategories function
572
  used to get an array of all the subcategories of a category.
4
 
5
  if ( get_option( 'wpsc_replace_page_title' ) == 1 )
6
  add_filter( 'wp_title', 'wpsc_replace_wp_title', 10, 2 );
7
+
8
  add_filter( 'post_type_link', 'wpsc_product_link', 10, 3 );
9
 
10
  /**
33
 
34
  // Only applies to WPSC products, don't stop on permalinks of other CPTs
35
  // Fixes http://code.google.com/p/wp-e-commerce/issues/detail?id=271
36
+ if ( 'wpsc-product' !== $post->post_type ) {
37
  return $permalink;
38
+ }
39
+
40
+ if ( 'inherit' === $post->post_status && 0 !== $post->post_parent ) {
41
+ $post_id = $post->post_parent;
42
+ $post = get_post( $post_id );
43
+ }
44
 
45
  $permalink_structure = get_option( 'permalink_structure' );
46
 
558
  function wpsc_category_description($category_id = null) {
559
  if($category_id < 1)
560
  $category_id = wpsc_category_id();
561
+ $category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
562
+ return $category ? $category->description : '';
563
  }
564
 
565
  function wpsc_category_name($category_id = null) {
566
+ if ( $category_id < 1 )
567
  $category_id = wpsc_category_id();
568
+
569
+ $category = get_term_by( 'id', $category_id, 'wpsc_product_category' );
570
+ return $category ? $category->name : '';
571
  }
572
 
573
  function nzshpcrt_display_categories_groups() {
574
+ return '';
575
+ }
 
 
576
 
577
  /** wpsc list subcategories function
578
  used to get an array of all the subcategories of a category.
wpsc-components/theme-engine-v1/templates/wpsc-shopping_cart_page.php CHANGED
@@ -233,7 +233,7 @@ endif;
233
  <?php
234
  $args = array(
235
  'remember' => false,
236
- 'redirect' => home_url( $_SERVER['REQUEST_URI'] )
237
  );
238
  wp_login_form( $args );
239
  ?>
233
  <?php
234
  $args = array(
235
  'remember' => false,
236
+ 'redirect' => get_option( 'shopping_cart_url' )
237
  );
238
  wp_login_form( $args );
239
  ?>
wpsc-core/js/wp-e-commerce.js CHANGED
@@ -150,6 +150,16 @@ jQuery(document).ready(function ($) {
150
 
151
  jQuery('#fancy_notification').appendTo('body');
152
 
 
 
 
 
 
 
 
 
 
 
153
  //this bit of code runs on the checkout page. If the checkbox is selected it copies the valus in the billing country and puts it in the shipping country form fields. 23.07.09
154
  //Added 6/25/2012 - Added function to update shiping quotes. This whole file is a bit of a mess in need of some Gary magic.
155
  if(jQuery("#shippingSameBilling").is(":checked"))
@@ -428,12 +438,19 @@ function switchmethod( key, key1 ) {
428
  } else {
429
  jQuery( '.pricedisplay.checkout-shipping' ).html( response.shipping );
430
  }
 
431
  if ( jQuery( '#coupons_amount .pricedisplay' ).size() > 0 ) {
432
  jQuery( '#coupons_amount .pricedisplay' ).html( response.coupon );
433
  } else {
434
  jQuery( '#coupons_amount' ).html( response.coupon );
435
  }
 
 
 
 
 
436
  jQuery( '.pricedisplay.checkout-total' ).html( response.cart_total );
 
437
  }, 'json' );
438
  }
439
 
@@ -574,6 +591,18 @@ function wpsc_handle_country_change( response ) {
574
  jQuery( wpsc_checkout_table_selector + ' .shipping_region' ).parent().parent().show();
575
  }
576
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  if ( response.tax > 0 ) {
578
  jQuery( 'tr.total_tax' ).show();
579
  } else {
150
 
151
  jQuery('#fancy_notification').appendTo('body');
152
 
153
+ /* Clears shipping state and billing state on body load if they are numeric */
154
+ $( 'input[title="shippingstate"], input[title="billingstate"]' ).each( function( index, value ){
155
+ var $this = $( this ), $val = $this.val();
156
+
157
+ if ( $this.is( ':visible' ) && ! isNaN( parseFloat( $val ) ) && isFinite( $val ) ) {
158
+ $this.val( '' );
159
+ }
160
+
161
+ });
162
+
163
  //this bit of code runs on the checkout page. If the checkbox is selected it copies the valus in the billing country and puts it in the shipping country form fields. 23.07.09
164
  //Added 6/25/2012 - Added function to update shiping quotes. This whole file is a bit of a mess in need of some Gary magic.
165
  if(jQuery("#shippingSameBilling").is(":checked"))
438
  } else {
439
  jQuery( '.pricedisplay.checkout-shipping' ).html( response.shipping );
440
  }
441
+
442
  if ( jQuery( '#coupons_amount .pricedisplay' ).size() > 0 ) {
443
  jQuery( '#coupons_amount .pricedisplay' ).html( response.coupon );
444
  } else {
445
  jQuery( '#coupons_amount' ).html( response.coupon );
446
  }
447
+
448
+ if ( jQuery( '#checkout_tax.pricedisplay' ).size() > 0 ) {
449
+ jQuery( '.pricedisplay.checkout-tax' ).html( response.tax );
450
+ }
451
+
452
  jQuery( '.pricedisplay.checkout-total' ).html( response.cart_total );
453
+
454
  }, 'json' );
455
  }
456
 
591
  jQuery( wpsc_checkout_table_selector + ' .shipping_region' ).parent().parent().show();
592
  }
593
 
594
+ if ( 'US' !== response.delivery_country && 'CA' !== response.delivery_country ) {
595
+ var shipping_state = jQuery( wpsc_checkout_table_selector + ' input[title="shippingstate"]' );
596
+ shipping_state.parents( 'tr' ).show();
597
+ shipping_state.val( '' ).prop( 'disabled', false );
598
+ }
599
+
600
+ if ( 'US' !== response.billing_country && 'CA' !== response.billing_country ) {
601
+ var billing_state = jQuery( wpsc_checkout_table_selector + ' input[title="billingstate"]' );
602
+ billing_state.parents( 'tr' ).show();
603
+ billing_state.val( '' ).prop( 'disabled', false );
604
+ }
605
+
606
  if ( response.tax > 0 ) {
607
  jQuery( 'tr.total_tax' ).show();
608
  } else {
wpsc-core/wpsc-constants.php CHANGED
@@ -25,16 +25,17 @@ function wpsc_core_load_session() {
25
  * The core WPEC constants necessary to start loading
26
  */
27
  function wpsc_core_constants() {
28
- if(!defined('WPSC_URL'))
29
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
 
30
  // Define Plugin version
31
- define( 'WPSC_VERSION', '3.8.13-beta' );
32
- define( 'WPSC_MINOR_VERSION', '2c168e9ea8' );
33
- define( 'WPSC_PRESENTABLE_VERSION', '3.8.13-beta' );
34
- define( 'WPSC_DB_VERSION', 7 );
35
 
36
  // Define Debug Variables for developers
37
- define( 'WPSC_DEBUG', false );
38
  define( 'WPSC_GATEWAY_DEBUG', false );
39
 
40
  // Images URL
@@ -261,10 +262,30 @@ function wpsc_core_setup_cart() {
261
  $GLOBALS['wpsc_cart'] = $cart;
262
  else
263
  $GLOBALS['wpsc_cart'] = new wpsc_cart();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
 
265
- $GLOBALS['wpsc_cart']->get_shipping_method();
 
 
266
  }
267
 
 
 
268
  /***
269
  * wpsc_core_setup_globals()
270
  *
25
  * The core WPEC constants necessary to start loading
26
  */
27
  function wpsc_core_constants() {
28
+ if ( ! defined( 'WPSC_URL' ) )
29
  define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
30
+
31
  // Define Plugin version
32
+ define( 'WPSC_VERSION' , '3.8.13.1' );
33
+ define( 'WPSC_MINOR_VERSION' , 'e8a508c011' );
34
+ define( 'WPSC_PRESENTABLE_VERSION', '3.8.13.1' );
35
+ define( 'WPSC_DB_VERSION' , 8 );
36
 
37
  // Define Debug Variables for developers
38
+ define( 'WPSC_DEBUG' , false );
39
  define( 'WPSC_GATEWAY_DEBUG', false );
40
 
41
  // Images URL
262
  $GLOBALS['wpsc_cart'] = $cart;
263
  else
264
  $GLOBALS['wpsc_cart'] = new wpsc_cart();
265
+ }
266
+
267
+ /**
268
+ * _wpsc_action_init_shipping_method()
269
+ *
270
+ * The cart was setup at the beginning of the init sequence, and that's
271
+ * too early to do shipping calculations because custom taxonomies, types
272
+ * and other plugins may not have been initialized. So we save the shipping
273
+ * method initialization for the end of the init sequence.
274
+ */
275
+ function _wpsc_action_init_shipping_method() {
276
+ global $wpsc_cart;
277
+
278
+ if ( ! is_object( $wpsc_cart ) ) {
279
+ wpsc_core_setup_cart();
280
+ }
281
 
282
+ if ( empty( $wpsc_cart->selected_shipping_method ) ) {
283
+ $wpsc_cart->get_shipping_method();
284
+ }
285
  }
286
 
287
+ add_action( 'wpsc_init', '_wpsc_action_init_shipping_method' );
288
+
289
  /***
290
  * wpsc_core_setup_globals()
291
  *
wpsc-core/wpsc-deprecated.php CHANGED
@@ -505,7 +505,7 @@ function wpec_get_the_post_id_by_shortcode( $shortcode ) {
505
  * @3.8
506
  * @returns nothing
507
  */
508
- function wpsc_update_permalinks( $return = '' ) {
509
  _wpsc_deprecated_function( __FUNCTION__, '3.8.9', '_wpsc_action_permalink_structure_changed' );
510
  _wpsc_action_permalink_structure_changed();
511
  }
@@ -1697,7 +1697,7 @@ if ( isset( $_REQUEST['wpsc_admin_action'] ) && ( 'wpsc_display_invoice' == $_RE
1697
  * @return resource $ch
1698
  **/
1699
  function wpsc_curl_ssl( $ch ) {
1700
- _wpsc_deprecated_function( __FUNCTION__, '3.8.13', __( "add_filter( 'https_ssl_verify', '__return_false' )", 'wpsc' ) );
1701
 
1702
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
1703
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
@@ -1738,3 +1738,7 @@ function wpsc_delete_cartmeta( $cart_item_id, $meta_key, $meta_value = '' ) {
1738
  return wpsc_delete_cart_item_meta( $cart_item_id, $meta_key, $meta_value );
1739
  }
1740
 
 
 
 
 
505
  * @3.8
506
  * @returns nothing
507
  */
508
+ function wpsc_update_permalinks( $return = '' ) {
509
  _wpsc_deprecated_function( __FUNCTION__, '3.8.9', '_wpsc_action_permalink_structure_changed' );
510
  _wpsc_action_permalink_structure_changed();
511
  }
1697
  * @return resource $ch
1698
  **/
1699
  function wpsc_curl_ssl( $ch ) {
1700
+ _wpsc_deprecated_function( __FUNCTION__, '3.8.13', "add_filter( 'https_ssl_verify', '__return_false' )" );
1701
 
1702
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
1703
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
1738
  return wpsc_delete_cart_item_meta( $cart_item_id, $meta_key, $meta_value );
1739
  }
1740
 
1741
+ function wpsc_get_exchange_rate( $from, $to ) {
1742
+ _wpsc_deprecated_function( __FUNCTION__, '3.8.13' );
1743
+ return _wpsc_get_exchange_rate( $from, $to );
1744
+ }
wpsc-core/wpsc-functions.php CHANGED
@@ -160,7 +160,7 @@ function wpsc_core_load_purchase_log_statuses() {
160
  'order' => 6,
161
  ),
162
  );
163
- $wpsc_purchlog_statuses = apply_filters('wpsc_set_purchlog_statuses',$wpsc_purchlog_statuses);
164
  }
165
 
166
  /***
@@ -231,8 +231,10 @@ function wpsc_core_load_shipping_modules() {
231
  */
232
  function _wpsc_action_get_shipping_method() {
233
  global $wpsc_cart;
234
- if ( empty( $wpsc_cart->selected_shipping_method ) )
 
235
  $wpsc_cart->get_shipping_method();
 
236
  }
237
 
238
  /**
@@ -303,7 +305,7 @@ function wpsc_register_post_types() {
303
  'public' => true,
304
  'show_ui' => true,
305
  'show_in_nav_menus' => true,
306
- 'menu_icon' => WPSC_CORE_IMAGES_URL . "/credit_cards.png",
307
  'labels' => $labels,
308
  'query_var' => true,
309
  'register_meta_box_cb' => 'wpsc_meta_boxes',
@@ -404,6 +406,7 @@ function wpsc_register_post_types() {
404
  do_action( 'wpsc_register_post_types_after' );
405
  do_action( 'wpsc_register_taxonomies_after' );
406
  }
 
407
  add_action( 'init', 'wpsc_register_post_types', 8 );
408
 
409
  /**
@@ -439,7 +442,7 @@ add_filter( 'post_updated_messages', 'wpsc_post_updated_messages' );
439
  * unserialized one gets butchered by various things
440
  */
441
  function wpsc_serialize_shopping_cart() {
442
- global $wpdb, $wpsc_start_time, $wpsc_cart;
443
 
444
  if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
445
  return;
@@ -451,16 +454,18 @@ function wpsc_serialize_shopping_cart() {
451
  }
452
 
453
  if ( is_object( $wpsc_cart ) )
454
- $wpsc_cart->errors = array( );
455
 
456
  // need to prevent set_cookie from being called at this stage in case the user just logged out
457
  // because by now, some output must have been printed out
458
  $customer_id = wpsc_get_current_customer_id();
 
459
  if ( $customer_id )
460
  wpsc_update_customer_meta( 'cart', base64_encode( serialize( $wpsc_cart ) ) );
461
 
462
  return true;
463
  }
 
464
  add_action( 'shutdown', 'wpsc_serialize_shopping_cart' );
465
 
466
  /**
@@ -519,9 +524,9 @@ function wpsc_update_permalink_slugs() {
519
  if ( ! $id )
520
  continue;
521
 
522
- $ids[$page_string] = $id;
523
 
524
- $the_new_link = get_page_link( $id );
525
 
526
  if ( stristr( get_option( $option_key ), "https://" ) )
527
  $the_new_link = str_replace( 'http://', "https://", $the_new_link );
160
  'order' => 6,
161
  ),
162
  );
163
+ $wpsc_purchlog_statuses = apply_filters( 'wpsc_set_purchlog_statuses', $wpsc_purchlog_statuses );
164
  }
165
 
166
  /***
231
  */
232
  function _wpsc_action_get_shipping_method() {
233
  global $wpsc_cart;
234
+
235
+ if ( empty( $wpsc_cart->selected_shipping_method ) ) {
236
  $wpsc_cart->get_shipping_method();
237
+ }
238
  }
239
 
240
  /**
305
  'public' => true,
306
  'show_ui' => true,
307
  'show_in_nav_menus' => true,
308
+ 'menu_icon' => version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ? WPSC_CORE_IMAGES_URL . '/credit_cards.png' : 'dashicons-cart',
309
  'labels' => $labels,
310
  'query_var' => true,
311
  'register_meta_box_cb' => 'wpsc_meta_boxes',
406
  do_action( 'wpsc_register_post_types_after' );
407
  do_action( 'wpsc_register_taxonomies_after' );
408
  }
409
+
410
  add_action( 'init', 'wpsc_register_post_types', 8 );
411
 
412
  /**
442
  * unserialized one gets butchered by various things
443
  */
444
  function wpsc_serialize_shopping_cart() {
445
+ global $wpsc_cart;
446
 
447
  if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
448
  return;
454
  }
455
 
456
  if ( is_object( $wpsc_cart ) )
457
+ $wpsc_cart->errors = array();
458
 
459
  // need to prevent set_cookie from being called at this stage in case the user just logged out
460
  // because by now, some output must have been printed out
461
  $customer_id = wpsc_get_current_customer_id();
462
+
463
  if ( $customer_id )
464
  wpsc_update_customer_meta( 'cart', base64_encode( serialize( $wpsc_cart ) ) );
465
 
466
  return true;
467
  }
468
+
469
  add_action( 'shutdown', 'wpsc_serialize_shopping_cart' );
470
 
471
  /**
524
  if ( ! $id )
525
  continue;
526
 
527
+ $ids[ $page_string ] = $id;
528
 
529
+ $the_new_link = _get_page_link( $id );
530
 
531
  if ( stristr( get_option( $option_key ), "https://" ) )
532
  $the_new_link = str_replace( 'http://', "https://", $the_new_link );
wpsc-core/wpsc-installer.php CHANGED
@@ -11,7 +11,7 @@ function wpsc_auto_update() {
11
  wpsc_check_and_copy_files();
12
 
13
  $wpsc_version = get_option( 'wpsc_version' );
14
- $wpsc_minor_version = get_option( 'wspc_minor_version' );
15
 
16
  if ( $wpsc_version === false )
17
  add_option( 'wpsc_version', WPSC_VERSION, '', 'yes' );
@@ -50,7 +50,7 @@ function wpsc_install() {
50
  wpsc_create_upload_directories();
51
 
52
  // All code to add new database tables and columns must be above here
53
- $wpsc_version = get_option( 'wpsc_version', 0 );
54
  $wpsc_minor_version = get_option( 'wspc_minor_version', 0 );
55
 
56
  if ( $wpsc_version === false ) {
11
  wpsc_check_and_copy_files();
12
 
13
  $wpsc_version = get_option( 'wpsc_version' );
14
+ $wpsc_minor_version = get_option( 'wpsc_minor_version' );
15
 
16
  if ( $wpsc_version === false )
17
  add_option( 'wpsc_version', WPSC_VERSION, '', 'yes' );
50
  wpsc_create_upload_directories();
51
 
52
  // All code to add new database tables and columns must be above here
53
+ $wpsc_version = get_option( 'wpsc_version', 0 );
54
  $wpsc_minor_version = get_option( 'wspc_minor_version', 0 );
55
 
56
  if ( $wpsc_version === false ) {
wpsc-includes/cart-item.class.php CHANGED
@@ -7,11 +7,10 @@
7
  *
8
  *
9
  * @package wp-e-commerce
10
- * @since 3.9
11
  * @subpackage wpsc-cart-classes
12
  */
13
 
14
-
15
  /**
16
  * The WPSC Cart Items class
17
  */
@@ -59,27 +58,38 @@ class wpsc_cart_item {
59
  var $custom_message = null;
60
  var $custom_file = null;
61
 
 
 
 
 
 
 
 
 
 
62
 
 
 
63
 
64
  /**
65
- * add cart item meta value
 
66
  * @access public
67
  * @param meta key name
68
  * @param meta key value
69
  * @return previous meta value if it existed, nothing otherwise
70
  */
71
- function delete_meta($key) {
72
 
73
- if ( isset($this->item_meta[$key]) ) {
74
- $value = $this->item_meta[$key];
75
- unset( $this->item_meta[$key]);
76
  return $value;
77
  }
78
 
79
  return;
80
  }
81
 
82
-
83
  /**
84
  * update or add cart item meta value
85
  * @access public
@@ -99,25 +109,24 @@ class wpsc_cart_item {
99
  return $result;
100
  }
101
 
102
-
103
  /**
104
- * get cart item meta value
 
105
  * @access public
106
  * @param meta key name, optional, empty returns all meta as an array
107
  * @return previous meta value if it existed, null otherwise
108
  */
109
- function get_meta($key='') {
110
 
111
- if ( empty($key) ) {
112
  $result = $this->item_meta;
113
  } else {
114
- $result = isset($this->item_meta[$key])?$this->item_meta[$key]:null;
115
  }
116
 
117
  return $result;
118
  }
119
 
120
-
121
  public static function refresh_variation_cache() {
122
  global $wpsc_cart;
123
 
@@ -174,6 +183,7 @@ class wpsc_cart_item {
174
  if(($parameters['is_customisable'] == true) && ($parameters['file_data'] != null)) {
175
  $this->save_provided_file($this->file_data);
176
  }
 
177
  $this->refresh_item();
178
 
179
  if ( ! has_action( 'wpsc_add_item', array( 'wpsc_cart_item', 'refresh_variation_cache' ) ) )
@@ -194,8 +204,6 @@ class wpsc_cart_item {
194
  $this->quantity = (int)$quantity;
195
  $this->refresh_item();
196
  $this->update_claimed_stock();
197
-
198
-
199
  }
200
 
201
  /**
@@ -234,7 +242,7 @@ class wpsc_cart_item {
234
  }
235
  }
236
 
237
- $price = apply_filters( 'wpsc_price', $price, $product_id );
238
 
239
  // create the string containing the product name.
240
  $this->product_name = $this->get_title( 'raw' );
@@ -277,7 +285,11 @@ class wpsc_cart_item {
277
  $this->tax = $taxes['tax'];
278
  }
279
 
280
- $this->product_url = get_permalink( $product_id );
 
 
 
 
281
 
282
  if( ! is_array( $this->variation_values ) )
283
  $attach_parent = $product_id;
@@ -326,7 +338,7 @@ class wpsc_cart_item {
326
  public function get_title( $mode = 'display' ) {
327
 
328
  if ( ! get_post_field( 'post_parent', $this->product_id ) )
329
- return get_post_field( 'post_title', $this->product_id);
330
 
331
  if ( empty( self::$variation_cache ) )
332
  self::refresh_variation_cache();
@@ -334,16 +346,16 @@ class wpsc_cart_item {
334
  $primary_product_id = get_post_field( 'post_parent', $this->product_id );
335
  $title = get_post_field( 'post_title', $primary_product_id );
336
 
337
- if ( isset( self::$variation_cache[$this->product_id] ) ) {
338
- ksort( self::$variation_cache[$this->product_id] );
339
- $vars = implode( ', ', self::$variation_cache[$this->product_id] );
340
  $title .= ' (' . $vars . ')';
341
  }
342
 
343
- $title = apply_filters( 'wpsc_cart_product_title', $title, $this->product_id );
344
 
345
  if ( $mode == 'display' )
346
- $title = apply_filters( 'the_title', $title );
347
 
348
  return $title;
349
  }
@@ -393,7 +405,7 @@ class wpsc_cart_item {
393
  $accepted_file_types['ext'][] = 'gif';
394
  $accepted_file_types['ext'][] = 'png';
395
 
396
- $accepted_file_types = apply_filters( 'wpsc_customer_upload_accepted_file_types', $accepted_file_types );
397
 
398
  $can_have_uploaded_image = get_product_meta($this->product_id,'product_metadata',true);
399
  $product = get_post($this->product_id);
@@ -533,38 +545,41 @@ class wpsc_cart_item {
533
 
534
  $cart_item_id = $wpdb->get_var( "SELECT " . $wpdb->insert_id . " AS `id` FROM `".WPSC_TABLE_CART_CONTENTS."` LIMIT 1");
535
 
536
- wpsc_add_cart_item_meta($cart_item_id, 'sku', $this->sku, true );
537
 
538
- if ( !empty( $this->item_meta) ) {
539
- foreach( $this->item_meta as $item_meta_key => $item_meta_value ) {
540
  wpsc_add_cart_item_meta( $cart_item_id, $item_meta_key, $item_meta_value, true );
541
  }
542
  }
543
 
544
- $downloads = get_option('max_downloads');
545
- if($this->is_downloadable == true) {
546
 
547
- $product_files = (array)get_posts(array(
548
- 'post_type' => 'wpsc-product-file',
549
  'post_parent' => $this->product_id,
550
  'numberposts' => -1,
551
  'post_status' => 'inherit'
552
- ));
553
- foreach($product_files as $file){
 
 
 
 
554
  // if the file is downloadable, check that the file is real
555
- $unique_id = sha1(uniqid(mt_rand(), true));
556
 
557
  $wpdb->insert(
558
  WPSC_TABLE_DOWNLOAD_STATUS,
559
  array(
560
  'product_id' => $this->product_id,
561
- 'fileid' => $file->ID,
562
- 'purchid' => $purchase_log_id,
563
- 'cartid' => $cart_item_id,
564
- 'uniqueid' => $unique_id,
565
- 'downloads' => $downloads,
566
- 'active' => 0,
567
- 'datetime' => date( 'Y-m-d H:i:s' )
568
  ),
569
  array(
570
  '%d',
@@ -579,12 +594,12 @@ class wpsc_cart_item {
579
  );
580
 
581
  $download_id = $wpdb->get_var( "SELECT " . $wpdb->insert_id . " AS `id` FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` LIMIT 1");
582
- wpsc_update_meta($download_id, '_is_legacy', 'false', 'wpsc_downloads');
583
  }
584
 
585
  }
586
 
587
- do_action('wpsc_save_cart_item', $cart_item_id, $this->product_id);
588
  }
589
 
590
  }
@@ -596,8 +611,8 @@ class wpsc_cart_item {
596
  * @since 3.8.9
597
  * @access private
598
  */
599
- class _WPSC_Comparison
600
- {
601
  private $orderby = '';
602
  private $order = 'ASC';
603
 
7
  *
8
  *
9
  * @package wp-e-commerce
10
+ * @since 3.8
11
  * @subpackage wpsc-cart-classes
12
  */
13
 
 
14
  /**
15
  * The WPSC Cart Items class
16
  */
58
  var $custom_message = null;
59
  var $custom_file = null;
60
 
61
+ /**
62
+ * compare cart item meta
63
+ * @access public
64
+ * @param other cart item against which this items meta will be compared
65
+ * @return returns true if the cart item meta for this item is the same as is in the cart item in the argument
66
+ */
67
+ function item_meta_equal( $other_cart_item ) {
68
+ $my_item_meta_key = serialize( $this->item_meta );
69
+ $other_item_meta_key = serialize( $other_cart_item->item_meta );
70
 
71
+ return strcmp( $my_item_meta_key, $other_item_meta_key ) == 0;
72
+ }
73
 
74
  /**
75
+ * Add cart item meta value
76
+ *
77
  * @access public
78
  * @param meta key name
79
  * @param meta key value
80
  * @return previous meta value if it existed, nothing otherwise
81
  */
82
+ function delete_meta( $key ) {
83
 
84
+ if ( isset( $this->item_meta[ $key ] ) ) {
85
+ $value = $this->item_meta[ $key ];
86
+ unset( $this->item_meta[ $key ] );
87
  return $value;
88
  }
89
 
90
  return;
91
  }
92
 
 
93
  /**
94
  * update or add cart item meta value
95
  * @access public
109
  return $result;
110
  }
111
 
 
112
  /**
113
+ * Get cart item meta value
114
+ *
115
  * @access public
116
  * @param meta key name, optional, empty returns all meta as an array
117
  * @return previous meta value if it existed, null otherwise
118
  */
119
+ function get_meta( $key = '' ) {
120
 
121
+ if ( empty( $key ) ) {
122
  $result = $this->item_meta;
123
  } else {
124
+ $result = isset( $this->item_meta[ $key ] ) ? $this->item_meta[ $key ] : null;
125
  }
126
 
127
  return $result;
128
  }
129
 
 
130
  public static function refresh_variation_cache() {
131
  global $wpsc_cart;
132
 
183
  if(($parameters['is_customisable'] == true) && ($parameters['file_data'] != null)) {
184
  $this->save_provided_file($this->file_data);
185
  }
186
+
187
  $this->refresh_item();
188
 
189
  if ( ! has_action( 'wpsc_add_item', array( 'wpsc_cart_item', 'refresh_variation_cache' ) ) )
204
  $this->quantity = (int)$quantity;
205
  $this->refresh_item();
206
  $this->update_claimed_stock();
 
 
207
  }
208
 
209
  /**
242
  }
243
  }
244
 
245
+ $price = apply_filters( 'wpsc_price', $price, $product_id, $this );
246
 
247
  // create the string containing the product name.
248
  $this->product_name = $this->get_title( 'raw' );
285
  $this->tax = $taxes['tax'];
286
  }
287
 
288
+ if ( $product->post_parent ) {
289
+ $this->product_url = get_permalink( $product->post_parent );
290
+ } else {
291
+ $this->product_url = get_permalink( $product_id );
292
+ }
293
 
294
  if( ! is_array( $this->variation_values ) )
295
  $attach_parent = $product_id;
338
  public function get_title( $mode = 'display' ) {
339
 
340
  if ( ! get_post_field( 'post_parent', $this->product_id ) )
341
+ return get_post_field( 'post_title', $this->product_id );
342
 
343
  if ( empty( self::$variation_cache ) )
344
  self::refresh_variation_cache();
346
  $primary_product_id = get_post_field( 'post_parent', $this->product_id );
347
  $title = get_post_field( 'post_title', $primary_product_id );
348
 
349
+ if ( isset( self::$variation_cache[ $this->product_id ] ) ) {
350
+ ksort( self::$variation_cache[ $this->product_id ] );
351
+ $vars = implode( ', ', self::$variation_cache[ $this->product_id ] );
352
  $title .= ' (' . $vars . ')';
353
  }
354
 
355
+ $title = apply_filters( 'wpsc_cart_product_title', $title, $this->product_id, $this );
356
 
357
  if ( $mode == 'display' )
358
+ $title = apply_filters( 'the_title', $title, $this );
359
 
360
  return $title;
361
  }
405
  $accepted_file_types['ext'][] = 'gif';
406
  $accepted_file_types['ext'][] = 'png';
407
 
408
+ $accepted_file_types = apply_filters( 'wpsc_customer_upload_accepted_file_types', $accepted_file_types, $this );
409
 
410
  $can_have_uploaded_image = get_product_meta($this->product_id,'product_metadata',true);
411
  $product = get_post($this->product_id);
545
 
546
  $cart_item_id = $wpdb->get_var( "SELECT " . $wpdb->insert_id . " AS `id` FROM `".WPSC_TABLE_CART_CONTENTS."` LIMIT 1");
547
 
548
+ wpsc_add_cart_item_meta( $cart_item_id, 'sku', $this->sku, true );
549
 
550
+ if ( ! empty( $this->item_meta ) ) {
551
+ foreach ( $this->item_meta as $item_meta_key => $item_meta_value ) {
552
  wpsc_add_cart_item_meta( $cart_item_id, $item_meta_key, $item_meta_value, true );
553
  }
554
  }
555
 
556
+ if ( $this->is_downloadable == true ) {
 
557
 
558
+ $product_files = (array) get_posts( array(
559
+ 'post_type' => 'wpsc-product-file',
560
  'post_parent' => $this->product_id,
561
  'numberposts' => -1,
562
  'post_status' => 'inherit'
563
+ ) );
564
+
565
+ $downloads = get_option( 'max_downloads' );
566
+
567
+ foreach ( $product_files as $file ) {
568
+
569
  // if the file is downloadable, check that the file is real
570
+ $unique_id = sha1( uniqid( mt_rand(), true ) );
571
 
572
  $wpdb->insert(
573
  WPSC_TABLE_DOWNLOAD_STATUS,
574
  array(
575
  'product_id' => $this->product_id,
576
+ 'fileid' => $file->ID,
577
+ 'purchid' => $purchase_log_id,
578
+ 'cartid' => $cart_item_id,
579
+ 'uniqueid' => $unique_id,
580
+ 'downloads' => $downloads,
581
+ 'active' => 0,
582
+ 'datetime' => date( 'Y-m-d H:i:s' )
583
  ),
584
  array(
585
  '%d',
594
  );
595
 
596
  $download_id = $wpdb->get_var( "SELECT " . $wpdb->insert_id . " AS `id` FROM `".WPSC_TABLE_DOWNLOAD_STATUS."` LIMIT 1");
597
+ wpsc_update_meta( $download_id, '_is_legacy', 'false', 'wpsc_downloads' );
598
  }
599
 
600
  }
601
 
602
+ do_action( 'wpsc_save_cart_item', $cart_item_id, $this->product_id, $this );
603
  }
604
 
605
  }
611
  * @since 3.8.9
612
  * @access private
613
  */
614
+ class _WPSC_Comparison {
615
+
616
  private $orderby = '';
617
  private $order = 'ASC';
618
 
wpsc-includes/cart.class.php CHANGED
@@ -14,10 +14,6 @@
14
  * The WPSC Cart API for templates
15
  */
16
 
17
- /**
18
- * cart item count function, no parameters
19
- * * @return integer the item countf
20
- */
21
  /**
22
  * tax is included function, no parameters
23
  * * @return boolean true or false depending on settings>general page
@@ -28,6 +24,10 @@ function wpsc_tax_isincluded() {
28
  return $wpec_taxes_controller->wpec_taxes_isincluded();
29
  }
30
 
 
 
 
 
31
  function wpsc_cart_item_count() {
32
  global $wpsc_cart;
33
  $count = 0;
@@ -37,7 +37,6 @@ function wpsc_cart_item_count() {
37
  return $count;
38
  }
39
 
40
-
41
  /**
42
  * coupon amount function, no parameters
43
  * * @return integer the item count
@@ -266,7 +265,7 @@ function _wpsc_validate_cart_product_quantity( $product_id, $parameters, $cart )
266
  }
267
  }
268
  }
269
- add_action( 'wpsc_add_item', '_wpsc_validate_cart_product_quantity', 10, 3 );
270
  add_action( 'wpsc_edit_item', '_wpsc_validate_cart_product_quantity', 10, 3 );
271
 
272
  /**
@@ -629,36 +628,46 @@ class wpsc_cart {
629
  * @param array parameters
630
  * @return boolean true on sucess, false on failure
631
  */
632
- function set_item($product_id, $parameters, $updater = false) {
633
- // default action is adding
634
 
635
- $add_item = false;
 
636
  $edit_item = false;
637
 
638
- if(($parameters['quantity'] > 0) && ($this->check_remaining_quantity($product_id, $parameters['variation_values'], $parameters['quantity']) == true)) {
639
- $new_cart_item = new wpsc_cart_item($product_id,$parameters, $this);
640
- do_action('wpsc_set_cart_item' , $product_id , $parameters , $this);
641
- $add_item = true;
 
 
 
642
  $edit_item = false;
643
- if((count($this->cart_items) > 0) && ($new_cart_item->is_donation != 1)) {
 
 
644
  //loop through each cart item
645
- foreach($this->cart_items as $key => $cart_item) {
 
646
  // compare product ids and variations.
647
- if(($cart_item->product_id == $new_cart_item->product_id) &&
648
- ($cart_item->product_variations == $new_cart_item->product_variations) &&
649
- ($cart_item->custom_message == $new_cart_item->custom_message) &&
650
- ($cart_item->custom_file == $new_cart_item->custom_file)) {
 
 
651
  // if they are the same, increment the count, and break out;
652
- if(!$updater){
653
- $this->cart_items[$key]->quantity += $new_cart_item->quantity;
654
  } else {
655
- $this->cart_items[$key]->quantity = $new_cart_item->quantity;
656
-
657
  }
658
- $this->cart_items[$key]->refresh_item();
659
- $add_item = false;
 
 
660
  $edit_item = true;
661
- do_action('wpsc_edit_item' , $product_id , $parameters , $this);
 
662
 
663
  }
664
  }
@@ -666,19 +675,20 @@ class wpsc_cart {
666
  }
667
 
668
  // if we are still adding the item, add it
669
- if($add_item === true) {
670
  $this->cart_items[] = $new_cart_item;
671
  do_action( 'wpsc_add_item', $product_id, $parameters, $this );
672
  }
673
 
674
  }
675
 
676
- // if some action was performed, return true, otherwise, return false;
677
- $status = false;
678
- if(($add_item == true) || ($edit_item == true)) {
679
- $status = $new_cart_item;
680
- }
681
- $this->cart_item_count = count($this->cart_items);
 
682
  $this->clear_cache();
683
 
684
  return $status;
14
  * The WPSC Cart API for templates
15
  */
16
 
 
 
 
 
17
  /**
18
  * tax is included function, no parameters
19
  * * @return boolean true or false depending on settings>general page
24
  return $wpec_taxes_controller->wpec_taxes_isincluded();
25
  }
26
 
27
+ /**
28
+ * cart item count function, no parameters
29
+ * * @return integer the item count
30
+ */
31
  function wpsc_cart_item_count() {
32
  global $wpsc_cart;
33
  $count = 0;
37
  return $count;
38
  }
39
 
 
40
  /**
41
  * coupon amount function, no parameters
42
  * * @return integer the item count
265
  }
266
  }
267
  }
268
+ add_action( 'wpsc_add_item' , '_wpsc_validate_cart_product_quantity', 10, 3 );
269
  add_action( 'wpsc_edit_item', '_wpsc_validate_cart_product_quantity', 10, 3 );
270
 
271
  /**
628
  * @param array parameters
629
  * @return boolean true on sucess, false on failure
630
  */
631
+ function set_item( $product_id, $parameters, $updater = false ) {
 
632
 
633
+ // default action is adding
634
+ $add_item = false;
635
  $edit_item = false;
636
 
637
+ if ( $parameters['quantity'] > 0 && $this->check_remaining_quantity( $product_id, $parameters['variation_values'], $parameters['quantity'] ) ) {
638
+
639
+ $new_cart_item = new wpsc_cart_item( $product_id, $parameters, $this );
640
+
641
+ do_action( 'wpsc_set_cart_item', $product_id, $parameters, $this, $new_cart_item );
642
+
643
+ $add_item = true;
644
  $edit_item = false;
645
+
646
+ if ( count( $this->cart_items ) > 0 && $new_cart_item->is_donation != 1 ) {
647
+
648
  //loop through each cart item
649
+ foreach ( $this->cart_items as $key => $cart_item ) {
650
+
651
  // compare product ids and variations.
652
+ if ( $cart_item->product_id == $new_cart_item->product_id &&
653
+ $cart_item->product_variations == $new_cart_item->product_variations &&
654
+ $cart_item->custom_message == $new_cart_item->custom_message &&
655
+ $cart_item->custom_file == $new_cart_item->custom_file &&
656
+ $cart_item->item_meta_equal( $new_cart_item ) ) {
657
+
658
  // if they are the same, increment the count, and break out;
659
+ if ( ! $updater ) {
660
+ $this->cart_items[ $key ]->quantity += $new_cart_item->quantity;
661
  } else {
662
+ $this->cart_items[ $key ]->quantity = $new_cart_item->quantity;
 
663
  }
664
+
665
+ $this->cart_items[ $key ]->refresh_item();
666
+
667
+ $add_item = false;
668
  $edit_item = true;
669
+
670
+ do_action( 'wpsc_edit_item', $product_id, $parameters, $this );
671
 
672
  }
673
  }
675
  }
676
 
677
  // if we are still adding the item, add it
678
+ if ( $add_item ) {
679
  $this->cart_items[] = $new_cart_item;
680
  do_action( 'wpsc_add_item', $product_id, $parameters, $this );
681
  }
682
 
683
  }
684
 
685
+ // if some action was performed, return true, otherwise, return false;
686
+ $status = false;
687
+ if ( $add_item || $edit_item ) {
688
+ $status = $new_cart_item;
689
+ }
690
+
691
+ $this->cart_item_count = count( $this->cart_items );
692
  $this->clear_cache();
693
 
694
  return $status;
wpsc-includes/checkout.class.php CHANGED
@@ -491,7 +491,13 @@ class wpsc_checkout {
491
  // dirty hack
492
  if ( $form_data->unique_name == 'billingstate' && empty( $value ) ) {
493
  $billing_country_id = $wpdb->get_var( "SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'billingcountry' AND active = '1' " );
494
- $value = $_POST['collected_data'][$billing_country_id][1];
 
 
 
 
 
 
495
  }
496
 
497
  switch ( $form_data->type ) {
491
  // dirty hack
492
  if ( $form_data->unique_name == 'billingstate' && empty( $value ) ) {
493
  $billing_country_id = $wpdb->get_var( "SELECT `" . WPSC_TABLE_CHECKOUT_FORMS . "`.`id` FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `unique_name` = 'billingcountry' AND active = '1' " );
494
+
495
+ if ( isset( $_POST['collected_data'][ $billing_country_id ][1] ) ) {
496
+ $value = $_POST['collected_data'][ $billing_country_id ][1];
497
+ } else {
498
+ $any_bad_inputs = true;
499
+ $bad_input = true;
500
+ }
501
  }
502
 
503
  switch ( $form_data->type ) {
wpsc-includes/currency.helpers.php CHANGED
@@ -1,36 +1,46 @@
1
  <?php
2
 
3
- function wpsc_get_exchange_rate( $from, $to ) {
4
- if ( $from == $to )
 
5
  return 1;
 
6
 
7
  $key = "wpsc_exchange_{$from}_{$to}";
8
 
9
- if ( $rate = get_transient( $key ) )
10
  return (float) $rate;
 
11
 
12
- $url = 'http://www.google.com/ig/calculator?hl=en&q=1' . urlencode( "{$from}=?{$to}" );
13
- $response = wp_remote_get( $url, array( 'timeout' => 10 ) );
 
 
 
 
 
 
14
 
15
- if ( is_wp_error( $response ) )
16
- return $response;
17
 
18
- $response = str_replace( array( "\n", "\r" ), '', $response['body'] );
19
- $response = preg_replace( '/([{,])(\s*)([^"]+?)\s*:/', '$1"$3":', $response );
20
- $response = json_decode( $response );
21
- $rate = explode( ' ', $response->rhs );
22
- $rate = $rate[0];
23
 
24
- set_transient( $key, $rate, 3600 * 24 );
 
 
 
25
 
26
- return $rate;
 
27
  }
28
 
29
  function wpsc_convert_currency( $amt, $from, $to ) {
30
  if ( empty( $from ) || empty( $to ) )
31
  return $amt;
32
 
33
- $rate = wpsc_get_exchange_rate( $from, $to );
34
  if ( is_wp_error( $rate ) )
35
  return $rate;
36
 
1
  <?php
2
 
3
+ function _wpsc_get_exchange_rate( $from, $to ) {
4
+
5
+ if ( $from == $to ) {
6
  return 1;
7
+ }
8
 
9
  $key = "wpsc_exchange_{$from}_{$to}";
10
 
11
+ if ( $rate = get_transient( $key ) ) {
12
  return (float) $rate;
13
+ }
14
 
15
+ $url = add_query_arg(
16
+ array(
17
+ 'a' => '1',
18
+ 'from' => $from,
19
+ 'to' => $to
20
+ ),
21
+ 'http://www.google.com/finance/converter'
22
+ );
23
 
24
+ $response = wp_remote_retrieve_body( wp_remote_get( $url, array( 'timeout' => 10 ) ) );
 
25
 
26
+ if ( empty( $response ) ) {
27
+ return $response;
28
+ } else {
 
 
29
 
30
+ $rate = explode( 'bld>', $response );
31
+ $rate = explode( $to, $rate[1] );
32
+ $rate = trim( $rate[0] );
33
+ set_transient( $key, $rate, DAY_IN_SECONDS );
34
 
35
+ return $rate;
36
+ }
37
  }
38
 
39
  function wpsc_convert_currency( $amt, $from, $to ) {
40
  if ( empty( $from ) || empty( $to ) )
41
  return $amt;
42
 
43
+ $rate = _wpsc_get_exchange_rate( $from, $to );
44
  if ( is_wp_error( $rate ) )
45
  return $rate;
46
 
wpsc-includes/currency_converter.inc.php CHANGED
@@ -15,20 +15,21 @@
15
  had no such restriction
16
  */
17
 
18
- Class CURRENCYCONVERTER
19
- {
20
- var $_amt=1;
21
- var $_to="";
22
- var $_from="";
23
- var $_error="";
24
- function CURRENCYCONVERTER($amt=1,$to="",$from="")
25
- {
26
- $this->_amt=$amt;
27
- $this->_to=$to;
28
- $this->_from=$from;
 
29
  }
30
- function error()
31
- {
32
  return $this->_error;
33
  }
34
 
@@ -44,39 +45,13 @@
44
  * @param $from string
45
  * The currency you are converting from.
46
  */
47
- function convert($amt = NULL, $to = "", $from = ""){
48
-
49
- $amount = urlencode(round($amt,2));
50
- $from_Currency = urlencode($from);
51
- $to_Currency = urlencode($to);
52
-
53
- $url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
54
-
55
- $ch = curl_init();
56
- $timeout = 20;
57
- curl_setopt ($ch, CURLOPT_URL, $url);
58
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
59
- curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
60
- $rawdata = curl_exec($ch);
61
- curl_close($ch);
62
- if(empty($rawdata)){
63
- throw new Exception( __( 'unable to connect to currency conversion service', 'wpsc' ) );
64
- }
65
 
66
- // google doesn't return a valid JSON response, so we have to
67
- // parse that.
68
- // attempt to use regexp to parse the converted amount. if that fails,
69
- // fall back to using json_decode().
70
- preg_match( '/rhs[^"]+"([\d\s.,]+)/', $rawdata, $matches );
71
- if ( isset( $matches[1] ) ) {
72
- $to_amount = (float) str_replace( array( ',', ' ' ), '', $matches[1] );
73
- } else {
74
- $rawdata = preg_replace( '/(\{|,\s*)([^\s:]+)(\s*:)/', '$1"$2"$3', $rawdata );
75
- $data = json_decode( $rawdata );
76
- }
77
- $to_amount = round( $to_amount, 2 );
78
 
79
- return $to_amount;
80
  }
81
  }
82
  ?>
15
  had no such restriction
16
  */
17
 
18
+ class CURRENCYCONVERTER {
19
+ public $_amt = 1;
20
+ public $_to = '';
21
+ public $_from = '';
22
+ public $_error = '';
23
+
24
+ function __construct( $amt = 1, $to = '', $from = '' ) {
25
+ $this->_amt = $amt;
26
+ $this->_to = $to;
27
+ $this->_from = $from;
28
+
29
+ return wpsc_convert_currency( $amt, $from, $to );
30
  }
31
+
32
+ function error() {
33
  return $this->_error;
34
  }
35
 
45
  * @param $from string
46
  * The currency you are converting from.
47
  */
48
+ function convert( $amt = NULL, $to = '', $from = '' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ $amount = urlencode( round( $amt, 2 ) );
51
+ $from = urlencode( $from );
52
+ $to = urlencode( $to );
 
 
 
 
 
 
 
 
 
53
 
54
+ return wpsc_convert_currency( $amt, $from, $to );
55
  }
56
  }
57
  ?>
wpsc-includes/customer.php CHANGED
@@ -3,6 +3,7 @@
3
  add_action( 'wpsc_set_cart_item' , '_wpsc_action_update_customer_last_active' );
4
  add_action( 'wpsc_add_item' , '_wpsc_action_update_customer_last_active' );
5
  add_action( 'wpsc_before_submit_checkout', '_wpsc_action_update_customer_last_active' );
 
6
 
7
  /**
8
  * Helper function for setting the customer cookie content and expiration
@@ -31,17 +32,17 @@ function _wpsc_set_customer_cookie( $cookie, $expire ) {
31
  * @return string Customer ID
32
  */
33
  function _wpsc_create_customer_id() {
34
- global $wp_roles;
35
 
36
- $role = $wp_roles->get_role( 'wpsc_anonymous' );
37
 
38
- if ( ! $role )
39
- $wp_roles->add_role( 'wpsc_anonymous', __( 'Anonymous', 'wpsc' ) );
 
40
 
41
  $username = '_' . wp_generate_password( 8, false, false );
42
  $password = wp_generate_password( 12, false );
43
 
44
- $id = wp_create_user( $username, $password );
45
  $user = new WP_User( $id );
46
  $user->set_role( 'wpsc_anonymous' );
47
 
@@ -95,14 +96,21 @@ function _wpsc_maybe_setup_bot_user() {
95
  * @param boolean $fake_it Defaults to false
96
  */
97
  function _wpsc_create_customer_id_cookie( $id, $fake_it = false ) {
 
98
  $expire = time() + WPSC_CUSTOMER_DATA_EXPIRATION; // valid for 48 hours
99
- $data = $id . $expire;
100
- $hash = hash_hmac( 'md5', $data, wp_hash( $data ) );
 
 
 
 
 
 
101
  $cookie = $id . '|' . $expire . '|' . $hash;
102
 
103
  // store ID, expire and hash to validate later
104
  if ( $fake_it )
105
- $_COOKIE[WPSC_CUSTOMER_COOKIE] = $cookie;
106
  else
107
  _wpsc_set_customer_cookie( $cookie, $expire );
108
  }
@@ -115,33 +123,35 @@ function _wpsc_create_customer_id_cookie( $id, $fake_it = false ) {
115
  * @return mixed Return the customer ID if the cookie is valid, false if otherwise.
116
  */
117
  function _wpsc_validate_customer_cookie() {
118
- if ( is_admin() || ! isset( $_COOKIE[WPSC_CUSTOMER_COOKIE] ) )
119
  return;
120
 
121
- $cookie = $_COOKIE[WPSC_CUSTOMER_COOKIE];
122
  list( $id, $expire, $hash ) = $x = explode( '|', $cookie );
123
  $data = $id . $expire;
124
- $hmac = hash_hmac( 'md5', $data, wp_hash( $data ) );
125
 
126
- $valid = true;
127
 
128
- if ( ($hmac != $hash) || empty( $id ) || !is_numeric($id)) {
129
- $valid = false;
130
- } else {
131
- // check to be sure the user still exists, could have been purged
132
- $id = intval( $id );
133
- $wp_user = get_user_by( 'id', $id );
134
- if ( $wp_user === false ) {
135
- $valid = false;
136
- }
137
- }
138
 
139
- // if the cookie is invalid, just delete it and a new user will be generated
140
- // later
141
- if ( ! $valid ) {
142
- unset( $_COOKIE[WPSC_CUSTOMER_COOKIE] );
143
- _wpsc_set_customer_cookie( '', time() - 3600 );
144
- }
 
 
 
 
 
 
 
 
 
 
145
  }
146
 
147
  /**
@@ -162,11 +172,6 @@ function wpsc_get_current_customer_id() {
162
  if ( ! empty( $id ) )
163
  return $id;
164
 
165
- // if the user is logged in and the cookie is still there, delete the cookie
166
- if ( is_user_logged_in() && isset( $_COOKIE[WPSC_CUSTOMER_COOKIE] ) ) {
167
- _wpsc_set_customer_cookie( '', time() - 3600 );
168
- }
169
-
170
  // if the user is logged in we use the user id
171
  if ( is_user_logged_in() ) {
172
  return get_current_user_id();
@@ -187,6 +192,10 @@ function wpsc_get_current_customer_id() {
187
  * @since 3.8.13
188
  */
189
  function _wpsc_action_setup_customer() {
 
 
 
 
190
  // if the customer cookie is invalid, unset it
191
  _wpsc_validate_customer_cookie();
192
 
@@ -212,6 +221,8 @@ function _wpsc_action_setup_customer() {
212
  * @return string Internal meta key
213
  */
214
  function _wpsc_get_customer_meta_key( $key ) {
 
 
215
  $blog_prefix = is_multisite() ? $wpdb->get_blog_prefix() : '';
216
  return "{$blog_prefix}_wpsc_{$key}";
217
  }
@@ -226,6 +237,8 @@ function _wpsc_get_customer_meta_key( $key ) {
226
  * @return boolean True if successful, False if otherwise
227
  */
228
  function wpsc_delete_all_customer_meta( $id = false ) {
 
 
229
  if ( ! $id )
230
  $id = wpsc_get_current_customer_id();
231
 
3
  add_action( 'wpsc_set_cart_item' , '_wpsc_action_update_customer_last_active' );
4
  add_action( 'wpsc_add_item' , '_wpsc_action_update_customer_last_active' );
5
  add_action( 'wpsc_before_submit_checkout', '_wpsc_action_update_customer_last_active' );
6
+ add_action( 'wp_login' , '_wpsc_action_setup_customer' );
7
 
8
  /**
9
  * Helper function for setting the customer cookie content and expiration
32
  * @return string Customer ID
33
  */
34
  function _wpsc_create_customer_id() {
 
35
 
36
+ $role = get_role( 'wpsc_anonymous' );
37
 
38
+ if ( ! $role ) {
39
+ add_role( 'wpsc_anonymous', __( 'Anonymous', 'wpsc' ) );
40
+ }
41
 
42
  $username = '_' . wp_generate_password( 8, false, false );
43
  $password = wp_generate_password( 12, false );
44
 
45
+ $id = wp_create_user( $username, $password );
46
  $user = new WP_User( $id );
47
  $user->set_role( 'wpsc_anonymous' );
48
 
96
  * @param boolean $fake_it Defaults to false
97
  */
98
  function _wpsc_create_customer_id_cookie( $id, $fake_it = false ) {
99
+
100
  $expire = time() + WPSC_CUSTOMER_DATA_EXPIRATION; // valid for 48 hours
101
+ $data = $id . $expire;
102
+
103
+ $user = get_user_by( 'id', $id );
104
+ $pass_frag = substr( $user->user_pass, 8, 4 );
105
+
106
+ $key = wp_hash( $user->user_login . $pass_frag . '|' . $expire );
107
+
108
+ $hash = hash_hmac( 'md5', $data, $key );
109
  $cookie = $id . '|' . $expire . '|' . $hash;
110
 
111
  // store ID, expire and hash to validate later
112
  if ( $fake_it )
113
+ $_COOKIE[ WPSC_CUSTOMER_COOKIE ] = $cookie;
114
  else
115
  _wpsc_set_customer_cookie( $cookie, $expire );
116
  }
123
  * @return mixed Return the customer ID if the cookie is valid, false if otherwise.
124
  */
125
  function _wpsc_validate_customer_cookie() {
126
+ if ( is_admin() || ! isset( $_COOKIE[ WPSC_CUSTOMER_COOKIE ] ) )
127
  return;
128
 
129
+ $cookie = $_COOKIE[ WPSC_CUSTOMER_COOKIE ];
130
  list( $id, $expire, $hash ) = $x = explode( '|', $cookie );
131
  $data = $id . $expire;
 
132
 
133
+ $id = intval( $id );
134
 
135
+ // invalid ID
136
+ if ( ! $id )
137
+ return false;
 
 
 
 
 
 
 
138
 
139
+ $user = get_user_by( 'id', $id );
140
+
141
+ // no user found
142
+ if ( $user === false )
143
+ return false;
144
+
145
+ $pass_frag = substr( $user->user_pass, 8, 4 );
146
+ $key = wp_hash( $user->user_login . $pass_frag . '|' . $expire );
147
+ $hmac = hash_hmac( 'md5', $data, $key );
148
+
149
+ // integrity check
150
+ if ( $hmac == $hash )
151
+ return $id;
152
+
153
+ _wpsc_set_customer_cookie( '', time() - 3600 );
154
+ return false;
155
  }
156
 
157
  /**
172
  if ( ! empty( $id ) )
173
  return $id;
174
 
 
 
 
 
 
175
  // if the user is logged in we use the user id
176
  if ( is_user_logged_in() ) {
177
  return get_current_user_id();
192
  * @since 3.8.13
193
  */
194
  function _wpsc_action_setup_customer() {
195
+ // if the user is logged in and the cookie is still there, delete the cookie
196
+ if ( is_user_logged_in() && isset( $_COOKIE[WPSC_CUSTOMER_COOKIE] ) )
197
+ _wpsc_set_customer_cookie( '', time() - 3600 );
198
+
199
  // if the customer cookie is invalid, unset it
200
  _wpsc_validate_customer_cookie();
201
 
221
  * @return string Internal meta key
222
  */
223
  function _wpsc_get_customer_meta_key( $key ) {
224
+ global $wpdb;
225
+
226
  $blog_prefix = is_multisite() ? $wpdb->get_blog_prefix() : '';
227
  return "{$blog_prefix}_wpsc_{$key}";
228
  }
237
  * @return boolean True if successful, False if otherwise
238
  */
239
  function wpsc_delete_all_customer_meta( $id = false ) {
240
+ global $wpdb;
241
+
242
  if ( ! $id )
243
  $id = wpsc_get_current_customer_id();
244
 
wpsc-includes/merchant.class.php CHANGED
@@ -231,7 +231,7 @@ class wpsc_merchant {
231
  "tax" => $cart_row['tax_charged'],
232
  "quantity" => $cart_row['quantity'],
233
  "is_downloadable" => $is_downloadable,
234
- "is_capability" => (bool)wpsc_get_cartmeta( $cart_row['id'], 'provided_capabilities', true ),
235
  "is_recurring" => $is_recurring,
236
  "is_subscription" => $is_recurring,
237
  "recurring_data" => array(
231
  "tax" => $cart_row['tax_charged'],
232
  "quantity" => $cart_row['quantity'],
233
  "is_downloadable" => $is_downloadable,
234
+ "is_capability" => (bool) wpsc_get_cart_item_meta( $cart_row['id'], 'provided_capabilities', true ),
235
  "is_recurring" => $is_recurring,
236
  "is_subscription" => $is_recurring,
237
  "recurring_data" => array(
wpsc-includes/misc.functions.php CHANGED
@@ -889,4 +889,44 @@ if ( isset( $_GET['termsandconds'] ) && 'true' == $_GET['termsandconds'] )
889
  function wpsc_show_terms_and_conditions() {
890
  echo wpautop( wp_kses_post( get_option( 'terms_and_conditions' ) ) );
891
  die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
892
  }
889
  function wpsc_show_terms_and_conditions() {
890
  echo wpautop( wp_kses_post( get_option( 'terms_and_conditions' ) ) );
891
  die();
892
+ }
893
+
894
+ /**
895
+ * Helper function to display proper spinner icon, depending on WP version used.
896
+ * This way, WP 3.8+ users will not feel like they are in a time-warp.
897
+ *
898
+ * @since 3.8.13
899
+ *
900
+ * @return void
901
+ */
902
+ function wpsc_get_ajax_spinner() {
903
+ global $wp_version;
904
+
905
+ if ( version_compare( $wp_version, '3.8', '<' ) ) {
906
+ $url = admin_url( 'images/wpspin_light.gif' );
907
+ } else {
908
+ $url = admin_url( 'images/spinner.gif' );
909
+ }
910
+
911
+ return apply_filters( 'wpsc_get_ajax_spinner', $url );
912
+ }
913
+
914
+ function _wpsc_remove_erroneous_files() {
915
+ $files = array(
916
+ WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/.htaccess',
917
+ WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/error_log',
918
+ WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/functions.php',
919
+ WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/admin-functions.php',
920
+ WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/advanced-cache.php'
921
+ );
922
+
923
+ foreach ( $files as $file ) {
924
+ @unlink( $file );
925
+ }
926
+
927
+ update_option( 'wpsc_38131_file_check', false );
928
+ }
929
+
930
+ if ( get_option( 'wpsc_38131_file_check', true ) ) {
931
+ add_action( 'admin_init', '_wpsc_remove_erroneous_files' );
932
  }
wpsc-includes/page-about.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The template for displaying the About page.
4
+ *
5
+ * @package WordPress
6
+ * @subpackage Twenty_Eleven
7
+ * @since Twenty Eleven 1.0
8
+ */
9
+
10
+ get_header(); ?>
11
+
12
+ <div class="row-fluid aboutBG our-goal"></div>
13
+ <div class="container">
14
+ <div class="row-fluid" id="aboutUs">
15
+ <div class="header span12">
16
+ <h4><span class="show">Licensing.&nbsp;&nbsp;Production &amp; Development.&nbsp;&nbsp;Distribution.&nbsp;&nbsp;Marketing &amp; Publicity.&nbsp;&nbsp;Digital & Social Media.&nbsp;&nbsp;Creative Services.</span><span class="hide">Saban Brands</span></h4>
17
+ </div>
18
+ <div class="row-fluid">
19
+ <div class="span2">
20
+ <ul class="nav nav-pills nav-stacked ">
21
+ <li class="active"><a href="#">Saban Brands</a></li>
22
+ <li><a href="#">Power Rangers emPOWER</a></li>
23
+ <li><a href="#">Paul Frank Arts</a></li>
24
+ </ul>
25
+ </div>
26
+ <script>
27
+ jQuery( document ).ready(function( $ ) {
28
+
29
+ $( 'div.about-section' ).not( ':first' ).hide();
30
+
31
+ var show_about_tabs = function( e ) {
32
+ var $this, $parent, $index, $_index, $_hash;
33
+
34
+ if ( e && $( this ).parents( 'ul' ).hasClass( 'nav-stacked' ) ) {
35
+
36
+ e.preventDefault();
37
+ $this = $( this );
38
+
39
+ } else if ( window.location.hash ) {
40
+
41
+ if ( e ) {
42
+ $_hash = $( this ).prop( 'hash' );
43
+ } else {
44
+ $_hash = window.location.hash;
45
+ }
46
+
47
+ $_index = $( '.about-section.' + $_hash.substring(1) ).index();
48
+ $this = $( '.nav-stacked li' ).eq( $_index ).find( 'a' );
49
+ }
50
+
51
+ $parent = $this.parent(), $index = $parent.index();
52
+
53
+ $( '.nav-stacked li' ).removeClass( 'active' );
54
+
55
+ $parent.addClass( 'active' );
56
+
57
+ $( '.about-section' ).hide();
58
+ $( '.about-section' ).eq( $index ).show();
59
+
60
+ $( '.aboutBG' ).removeClass().addClass( 'row-fluid aboutBG ' + $( '.about-section' ).eq( $index ).attr( 'class' ).split(' ')[1] );
61
+
62
+ }
63
+
64
+ if ( $( 'body' ).hasClass( 'page-id-2' ) ) {
65
+ $( 'li.first-menu-item ul.dropdown-menu a' ).click( show_about_tabs );
66
+ }
67
+
68
+ if ( window.location.hash ) {
69
+ show_about_tabs();
70
+ }
71
+
72
+ $( '.nav-stacked li a' ).click( show_about_tabs );
73
+
74
+ });
75
+ </script>
76
+ <?php while ( have_posts() ) : the_post(); ?>
77
+ <div class="span10" id="description">
78
+ <?php
79
+ the_content();
80
+ ?>
81
+ </div>
82
+ <?php endwhile; // end of the loop. ?>
83
+ <div class="clearfix"></div>
84
+ </div>
85
+ </div>
86
+ <ul class="thumbnails">
87
+ <?php
88
+ $logo_src = isset( $brand_meta['brand-logo_url'] ) ? $brand_meta['brand-logo_url'] : '';
89
+
90
+ $latest_posts = get_posts( array( 'numberposts' => 3, 'brands' => 'saban-brands', 'meta_query' => array( array( 'key' => '_thumbnail_id', 'value' => '', 'compare' => '!=' ) ) ) );
91
+ foreach ( $latest_posts as $latest_post ) :
92
+ ?>
93
+ <li class="span4">
94
+ <div class="thumbnail">
95
+ <?php
96
+ if ( has_post_thumbnail( $latest_post->ID ) )
97
+ echo get_the_post_thumbnail( $latest_post->ID, 'home-page-news' );
98
+
99
+ $link = get_permalink( $latest_post->ID );
100
+
101
+ if ( in_category( 'press', $latest_post->ID ) ) {
102
+ $pdfs = get_posts( array( 'post_parent' => $latest_post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'application/pdf', 'numberposts' => 1 ) );
103
+ $pdf = wp_get_attachment_url( $pdfs[0]->ID );
104
+
105
+ $link = $pdf ? $pdf : $link;
106
+ }
107
+
108
+ ?>
109
+ <div class="copy">
110
+ <h3><?php echo get_the_title( $latest_post->ID ); ?></h3>
111
+ <p><?php echo wp_trim_words( $latest_post->post_content, 16 ); ?></p>
112
+ <a class="btn" href="<?php echo esc_url( $link ); ?>">read Article</a></div>
113
+ </div>
114
+ </li>
115
+ <?php endforeach; ?>
116
+
117
+ </ul><p></p>
118
+
119
+ <!--We Love it Here Row-->
120
+
121
+ <div class="row-fluid" id="weLoveItHere">
122
+ <div class="header span12">
123
+ <h4>We Love it Here</h4>
124
+ </div>
125
+
126
+ <?php
127
+ if ( is_active_sidebar( 'footer-content' ) ) :
128
+ dynamic_sidebar( 'footer-content' );
129
+ endif;
130
+ ?>
131
+ </div>
132
+
133
+ <!--End We Love it Here Row-->
134
+ </div>
135
+
136
+ <?php get_footer(); ?>
wpsc-includes/purchase-log-notification.class.php CHANGED
@@ -62,9 +62,9 @@ abstract class WPSC_Purchase_Log_Notification {
62
  }
63
 
64
  private function get_table_args() {
65
- $log_id = $this->purchase_log->get( 'id' );
66
  $log_data = $this->purchase_log->get_data();
67
- $rows = array();
68
 
69
  $headings = array(
70
  _x( 'Name' , 'purchase log notification table heading', 'wpsc' ) => 'left',
@@ -74,9 +74,9 @@ abstract class WPSC_Purchase_Log_Notification {
74
  );
75
 
76
  $has_additional_details = false;
77
- $additional_details = array();
78
 
79
- foreach( $this->purchase_log->get_cart_contents() as $item ) {
80
  $cart_item_array = array(
81
  'purchase_id' => $log_id,
82
  'cart_item' => (array) $item,
@@ -91,24 +91,27 @@ abstract class WPSC_Purchase_Log_Notification {
91
  // then there's also this annoying apply_filters call, which is apparently not the best example
92
  // of how to use it, but we have to preserve them anyways
93
  $additional_content = apply_filters( 'wpsc_transaction_result_content', $cart_item_array );
94
- if ( ! is_string( $additional_content ) )
 
95
  $additional_content = '';
96
- else
97
  $has_additional_details = true;
 
 
98
  $additional_details[] = $additional_content;
99
 
100
  $item_total = $item->quantity * $item->price;
101
  $item_total = wpsc_currency_display( $item_total , array( 'display_as_html' => false ) );
102
  $item_price = wpsc_currency_display( $item->price, array( 'display_as_html' => false ) );
103
- $item_name = apply_filters( 'the_title', $item->name );
104
- $rows[] = array( $item->name, $item_price, $item->quantity, $item_total );
105
  }
106
 
107
  // Preserve the 'wpsc_transaction_result_content' filter for backward compat
108
  if ( $has_additional_details ) {
109
  $headings[] = __( 'Additional Details', 'wpsc' );
110
  foreach ( $rows as $index => $row ) {
111
- $rows[] = $additional_details[$index];
112
  }
113
  }
114
 
62
  }
63
 
64
  private function get_table_args() {
65
+ $log_id = $this->purchase_log->get( 'id' );
66
  $log_data = $this->purchase_log->get_data();
67
+ $rows = array();
68
 
69
  $headings = array(
70
  _x( 'Name' , 'purchase log notification table heading', 'wpsc' ) => 'left',
74
  );
75
 
76
  $has_additional_details = false;
77
+ $additional_details = array();
78
 
79
+ foreach ( $this->purchase_log->get_cart_contents() as $item ) {
80
  $cart_item_array = array(
81
  'purchase_id' => $log_id,
82
  'cart_item' => (array) $item,
91
  // then there's also this annoying apply_filters call, which is apparently not the best example
92
  // of how to use it, but we have to preserve them anyways
93
  $additional_content = apply_filters( 'wpsc_transaction_result_content', $cart_item_array );
94
+
95
+ if ( ! is_string( $additional_content ) ) {
96
  $additional_content = '';
97
+ } else {
98
  $has_additional_details = true;
99
+ }
100
+
101
  $additional_details[] = $additional_content;
102
 
103
  $item_total = $item->quantity * $item->price;
104
  $item_total = wpsc_currency_display( $item_total , array( 'display_as_html' => false ) );
105
  $item_price = wpsc_currency_display( $item->price, array( 'display_as_html' => false ) );
106
+ $item_name = apply_filters( 'the_title', $item->name );
107
+ $rows[] = array( $item->name, $item_price, $item->quantity, $item_total );
108
  }
109
 
110
  // Preserve the 'wpsc_transaction_result_content' filter for backward compat
111
  if ( $has_additional_details ) {
112
  $headings[] = __( 'Additional Details', 'wpsc' );
113
  foreach ( $rows as $index => $row ) {
114
+ $rows[] = $additional_details[ $index ];
115
  }
116
  }
117
 
wpsc-includes/wpsc-meta-cart-item.php CHANGED
@@ -23,7 +23,7 @@
23
  * @return bool False for failure. True for success.
24
  */
25
  function wpsc_add_cart_item_meta( $cart_item_id, $meta_key, $meta_value, $unique = false ) {
26
- return add_metadata( 'wpsc_cart_item' , $cart_item_id, $meta_key , $meta_value, $unique );
27
  }
28
 
29
  /**
@@ -43,7 +43,7 @@ function wpsc_add_cart_item_meta( $cart_item_id, $meta_key, $meta_value, $unique
43
  * @return bool False for failure. True for success.
44
  */
45
  function wpsc_delete_cart_item_meta( $cart_item_id, $meta_key, $meta_value = '' ) {
46
- return delete_metadata( 'wpsc_cart_item' , $cart_item_id , $meta_key , $meta_value );
47
  }
48
 
49
  /**
23
  * @return bool False for failure. True for success.
24
  */
25
  function wpsc_add_cart_item_meta( $cart_item_id, $meta_key, $meta_value, $unique = false ) {
26
+ return add_metadata( 'wpsc_cart_item' , $cart_item_id, $meta_key , $meta_value, $unique );
27
  }
28
 
29
  /**
43
  * @return bool False for failure. True for success.
44
  */
45
  function wpsc_delete_cart_item_meta( $cart_item_id, $meta_key, $meta_value = '' ) {
46
+ return delete_metadata( 'wpsc_cart_item', $cart_item_id , $meta_key , $meta_value );
47
  }
48
 
49
  /**
wpsc-includes/wpsc-meta-functions-template.txt DELETED
@@ -1,186 +0,0 @@
1
- //
2
- // {$OBJECT_TYPE} meta functions
3
- //
4
-
5
- /**
6
- * Add meta data field to a {$OBJECT_TYPE}.
7
- *
8
- * This meta data function mirrors a corresponding wordpress post meta function.
9
- *
10
- * @since 3.8.12
11
- *
12
- * @param int ${$OBJECT_TYPE}_id {$OBJECT_TYPE} ID.
13
- * @param string $meta_key Metadata name.
14
- * @param mixed $meta_value Metadata value.
15
- * @param bool $unique Optional, default is false. Whether the same key should not be added.
16
- * @return bool False for failure. True for success.
17
- */
18
- function wpsc_add_{$OBJECT_TYPE}_meta( ${$OBJECT_TYPE}_id, $meta_key, $meta_value, $unique = false ) {
19
- return add_metadata( '{$OBJECT_TYPE}' , ${$OBJECT_TYPE}_id, $meta_key , $meta_value, $unique );
20
- }
21
-
22
- /**
23
- * Remove metadata matching criteria from a {$OBJECT_TYPE}.
24
- *
25
- * You can match based on the key, or key and value. Removing based on key and
26
- * value, will keep from removing duplicate metadata with the same key. It also
27
- * allows removing all metadata matching key, if needed.
28
-
29
- * This meta data function mirrors a corresponding wordpress post meta function.
30
- *
31
- * @since 3.8.12
32
- *
33
- * @param int ${$OBJECT_TYPE}_id {$OBJECT_TYPE} ID
34
- * @param string $meta_key Metadata name.
35
- * @param mixed $meta_value Optional. Metadata value.
36
- * @return bool False for failure. True for success.
37
- */
38
- function wpsc_delete_{$OBJECT_TYPE}_meta( ${$OBJECT_TYPE}_id, $meta_key, $meta_value = '' ) {
39
- return delete_metadata( '{$OBJECT_TYPE}' , ${$OBJECT_TYPE}_id , $meta_key , $meta_value );
40
- }
41
-
42
- /**
43
- * Retrieve {$OBJECT_TYPE} meta field for a {$OBJECT_TYPE}.
44
- *
45
- * @since 3.8.12
46
- *
47
- * @param int ${$OBJECT_TYPE}_id {$OBJECT_TYPE} ID.
48
- * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
49
- * @param bool $single Whether to return a single value.
50
- * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
51
- * is true.
52
- */
53
- function wpsc_get_{$OBJECT_TYPE}_meta( ${$OBJECT_TYPE}_id, $key = '', $single = false ) {
54
- return get_metadata( '{$OBJECT_TYPE}' , ${$OBJECT_TYPE}_id , $key, $single );
55
- }
56
-
57
- /**
58
- * Determine if a meta key is set for a given {$OBJECT_TYPE}.
59
- *
60
- * @since 3.8.12
61
- *
62
- * @param int ${$OBJECT_TYPE}_id {$OBJECT_TYPE} ID.
63
- * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
64
- * @return boolean true of the key is set, false if not.
65
- * is true.
66
- */
67
- function wpsc_{$OBJECT_TYPE}_meta_exists( ${$OBJECT_TYPE}_id, $meta_key ) {
68
- return metadata_exists( '{$OBJECT_TYPE}' , ${$OBJECT_TYPE}_id , $meta_key );
69
- }
70
-
71
- /**
72
- * Update {$OBJECT_TYPE} meta field based on {$OBJECT_TYPE} ID.
73
- *
74
- * Use the $prev_value parameter to differentiate between meta fields with the
75
- * same key and {$OBJECT_TYPE} ID.
76
- *
77
- * If the meta field for the {$OBJECT_TYPE} does not exist, it will be added.
78
-
79
- * This meta data function mirrors a corresponding wordpress post meta function.
80
- *
81
- * @since 3.8.12
82
- *
83
- * @param int ${$OBJECT_TYPE}_id ${$OBJECT_TYPE} ID.
84
- * @param string $meta_key Metadata key.
85
- * @param mixed $meta_value Metadata value.
86
- * @param mixed $prev_value Optional. Previous value to check before removing.
87
- * @return bool False on failure, true if success.
88
- */
89
- function wpsc_update_{$OBJECT_TYPE}_meta( ${$OBJECT_TYPE}_id, $meta_key, $meta_value, $prev_value = '' ) {
90
- return update_metadata( '{$OBJECT_TYPE}' , ${$OBJECT_TYPE}_id , $meta_key , $meta_value , $prev_value );
91
- }
92
-
93
- /**
94
- * Delete everything from {$OBJECT_TYPE} meta matching meta key.
95
- * This meta data function mirrors a corresponding wordpress post meta function.
96
- * @since 3.8.12
97
- *
98
- * @param string ${$OBJECT_TYPE}_meta_key Key to search for when deleting.
99
- * @return bool Whether the {$OBJECT_TYPE} meta key was deleted from the database
100
- */
101
- function wpsc_delete_{$OBJECT_TYPE}_meta_by_key( ${$OBJECT_TYPE}_meta_key ) {
102
- return delete_metadata( '{$OBJECT_TYPE}' , null , ${$OBJECT_TYPE}_meta_key , '' , true );
103
- }
104
-
105
- /**
106
- * Retrieve {$OBJECT_TYPE} meta fields, based on {$OBJECT_TYPE} ID.
107
- *
108
- * The {$OBJECT_TYPE} meta fields are retrieved from the cache where possible,
109
- * so the function is optimized to be called more than once.
110
- * This meta data function mirrors a corresponding wordpress post meta function.
111
- *
112
- * @since 3.8.12
113
- *
114
- * @param int ${$OBJECT_TYPE}_id {$OBJECT_TYPE} ID.
115
- * @return array
116
- */
117
- function wpsc_get_{$OBJECT_TYPE}_custom( ${$OBJECT_TYPE}_id = 0 ) {
118
- ${$OBJECT_TYPE}_id = absint( ${$OBJECT_TYPE}_id );
119
- return get_{$OBJECT_TYPE}_meta( ${$OBJECT_TYPE}_id );
120
- }
121
-
122
- /**
123
- * Retrieve meta field names for a {$OBJECT_TYPE}.
124
- *
125
- * If there are no meta fields, then nothing(null) will be returned.
126
- * This meta data function mirrors a corresponding wordpress post meta function.
127
- *
128
- * @since 3.8.12
129
- *
130
- * @param int ${$OBJECT_TYPE}_id {$OBJECT_TYPE} ID
131
- * @return array|null Either array of the keys, or null if keys could not be retrieved.
132
- */
133
- function wpsc_get_{$OBJECT_TYPE}_custom_keys( ${$OBJECT_TYPE}_id = 0 ) {
134
- $custom = get_{$OBJECT_TYPE}_custom( ${$OBJECT_TYPE}_id );
135
-
136
- if ( ! is_array( $custom ) )
137
- return;
138
-
139
- if ( $keys = array_keys( $custom ) )
140
- return $keys;
141
- }
142
-
143
- /**
144
- * Retrieve values for a custom {$OBJECT_TYPE} field.
145
- *
146
- * The parameters must not be considered optional. All of the {$OBJECT_TYPE} meta fields
147
- * will be retrieved and only the meta field key values returned.
148
- * This meta data function mirrors a corresponding wordpress post meta function.
149
- *
150
- * @since 3.8.12
151
- *
152
- * @param string $metakey Meta field key.
153
- * @param int ${$OBJECT_TYPE}_id {$OBJECT_TYPE} ID
154
- * @return array Meta field values.
155
- */
156
- function wpsc_get_{$OBJECT_TYPE}_custom_values( $metakey = '', ${$OBJECT_TYPE}_id = 0 ) {
157
-
158
- if ( ! $key )
159
- return null;
160
-
161
- $custom = get_{$OBJECT_TYPE}_custom( ${$OBJECT_TYPE}_id );
162
-
163
- return isset( $custom[$key] ) ? $custom[$key] : null;
164
- }
165
-
166
- /**
167
- * Calls function for each meta matching the timestamp criteria. Callback function
168
- * will get a single parameter that is an object representing the meta.
169
- *
170
- * @since 3.8.12
171
- *
172
- * @param function $callback function to invoke once for each meta matching criteria
173
- * @param int|string $timestamp timestamp to compare meta items against, if int a unix timestamp is assumed,
174
- * if string a mysql timestamp is assumed
175
- * @param string $comparison any one of the supported comparison operators,(=,>=,>,<=,<,<>,!=)
176
- * @param string $meta_key restrict testing of meta to the values with the specified meta key
177
- * @return int count of meta items matching the criteria
178
- */
179
- function wpsc_get_{$OBJECT_TYPE}_meta_by_timestamp( $callback = null, $timestamp = 0, $comparison = '>', $metakey = '' ) {
180
- return wpsc_get_meta_by_timestamp( '{$OBJECT_TYPE}', $callback , $timestamp , $comparison , $metakey );
181
- }
182
-
183
-
184
-
185
-
186
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-includes/wpsc-meta-visitor.php DELETED
@@ -1,194 +0,0 @@
1
- <?php
2
- /*
3
- ** NOTICE:
4
- ** This file was automatically created, strongly suggest that it not be edited directly.
5
- ** See the code in the file wpsc-meta-init.php near line 320 for more details.
6
- */
7
-
8
-
9
- //
10
- // visitor meta functions
11
- //
12
-
13
- /**
14
- * Add meta data field to a visitor.
15
- *
16
- * This meta data function mirrors a corresponding wordpress post meta function.
17
- *
18
- * @since 3.8.12
19
- *
20
- * @param int $visitor_id visitor ID.
21
- * @param string $meta_key Metadata name.
22
- * @param mixed $meta_value Metadata value.
23
- * @param bool $unique Optional, default is false. Whether the same key should not be added.
24
- * @return bool False for failure. True for success.
25
- */
26
- function wpsc_add_visitor_meta( $visitor_id, $meta_key, $meta_value, $unique = false ) {
27
- return add_metadata( 'visitor' , $visitor_id, $meta_key , $meta_value, $unique );
28
- }
29
-
30
- /**
31
- * Remove metadata matching criteria from a visitor.
32
- *
33
- * You can match based on the key, or key and value. Removing based on key and
34
- * value, will keep from removing duplicate metadata with the same key. It also
35
- * allows removing all metadata matching key, if needed.
36
-
37
- * This meta data function mirrors a corresponding wordpress post meta function.
38
- *
39
- * @since 3.8.12
40
- *
41
- * @param int $visitor_id visitor ID
42
- * @param string $meta_key Metadata name.
43
- * @param mixed $meta_value Optional. Metadata value.
44
- * @return bool False for failure. True for success.
45
- */
46
- function wpsc_delete_visitor_meta( $visitor_id, $meta_key, $meta_value = '' ) {
47
- return delete_metadata( 'visitor' , $visitor_id , $meta_key , $meta_value );
48
- }
49
-
50
- /**
51
- * Retrieve visitor meta field for a visitor.
52
- *
53
- * @since 3.8.12
54
- *
55
- * @param int $visitor_id visitor ID.
56
- * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
57
- * @param bool $single Whether to return a single value.
58
- * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
59
- * is true.
60
- */
61
- function wpsc_get_visitor_meta( $visitor_id, $key = '', $single = false ) {
62
- return get_metadata( 'visitor' , $visitor_id , $key, $single );
63
- }
64
-
65
- /**
66
- * Determine if a meta key is set for a given visitor.
67
- *
68
- * @since 3.8.12
69
- *
70
- * @param int $visitor_id visitor ID.
71
- * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
72
- * @return boolean true of the key is set, false if not.
73
- * is true.
74
- */
75
- function wpsc_visitor_meta_exists( $visitor_id, $meta_key ) {
76
- return metadata_exists( 'visitor' , $visitor_id , $meta_key );
77
- }
78
-
79
- /**
80
- * Update visitor meta field based on visitor ID.
81
- *
82
- * Use the $prev_value parameter to differentiate between meta fields with the
83
- * same key and visitor ID.
84
- *
85
- * If the meta field for the visitor does not exist, it will be added.
86
-
87
- * This meta data function mirrors a corresponding wordpress post meta function.
88
- *
89
- * @since 3.8.12
90
- *
91
- * @param int $visitor_id $visitor ID.
92
- * @param string $meta_key Metadata key.
93
- * @param mixed $meta_value Metadata value.
94
- * @param mixed $prev_value Optional. Previous value to check before removing.
95
- * @return bool False on failure, true if success.
96
- */
97
- function wpsc_update_visitor_meta( $visitor_id, $meta_key, $meta_value, $prev_value = '' ) {
98
- return update_metadata( 'visitor' , $visitor_id , $meta_key , $meta_value , $prev_value );
99
- }
100
-
101
- /**
102
- * Delete everything from visitor meta matching meta key.
103
- * This meta data function mirrors a corresponding wordpress post meta function.
104
- * @since 3.8.12
105
- *
106
- * @param string $visitor_meta_key Key to search for when deleting.
107
- * @return bool Whether the visitor meta key was deleted from the database
108
- */
109
- function wpsc_delete_visitor_meta_by_key( $visitor_meta_key ) {
110
- return delete_metadata( 'visitor' , null , $visitor_meta_key , '' , true );
111
- }
112
-
113
- /**
114
- * Retrieve visitor meta fields, based on visitor ID.
115
- *
116
- * The visitor meta fields are retrieved from the cache where possible,
117
- * so the function is optimized to be called more than once.
118
- * This meta data function mirrors a corresponding wordpress post meta function.
119
- *
120
- * @since 3.8.12
121
- *
122
- * @param int $visitor_id visitor ID.
123
- * @return array
124
- */
125
- function wpsc_get_visitor_custom( $visitor_id = 0 ) {
126
- $visitor_id = absint( $visitor_id );
127
- return get_visitor_meta( $visitor_id );
128
- }
129
-
130
- /**
131
- * Retrieve meta field names for a visitor.
132
- *
133
- * If there are no meta fields, then nothing(null) will be returned.
134
- * This meta data function mirrors a corresponding wordpress post meta function.
135
- *
136
- * @since 3.8.12
137
- *
138
- * @param int $visitor_id visitor ID
139
- * @return array|null Either array of the keys, or null if keys could not be retrieved.
140
- */
141
- function wpsc_get_visitor_custom_keys( $visitor_id = 0 ) {
142
- $custom = get_visitor_custom( $visitor_id );
143
-
144
- if ( ! is_array( $custom ) )
145
- return;
146
-
147
- if ( $keys = array_keys( $custom ) )
148
- return $keys;
149
- }
150
-
151
- /**
152
- * Retrieve values for a custom visitor field.
153
- *
154
- * The parameters must not be considered optional. All of the visitor meta fields
155
- * will be retrieved and only the meta field key values returned.
156
- * This meta data function mirrors a corresponding wordpress post meta function.
157
- *
158
- * @since 3.8.12
159
- *
160
- * @param string $metakey Meta field key.
161
- * @param int $visitor_id visitor ID
162
- * @return array Meta field values.
163
- */
164
- function wpsc_get_visitor_custom_values( $metakey = '', $visitor_id = 0 ) {
165
-
166
- if ( ! $key )
167
- return null;
168
-
169
- $custom = get_visitor_custom( $visitor_id );
170
-
171
- return isset( $custom[$key] ) ? $custom[$key] : null;
172
- }
173
-
174
- /**
175
- * Calls function for each meta matching the timestamp criteria. Callback function
176
- * will get a single parameter that is an object representing the meta.
177
- *
178
- * @since 3.8.12
179
- *
180
- * @param function $callback function to invoke once for each meta matching criteria
181
- * @param int|string $timestamp timestamp to compare meta items against, if int a unix timestamp is assumed,
182
- * if string a mysql timestamp is assumed
183
- * @param string $comparison any one of the supported comparison operators,(=,>=,>,<=,<,<>,!=)
184
- * @param string $meta_key restrict testing of meta to the values with the specified meta key
185
- * @return int count of meta items matching the criteria
186
- */
187
- function wpsc_get_visitor_meta_by_timestamp( $callback = null, $timestamp = 0, $comparison = '>', $metakey = '' ) {
188
- return wpsc_get_meta_by_timestamp( 'visitor', $callback , $timestamp , $comparison , $metakey );
189
- }
190
-
191
-
192
-
193
-
194
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpsc-merchants/GoogleCheckout-XML.php CHANGED
@@ -449,8 +449,6 @@ function nzsc_googleResponse() {
449
  $server_type = get_option('google_server_type');
450
  $currency = get_option('google_cur');
451
 
452
- $xml_response = isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:file_get_contents("php://input");
453
-
454
  define('RESPONSE_HANDLER_ERROR_LOG_FILE', 'library/googleerror.log');
455
  define('RESPONSE_HANDLER_LOG_FILE', 'library/googlemessage.log');
456
  if (stristr($_SERVER['HTTP_USER_AGENT'],"Google Checkout Notification Agent")) {
449
  $server_type = get_option('google_server_type');
450
  $currency = get_option('google_cur');
451
 
 
 
452
  define('RESPONSE_HANDLER_ERROR_LOG_FILE', 'library/googleerror.log');
453
  define('RESPONSE_HANDLER_LOG_FILE', 'library/googlemessage.log');
454
  if (stristr($_SERVER['HTTP_USER_AGENT'],"Google Checkout Notification Agent")) {
wpsc-merchants/paypal-pro.merchant.php CHANGED
@@ -324,7 +324,7 @@ class wpsc_merchant_paypal_pro extends wpsc_merchant {
324
  $altered_count = 0;
325
  if ( (bool)$cart_row['is_recurring'] == true ) {
326
  $altered_count++;
327
- wpsc_update_cartmeta( $cart_row['cart_item_id'], 'is_subscribed', 0 );
328
  }
329
  }
330
  break;
324
  $altered_count = 0;
325
  if ( (bool)$cart_row['is_recurring'] == true ) {
326
  $altered_count++;
327
+ wpsc_update_cart_item_meta( $cart_row['cart_item_id'], 'is_subscribed', 0 );
328
  }
329
  }
330
  break;
wpsc-merchants/paypal-standard.merchant.php CHANGED
@@ -532,7 +532,7 @@ class wpsc_merchant_paypal_standard extends wpsc_merchant {
532
  $altered_count = 0;
533
  if ( (bool)$cart_row['is_recurring'] == true ) {
534
  $altered_count++;
535
- wpsc_update_cartmeta( $cart_row['cart_item_id'], 'is_subscribed', 0 );
536
  }
537
  }
538
  break;
532
  $altered_count = 0;
533
  if ( (bool)$cart_row['is_recurring'] == true ) {
534
  $altered_count++;
535
+ wpsc_update_cart_item_meta( $cart_row['cart_item_id'], 'is_subscribed', 0 );
536
  }
537
  }
538
  break;
wpsc-shipping/flatrate.php CHANGED
@@ -75,8 +75,8 @@ class flatrate {
75
  break;
76
 
77
  case 'US':
78
- $output .= $this->settings_form_shipping_price_field( 'continental', __( 'South Island', 'wpsc' ), $shipping['continental'] );
79
- $output .= $this->settings_form_shipping_price_field( 'all', __( 'All 50 States', 'wpsc' ), $shipping['all'] );
80
  break;
81
 
82
  default:
75
  break;
76
 
77
  case 'US':
78
+ $output .= $this->settings_form_shipping_price_field( 'continental', __( 'Continental 48 States', 'wpsc' ), $shipping['continental'] );
79
+ $output .= $this->settings_form_shipping_price_field( 'all', __( 'All 50 States' , 'wpsc' ), $shipping['all'] );
80
  break;
81
 
82
  default:
wpsc-shipping/usps_20.php CHANGED
@@ -516,9 +516,7 @@ class ash_usps {
516
  * @param string $response Reference to the $response string
517
  */
518
  function _clean_response( &$response ) {
519
- $bad_encoding = array( "&amp;lt;sup&amp;gt;&amp;amp;", ";&amp;lt;/sup&amp;gt;" );
520
- $good_encoding = array( "<sup>","</sup>" );
521
- $response = str_replace( $bad_encoding, $good_encoding, $response );
522
  }
523
 
524
  /**
516
  * @param string $response Reference to the $response string
517
  */
518
  function _clean_response( &$response ) {
519
+ return html_entity_decode( html_entity_decode( $response ) );
 
 
520
  }
521
 
522
  /**
wpsc-taxes/controllers/taxes_controller.class.php CHANGED
@@ -618,7 +618,7 @@ class wpec_taxes_controller {
618
  }
619
  } // if
620
  ?>
621
- <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-feedback" title="" alt="" />
622
  </td>
623
 
624
 
618
  }
619
  } // if
620
  ?>
621
+ <img src="<?php echo esc_url( wpsc_get_ajax_spinner() ); ?>" class="ajax-feedback" title="" alt="" />
622
  </td>
623
 
624
 
wpsc-updates/currency_list.php CHANGED
@@ -102,7 +102,7 @@ INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (100, '" . __( 'Canada', 'wpsc
102
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (101, '" . __( 'Cambodia', 'wpsc' ) ."', 'KH', '" . __('Kampuchean Riel', 'wpsc') ."', '', '', '" . __('KHR', 'wpsc') . "', '0', '0','asiapacific','1');
103
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (102, '" . __( 'Burundi', 'wpsc' ) ."', 'BI', '" . __('Burundi Franc', 'wpsc') ."', '', '', '" . __('BIF', 'wpsc') . "', '0', '0','africa','1');
104
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (103, '" . __( 'Burkina Faso', 'wpsc' ) ."', 'BF', '" . __('CFA Franc BCEAO', 'wpsc') ."', '', '', '" . __('XOF', 'wpsc') . "', '0', '0','africa','1');
105
- INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (104, '" . __( 'Bulgaria', 'wpsc' ) ."', 'BG', '" . __('Bulgarian Lev', 'wpsc') ."', '', '', '" . __('BGL', 'wpsc') . "', '0', '0','europe','1');
106
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (105, '" . __( 'Brunei Darussalam', 'wpsc' ) ."', 'BN', '" . __('Brunei Dollar', 'wpsc') ."', '" . __('$', 'wpsc') . "', '" . __('&#036;', 'wpsc') . "', '" . __('BND', 'wpsc') . "', '0', '0','asiapacific','1');
107
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (106, '" . __( 'British Indian Ocean Territory', 'wpsc' ) ."', 'IO', '" . __('US Dollar', 'wpsc') ."', '$', '&#036;', 'USD', '0', '0','asiapacific','1');
108
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (107, '" . __( 'Brazil', 'wpsc' ) ."', 'BR', '" . __('Brazilian Real', 'wpsc') ."', '', '', '" . __('BRL', 'wpsc') . "', '0', '0','southamerica','1');
@@ -248,4 +248,4 @@ INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (249, '" . __( 'Curacao', 'wps
248
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (250, '" . __( 'Saint Martin (French Part)', 'wpsc' ) ."', 'MF', '" . __('Euro', 'wpsc') . "', '" . __('€', 'wpsc') . "', '" . __('&#8364;', 'wpsc') . "', '" . __('EUR', 'wpsc') . "', '0', '0','southamerica','1');
249
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (251, '" . __( 'Palestinian Territories', 'wpsc' ) ."', 'PS', '" . __('Israeli New Shekel', 'wpsc') ."', '" . __( '₪', 'wpsc' ) . "', '" . __( '&#8362;', 'wpsc' ) . "', '" . __('ILS', 'wpsc') . "', '0', '0', 'asiapacific','1');
250
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (252, '" . __( 'Sint Maarten (Dutch Part)', 'wpsc' ) ."', 'SX', '" . __('Netherlands Antillean Guilder', 'wpsc') . "', '" . __( 'ƒ', 'wpsc' ) . "', '" . __( '&#402;', 'wpsc' ) . "', '" . __('ANG', 'wpsc') . "', '0', '0','africa','1');
251
- INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (253, '" . __( 'French Guiana', 'wpsc' ) ."', 'GF', '" . __('Euro', 'wpsc') . "', '" . __('€', 'wpsc') . "', '" . __('&#8364;', 'wpsc') . "', '" . __('EUR', 'wpsc') . "', '0', '0','southamerica','1');";
102
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (101, '" . __( 'Cambodia', 'wpsc' ) ."', 'KH', '" . __('Kampuchean Riel', 'wpsc') ."', '', '', '" . __('KHR', 'wpsc') . "', '0', '0','asiapacific','1');
103
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (102, '" . __( 'Burundi', 'wpsc' ) ."', 'BI', '" . __('Burundi Franc', 'wpsc') ."', '', '', '" . __('BIF', 'wpsc') . "', '0', '0','africa','1');
104
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (103, '" . __( 'Burkina Faso', 'wpsc' ) ."', 'BF', '" . __('CFA Franc BCEAO', 'wpsc') ."', '', '', '" . __('XOF', 'wpsc') . "', '0', '0','africa','1');
105
+ INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (104, '" . __( 'Bulgaria', 'wpsc' ) ."', 'BG', '" . __('Bulgarian Lev', 'wpsc') ."', '', '', '" . __('BGN', 'wpsc') . "', '0', '0','europe','1');
106
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (105, '" . __( 'Brunei Darussalam', 'wpsc' ) ."', 'BN', '" . __('Brunei Dollar', 'wpsc') ."', '" . __('$', 'wpsc') . "', '" . __('&#036;', 'wpsc') . "', '" . __('BND', 'wpsc') . "', '0', '0','asiapacific','1');
107
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (106, '" . __( 'British Indian Ocean Territory', 'wpsc' ) ."', 'IO', '" . __('US Dollar', 'wpsc') ."', '$', '&#036;', 'USD', '0', '0','asiapacific','1');
108
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (107, '" . __( 'Brazil', 'wpsc' ) ."', 'BR', '" . __('Brazilian Real', 'wpsc') ."', '', '', '" . __('BRL', 'wpsc') . "', '0', '0','southamerica','1');
248
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (250, '" . __( 'Saint Martin (French Part)', 'wpsc' ) ."', 'MF', '" . __('Euro', 'wpsc') . "', '" . __('€', 'wpsc') . "', '" . __('&#8364;', 'wpsc') . "', '" . __('EUR', 'wpsc') . "', '0', '0','southamerica','1');
249
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (251, '" . __( 'Palestinian Territories', 'wpsc' ) ."', 'PS', '" . __('Israeli New Shekel', 'wpsc') ."', '" . __( '₪', 'wpsc' ) . "', '" . __( '&#8362;', 'wpsc' ) . "', '" . __('ILS', 'wpsc') . "', '0', '0', 'asiapacific','1');
250
  INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (252, '" . __( 'Sint Maarten (Dutch Part)', 'wpsc' ) ."', 'SX', '" . __('Netherlands Antillean Guilder', 'wpsc') . "', '" . __( 'ƒ', 'wpsc' ) . "', '" . __( '&#402;', 'wpsc' ) . "', '" . __('ANG', 'wpsc') . "', '0', '0','africa','1');
251
+ INSERT INTO `".WPSC_TABLE_CURRENCY_LIST."` VALUES (253, '" . __( 'French Guiana', 'wpsc' ) ."', 'GF', '" . __('Euro', 'wpsc') . "', '" . __('€', 'wpsc') . "', '" . __('&#8364;', 'wpsc') . "', '" . __('EUR', 'wpsc') . "', '0', '0','southamerica','1');";