]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/CategoryPage.php
Activated Id substitution for Subversion
[SourceForge/phpwiki.git] / lib / plugin / CategoryPage.php
1 <?php // -*-php-*-
2 rcs_id('$Id$');
3 /**
4  Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
5
6  This file is part of PhpWiki.
7
8  PhpWiki is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12
13  PhpWiki is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with PhpWiki; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 //require_once('lib/InlineParser.php');
24 require_once('lib/BlockParser.php');
25
26 /**
27  * CategoryPage plugin.
28  *
29  * This puts boilerplate text on a category page to make it easily usable
30  * by novices.
31  *
32  * Usage:
33  * <?plugin-form CategoryPage ?>
34  *
35  * It finds the file templates/categorypage.tmpl, then loads it with a few
36  * variables substituted.
37  *
38  * This has only been used in wikilens.org.
39  */
40 class WikiPlugin_CategoryPage
41 extends WikiPlugin
42 {
43     function getName () {
44         return _("CategoryPage");
45     }
46
47     function getDescription () {
48         return _("Create a Wiki page.");
49     }
50
51     function getVersion() {
52         return preg_replace("/[Revision: $]/", '',
53                             "\$Revision: 1.3 $");
54     }
55
56     function getDefaultArguments() {
57         return array(// Assume the categories are listed on the HomePage
58                      'exclude'              => false,
59                      'pagename'             => '[pagename]',
60                      'plural'               => false,
61                      'singular'             => false,
62                      'self_on_create'       => true,
63                      'showbuds'             => false);
64     }
65
66     function run($dbi, $argstr, &$request) {
67         $args = $this->getArgs($argstr, $request);
68
69         if (empty($args['singular'])) {
70             $args['singular'] = $args['pagename'];
71         }
72         if (empty($args['plural'])) {
73             $args['plural'] = $args['singular'] . 's';
74         }
75
76         return new Template('categorypage', $request,
77                             array('EXCLUDE' => $args['exclude'],
78                                   'PAGENAME' => $args['pagename'],
79                                   'PLURAL' => $args['plural'],
80                                   'SHOWBUDS' => $args['showbuds'],
81                                   'SELF_ON_CREATE' => $args['self_on_create'],
82                                   'SINGULAR' => $args['singular']));
83     }
84 };
85
86 // Local Variables:
87 // mode: php
88 // tab-width: 8
89 // c-basic-offset: 4
90 // c-hanging-comment-ender-p: nil
91 // indent-tabs-mode: nil
92 // End:
93 ?>