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