summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TEmailAddressValidator.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls/TEmailAddressValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TEmailAddressValidator.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/framework/Web/UI/WebControls/TEmailAddressValidator.php b/framework/Web/UI/WebControls/TEmailAddressValidator.php
index b6ceff90..3534d1d0 100644
--- a/framework/Web/UI/WebControls/TEmailAddressValidator.php
+++ b/framework/Web/UI/WebControls/TEmailAddressValidator.php
@@ -19,8 +19,9 @@ Prado::using('System.Web.UI.WebControls.TRegularExpressionValidator');
* TEmailAddressValidator class
*
* TEmailAddressValidator validates whether the value of an associated
- * input component is a valid email address. It will check MX record
- * if checkdnsrr() is available in the installed PHP.
+ * input component is a valid email address. If {@link getCheckMXRecord CheckMXRecord}
+ * is true, it will check MX record for the email adress, provided
+ * checkdnsrr() is available in the installed PHP.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
@@ -50,7 +51,7 @@ class TEmailAddressValidator extends TRegularExpressionValidator
public function evaluateIsValid()
{
$valid=parent::evaluateIsValid();
- if($valid && function_exists('checkdnsrr'))
+ if($valid && $this->getCheckMXRecord() && function_exists('checkdnsrr'))
{
if(($value=$this->getValidationValue($this->getValidationTarget()))!=='')
{
@@ -65,6 +66,23 @@ class TEmailAddressValidator extends TRegularExpressionValidator
}
return $valid;
}
+
+ /**
+ * @return boolean whether to check MX record for the email address being validated. Defaults to true.
+ */
+ public function getCheckMXRecord()
+ {
+ return $this->getViewState('CheckMXRecord',true);
+ }
+
+ /**
+ * @param boolean whether to check MX record for the email address being validated.
+ * Note, if {@link checkdnsrr} is not available, this check will not be performed.
+ */
+ public function setCheckMXRecord($value)
+ {
+ $this->setViewState('CheckMXRecord',TPropertyValue::ensureBoolean($value),true);
+ }
}
?> \ No newline at end of file