Exemplo n.º 1
0
 public function validate($val)
 {
     if ($this->required) {
         if (Useful::stripper($val) === false) {
             $this->error[] = 'is required';
         }
     }
     if (in_array($val, $this->false_values)) {
         $this->error[] = "{$val} is not a valid choice";
     }
     return !empty($this->error) ? false : true;
 }
Exemplo n.º 2
0
 public function validate($val)
 {
     if (!empty($this->error)) {
         return false;
     }
     if (parent::validate($val)) {
         if (Useful::stripper($val) !== false) {
             if (!filter_var($val, FILTER_VALIDATE_FLOAT)) {
                 $this->error[] = 'must be numeric';
             }
         }
     }
     return !empty($this->error) ? false : true;
 }
Exemplo n.º 3
0
 public function validate($val)
 {
     if ($this->required) {
         if (Useful::stripper($val) === false) {
             $this->error[] = 'is required';
         }
     }
     if (Useful::stripper($val) !== false) {
         if (!preg_match($this->content, $val)) {
             $this->error[] = 'is not valid';
         }
     }
     return !empty($this->error) ? false : true;
 }
Exemplo n.º 4
0
 public function validate($val)
 {
     if (!empty($this->error)) {
         return false;
     }
     if (parent::validate($val)) {
         if (Useful::stripper($val) !== false) {
             if (!filter_var($val, FILTER_VALIDATE_EMAIL)) {
                 $this->error[] = 'must be a valid email address';
             }
         }
     }
     if ($this->confirm) {
         $request = strtoupper($this->form->getMethod()) == 'POST' ? $_POST : $_GET;
         if ($val != $request[$this->form->getName()][$this->confirm]) {
             $this->error[] = 'The email addresses provided do not match';
         }
     }
     return !empty($this->error) ? false : true;
 }
Exemplo n.º 5
0
 public function validate($val)
 {
     if (!empty($this->error)) {
         return false;
     }
     if (parent::validate($val)) {
         if (Useful::stripper($val) !== false) {
             if ($this->min_length && strlen($val) < $this->min_length) {
                 $this->error[] = sprintf('must be more than %s characters', $this->min_length);
             }
             if ($this->alphanumeric && (!preg_match("/[A-Za-z]+/", $val) || !preg_match("/[0-9]+/", $val))) {
                 $this->error[] = 'must have at least one alphabetic character and one numeric character';
             }
         }
     }
     if ($this->confirm) {
         $request = strtoupper($this->form->getMethod()) == 'POST' ? $_POST : $_GET;
         if ($val != $request[$this->form->getName()][$this->confirm]) {
             $this->error[] = 'The passwords provided do not match password';
         }
     }
     return !empty($this->error) ? false : true;
 }