WP eCommerce - Version 3.14.0

Version Description

[2019-01-24] =

  • Fix: Improve integration with new WordPress block editor.
  • Fix: Improve compatibility with PHP 7.2+
Download this release

Release Info

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

Code changes from version 3.13.1 to 3.14.0

CONTRIBUTING.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to WP eCommerce
2
+
3
+ Howdy! We're glad you're interested in contributing to WP eCommerce. Read on to make sure you follow all the steps required to successfully submit an issue or patch to the repository.
4
+
5
+ *This is not a place to submit support requests, this is a code repository to submit code bugs and code patches. Support tickets can be created here: https://wordpress.org/support/plugin/wp-e-commerce*
6
+
7
+ Before you submit an issue
8
+ ---
9
+ 1. Check for duplicate issues in the repo
10
+ 2. Make sure you have the latest version of WP eCommerce running in your local enviroment
11
+ 3. Fork the WP eCommerce repo in order to create Pull Requests.
12
+
13
+ Reporting a bug
14
+ ---
15
+ 1. Specify the version number for both WordPress and WP eCommerce
16
+ 2. Describe the issue with great detail, be specific about the problem you see.
17
+ 3. If this is a browser issue, make sure to mention which browser you have trouble on.
18
+ 4. If this is a visual bug, please make sure to add a screenshot.
19
+ 5. if you create a Pull Request for this issue, make sure to attach the Pull Request created to the issue.
20
+
21
+ Branch Strategy
22
+ ---
23
+ Master will be in sync with the latest release, which will also have its own branch (`branch-x.x.x`). Features should go in `features/*` branches, which then merge into `branch-x.x.x` branch, which then merges to master upon release. Our goal is to keep from merging directly to master. To determine the next branch to fork/PR, review the [Development status](https://github.com/wp-e-commerce/WP-e-Commerce#development-status).
24
+
25
+ Resources
26
+ ---
27
+ [Labels and Workflow](https://github.com/wp-e-commerce/WP-e-Commerce/wiki/Issue-Labels-and-Workflow)
28
+
Gruntfile.js ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global module:false, require:false */
2
+
3
+ module.exports = function( grunt ) {
4
+ 'use strict';
5
+
6
+ require('matchdep').filterDev('grunt-*').forEach( grunt.loadNpmTasks );
7
+
8
+ var bannerTemplate = '/**\n' + ' * <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' + ' * <%= pkg.author.url %>\n' + ' *\n' + ' * Copyright (c) <%= grunt.template.today("yyyy") %>;\n' + ' * Licensed GPLv2+\n' + ' */\n';
9
+
10
+ var compactBannerTemplate = '/** ' + '<%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> | <%= pkg.author.url %> | Copyright (c) <%= grunt.template.today("yyyy") %>; | Licensed GPLv2+' + ' **/\n';
11
+
12
+ grunt.initConfig({
13
+ pkg: grunt.file.readJSON('package.json'),
14
+
15
+ asciify: {
16
+ banner: {
17
+ text : 'WP eCommerce',
18
+ options : {
19
+ font : 'speed',
20
+ log : true
21
+ }
22
+ }
23
+ },
24
+
25
+ jshint: {
26
+ options: {
27
+ jshintrc: '.jshintrc'
28
+ },
29
+
30
+ all: {
31
+ src: [
32
+ 'Gruntfile.js',
33
+ 'wpsc-admin/js/*.js',
34
+ 'wpsc-components/marketplace-core-v1/static/*.js',
35
+ 'wpsc-components/merchant-core-v3/gateways/*.js',
36
+ 'wpsc-components/theme-engine-v2/admin/js/*.js',
37
+ 'wpsc-components/theme-engine-v2/theming/assets/js/*.js',
38
+ 'wpsc-components/merchant-core-v3/*.js',
39
+ 'wpsc-core/js/*.js',
40
+ '!wpsc-core/js/tinymce/*.js',
41
+ '!wpsc-core/js/*-min.js',
42
+ '!wpsc-core/js/jquery*.js',
43
+ '!wpsc-admin/js/admin-legacy.js',
44
+ '!wpsc-admin/js/jquery-*.js',
45
+ '!wpsc-components/theme-engine-v2/admin/js/select2*.js',
46
+ '!wpsc-components/theme-engine-v2/theming/assets/js/jquery.*.js',
47
+ '!*.min.js'
48
+ ]
49
+ },
50
+ watch: {
51
+ src : [
52
+ 'Gruntfile.js',
53
+ 'wpsc-components/theme-engine-v2/theming/assets/js/**/*.js',
54
+ '!wpsc-components/theme-engine-v2/theming/assets/js/jquery.*.js',
55
+ '!wpsc-components/theme-engine-v2/theming/assets/js/floatlabel.js',
56
+ '!wpsc-components/theme-engine-v2/theming/assets/js/fluidbox.js',
57
+ '!wpsc-components/theme-engine-v2/theming/assets/js/cart-notifications.js',
58
+ '!**/*.min.js'
59
+ ]
60
+ }
61
+ },
62
+
63
+ browserify: {
64
+ options: {
65
+ banner: bannerTemplate,
66
+ stripBanners: true,
67
+ transform: [
68
+ 'babelify',
69
+ 'browserify-shim'
70
+ ]
71
+ },
72
+ dist: { files: {
73
+ 'wpsc-components/theme-engine-v2/theming/assets/js/cart-notifications.js' : 'wpsc-components/theme-engine-v2/theming/assets/js/components/cart-notifications-main.js'
74
+ } }
75
+ },
76
+
77
+ uglify: {
78
+ all: {
79
+ options: {
80
+ banner: compactBannerTemplate,
81
+ mangle: false
82
+ },
83
+ files: [{
84
+ expand: true,
85
+ cwd: 'wpsc-components/theme-engine-v2/theming/assets/js',
86
+ src: ['*.js', '!*.min.js'],
87
+ dest: 'wpsc-components/theme-engine-v2/theming/assets/js',
88
+ extDot: 'last',
89
+ ext: '.min.js'
90
+ }]
91
+ },
92
+ noBanner : {
93
+ options: {
94
+ mangle: false
95
+ },
96
+ files: [{
97
+ expand: true,
98
+ cwd: 'wpsc-components/theme-engine-v2/theming/assets/js',
99
+ src: ['jquery.*.js', '!jquery.*.min.js'],
100
+ dest: 'wpsc-components/theme-engine-v2/theming/assets/js',
101
+ extDot: 'last',
102
+ ext: '.min.js'
103
+ }]
104
+ }
105
+ },
106
+
107
+ sass: {
108
+ dist: {
109
+ options: {
110
+ style: 'expanded',
111
+ lineNumbers: false
112
+ },
113
+ files: [{
114
+ expand: true,
115
+ cwd: 'wpsc-components/theme-engine-v2/theming/assets/scss',
116
+ src: ['**/*.scss'],
117
+ dest: 'wpsc-components/theme-engine-v2/theming/assets/css/',
118
+ ext: '.css'
119
+ }]
120
+ }
121
+ },
122
+
123
+ cmq: {
124
+ options: {
125
+ log: false
126
+ },
127
+ dist: {
128
+ files: [{
129
+ expand: true,
130
+ cwd: 'wpsc-components/theme-engine-v2/theming/assets/css',
131
+ src: ['*.css', '!*.min.css', '!wpsc-components/theme-engine-v2/theming/assets/css/font-awesome-ie7.css'],
132
+ dest: 'wpsc-components/theme-engine-v2/theming/assets/css/'
133
+ }]
134
+ }
135
+ },
136
+
137
+ cssmin: {
138
+ target: {
139
+ files: [{
140
+ expand: true,
141
+ cwd: 'wpsc-components/theme-engine-v2/theming/assets/css',
142
+ src: ['*.css', '!*.min.css', '!wpsc-components/theme-engine-v2/theming/assets/css/font-awesome-ie7.css'],
143
+ dest: 'wpsc-components/theme-engine-v2/theming/assets/css',
144
+ ext: '.min.css'
145
+ }]
146
+ }
147
+ },
148
+
149
+ // Check textdomain errors.
150
+ checktextdomain: {
151
+ options:{
152
+ text_domain: 'wp-e-commerce',
153
+ keywords: [
154
+ '__:1,2d',
155
+ '_e:1,2d',
156
+ '_x:1,2c,3d',
157
+ 'esc_html__:1,2d',
158
+ 'esc_html_e:1,2d',
159
+ 'esc_html_x:1,2c,3d',
160
+ 'esc_attr__:1,2d',
161
+ 'esc_attr_e:1,2d',
162
+ 'esc_attr_x:1,2c,3d',
163
+ '_ex:1,2c,3d',
164
+ '_n:1,2,4d',
165
+ '_nx:1,2,4c,5d',
166
+ '_n_noop:1,2,3d',
167
+ '_nx_noop:1,2,3c,4d'
168
+ ]
169
+ },
170
+ files: {
171
+ src: [
172
+ '**/*.php', // Include all files
173
+ '!node_modules/**', // Exclude node_modules/
174
+ '!tests/**', // Exclude tests/
175
+ '!bin/**', // Exclude bin/
176
+ '!tmp/**' // Exclude tmp/
177
+ ],
178
+ expand: true
179
+ }
180
+ },
181
+
182
+ makepot: {
183
+ target: {
184
+ options: {
185
+ domainPath: '/wpsc-languages/', // Where to save the POT file.
186
+ exclude: [
187
+ 'tesst/.*',
188
+ 'bin/.*',
189
+ 'images/.*'
190
+ ],
191
+ mainFile: 'wp-shopping-cart.php', // Main project file.
192
+ potFilename: 'wp-e-commerce.pot', // Name of the POT file.
193
+ potHeaders: {
194
+ poedit: true, // Includes common Poedit headers.
195
+ 'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
196
+ },
197
+ type: 'wp-plugin', // Type of project (wp-plugin or wp-theme).
198
+ updateTimestamp: true, // Whether the POT-Creation-Date should be updated without other changes.
199
+ processPot: function( pot ) {
200
+ pot.headers['report-msgid-bugs-to'] = 'https://wpecommerce.org/';
201
+ pot.headers['last-translator'] = 'WP-Translations (http://wp-translations.org/)';
202
+ pot.headers['language-team'] = 'WP-Translations <wpt@wp-translations.org>';
203
+ pot.headers.language = 'en_US';
204
+ return pot;
205
+ }
206
+ }
207
+ }
208
+ },
209
+
210
+ watch: {
211
+ css: {
212
+ files: ['wpsc-components/theme-engine-v2/theming/assets/scss/**/*.scss'],
213
+ tasks: ['css'],
214
+ options: {
215
+ spawn: false
216
+ }
217
+ },
218
+ js: {
219
+ // files: ['<%= jshint.watch.src %>'],
220
+ files: ['**/*.js', '!**/*.min.js'],
221
+ tasks: ['watchjs'],
222
+ options: {
223
+ debounceDelay: 500
224
+ }
225
+ }
226
+ }
227
+
228
+ });
229
+
230
+ grunt.registerTask('css', ['asciify', 'sass', 'cmq', 'cssmin']);
231
+ grunt.registerTask('js', ['asciify', 'jshint', 'browserify', 'uglify']);
232
+ grunt.registerTask('watchjs', ['asciify', 'jshint:watch', 'browserify', 'uglify']);
233
+ grunt.registerTask('default', ['asciify', 'js', 'css', 'makepot']);
234
+
235
+ /**
236
+ * PHP Code Sniffer using WordPress Coding Standards.
237
+ *
238
+ * @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
239
+ */
240
+ grunt.registerTask('phpcs', function() {
241
+ var done = this.async();
242
+
243
+ grunt.util.spawn({
244
+ cmd: 'phpcs',
245
+ args: [
246
+ '-p',
247
+ '-s',
248
+ '--standard=WordPress',
249
+ '--extensions=php',
250
+ '--ignore=*/node_modules/*,*/tests/*',
251
+ '--report-file=codesniffs.txt',
252
+ '.'
253
+ ],
254
+ opts: { stdio: 'inherit' }
255
+ }, done);
256
+ });
257
+
258
+ };
package.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wp-e-commerce",
3
+ "title": "WP eCommerce",
4
+ "description": "The most popular independent eCommerce platform for WordPress",
5
+ "version": "3.14.0",
6
+ "license": "GPLv2",
7
+ "author": {
8
+ "name": "WP-e-Commerce",
9
+ "url": "https://wpecommerce.org/"
10
+ },
11
+ "private": true,
12
+ "devDependencies": {
13
+ "babelify": "^6.3.0",
14
+ "grunt": "^0.4.5",
15
+ "browserify": "^11.1.0",
16
+ "browserify-shim": "^3.8.10",
17
+ "grunt-asciify": "~0.2.2",
18
+ "grunt-checktextdomain": "^1.0.0",
19
+ "grunt-combine-media-queries": "^1.0.20",
20
+ "grunt-contrib-cssmin": "^0.9.0",
21
+ "grunt-contrib-jshint": "^0.11.0",
22
+ "grunt-contrib-sass": "^0.7.4",
23
+ "grunt-contrib-uglify": "^2.2.0",
24
+ "grunt-contrib-watch": "^0.6.1",
25
+ "grunt-exec": "^0.4.7",
26
+ "grunt-potomo": "^2.1.0",
27
+ "grunt-wp-i18n": "^0.4.9",
28
+ "grunt-browserify": "^4.0.1",
29
+ "load-grunt-tasks": "^0.2.1",
30
+ "matchdep": "^1.0.1"
31
+ },
32
+ "browserify-shim": {
33
+ "jquery": "global:jQuery"
34
+ }
35
+ }
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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.5
6
- Tested up to: 4.9
7
- Stable tag: 3.13.1
8
 
9
  WP eCommerce is a free, powerful plugin that empowers you to sell anything online, quickly and easily.
10
 
@@ -36,6 +36,11 @@ After upgrading from earlier versions look for link "Update Store". This will up
36
 
37
  == Changelog ==
38
 
 
 
 
 
 
39
  = 3.13.1 [2017-10-25] =
40
 
41
  * Fix: Fatal errors in Braintree gateway below PHP 7.0.
2
  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.7
6
+ Tested up to: 5.0
7
+ Stable tag: 3.14.0
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.14.0 [2019-01-24] =
40
+
41
+ * Fix: Improve integration with new WordPress block editor.
42
+ * Fix: Improve compatibility with PHP 7.2+
43
+
44
  = 3.13.1 [2017-10-25] =
45
 
46
  * Fix: Fatal errors in Braintree gateway below PHP 7.0.
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.13.1
7
  * Author: WP eCommerce
8
  * Author URI: http://wpecommerce.org/
9
  * Text Domain: wp-e-commerce
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.14.0
7
  * Author: WP eCommerce
8
  * Author URI: http://wpecommerce.org/
9
  * Text Domain: wp-e-commerce
wpsc-admin/display-update.page.php CHANGED
@@ -12,13 +12,13 @@ global $wpdb,$wp_version;
12
  $show_update_page = 1;
13
 
14
  // if there's nothing in the children variation cache, refresh it, just to make sure.
15
- if ( 0 == count( get_option( 'wpsc-variation_children' ) ) ) {
16
  delete_option( 'wpsc-variation_children' );
17
  _get_term_hierarchy( 'wpsc-variation' );
18
  }
19
 
20
  // if there's nothing in the children variation cache, refresh it, just to make sure.
21
- if ( 0 == count( get_option( 'wpsc_product_category_children' ) ) ) {
22
  delete_option( 'wpsc_product_category_children' );
23
  _get_term_hierarchy( 'wpsc_product_category_children' );
24
  }
12
  $show_update_page = 1;
13
 
14
  // if there's nothing in the children variation cache, refresh it, just to make sure.
15
+ if ( 0 == count( get_option( 'wpsc-variation_children', array() ) ) ) {
16
  delete_option( 'wpsc-variation_children' );
17
  _get_term_hierarchy( 'wpsc-variation' );
18
  }
19
 
20
  // if there's nothing in the children variation cache, refresh it, just to make sure.
21
+ if ( 0 == count( get_option( 'wpsc_product_category_children', array() ) ) ) {
22
  delete_option( 'wpsc_product_category_children' );
23
  _get_term_hierarchy( 'wpsc_product_category_children' );
24
  }
wpsc-admin/includes/display-items-functions.php CHANGED
@@ -239,7 +239,7 @@ function wpsc_price_control_forms() {
239
  </thead>
240
  <tbody>
241
  <?php
242
- if ( count( $product_meta['table_rate_price']['quantity'] ) > 0 ) {
243
  foreach ( (array) $product_meta['table_rate_price']['quantity'] as $key => $quantity ) {
244
  if ( $quantity != '' ) {
245
  $table_price = number_format( $product_meta['table_rate_price']['table_price'][ $key ], 2, '.', '' );
@@ -299,7 +299,7 @@ function wpsc_stock_control_forms() {
299
  if ( ! isset( $product_meta['unpublish_when_none_left'] ) ) {
300
  $product_meta['unpublish_when_none_left'] = '';
301
  }
302
-
303
  if ( ! isset( $product_meta['stock_limit_notify'] ) ) {
304
  $product_meta['stock_limit_notify'] = '';
305
  }
239
  </thead>
240
  <tbody>
241
  <?php
242
+ if ( count( (array) $product_meta['table_rate_price']['quantity'] ) > 0 ) {
243
  foreach ( (array) $product_meta['table_rate_price']['quantity'] as $key => $quantity ) {
244
  if ( $quantity != '' ) {
245
  $table_price = number_format( $product_meta['table_rate_price']['table_price'][ $key ], 2, '.', '' );
299
  if ( ! isset( $product_meta['unpublish_when_none_left'] ) ) {
300
  $product_meta['unpublish_when_none_left'] = '';
301
  }
302
+
303
  if ( ! isset( $product_meta['stock_limit_notify'] ) ) {
304
  $product_meta['stock_limit_notify'] = '';
305
  }
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.13.1' );
59
  }
60
 
61
  if ( ! defined( 'WPSC_MINOR_VERSION' ) ) {
62
- define( 'WPSC_MINOR_VERSION' , '361d748' );
63
  }
64
 
65
  if ( ! defined( 'WPSC_PRESENTABLE_VERSION' ) ) {
66
- define( 'WPSC_PRESENTABLE_VERSION', '3.13.1' );
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.14.0' );
59
  }
60
 
61
  if ( ! defined( 'WPSC_MINOR_VERSION' ) ) {
62
+ define( 'WPSC_MINOR_VERSION' , '855a4af6' );
63
  }
64
 
65
  if ( ! defined( 'WPSC_PRESENTABLE_VERSION' ) ) {
66
+ define( 'WPSC_PRESENTABLE_VERSION', '3.14.0' );
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
@@ -479,11 +479,12 @@ function wpsc_register_post_types() {
479
  );
480
  $args = array(
481
  'capability_type' => 'post',
482
- 'supports' => array( 'title', 'editor', 'thumbnail' ),
483
  'hierarchical' => true,
484
  'exclude_from_search' => false,
485
  'public' => true,
486
  'show_ui' => true,
 
487
  'show_in_nav_menus' => true,
488
  'menu_icon' => version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ? WPSC_CORE_IMAGES_URL . '/credit_cards.png' : 'dashicons-cart',
489
  'labels' => $labels,
@@ -530,7 +531,6 @@ function wpsc_register_post_types() {
530
  'hierarchical' => false,
531
  'labels' => $labels,
532
  'show_in_rest' => true,
533
- 'rest_controller_class' => 'WPSC_REST_Tags_Controller',
534
  'rewrite' => array(
535
  'slug' => '/' . sanitize_title_with_dashes( _x( 'tagged', 'slug, part of url', 'wp-e-commerce' ) ),
536
  'with_front' => false )
@@ -556,7 +556,6 @@ function wpsc_register_post_types() {
556
  'labels' => $labels,
557
  'hierarchical' => true,
558
  'show_in_rest' => true,
559
- 'rest_controller_class' => 'WPSC_REST_Categories_Controller',
560
  'rewrite' => array(
561
  'slug' => str_replace( basename( home_url() ), '', $wpsc_page_titles['products'] ),
562
  'with_front' => false,
@@ -581,7 +580,6 @@ function wpsc_register_post_types() {
581
  $args = array(
582
  'hierarchical' => true,
583
  'show_in_rest' => true,
584
- 'rest_controller_class' => 'WPSC_REST_Variations_Controller',
585
  'query_var' => 'variations',
586
  'rewrite' => false,
587
  'public' => true,
479
  );
480
  $args = array(
481
  'capability_type' => 'post',
482
+ 'supports' => array( 'title', 'editor', 'thumbnail', 'block-editor', 'revisions' ),
483
  'hierarchical' => true,
484
  'exclude_from_search' => false,
485
  'public' => true,
486
  'show_ui' => true,
487
+ 'show_in_rest' => true,
488
  'show_in_nav_menus' => true,
489
  'menu_icon' => version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ? WPSC_CORE_IMAGES_URL . '/credit_cards.png' : 'dashicons-cart',
490
  'labels' => $labels,
531
  'hierarchical' => false,
532
  'labels' => $labels,
533
  'show_in_rest' => true,
 
534
  'rewrite' => array(
535
  'slug' => '/' . sanitize_title_with_dashes( _x( 'tagged', 'slug, part of url', 'wp-e-commerce' ) ),
536
  'with_front' => false )
556
  'labels' => $labels,
557
  'hierarchical' => true,
558
  'show_in_rest' => true,
 
559
  'rewrite' => array(
560
  'slug' => str_replace( basename( home_url() ), '', $wpsc_page_titles['products'] ),
561
  'with_front' => false,
580
  $args = array(
581
  'hierarchical' => true,
582
  'show_in_rest' => true,
 
583
  'query_var' => 'variations',
584
  'rewrite' => false,
585
  'public' => true,
wpsc-includes/cart.class.php CHANGED
@@ -431,7 +431,7 @@ class WPSC_Cart {
431
  function get_shipping_option() {
432
  global $wpsc_shipping_modules;
433
 
434
- if ( ( count( $this->shipping_quotes ) < 1 ) &&
435
  isset( $wpsc_shipping_modules[$this->selected_shipping_method] ) &&
436
  is_callable( array( $wpsc_shipping_modules[$this->selected_shipping_method], 'getQuote' ) ) ) {
437
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
@@ -441,7 +441,7 @@ class WPSC_Cart {
441
  $this->selected_shipping_option = null;
442
  }
443
 
444
- if ( count( $this->shipping_quotes ) < 1 ) {
445
  $this->selected_shipping_option = null;
446
  }
447
 
431
  function get_shipping_option() {
432
  global $wpsc_shipping_modules;
433
 
434
+ if ( ( count( (array) $this->shipping_quotes ) < 1 ) &&
435
  isset( $wpsc_shipping_modules[$this->selected_shipping_method] ) &&
436
  is_callable( array( $wpsc_shipping_modules[$this->selected_shipping_method], 'getQuote' ) ) ) {
437
  $this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
441
  $this->selected_shipping_option = null;
442
  }
443
 
444
+ if ( count( (array) $this->shipping_quotes ) < 1 ) {
445
  $this->selected_shipping_option = null;
446
  }
447
 
wpsc-includes/processing.functions.php CHANGED
@@ -126,7 +126,7 @@ function wpsc_decrement_claimed_stock( $purchase_log_id ) {
126
  case 4:
127
  case 5:
128
  foreach ( (array) $all_claimed_stock as $claimed_stock ) {
129
-
130
  $product = get_post( $claimed_stock->product_id );
131
  $current_stock = get_post_meta( $product->ID, '_wpsc_stock', true );
132
  $remaining_stock = $current_stock - $claimed_stock->stock_claimed;
@@ -134,7 +134,7 @@ function wpsc_decrement_claimed_stock( $purchase_log_id ) {
134
  update_product_meta( $product->ID, 'stock', $remaining_stock );
135
 
136
  $product_meta = get_product_meta( $product->ID, 'product_metadata', true );
137
-
138
  $parent_id = wpsc_product_is_variation( $product->ID );
139
 
140
  if( $parent_id ) {
@@ -144,19 +144,19 @@ function wpsc_decrement_claimed_stock( $purchase_log_id ) {
144
  } else {
145
  $notify_limit = $product_meta['stock_limit_notify'];
146
  }
147
-
148
  if ( $notify_limit != 0 && $remaining_stock <= apply_filters( 'wpec_stock_limit_notify', $notify_limit ) ) {
149
  // Check if notification has been sent
150
  $notify_sent = get_product_meta( $product->ID, 'stock_limit_notify_sent', true );
151
-
152
  if( empty( $notify_sent ) ) {
153
  $email_message = sprintf( __( 'The product "%s" has reached stock level "%s".', 'wp-e-commerce' ), $product->post_title, $remaining_stock );
154
-
155
  wp_mail( get_option('purch_log_email'), sprintf(__('%s is low on stock', 'wp-e-commerce'), $product->post_title), $email_message );
156
- update_product_meta( $product->ID, 'stock_limit_notify_sent', true );
157
  }
158
  }
159
-
160
  if ( $remaining_stock < 1 ) {
161
  $email_message = sprintf( __( 'The product "%s" is out of stock.', 'wp-e-commerce' ), $product->post_title );
162
 
@@ -244,6 +244,7 @@ function wpsc_convert_weight( $in_weight, $in_unit, $out_unit = 'pound', $raw =
244
  // other unit names are used when doing imports from CSV
245
 
246
  // convert $in_weight to grams, then convert that to whatever else.
 
247
 
248
  switch( strtolower( $in_unit ) ) {
249
  case "kilogram":
@@ -411,11 +412,11 @@ function wpsc_check_weight($state, $product) {
411
  $shipping_modules = array();
412
  $product_meta = get_product_meta( $product->ID, 'product_metadata',true );
413
  if(! $product->post_parent && wpsc_product_has_children($product->ID)) return $state;
414
-
415
  if ( get_option( 'do_not_use_shipping' ) ) {
416
  return $state;
417
  }
418
-
419
  // only do anything if UPS is on and shipping is used
420
  if( array_search( 'ups', $custom_shipping ) !== false )
421
  $shipping_modules[] = 'UPS';
126
  case 4:
127
  case 5:
128
  foreach ( (array) $all_claimed_stock as $claimed_stock ) {
129
+
130
  $product = get_post( $claimed_stock->product_id );
131
  $current_stock = get_post_meta( $product->ID, '_wpsc_stock', true );
132
  $remaining_stock = $current_stock - $claimed_stock->stock_claimed;
134
  update_product_meta( $product->ID, 'stock', $remaining_stock );
135
 
136
  $product_meta = get_product_meta( $product->ID, 'product_metadata', true );
137
+
138
  $parent_id = wpsc_product_is_variation( $product->ID );
139
 
140
  if( $parent_id ) {
144
  } else {
145
  $notify_limit = $product_meta['stock_limit_notify'];
146
  }
147
+
148
  if ( $notify_limit != 0 && $remaining_stock <= apply_filters( 'wpec_stock_limit_notify', $notify_limit ) ) {
149
  // Check if notification has been sent
150
  $notify_sent = get_product_meta( $product->ID, 'stock_limit_notify_sent', true );
151
+
152
  if( empty( $notify_sent ) ) {
153
  $email_message = sprintf( __( 'The product "%s" has reached stock level "%s".', 'wp-e-commerce' ), $product->post_title, $remaining_stock );
154
+
155
  wp_mail( get_option('purch_log_email'), sprintf(__('%s is low on stock', 'wp-e-commerce'), $product->post_title), $email_message );
156
+ update_product_meta( $product->ID, 'stock_limit_notify_sent', true );
157
  }
158
  }
159
+
160
  if ( $remaining_stock < 1 ) {
161
  $email_message = sprintf( __( 'The product "%s" is out of stock.', 'wp-e-commerce' ), $product->post_title );
162
 
244
  // other unit names are used when doing imports from CSV
245
 
246
  // convert $in_weight to grams, then convert that to whatever else.
247
+ $in_weight = floatval( $in_weight );
248
 
249
  switch( strtolower( $in_unit ) ) {
250
  case "kilogram":
412
  $shipping_modules = array();
413
  $product_meta = get_product_meta( $product->ID, 'product_metadata',true );
414
  if(! $product->post_parent && wpsc_product_has_children($product->ID)) return $state;
415
+
416
  if ( get_option( 'do_not_use_shipping' ) ) {
417
  return $state;
418
  }
419
+
420
  // only do anything if UPS is on and shipping is used
421
  if( array_search( 'ups', $custom_shipping ) !== false )
422
  $shipping_modules[] = 'UPS';
wpsc-includes/product-template.php CHANGED
@@ -170,9 +170,10 @@ function wpsc_calculate_price( $product_id, $variations = false, $special = true
170
  } else {
171
  $price = get_post_meta( $product_id, '_wpsc_price', true );
172
  }
 
173
  $price = apply_filters( 'wpsc_price', $price, $product_id );
174
 
175
- return $price;
176
  }
177
 
178
  /**
170
  } else {
171
  $price = get_post_meta( $product_id, '_wpsc_price', true );
172
  }
173
+
174
  $price = apply_filters( 'wpsc_price', $price, $product_id );
175
 
176
+ return floatval( $price );
177
  }
178
 
179
  /**
wpsc-includes/rest-api/wpsc-rest-categories-controller.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
- class WPSC_REST_Categories_Controller extends WP_REST_Terms_Controller {
3
- public function __construct() {
4
- parent::__construct( 'wpsc_product_category' );
5
- $this->namespace = 'wpsc/v1';
6
- }
7
- }
 
 
 
 
 
 
 
wpsc-includes/rest-api/wpsc-rest-products-controller.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- class WPSC_REST_Products_Controller extends WP_REST_Posts_Controller {
4
-
5
- public function __construct( $post_type = 'wpsc-product' ) {
6
- parent::__construct( $post_type );
7
- $this->namespace = 'wpsc/v1';
8
- }
9
- }
 
 
 
 
 
 
 
 
 
wpsc-includes/rest-api/wpsc-rest-tags-controller.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
- class WPSC_REST_Tags_Controller extends WP_REST_Terms_Controller {
3
- public function __construct() {
4
- parent::__construct( 'product_tag' );
5
- $this->namespace = 'wpsc/v1';
6
- }
7
- }
 
 
 
 
 
 
 
wpsc-includes/wpsc-rest-api.class.php CHANGED
@@ -17,19 +17,9 @@ class WPSC_REST_API {
17
  );
18
 
19
  public static function hooks() {
20
- add_filter( 'wpsc_register_post_types_products_args', array( __CLASS__, 'register_post_type_rest_args' ) );
21
  add_action( 'rest_api_init', array( __CLASS__, 'register_routes' ), 999 );
22
  }
23
 
24
- public static function register_post_type_rest_args( $args ) {
25
-
26
- $args['show_in_rest'] = true;
27
- $args['rest_base'] = 'products';
28
- $args['rest_controller_class'] = 'WPSC_REST_Products_Controller';
29
-
30
- return $args;
31
- }
32
-
33
  public static function register_routes() {
34
  $dir = WPSC_FILE_PATH . '/wpsc-includes/rest-api/';
35
 
17
  );
18
 
19
  public static function hooks() {
 
20
  add_action( 'rest_api_init', array( __CLASS__, 'register_routes' ), 999 );
21
  }
22
 
 
 
 
 
 
 
 
 
 
23
  public static function register_routes() {
24
  $dir = WPSC_FILE_PATH . '/wpsc-includes/rest-api/';
25