File tree Expand file tree Collapse file tree 3 files changed +4
-28
lines changed
checkout/woopay/express-button Expand file tree Collapse file tree 3 files changed +4
-28
lines changed Original file line number Diff line number Diff line change 2
2
* External dependencies
3
3
*/
4
4
import validator from 'validator' ;
5
- import { applyFilters } from '@wordpress/hooks' ;
6
5
7
6
const useExpressCheckoutProductHandler = ( api ) => {
8
7
const getAttributes = ( ) => {
@@ -105,24 +104,12 @@ const useExpressCheckoutProductHandler = ( api ) => {
105
104
}
106
105
107
106
const addOnForm = document . querySelector ( 'form.cart' ) ;
108
- let allowedFieldNames = applyFilters (
109
- 'wcpayPaymentRequestAllowedFieldNames' ,
110
- [ ]
111
- ) ;
112
- // Ensure allowedFieldNames is an array.
113
- if ( ! Array . isArray ( allowedFieldNames ) ) {
114
- allowedFieldNames = [ allowedFieldNames ] ;
115
- }
116
107
117
108
if ( addOnForm ) {
118
109
const formData = new FormData ( addOnForm ) ;
119
110
120
111
formData . forEach ( ( value , name ) => {
121
- if (
122
- / ^ a d d o n - / . test ( name ) ||
123
- / ^ w c _ / . test ( name ) ||
124
- allowedFieldNames . includes ( name )
125
- ) {
112
+ if ( / ^ ( a d d o n - | w c _ ) / . test ( name ) ) {
126
113
if ( / \[ \] $ / . test ( name ) ) {
127
114
const fieldName = name . substring ( 0 , name . length - 2 ) ;
128
115
Original file line number Diff line number Diff line change 3
3
* External dependencies
4
4
*/
5
5
import { __ } from '@wordpress/i18n' ;
6
- import { applyFilters , doAction } from '@wordpress/hooks' ;
6
+ import { doAction } from '@wordpress/hooks' ;
7
7
import { debounce } from 'lodash' ;
8
8
/**
9
9
* Internal dependencies
@@ -189,19 +189,8 @@ jQuery( ( $ ) => {
189
189
190
190
// Add addons data to the POST body
191
191
const formData = $ ( 'form.cart' ) . serializeArray ( ) ;
192
- let allowedFieldNames = applyFilters (
193
- 'wcpayPaymentRequestAllowedFieldNames' ,
194
- [ ]
195
- ) ;
196
- // Ensure allowedFieldNames is an array.
197
- if ( ! Array . isArray ( allowedFieldNames ) ) {
198
- allowedFieldNames = [ allowedFieldNames ] ;
199
- }
200
192
$ . each ( formData , ( i , field ) => {
201
- if (
202
- allowedFieldNames . includes ( field . name ) ||
203
- / ^ ( a d d o n - | w c _ ) / . test ( field . name )
204
- ) {
193
+ if ( / ^ ( a d d o n - | w c _ ) / . test ( field . name ) ) {
205
194
if ( / \[ \] $ / . test ( field . name ) ) {
206
195
const fieldName = field . name . substring (
207
196
0 ,
Original file line number Diff line number Diff line change @@ -1062,7 +1062,7 @@ public function ajax_get_selected_product_data() {
1062
1062
$ product = wc_get_product ( $ product_id );
1063
1063
$ variation_id = null ;
1064
1064
$ currency = get_woocommerce_currency ();
1065
- $ is_deposit = isset ( $ _POST ['wc_deposit_option ' ] ) ? 'yes ' === $ _POST ['wc_deposit_option ' ] : null ;
1065
+ $ is_deposit = isset ( $ _POST ['wc_deposit_option ' ] ) ? 'yes ' === sanitize_text_field ( wp_unslash ( $ _POST ['wc_deposit_option ' ] ) ) : null ;
1066
1066
1067
1067
if ( ! is_a ( $ product , 'WC_Product ' ) ) {
1068
1068
/* translators: product ID */
You can’t perform that action at this time.
0 commit comments