Validate/Hostname.php
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
- http://framework.zend.com/license/new-bsd New BSD License
- package
- Zend_Validate
- version
- $Id: Hostname.php 23972 2011-05-03 16:26:36Z ralph $
- Classes
- Zend_Validate_Hostname
Description
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.
- Extends from
- Zend_Validate_Abstract
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
- http://framework.zend.com/license/new-bsd New BSD License
- package
- Zend_Validate
- Constants
- CANNOT_DECODE_PUNYCODE
- INVALID
- INVALID_DASH
- INVALID_HOSTNAME
- INVALID_HOSTNAME_SCHEMA
- INVALID_LOCAL_NAME
- INVALID_URI
- IP_ADDRESS_NOT_ALLOWED
- LOCAL_NAME_NOT_ALLOWED
- UNDECIPHERABLE_TLD
- UNKNOWN_TLD
- ALLOW_DNS
- ALLOW_IP
- ALLOW_LOCAL
- ALLOW_ALL
- ALLOW_URI
- Properties
- $_messageTemplates
- $_messageVariables
- $_validTlds
- $_tld
- $_validIdns
- $_idnLength
- $_options
- Methods
- __construct
- getOptions
- setOptions
- getIpValidator
- setIpValidator
- getAllow
- setAllow
- getValidateIdn
- setValidateIdn
- getValidateTld
- setValidateTld
- isValid
- decodePunycode
Description
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.
Constants
CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode'
Details
- value
- hostnameCannotDecodePunycode
INVALID = 'hostnameInvalid'
Details
- value
- hostnameInvalid
INVALID_DASH = 'hostnameDashCharacter'
Details
- value
- hostnameDashCharacter
INVALID_HOSTNAME = 'hostnameInvalidHostname'
Details
- value
- hostnameInvalidHostname
INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'
Details
- value
- hostnameInvalidHostnameSchema
INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'
Details
- value
- hostnameInvalidLocalName
INVALID_URI = 'hostnameInvalidUri'
Details
- value
- hostnameInvalidUri
IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'
Details
- value
- hostnameIpAddressNotAllowed
LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'
Details
- value
- hostnameLocalNameNotAllowed
UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'
Details
- value
- hostnameUndecipherableTld
UNKNOWN_TLD = 'hostnameUnknownTld'
Details
- value
- hostnameUnknownTld
ALLOW_DNS = '1'
Allows Internet domain names (e.g., example.com)
Details
- value
- 1
ALLOW_IP = '2'
Allows IP addresses
Details
- value
- 2
ALLOW_LOCAL = '4'
Allows local network names (e.g., localhost, www.localdomain)
Details
- value
- 4
ALLOW_ALL = '7'
Allows all types of hostnames
Details
- value
- 7
ALLOW_URI = '8'
Allows all types of hostnames
Details
- value
- 8
Properties
$_idnLength = 'array'
Details
- visibility
- protected
- default
- array
- final
- false
- static
- false
array $_messageTemplates = 'array'
Details
- $_messageTemplates
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
array $_messageVariables = 'array'
Details
- $_messageVariables
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
$_options = 'array'
Details
- visibility
- protected
- default
- array
- final
- false
- static
- false
string $_tld = ''
Details
- $_tld
- string
- visibility
- protected
- default
- final
- false
- static
- false
array $_validIdns = 'array'
Array for valid Idns
Details
- $_validIdns
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
- see
- 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
array $_validTlds = 'array'
Array of valid top-level-domains
Details
- $_validTlds
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
- see
- ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain
- see
- http://www.iana.org/domains/root/db/ Official list of supported TLDs
Methods
__construct(
$options
=
array
)
:
void
Sets validator options
Details
- visibility
- public
- final
- false
- static
- false
- see
- http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs
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
Arguments
- $encoded
- string
Punycode encoded string to decode
Details
- visibility
- protected
- final
- false
- static
- false
getAllow(
)
:
integer
Returns the allow option
Details
- visibility
- public
- final
- false
- static
- false
getIpValidator(
)
:
Zend_Validate_Ip
Returns the set ip validator
Details
- visibility
- public
- final
- false
- static
- false
getOptions(
)
:
array
Returns all set options
Details
- visibility
- public
- final
- false
- static
- false
getValidateIdn(
)
:
boolean
Returns the set idn option
Details
- visibility
- public
- final
- false
- static
- false
getValidateTld(
)
:
boolean
Returns the set tld option
Details
- visibility
- public
- final
- false
- static
- false
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
Details
- visibility
- public
- final
- false
- static
- false
- throws
- if a fatal error occurs for validation process
setAllow(
integer $allow
)
:
Zend_Validate_Hostname
Sets the allow option
Details
- visibility
- public
- final
- false
- static
- false
setIpValidator(
Zend_Validate_Ip $ipValidator
=
null
)
:
void;
Arguments
- $ipValidator
- Zend_Validate_Ip
OPTIONAL
Details
- visibility
- public
- final
- false
- static
- false
setOptions(
array $options
)
:
Zend_Validate_Hostname
Sets the options for this validator
Details
- visibility
- public
- final
- false
- static
- false
setValidateIdn(
boolean $allowed
)
:
Set whether IDN domains are validated
This only applies when DNS hostnames are validated
Arguments
- $allowed
- boolean
Set allowed to true to validate IDNs, and false to not validate them
Details
- visibility
- public
- final
- false
- static
- false
setValidateTld(
boolean $allowed
)
:
Set whether the TLD element of a hostname is validated
This only applies when DNS hostnames are validated
Arguments
- $allowed
- boolean
Set allowed to true to validate TLDs, and false to not validate them
Details
- visibility
- public
- final
- false
- static
- false