Example #1
0
 /**
  * Returns true if the given value contains only alpha-numeric characters.
  * Return false otherwise.
  * 
  * @param string $value
  * @return boolean
  */
 public function isValid($value)
 {
     $value = (string) $value;
     $alphaNumericFilter = new iPhorm_Filter_AlphaNumeric();
     if ($value !== $alphaNumericFilter->filter($value)) {
         $this->addMessage('Only alphanumeric characters are allowed');
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Returns true if the given value contains only alpha-numeric characters.
  * Return false otherwise.
  *
  * @param string $value
  * @return boolean
  */
 public function isValid($value)
 {
     $value = (string) $value;
     $alphaNumericFilter = new iPhorm_Filter_AlphaNumeric();
     $alphaNumericFilter->setAllowWhiteSpace($this->_allowWhiteSpace);
     if ($value !== $alphaNumericFilter->filter($value)) {
         $message = sprintf($this->_messageTemplates['invalid'], $value);
         $this->addMessage($message);
         return false;
     }
     return true;
 }