PHP Class Zend_Validate_Hostname

Inheritance: extends Zend_Validate_Abstract
Mostra file Open project: dbpatch/dbpatch Class Usage Examples

Protected Properties

Property Type Description
$_idnLength
$_messageTemplates array
$_messageVariables array
$_options
$_tld string
$_validIdns array Array for valid Idns
$_validTlds array Array of valid top-level-domains

Public Methods

Method Description
__construct ( $options = [] ) : void Sets validator options
getAllow ( ) : integer Returns the allow option
getIpValidator ( ) : Zend_Validate_Ip Returns the set ip validator
getOptions ( ) : array Returns all set options
getValidateIdn ( ) : boolean Returns the set idn option
getValidateTld ( ) : boolean Returns the set tld option
isValid ( string $value ) : boolean Defined by Zend_Validate_Interface
setAllow ( integer $allow ) : Zend_Validate_Hostname Sets the allow option
setIpValidator ( Zend_Validate_Ip $ipValidator = null ) : void;
setOptions ( array $options ) : Zend_Validate_Hostname Sets the options for this validator
setValidateIdn ( boolean $allowed ) Set whether IDN domains are validated
setValidateTld ( boolean $allowed ) Set whether the TLD element of a hostname is validated

Protected Methods

Method Description
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

Method Details

__construct() public method

Sets validator options
See also: http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs
public __construct ( $options = [] ) : void
return void

decodePunycode() protected method

Decodes a punycode encoded string to it's original utf8 string In case of a decoding failure the original string is returned
protected decodePunycode ( string $encoded ) : string
$encoded string Punycode encoded string to decode
return string

getAllow() public method

Returns the allow option
public getAllow ( ) : integer
return integer

getIpValidator() public method

Returns the set ip validator
public getIpValidator ( ) : Zend_Validate_Ip
return Zend_Validate_Ip

getOptions() public method

Returns all set options
public getOptions ( ) : array
return array

getValidateIdn() public method

Returns the set idn option
public getValidateIdn ( ) : boolean
return boolean

getValidateTld() public method

Returns the set tld option
public getValidateTld ( ) : boolean
return boolean

isValid() public method

Returns true if and only if the $value is a valid hostname with respect to the current allow option
public isValid ( string $value ) : boolean
$value string
return boolean

setAllow() public method

Sets the allow option
public setAllow ( integer $allow ) : Zend_Validate_Hostname
$allow integer
return Zend_Validate_Hostname Provides a fluent interface

setIpValidator() public method

public setIpValidator ( Zend_Validate_Ip $ipValidator = null ) : void;
$ipValidator Zend_Validate_Ip OPTIONAL
return void;

setOptions() public method

Sets the options for this validator
public setOptions ( array $options ) : Zend_Validate_Hostname
$options array
return Zend_Validate_Hostname

setValidateIdn() public method

This only applies when DNS hostnames are validated
public setValidateIdn ( boolean $allowed )
$allowed boolean Set allowed to true to validate IDNs, and false to not validate them

setValidateTld() public method

This only applies when DNS hostnames are validated
public setValidateTld ( boolean $allowed )
$allowed boolean Set allowed to true to validate TLDs, and false to not validate them

Property Details

$_idnLength protected_oe property

protected $_idnLength

$_messageTemplates protected_oe property

protected array $_messageTemplates
return array

$_messageVariables protected_oe property

protected array $_messageVariables
return array

$_options protected_oe property

protected $_options

$_tld protected_oe property

protected string $_tld
return string

$_validIdns protected_oe property

Array for valid Idns
See also: http://www.iana.org/domains/idn-tables/ Official list of supported IDN Chars (.AC) Ascension Island http://www.nic.ac/pdf/AC-IDN-Policy.pdf (.AR) Argentinia http://www.nic.ar/faqidn.html (.AS) American Samoa http://www.nic.as/idn/chars.cfm (.AT) Austria http://www.nic.at/en/service/technical_information/idn/charset_converter/ (.BIZ) International http://www.iana.org/domains/idn-tables/ (.BR) Brazil http://registro.br/faq/faq6.html (.BV) Bouvett Island http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html (.CAT) Catalan http://www.iana.org/domains/idn-tables/tables/cat_ca_1.0.html (.CH) Switzerland https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1 (.CL) Chile http://www.iana.org/domains/idn-tables/tables/cl_latn_1.0.html (.COM) International http://www.verisign.com/information-services/naming-services/internationalized-domain-names/index.html (.DE) Germany http://www.denic.de/en/domains/idns/liste.html (.DK) Danmark http://www.dk-hostmaster.dk/index.php?id=151 (.ES) Spain https://www.nic.es/media/2008-05/1210147705287.pdf (.FI) Finland http://www.ficora.fi/en/index/palvelut/fiverkkotunnukset/aakkostenkaytto.html (.GR) Greece https://grweb.ics.forth.gr/CharacterTable1_en.jsp (.HU) Hungary http://www.domain.hu/domain/English/szabalyzat/szabalyzat.html (.INFO) International http://www.nic.info/info/idn (.IO) British Indian Ocean Territory http://www.nic.io/IO-IDN-Policy.pdf (.IR) Iran http://www.nic.ir/Allowable_Characters_dot-iran (.IS) Iceland http://www.isnic.is/domain/rules.php (.KR) Korea http://www.iana.org/domains/idn-tables/tables/kr_ko-kr_1.0.html (.LI) Liechtenstein https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1 (.LT) Lithuania http://www.domreg.lt/static/doc/public/idn_symbols-en.pdf (.MD) Moldova http://www.register.md/ (.MUSEUM) International http://www.iana.org/domains/idn-tables/tables/museum_latn_1.0.html (.NET) International http://www.verisign.com/information-services/naming-services/internationalized-domain-names/index.html (.NO) Norway http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html (.NU) Niue http://www.worldnames.net/ (.ORG) International http://www.pir.org/index.php?db=content/FAQs&tbl=FAQs_Registrant&id=2 (.PE) Peru https://www.nic.pe/nuevas_politicas_faq_2.php (.PL) Poland http://www.dns.pl/IDN/allowed_character_sets.pdf (.PR) Puerto Rico http://www.nic.pr/idn_rules.asp (.PT) Portugal https://online.dns.pt/dns_2008/do?com=DS;8216320233;111;+PAGE(4000058)+K-CAT-CODIGO(C.125)+RCNT(100); (.RU) Russia http://www.iana.org/domains/idn-tables/tables/ru_ru-ru_1.0.html (.SA) Saudi Arabia http://www.iana.org/domains/idn-tables/tables/sa_ar_1.0.html (.SE) Sweden http://www.iis.se/english/IDN_campaignsite.shtml?lang=en (.SH) Saint Helena http://www.nic.sh/SH-IDN-Policy.pdf (.SJ) Svalbard and Jan Mayen http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html (.TH) Thailand http://www.iana.org/domains/idn-tables/tables/th_th-th_1.0.html (.TM) Turkmenistan http://www.nic.tm/TM-IDN-Policy.pdf (.TR) Turkey https://www.nic.tr/index.php (.VE) Venice http://www.iana.org/domains/idn-tables/tables/ve_es_1.0.html (.VN) Vietnam http://www.vnnic.vn/english/5-6-300-2-2-04-20071115.htm#1.%20Introduction
protected array $_validIdns
return array

$_validTlds protected_oe property

Array of valid top-level-domains
See also: ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain
See also: http://www.iana.org/domains/root/db/ Official list of supported TLDs
protected array $_validTlds
return array