]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - locale/zh/pgsrc/Help%2FHelloWorldPlugin
Merge OldTextFormattingRules into TextFormattingRules; Rename _GroupInfo --> DebugGro...
[SourceForge/phpwiki.git] / locale / zh / pgsrc / Help%2FHelloWorldPlugin
1 Date: Fri,  4 Feb 2011 16:44:25 +0000
2 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0)
3 Content-Type: application/x-phpwiki;
4   pagename=Help%2FHelloWorldPlugin;
5   flags="";
6   author=test;
7   version=10;
8   lastmodified=1068935007;
9   author_id=test;
10   hits=10;
11   charset=UTF-8
12 Content-Transfer-Encoding: binary
13
14 簡單的範例 plugin.
15
16 <<HelloWorld salutation="Hello," name="WikiUser" >>
17
18 From the source of this page:
19
20 {{{
21 <<HelloWorld salutation="Hello," name="WikiUser" >>
22 }}}
23
24 -----
25 PhpWiki 的 plugin 架構允許你加入自訂的頁面元素. 你所要做的就是繼承 ~WikiPlugin
26 類別並實作你的 run() 方法.
27
28 <<PhpHighlight
29
30 /**
31  * A simple demonstration WikiPlugin.
32  *
33  * Usage:
34  * <<HelloWorld> >
35  * <<HelloWorld
36  *          salutation="Greetings, "
37  *          name=Wikimeister
38  * > >
39  * <<HelloWorld salutation=Hi > >
40  * <<HelloWorld name=WabiSabi > >
41  */
42
43 // Constants are defined before the class.
44 if (!defined('THE_END'))
45     define('THE_END', "!");
46
47 class WikiPlugin_HelloWorld
48 extends WikiPlugin
49 {
50     // Five required functions in a WikiPlugin.
51
52     function getName () {
53         return _("HelloWorld");
54     }
55
56     function getDescription () {
57         return _("Simple Sample Plugin");
58
59     }
60
61     // Establish default values for each of this plugin's arguments.
62     function getDefaultArguments() {
63         return array('salutation' => "Hello,",
64                      'name'       => "World");
65     }
66
67     function run($dbi, $argstr, $request) {
68         extract($this->getArgs($argstr, $request));
69
70         // Any text that is returned will not be further transformed,
71         // so use html where necessary.
72         $html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')),
73                          THE_END);
74         return $html;
75     }
76 };
77 >>
78
79 <noinclude>
80 ----
81 [[PhpWikiDocumentation]] [[CategoryWikiPlugin]]
82 </noinclude>