]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/HelloWorld.php
More infiltration of new object-based HTML generation.
[SourceForge/phpwiki.git] / lib / plugin / HelloWorld.php
1 <?php // -*-php-*-
2 rcs_id('$Id: HelloWorld.php,v 1.8 2002-01-21 06:55:47 dairiki Exp $');
3 /**
4  * A simple demonstration WikiPlugin.
5  *
6  * Usage:
7  * <?plugin HelloWorld?>
8  * <?plugin HelloWorld salutation="Greetings, " name=Wikimeister ?>
9  * <?plugin HelloWorld salutation=Hi ?>
10  * <?plugin HelloWorld name=WabiSabi ?>
11  */
12
13 // Constants are defined before the class.
14 if (!defined('THE_END'))
15     define('THE_END', "!");
16
17 class WikiPlugin_HelloWorld
18 extends WikiPlugin
19 {
20     // Four required functions in a WikiPlugin.
21
22     function getName () {
23         return _("HelloWorld");
24     }
25
26     function getDescription () {
27         return _("Simple Sample Plugin");
28
29     }
30     // Establish default values for each of this plugin's arguments.
31     function getDefaultArguments() {
32         return array('salutation' => "Hello,",
33                      'name'       => "World");
34     }
35
36     function run($dbi, $argstr, $request) {
37         extract($this->getArgs($argstr, $request));
38
39         // Any text that is returned will not be further transformed,
40         // so use html where necessary.
41         $html = HTML::tt(fmt('%s %s', $salutation, _LinkWikiWord($name)),
42                          THE_END);
43         return $html;
44     }
45 };
46
47 // For emacs users
48 // Local Variables:
49 // mode: php
50 // tab-width: 8
51 // c-basic-offset: 4
52 // c-hanging-comment-ender-p: nil
53 // indent-tabs-mode: nil
54 // End:
55 ?>