API Documentation

Zend/Validate/Hostname.php

Show: inherited
Table of Contents

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.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id: Hostname.php 24632 2012-02-24 17:46:13Z adamlundrigan $  

\Zend_Validate_Hostname

Package: Zend\Validate

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.

Parent(s)
\Zend_Validate_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode'
Constant  INVALID = 'hostnameInvalid'
Constant  INVALID_DASH = 'hostnameDashCharacter'
Constant  INVALID_HOSTNAME = 'hostnameInvalidHostname'
Constant  INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'
Constant  INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'
Constant  INVALID_URI = 'hostnameInvalidUri'
Constant  IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'
Constant  LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'
Constant  UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'
Constant  UNKNOWN_TLD = 'hostnameUnknownTld'
Constant  ALLOW_DNS = 1

Allows Internet domain names (e.g., example.com)

Constant  ALLOW_IP = 2

Allows IP addresses

Constant  ALLOW_LOCAL = 4

Allows local network names (e.g., localhost, www.localdomain)

Constant  ALLOW_URI = 8

Allows all types of hostnames

Constant  ALLOW_ALL = 15

Allows all types of hostnames

Properties

Propertyprotected  $_idnLength= 'array( 'BIZ' => array(5 => 17'
Default valuearray( 'BIZ' => array(5 => 17Details
Type
Propertyprotectedarray  $_messageTemplates= 'array( self::CANNOT_DECODE_PUNYCODE => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"'

Default valuearray( self::CANNOT_DECODE_PUNYCODE => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"Details
Type
array
Propertyprotectedarray  $_messageVariables= 'array( 'tld' => '_tld' )'

Default valuearray( 'tld' => '_tld' )Details
Type
array
Propertyprotected  $_options= 'array( 'allow' => self::ALLOW_DNS'
Default valuearray( 'allow' => self::ALLOW_DNSDetails
Type
Propertyprotectedstring  $_tld= ''

Details
Type
string
Propertyprotectedarray  $_validIdns= 'array( 'AC' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu')'

Array for valid Idns

Default valuearray( 'AC' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu')Details
Type
array
See
\http://www.iana.org/domains/idn-tables/  
Propertyprotectedarray  $_validTlds= 'array( 'ac''

Array of valid top-level-domains

Default valuearray( 'ac'Details
Type
array
See
\ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt  
See
\http://www.iana.org/domains/root/db/  

Methods

methodpublic__construct(  $options = array() ) : void

Sets validator options

Parameters
Name Type Description
$options
Details
See
\http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm  
methodprotecteddecodePunycode( 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

Parameters
Name Type Description
$encoded string

Punycode encoded string to decode

Returns
Type Description
string
methodpublicgetAllow( ) : integer

Returns the allow option

Returns
Type Description
integer
methodpublicgetIpValidator( ) : \Zend_Validate_Ip

Returns the set ip validator

Returns
Type Description
\Zend_Validate_Ip
methodpublicgetOptions( ) : array

Returns all set options

Returns
Type Description
array
methodpublicgetValidateIdn( ) : boolean

Returns the set idn option

Returns
Type Description
boolean
methodpublicgetValidateTld( ) : boolean

Returns the set tld option

Returns
Type Description
boolean
methodpublicisValid( 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

Parameters
Name Type Description
$value string
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Validate_Exception if a fatal error occurs for validation process
methodpublicsetAllow( integer $allow ) : \Zend_Validate_Hostname

Sets the allow option

Parameters
Name Type Description
$allow integer
Returns
Type Description
\Zend_Validate_Hostname Provides a fluent interface
methodpublicsetIpValidator( \Zend_Validate_Ip $ipValidator = null ) : \void;

Parameters
Name Type Description
$ipValidator \Zend_Validate_Ip

OPTIONAL

Returns
Type Description
\void;
methodpublicsetOptions( array $options ) : \Zend_Validate_Hostname

Sets the options for this validator

Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Validate_Hostname
methodpublicsetValidateIdn( boolean $allowed ) : void

Set whether IDN domains are validated

This only applies when DNS hostnames are validated

Parameters
Name Type Description
$allowed boolean

Set allowed to true to validate IDNs, and false to not validate them

methodpublicsetValidateTld( boolean $allowed ) : void

Set whether the TLD element of a hostname is validated

This only applies when DNS hostnames are validated

Parameters
Name Type Description
$allowed boolean

Set allowed to true to validate TLDs, and false to not validate them

Documentation was generated by DocBlox 0.15.1.