PHP Class Contao\Validator

Usage: if (Validator::isEmail($recipient)) { $email->sendTo($recipient); }
ファイルを表示 Open project: contao/core-bundle Class Usage Examples

Public Methods

Method Description
isAlias ( mixed $varValue ) : boolean Valid alias name
isAlphabetic ( mixed $varValue ) : boolean Alphabetic characters (including full stop [.] minus [-] and space [ ])
isAlphanumeric ( mixed $varValue ) : boolean Alphanumeric characters (including full stop [.] minus [-], underscore [_] and space [ ])
isBinaryUuid ( mixed $varValue ) : boolean Valid binary UUID (version 1)
isDate ( mixed $varValue ) : boolean Valid date formats
isDatim ( mixed $varValue ) : boolean Valid date and time formats
isEmail ( mixed $varValue ) : boolean Valid e-mail address
isExtendedAlphanumeric ( mixed $varValue ) : boolean Characters that are usually encoded by the Input class: #<>()\=
isFieldName ( mixed $strName ) : boolean Valid form field name
isFolderAlias ( mixed $varValue ) : boolean Valid folder alias name
isGooglePlusId ( mixed $varValue ) : boolean Valid Google+ ID or vanity name
isInsecurePath ( string $strPath ) : boolean Insecure path potentially containing directory traversal
isLanguage ( mixed $varValue ) : boolean Valid language code
isLocale ( mixed $varValue ) : boolean Valid locale
isNatural ( mixed $varValue ) : boolean Natural numbers (nonnegative integers)
isNumeric ( mixed $varValue ) : boolean Numeric characters (including full stop [.] and minus [-])
isPercent ( mixed $varValue ) : boolean Valid percentage
isPhone ( mixed $varValue ) : boolean Valid phone number
isStringUuid ( mixed $varValue ) : boolean Valid string UUID (version 1)
isTime ( mixed $varValue ) : boolean Valid time formats
isUrl ( mixed $varValue ) : boolean Valid URL with special characters allowed (see #6402)
isUuid ( mixed $varValue ) : boolean Valid UUID (version 1)
isValidFileName ( mixed $strName ) : boolean Valid file name

Method Details

isAlias() public static method

Valid alias name
public static isAlias ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid alias name

isAlphabetic() public static method

Alphabetic characters (including full stop [.] minus [-] and space [ ])
public static isAlphabetic ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is alphabetic

isAlphanumeric() public static method

Alphanumeric characters (including full stop [.] minus [-], underscore [_] and space [ ])
public static isAlphanumeric ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is alphanumeric

isBinaryUuid() public static method

Valid binary UUID (version 1)
public static isBinaryUuid ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a binary UUID

isDate() public static method

Valid date formats
public static isDate ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid date format

isDatim() public static method

Valid date and time formats
public static isDatim ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid date and time format

isEmail() public static method

Valid e-mail address
public static isEmail ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid e-mail address

isExtendedAlphanumeric() public static method

Characters that are usually encoded by the Input class: #<>()\=
public static isExtendedAlphanumeric ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value does not match the characters

isFieldName() public static method

Valid form field name
public static isFieldName ( mixed $strName ) : boolean
$strName mixed The form field name
return boolean True if the form field name is valid

isFolderAlias() public static method

Valid folder alias name
public static isFolderAlias ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid folder alias name

isGooglePlusId() public static method

Valid Google+ ID or vanity name
public static isGooglePlusId ( mixed $varValue ) : boolean
$varValue mixed The numeric ID or vanity name
return boolean True if the value is a Google+ ID

isInsecurePath() public static method

Insecure path potentially containing directory traversal
public static isInsecurePath ( string $strPath ) : boolean
$strPath string The file path
return boolean True if the file path is insecure

isLanguage() public static method

Valid language code
public static isLanguage ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid language code

isLocale() public static method

Valid locale
public static isLocale ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid locale

isNatural() public static method

Natural numbers (nonnegative integers)
public static isNatural ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a natural number

isNumeric() public static method

Numeric characters (including full stop [.] and minus [-])
public static isNumeric ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is numeric

isPercent() public static method

Valid percentage
public static isPercent ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid percentage

isPhone() public static method

Valid phone number
public static isPhone ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid phone number

isStringUuid() public static method

Valid string UUID (version 1)
public static isStringUuid ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a string UUID

isTime() public static method

Valid time formats
public static isTime ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid time format

isUrl() public static method

Valid URL with special characters allowed (see #6402)
public static isUrl ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a valid URL

isUuid() public static method

Valid UUID (version 1)
public static isUuid ( mixed $varValue ) : boolean
$varValue mixed The value to be validated
return boolean True if the value is a UUID

isValidFileName() public static method

Valid file name
public static isValidFileName ( mixed $strName ) : boolean
$strName mixed The file name
return boolean True if the file name is valid