category Zend
package Zend_Validate
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Validate_Abstract

 Methods

Instantiates hostname validator for local use

__construct(array|string|\Zend_Config $options = array()

The following option keys are supported: 'hostname' => A hostname validator, see Zend_Validate_Hostname 'allow' => Options for the hostname validator, see Zend_ValidateHostname::ALLOW* 'mx' => If MX check should be enabled, boolean 'deep' => If a deep MX check should be done, boolean

Parameters

$options

arraystring\Zend_Config

OPTIONAL

Magic function returns the value of the requested property, if and only if it is the value or a message variable.

__get(string $property) : mixed
Inherited

Parameters

$property

string

Exceptions

\Zend_Validate_Exception

Returns

mixed

Returns the set deepMxCheck option

getDeepMxCheck() : boolean

Returns

boolean

Get default translation object for all validate objects

getDefaultTranslator() : \Zend_Translate_Adapter | null
InheritedStatic

Returns

\Zend_Translate_Adapternull

Returns the set domainCheck option

getDomainCheck() : \unknown

Returns

\unknown

Returns array of validation failure message codes

getErrors() : array
Inherited
deprecated Since 1.5.0

Returns

array

Returns the set hostname validator

getHostnameValidator() : \Zend_Validate_Hostname

Returns

\Zend_Validate_Hostname

Returns the maximum allowed message length

getMessageLength() : integer
InheritedStatic

Returns

integer

Returns the message templates from the validator

getMessageTemplates() : array
Inherited

Returns

array

Returns an array of the names of variables that are used in constructing validation failure messages

getMessageVariables() : array
Inherited

Returns

array

Returns array of validation failure messages

getMessages() : array
Inherited

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

inherited_from \Zend_Validate_Interface::getMessages()

Returns

array

Retrieve flag indicating whether or not value should be obfuscated in messages

getObscureValue() : boolean
Inherited

Returns

boolean

Returns all set Options

getOptions() : array

Returns

array

Return translation object

getTranslator() : \Zend_Translate_Adapter | null
Inherited

Returns

\Zend_Translate_Adapternull

Returns the set validateMx option

getValidateMx() : boolean

Returns

boolean

Is there a default translation object set?

hasDefaultTranslator() : boolean
InheritedStatic

Returns

boolean

Does this validator have its own specific translator?

hasTranslator() : boolean
Inherited

Returns

boolean

Defined by Zend_Validate_Interface

isValid(string $value) : boolean

Returns true if and only if $value is a valid email address according to RFC2822

link RFC2822
link US-ASCII characters

Parameters

$value

string

Returns

boolean

Set whether we check MX record should be a deep validation

setDeepMxCheck(boolean $deep) : \Zend_Validate_EmailAddress

Parameters

$deep

boolean

Set deep to true to perform a deep validation process for MX records

Returns

\Zend_Validate_EmailAddressProvides a fluent inteface

Set default translation object for all validate objects

setDefaultTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null
InheritedStatic

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Indicate whether or not translation should be disabled

setDisableTranslator(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Sets if the domain should also be checked or only the local part of the email address

setDomainCheck(boolean $domain = true) : \Zend_Validate_EmailAddress

Parameters

$domain

boolean

Returns

\Zend_Validate_EmailAddressProvides a fluent inteface

setHostnameValidator()

setHostnameValidator(\Zend_Validate_Hostname $hostnameValidator = null, integer $allow = \Zend_Validate_Hostname::ALLOW_DNS) : \Zend_Validate_EmailAddress
fluent This method is part of a fluent interface and will return the same instance

Parameters

$hostnameValidator

\Zend_Validate_Hostname

OPTIONAL

$allow

integer

OPTIONAL

Returns

\Zend_Validate_EmailAddress

Sets the validation failure message template for a particular key Adds the ability to set messages to the attached hostname validator

setMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
inherited_from \Zend_Validate_Abstract::setMessage()

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_AbstractProvides a fluent interface

Sets the validation failure message template for a particular key

setMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
Inherited

Parameters

$messageString

string

$messageKey

string

OPTIONAL

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_AbstractProvides a fluent interface

Sets the maximum allowed message length

setMessageLength(integer $length = -1
InheritedStatic

Parameters

$length

integer

Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings.

setMessages(array $messages) : \Zend_Validate_Abstract
Inherited

Parameters

$messages

array

Returns

\Zend_Validate_Abstract

Set flag indicating whether or not value should be obfuscated in messages

setObscureValue(boolean $flag) : \Zend_Validate_Abstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_Validate_Abstract

Set options for the email validator

setOptions(array $options = array()) : \Zend_Validate_EmailAddress

Parameters

$options

array

Returns

\Zend_Validate_EmailAddressProvides a fluent inteface

Set translation object

setTranslator(\Zend_Translate|\Zend_Translate_Adapter|null $translator = null) : \Zend_Validate_Abstract
Inherited

Parameters

$translator

\Zend_Translate\Zend_Translate_Adapternull

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_Abstract

Set whether we check for a valid MX record via DNS

setValidateMx(boolean $mx) : \Zend_Validate_EmailAddress

This only applies when DNS hostnames are validated

Parameters

$mx

boolean

Set allowed to true to validate for MX records, and false to not validate them

Exceptions

\Zend_Validate_Exception

Returns

\Zend_Validate_EmailAddressProvides a fluent inteface

Is translation disabled?

translatorIsDisabled() : boolean
Inherited

Returns

boolean

Whether MX checking via getmxrr is supported or not

validateMxSupported() : boolean

This currently only works on UNIX systems

Returns

boolean

Constructs and returns a validation failure message with the given message key and value.

_createMessage(string $messageKey, string $value) : string
Inherited

Returns null if and only if $messageKey does not correspond to an existing template.

If a translator is available and a translation exists for $messageKey, the translation will be used.

Parameters

$messageKey

string

$value

string

Returns

string

_error()

_error(string $messageKey, string $value = null) : void
Inherited

Parameters

$messageKey

string

$value

string

OPTIONAL

Joins elements of a multidimensional array

_implodeRecursive(array $pieces) : string
Inherited

Parameters

$pieces

array

Returns

string

Sets the value to be validated and clears the messages and errors arrays

_setValue(mixed $value) : void
Inherited

Parameters

$value

mixed

Returns if the given host is reserved

_isReserved(string $host) : boolean

Parameters

$host

string

Returns

boolean

Converts a binary string to an IP address

_toIp(string $binary) : mixed

Parameters

$binary

string

Returns

mixed

Internal method to validate the hostname part of the email address

_validateHostnamePart() : boolean

Returns

boolean

Internal method to validate the local part of the email address

_validateLocalPart() : boolean

Returns

boolean

Internal method to validate the servers MX records

_validateMXRecords() : boolean

Returns

boolean

 Properties

 

Default translation object for all validate objects

$_defaultTranslator : \Zend_Translate

Default

Static
 

Array of validation failure message codes

$_errors : array

Default

array()
deprecated Since 1.5.0
 

$_hostname

$_hostname : string

Default

 

As of RFC5753 (JAN 2010), the following blocks are no longer reserved: - 128.0.0.0/16 - 191.255.0.0/16 - 223.255.255.0/24

$_invalidIp : array

Default

array('0' => '0.0.0.0/8', '10' => '10.0.0.0/8', '100' => '100.64.0.0/10', '127' => '127.0.0.0/8', '169' => '169.254.0.0/16', '172' => '172.16.0.0/12', '192' => array('192.0.0.0/24', '192.0.2.0/24', '192.88.99.0/24', '192.168.0.0/16'), '198' => '198.18.0.0/15', '224' => '224.0.0.0/4', '240' => '240.0.0.0/4')
 

$_localPart

$_localPart : string

Default

 

Limits the maximum returned length of a error message

$_messageLength : Integer

Default

-1
Static
 

Validation failure message template definitions

$_messageTemplates : array

Default

array(self::INVALID => "Invalid type given. String expected", self::INVALID_FORMAT => "'%value%' is not a valid email address in the basic format local-part@hostname", self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'", self::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network", self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format", self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format", self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for email address '%value%'", self::LENGTH_EXCEEDED => "'%value%' exceeds the allowed length")
inherited_from \Zend_Validate_Abstract::_messageTemplates
 

Validation failure message template definitions

$_messageTemplates : array

Default

array()
 

Additional variables available for validation failure messages

$_messageVariables : array

Default

array('hostname' => '_hostname', 'localPart' => '_localPart')
inherited_from \Zend_Validate_Abstract::_messageVariables
 

Additional variables available for validation failure messages

$_messageVariables : array

Default

array()
 

Array of validation failure messages

$_messages : array

Default

array()
 

Flag indidcating whether or not value should be obfuscated in error messages

$_obscureValue : boolean

Default

false
 

Internal options array

$_options 

Default

array('mx' => false, 'deep' => false, 'domain' => true, 'allow' => \Zend_Validate_Hostname::ALLOW_DNS, 'hostname' => null)
 

Translation object

$_translator : \Zend_Translate

Default

 

Is translation disabled?

$_translatorDisabled : Boolean

Default

false
 

The value to be validated

$_value : mixed

Default

 Constants

 

DOT_ATOM

DOT_ATOM = 'emailAddressDotAtom' 
 

INVALID

INVALID = 'emailAddressInvalid' 
 

INVALID_FORMAT

INVALID_FORMAT = 'emailAddressInvalidFormat' 
 

INVALID_HOSTNAME

INVALID_HOSTNAME = 'emailAddressInvalidHostname' 
 

INVALID_LOCAL_PART

INVALID_LOCAL_PART = 'emailAddressInvalidLocalPart' 
 

INVALID_MX_RECORD

INVALID_MX_RECORD = 'emailAddressInvalidMxRecord' 
 

INVALID_SEGMENT

INVALID_SEGMENT = 'emailAddressInvalidSegment' 
 

LENGTH_EXCEEDED

LENGTH_EXCEEDED = 'emailAddressLengthExceeded' 
 

QUOTED_STRING

QUOTED_STRING = 'emailAddressQuotedString'