Public Member Functions | Data Fields | Protected Attributes

Zend_Validate_EmailAddress Class Reference

Inheritance diagram for Zend_Validate_EmailAddress:
Zend_Validate_Abstract Zend_Validate_Interface

Public Member Functions

 __construct ($allow=Zend_Validate_Hostname::ALLOW_DNS, $validateMx=false, Zend_Validate_Hostname $hostnameValidator=null)
 getHostnameValidator ()
 setHostnameValidator (Zend_Validate_Hostname $hostnameValidator=null, $allow=Zend_Validate_Hostname::ALLOW_DNS)
 validateMxSupported ()
 setValidateMx ($allowed)
 isValid ($value)

Data Fields

const INVALID = 'emailAddressInvalid'
const INVALID_FORMAT = 'emailAddressInvalidFormat'
const INVALID_HOSTNAME = 'emailAddressInvalidHostname'
const INVALID_MX_RECORD = 'emailAddressInvalidMxRecord'
const DOT_ATOM = 'emailAddressDotAtom'
const QUOTED_STRING = 'emailAddressQuotedString'
const INVALID_LOCAL_PART = 'emailAddressInvalidLocalPart'
const LENGTH_EXCEEDED = 'emailAddressLengthExceeded'
 $hostnameValidator

Protected Attributes

 $_messageTemplates
 $_messageVariables
 $_validateMx = false
 $_hostname
 $_localPart

Detailed Description

Definition at line 38 of file EmailAddress.php.


Constructor & Destructor Documentation

__construct ( allow = Zend_Validate_Hostname::ALLOW_DNS,
validateMx = false,
Zend_Validate_Hostname hostnameValidator = null 
)

Instantiates hostname validator for local use

You can pass a bitfield to determine what types of hostnames are allowed. These bitfields are defined by the ALLOW_* constants in Zend_Validate_Hostname The default is to allow DNS hostnames only

Parameters:
integer$allowOPTIONAL
bool$validateMxOPTIONAL
Zend_Validate_Hostname$hostnameValidatorOPTIONAL
Returns:
void

Definition at line 108 of file EmailAddress.php.


Member Function Documentation

getHostnameValidator (  )

Returns the set hostname validator

Returns:
Zend_Validate_Hostname

Definition at line 119 of file EmailAddress.php.

isValid ( value )

Defined by Zend_Validate_Interface

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

RFC2822 http://www.columbia.edu/kermit/ascii.html US-ASCII characters string $value boolean

MX checks are not supported by this system

See also:
Zend_Validate_Exception

Implements Zend_Validate_Interface.

Definition at line 172 of file EmailAddress.php.

setHostnameValidator ( Zend_Validate_Hostname hostnameValidator = null,
allow = Zend_Validate_Hostname::ALLOW_DNS 
)
Parameters:
Zend_Validate_Hostname$hostnameValidatorOPTIONAL
int$allowOPTIONAL
Returns:
void

Definition at line 129 of file EmailAddress.php.

setValidateMx ( allowed )

Set whether we check for a valid MX record via DNS

This only applies when DNS hostnames are validated

Parameters:
boolean$allowedSet allowed to true to validate for MX records, and false to not validate them

Definition at line 156 of file EmailAddress.php.

validateMxSupported (  )

Whether MX checking via dns_get_mx is supported or not

This currently only works on UNIX systems

Returns:
boolean

Definition at line 144 of file EmailAddress.php.


Field Documentation

$_messageTemplates [protected]
Initial value:
 array(
        self::INVALID            => "Invalid type given, value should be a string",
        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::DOT_ATOM           => "'%localPart%' not matched against dot-atom format",
        self::QUOTED_STRING      => "'%localPart%' not 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"
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 52 of file EmailAddress.php.

$_messageVariables [protected]
Initial value:
 array(
        'hostname'  => '_hostname',
        'localPart' => '_localPart'
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 66 of file EmailAddress.php.


The documentation for this class was generated from the following file: