====== 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). Definitions: * '''' -- simple and unique name, also name of plugin directory * '''' -- characterizes the function of plugin e.g. syntax, auth, action... * '''' -- needed when plugin has more components of one type Class definition: - **Single component** of one plugin type:\\ ''/lib/plugins//.php'' \\ the plugin class name will be ''_plugin_'' e.g. file name type class /lib/plugins/acl/admin.php => admin_plugin_acl - **More components** of one plugin type:\\ ''/lib/plugins///.php'' \\ This structure allows several plugin classes of one plugin type within one plugin.\\ The class names will be ''_plugin__''. e.g. file name type component class /lib/plugins/code/syntax/code.php => syntax_plugin_code_code /lib/plugins/code/syntax/file.php => syntax_plugin_code_file or /lib/plugins/code/auth/file.php => auth_plugin_code_file /lib/plugins/code/auth/file.php => auth_plugin_code_file If you are creating multiple syntax components, their mode name in the ''connectTo()'' method must also have ''_'' appended, e.g.: ''plugin_code_code'' and ''plugin_code_file''. === Name conventions of plugin name === * an _ (underscore) is a reserved character and cannot be used in the '''' * valid '''' should only contain the characters a-z and 0-9 * two different plugins with the same name are mutually exclusive and inherently incompatible. === Combining of plugin types and functions === A plugin may contain several different plugins types as well as several different plugin classes(components) 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. See also [[common plugin functions]]. === File Structure === All paths and files are relative to the plugin root directory. * ''/lib/plugins//'' * ''style.css'' -- [[CSS]] styles for the plugin * ''print.css'' -- print [[CSS]] styles for the plugin * ''script.js'' -- [[JavaScript]] used by the plugin * ''plugin.info.txt'' -- A text file with [[devel:plugin info|plugin informations]] **required!** * ''deleted.files''-- (optional) A text file that lists [[deleted.files|files that are deleted]] if the plugin is updated. * ''lang/'' * ''/lang.php'' -- [[devel:localization#plugin_localization|Language strings]] (accessible via ''$this%%->%%getLang()'') * ''/settings.php'' -- localised strings used in the Configuration Manager * ''/.txt'' -- localised text including DokuWiki markup (accessible via ''$this%%->%%locale_xhtml()'') * ''conf/'' * ''default.php'' -- [[configuration#Default settings]] for the [[devel:configuration#plugin settings]] (accessible via ''$this%%->%%getConf()'', saved local settings are stored in DokuWiki's global ''/conf/local.php'') * ''metadata.php'' -- [[configuration#configuration metadata]] describing properties of the settings for use by Configuration Manager === Use Plugin Wizard === The simplest and recommended way to create the initial file system structure for new plugin is to use the [[http://pluginwizard.dokuwiki.org/|DokuWiki Plugin Wizard]]. ===== CSS Styles ===== Please refer to [[devel:css#plugins_styles|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: * ''/lib/plugins//'' * ''style.css'' -- [[CSS]] styles for the plugin. Usually only used css file. * ''print.css'' -- print [[CSS]] styles for the plugin * ''all.css'' -- Applied in all display modes * ''feed.css'' -- Applied when displaying the [[:syndication|feed]] Since Binky, DokuWiki supports LESS parsing, you may use [[devel:less|*.less]] files as well. ===== JavaScript ===== Please read [[devel:javascript]] for javascript loading and coding guidelines. Javascript files can contain DokuWiki specific syntax for [[devel:javascript#include_syntax|including other javascript files]]. Possible files, all optional: * ''/lib/plugins//'' * ''script.js'' -- [[JavaScript]] used by the plugin * ''scripts/.js'' -- in script.js can be [[javascript#include_syntax|included other script files]]. See also [[devel:jqueryfaq|FAQ about jQuery]] ===== Don't include Extension manager files ===== There can be also auto-generated files around from the extension manager, don't include these in your final plugin download package: * ''/lib/plugins//'' * ''disabled'' -- This 0 byte file indicates the plugin is disabled. * ''manager.dat'' -- Stores extension manager data e.g. download url and installation date ===== See also ===== * [[plugins|Plugin Developer documentation]] * [[Common Plugin Functions]] * Plugin types: [[Action plugins|Action]], [[Admin plugins|Admin]], [[Auth plugins|Auth]], [[Remote plugins|Remote]], [[Helper plugins|Helper]], [[Syntax plugins|Syntax]] and [[Renderer plugins|Renderer]] * [[security|Security Guidelines]] for plugin developers * [[Plugin programming tips]]