Zend Framework
1.12
|
Public Member Functions | |
__construct ($options=array()) | |
Sets validator options. | |
getOptions () | |
Returns all set options. | |
setOptions ($options) | |
Sets the options for this validator. | |
getIpValidator () | |
Returns the set ip validator. | |
setIpValidator (Zend_Validate_Ip $ipValidator=null) | |
getAllow () | |
Returns the allow option. | |
setAllow ($allow) | |
Sets the allow option. | |
getValidateIdn () | |
Returns the set idn option. | |
setValidateIdn ($allowed) | |
Set whether IDN domains are validated. | |
getValidateTld () | |
Returns the set tld option. | |
setValidateTld ($allowed) | |
Set whether the TLD element of a hostname is validated. | |
isValid ($value) | |
Defined by Zend_Validate_Interface. | |
![]() | |
getMessages () | |
Returns array of validation failure messages. | |
getMessageVariables () | |
Returns an array of the names of variables that are used in constructing validation failure messages. | |
getMessageTemplates () | |
Returns the message templates from the validator. | |
setMessage ($messageString, $messageKey=null) | |
Sets the validation failure message template for a particular key. | |
setMessages (array $messages) | |
Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings. | |
__get ($property) | |
Magic function returns the value of the requested property, if and only if it is the value or a message variable. | |
getErrors () | |
Returns array of validation failure message codes. | |
setObscureValue ($flag) | |
Set flag indicating whether or not value should be obfuscated in messages. | |
getObscureValue () | |
Retrieve flag indicating whether or not value should be obfuscated in messages. | |
setTranslator ($translator=null) | |
Set translation object. | |
getTranslator () | |
Return translation object. | |
hasTranslator () | |
Does this validator have its own specific translator? | |
setDisableTranslator ($flag) | |
Indicate whether or not translation should be disabled. | |
translatorIsDisabled () | |
Is translation disabled? | |
Public Attributes | |
const | CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode' |
const | INVALID = 'hostnameInvalid' |
const | INVALID_DASH = 'hostnameDashCharacter' |
const | INVALID_HOSTNAME = 'hostnameInvalidHostname' |
const | INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema' |
const | INVALID_LOCAL_NAME = 'hostnameInvalidLocalName' |
const | INVALID_URI = 'hostnameInvalidUri' |
const | IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed' |
const | LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed' |
const | UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld' |
const | UNKNOWN_TLD = 'hostnameUnknownTld' |
const | ALLOW_DNS = 1 |
Allows Internet domain names (e.g., example.com) | |
const | ALLOW_IP = 2 |
Allows IP addresses. | |
const | ALLOW_LOCAL = 4 |
Allows local network names (e.g., localhost, www.localdomain) | |
const | ALLOW_URI = 8 |
Allows all types of hostnames. | |
const | ALLOW_ALL = 15 |
Allows all types of hostnames. | |
Protected Member Functions | |
decodePunycode ($encoded) | |
Decodes a punycode encoded string to it's original utf8 string In case of a decoding failure the original string is returned. | |
![]() | |
_createMessage ($messageKey, $value) | |
Constructs and returns a validation failure message with the given message key and value. | |
_error ($messageKey, $value=null) | |
_setValue ($value) | |
Sets the value to be validated and clears the messages and errors arrays. | |
Protected Attributes | |
$_messageTemplates | |
$_messageVariables | |
$_validTlds | |
$_tld | |
$_validIdns | |
$_idnLength | |
$_options | |
![]() | |
$_value | |
$_messageVariables = array() | |
$_messageTemplates = array() | |
$_messages = array() | |
$_obscureValue = false | |
$_errors = array() | |
$_translator | |
$_translatorDisabled = false | |
Additional Inherited Members | |
![]() | |
static | setDefaultTranslator ($translator=null) |
Set default translation object for all validate objects. | |
static | getDefaultTranslator () |
Get default translation object for all validate objects. | |
static | hasDefaultTranslator () |
Is there a default translation object set? | |
static | getMessageLength () |
Returns the maximum allowed message length. | |
static | setMessageLength ($length=-1) |
Sets the maximum allowed message length. | |
![]() | |
static | $_defaultTranslator |
static | $_messageLength = -1 |
__construct | ( | $options = array() | ) |
Sets validator options.
integer | $allow | OPTIONAL Set what types of hostname to allow (default ALLOW_DNS) |
boolean | $validateIdn | OPTIONAL Set whether IDN domains are validated (default true) |
boolean | $validateTld | OPTIONAL Set whether the TLD element of a hostname is validated (default true) |
Zend_Validate_Ip | $ipValidator | OPTIONAL |
|
protected |
Decodes a punycode encoded string to it's original utf8 string In case of a decoding failure the original string is returned.
string | $encoded | Punycode encoded string to decode |
getAllow | ( | ) |
Returns the allow option.
getIpValidator | ( | ) |
Returns the set ip validator.
getOptions | ( | ) |
Returns all set options.
getValidateIdn | ( | ) |
Returns the set idn option.
getValidateTld | ( | ) |
Returns the set tld option.
isValid | ( | $value | ) |
Defined by Zend_Validate_Interface.
Returns true if and only if the $value is a valid hostname with respect to the current allow option
string | $value |
Zend_Validate_Exception | if a fatal error occurs for validation process |
Match against IDN hostnames Note: Keep label regex short to avoid issues with long patterns when matching IDN hostnames
Implements Zend_Validate_Interface.
setAllow | ( | $allow | ) |
Sets the allow option.
integer | $allow |
setIpValidator | ( | Zend_Validate_Ip | $ipValidator = null | ) |
Zend_Validate_Ip | $ipValidator | OPTIONAL |
setOptions | ( | $options | ) |
setValidateIdn | ( | $allowed | ) |
Set whether IDN domains are validated.
This only applies when DNS hostnames are validated
boolean | $allowed | Set allowed to true to validate IDNs, and false to not validate them |
setValidateTld | ( | $allowed | ) |
Set whether the TLD element of a hostname is validated.
This only applies when DNS hostnames are validated
boolean | $allowed | Set allowed to true to validate TLDs, and false to not validate them |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
const ALLOW_ALL = 15 |
Allows all types of hostnames.
const ALLOW_DNS = 1 |
Allows Internet domain names (e.g., example.com)
const ALLOW_IP = 2 |
Allows IP addresses.
const ALLOW_LOCAL = 4 |
Allows local network names (e.g., localhost, www.localdomain)
const ALLOW_URI = 8 |
Allows all types of hostnames.
const CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode' |
const INVALID = 'hostnameInvalid' |
const INVALID_DASH = 'hostnameDashCharacter' |
const INVALID_HOSTNAME = 'hostnameInvalidHostname' |
const INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema' |
const INVALID_LOCAL_NAME = 'hostnameInvalidLocalName' |
const INVALID_URI = 'hostnameInvalidUri' |
const IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed' |
const LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed' |
const UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld' |
const UNKNOWN_TLD = 'hostnameUnknownTld' |