1 Date: Fri, 10 Sep 2010 13:48:42 +0000
2 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC1)
4 Content-Type: application/x-phpwiki;
5 pagename=Hilfe%2FWikiPlugin;
9 Content-Transfer-Encoding: binary
10 Since PhpWiki-1.3.3 support for ~WikiPlugins is included.
12 A plugin is some PHP code that
14 * lives in =phpwiki/lib/plugin/<pluginname>.php=
15 * implements the ~WikiPlugin interface by extending that class.
17 There are many plugins already distributed with PhpWiki. Simply look in the =lib/plugin=
18 directory or see the PluginManager list.
20 To write your own, look at the HelloWorldPlugin (~HelloWorld.php in that directory),
21 which is a minimal example of a plugin.
22 Publish your self-written plugin at a new PhpWiki page with ~PluginName + *Plugin* appended
23 and add a link to [CategoryContributedPlugin | PhpWiki:CategoryContributedPlugin].
25 A Help:WikiPlugin allows one to easily add new types of dynamic content
26 (as well as other functionality) to wiki pages within PhpWiki.
27 In this very wiki all actions which are not entirely lowercased
28 are implemented using plugins, and some lowercased convenience actions also. (rename, revert, setacl, diff, ...)
30 (The old-style Help:MagicPhpWikiURLs have been replaced by plugins entirely.)
34 Currently, one invokes a plugin by putting something like:
40 into a regular wiki-page. That particular example produces a list of
41 the first 5 existing pages (via the ~PageList library).
47 Plugins can take certain named arguments (most do). The values of
48 these arguments can be determined four different ways. In order of
51 # The plugin invocation can specify the value for an argument, like so:
53 <<BackLinks page=OtherPage >>
56 # The argument can be specified via an HTTP query argument. This
57 doesn't happen (is not allowed) unless the argument is mentioned in
58 the plugin invocation:
64 # Default values specified in the plugin invocation:
67 <<BackLinks page||=OtherPage >>
70 # The plugin must supply default values for each argument it uses.
71 Such default args may be overriden by URL arguments like so:
73 BackLinks?page=ThisPage&sortby=-mtime
75 (The BackLinks plugin uses the current page as the default value for
76 the ''page'' argument.)
78 Most plugins using the ~PageListLibrary inherit their default arguments
79 from the PhpWiki:PageListLibrary.
81 === Standard Arguments
83 Most plugins display a list of pages, via the ~PageListLibrary.
84 ~PageList provides automatic support for those arguments.
86 info, exclude, author, owner, creator, sortby, limit, paging, cols, azhead,
87 comma, commasep, ordered
89 For details see the PhpWiki:PageListLibrary documentation.
91 *exclude* and *pages* accept a list of pages. Either as comma-seperated list,
92 supporting glob-style wildcards, or via the <tt><!plugin-list pluginname ~[args~] !></tt>
93 invocation syntax, where pluginname might be any plugin returning a pagelist.
94 See PhpWiki:PluginList.
96 === Basic Plugin Types
98 All these plugins derive from the Help:WikiPlugin class extending the run method,
99 which returns a object tree of HTML objects, and may react on any
100 provided arguments from the ~WikiPage (see the args below) or
101 optionally overridden by arguments from the url (GET or POST args),
102 if defined via '||='.
104 A basic plugin just needs the run() method, and optionally getName,
105 getDescription, getDefaultArguments. See the Help:HelloWorldPlugin for a short introduction.
107 *plugin* reacts on its arguments and the request and displays arbitrary HTML.
109 *plugin-form* is used to display a input type=text box for the default argument *s*.
111 *plugin-list* is used as argument to provide a dynamic list of pagenames.
114 <<PluginName Help:s ...] >>
118 <?plugin-form PluginName Help:s ...] ?>
122 <<PluginName args=<!plugin-list pluginname Help:s ] !> >>
127 Themes based on the "sidebar" theme may use the box method of any plugin, which displays a *title*
128 and a condensed *content* in a box.
130 ==== ~WikiPluginCached
132 Plugins deriving from the class ~WikiPluginCached must also define the methods getPluginType(),
133 optionally getExpire(), managesValidators(), and dependent of the getPluginType the methods
134 to display the *possibly cached* result.
136 getImage(), getMap() or getHtml(),
140 getAlt(), getImageType(), embedMap(), embedImg(), embedObject()
142 See the config.ini PLUGIN_CACHED_* settings and PhpWiki:WikiPluginCached
146 The term *~ActionPage* refers to a page containing a plugin invocation.
147 An *action* is together with the *pagename* argument the a basic PhpWiki argument.
148 It can both be GET or POST actions. Actions are untranslated, always english.
149 Basic (and old) actions are all lowercase, like edit, browse, remove, ...
150 Newer actions in PhpWiki:CamelCase are invoked via plugins on their specific action page.
152 We decoupled actions from plugins via action pages for the following reasons:
154 # support translated action buttons and customizable action descriptions.
155 # customize standard actions by tuning the plugin invocation arguments. override or add plugin defaults.
156 # split simple plugins into multiple actions, like RecentChanges/RecentEdits, MostPopular/LeastPopular,
157 AllPages/AllPagesCreatedByMe/AllPagesLastEditedByMe/AllPagesOwnedByMe which differ only in one argument.
159 * Those actions which have buttons or links in the theme or are referenced in the standard pgsrc
160 pageset require their (possibly localized) actionpages, otherwise the actions will not work.
161 * If the localized actionpage is not found the english version is used.
162 * If no actionpage is found, it is recommended to do action=upgrade, which imports all missing
163 and required action pages into the database.
165 So for a hypothetical new ~MyActionPage plugin ~MyActionPage will invoke the plugin and
166 ~MyActionPagePlugin is the the description.
170 See PluginManager for a detailed list. Most plugins should have their own description page with the name
173 <<BackLinks noheader=1 >>
175 == Contributed Plugins
177 See PhpWiki:CategoryContributedPlugin.
179 <<Backlinks page=CategoryContributedPlugin >>
182 [[PhpWikiDokumentation]]