]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/CategoryPage.php
getName should not translate
[SourceForge/phpwiki.git] / lib / plugin / CategoryPage.php
1 <?php
2
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 along
19  * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 getDescription()
44     {
45         return _("Create a Wiki Category Page.");
46     }
47
48     function getDefaultArguments()
49     {
50         return array( // Assume the categories are listed on the HomePage
51             'exclude' => false,
52             'pagename' => '[pagename]',
53             'plural' => false,
54             'singular' => false,
55             'self_on_create' => true,
56             'showbuds' => false);
57     }
58
59     function run($dbi, $argstr, &$request)
60     {
61         $args = $this->getArgs($argstr, $request);
62
63         if (empty($args['singular'])) {
64             $args['singular'] = $args['pagename'];
65         }
66         if (empty($args['plural'])) {
67             $args['plural'] = $args['singular'] . 's';
68         }
69
70         return new Template('categorypage', $request,
71             array('EXCLUDE' => $args['exclude'],
72                 'PAGENAME' => $args['pagename'],
73                 'PLURAL' => $args['plural'],
74                 'SHOWBUDS' => $args['showbuds'],
75                 'SELF_ON_CREATE' => $args['self_on_create'],
76                 'SINGULAR' => $args['singular']));
77     }
78 }
79
80 // Local Variables:
81 // mode: php
82 // tab-width: 8
83 // c-basic-offset: 4
84 // c-hanging-comment-ender-p: nil
85 // indent-tabs-mode: nil
86 // End: