The idn_to_ascii() function is only supported by PHP version 5.3 and up.
This commit is contained in:
parent
a0a0ba5bbc
commit
a79875c1eb
1 changed files with 11 additions and 5 deletions
|
@ -35,8 +35,14 @@ function int_escape($input) {
|
||||||
*/
|
*/
|
||||||
function url_escape($input) {
|
function url_escape($input) {
|
||||||
/* The function idn_to_ascii is used to support Unicode domains / URLs as well.
|
/* The function idn_to_ascii is used to support Unicode domains / URLs as well.
|
||||||
See here for more: http://php.net/manual/en/function.filter-var.php */
|
See here for more: http://php.net/manual/en/function.filter-var.php
|
||||||
|
However, it is only supported by PHP version 5.3 and up
|
||||||
|
*/
|
||||||
|
if (function_exists('idn_to_ascii')) {
|
||||||
return filter_var(idn_to_ascii($input), FILTER_SANITIZE_URL);
|
return filter_var(idn_to_ascii($input), FILTER_SANITIZE_URL);
|
||||||
|
} else {
|
||||||
|
return filter_var($input, FILTER_SANITIZE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
/*if(is_null($input)) {
|
/*if(is_null($input)) {
|
||||||
return "";
|
return "";
|
||||||
|
@ -71,8 +77,8 @@ function bool_escape($input) {
|
||||||
Yay for Got'chas!
|
Yay for Got'chas!
|
||||||
http://php.net/manual/en/filter.filters.validate.php
|
http://php.net/manual/en/filter.filters.validate.php
|
||||||
*/
|
*/
|
||||||
if (is_bool($value)) {
|
if (is_bool($input)) {
|
||||||
return $value;
|
return $input;
|
||||||
} else {
|
} else {
|
||||||
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
$value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||||
if (!is_null($value)) {
|
if (!is_null($value)) {
|
||||||
|
|
Reference in a new issue