OSDN Git Service

BugTrack/2473 list plugin: Sort sub pages in natural order
authorumorigu <umorigu@gmail.com>
Thu, 31 May 2018 20:28:27 +0000 (05:28 +0900)
committerumorigu <umorigu@gmail.com>
Thu, 31 May 2018 20:28:27 +0000 (05:28 +0900)
lib/func.php

index 18a6dfa..68b7cc1 100644 (file)
@@ -533,7 +533,7 @@ function page_list($pages, $cmd = 'read', $withfilename = FALSE)
        } else {
                $href = $script . '?cmd=' . $cmd . '&amp;page=';
        }
-
+       uasort($pages, 'strnatcmp');
        foreach($pages as $file=>$page) {
                $r_page  = pagename_urlencode($page);
                $s_page  = htmlsc($page, ENT_QUOTES);
@@ -568,7 +568,7 @@ function page_list($pages, $cmd = 'read', $withfilename = FALSE)
        $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) {
@@ -584,8 +584,7 @@ function page_list($pages, $cmd = 'read', $withfilename = FALSE)
                                '"><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";
        }