devel:admin_plugins
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
devel:admin_plugins [2011-03-15 09:32] – [Safety] lupo49 | devel:admin_plugins [2023-09-01 23:55] (current) – Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Admin Plugins ====== | ====== Admin Plugins ====== | ||
- | Admin Plugins are [[:plugins]] that provide DokuWiki with extra functions accessible via the [[: | + | [[plugintype> |
Some examples: | Some examples: | ||
Line 9: | Line 9: | ||
- | ===== Admin plugin trigger | + | ===== How to Write an Admin Plugin |
- | A user initiates interaction with the admin plugin by clicking the plugin's menu link in the [[: | + | An Admin Plugin //Example// needs: |
+ | * class name | ||
+ | * which extends | ||
+ | | ||
+ | Moreover, a [[plugin_info|plugin.info.txt]] file is needed. For full details of plugins and their files and how to create more admin components refer to [[plugin file structure]]. | ||
- | If the plugin | + | ===Required methods=== |
- | * '' | + | Class needs to implement |
- | * '' | + | |
- | * '' | + | |
- | Best practice is to include these in your plugin' | + | ^Name ^Description ^ |
+ | |[[xref> | ||
+ | |[[xref> | ||
- | ===== Admin plugin class ===== | + | ===Optional methods=== |
+ | (Override only if needed): | ||
- | **Inheritance Hierarchy: | + | ^ Name ^ Description |
- | | + | | [[xref>forAdminOnly()]] |
- | * **[[xref>lib/ | + | | [[xref>getMenuText()]] |
- | | + | | [[xref> |
+ | | [[xref>getTOC()]] | ||
+ | | [[xref> | ||
- | The simple admin plugin //foobar// needs to define a class named '' | + | ===Inherited methods=== |
- | **Class needs to implement the following methods** (Must override): | + | See [[common plugin functions]] for inherited functions available |
- | ^Name ^Description ^ | + | === Icon === |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | **Methods & properties** | + | Since the 2017 Frusterick Manners release, admin plugins can provide an icon to be shown next to the plugin' |
- | ^Name ^Description ^ | + | There are a few restrictions |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | **Inherited methods** (also see [[xref> | + | |
+ | | ||
+ | | ||
- | ^Name ^Description ^ | + | The fill color of the path will be set by CSS and match the link color (unless your template does something different). |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | |[[xref> | + | |
- | ===== Hello World admin plugin ===== | + | To match the style of other icons, we recommend to either pick an icon from the huge, free selection at https:// |
+ | |||
+ | |||
+ | ===== Admin plugin trigger ===== | ||
+ | |||
+ | A admin or moderator initiates interaction with the admin plugin by clicking the plugin' | ||
+ | |||
+ | |||
+ | ===Requests=== | ||
+ | If the plugin needs to receive information back from the user it needs to ensure the following '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Best practice is to include these variables in your plugin' | ||
+ | |||
+ | |||
+ | |||
+ | ===== Example | ||
Here is the [[devel: | Here is the [[devel: | ||
Line 60: | Line 75: | ||
===== Programming tips ===== | ===== Programming tips ===== | ||
- | * If you haven' | + | * If you haven' |
- | * A plugin may vary its menu text on the main admin menu depending on its status or the state of what it administers. The [[plugin: | + | * A plugin may vary its menu text on the main admin menu depending on its status or the state of what it administers. The [[plugin: |
==== Safety ==== | ==== Safety ==== | ||
- | The admin plugin has the opportunity to interact with the DokuWiki admin user through the data returned by forms and/or query strings, i.e. the $_REQUEST, $_POST or $_GET variables. All user entered data must be treated with suspicion, even from users identified as admins by ACL settings. Take special care to follow | + | The admin plugin has the opportunity to interact with the DokuWiki admin user through the data returned by forms and/or query strings, i.e. the $_REQUEST, $_POST or $_GET variables. Take special care to follow |
- | * Use the '' | + | |
- | * When using forms you should include a hidden form field with the session-based security token by calling the function [[xref>formsecuritytoken()]]. Before you process the form input, call [[xref> | + | |
+ | | ||
+ | |||
+ | * When using forms you should include a hidden form field with the session-based security token by calling the function [[xref>formSecurityToken()]]. Before you process the form input, call [[xref> | ||
==== Core API & globals ==== | ==== Core API & globals ==== | ||
Line 77: | Line 95: | ||
==== Localization & configuration ==== | ==== Localization & configuration ==== | ||
- | Adding | + | The plugin |
- | Example getting | + | * Be sure to add at least the **'' |
- | $this-> | + | **Example** Making |
- | + | ||
- | [[devel: | + | |
- | + | ||
- | Example | + | |
<code php lang.php> | <code php lang.php> | ||
<?php | <?php | ||
- | // language file for DokuWiki admin plugin | + | // minimal |
$lang[' | $lang[' | ||
</ | </ | ||
Line 95: | Line 109: | ||
The user experience can be enhanced by using [[devel: | The user experience can be enhanced by using [[devel: | ||
+ | |||
+ | ===== Further reading ===== | ||
+ | |||
+ | * [[Plugin programming tips]] | ||
+ | * [[security|Security Guidelines for Plugin Authors]] | ||
+ | * [[plugins|Plugin Development]] | ||
+ | * [[plugintype> | ||
+ |
devel/admin_plugins.1300177971.txt.gz · Last modified: 2011-03-15 09:32 by lupo49