]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllPages.php
LANG still broken, working on better locale handling.
[SourceForge/phpwiki.git] / lib / plugin / AllPages.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllPages.php,v 1.13 2002-08-27 21:51:31 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                      'debug'         => false
25                      );
26     }
27     // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor,markup or all
28     // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
29
30     function run($dbi, $argstr, $request) {
31         extract($this->getArgs($argstr, $request));
32
33         $pagelist = new PageList($info, $exclude);
34         if (!$noheader)
35             $pagelist->setCaption(_("Pages in this wiki (%d total):"));
36
37         // deleted pages show up as version 0.
38         if ($include_empty)
39             $pagelist->_addColumn('version');
40
41         if (defined('DEBUG'))
42             $debug = true;
43
44         if ($debug) $time_start = $this->getmicrotime();
45
46         $pagelist->addPages( $dbi->getAllPages($include_empty) );
47
48         if ($debug) $time_end = $this->getmicrotime();
49
50         if ($debug) {
51             $time = round($time_end - $time_start, 3);
52             return HTML($pagelist,HTML::p(fmt("Elapsed time: %s s", $time)));
53         } else {
54             return $pagelist;
55         }
56     }
57
58     function getmicrotime(){
59         list($usec, $sec) = explode(" ",microtime());
60         return (float)$usec + (float)$sec;
61     }
62 };
63
64 // Local Variables:
65 // mode: php
66 // tab-width: 8
67 // c-basic-offset: 4
68 // c-hanging-comment-ender-p: nil
69 // indent-tabs-mode: nil
70 // End:
71 ?>