summaryrefslogtreecommitdiff
path: root/it_html.class
diff options
context:
space:
mode:
authorNathan Gass2017-11-28 15:06:41 +0100
committerNathan Gass2017-11-28 15:07:38 +0100
commitfdafbf02b626b5d0cf47ca982bbf5cf64e27084f (patch)
tree4da8e28f44d785e26ce7fae31260bcd8f2473283 /it_html.class
parent7a065544ad3b43c891d72ea5ae400a143f38f070 (diff)
downloaditools-fdafbf02b626b5d0cf47ca982bbf5cf64e27084f.tar.gz
itools-fdafbf02b626b5d0cf47ca982bbf5cf64e27084f.tar.bz2
itools-fdafbf02b626b5d0cf47ca982bbf5cf64e27084f.zip
simplify % code, test % at end and with digits
Diffstat (limited to 'it_html.class')
-rw-r--r--it_html.class5
1 files changed, 1 insertions, 4 deletions
diff --git a/it_html.class b/it_html.class
index 02f3f2a..c7105b7 100644
--- a/it_html.class
+++ b/it_html.class
@@ -556,10 +556,7 @@ static function U(/* ... */)
$schemepart = $hostpart ? ($u['scheme'] ? $u['scheme'] . ":" : "") . "//$hostpart" : ($u['scheme'] == "mailto" ? $u['scheme'] . ":" : "");
# hack: encode % if not followed by two hex digits
- $parts = preg_split('/%([^%]{0,2})/', $u['path'], -1, PREG_SPLIT_DELIM_CAPTURE);
- for ($i = 1; $i < count($parts); $i+=2)
- $parts[$i] = (preg_match('/[0-9a-f][0-9a-f]/i', $parts[$i]) ? "%" : "%25") . $parts[$i];
- $path = join("", $parts);
+ $path = preg_replace('/%(?![0-9a-f]{2})/i', '%25', $u['path']);
# if params replace url parameters that are present in base, replace them but keep their order
foreach ($u['params'] as $key => $dummy)