Location: PHPKode > projects > SkullPuppy > Project/library/SP/Security/Parse.php
<?php

class SP_Security_Parse {

	static public function mq($var) {
		if(!is_array($var)) return addslashes($var);
		foreach($var as $key => $val) {
			if(is_array($val)) {
				foreach($val as $k => $v)
					$a[$key][$k] = addslashes($v);
			} else $a[$key] = addslashes($val);
		}
		return $a;
	}

	static public function secure($var, $filter = "a-zA-z0-9 ") {
		return preg_replace("/[^$filter]/", "", $var);
	}
	
	static public function htmlSafe($var) {
		if(!is_array($var)) return htmlentities($var);
		foreach($var as $key => $val) {
			if(is_array($val)) {
				foreach($val as $k => $v)
					$a[$key][$k] = htmlentities($v);
			} else $a[$key] = htmlentities($val);
		}
		return $a;
	}

	static public function get() {
		return self::mq($_GET);
	}

	static public function post() {
		return self::mq($_POST);
	}

	static public function date() {
		return date("Y-n-j G:i:s");
	}
	
	static public function isValidEmail($email) {
		if(!$email || preg_match('/[^0-9a-zA-z\hide@address.com]/',$email) ||
				!preg_match('/.*@.*\..*/',$email)) return false;
		return true;
	}

}

?>
Return current item: SkullPuppy