Fixed coding standards
This commit is contained in:
parent
c5c1e9ecbe
commit
089b5e93f2
|
@ -446,13 +446,13 @@ class WC_Checkout {
|
|||
|
||||
// Get Value
|
||||
switch ( $field['type'] ) {
|
||||
case "checkbox" :
|
||||
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? 1 : 0;
|
||||
case 'checkbox' :
|
||||
$this->posted[ $key ] = (int) isset( $_POST[ $key ] );
|
||||
break;
|
||||
case "multiselect" :
|
||||
case 'multiselect' :
|
||||
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? implode( ', ', array_map( 'wc_clean', $_POST[ $key ] ) ) : '';
|
||||
break;
|
||||
case "textarea" :
|
||||
case 'textarea' :
|
||||
$this->posted[ $key ] = isset( $_POST[ $key ] ) ? wp_strip_all_tags( wp_check_invalid_utf8( stripslashes( $_POST[ $key ] ) ) ) : '';
|
||||
break;
|
||||
default :
|
||||
|
@ -489,23 +489,25 @@ class WC_Checkout {
|
|||
case 'postcode' :
|
||||
$this->posted[ $key ] = strtoupper( str_replace( ' ', '', $this->posted[ $key ] ) );
|
||||
|
||||
if ( ! WC_Validation::is_postcode( $this->posted[ $key ], $_POST[ $fieldset_key . '_country' ] ) ) :
|
||||
if ( ! WC_Validation::is_postcode( $this->posted[ $key ], $_POST[ $fieldset_key . '_country' ] ) ) {
|
||||
wc_add_notice( __( 'Please enter a valid postcode/ZIP.', 'woocommerce' ), 'error' );
|
||||
else :
|
||||
} else {
|
||||
$this->posted[ $key ] = wc_format_postcode( $this->posted[ $key ], $_POST[ $fieldset_key . '_country' ] );
|
||||
endif;
|
||||
}
|
||||
break;
|
||||
case 'phone' :
|
||||
$this->posted[ $key ] = wc_format_phone_number( $this->posted[ $key ] );
|
||||
|
||||
if ( ! WC_Validation::is_phone( $this->posted[ $key ] ) )
|
||||
if ( ! WC_Validation::is_phone( $this->posted[ $key ] ) ) {
|
||||
wc_add_notice( '<strong>' . $field['label'] . '</strong> ' . __( 'is not a valid phone number.', 'woocommerce' ), 'error' );
|
||||
}
|
||||
break;
|
||||
case 'email' :
|
||||
$this->posted[ $key ] = strtolower( $this->posted[ $key ] );
|
||||
|
||||
if ( ! is_email( $this->posted[ $key ] ) )
|
||||
if ( ! is_email( $this->posted[ $key ] ) ) {
|
||||
wc_add_notice( '<strong>' . $field['label'] . '</strong> ' . __( 'is not a valid email address.', 'woocommerce' ), 'error' );
|
||||
}
|
||||
break;
|
||||
case 'state' :
|
||||
// Get valid states
|
||||
|
|
Loading…
Reference in New Issue