Class WC_Validation

Contains Validation functions

Package: WooCommerce\Classes
Category: Class
Author: WooThemes
Version: 2.1.0
Class: WC_Validation
Located at includes/class-wc-validation.php

Methods summary

public static boolean
# is_email( string $email )

Validates an email using wordpress native is_email function

Validates an email using wordpress native is_email function

Parameters

$email
string
email address

Returns

boolean
public static boolean
# is_phone( string $phone )

Validates a phone number using a regular expression

Validates a phone number using a regular expression

Parameters

$phone
string
phone number

Returns

boolean
public static boolean
# is_postcode( string $postcode, string $country )

Checks for a valid postcode

Checks for a valid postcode

Parameters

$postcode
string
postcode
$country
string
country

Returns

boolean
public static boolean
# is_GB_postcode( mixed $toCheck )

is_GB_postcode function.

is_GB_postcode function.

Parameters

$toCheck
mixed
$toCheck A postcode

Returns

boolean

Author

John Gardner
public static string
# format_postcode( string $postcode, string $country )

Format the postcode according to the country and length of the postcode

Format the postcode according to the country and length of the postcode

Parameters

$postcode
string
postcode
$country
string
country

Returns

string
formatted postcode
public static string
# format_phone( mixed $tel )

format_phone function.

format_phone function.

Parameters

$tel
mixed
$tel

Returns

string

Magic methods summary

WooCommerce API documentation generated by ApiGen 2.8.0