PHP Class WC_Validation

Author: WooThemes
Exibir arquivo Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
format_phone ( mixed $tel ) : string format_phone function.
format_postcode ( $postcode, $country ) : string Format the postcode according to the country and length of the postcode.
is_GB_postcode ( string $to_check ) : boolean Check if is a GB postcode.
is_email ( $email ) : boolean Validates an email using wordpress native is_email function.
is_phone ( $phone ) : boolean Validates a phone number using a regular expression.
is_postcode ( $postcode, $country ) : boolean Checks for a valid postcode.

Method Details

format_phone() public static method

format_phone function.
public static format_phone ( mixed $tel ) : string
$tel mixed
return string

format_postcode() public static method

Format the postcode according to the country and length of the postcode.
public static format_postcode ( $postcode, $country ) : string
return string formatted postcode

is_GB_postcode() public static method

Check if is a GB postcode.
Author: John Gardner
public static is_GB_postcode ( string $to_check ) : boolean
$to_check string A postcode
return boolean

is_email() public static method

Validates an email using wordpress native is_email function.
public static is_email ( $email ) : boolean
return boolean

is_phone() public static method

Validates a phone number using a regular expression.
public static is_phone ( $phone ) : boolean
return boolean

is_postcode() public static method

Checks for a valid postcode.
public static is_postcode ( $postcode, $country ) : boolean
return boolean