Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
Please note there are two standalone test scripts for testing IDN characters due to problems with file encoding.
The first is tests/Zend/Validate/HostnameTestStandalone.php which is designed to be run on the command line.
The second is tests/Zend/Validate/HostnameTestForm.php which is designed to be run via HTML to allow users to test entering UTF-8 characters in a form.
CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode'
INVALID = 'hostnameInvalid'
INVALID_DASH = 'hostnameDashCharacter'
INVALID_HOSTNAME = 'hostnameInvalidHostname'
INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'
INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'
INVALID_URI = 'hostnameInvalidUri'
IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'
LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'
UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'
UNKNOWN_TLD = 'hostnameUnknownTld'
ALLOW_DNS = 1
Allows Internet domain names (e.g., example.com)
ALLOW_IP = 2
Allows IP addresses
ALLOW_LOCAL = 4
Allows local network names (e.g., localhost, www.localdomain)
ALLOW_URI = 8
Allows all types of hostnames
ALLOW_ALL = 15
Allows all types of hostnames
$_idnLength= 'array( 'BIZ' => array(5 => 17'
array( 'BIZ' => array(5 => 17
Details array $_messageTemplates= 'array( self::CANNOT_DECODE_PUNYCODE => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"'
array( self::CANNOT_DECODE_PUNYCODE => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"
Details array $_messageVariables= 'array( 'tld' => '_tld' )'
array( 'tld' => '_tld' )
Details $_options= 'array( 'allow' => self::ALLOW_DNS'
array( 'allow' => self::ALLOW_DNS
Details string $_tld= ''
array $_validIdns= 'array( 'AC' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu')'
Array for valid Idns
array( 'AC' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu')
Details array $_validTlds= 'array( 'ac''
Array of valid top-level-domains
array( 'ac'
Details __construct( $options = array() ) : void
Sets validator options
Name | Type | Description |
---|---|---|
$options |
decodePunycode( string $encoded ) : string
Decodes a punycode encoded string to it's original utf8 string In case of a decoding failure the original string is returned
Name | Type | Description |
---|---|---|
$encoded | string | Punycode encoded string to decode |
Type | Description |
---|---|
string |
getAllow( ) : integer
Returns the allow option
Type | Description |
---|---|
integer |
getIpValidator( ) : \Zend_Validate_Ip
Returns the set ip validator
Type | Description |
---|---|
\Zend_Validate_Ip |
getOptions( ) : array
Returns all set options
Type | Description |
---|---|
array |
getValidateIdn( ) : boolean
Returns the set idn option
Type | Description |
---|---|
boolean |
getValidateTld( ) : boolean
Returns the set tld option
Type | Description |
---|---|
boolean |
isValid( string $value ) : boolean
Defined by Zend_Validate_Interface
Returns true if and only if the $value is a valid hostname with respect to the current allow option
Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Validate_Exception | if a fatal error occurs for validation process |
setAllow( integer $allow ) : \Zend_Validate_Hostname
Sets the allow option
Name | Type | Description |
---|---|---|
$allow | integer |
Type | Description |
---|---|
\Zend_Validate_Hostname | Provides a fluent interface |
setIpValidator( \Zend_Validate_Ip $ipValidator = null ) : \void;
Name | Type | Description |
---|---|---|
$ipValidator | \Zend_Validate_Ip | OPTIONAL |
Type | Description |
---|---|
\void; |
setOptions( array $options ) : \Zend_Validate_Hostname
Sets the options for this validator
Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
\Zend_Validate_Hostname |
setValidateIdn( boolean $allowed ) : void
Set whether IDN domains are validated
This only applies when DNS hostnames are validated
Name | Type | Description |
---|---|---|
$allowed | boolean | Set allowed to true to validate IDNs, and false to not validate them |
setValidateTld( boolean $allowed ) : void
Set whether the TLD element of a hostname is validated
This only applies when DNS hostnames are validated
Name | Type | Description |
---|---|---|
$allowed | boolean | Set allowed to true to validate TLDs, and false to not validate them |