1 Date: Wed, 28 May 2008 19:06:42 +0200
2 Mime-Version: 1.0 (Produced by PhpWiki 1.3.14-20080124)
3 Content-Type: application/x-phpwiki;
4 pagename=Help%2FHelloWorldPlugin;
8 Content-Transfer-Encoding: binary
10 A simple example plugin.
12 <?plugin HelloWorld salutation="Hello," name="WikiUser" ?>
14 From the source of this page:
17 <?plugin HelloWorld salutation="Hello," name="WikiUser" ?>
21 PhpWiki's plugin architecture allows you to add custom page elements to your wiki. All you have to do is extend (subclass) the ~WikiPlugin class and create your output via the run() method, dependend on the Wiki- or Request arguments,
23 * either with the predefined HTML classes to create valid XHTML,
24 * or by using templates, which are easier customizable, but generally more a mess to use and easier to create invalid XHTML.
29 * A simple demonstration WikiPlugin.
32 * <?plugin HelloWorld?>
34 * salutation="Greetings, "
37 * <?plugin HelloWorld salutation=Hi ? >
38 * <?plugin HelloWorld name=WabiSabi ? >
41 // Constants are defined before the class.
42 if (!defined('THE_END'))
43 define('THE_END', "!");
45 class WikiPlugin_HelloWorld
48 // Five required functions in a WikiPlugin.
51 return _("HelloWorld");
54 function getDescription () {
55 return _("Simple Sample Plugin");
59 function getVersion() {
60 return preg_replace("/ Help:n : $]/", '',
64 // Establish default values for each of this plugin's arguments.
65 function getDefaultArguments() {
66 return array('salutation' => "Hello,",
70 function run($dbi, $argstr, $request) {
71 extract($this->getArgs($argstr, $request));
73 // Any text that is returned will not be further transformed,
74 // so use html where necessary.
75 $html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')),
83 [PhpWikiDocumentation] [WikiPlugin|Help:WikiPlugin]