API Documentation

Validate/Hostname.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 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 22697 2010-07-26 21:14:47Z alexander $
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.

Zend_Validate_Hostname

Extends from
Zend_Validate_Abstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Validate
Constants
INVALID
IP_ADDRESS_NOT_ALLOWED
UNKNOWN_TLD
INVALID_DASH
INVALID_HOSTNAME_SCHEMA
UNDECIPHERABLE_TLD
INVALID_HOSTNAME
INVALID_LOCAL_NAME
LOCAL_NAME_NOT_ALLOWED
CANNOT_DECODE_PUNYCODE
ALLOW_DNS
ALLOW_IP
ALLOW_LOCAL
ALLOW_ALL
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

INVALID

 INVALID = 'hostnameInvalid'

Details

value
hostnameInvalid

IP_ADDRESS_NOT_ALLOWED

 IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'

Details

value
hostnameIpAddressNotAllowed

UNKNOWN_TLD

 UNKNOWN_TLD = 'hostnameUnknownTld'

Details

value
hostnameUnknownTld

INVALID_DASH

 INVALID_DASH = 'hostnameDashCharacter'

Details

value
hostnameDashCharacter

INVALID_HOSTNAME_SCHEMA

 INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'

Details

value
hostnameInvalidHostnameSchema

UNDECIPHERABLE_TLD

 UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'

Details

value
hostnameUndecipherableTld

INVALID_HOSTNAME

 INVALID_HOSTNAME = 'hostnameInvalidHostname'

Details

value
hostnameInvalidHostname

INVALID_LOCAL_NAME

 INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'

Details

value
hostnameInvalidLocalName

LOCAL_NAME_NOT_ALLOWED

 LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'

Details

value
hostnameLocalNameNotAllowed

CANNOT_DECODE_PUNYCODE

 CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode'

Details

value
hostnameCannotDecodePunycode

ALLOW_DNS

 ALLOW_DNS = '1'

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

Details

value
1

ALLOW_IP

 ALLOW_IP = '2'

Allows IP addresses

Details

value
2

ALLOW_LOCAL

 ALLOW_LOCAL = '4'

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

Details

value
4

ALLOW_ALL

 ALLOW_ALL = '7'

Allows all types of hostnames

Details

value
7

Properties

$_idnLength

 $_idnLength = 'array'

Details

visibility
protected
default
array
final
false
static
false

$_messageTemplates

array $_messageTemplates = 'array'

Details

$_messageTemplates
array
visibility
protected
default
array
final
false
static
false

$_messageVariables

array $_messageVariables = 'array'

Details

$_messageVariables
array
visibility
protected
default
array
final
false
static
false

$_options

 $_options = 'array'

Details

visibility
protected
default
array
final
false
static
false

$_tld

string $_tld = ''

Details

$_tld
string
visibility
protected
default
final
false
static
false

$_validIdns

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

$_validTlds

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

__construct(  $options = array ) : void

Sets validator options

Arguments
$options
Details
visibility
public
final
false
static
false
see
http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs

decodePunycode

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
Output
string
Details
visibility
protected
final
false
static
false

getAllow

getAllow( ) : integer

Returns the allow option

Output
integer
Details
visibility
public
final
false
static
false

getIpValidator

getIpValidator( ) : Zend_Validate_Ip

Returns the set ip validator

Details
visibility
public
final
false
static
false

getOptions

getOptions( ) : array

Returns all set options

Output
array
Details
visibility
public
final
false
static
false

getValidateIdn

getValidateIdn( ) : boolean

Returns the set idn option

Output
boolean
Details
visibility
public
final
false
static
false

getValidateTld

getValidateTld( ) : boolean

Returns the set tld option

Output
boolean
Details
visibility
public
final
false
static
false

isValid

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

Arguments
$value
string
Output
boolean
Details
visibility
public
final
false
static
false
throws
if a fatal error occurs for validation process

setAllow

setAllow( integer $allow ) : Zend_Validate_Hostname

Sets the allow option

Arguments
$allow
integer
Output
Zend_Validate_Hostname
Provides a fluent interface
Details
visibility
public
final
false
static
false

setIpValidator

setIpValidator( Zend_Validate_Ip $ipValidator = null ) : void;

Arguments
$ipValidator
Zend_Validate_Ip
OPTIONAL
Output
void;
Details
visibility
public
final
false
static
false

setOptions

setOptions( array $options ) : Zend_Validate_Hostname

Sets the options for this validator

Arguments
$options
array
Details
visibility
public
final
false
static
false

setValidateIdn

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

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
Documentation was generated by DocBlox.