1 Date: Fri, 11 Jan 2013 11:16:51 +0000
2 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0)
3 Content-Type: application/x-phpwiki;
4 pagename=Help%2FWikiPlugin;
5 flags=PAGE_LOCKED%2CEXTERNAL_PAGE;
7 Content-Transfer-Encoding: binary
9 A **plugin** is some PHP code that:
10 * lives in ##phpwiki/lib/plugin/<pluginname>.php##
11 * implements the ~WikiPlugin interface by extending that class.
13 There are many plugins already distributed with ~PhpWiki. Simply look
14 in the ##lib/plugin## directory or see the [[PluginManager]] list or see all the
15 [[phpwiki:TitleSearch?s=Help/*Plugin|Help/*Plugin pages]].
17 To write your own, look at the [[Help:HelloWorldPlugin]] (~HelloWorld.php
18 in that directory), which is a minimal example of a plugin.
20 A ~WikiPlugin allows one to easily add new types of dynamic
21 content (as well as other functionality) to wiki pages within ~PhpWiki.
22 In this very wiki all actions which are not entirely lowercased
23 are implemented using plugins, and some lowercased convenience
25 (rename, revert, setacl, diff, ...)
27 Note that you can NOT extend the markup syntax with a plugin, as in other wiki engines.
29 (The old-style [[Help:MagicPhpWikiURLs|MagicPhpWikiURLs]] have been replaced by plugins
34 Currently, one invokes a plugin by putting something like:
37 <<AllPages limit=20 cols=3>>
40 into a regular wiki-page. That particular example produces a list
41 of the first 20 existing pages in 3 columns, via the [[Help:PageList|PageList]]
44 <<AllPages limit=20 cols=3>>
48 Plugins can take certain named arguments, most do. The values of
49 these arguments can be determined four different ways. In order of
52 # The plugin invocation can specify the value for an argument, like so:
54 <?plugin BackLinks page=OtherPage ?>
57 # The argument can be specified via an HTTP query argument. This
58 doesn't happen (is not allowed) unless the argument is mentioned in
59 the plugin invocation:
62 <?plugin BackLinks page ?>
65 # Default values specified in the plugin invocation:
68 <?plugin BackLinks page||=OtherPage ?>
71 # The plugin must supply default values for each argument it uses.
72 Such default args may be overriden by URL arguments like so:
74 BackLinks?page=ThisPage&sortby=-mtime
76 (The BackLinks plugin uses the current page as the default value for
79 Most plugins using the [[Help:PageList|PageList]] library inherit their
80 default arguments from the ~PageList.
82 === Standard Arguments ===
84 Most plugins display a list of pages, via the [[Help:PageList|PageList]]
85 library. ~PageList provides automatic support for those arguments.
87 info, exclude, author, owner, creator, sortby, limit, paging, cols, azhead,
88 comma, commasep, ordered
90 For details see the [[Help:PageList|PageList]] library documentation.
92 *exclude* and *pages* accept a list of pages. Either as comma-separated list,
93 supporting glob-style wildcards, or via the ##<!plugin-list pluginname ~[args~] !>##
94 invocation syntax, where pluginname might be any plugin returning a [[Help:PageList|PageList]].
95 See PhpWiki:PluginList.
97 Since most plugins return a ~PageList, this ~PageList is also a common
98 input parameter for other plugins, actions or formats.
100 === Basic Plugin Types ===
102 All these plugins derive from the ##~WikiPlugin## class extending the
104 which returns a object tree of HTML objects, and may react on any
105 provided arguments from the ~WikiPage (see the args below) or
106 optionally overridden by arguments from the url (GET or POST args),
107 if defined via '||='.
109 A basic plugin just needs the run() method, and optionally getName,
110 getDescription, getDefaultArguments. See the
111 [[Help:HelloWorldPlugin]] for a short introduction.
113 **plugin** reacts on its arguments and the request and displays
116 **plugin-form** is used to display a input type=text box for the
117 default argument **s**.
119 **plugin-list** is used as argument to provide a dynamic list of
123 <?plugin PluginName [args...] ?>
127 <?plugin-form PluginName [args...] ?>
131 <?plugin PluginName args=<!plugin-list pluginname [args...] !> ?>
134 ==== The box Method ====
136 Themes based on the "sidebar" theme may use the box method of any
137 plugin, which displays a **title**
138 and a condensed **content** in a box.
140 ==== ~WikiPluginCached ====
142 Plugins deriving from the class ~WikiPluginCached must also define
143 the methods getPluginType(),
144 optionally getExpire(), managesValidators(), and dependent of the
145 getPluginType the methods to display the **possibly cached** result.
147 getImage(), getMap() or getHtml(),
151 getAlt(), getImageType(), embedMap(), embedImg(), embedObject()
153 See the config.ini PLUGIN_CACHED_* settings and PhpWiki:WikiPluginCached
157 The term **[[Help:ActionPage|ActionPage]]** refers to a page containing a plugin
158 invocation with the same or translated pluginname as the pagename.
159 An **action** is together with the **pagename** argument the basic
161 It can both be GET or POST actions. Actions are untranslated, always
162 English, pagenames can be localized.
163 Basic (and old) actions are all lowercase, like edit, browse, remove, ...
164 Newer actions in [[PhpWiki:CamelCase]] are invoked via plugins on their
165 specific action page.
167 We decoupled actions from plugins via action pages for the following
170 # Support translated action buttons and customizable action descriptions.
171 # Customize standard actions by tuning the plugin invocation arguments.
172 Override or add plugin defaults.
173 # Split simple plugins into multiple actions, like RecentChanges/RecentEdits,
174 MostPopular/LeastPopular, AllPages/AllPagesCreatedByMe/AllPagesLastEditedByMe/
175 AllPagesOwnedByMe which differ only in one argument.
176 # Simplify the syntax for actions on another actions using a ~PageList
177 as result of an actionpage as input parameter for another action or
180 * Those actions which have buttons or links in the theme or are
181 referenced in the standard pgsrc pageset require their
182 (possibly localized) actionpages, otherwise the actions will not work.
183 * If the localized actionpage is not found the english version is
185 * If no actionpage is found, it is recommended to do action=upgrade,
186 which imports all missing and required action pages into the database.
188 So for a hypothetical new ~MyActionPage plugin ~MyActionPage will
189 invoke the plugin and ~Help:~MyActionPagePlugin should be the description page.
191 == Existing Plugins ==
193 See [[PluginManager]] for a detailed list. Most plugins should have their
194 own description page as subpage of **Help/** with the name **Plugin**
198 [[PhpWikiDocumentation]]