コード例 #1
0
 public function isValid($value)
 {
     if (!preg_match("/^[a-z0-9~@+:\\[\\]\\.-]+\$/i", $value)) {
         $idna = new waIdna();
         $value = $idna->encode($value);
     }
     return parent::isValid($value);
 }
コード例 #2
0
 public function isValid($value)
 {
     parent::isValid($value);
     // more restrictions for common protocols
     if (!$this->isEmpty($value) && !$this->getErrors() && ('http' == substr($value, 0, 4) || 'ftp' == substr($value, 0, 3))) {
         if (!preg_match('`^(https?|ftp):((//)|(\\\\\\\\))+((?:([^[:punct:]]|-)+\\.)+[^[:punct:]]{2,6})((/|\\|#)([^[:punct:]]|[:#@%/;$()~_?\\+-=\\.&\\\\])*)?$`ui', $value)) {
             $this->setError($this->getMessage('not_match', array('value' => $value)));
         }
     }
     return !$this->getErrors();
 }