]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/CategoryPage.php
rcs_id no longer makes sense with Subversion global version number
[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 getDefaultArguments() {
52         return array(// Assume the categories are listed on the HomePage
53                      'exclude'              => false,
54                      'pagename'             => '[pagename]',
55                      'plural'               => false,
56                      'singular'             => false,
57                      'self_on_create'       => true,
58                      'showbuds'             => false);
59     }
60
61     function run($dbi, $argstr, &$request) {
62         $args = $this->getArgs($argstr, $request);
63
64         if (empty($args['singular'])) {
65             $args['singular'] = $args['pagename'];
66         }
67         if (empty($args['plural'])) {
68             $args['plural'] = $args['singular'] . 's';
69         }
70
71         return new Template('categorypage', $request,
72                             array('EXCLUDE' => $args['exclude'],
73                                   'PAGENAME' => $args['pagename'],
74                                   'PLURAL' => $args['plural'],
75                                   'SHOWBUDS' => $args['showbuds'],
76                                   'SELF_ON_CREATE' => $args['self_on_create'],
77                                   'SINGULAR' => $args['singular']));
78     }
79 };
80
81 // Local Variables:
82 // mode: php
83 // tab-width: 8
84 // c-basic-offset: 4
85 // c-hanging-comment-ender-p: nil
86 // indent-tabs-mode: nil
87 // End:
88 ?>