]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/HelloWorld.php
getName should not translate
[SourceForge/phpwiki.git] / lib / plugin / HelloWorld.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 /**
24  * A simple demonstration WikiPlugin.
25  *
26  * Usage:
27  * <<HelloWorld?>
28  * <<HelloWorld
29  *          salutation="Greetings, "
30  *          name=Wikimeister
31  * >>
32  * <<HelloWorld salutation=Hi >>
33  * <<HelloWorld name=WabiSabi >>
34  */
35
36 // Constants are defined before the class.
37 if (!defined('THE_END'))
38     define('THE_END', "!");
39
40 class WikiPlugin_HelloWorld
41     extends WikiPlugin
42 {
43     function getDescription()
44     {
45         return _("Simple Sample Plugin.");
46     }
47
48     // Establish default values for each of this plugin's arguments.
49     function getDefaultArguments()
50     {
51         return array('salutation' => "Hello,",
52             'name' => "World");
53     }
54
55     function run($dbi, $argstr, &$request, $basepage)
56     {
57         extract($this->getArgs($argstr, $request));
58
59         // Any text that is returned will not be further transformed,
60         // so use html where necessary.
61         $html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')),
62             THE_END);
63         return $html;
64     }
65 }
66
67 // Local Variables:
68 // mode: php
69 // tab-width: 8
70 // c-basic-offset: 4
71 // c-hanging-comment-ender-p: nil
72 // indent-tabs-mode: nil
73 // End: