The goal of this tutorial is to explain the concepts involved in a DokuWiki admin plugin and to go through the steps involved in writing your own plugin.
For those who are really impatient to get started, grab a copy of the admin plugin Skeleton. Its a bare bones plugin which outputs "Hello World!" when selected from the admin menu.
There are four components to an admin plugin
$lang['menu'] string in the localised lang.php file, use this method if the admin menu prompt will always be the same.getMenuText() method. Use this method if you need to display different strings at different times or to represent different states.getInfo() function will be used.handle() function. html() function. handle() function and outputs the html required to keep the user informed on what has just happened and ask them what they would like to do next. do=admin & page=plugin name and should include id=current wiki page to allow the user to return to where they came from.For Dokuwiki to know to return to the admin plugin the user page request must include two variables set to specific values:
$_REQUEST['do'] = "admin"$_REQUEST['page'] = "plugin_name"For other buttons and links on the Dokuwiki page to allow the user to return to the wiki page they came from you should also set one further value:
$REQUEST['id'] = $IDThe values can be set as input controls of type hidden or as part of the link query string:
e.g.
Any data received from the user must be treated with suspicion. Form data and query strings can be spoofed by malicious users. Don't echo anything back to the user without filtering it to remove any html special characters. Don't act on any user data (e.g. filenames) without first verifying its a valid and acceptable value.
Ok, so you have decided you want to extend Dokuwiki's admin section with your own plugin. You have worked out what the facility you are going to provide and how you are going to provide it. Now you need to write the plugin.
lib/plugins/ directory. That directory will have the same name as your plugin.admin.php in the new directory. As a starting point, use a copy of the skeleton plugin.syntax_plugin_<your plugin name>.getInfo() to report information about your plugin.
…
…
And that's our plugin finished.