]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/HelloWorld.php
Added plugin version function.
[SourceForge/phpwiki.git] / lib / plugin / HelloWorld.php
1 <?php // -*-php-*-
2 rcs_id('$Id: HelloWorld.php,v 1.11 2002-12-30 23:49:35 carstenklapp 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     // Five 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
31     function getVersion() {
32         return preg_replace("/[Revision: $]/", '',
33                             "\$Revision: 1.11 $");
34     }
35
36     // Establish default values for each of this plugin's arguments.
37     function getDefaultArguments() {
38         return array('salutation' => "Hello,",
39                      'name'       => "World");
40     }
41
42     function run($dbi, $argstr, $request) {
43         extract($this->getArgs($argstr, $request));
44
45         // Any text that is returned will not be further transformed,
46         // so use html where necessary.
47         $html = HTML::tt(fmt('%s %s', $salutation, WikiLink($name, 'auto')),
48                          THE_END);
49         return $html;
50     }
51 };
52
53 // For emacs users
54 // Local Variables:
55 // mode: php
56 // tab-width: 8
57 // c-basic-offset: 4
58 // c-hanging-comment-ender-p: nil
59 // indent-tabs-mode: nil
60 // End:
61 ?>