Fix code sniffer errors
This commit is contained in:
parent
053a45e0b2
commit
aae44ac1cd
|
@ -688,23 +688,25 @@ class WC_Checkout {
|
||||||
foreach ( $fieldset as $key => $field ) {
|
foreach ( $fieldset as $key => $field ) {
|
||||||
$type = sanitize_title( isset( $field['type'] ) ? $field['type'] : 'text' );
|
$type = sanitize_title( isset( $field['type'] ) ? $field['type'] : 'text' );
|
||||||
|
|
||||||
|
// phpcs:disable WordPress.Security.NonceVerification.Missing
|
||||||
switch ( $type ) {
|
switch ( $type ) {
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
$value = isset( $_POST[ $key ] ) ? 1 : ''; // WPCS: input var ok, CSRF ok.
|
$value = isset( $_POST[ $key ] ) ? 1 : '';
|
||||||
break;
|
break;
|
||||||
case 'multiselect':
|
case 'multiselect':
|
||||||
$value = isset( $_POST[ $key ] ) ? implode( ', ', wc_clean( wp_unslash( $_POST[ $key ] ) ) ) : ''; // WPCS: input var ok, CSRF ok.
|
$value = isset( $_POST[ $key ] ) ? implode( ', ', wc_clean( wp_unslash( $_POST[ $key ] ) ) ) : '';
|
||||||
break;
|
break;
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
$value = isset( $_POST[ $key ] ) ? wc_sanitize_textarea( wp_unslash( $_POST[ $key ] ) ) : ''; // WPCS: input var ok, CSRF ok.
|
$value = isset( $_POST[ $key ] ) ? wc_sanitize_textarea( wp_unslash( $_POST[ $key ] ) ) : '';
|
||||||
break;
|
break;
|
||||||
case 'password':
|
case 'password':
|
||||||
$value = isset( $_POST[ $key ] ) ? wp_unslash( $_POST[ $key ] ) : ''; // WPCS: input var ok, CSRF ok, sanitization ok.
|
$value = isset( $_POST[ $key ] ) ? wp_unslash( $_POST[ $key ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$value = isset( $_POST[ $key ] ) ? wc_clean( wp_unslash( $_POST[ $key ] ) ) : ''; // WPCS: input var ok, CSRF ok.
|
$value = isset( $_POST[ $key ] ) ? wc_clean( wp_unslash( $_POST[ $key ] ) ) : '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// phpcs:enable WordPress.Security.NonceVerification.Missing
|
||||||
|
|
||||||
$data[ $key ] = apply_filters( 'woocommerce_process_checkout_' . $type . '_field', apply_filters( 'woocommerce_process_checkout_field_' . $key, $value ) );
|
$data[ $key ] = apply_filters( 'woocommerce_process_checkout_' . $type . '_field', apply_filters( 'woocommerce_process_checkout_field_' . $key, $value ) );
|
||||||
}
|
}
|
||||||
|
@ -835,7 +837,8 @@ class WC_Checkout {
|
||||||
WC()->countries->country_exists( $billing_country, true );
|
WC()->countries->country_exists( $billing_country, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $data['woocommerce_checkout_update_totals'] ) && empty( $data['terms'] ) && ! empty( $_POST['terms-field'] ) ) { // WPCS: input var ok, CSRF ok.
|
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||||
|
if ( empty( $data['woocommerce_checkout_update_totals'] ) && empty( $data['terms'] ) && ! empty( $_POST['terms-field'] ) ) {
|
||||||
$errors->add( 'terms', __( 'Please read and accept the terms and conditions to proceed with your order.', 'woocommerce' ) );
|
$errors->add( 'terms', __( 'Please read and accept the terms and conditions to proceed with your order.', 'woocommerce' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,8 +1214,8 @@ class WC_Checkout {
|
||||||
*/
|
*/
|
||||||
public function get_value( $input ) {
|
public function get_value( $input ) {
|
||||||
// If the form was posted, get the posted value. This will only tend to happen when JavaScript is disabled client side.
|
// If the form was posted, get the posted value. This will only tend to happen when JavaScript is disabled client side.
|
||||||
if ( ! empty( $_POST[ $input ] ) ) { // WPCS: input var ok, CSRF OK.
|
if ( ! empty( $_POST[ $input ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||||
return wc_clean( wp_unslash( $_POST[ $input ] ) ); // WPCS: input var ok, CSRF OK.
|
return wc_clean( wp_unslash( $_POST[ $input ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow 3rd parties to short circuit the logic and return their own default value.
|
// Allow 3rd parties to short circuit the logic and return their own default value.
|
||||||
|
|
Loading…
Reference in New Issue