public static function removeUnsafeChars($str) {
		static $blacklist = '/[!\"?():\']/';
		static $whitelist = '/[^a-zA-Z0-9-_.]/';
		$validStr = preg_replace(array($blacklist, $whitelist), array('', '-'), $str);
		return $validStr;
	}
public static function removeUnsafeChars($str) {
		static $blacklist = '/[!\"?():\']/';
		static $whitelist = '/[^a-zA-Z0-9-_.]/';
		$validStr = preg_replace(array($blacklist, $whitelist), array('', '-'), $str);
		return $validStr;
	}
public static function removeUnsafeChars ( $ str ) { static $ blacklist = '/[!\"?():\']/' ; static $ whitelist = '/[^a-zA-Z0-9-_.]/' ; $ validStr = preg_replace ( array ( $ blacklist , $ whitelist ) , array ( '' , '-' ) , $ str ) ; return $ validStr ; }
Remove unwanted characters from a string.
Characters in blacklist will be removed.
Remaining characters not in blacklist or whitelist will be replaced with hyphen.

@param string $str
@return string
Remove unwanted characters from a string . Characters in blacklist will be removed . Remaining characters not in blacklist or whitelist will be replaced with hyphen .