Created
November 13, 2013 19:25
-
-
Save gthomas3/7454829 to your computer and use it in GitHub Desktop.
validate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Validate | |
{ | |
private static function clean($input = array()) | |
{ | |
$clean = array(); | |
foreach ($input as $key => $value) { | |
$clean[$key] = htmlentities(mb_convert_encoding($value, 'UTF-8', 'UTF-8'), ENT_QUOTES, 'UTF-8'); | |
} | |
return $clean; | |
} | |
public static function textField($input = array()) | |
{ | |
$error = null; | |
$clean = self::clean($input); | |
foreach ($clean as $key => $value) { | |
if (empty($value)) { | |
$error = $key . '.empty'; | |
} | |
} | |
return $error; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment