]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/HelloWorld.php
Remove history
[SourceForge/phpwiki.git] / lib / plugin / HelloWorld.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 /**
24  * A simple demonstration WikiPlugin.
25  *
26  * Usage:
27  * <?plugin HelloWorld?>
28  * <?plugin HelloWorld
29  *          salutation="Greetings, "
30  *          name=Wikimeister
31  * ?>
32  * <?plugin HelloWorld salutation=Hi ?>
33  * <?plugin 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     // Five required functions in a WikiPlugin.
44
45     function getName () {
46         return _("HelloWorld");
47     }
48
49     function getDescription () {
50         return _("Simple Sample Plugin");
51
52     }
53
54     function getVersion() {
55         return preg_replace("/[Revision: $]/", '',
56                             "\$Revision$");
57     }
58
59     // Establish default values for each of this plugin's arguments.
60     function getDefaultArguments() {
61         return array('salutation' => "Hello,",
62                      'name'       => "World");
63     }
64
65     function run($dbi, $argstr, &$request, $basepage) {
66         extract($this->getArgs($argstr, $request));
67
68         // Any text that is returned will not be further transformed,
69         // so use html where necessary.
70         $html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')),
71                          THE_END);
72         return $html;
73     }
74 };
75
76 // For emacs users
77 // Local Variables:
78 // mode: php
79 // tab-width: 8
80 // c-basic-offset: 4
81 // c-hanging-comment-ender-p: nil
82 // indent-tabs-mode: nil
83 // End:
84 ?>