Example #1
0
 public function setPasUsu($passwordUsuario)
 {
     if (SpoonFilter::isSmallerThan(40, strlen($passwordUsuario)) && SpoonFilter::isString($passwordUsuario) && SpoonFilter::isAlphaNumeric($passwordUsuario)) {
         $this->passwdUsu = sha1($passwordUsuario);
     } else {
         echo "Introduzca una contraseña correcta, use sólo números y letras";
         exit;
     }
 }
 public function testIsString()
 {
     $this->assertTrue(SpoonFilter::isString('This should qualify as a string.'));
     // Simulating (string) casting behaviour in PHP < 5.4
     $this->assertTrue(SpoonFilter::isString(array()));
 }
Example #3
0
 /**
  * Checks if this field contains any string that doesn't have control characters (ASCII 0 - 31) but spaces are allowed.
  *
  * @return	bool
  * @param	string[optional] $error		The error message to set.
  */
 public function isString($error = null)
 {
     // filled
     if ($this->isFilled()) {
         // post/get data
         $data = $this->getMethod(true);
         // validate
         if (!isset($data[$this->attributes['name']]) || !SpoonFilter::isString($data[$this->attributes['name']])) {
             if ($error !== null) {
                 $this->setError($error);
             }
             return false;
         }
         return true;
     }
     // not submitted
     if ($error !== null) {
         $this->setError($error);
     }
     return false;
 }
 public function testIsString()
 {
     $this->assertTrue(SpoonFilter::isString('This should qualify as a string.'));
 }