/**
  * @see Components\Validator::validate() Components\Validator::validate()
  */
 public function validate($value_, $quiet_ = false)
 {
     try {
         return parent::validate($value_, $quiet_);
     } catch (Validator_Exception $e_) {
         throw new Validator_Exception('validator/email', 'Invalid email address.');
     }
 }
示例#2
0
文件: Date.php 项目: jasny/Q
 /**
  * Validates a value using a regular expression
  *
  * @param     string    $value         Value to be checked
  * @param     string    $pattern       A format from Date_Local. Leave NULL to use $this->pattern.
  * @return    boolean   true if $value is valid
  */
 function validate($value)
 {
     if ($value === null || $value === "") {
         return null;
     }
     if (is_int($value) && $this->pattern & Date_Local::FORMAT_UNIXTIME) {
         return true;
     }
     return parent::validate($value, self::getRegex($this->pattern));
 }
示例#3
0
文件: Time.php 项目: jasny/Q
 /**
  * Validates a value using a regular expression
  *
  * @param     string    $value         Value to be checked
  * @param     string    $pattern       A format from Date_Local. Leave NULL to use $this->pattern.
  * @return    boolean   true if $value is valid
  */
 function validate($value, $pattern = null)
 {
     if ($value === null || $value === "") {
         return null;
     }
     if (!isset($pattern) && (!isset($this) || !$this instanceof self)) {
         $pattern = parent::getRegex('time');
     }
     if (isset($pattern)) {
         $pattern = self::getRegex($pattern);
     }
     if (is_int($value) && (isset($pattern) ? $pattern : $this->pattern)) {
         return !$this->negate;
     }
     return parent::validate($value, $pattern);
 }
示例#4
0
文件: Email.php 项目: jasny/Q
 /**
  * Check if $value is a valid e-mail address.
  *
  * @return boolean
  */
 public function validate($value)
 {
     return parent::validate($value) != $this->negate && (!$this->check_dns || self::checkDNS($value)) xor $this->negate;
 }