if (empty($pages))
return str_replace('$1', $s_word, $_msg_notfoundresult);
- ksort($pages);
+ ksort($pages, SORT_STRING);
$retval = '<ul>' . "\n";
foreach (array_keys($pages) as $page) {
}
// Encode page-name
-function encode($key)
+function encode($str)
{
- return ($key == '') ? '' : strtoupper(bin2hex($key));
+ $str = strval($str);
+ return ($str == '') ? '' : strtoupper(bin2hex($str));
// Equal to strtoupper(join('', unpack('H*0', $key)));
// But PHP 4.3.10 says 'Warning: unpack(): Type H: outside of string in ...'
}
// Decode page name
-function decode($key)
+function decode($str)
{
- return pkwk_hex2bin($key);
+ return pkwk_hex2bin($str);
}
// Inversion of bin2hex()
foreach($pages as $file=>$page) {
$r_page = rawurlencode($page);
- $s_page = htmlspecialchars($page, ENT_QUOTES);
+ $s_page = htmlsc($page, ENT_QUOTES);
$passage = get_pg_passage($page);
$str = ' <li><a href="' . $href . $r_page . '">' .
$s_page . '</a>' . $passage;
if ($withfilename) {
- $s_file = htmlspecialchars($file);
+ $s_file = htmlsc($file);
$str .= "\n" . ' <ul><li>' . $s_file . '</li></ul>' .
"\n" . ' ';
}
}
} else {
$head = (preg_match('/^([A-Za-z])/', $page, $matches)) ? $matches[1] :
- (preg_match('/^([ -~])/', $page, $matches) ? $symbol : $other);
+ (preg_match('/^([ -~])/', $page) ? $symbol : $other);
}
$list[$head][$page] = $str;
}
// Sugar with default settings
-function htmlsc($string = '', $flags = ENT_QUOTES, $charset = CONTENT_CHARSET)
+function htmlsc($string = '', $flags = ENT_COMPAT, $charset = CONTENT_CHARSET)
{
return htmlspecialchars($string, $flags, $charset); // htmlsc()
}