diff options
author | xue <> | 2006-02-22 02:46:25 +0000 |
---|---|---|
committer | xue <> | 2006-02-22 02:46:25 +0000 |
commit | fceb3741d3b0c1e00e81a4a24caf7d49a86896b4 (patch) | |
tree | b2d7f92eaacc92111701c493b91da9d882f580be /framework/Web/UI/WebControls/TEmailAddressValidator.php | |
parent | 0922e304fb1d7fc2e486d7020e65e011b9f13e0d (diff) |
Updated some validators and relevant demos.
Diffstat (limited to 'framework/Web/UI/WebControls/TEmailAddressValidator.php')
-rw-r--r-- | framework/Web/UI/WebControls/TEmailAddressValidator.php | 24 |
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 |