Revert "Change URL Validation to use filter_var"

This reverts commit 4e53916021.
This commit is contained in:
predominant 2010-04-24 11:01:07 +10:00
parent 4e53916021
commit da3103379e

View file

@ -666,11 +666,14 @@ class Validation {
* @return boolean Success
*/
public static function url($check, $strict = false) {
$flags = array(FILTER_FLAG_HOST_REQUIRED);
if ($strict === true) {
$flags[] = FILTER_FLAG_SCHEME_REQUIRED;
}
return (boolean)filter_var($check, FILTER_VALIDATE_URL, $flags);
self::__populateIp();
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~') . '\/0-9a-z]|(%[0-9a-f]{2}))';
$regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
'(?:' . self::$__pattern['IPv4'] . '|' . self::$__pattern['hostname'] . ')(?::[1-9][0-9]{0,3})?' .
'(?:\/?|\/' . $validChars . '*)?' .
'(?:\?' . $validChars . '*)?' .
'(?:#' . $validChars . '*)?$/i';
return self::_check($check, $regex);
}
/**