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 license@zend.com 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.

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
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
__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 |

getIpValidator(
)
:
\Zend_Validate_Ip
Returns the set ip validator
Type | Description |
---|---|
\Zend_Validate_Ip |

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; |

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 |