From 9156fa6596e5ea46d529cf984d7ccfd5d38ed8f1 Mon Sep 17 00:00:00 2001 From: carstenklapp Date: Mon, 7 Jan 2002 04:14:20 +0000 Subject: [PATCH] minor update to sample plugin: added a few examples, comments and notes, spiffed up the output. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@1046 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/plugin/HelloWorld.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/plugin/HelloWorld.php b/lib/plugin/HelloWorld.php index d5875030c..580ea0b02 100644 --- a/lib/plugin/HelloWorld.php +++ b/lib/plugin/HelloWorld.php @@ -1,19 +1,33 @@ + * + * + * */ + +// Constants are defined before the class. +if (!defined('THE_END')) + define('THE_END', "!"); + class WikiPlugin_HelloWorld extends WikiPlugin { + // Four required functions in a WikiPlugin. + function getName () { return _("HelloWorld"); } function getDescription () { return _("Simple Sample Plugin"); + } - + // Establish default values for each of this plugin's arguments. function getDefaultArguments() { return array('salutation' => "Hello,", 'name' => "World"); @@ -21,8 +35,12 @@ extends WikiPlugin function run($dbi, $argstr, $request) { extract($this->getArgs($argstr, $request)); - - return sprintf("%s %s", $salutation, $name); + + // Any text that is returned will not be further transformed, + // so use html where necessary. + $html = Element('tt', __sprintf("%s %s" .THE_END, $salutation, + do_transform($name, 'LinkTransform'))); + return $html; } }; -- 2.45.0