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 [email protected] 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 25061 2012-11-02 21:24:09Z rob $  

\Zend_Validate_Hostname

jump to top

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

  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

Properties

 $_idnLength= 'array( 'BIZ' => array(5 => 17'
Default valuearray( 'BIZ' => array(5 => 17Details
Type
array  $_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
array  $_messageVariables= 'array( 'tld' => '_tld' )'

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

Details
Type
string
array  $_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/  
array  $_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

__construct(  $options = array() ) : void

Sets validator options

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

Parameters
NameTypeDescription
$encodedstring

Punycode encoded string to decode

Returns
TypeDescription
string
getAllow( ) : integer

Returns the allow option

Returns
TypeDescription
integer
getIpValidator( ) : \Zend_Validate_Ip

Returns the set ip validator

Returns
TypeDescription
\Zend_Validate_Ip
getOptions( ) : array

Returns all set options

Returns
TypeDescription
array
getValidateIdn( ) : boolean

Returns the set idn option

Returns
TypeDescription
boolean
getValidateTld( ) : boolean

Returns the set tld option

Returns
TypeDescription
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

Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Validate_Exceptionif a fatal error occurs for validation process
setAllow( integer $allow ) : \Zend_Validate_Hostname

Sets the allow option

Parameters
NameTypeDescription
$allowinteger
Returns
TypeDescription
\Zend_Validate_HostnameProvides a fluent interface
setIpValidator( \Zend_Validate_Ip $ipValidator = null ) : \void;

Parameters
NameTypeDescription
$ipValidator\Zend_Validate_Ip

OPTIONAL

Returns
TypeDescription
\void;
setOptions( array $options ) : \Zend_Validate_Hostname

Sets the options for this validator

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_Validate_Hostname
setValidateIdn( boolean $allowed ) : void

Set whether IDN domains are validated

This only applies when DNS hostnames are validated

Parameters
NameTypeDescription
$allowedboolean

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

Parameters
NameTypeDescription
$allowedboolean

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

Documentation was generated by DocBlox 0.15.1.