Skip to content

Commit 85ae508

Browse files
authored
Merge pull request #218 from moderntribe/release/3.22.0
Package version 3.22.0
2 parents 108f7f5 + 767aa87 commit 85ae508

File tree

106 files changed

+969
-865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+969
-865
lines changed

CHANGELOG.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
# Changelog
22

3+
## [3.22.0]
4+
5+
### Added
6+
- Segment support for cross-domain analytics with Google Analytics. It enables the
7+
`autoLinker` plugin feature for GA.
8+
- Enforce BigCommerce password requirements when registering new customers
9+
- Display category description on product category pages
10+
11+
### Changed
12+
- Data Sanitization/Escaping code refactor for WPVIP compliance
13+
314
## [3.21.0]
415

516
### Added
6-
- Added manuall site URL sync option in the Diagnostics panel
17+
- Added manual site URL sync option in the Diagnostics panel
718

819
### Changed
920
- Modified admin import timeout message
@@ -22,7 +33,7 @@
2233

2334
### Fixed
2435

25-
- Fixed an issue with product grids where Ajax to cart is enabled but no simple products are on the page. This would
36+
- Fixed an issue with product grids where Ajax to cart is enabled but no simple products are on the page. This would
2637
cause the Add to Cart button on Quick View to redirect to the cart page instead of an ajax submission.
2738

2839
- Fixed Google SiteKit plugin breaking Settings page.
@@ -36,7 +47,7 @@
3647

3748
### Fixed
3849

39-
- Featured and regular product sort order reflect order in BC store
50+
- Featured and regular product sort order reflect order in BC store
4051

4152

4253
## [3.18.1]
@@ -50,7 +61,7 @@
5061

5162
### Added
5263

53-
- Added support for new larger image size and zoom features on the PDP in multiple
64+
- Added support for new larger image size and zoom features on the PDP in multiple
5465
supported WordPress themes.
5566
- Added version numbers to templates. Diagnostics panel will now check major versions of overridden files.
5667
- Support for Flatsome theme added starting with version 3.10.1 of the theme.
@@ -1207,6 +1218,7 @@
12071218
in fact, reset postdata, so far as Gutenberg 3.2.0 is concerned.
12081219

12091220

1221+
[3.22.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.21.0...3.22.0
12101222
[3.21.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.20.0...3.21.0
12111223
[3.20.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.19.0...3.20.0
12121224
[3.19.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/3.18.1...3.19.0

assets/js/dist/scripts.js

+401-401
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/scripts.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/vendor.js

+193-193
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dist/vendor.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/src/public/buttons/analytics.js

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import delegate from 'delegate';
7+
import { STORE_DOMAIN } from 'publicConfig/wp-settings';
78
import * as tools from '../../utils/tools';
89

910
const el = {
@@ -44,6 +45,13 @@ const handleClickTracker = (e) => {
4445
console.info(`Segment has sent the following tracking data to your analytics account(s): ${analyticsData}`);
4546
};
4647

48+
const gaCrossDomainInit = async () => {
49+
await analytics.ready(() => {
50+
ga('require', 'linker');
51+
ga('linker:autoLink', [STORE_DOMAIN]);
52+
});
53+
};
54+
4755
const bindEvents = () => {
4856
tools.getNodes('bc-product-loop-card', true, document).forEach((product) => {
4957
delegate(product, '[data-js="bc-product-quick-view-dialog-trigger"]', 'click', handleClickTracker);
@@ -60,6 +68,7 @@ const init = () => {
6068
return;
6169
}
6270

71+
gaCrossDomainInit();
6372
bindEvents();
6473
handleAddToCartTracker();
6574
};

assets/js/src/public/config/wp-settings.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export const PRODUCT_MESSAGES = CONFIG.product.messages || '';
1010
export const PRICING_API_URL = CONFIG.pricing.api_url || '';
1111
export const PRICING_API_NONCE = CONFIG.pricing.ajax_pricing_nonce || '';
1212
export const MINI_CART = CONFIG.cart.mini_cart.enabled || false;
13+
export const STORE_DOMAIN = CONFIG.store_domain || '';

bigcommerce.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: BigCommerce for WordPress
44
Description: Scale your ecommerce business with WordPress on the front-end and BigCommerce on the back end. Free up server resources from things like catalog management, processing payments, and managing fulfillment logistics.
55
Author: BigCommerce
6-
Version: 3.21.0
6+
Version: 3.22.0
77
Author URI: https://www.bigcommerce.com/wordpress
88
Requires PHP: 5.6.24
99
Text Domain: bigcommerce

build-timestamp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?php
2-
define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '3.04.07.03.2020');
2+
define('BIGCOMMERCE_ASSETS_BUILD_TIMESTAMP', '5.44.07.17.2020');

readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: bigcommerce, moderntribe, jbrinley, becomevocal, vincentlistrani,
33
Tags: ecommerce, online store, sell online, storefront, retail, online shop, bigcommerce, big commerce, e-commerce, physical products, buy buttons, commerce, shopping cart, checkout, cart, shop, headless commerce, shipping, payments, fulfillment
44
Requires at least: 4.6
55
Tested up to: 5.3
6-
Stable tag: 3.21.0
6+
Stable tag: 3.22.0
77
Requires PHP: 5.6.24
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html

src/BigCommerce/Accounts/Login.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,13 @@ public function lostpassword_url( $login_url, $redirect ) {
183183
public function lostpassword_error_handler( $error ) {
184184

185185
if ( ! $error->get_error_code() ) {
186-
if ( strpos( $_POST[ 'user_login' ], '@' ) !== false ) {
186+
$user_login = filter_input( INPUT_POST, 'user_login', FILTER_SANITIZE_STRING );
187+
if ( strpos( $user_login, '@' ) !== false ) {
187188
return; // WP has already checked it as an email address
188189
}
189-
if ( isset( $_POST[ 'user_login' ] ) ) { // WP doesn't add this as an error until after lostpassword_post
190-
$user_data = get_user_by( 'login', $_POST[ 'user_login' ] );
191-
}
190+
// WP doesn't add this as an error until after lostpassword_post
191+
$user_data = get_user_by( 'login', $user_login );
192+
192193
if ( ! empty( $user_data ) ) {
193194
return; // no errors
194195
} else {

src/BigCommerce/Accounts/Password_Reset.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public function sync_reset_password_with_bigcommerce( $user, $new_pass ) {
4242
* @action profile_update
4343
*/
4444
public function sync_password_change_with_bigcommerce( $user_id, $old_user_data ) {
45-
if ( empty( $_POST['pass1'] ) ) { // $_POST is the only place we can find the plain text password
45+
// $_POST is the only place we can find the plain text password
46+
$pass1 = filter_input( INPUT_POST, 'pass1', FILTER_UNSAFE_RAW ); // phpcs:ignore
47+
if ( empty( $pass1 ) ) {
4648
return; // not a request to update a user's password
4749
}
4850
$sync = get_user_meta( $user_id, User_Profile_Settings::SYNC_PASSWORD, true );
@@ -55,7 +57,7 @@ public function sync_password_change_with_bigcommerce( $user_id, $old_user_data
5557
return; // nothing changes
5658
}
5759

58-
$this->set_password( $current_user, $_POST['pass1'] );
60+
$this->set_password( $current_user, $pass1 );
5961
}
6062

6163
/**

src/BigCommerce/Accounts/User_Profile_Settings.php

+7-8
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ public function render_profile_settings( $user ) {
2222
}
2323
$sync = get_user_meta( $user->ID, self::SYNC_PASSWORD, true );
2424
?>
25-
<h2><?php _e( 'BigCommerce', 'bigcommerce' ); ?></h2>
25+
<h2><?php esc_html_e( 'BigCommerce', 'bigcommerce' ); ?></h2>
2626
<table class="form-table">
2727
<tr id="bigcommerce-sync-password" class="">
2828
<th scope="row">
29-
<?php _e( 'Authentication', 'bigcommerce' ); ?>
29+
<?php esc_html_e( 'Authentication', 'bigcommerce' ); ?>
3030
<?php wp_nonce_field( self::NONCE_ACTION, self::NONCE_NAME ); ?>
3131
</th>
3232
<td>
3333
<label for="<?php echo esc_attr( self::SYNC_PASSWORD ); ?>">
3434
<input id="<?php echo esc_attr( self::SYNC_PASSWORD ); ?>" type="checkbox"
3535
name="<?php echo esc_attr( self::SYNC_PASSWORD ); ?>" value="1" <?php checked( $sync ); ?> />
36-
<?php _e( 'Synchronize Password', 'bigcommerce' ); ?>
36+
<?php esc_html_e( 'Synchronize Password', 'bigcommerce' ); ?>
3737
</label>
3838
<p
39-
class="description"><?php _e( "Validate the user's password with the BigCommerce API.", 'bigcommerce' ) ?></p>
39+
class="description"><?php esc_html_e( "Validate the user's password with the BigCommerce API.", 'bigcommerce' ) ?></p>
4040
</td>
4141
</tr>
4242
</table>
@@ -54,10 +54,9 @@ public function save_profile_settings( $user_id ) {
5454
if ( ! current_user_can( 'edit_users' ) ) {
5555
return;
5656
}
57-
if ( ! isset( $_POST[ self::NONCE_NAME ] ) ) {
58-
return;
59-
}
60-
if ( ! wp_verify_nonce( $_POST[ self::NONCE_NAME ], self::NONCE_ACTION ) ) {
57+
58+
$nonce = filter_input( INPUT_POST, self::NONCE_NAME, FILTER_SANITIZE_STRING );
59+
if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, self::NONCE_ACTION ) ) {
6160
return;
6261
}
6362

src/BigCommerce/Analytics/Events/Add_To_Cart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function set_tracking_attributes_on_success_message( $args, $data ) {
3131
$args[ Message::ATTRIBUTES ] = array_merge( $args[ Message::ATTRIBUTES ], [
3232
'data-tracking-trigger' => 'ready',
3333
'data-tracking-event' => 'add_to_cart',
34-
'data-tracking-data' => json_encode( [
34+
'data-tracking-data' => wp_json_encode( [
3535
'cart_id' => $data['cart_id'],
3636
'post_id' => $data['post_id'],
3737
'product_id' => $data['product_id'],

src/BigCommerce/Analytics/Events/View_Product.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function add_tracking_attributes_to_button( $options = [], $template = ''
3030
$options[ View_Product_Button::ATTRIBUTES ] = array_merge( $options[ View_Product_Button::ATTRIBUTES ], [
3131
'data-tracking-trigger' => 'click',
3232
'data-tracking-event' => 'view_product',
33-
'data-tracking-data' => json_encode( [
33+
'data-tracking-data' => wp_json_encode( [
3434
'post_id' => $product->post_id(),
3535
'product_id' => $product->bc_id(),
3636
'name' => get_the_title( $product->post_id() ),
@@ -61,7 +61,7 @@ public function add_tracking_attributes_to_permalink( $options, $template ) {
6161
$options[ Product_Title::LINK_ATTRIBUTES ] = array_merge( $options[ Product_Title::LINK_ATTRIBUTES ], [
6262
'data-tracking-trigger' => 'click',
6363
'data-tracking-event' => 'view_product',
64-
'data-tracking-data' => json_encode( [
64+
'data-tracking-data' => wp_json_encode( [
6565
'post_id' => $product->post_id(),
6666
'product_id' => $product->bc_id(),
6767
'name' => get_the_title( $product->post_id() ),

src/BigCommerce/Analytics/Segment.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function render_tracking_code() {
1818
<!-- Segment Analytics Code -->
1919
<script type="text/javascript" data-js="bc-segment-tracker">
2020
!function(){var analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.loadPlatform=function(t,e,a,o){window[o||"analytics"]=analytics;window._analytics_js_global_name=o;analytics.platformSettings=e;analytics.platformPlan=a;var n=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1";t&&(n+="/"+t);var r=document.createElement("script");r.type="text/javascript";r.async=!0;r.src=n+"/platform/analytics.min.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)};analytics.SNIPPET_VERSION="4.0.0_platform";
21-
analytics.loadPlatform(<?php echo ( $key ? json_encode( $key ) : 'null' ); ?>, <?php echo json_encode( $settings ) ?>,{},"analytics");
21+
analytics.loadPlatform(<?php echo ( $key ? wp_json_encode( $key ) : 'null' ); ?>, <?php echo wp_json_encode( $settings ) ?>,{},"analytics");
2222
analytics.page()
2323
}}();
2424
</script>
@@ -43,7 +43,7 @@ private function get_settings() {
4343
$facebook = get_option( Analytics::FACEBOOK_PIXEL );
4444
if ( $facebook ) {
4545
$settings[ 'Facebook Pixel' ] = [
46-
'pixelId' => $facebook,
46+
'pixelId' => $facebook,
4747
'initWithExistingTraits' => true,
4848
];
4949
}
@@ -55,4 +55,4 @@ private function get_settings() {
5555
return (object) $settings;
5656
}
5757

58-
}
58+
}

src/BigCommerce/Api/Caching_Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private function build_cache_key( $resourcePath, $method, $queryParams, $postDat
140140
'headerParams' => $headerParams,
141141
'responseType' => $responseType,
142142
];
143-
$serialized = md5( json_encode( $args ) );
143+
$serialized = md5( wp_json_encode( $args ) );
144144

145145
return $resourcePath . ':' . $serialized . ':' . $this->get_generation_key();
146146
}

src/BigCommerce/Assets/Theme/JS_Config.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ public function __construct( $asset_directory ) {
2121
public function get_data() {
2222
if ( ! isset( $this->data ) ) {
2323
$this->data = [
24-
'images_url' => $this->directory . 'img/admin/',
25-
'product' => [
24+
'store_domain' => get_option( \BigCommerce\Import\Processors\Store_Settings::DOMAIN ),
25+
'images_url' => $this->directory . 'img/admin/',
26+
'product' => [
2627
'messages' => [
2728
'not_available' => __( 'The selected product combination is currently unavailable.', 'bigcommerce' ),
2829
],
@@ -33,4 +34,4 @@ public function get_data() {
3334

3435
return $this->data;
3536
}
36-
}
37+
}

src/BigCommerce/CLI/Documentation/Build_Docs.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function run( $args, $assoc_args ) {
3939
exit;
4040
}
4141
$data = $this->get_data();
42-
$json = json_encode( $data, JSON_PRETTY_PRINT );
42+
$json = wp_json_encode( $data, JSON_PRETTY_PRINT );
4343
$output_file = reset( $args );
4444
$result = file_put_contents( $output_file, $json );
4545
WP_CLI::line();

src/BigCommerce/CLI/Resources/Build_Resources.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function run( $args, $assoc_args ) {
7979
$flags |= JSON_PRETTY_PRINT;
8080
}
8181

82-
echo json_encode( $output, $flags );
82+
echo wp_json_encode( $output, $flags );
8383

8484
}
8585
}

src/BigCommerce/CLI/Update_Country_Cache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function run( $args, $assoc_args ) {
4848
if ( empty( $countries ) ) {
4949
\WP_CLI::error( __( 'Unable to retrieve country data from the BigCommerce API', 'bigcommerce' ) );
5050
}
51-
$json = json_encode( $countries );
51+
$json = wp_json_encode( $countries );
5252
\WP_CLI::debug( sprintf( __( 'Writing country json to %s', 'bigcommerce' ), $output_file ) );
5353
file_put_contents( $output_file, $json );
5454
\WP_CLI::success( __( 'Update complete', 'bigcommerce' ) );

src/BigCommerce/Cart/Add_To_Cart.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ public function handle_request( $post_id, CartApi $cart_api ) {
4444

4545
$options = [];
4646

47-
$submitted_options = empty( $_POST[ 'option' ] ) ? [] : (array) $_POST[ 'option' ];
48-
$option_config = $product->options();
49-
$modifier_config = $product->modifiers();
47+
// Options are sanitized bellow
48+
$submitted_options = empty( $_POST[ 'option' ] ) ? [] : (array) $_POST[ 'option' ]; // phpcs:ignore
49+
$option_config = $product->options();
50+
$modifier_config = $product->modifiers();
5051
foreach ( $option_config as $config ) {
5152
if ( array_key_exists( $config[ 'id' ], $submitted_options ) ) {
5253
$options[ $config[ 'id' ] ] = absint( $submitted_options[ $config[ 'id' ] ] );

src/BigCommerce/Cart/Cart.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ public function __construct( CartApi $api ) {
3737
*/
3838
public function get_cart_id() {
3939
$cart_id = '';
40-
if ( isset( $_COOKIE[ self::CART_COOKIE ] ) && get_option( Settings\Sections\Cart::OPTION_ENABLE_CART, true ) ) {
41-
$cart_id = $_COOKIE[ self::CART_COOKIE ];
40+
$cookie = filter_input( INPUT_COOKIE, self::CART_COOKIE, FILTER_SANITIZE_STRING );
41+
if ( $cookie && get_option( Settings\Sections\Cart::OPTION_ENABLE_CART, true ) ) {
42+
$cart_id = $cookie;
4243
}
4344

4445
/**

src/BigCommerce/Cart/Cart_Recovery.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function handle_request( ) {
4141
$token = filter_input( INPUT_GET, 't', FILTER_SANITIZE_STRING );
4242

4343
if ( empty( $token ) ) {
44-
wp_die( __( 'Bad Request', 'bigcommerce' ), __( 'Bad Request', 'bigcommerce' ), 400 );
44+
wp_die( esc_html( __( 'Bad Request', 'bigcommerce' ) ), esc_html( __( 'Bad Request', 'bigcommerce' ) ), 400 );
4545
exit();
4646
}
4747

src/BigCommerce/Checkout/Requirements_Notice.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function check_requirements() {
9090
printf(
9191
'<div class="notice notice-error bigcommerce-notice"><p class="bigcommerce-notice__refresh"><a class="bigcommerce-notice__refresh-button" href="%s"><i class="bc-icon icon-bc-sync"></i> %s</a></p><h3 class="bigcommerce-notice__heading">%s</h3>%s</div>',
9292
esc_url( $this->refresh_url() ),
93-
__( 'Refresh', 'bigcommerce' ),
93+
esc_html( __( 'Refresh', 'bigcommerce' ) ),
9494
$notice_header,
9595
$list
9696
);
@@ -133,7 +133,7 @@ private function refresh_url( $redirect = '' ) {
133133
'action' => self::REFRESH,
134134
], $url );
135135
if ( empty( $redirect ) ) {
136-
$redirect = $_SERVER['REQUEST_URI'];
136+
$redirect = filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL );
137137
}
138138
$url = add_query_arg( [ 'redirect_to' => urlencode( $redirect ) ], $url );
139139
$url = wp_nonce_url( $url, self::REFRESH );

src/BigCommerce/Compatibility/WooCommerce/Cart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Cart {
1717
public function __construct( CartApi $bc_cart_api )
1818
{
1919
$this->bc_cart_api = $bc_cart_api;
20-
$this->cart_contents_count = isset( $_COOKIE[ BC_Cart::COUNT_COOKIE ] ) ? $_COOKIE[ BC_Cart::COUNT_COOKIE ] : 0;
20+
$this->cart_contents_count = filter_input( INPUT_COOKIE, BC_Cart::COUNT_COOKIE, FILTER_SANITIZE_NUMBER_INT ) ?: 0;
2121
}
2222

2323
public function get_cart_subtotal() {

src/BigCommerce/Compatibility/woocommerce-functions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function wc_locate_template( $template_name, $template_path = '', $default_path
5151

5252
if ( ! function_exists( 'woocommerce_mini_cart' ) ) {
5353
function woocommerce_mini_cart() {
54-
printf( '<div data-js="bc-mini-cart"><span class="bc-loading">%s</span></div>', __( 'Loading', 'bigcommerce' ) );
54+
printf( '<div data-js="bc-mini-cart"><span class="bc-loading">%s</span></div>', esc_html( __( 'Loading', 'bigcommerce' ) ) );
5555
}
5656
}
5757

src/BigCommerce/Container/Compatibility.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function register( Container $container ) {
4747
} ), 10, 3 );
4848

4949
add_action( 'setup_theme', $this->create_callback( 'woo_compat_functions', function () use ( $container ) {
50-
if ( filter_input( INPUT_GET, 'action' ) === 'activate' && filter_input( INPUT_GET, 'plugin' ) === 'woocommerce/woocommerce.php' ) {
50+
if ( filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING ) === 'activate' && filter_input( INPUT_GET, 'plugin', FILTER_SANITIZE_STRING ) === 'woocommerce/woocommerce.php' ) {
5151
return;
5252
}
5353
include_once( dirname( $container[ 'plugin_file' ] ) . '/src/BigCommerce/Compatibility/woocommerce-functions.php' );

src/BigCommerce/Container/Forms.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ private function actions( Container $container ) {
4343
* Handle all form submissions with a bc-action argument
4444
*/
4545
add_action( 'parse_request', $this->create_callback( 'handle_form_action', function () use ( $container ) {
46-
if ( isset( $_REQUEST[ 'bc-action' ] ) ) {
47-
do_action( 'bigcommerce/form/action=' . $_REQUEST[ 'bc-action' ], stripslashes_deep( $_REQUEST ) );
46+
$action = filter_var_array( $_REQUEST, [ 'bc-action' => FILTER_SANITIZE_STRING ] );
47+
if ( $action['bc-action'] ) {
48+
do_action( 'bigcommerce/form/action=' . $action['bc-action'], stripslashes_deep( $_REQUEST ) );
4849
}
4950
} ), 10, 0 );
5051

0 commit comments

Comments
 (0)