]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllPages.php
added multiple page exclusion and include_self
[SourceForge/phpwiki.git] / lib / plugin / AllPages.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllPages.php,v 1.6 2002-01-30 18:26:04 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                      'pagename'      => '[pagename]', // hackish
23                      'exclude'       => '',
24                      'include_self'  => 1, // hackish
25                      'info'          => ''
26                      );
27     }
28     // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor
29     // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
30
31     function run($dbi, $argstr, $request) {
32         extract($this->getArgs($argstr, $request));
33
34         $pagelist = new PageList();
35
36         if ($info)
37             foreach (explode(",", $info) as $col)
38                 $pagelist->insertColumn($col);
39
40         if ($include_self==false || $include_self==0 )
41                 $pagelist->excludePageName($pagename); // hackish
42         if ($exclude)
43             foreach (explode(",", $exclude) as $excludepage)
44                 $pagelist->excludePageName($excludepage);
45
46         if (!$noheader)
47             $pagelist->setCaption(_("Pages in this wiki (%d total):"));
48
49         $pages = $dbi->getAllPages($include_empty);
50
51         while ($page = $pages->next())
52             $pagelist->addPage($page);
53
54         return $pagelist;
55     }
56 };
57         
58 // Local Variables:
59 // mode: php
60 // tab-width: 8
61 // c-basic-offset: 4
62 // c-hanging-comment-ender-p: nil
63 // indent-tabs-mode: nil
64 // End:   
65 ?>