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