1 Date: Mon, 16 Jun 2008 14:15:24 +0000
2 X-Rcs-Id: $Id: Help%2FWikiPlugin,v 1.10 2008-06-18 01:12:39 vargenau Exp $
3 Mime-Version: 1.0 (Produced by PhpWiki 1.3.14-20080124)
4 Content-Type: application/x-phpwiki;
5 pagename=Help%2FWikiPlugin;
9 Content-Transfer-Encoding: binary
11 Since PhpWiki-1.3.3 support for ~WikiPlugins is included.
13 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
18 in the =lib/plugin= directory or see the [PluginManager] list or see all the
19 [Help/*Plugin pages|phpwiki:TitleSearch?s=Help/*Plugin].
21 To write your own, look at the Help:HelloWorldPlugin (~HelloWorld.php
22 in that directory), which is a minimal example of a plugin.
23 Publish your self-written plugin at a new PhpWiki page with
24 ~PluginName + *Plugin* appended
25 and add a link to [CategoryContributedPlugin | PhpWiki:CategoryContributedPlugin].
27 A ~WikiPlugin allows one to easily add new types of dynamic
28 content (as well as other functionality) to wiki pages within PhpWiki.
29 In this very wiki all actions which are not entirely lowercased
30 are implemented using plugins, and some lowercased convenience
32 (rename, revert, setacl, diff, ...)
34 Note that you can NOT extend the markup syntax with a plugin, as in other wiki engines.
36 (The old-style [MagicPhpWikiURLs|Help:MagicPhpWikiURLs] have been replaced by plugins
41 Currently, one invokes a plugin by putting something like:
44 <?plugin AllPages limit=20 cols=3 ?>
47 into a regular wiki-page. That particular example produces a list
48 of the first 20 existing pages in 3 columns, via the PhpWiki:PageList
51 <?plugin AllPages limit=20 cols=3 ?>
55 Plugins can take certain named arguments, most do. The values of
56 these arguments can be determined four different ways. In order of
59 # The plugin invocation can specify the value for an argument, like so:
61 <?plugin BackLinks page=OtherPage ?>
64 # The argument can be specified via an HTTP query argument. This
65 doesn't happen (is not allowed) unless the argument is mentioned in
66 the plugin invocation:
69 <?plugin BackLinks page ?>
72 # Default values specified in the plugin invocation:
75 <?plugin BackLinks page||=OtherPage ?>
78 # The plugin must supply default values for each argument it uses.
79 Such default args may be overriden by URL arguments like so:
81 BackLinks?page=ThisPage&sortby=-mtime
83 (The BackLinks plugin uses the current page as the default value for
86 Most plugins using the PhpWiki:PageList library inherit their
87 default arguments from the ~PageList.
91 Most plugins display a list of pages, via the PhpWiki:PageList
92 library. ~PageList provides automatic support for those arguments.
94 info, exclude, author, owner, creator, sortby, limit, paging, cols, azhead,
95 comma, commasep, ordered
97 For details see the PhpWiki:PageList library documentation.
99 *exclude* and *pages* accept a list of pages. Either as comma-seperated list,
100 supporting glob-style wildcards, or via the <tt><!plugin-list pluginname ~[args~] !></tt>
101 invocation syntax, where pluginname might be any plugin returning a PhpWiki:PageList.
102 See PhpWiki:PluginList.
104 Since most plugins return a ~PageList, this ~PageList is also a common
105 input parameter for other plugins, actions or formats.
107 !! Basic Plugin Types
109 All these plugins derive from the <tt>WikiPlugin</tt> class extending the
111 which returns a object tree of HTML objects, and may react on any
112 provided arguments from the ~WikiPage (see the args below) or
113 optionally overridden by arguments from the url (GET or POST args),
114 if defined via '||='.
116 A basic plugin just needs the run() method, and optionally getName,
117 getDescription, getVersion, getDefaultArguments. See the
118 Help:HelloWorldPlugin for a short introduction.
120 *plugin* reacts on its arguments and the request and displays
123 *plugin-form* is used to display a input type=text box for the
124 default argument *s*.
126 *plugin-list* is used as argument to provide a dynamic list of
130 <?plugin PluginName [args...] ?>
134 <?plugin-form PluginName [args...] ?>
138 <?plugin PluginName args=<!plugin-list pluginname [args...] !> ?>
143 Themes based on the "sidebar" theme may use the box method of any
144 plugin, which displays a *title*
145 and a condensed *content* in a box.
149 Plugins deriving from the class ~WikiPluginCached must also define
150 the methods getPluginType(),
151 optionally getExpire(), managesValidators(), and dependent of the
152 getPluginType the methods to display the *possibly cached* result.
154 getImage(), getMap() or getHtml(),
158 getAlt(), getImageType(), embedMap(), embedImg(), embedObject()
160 See the config.ini PLUGIN_CACHED_* settings and PhpWiki:WikiPluginCached
164 The term *[ActionPage|Help:ActionPage]* refers to a page containing a plugin
165 invocation with the same or translated pluginname as the pagename.
166 An *action* is together with the *pagename* argument the basic
168 It can both be GET or POST actions. Actions are untranslated, always
169 english, pagenames can be localized.
170 Basic (and old) actions are all lowercase, like edit, browse, remove, ...
171 Newer actions in PhpWiki:CamelCase are invoked via plugins on their
172 specific action page.
174 We decoupled actions from plugins via action pages for the following
177 # Support translated action buttons and customizable action descriptions.
178 # Customize standard actions by tuning the plugin invocation arguments.
179 Override or add plugin defaults.
180 # Split simple plugins into multiple actions, like RecentChanges/RecentEdits,
181 MostPopular/LeastPopular, AllPages/AllPagesCreatedByMe/AllPagesLastEditedByMe/
182 AllPagesOwnedByMe which differ only in one argument.
183 # Simplify the syntax for actions on another actions using a PageList
184 as result of an actionpage as input parameter for another action or
187 * Those actions which have buttons or links in the theme or are
188 referenced in the standard pgsrc pageset require their
189 (possibly localized) actionpages, otherwise the actions will not work.
190 * If the localized actionpage is not found the english version is
192 * If no actionpage is found, it is recommended to do action=upgrade,
193 which imports all missing and required action pages into the database.
195 So for a hypothetical new ~MyActionPage plugin ~MyActionPage will
196 invoke the plugin and ~Help:~MyActionPagePlugin should be the description page.
200 See [PluginManager] for a detailed list. Most plugins should have their
201 own description page as subpage of *Help/* with the name *Plugin*
204 <?plugin BackLinks noheader=1 ?>
206 !!! Contributed Plugins
208 See PhpWiki:CategoryContributedPlugin.
210 <?plugin Backlinks page=CategoryContributedPlugin ?>
213 [PhpWikiDocumentation]