OSDN Git Service

BugTrack/2514 PHP8: uasort with non-static comparison func
[pukiwiki/pukiwiki.git] / plugin / list.inc.php
1 <?php
2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // list.inc.php
4 // Copyright 2003-2017 PukiWiki Development Team
5 // License: GPL v2 or (at your option) any later version
6 //
7 // IndexPages plugin: Show a list of page names
8
9 function plugin_list_action()
10 {
11         global $vars, $_title_list, $_title_filelist, $whatsnew;
12
13         // Redirected from filelist plugin?
14         $filelist = (isset($vars['cmd']) && $vars['cmd'] === 'filelist');
15
16         return array(
17                 'msg'=>$filelist ? $_title_filelist : $_title_list,
18                 'body'=>plugin_list_getlist($filelist));
19 }
20
21 // Get a list
22 function plugin_list_getlist($withfilename = FALSE)
23 {
24         global $non_list, $whatsnew;
25
26         $pages = array_diff(get_existpages(), array($whatsnew));
27         if (! $withfilename)
28                 $pages = array_diff($pages, preg_grep('/' . $non_list . '/S', $pages));
29         if (empty($pages)) return '';
30
31         return page_list($pages, 'read', $withfilename);
32 }