// PukiWiki - Yet another WikiWikiWeb clone.
// func.php
// Copyright
-// 2002-2018 PukiWiki Development Team
+// 2002-2019 PukiWiki Development Team
// 2001-2002 Originally written by yu-ji
// License: GPL v2 or (at your option) any later version
//
function _pagename_urlencode_callback($matches)
{
- return rawurlencode($matches[0]);
+ return urlencode($matches[0]);
}
function pagename_urlencode($page)
} else {
$href = $script . '?cmd=' . $cmd . '&page=';
}
-
+ uasort($pages, 'strnatcmp');
foreach($pages as $file=>$page) {
$r_page = pagename_urlencode($page);
$s_page = htmlsc($page, ENT_QUOTES);
$str = ' <li><a href="' . $href . $r_page . '">' .
- $s_page . '</a>' . get_passage_html_span($page);
+ $s_page . '</a> ' . get_pg_passage($page);
if ($withfilename) {
$s_file = htmlsc($file);
$str .= "\n" . ' <ul><li>' . $s_file . '</li></ul>' .
$cnt = 0;
$arr_index = array();
$retval .= '<ul>' . "\n";
- foreach ($list as $head=>$pages) {
+ foreach ($list as $head=>$sub_pages) {
if ($head === $symbol) {
$head = $_msg_symbol;
} else if ($head === $other) {
'"><strong>' . $head . '</strong></a>' . "\n" .
' <ul>' . "\n";
}
- ksort($pages, SORT_STRING);
- $retval .= join("\n", $pages);
+ $retval .= join("\n", $sub_pages);
if ($list_index)
$retval .= "\n </ul>\n </li>\n";
}
}
/**
+ * Get JSON string with htmlspecialchars().
+ */
+function htmlsc_json($obj)
+{
+ // json_encode: PHP 5.2+
+ // JSON_UNESCAPED_UNICODE: PHP 5.4+
+ // JSON_UNESCAPED_SLASHES: PHP 5.4+
+ if (defined('JSON_UNESCAPED_UNICODE')) {
+ return htmlsc(json_encode($obj,
+ JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
+ }
+ return '';
+}
+
+/**
* Get redirect page name on Page Redirect Rules
*
* This function returns exactly false if it doesn't need redirection.