]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllPages.php
Update to work with DEBUG constant
[SourceForge/phpwiki.git] / lib / plugin / AllPages.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllPages.php,v 1.10 2002-02-06 17:01:07 carstenklapp 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
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         if (defined('DEBUG'))
38             $debug = true;
39
40         if ($debug) $time_start = $this->getmicrotime();
41
42         $pagelist->addPages( $dbi->getAllPages($include_empty) );
43
44         if ($debug) $time_end = $this->getmicrotime();
45
46         if ($debug) {
47             $time = $time_end - $time_start;
48             return HTML::p(fmt("elapsed time: %s s", $time), $pagelist);
49         } else {
50             return $pagelist;
51         }
52     }
53
54     function getmicrotime(){ 
55         list($usec, $sec) = explode(" ",microtime()); 
56         return ((float)$usec + (float)$sec); 
57     } 
58 };
59         
60 // Local Variables:
61 // mode: php
62 // tab-width: 8
63 // c-basic-offset: 4
64 // c-hanging-comment-ender-p: nil
65 // indent-tabs-mode: nil
66 // End:   
67 ?>