Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CBooleanValidator
  • CCaptchaValidator
  • CCompareValidator
  • CDateValidator
  • CDefaultValueValidator
  • CEmailValidator
  • CExistValidator
  • CFileValidator
  • CFilterValidator
  • CInlineValidator
  • CNumberValidator
  • CRangeValidator
  • CRegularExpressionValidator
  • CRequiredValidator
  • CSafeValidator
  • CStringValidator
  • CTypeValidator
  • CUniqueValidator
  • CUnsafeValidator
  • CUrlValidator
  • CValidator
  • X2UrlValidator
  • Overview
  • Package
  • Class
  • Tree

Class CEmailValidator

CEmailValidator validates that the attribute value is a valid email address.

CComponent
Extended by CValidator
Extended by CEmailValidator
Package: system\validators
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/validators/CEmailValidator.php
Methods summary
protected
# validateAttribute( CModel $object, string $attribute )

Validates the attribute of the object. If there is any error, the error message is added to the object.

Validates the attribute of the object. If there is any error, the error message is added to the object.

Parameters

$object
CModel
$object the object being validated
$attribute
string
$attribute the attribute being validated
public boolean
# validateValue( mixed $value )

Validates a static value to see if it is a valid email. Note that this method does not respect CEmailValidator::$allowEmpty property. This method is provided so that you can call it directly without going through the model validation rule mechanism.

Validates a static value to see if it is a valid email. Note that this method does not respect CEmailValidator::$allowEmpty property. This method is provided so that you can call it directly without going through the model validation rule mechanism.

Parameters

$value
mixed
$value the value to be validated

Returns

boolean
whether the value is a valid email

Since

1.1.1
public string
# clientValidateAttribute( CModel $object, string $attribute )

Returns the JavaScript needed for performing client-side validation.

Returns the JavaScript needed for performing client-side validation.

Parameters

$object
CModel
$object the data object being validated
$attribute
string
$attribute the name of the attribute to be validated.

Returns

string
the client-side validation script.

Since

1.1.7

See

CActiveForm::$enableClientValidation

Overrides

CValidator::clientValidateAttribute()
protected boolean
# checkMxPorts( string $domain )

Retrieves the list of MX records for $domain and checks if port 25 is opened on any of these.

Retrieves the list of MX records for $domain and checks if port 25 is opened on any of these.

Parameters

$domain
string
$domain domain to be checked

Returns

boolean
true if a reachable MX server has been found

Since

1.1.11
protected boolean
# mxSort( mixed $a, mixed $b )

Determines if one MX record has higher priority as another (i.e. 'pri' is lower). Used by CEmailValidator::checkMxPorts().

Determines if one MX record has higher priority as another (i.e. 'pri' is lower). Used by CEmailValidator::checkMxPorts().

Parameters

$a
mixed
$a first item for comparison
$b
mixed
$b second item for comparison

Returns

boolean

Since

1.1.11
Methods inherited from CValidator
addError(), applyTo(), createValidator(), isEmpty(), validate()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public string $pattern '/^[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'
#

the regular expression used to validate the attribute value.

the regular expression used to validate the attribute value.

See

http://www.regular-expressions.info/email.html
public string $fullPattern '/^[^@]*<[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?>$/'
#

the regular expression used to validate email addresses with the name part. This property is used only when CEmailValidator::$allowName is true.

the regular expression used to validate email addresses with the name part. This property is used only when CEmailValidator::$allowName is true.

See

CEmailValidator::$allowName
public boolean $allowName false
#

whether to allow name in the email address (e.g. "Qiang Xue <qiang.xue@gmail.com>"). Defaults to false.

whether to allow name in the email address (e.g. "Qiang Xue <qiang.xue@gmail.com>"). Defaults to false.

See

CEmailValidator::$fullPattern
public boolean $checkMX false
#

whether to check the MX record for the email address. Defaults to false. To enable it, you need to make sure the PHP function 'checkdnsrr' exists in your PHP installation. Please note that this check may fail due to temporary problems even if email is deliverable.

whether to check the MX record for the email address. Defaults to false. To enable it, you need to make sure the PHP function 'checkdnsrr' exists in your PHP installation. Please note that this check may fail due to temporary problems even if email is deliverable.

public boolean $checkPort false
#

whether to check port 25 for the email address. Defaults to false. To enable it, ensure that the PHP functions 'dns_get_record' and 'fsockopen' are available in your PHP installation. Please note that this check may fail due to temporary problems even if email is deliverable.

whether to check port 25 for the email address. Defaults to false. To enable it, ensure that the PHP functions 'dns_get_record' and 'fsockopen' are available in your PHP installation. Please note that this check may fail due to temporary problems even if email is deliverable.

public boolean $allowEmpty true
#

whether the attribute value can be null or empty. Defaults to true, meaning that if the attribute is empty, it is considered valid.

whether the attribute value can be null or empty. Defaults to true, meaning that if the attribute is empty, it is considered valid.

public boolean $validateIDN false
#

whether validation process should care about IDN (internationalized domain names). Default value is false which means that validation of emails containing IDN will always fail.

whether validation process should care about IDN (internationalized domain names). Default value is false which means that validation of emails containing IDN will always fail.

Since

1.1.13
Properties inherited from CValidator
$attributes, $builtInValidators, $enableClientValidation, $except, $message, $on, $safe, $skipOnError
API documentation generated by ApiGen 2.8.0