WP eCommerce - Version 3.11.3

Version Description

[2016-5-23] =

  • Fix: WordPress 4.4 introduced changes to the WPDB class that caused loosely typed data to fail upon insert, causing empty cart contents entries when taxes were applied and coupons not being created.
  • Fix: Pagination on purchase logs was broken. Now, it's not.
  • Fix: Now, you can upload category images when editing product categories, not just when adding them.
  • Fix: A random and quite awful bug was causing the "collapse menu" toggle to be perpetually collapsed if you collapsed it even once. No more!
  • Enhancement: Addition of premium product license activation functionality on licensing page.
Download this release

Release Info

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

Code changes from version 3.11.2 to 3.11.3

readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: JustinSainton
3
  Donate link: https://wpecommerce.org
4
  Tags: e-commerce, digital downloads, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
  Requires at least: 4.1
6
- Tested up to: 4.4
7
- Stable tag: 3.11.2
8
 
9
  WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
@@ -36,6 +36,14 @@ After upgrading from earlier versions look for link "Update Store". This will up
36
 
37
  == Changelog ==
38
 
 
 
 
 
 
 
 
 
39
  = 3.11.2 =
40
 
41
  * Fix: WordPress 4.4 introduced changes to the WPDB class that caused loosely typed data to fail upon insert, causing empty purchase logs.
3
  Donate link: https://wpecommerce.org
4
  Tags: e-commerce, digital downloads, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
5
  Requires at least: 4.1
6
+ Tested up to: 4.6
7
+ Stable tag: 3.11.3
8
 
9
  WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
36
 
37
  == Changelog ==
38
 
39
+ = 3.11.3 [2016-5-23] =
40
+
41
+ * Fix: WordPress 4.4 introduced changes to the WPDB class that caused loosely typed data to fail upon insert, causing empty cart contents entries when taxes were applied and coupons not being created.
42
+ * Fix: Pagination on purchase logs was broken. Now, it's not.
43
+ * Fix: Now, you can upload category images when editing product categories, not just when adding them.
44
+ * Fix: A random and quite awful bug was causing the "collapse menu" toggle to be perpetually collapsed if you collapsed it even once. No more!
45
+ * Enhancement: Addition of premium product license activation functionality on licensing page.
46
+
47
  = 3.11.2 =
48
 
49
  * Fix: WordPress 4.4 introduced changes to the WPDB class that caused loosely typed data to fail upon insert, causing empty purchase logs.
wp-shopping-cart.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP eCommerce
4
  * Plugin URI: http://wpecommerce.org/
5
  * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://wpecommerce.org" target="_blank">WPeCommerce.org</a> | <a href="https://wordpress.org/support/plugin/wp-e-commerce/" target="_blank">Support Forum</a> | <a href="http://docs.wpecommerce.org/" target="_blank">Documentation</a>
6
- * Version: 3.11.2
7
  * Author: WP eCommerce
8
  * Author URI: http://wpecommerce.org/
9
  * Text Domain: wp-e-commerce
@@ -344,4 +344,4 @@ $wpec = new WP_eCommerce();
344
 
345
  // Activation
346
  register_activation_hook( __FILE__ , array( $wpec, 'install' ) );
347
- register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
3
  * Plugin Name: WP eCommerce
4
  * Plugin URI: http://wpecommerce.org/
5
  * Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://wpecommerce.org" target="_blank">WPeCommerce.org</a> | <a href="https://wordpress.org/support/plugin/wp-e-commerce/" target="_blank">Support Forum</a> | <a href="http://docs.wpecommerce.org/" target="_blank">Documentation</a>
6
+ * Version: 3.11.3
7
  * Author: WP eCommerce
8
  * Author URI: http://wpecommerce.org/
9
  * Text Domain: wp-e-commerce
344
 
345
  // Activation
346
  register_activation_hook( __FILE__ , array( $wpec, 'install' ) );
347
+ register_deactivation_hook( __FILE__, array( $wpec, 'deactivate' ) );
wpsc-admin/admin.php CHANGED
@@ -590,7 +590,12 @@ add_action( 'admin_enqueue_scripts', 'wpsc_admin_include_css_and_js_refac' );
590
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
591
  global $post_type, $post;
592
 
593
- $current_screen = get_current_screen();
 
 
 
 
 
594
 
595
  if ( 'dashboard_page_wpsc-sales-logs' == $current_screen->id ) {
596
  // jQuery
@@ -605,15 +610,9 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
605
  wp_enqueue_script( 'postbox' );
606
  }
607
 
608
- $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
609
- $pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
610
-
611
  if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'dashboard_page_wpsc-purchase-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' || $current_screen->id == 'edit-wpsc-variation' || $current_screen->id == 'wpsc-product-variations-iframe' || ( $pagehook == 'media-upload-popup' && get_post_type( $_REQUEST['post_id'] ) == 'wpsc-product' ) ) {
612
 
613
- _wpsc_enqueue_wp_e_commerce_admin();
614
-
615
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
616
- wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
617
  wp_enqueue_script( 'wpsc-sortable-table', WPSC_URL . '/wpsc-admin/js/sortable-table.js', array( 'jquery' ) );
618
 
619
  if ( in_array( $current_screen->id, array( 'wpsc-product', 'edit-wpsc-variation', 'wpsc-product' ) ) ) {
@@ -628,33 +627,34 @@ function wpsc_admin_include_css_and_js_refac( $pagehook ) {
628
  }
629
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
630
 
631
- static $_wpsc_admin_l10n_loaded;
632
-
633
- if ( ! $_wpsc_admin_l10n_loaded ) {
634
- // Localize scripts
635
- wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
636
- 'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
637
- 'save_product_order_nonce' => _wpsc_create_ajax_nonce( 'save_product_order' ),
638
- 'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};',
639
- 'empty_coupon' => esc_html__( 'Please enter a coupon code.', 'wp-e-commerce' ),
640
- 'bulk_edit_no_vars' => esc_html__( 'Quick Edit options are limited when editing products that have variations. You will need to edit the variations themselves.', 'wp-e-commerce' ),
641
- 'wpsc_core_images_url' => WPSC_CORE_IMAGES_URL,
642
- 'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wp-e-commerce' ),
643
- /* translators : This string is prepended to the 'New Variation Set' string */
644
- 'variation_helper_text' => esc_html_x( 'Choose the Variation Set you want to add variants to. If you\'re creating a new variation set, then select', 'Variation helper text', 'wp-e-commerce' ),
645
- 'variations_tutorial' => esc_html__( 'Variations allow you to create options for your products. For example, if you\'re selling T-Shirts, they will generally have a "Size" option. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by dragging and dropping them within their Variation Set.', 'wp-e-commerce' ),
646
- /* translators : These strings are dynamically inserted as a drop-down for the Coupon comparison conditions */
647
- 'coupons_compare_or' => esc_html_x( 'OR' , 'Coupon comparison logic', 'wp-e-commerce' ),
648
- 'coupons_compare_and' => esc_html_x( 'AND' , 'Coupon comparison logic', 'wp-e-commerce' ),
649
- 'meta_downloads_plural' => _x( ' downloads', 'live preview for downloads metabox', 'wp-e-commerce' ),
650
- 'meta_downloads_singular' => _x( ' download' , 'live preview for downloads metabox', 'wp-e-commerce' ),
651
- 'wpsc_inline_css_error' => __( 'It is not possible to change the state of the inline CSS without also changing the common CSS.', 'wp-e-commerce' )
652
- ) );
653
 
654
- $_wpsc_admin_l10n_loaded = true;
655
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
 
 
657
  }
 
658
  if ( $pagehook == 'wpsc-product-variations-iframe' ) {
659
  _wpsc_enqueue_wp_e_commerce_admin();
660
 
590
  function wpsc_admin_include_css_and_js_refac( $pagehook ) {
591
  global $post_type, $post;
592
 
593
+ $current_screen = get_current_screen();
594
+ $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
595
+ $pages = array( 'index.php', 'options-general.php', 'edit.php', 'post.php', 'post-new.php' );
596
+
597
+ _wpsc_enqueue_wp_e_commerce_admin();
598
+ wp_enqueue_script( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/js/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), $version_identifier, false );
599
 
600
  if ( 'dashboard_page_wpsc-sales-logs' == $current_screen->id ) {
601
  // jQuery
610
  wp_enqueue_script( 'postbox' );
611
  }
612
 
 
 
 
613
  if ( ( in_array( $pagehook, $pages ) && $post_type == 'wpsc-product' ) || $current_screen->id == 'edit-wpsc_product_category' || $current_screen->id == 'dashboard_page_wpsc-sales-logs' || $current_screen->id == 'dashboard_page_wpsc-purchase-logs' || $current_screen->id == 'settings_page_wpsc-settings' || $current_screen->id == 'wpsc-product_page_wpsc-edit-coupons' || $current_screen->id == 'edit-wpsc-variation' || $current_screen->id == 'wpsc-product-variations-iframe' || ( $pagehook == 'media-upload-popup' && get_post_type( $_REQUEST['post_id'] ) == 'wpsc-product' ) ) {
614
 
 
 
615
  wp_enqueue_script( 'livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array( 'jquery' ), '1.0.3' );
 
616
  wp_enqueue_script( 'wpsc-sortable-table', WPSC_URL . '/wpsc-admin/js/sortable-table.js', array( 'jquery' ) );
617
 
618
  if ( in_array( $current_screen->id, array( 'wpsc-product', 'edit-wpsc-variation', 'wpsc-product' ) ) ) {
627
  }
628
  wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL . '/wpsc-admin/css/admin.css', false, $version_identifier, 'all' );
629
 
630
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
 
632
+ static $_wpsc_admin_l10n_loaded;
633
+
634
+ if ( ! $_wpsc_admin_l10n_loaded ) {
635
+ // Localize scripts
636
+ wp_localize_script( 'wp-e-commerce-admin', 'wpsc_adminL10n', array(
637
+ 'dragndrop_set' => ( get_option( 'wpsc_sort_by' ) == 'dragndrop' ? 'true' : 'false' ),
638
+ 'save_product_order_nonce' => _wpsc_create_ajax_nonce( 'save_product_order' ),
639
+ 'l10n_print_after' => 'try{convertEntities(wpsc_adminL10n);}catch(e){};',
640
+ 'empty_coupon' => esc_html__( 'Please enter a coupon code.', 'wp-e-commerce' ),
641
+ 'bulk_edit_no_vars' => esc_html__( 'Quick Edit options are limited when editing products that have variations. You will need to edit the variations themselves.', 'wp-e-commerce' ),
642
+ 'wpsc_core_images_url' => WPSC_CORE_IMAGES_URL,
643
+ 'variation_parent_swap' => esc_html_x( 'New Variation Set', 'Variation taxonomy parent', 'wp-e-commerce' ),
644
+ /* translators : This string is prepended to the 'New Variation Set' string */
645
+ 'variation_helper_text' => esc_html_x( 'Choose the Variation Set you want to add variants to. If you\'re creating a new variation set, then select', 'Variation helper text', 'wp-e-commerce' ),
646
+ 'variations_tutorial' => esc_html__( 'Variations allow you to create options for your products. For example, if you\'re selling T-Shirts, they will generally have a "Size" option. Size will be the Variation Set name, and it will be a "New Variant Set". You will then create variants (small, medium, large) which will have the "Variation Set" of Size. Once you have made your set you can use the table on the right to manage them (edit, delete). You will be able to order your variants by dragging and dropping them within their Variation Set.', 'wp-e-commerce' ),
647
+ /* translators : These strings are dynamically inserted as a drop-down for the Coupon comparison conditions */
648
+ 'coupons_compare_or' => esc_html_x( 'OR' , 'Coupon comparison logic', 'wp-e-commerce' ),
649
+ 'coupons_compare_and' => esc_html_x( 'AND' , 'Coupon comparison logic', 'wp-e-commerce' ),
650
+ 'meta_downloads_plural' => _x( ' downloads', 'live preview for downloads metabox', 'wp-e-commerce' ),
651
+ 'meta_downloads_singular' => _x( ' download' , 'live preview for downloads metabox', 'wp-e-commerce' ),
652
+ 'wpsc_inline_css_error' => __( 'It is not possible to change the state of the inline CSS without also changing the common CSS.', 'wp-e-commerce' )
653
+ ) );
654
 
655
+ $_wpsc_admin_l10n_loaded = true;
656
  }
657
+
658
  if ( $pagehook == 'wpsc-product-variations-iframe' ) {
659
  _wpsc_enqueue_wp_e_commerce_admin();
660
 
wpsc-admin/display-coupons.php CHANGED
@@ -20,8 +20,8 @@ function wpsc_display_coupons_page() {
20
  $use_once = (int)(bool)$_POST['add_use-once'];
21
  $every_product = (int)(bool)$_POST['add_every_product'];
22
  $is_active = (int)(bool)$_POST['add_active'];
23
- $start_date = ! empty( $_POST['add_start'] ) ? date( 'Y-m-d', strtotime( $_POST['add_start'] ) ) . " 00:00:00" : null;
24
- $end_date = ! empty( $_POST['add_end'] ) ? date( 'Y-m-d', strtotime( $_POST['add_end'] ) ) . " 23:59:59" : null;
25
  $rules = $_POST['rules'];
26
  $new_rules = array();
27
 
@@ -84,8 +84,8 @@ function wpsc_display_coupons_page() {
84
  'is-used' => $_POST['edit_coupon_is_used'],
85
  'active' => $_POST['edit_coupon_active'],
86
  'every_product' => $_POST['edit_coupon_every_product'],
87
- 'start' => ! empty( $_POST['edit_coupon_start'] ) ? get_gmt_from_date( $_POST['edit_coupon_start'] . ' 00:00:00' ) : null,
88
- 'expiry' => ! empty( $_POST['edit_coupon_end'] ) ? get_gmt_from_date( $_POST['edit_coupon_end'] . ' 23:59:59' ) : null,
89
  'condition' => $new_rules
90
  ) );
91
 
20
  $use_once = (int)(bool)$_POST['add_use-once'];
21
  $every_product = (int)(bool)$_POST['add_every_product'];
22
  $is_active = (int)(bool)$_POST['add_active'];
23
+ $start_date = ! empty( $_POST['add_start'] ) ? date( 'Y-m-d', strtotime( $_POST['add_start'] ) ) . " 00:00:00" : "0000-00-00 00:00:00";
24
+ $end_date = ! empty( $_POST['add_end'] ) ? date( 'Y-m-d', strtotime( $_POST['add_end'] ) ) . " 23:59:59" : "0000-00-00 00:00:00";
25
  $rules = $_POST['rules'];
26
  $new_rules = array();
27
 
84
  'is-used' => $_POST['edit_coupon_is_used'],
85
  'active' => $_POST['edit_coupon_active'],
86
  'every_product' => $_POST['edit_coupon_every_product'],
87
+ 'start' => ! empty( $_POST['edit_coupon_start'] ) ? get_gmt_from_date( $_POST['edit_coupon_start'] . ' 00:00:00' ) : "0000-00-00 00:00:00",
88
+ 'expiry' => ! empty( $_POST['edit_coupon_end'] ) ? get_gmt_from_date( $_POST['edit_coupon_end'] . ' 23:59:59' ) : "0000-00-00 00:00:00",
89
  'condition' => $new_rules
90
  ) );
91
 
wpsc-admin/display-sales-logs.php CHANGED
@@ -146,8 +146,9 @@ class WPSC_Purchase_Log_Page {
146
  $href = $this->get_purchase_log_url( ( $this->log_id - 1 ) );
147
  $disabled = '';
148
  }
 
149
  ?>
150
- <a href='<?php esc_url( $href ); ?>' class='prev-page <?php echo $disabled; ?>'>&lsaquo; <?php _e( 'Previous', 'wp-e-commerce' ); ?></a>
151
  <?php
152
 
153
  $max_purchase_id = wpsc_max_purchase_id();
@@ -158,7 +159,7 @@ class WPSC_Purchase_Log_Page {
158
  $disabled = '';
159
  }
160
  ?>
161
- <a href='<?php esc_url( $href ); ?>' class='next-page <?php echo $disabled; ?>'><?php _e( 'Next', 'wp-e-commerce' ); ?> &rsaquo;</a>
162
 
163
  </span></span></span>
164
  <?php
@@ -446,4 +447,4 @@ class WPSC_Purchase_Log_Page {
446
  return esc_url( $location );
447
  }
448
 
449
- }
146
  $href = $this->get_purchase_log_url( ( $this->log_id - 1 ) );
147
  $disabled = '';
148
  }
149
+
150
  ?>
151
+ <a href='<?php echo esc_url( $href ); ?>' class='prev-page <?php echo $disabled; ?>'>&lsaquo; <?php _e( 'Previous', 'wp-e-commerce' ); ?></a>
152
  <?php
153
 
154
  $max_purchase_id = wpsc_max_purchase_id();
159
  $disabled = '';
160
  }
161
  ?>
162
+ <a href='<?php echo esc_url( $href ); ?>' class='next-page <?php echo $disabled; ?>'><?php _e( 'Next', 'wp-e-commerce' ); ?> &rsaquo;</a>
163
 
164
  </span></span></span>
165
  <?php
447
  return esc_url( $location );
448
  }
449
 
450
+ }
wpsc-admin/display-upgrades.page.php CHANGED
@@ -32,7 +32,7 @@ wpse_license_page_display_licenses();
32
  }
33
 
34
  function wpse_license_page_display_licenses () {
35
- $licenses = get_option( 'wpec_license_active_products', array() );
36
  ?>
37
  <table class="wp-list-table widefat striped">
38
  <thead>
@@ -45,10 +45,11 @@ function wpse_license_page_display_licenses () {
45
  <tbody id="the-list">
46
  <?php
47
  if ( ! empty( $licenses ) ) {
48
- foreach ( (array) $licenses as $license ) { ?>
49
- <tr><td class="product_name column-product_name"><p><strong><?php echo esc_html( $license['name'] ); ?></strong></p></td>
50
- <td class="product_license column-product_license"><p><strong><?php echo esc_html( $license['license'] ); ?></strong></p></td>
51
- <td class="product_expiry column-product_expiry"><p><strong><?php echo esc_html( $license['expires'] ); ?></strong></p></td></tr>
 
52
  <?php }
53
  } else {
54
  ?>
@@ -71,67 +72,146 @@ function wpse_license_page_display_licenses () {
71
  /**
72
  * Activate Gold Cart plugin
73
  */
74
- function wpsc_licenses_action_stuff() {
75
  //Activate a new Product License
 
 
 
 
 
76
  if ( isset( $_POST['product_license_key'] ) && $_POST['product_license_key'] == 'true' ) {
77
  if ( isset( $_POST['product_license'] ) && $_POST['product_license'] != '' ) {
78
 
79
  //Do stuff
80
- $url = "https://wpecommerce.org/wp-license-api/license_register.php";
81
  $params = array (
82
- 'api' => 'v2',
83
- 'key' => base64_encode( stripslashes( $_POST['product_license'] ) ),
84
- 'url' => base64_encode( esc_url_raw( site_url() ) )
85
- );
86
-
87
- $args = array(
88
- 'httpversion' => '1.0',
89
- 'sslverify' => false,
90
- 'timeout' => 15,
91
- 'user-agent' => 'WP eCommerce Licensing/' . get_bloginfo( 'url' ),
92
  );
93
 
 
94
  if ( isset( $_POST['submit_values'] ) && $_POST['submit_values'] == 'submit_values' ) {
95
- $params['action'] = 'activate';
 
96
  } elseif ( isset( $_POST['reset_values'] ) && $_POST['reset_values'] == 'reset_values' ) {
97
- $params['action'] = 'deactivate';
98
  }
99
 
100
- $url = add_query_arg( $params, $url );
 
 
 
 
 
 
 
101
 
102
-
103
- $response = json_decode( wp_remote_retrieve_body( wp_remote_get( $url, $args ) ) );
104
-
105
- $licenses = get_option( 'wpec_license_active_products', array() );
106
 
107
- if ( 'activated' === $response->status) {
108
-
109
- $licenses[] = array(
110
- 'tag' => $response->fileid,
111
- 'name' => $response->product,
112
- 'license' => $response->license,
113
- 'expires' => $response->valid
114
- );
115
-
116
- update_option( 'wpec_license_active_products', $licenses );
117
- echo '<div class="updated"><p>'.esc_html( $response->message ).'</p></div>';
118
 
119
- } elseif ( 'deactivated' === $response->status ) {
120
-
121
- foreach ( $licenses as $key => $license ) {
122
- if ( in_array( $response->fileid, $license ) ) {
123
- unset( $licenses[$key] );
124
- array_values($licenses);
125
- }
 
 
 
 
 
126
  }
127
 
128
- update_option( 'wpec_license_active_products', $licenses );
129
- echo '<div class="updated"><p>'.esc_html( $response->message ).'</p></div>';
130
-
131
  } else {
132
- echo '<div class="error"><p>'.esc_html( $response->message ).'</p></div>';
133
  }
134
  }
135
  }
136
  }
137
- add_action( 'wpsc_upgrades_license_activation', 'wpsc_licenses_action_stuff' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
  function wpse_license_page_display_licenses () {
35
+ $licenses = get_option( 'wpec_licenses_active_products', array() );
36
  ?>
37
  <table class="wp-list-table widefat striped">
38
  <thead>
45
  <tbody id="the-list">
46
  <?php
47
  if ( ! empty( $licenses ) ) {
48
+ foreach ( (array) $licenses as $license ) { $license_info = get_option( 'wpec_product_' . $license . '_license_active', array() ); ?>
49
+ <?php do_action( 'wpec_license_individual_license', $license_info ); ?>
50
+ <tr><td class="product_name column-product_name"><p><strong><?php echo esc_html( $license_info->item_name ); ?></strong></p></td>
51
+ <td class="product_license column-product_license"><p><strong><?php echo esc_html( $license_info->license_key ); ?></strong></p></td>
52
+ <td class="product_expiry column-product_expiry"><p><strong><?php if ( $license_info->expiration == 'lifetime' ) { _e('Lifetime', 'wp-e-commerce'); } else { echo esc_html( $license_info->expiration ); } ?></strong></p></td></tr>
53
  <?php }
54
  } else {
55
  ?>
72
  /**
73
  * Activate Gold Cart plugin
74
  */
75
+ function wpec_licenses_action_stuff() {
76
  //Activate a new Product License
77
+
78
+ if( ! current_user_can( 'manage_options' ) ) {
79
+ return;
80
+ }
81
+
82
  if ( isset( $_POST['product_license_key'] ) && $_POST['product_license_key'] == 'true' ) {
83
  if ( isset( $_POST['product_license'] ) && $_POST['product_license'] != '' ) {
84
 
85
  //Do stuff
 
86
  $params = array (
87
+ 'license' => sanitize_text_field( $_POST['product_license'] ),
88
+ 'url' => home_url()
 
 
 
 
 
 
 
 
89
  );
90
 
91
+ $activation = false;
92
  if ( isset( $_POST['submit_values'] ) && $_POST['submit_values'] == 'submit_values' ) {
93
+ $activation = true;
94
+ $params['wpec_lic_action'] = 'activate_license';
95
  } elseif ( isset( $_POST['reset_values'] ) && $_POST['reset_values'] == 'reset_values' ) {
96
+ $params['wpec_lic_action'] = 'deactivate_license';
97
  }
98
 
99
+ $response = wp_remote_post(
100
+ 'https://wpecommerce.org/',
101
+ array(
102
+ 'timeout' => 15,
103
+ 'sslverify' => false,
104
+ 'body' => $params
105
+ )
106
+ );
107
 
108
+ // Make sure there are no errors
109
+ if ( is_wp_error( $response ) ) {
110
+ return;
111
+ }
112
 
113
+ // Decode license data
114
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
115
+ $active_licenses = get_option( 'wpec_licenses_active_products', array() );
 
 
 
 
 
 
 
 
116
 
117
+ if( $license_data->success === true ) {
118
+ if ( $activation ) {
119
+ // Tell WordPress to look for updates
120
+ set_site_transient( 'update_plugins', null );
121
+ $active_licenses[] = $license_data->item_id;
122
+ update_option( 'wpec_licenses_active_products', $active_licenses );
123
+ update_option( 'wpec_product_' . $license_data->item_id . '_license_active', $license_data );
124
+ } else {
125
+ $key = array_search( $license_data->item_id, $active_licenses );
126
+ unset( $active_licenses[ $key ] );
127
+ update_option( 'wpec_licenses_active_products', $active_licenses );
128
+ delete_option( 'wpec_product_' . $license_data->item_id . '_license_active' );
129
  }
130
 
131
+
132
+ echo '<div class="updated"><p>'.esc_html( $license_data->message ).'</p></div>';
 
133
  } else {
134
+ echo '<div class="error"><p>'.esc_html( $license_data->message ).'</p></div>';
135
  }
136
  }
137
  }
138
  }
139
+ add_action( 'wpsc_upgrades_license_activation', 'wpec_licenses_action_stuff' );
140
+
141
+ function wpec_lic_weekly_license_check() {
142
+
143
+ if( ! empty( $_POST['product_license_key'] ) ) {
144
+ return; // Don't fire when saving settings
145
+ }
146
+
147
+ $active_licenses = get_option( 'wpec_licenses_active_products', array() );
148
+ if( empty( $active_licenses ) ) {
149
+ return;
150
+ }
151
+
152
+ foreach ( (array) $active_licenses as $license ) {
153
+ $license_info = get_option( 'wpec_product_' . $license . '_license_active' );
154
+
155
+ // data to send in our API request
156
+ $api_params = array(
157
+ 'wpec_lic_action'=> 'check_license',
158
+ 'license' => $license_info->license_key,
159
+ 'item_id' => $license_info->item_id,
160
+ 'url' => home_url()
161
+ );
162
+
163
+ // Call the API
164
+ $response = wp_remote_post(
165
+ 'https://wpecommerce.org/',
166
+ array(
167
+ 'timeout' => 15,
168
+ 'sslverify' => false,
169
+ 'body' => $api_params
170
+ )
171
+ );
172
+
173
+ // make sure the response came back okay
174
+ if ( is_wp_error( $response ) ) {
175
+ return false;
176
+ }
177
+
178
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
179
+ update_option( 'wpec_product_' . $license . '_license_active', $license_data );
180
+ }
181
+ }
182
+ add_action( 'wpsc_weekly_cron_task', 'wpec_lic_weekly_license_check' ); // For testing use admin_init
183
+
184
+ function wpec_license_notices() {
185
+ if( ! current_user_can( 'manage_options' ) ) {
186
+ return;
187
+ }
188
+
189
+ $active_licenses = get_option( 'wpec_licenses_active_products', array() );
190
+ if( empty( $active_licenses ) ) {
191
+ return;
192
+ }
193
+
194
+ $messages = array();
195
+
196
+ foreach ( (array) $active_licenses as $license ) {
197
+ $license = get_option( 'wpec_product_' . $license . '_license_active' );
198
+ if( is_object( $license ) && 'valid' !== $license->license && empty( $showed_invalid_message ) ) {
199
+ if( isset( $_GET['page'] ) && 'wpsc-upgrades' !== $_GET['page'] ) {
200
+ $messages[] = sprintf(
201
+ __( 'You have invalid or expired license keys for WP eCommerce. Please go to the <a href="%s" title="Go to Licenses page">Licenses page</a> to correct this issue.', 'wp-e-commerce' ),
202
+ admin_url( 'index.php?page=wpsc-upgrades' )
203
+ );
204
+ $showed_invalid_message = true;
205
+ }
206
+ }
207
+ }
208
+
209
+ if( ! empty( $messages ) ) {
210
+ foreach( $messages as $message ) {
211
+ echo '<div class="error">';
212
+ echo '<p>' . $message . '</p>';
213
+ echo '</div>';
214
+ }
215
+ }
216
+ }
217
+ add_action( 'admin_notices', 'wpec_license_notices' );
wpsc-admin/js/admin.js CHANGED
@@ -78,6 +78,7 @@
78
  stop : category_sort
79
  });
80
 
 
81
  $('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
82
 
83
  $('[name="image"]').on('change', function() {
@@ -160,7 +161,7 @@
160
  }(jQuery));
161
 
162
  jQuery(document).ready(function($){
163
-
164
  $('.ui-sortable li .list_gallery_image').mouseover(function(){
165
  $('.product_gallery_image_delete_button', $(this).parent()).show();
166
  }).mouseout(function(){
@@ -177,9 +178,18 @@ jQuery(document).ready(function($){
177
  $.post(ajaxurl, product_gallery_image_data, function(response){});
178
  $(this).parent().parent().fadeOut( 'slow' );
179
  });
180
-
181
-
182
-
 
 
 
 
 
 
 
 
 
183
  $( '#wpsc_price' ).on( 'change', wpsc_update_price_live_preview );
184
  $( '#wpsc_sale_price' ).on( 'change', wpsc_update_price_live_preview );
185
 
@@ -363,29 +373,6 @@ jQuery(document).ready(function($){
363
  return false;
364
  });
365
 
366
- // Fill in values when inline editor appears.
367
- // This should be done properly so we don't need livequery here - see http://codex.wordpress.org/Plugin_API/Action_Reference/quick_edit_custom_box
368
- jQuery('.inline-editor').livequery(function() {
369
- var id = jQuery(this).attr('id');
370
- id = id.replace(/^edit-/, '');
371
-
372
- if ( ! id || ! parseInt( id, 10 ) ) {
373
- return;
374
- }
375
-
376
- var weight = jQuery('#inline_' + id + '_weight').text(),
377
- stock = jQuery('#inline_' + id + '_stock').text(),
378
- price = jQuery('#inline_' + id + '_price').text(),
379
- sale_price = jQuery('#inline_' + id + '_sale_price').text(),
380
- sku = jQuery('#inline_' + id + '_sku').text();
381
-
382
- jQuery(this).find('.wpsc_ie_weight').val(weight);
383
- jQuery(this).find('.wpsc_ie_stock').val(stock);
384
- jQuery(this).find('.wpsc_ie_price').val(price);
385
- jQuery(this).find('.wpsc_ie_sale_price').val(sale_price);
386
- jQuery(this).find('.wpsc_ie_sku').val(sku);
387
- });
388
-
389
  jQuery( 'div.coupon-condition' ).each( function( index, value ){
390
  if( jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).length !== 0 ) {
391
  margin = jQuery( 'select.ruleprops', jQuery( this ) ).offset().left - jQuery( this ).offset().left;
@@ -668,4 +655,4 @@ function show_status_box(id,image_id) {
668
  document.getElementById(image_id).src = wpsc_adminL10n.wpsc_core_images_url + '/icon_window_expand.gif';
669
  }
670
  return false;
671
- }
78
  stop : category_sort
79
  });
80
 
81
+ $('#edittag').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
82
  $('.edit-tags-php form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');
83
 
84
  $('[name="image"]').on('change', function() {
161
  }(jQuery));
162
 
163
  jQuery(document).ready(function($){
164
+
165
  $('.ui-sortable li .list_gallery_image').mouseover(function(){
166
  $('.product_gallery_image_delete_button', $(this).parent()).show();
167
  }).mouseout(function(){
178
  $.post(ajaxurl, product_gallery_image_data, function(response){});
179
  $(this).parent().parent().fadeOut( 'slow' );
180
  });
181
+
182
+ $( document ).on( 'wp-collapse-menu', function( event, state ) {
183
+
184
+ if ( $( 'body' ).hasClass( 'folded' ) ) {
185
+ $( 'body' ).removeClass( 'folded' );
186
+ setUserSetting('mfold', 'o');
187
+ } else {
188
+ $( 'body' ).addClass( 'folded' );
189
+ setUserSetting('mfold', 'f');
190
+ }
191
+ } );
192
+
193
  $( '#wpsc_price' ).on( 'change', wpsc_update_price_live_preview );
194
  $( '#wpsc_sale_price' ).on( 'change', wpsc_update_price_live_preview );
195
 
373
  return false;
374
  });
375
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  jQuery( 'div.coupon-condition' ).each( function( index, value ){
377
  if( jQuery( 'select[name="rules[operator][]"]', jQuery( this ) ).length !== 0 ) {
378
  margin = jQuery( 'select.ruleprops', jQuery( this ) ).offset().left - jQuery( this ).offset().left;
655
  document.getElementById(image_id).src = wpsc_adminL10n.wpsc_core_images_url + '/icon_window_expand.gif';
656
  }
657
  return false;
658
+ }
wpsc-core/wpsc-constants.php CHANGED
@@ -55,15 +55,15 @@ function wpsc_core_constants() {
55
 
56
  // Define Plugin version
57
  if ( ! defined( 'WPSC_VERSION' ) ) {
58
- define( 'WPSC_VERSION' , '3.11.2' );
59
  }
60
 
61
  if ( ! defined( 'WPSC_MINOR_VERSION' ) ) {
62
- define( 'WPSC_MINOR_VERSION' , 'ffbc44e' );
63
  }
64
 
65
  if ( ! defined( 'WPSC_PRESENTABLE_VERSION' ) ) {
66
- define( 'WPSC_PRESENTABLE_VERSION', '3.11.2' );
67
  }
68
 
69
  // Define a salt to use when we hash, WPSC_SALT may be defined for us in our config file, so check first
55
 
56
  // Define Plugin version
57
  if ( ! defined( 'WPSC_VERSION' ) ) {
58
+ define( 'WPSC_VERSION' , '3.11.3' );
59
  }
60
 
61
  if ( ! defined( 'WPSC_MINOR_VERSION' ) ) {
62
+ define( 'WPSC_MINOR_VERSION' , '9cadbff' );
63
  }
64
 
65
  if ( ! defined( 'WPSC_PRESENTABLE_VERSION' ) ) {
66
+ define( 'WPSC_PRESENTABLE_VERSION', '3.11.3' );
67
  }
68
 
69
  // Define a salt to use when we hash, WPSC_SALT may be defined for us in our config file, so check first
wpsc-core/wpsc-functions.php CHANGED
@@ -674,7 +674,7 @@ function wpsc_get_page_post_names() {
674
  * @return void
675
  */
676
  function wpsc_cron() {
677
- $default_schedules = array( 'hourly', 'twicedaily', 'daily');
678
 
679
  /*
680
  * Create a cron event for each likely cron schedule. The likely cron schedules
@@ -692,6 +692,23 @@ function wpsc_cron() {
692
  }
693
  add_action( 'init', 'wpsc_cron' );
694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  /**
696
  * Updates permalink slugs
697
  *
@@ -1149,4 +1166,4 @@ function wpsc_say_what_domain_aliases( $aliases ) {
1149
  return $aliases;
1150
  }
1151
 
1152
- add_filter( 'say_what_domain_aliases', 'wpsc_say_what_domain_aliases' );
674
  * @return void
675
  */
676
  function wpsc_cron() {
677
+ $default_schedules = array( 'hourly', 'twicedaily', 'daily', 'weekly');
678
 
679
  /*
680
  * Create a cron event for each likely cron schedule. The likely cron schedules
692
  }
693
  add_action( 'init', 'wpsc_cron' );
694
 
695
+ /**
696
+ * wpsc_add_weekly_schedule()
697
+ *
698
+ * Creates a weekly schedule event
699
+ *
700
+ * @param none
701
+ * @return void
702
+ */
703
+ function wpsc_add_weekly_schedule( $schedules = array()) {
704
+ $schedules['weekly'] = array(
705
+ 'interval' => 604800,
706
+ 'display' => __( 'Once Weekly', 'wp-e-commerce' )
707
+ );
708
+ return $schedules;
709
+ }
710
+ add_filter( 'cron_schedules', 'wpsc_add_weekly_schedule' );
711
+
712
  /**
713
  * Updates permalink slugs
714
  *
1166
  return $aliases;
1167
  }
1168
 
1169
+ add_filter( 'say_what_domain_aliases', 'wpsc_say_what_domain_aliases' );
wpsc-includes/cart-item.class.php CHANGED
@@ -516,7 +516,7 @@ class wpsc_cart_item {
516
  'purchaseid' => $purchase_log_id,
517
  'price' => $this->unit_price,
518
  'pnp' => floatval( $shipping ),
519
- 'tax_charged' => $tax,
520
  'gst' => floatval( $tax_rate ),
521
  'quantity' => $this->quantity,
522
  'donation' => $this->is_donation,
516
  'purchaseid' => $purchase_log_id,
517
  'price' => $this->unit_price,
518
  'pnp' => floatval( $shipping ),
519
+ 'tax_charged' => floatval( $tax ),
520
  'gst' => floatval( $tax_rate ),
521
  'quantity' => $this->quantity,
522
  'donation' => $this->is_donation,