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 [2013-01-22 01:31] – [Programming tips] Klap-in | devel:admin_plugins [2023-09-01 23:55] (current) – Klap-in | ||
---|---|---|---|
Line 9: | Line 9: | ||
- | ===== Admin plugin trigger | + | ===== How to Write an Admin Plugin |
- | A admin or moderator 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]]. | ||
+ | ===Required methods=== | ||
+ | Class needs to implement the following methods (Must override): | ||
- | ===Requests=== | + | ^Name ^Description ^ |
- | If the plugin needs to receive information back from the user it needs to ensure the following '' | + | |[[xref> |
- | * '' | + | |[[xref>inc/ |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | Best practice is to include these in your plugin' | + | ===Optional methods=== |
+ | (Override only if needed): | ||
- | ===== Admin plugin | + | ^ Name ^ Description |
+ | | [[xref> | ||
+ | | [[xref> | ||
+ | | [[xref> | ||
+ | | [[xref> | ||
+ | | [[xref> | ||
- | **Inheritance Hierarchy: | + | ===Inherited methods=== |
- | * [[xref> | + | |
- | * **[[xref> | + | |
- | * [[xref> | + | |
- | The simple admin plugin //Foobar// needs to define a class named '' | + | See [[common plugin functions]] for inherited functions available |
- | **Class needs to implement the following methods** (Must override): | + | === Icon === |
- | ^Name ^Description ^ | + | Since the 2017 Frusterick Manners release, admin plugins |
- | |[[xref> | + | |
- | |[[xref>lib/ | + | |
- | **Methods & properties** (Override only if needed): | + | There are a few restrictions the icon has to adhere to for it to be displayed: |
- | ^Name ^Description ^ | + | * It has to be in SVG format |
- | |[[xref>lib/plugins/admin.php# | + | * The file has to be smaller than 2 kB |
- | |[[xref> | + | * It should only contain a single path object |
- | |[[xref>lib/ | + | |
- | |[[xref>lib/ | + | The fill color of the path will be set by CSS and match the link color (unless your template does something different). |
+ | |||
+ | 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 | ||
- | **Inherited methods** (also see [[xref> | ||
- | See [[common plugin functions]] for inherited functions available to all plugins. e.g. localisation, | ||
- | ===== Hello World admin plugin ===== | + | ===== Example |
Here is the [[devel: | Here is the [[devel: | ||
Line 58: | Line 77: | ||
* 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> | ||
- | * When using forms you should include a hidden form field with the session-based security token by calling the function [[xref> | ||
==== Core API & globals ==== | ==== Core API & globals ==== | ||
Line 73: | Line 95: | ||
==== Localization & configuration ==== | ==== Localization & configuration ==== | ||
- | Adding | + | The plugin |
- | [[devel: | + | * Be sure to add at least the **'' |
- | See [[common plugin functions]] for description of functions available for localisation and configuration. | + | **Example** Making |
- | + | ||
- | Example | + | |
<code php lang.php> | <code php lang.php> | ||
<?php | <?php | ||
- | // language file for DokuWiki admin plugin | + | // minimal |
$lang[' | $lang[' | ||
</ | </ | ||
Line 89: | 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.1358814687.txt.gz · Last modified: 2013-01-22 01:31 by Klap-in