Moodle  2.2.1
http://www.collinsharper.com
Zend_Validate_Hostname Class Reference
Inheritance diagram for Zend_Validate_Hostname:
Collaboration diagram for Zend_Validate_Hostname:

Public Member Functions

 __construct ($options=array())
 getOptions ()
 setOptions ($options)
 getIpValidator ()
 setIpValidator (Zend_Validate_Ip $ipValidator=null)
 getAllow ()
 setAllow ($allow)
 getValidateIdn ()
 setValidateIdn ($allowed)
 getValidateTld ()
 setValidateTld ($allowed)
 isValid ($value)

Data Fields

const INVALID = 'hostnameInvalid'
const IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'
const UNKNOWN_TLD = 'hostnameUnknownTld'
const INVALID_DASH = 'hostnameDashCharacter'
const INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'
const UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'
const INVALID_HOSTNAME = 'hostnameInvalidHostname'
const INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'
const LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'
const CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode'
const ALLOW_DNS = 1
const ALLOW_IP = 2
const ALLOW_LOCAL = 4
const ALLOW_ALL = 7

Protected Member Functions

 decodePunycode ($encoded)

Protected Attributes

 $_messageTemplates
 $_messageVariables
 $_validTlds
 $_tld
 $_validIdns
 $_idnLength
 $_options

Detailed Description

Definition at line 47 of file Hostname.php.


Constructor & Destructor Documentation

__construct ( options = array())

Sets validator options

Parameters:
integer$allowOPTIONAL Set what types of hostname to allow (default ALLOW_DNS)
boolean$validateIdnOPTIONAL Set whether IDN domains are validated (default true)
boolean$validateTldOPTIONAL Set whether the TLD element of a hostname is validated (default true)
Zend_Validate_Ip$ipValidatorOPTIONAL
Returns:
void
See also:
http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs

Definition at line 325 of file Hostname.php.

Here is the call graph for this function:


Member Function Documentation

decodePunycode ( encoded) [protected]

Decodes a punycode encoded string to it's original utf8 string In case of a decoding failure the original string is returned

Parameters:
string$encodedPunycode encoded string to decode
Returns:
string

Definition at line 651 of file Hostname.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getAllow ( )

Returns the allow option

Returns:
integer

Definition at line 417 of file Hostname.php.

Returns the set ip validator

Returns:
Zend_Validate_Ip

Definition at line 393 of file Hostname.php.

Returns all set options

Returns:
array

Definition at line 356 of file Hostname.php.

Returns the set idn option

Returns:
boolean

Definition at line 439 of file Hostname.php.

Returns the set tld option

Returns:
boolean

Definition at line 462 of file Hostname.php.

isValid ( value)

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:
string$value
Exceptions:
Zend_Validate_Exceptionif a fatal error occurs for validation process
Returns:
boolean

Match against IDN hostnames Note: Keep label regex short to avoid issues with long patterns when matching IDN hostnames

See also:
Zend_Validate_Hostname_Interface

Implements Zend_Validate_Interface.

Definition at line 489 of file Hostname.php.

Here is the call graph for this function:

setAllow ( allow)

Sets the allow option

Parameters:
integer$allow
Returns:
Zend_Validate_Hostname Provides a fluent interface

Definition at line 428 of file Hostname.php.

Here is the caller graph for this function:

setIpValidator ( Zend_Validate_Ip ipValidator = null)
Parameters:
Zend_Validate_Ip$ipValidatorOPTIONAL
Returns:
void;

Definition at line 402 of file Hostname.php.

Here is the caller graph for this function:

setOptions ( options)

Sets the options for this validator

Parameters:
array$options
Returns:
Zend_Validate_Hostname

Definition at line 367 of file Hostname.php.

Here is the call graph for this function:

Here is the caller graph for this function:

setValidateIdn ( allowed)

Set whether IDN domains are validated

This only applies when DNS hostnames are validated

Parameters:
boolean$allowedSet allowed to true to validate IDNs, and false to not validate them

Definition at line 451 of file Hostname.php.

Here is the caller graph for this function:

setValidateTld ( allowed)

Set whether the TLD element of a hostname is validated

This only applies when DNS hostnames are validated

Parameters:
boolean$allowedSet allowed to true to validate TLDs, and false to not validate them

Definition at line 474 of file Hostname.php.

Here is the caller graph for this function:


Field Documentation

$_idnLength [protected]
Initial value:
 array(
        'BIZ' => array(5 => 17, 11 => 15, 12 => 20),
        'CN'  => array(1 => 20),
        'COM' => array(3 => 17, 5 => 20),
        'HK'  => array(1 => 15),
        'INFO'=> array(4 => 17),
        'KR'  => array(1 => 17),
        'NET' => array(3 => 17, 5 => 20),
        'ORG' => array(6 => 17),
        'TW'  => array(1 => 20),
        'ایران' => array(1 => 30),
        '中国' => array(1 => 20),
        '公司' => array(1 => 20),
        '网络' => array(1 => 20),
    )

Definition at line 292 of file Hostname.php.

$_messageTemplates [protected]
Initial value:
 array(
        self::INVALID                 => "Invalid type given, value should be a string",
        self::IP_ADDRESS_NOT_ALLOWED  => "'%value%' appears to be an IP address, but IP addresses are not allowed",
        self::UNKNOWN_TLD             => "'%value%' appears to be a DNS hostname but cannot match TLD against known list",
        self::INVALID_DASH            => "'%value%' appears to be a DNS hostname but contains a dash in an invalid position",
        self::INVALID_HOSTNAME_SCHEMA => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'",
        self::UNDECIPHERABLE_TLD      => "'%value%' appears to be a DNS hostname but cannot extract TLD part",
        self::INVALID_HOSTNAME        => "'%value%' does not match the expected structure for a DNS hostname",
        self::INVALID_LOCAL_NAME      => "'%value%' does not appear to be a valid local network name",
        self::LOCAL_NAME_NOT_ALLOWED  => "'%value%' appears to be a local network name but local network names are not allowed",
        self::CANNOT_DECODE_PUNYCODE  => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded",
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 63 of file Hostname.php.

$_messageVariables [protected]
Initial value:
 array(
        'tld' => '_tld'
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 79 of file Hostname.php.

$_options [protected]
Initial value:
 array(
        'allow' => self::ALLOW_DNS,
        'idn'   => true,
        'tld'   => true,
        'ip'    => null
    )

Definition at line 308 of file Hostname.php.

$_tld [protected]

Definition at line 135 of file Hostname.php.

$_validIdns [protected]

Definition at line 187 of file Hostname.php.

$_validTlds [protected]
Initial value:
 array(
        'ac', 'ad', 'ae', 'aero', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'arpa',
        'as', 'asia', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi',
        'biz', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cat', 'cc',
        'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'com', 'coop', 'cr', 'cu',
        'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'edu', 'ee', 'eg', 'er',
        'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg',
        'gh', 'gi', 'gl', 'gm', 'gn', 'gov', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk',
        'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'info', 'int', 'io', 'iq',
        'ir', 'is', 'it', 'je', 'jm', 'jo', 'jobs', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp',
        'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly',
        'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mil', 'mk', 'ml', 'mm', 'mn', 'mo', 'mobi', 'mp',
        'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'name', 'nc',
        'ne', 'net', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'org', 'pa', 'pe',
        'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'pro', 'ps', 'pt', 'pw', 'py', 'qa', 're',
        'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl',
        'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tel', 'tf', 'tg', 'th',
        'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'travel', 'tt', 'tv', 'tw', 'tz', 'ua',
        'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws',
        'ye', 'yt', 'yu', 'za', 'zm', 'zw'
    )

Definition at line 110 of file Hostname.php.

const ALLOW_ALL = 7

Allows all types of hostnames

Definition at line 101 of file Hostname.php.

const ALLOW_DNS = 1

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

Definition at line 86 of file Hostname.php.

const ALLOW_IP = 2

Allows IP addresses

Definition at line 91 of file Hostname.php.

const ALLOW_LOCAL = 4

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

Definition at line 96 of file Hostname.php.

const CANNOT_DECODE_PUNYCODE = 'hostnameCannotDecodePunycode'

Definition at line 58 of file Hostname.php.

const INVALID = 'hostnameInvalid'

Definition at line 49 of file Hostname.php.

const INVALID_DASH = 'hostnameDashCharacter'

Definition at line 52 of file Hostname.php.

const INVALID_HOSTNAME = 'hostnameInvalidHostname'

Definition at line 55 of file Hostname.php.

const INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'

Definition at line 53 of file Hostname.php.

const INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'

Definition at line 56 of file Hostname.php.

const IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'

Definition at line 50 of file Hostname.php.

const LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'

Definition at line 57 of file Hostname.php.

const UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'

Definition at line 54 of file Hostname.php.

const UNKNOWN_TLD = 'hostnameUnknownTld'

Definition at line 51 of file Hostname.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations