Exemple #1
0
 public function test_empty_string()
 {
     $str = '';
     $trimmed = '';
     $this->assertEquals($trimmed, utf8\trim($str));
 }
Exemple #2
0
 /**
  * Required
  *
  * @param	string
  * @return	bool
  */
 public function required($str)
 {
     if (!is_array($str)) {
         return utf8\trim($str) == '' ? FALSE : TRUE;
     } else {
         return !empty($str);
     }
 }
 /**
  * Valid Emails
  *
  * @param	string
  * @return	bool
  */
 function emails($str)
 {
     if (strpos($str, ',') === FALSE) {
         return $this->valid_email(utf8\trim($str));
     }
     foreach (explode(',', $str) as $email) {
         if (utf8\trim($email) != '' && $this->valid_email(utf8\trim($email)) === FALSE) {
             return FALSE;
         }
     }
     return TRUE;
 }