diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -854,7 +854,7 @@ static function getopt($usage, $p = array()) $optdesc = trim($optdesc); if ($matches = (array)it::match('^--(\w[\w-]*)(=[A-Z])?', $optdesc)) list($longoptname, $longoptarg) = $matches; - elseif ($matches = (array)it::match('^-(\w)( [A-Z])?', $optdesc)) + else if ($matches = (array)it::match('^-(\w)( [A-Z])?', $optdesc)) list($shortoptname, $shortoptarg) = $matches; } @@ -897,7 +897,7 @@ static function getopt($usage, $p = array()) } else if ($arg == "--") $noopts = true; - elseif (!$noopts && ($matches = (array)it::match('^--(\w[\w-]*)(=.*)?', $arg))) + else if (!$noopts && ($matches = (array)it::match('^--(\w[\w-]*)(=.*)?', $arg))) { list($optname, $val) = $matches; if (!isset($witharg[$optname]) || isset($val) && !$witharg[$optname]) @@ -922,7 +922,7 @@ static function getopt($usage, $p = array()) $result[$optname] = true; } } - elseif($mandatoryargs) + else if($mandatoryargs) $result[strtolower(array_shift($mandatoryargs))] = $seenarg = $arg; else $result['args'][] = $seenarg = $arg; @@ -1274,10 +1274,13 @@ static function params2utf8() $_SERVER[$var] = it::any2utf8($_SERVER[$var]); $urlfix = function($m) { return urlencode(it::any2utf8(urldecode($m[0]))); }; - foreach (['QUERY_STRING', 'REQUEST_URI', 'HTTP_REFERER'] as $var) { + foreach (['QUERY_STRING', 'REQUEST_URI', 'HTTP_REFERER'] as $var) + { $_SERVER[$var.'_RAW'] = $_SERVER[$var]; $_SERVER[$var] = it::any2utf8($_SERVER[$var]); - if (strpos($_SERVER[$var], '%') !== false) { + + if (strpos($_SERVER[$var], '%') !== false) + { if (grapheme_strlen(urldecode($_SERVER[$var])) === null) # handle latin (double encodes correct utf8) $_SERVER[$var] = preg_replace_callback('/%[89A-F][A-Z0-9]/i', $urlfix, $_SERVER[$var]); while (preg_match('/%C3%8[23]%C2%[89ab][0-9a-f]/i', $_SERVER[$var]) && $iterations++ < 3) # handle doubly encoded utf8, UTF8SAFE |