1 Date: Sun, 4 Jul 2004 01:31:02 -0700
2 Mime-Version: 1.0 (Produced by PhpWiki 1.3.5pre)
3 X-Rcs-Id: $Id: Help%2FHelloWorldPlugin,v 1.1 2005-11-21 22:19:00 rurban Exp $
4 Content-Type: application/x-phpwiki;
5 pagename=Help%2FHelloWorldPlugin;
6 pgsrc_version="2 $Revision: 1.1 $";
10 Content-Transfer-Encoding: binary
12 A simple example plugin.
14 <?plugin HelloWorld salutation="Hello," name="WikiUser" ?>
16 From the source of this page:
19 <?plugin HelloWorld salutation="Hello," name="WikiUser" ?>
23 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,
25 * either with the predefined HTML classes to create valid XHTML,
26 * or by using templates, which are easier customizable, but generally more a mess to use and easier to create invalid XHTML.
31 * A simple demonstration Help:WikiPlugin.
34 * <?plugin HelloWorld?>
36 * salutation="Greetings, "
39 * <?plugin HelloWorld salutation=Hi ? >
40 * <?plugin HelloWorld name=WabiSabi ? >
43 // Constants are defined before the class.
44 if (!defined('THE_END'))
45 define('THE_END', "!");
47 class Help:WikiPlugin_HelloWorld
48 extends Help:WikiPlugin
50 // Five required functions in a Help:WikiPlugin.
53 return _("HelloWorld");
56 function getDescription () {
57 return _("Simple Sample Plugin");
61 function getVersion() {
62 return preg_replace("/ Help:n : $]/", '',
66 // Establish default values for each of this plugin's arguments.
67 function getDefaultArguments() {
68 return array('salutation' => "Hello,",
72 function run($dbi, $argstr, $request) {
73 extract($this->getArgs($argstr, $request));
75 // Any text that is returned will not be further transformed,
76 // so use html where necessary.
77 $html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')),
85 PhpWikiDocumentation Help:WikiPlugin