]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllPages.php
FileFinder: added OS specific code. Just for testing. Will be changed to seperate...
[SourceForge/phpwiki.git] / lib / plugin / AllPages.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllPages.php,v 1.14 2002-09-09 08:38:19 rurban Exp $');
3
4 require_once('lib/PageList.php');
5
6 /**
7  */
8 class WikiPlugin_AllPages
9 extends WikiPlugin
10 {
11     function getName () {
12         return _("AllPages");
13     }
14
15     function getDescription () {
16         return _("All Pages");
17     }
18
19     function getDefaultArguments() {
20         return array('noheader'      => false,
21                      'include_empty' => false,
22                      'exclude'       => '',
23                      'info'          => '',
24                      'sortby'        => '',   // +mtime,-pagename
25                      'debug'         => false
26                      );
27     }
28     // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor,markup or all
29     // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
30     // sortby: [+|-] pagename|mtime|hits
31
32     function run($dbi, $argstr, $request) {
33         extract($this->getArgs($argstr, $request));
34         // Todo: extend given _GET args
35         if ($sortby) $request->setArg('sortby',$sortby);
36
37         $pagelist = new PageList($info, $exclude);
38         if (!$noheader)
39             $pagelist->setCaption(_("Pages in this wiki (%d total):"));
40
41         // deleted pages show up as version 0.
42         if ($include_empty)
43             $pagelist->_addColumn('version');
44
45         if (defined('DEBUG'))
46             $debug = true;
47
48         if ($debug) $time_start = $this->getmicrotime();
49
50         $pagelist->addPages( $dbi->getAllPages($include_empty) );
51
52         if ($debug) $time_end = $this->getmicrotime();
53
54         if ($debug) {
55             $time = round($time_end - $time_start, 3);
56             return HTML($pagelist,HTML::p(fmt("Elapsed time: %s s", $time)));
57         } else {
58             return $pagelist;
59         }
60     }
61
62     function getmicrotime(){
63         list($usec, $sec) = explode(" ",microtime());
64         return (float)$usec + (float)$sec;
65     }
66 };
67
68 // Local Variables:
69 // mode: php
70 // tab-width: 8
71 // c-basic-offset: 4
72 // c-hanging-comment-ender-p: nil
73 // indent-tabs-mode: nil
74 // End:
75 ?>