This is an old revision of the document!
Table of Contents
Plugin File Structure
There are two structures for the files of a DokuWiki plugin class. The structure chosen determines the name for the plugin class(es).
<dokuwiki>/lib/plugins/<plugin name>/<plugin type>.php
the plugin class name will be<plugin type>_plugin_<plugin name>
e.g. file type class <dokuwiki>/lib/plugins/acl/admin.php => admin_plugin_acl
<dokuwiki>/lib/plugins/<plugin name>/<plugin type>/<filename>.php
This structure allows several plugin classes of one plugin type within one plugin, the class names will be<plugin_type>_plugin_<plugin name>_<filename>
,e.g. file type component class <dokuwiki>/lib/plugins/code/syntax/code.php => syntax_plugin_code_code <dokuwiki>/lib/plugins/code/syntax/file.php => syntax_plugin_code_file
Note that an _ (underscore) is a reserved character and cannot be used in the <plugin name>
.
A plugin may contain several different plugins types as well as several different plugin classes of each type.
In addition, a plugin can (optionally) take advantage of other built-in facilities to have its styles, JavaScript, localisation, and configuration included in DokuWiki.
All paths and files are relative to the plugin root directory.
<dokuwiki>/lib/plugins/<pluginname>/
style.css
– CSS styles for the pluginprint.css
– print CSS styles for the pluginscript.js
– JavaScript used by the pluginplugin.info.txt
– A text file with plugin informations required!lang/<language>/lang.php
– Language strings (accessible via$this->getLang()
)lang/<language>/settings.php
– localised strings used in the configuration managerlang/<language>/<filename>.txt
– localised text including DokuWiki markup (accessible via$this->locale_xhtml()
)conf/default.php
– default settings (accessible via$this->getConf()
, local settings are added to DokuWiki's global<dokuwiki>/conf/local.php
)
The simplest and recommended way to create the initial file system structure for new plugin is to use the DokuWiki Plugin Wizard.
CSS Styles
Please refer to CSS stylesheets for plugins for more info which style files you can use and how. Only the CSS style files listed below are available, all your CSS should be merged into one of these files, including or referring other style files is not available.
Possible files, all optional:
Javascript
Please read javascript for javascript loading and coding guidelines. Javascript files can contain DokuWiki specific include syntax.
Possible files, all optional:
<dokuwiki>/lib/plugins/<pluginname>/
script.js
– JavaScript used by the pluginscripts/<filename>.js
– in script.js can be included other script files.
Don't include Plugin manager files
There can be also auto-generated files around from the plugin manager, don't include these in your final plugin download package:
<dokuwiki>/lib/plugins/<pluginname>/
disabled
– This 0 byte file indicates the plugin is disabled.manager.dat
– Stores plugin manager data e.g. download url and installation date
See also
- Security Guidelines for plugin developers