forked from Cavemanon/cavepaintings
make it more explicit that caret/decaret are for encoding tags into URL paths
This commit is contained in:
@@ -449,32 +449,9 @@ function int_escape(?string $input): int
|
||||
*/
|
||||
function url_escape(?string $input): string
|
||||
{
|
||||
/*
|
||||
Shish: I have a feeling that these three lines are important, possibly for searching for tags with slashes in them like fate/stay_night
|
||||
green-ponies: indeed~
|
||||
|
||||
$input = str_replace('^', '^^', $input);
|
||||
$input = str_replace('/', '^s', $input);
|
||||
$input = str_replace('\\', '^b', $input);
|
||||
|
||||
/* 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
|
||||
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);
|
||||
} else {
|
||||
return filter_var($input, FILTER_SANITIZE_URL);
|
||||
}
|
||||
*/
|
||||
if (is_null($input)) {
|
||||
return "";
|
||||
}
|
||||
$input = str_replace('^', '^^', $input);
|
||||
$input = str_replace('/', '^s', $input);
|
||||
$input = str_replace('\\', '^b', $input);
|
||||
$input = str_replace('?', '^q', $input);
|
||||
$input = str_replace('&', '^a', $input);
|
||||
$input = rawurlencode($input);
|
||||
return $input;
|
||||
}
|
||||
|
Reference in New Issue
Block a user