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.phpfile, 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 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.
page=plugin nameand should include
id=current wiki pageto 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'] = $ID
The values can be set as input controls of type hidden or as part of the link query string:
<form action="<?php echo wl($ID) ?>" method="post"> <input type='hidden' name="do" value="admin" /> <input type='hidden' name="page" value="mypluginname" /> ... </form> or <form action="<?php echo wl($ID, 'do=admin&page=mypluginname') ?>" method="post">
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.phpin 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.