DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:plugin_file_structure

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
devel:plugin_file_structure [2013-01-24 09:44] – [Plugin File Structure] Klap-indevel:plugin_file_structure [2022-03-12 12:18] 93.81.212.113
Line 3: Line 3:
 There are two structures for the files of a DokuWiki plugin class. The structure chosen determines the name for the plugin class(es). There are two structures for the files of a DokuWiki plugin class. The structure chosen determines the name for the plugin class(es).
  
-  -  **Single component** of one plugin type:\\ ''<dokuwiki>/lib/plugins/<plugin name>/<plugin type>.php'' \\ the plugin class name will be ''<plugin type>_plugin_<plugin name>'' <code> +Definitions: 
-e.g. file                       type          class+  * ''<pluginname>'' -- simple and unique name, also name of plugin directory 
 +  * ''<plugin type>'' -- characterizes the function of plugin e.g. syntax, auth, action... 
 +  * ''<plugin component>'' -- needed when plugin has more components of one type 
 + 
 +Class definition: 
 + 
 +  - **Single component** of one plugin type:\\ ''<dokuwiki>/lib/plugins/<plugin name>/<plugin type>.php'' \\ the plugin class name will be ''<plugin type>_plugin_<plugin name>'' <code> 
 +e.g. file                  name type          class
      <dokuwiki>/lib/plugins/acl/admin.php  => admin_plugin_acl      <dokuwiki>/lib/plugins/acl/admin.php  => admin_plugin_acl
-</code> \\ +</code> 
-  -  **More components** of one plugin type:\\ ''<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>''. <code> +  - **More components** of one plugin type:\\ ''<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>''. <code> 
-e.g. file                        type   component     class+e.g. file                   name type   component     class
      <dokuwiki>/lib/plugins/code/syntax/code.php   => syntax_plugin_code_code      <dokuwiki>/lib/plugins/code/syntax/code.php   => syntax_plugin_code_code
      <dokuwiki>/lib/plugins/code/syntax/file.php   => syntax_plugin_code_file      <dokuwiki>/lib/plugins/code/syntax/file.php   => syntax_plugin_code_file
-</code> \\+or 
 +     <dokuwiki>/lib/plugins/code/auth/file.php     => auth_plugin_code_file 
 +     <dokuwiki>/lib/plugins/code/auth/file.php     => auth_plugin_code_file 
 +</code> If you are creating multiple syntax components, their mode name in the ''connectTo()'' method must also have ''_<filename>'' 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 ''<pluginname>'' 
 +  * valid ''<pluginname>'' should only contain the characters a-z and 0-9 
 +  * two different plugins with the same name are mutually exclusive and inherently incompatible.
  
-Note that: +=== Combining of plugin types and functions ===
-  * an _ (underscore) is a reserved character and cannot be used in the ''<plugin name>'' +
-  * valid ''<plugin name>'' should only contain the characters a-z and 0-9 +
-  * two different plugins with the same name are mutually excluding and inherent incompatible.+
  
-A plugin may contain several different plugins types as well as several different plugin classes of each type.+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]]. 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. All paths and files are relative to the plugin root directory.
Line 29: Line 44:
     * ''script.js'' -- [[JavaScript]] used by the plugin     * ''script.js'' -- [[JavaScript]] used by the plugin
     * ''plugin.info.txt'' -- A text file with [[devel:plugin info|plugin informations]] **required!**     * ''plugin.info.txt'' -- A text file with [[devel:plugin info|plugin informations]] **required!**
-    * ''lang/<language>/lang.php'' -- Language strings (accessible via ''$this%%->%%getLang()''+    * ''deleted.files''-- (optional) A text file that lists [[deleted.files|files that are deleted]] if the plugin is updated. 
-    * ''lang/<language>/settings.php'' -- localised strings used in the [[plugin:config|configuration manager]] +    * ''lang/'' 
-    * ''lang/<language>/<filename>.txt'' -- localised text including DokuWiki markup (accessible via ''$this%%->%%locale_xhtml()''+      * ''<language>/lang.php'' -- [[devel:localization#plugin_localization|Language strings]] (accessible via ''$this%%->%%getLang()''
-    * ''conf/default.php'' -- [[configuration#default settings]] (accessible via ''$this%%->%%getConf()'', local settings are added to DokuWiki's global ''<dokuwiki>/conf/local.php''+      * ''<language>/settings.php'' -- localised strings used in the Configuration Manager 
-    * ''conf/metadata.php'' -- [[configuration#configuration metadata]] describing the settings for use by [[plugin:config|configuration manager]]+      * ''<language>/<filename>.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 ''<dokuwiki>/conf/local.php''
 +      * ''metadata.php'' -- [[configuration#configuration metadata]] describing properties of the settings for use by Configuration Manager 
 + 
 +=== Use Plugin wizard ===
  
-===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]]. 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 ===== ===== 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. 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.
  
Line 51: Line 69:
     * ''feed.css'' -- Applied when displaying the [[:syndication|feed]]     * ''feed.css'' -- Applied when displaying the [[:syndication|feed]]
  
 +Since Binky, DokuWiki supports LESS parsing, you may use [[devel:less|*.less]] files as well.
  
 ===== Javascript ===== ===== 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]]. 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]].
  
Line 62: Line 82:
  
 See also [[devel:jqueryfaq|FAQ about jQuery]] See also [[devel:jqueryfaq|FAQ about jQuery]]
-===== 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:+===== 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:
  
   * ''<dokuwiki>/lib/plugins/<pluginname>/''   * ''<dokuwiki>/lib/plugins/<pluginname>/''
     * ''disabled'' -- This 0 byte file indicates the plugin is disabled.     * ''disabled'' -- This 0 byte file indicates the plugin is disabled.
-    * ''manager.dat'' -- Stores plugin manager data e.g. download url and installation date+    * ''manager.dat'' -- Stores extension manager data e.g. download url and installation date
  
 ===== See also ===== ===== See also =====
 +
   * [[plugins|Plugin Developer documentation]]   * [[plugins|Plugin Developer documentation]]
   * [[Common Plugin Functions]]   * [[Common Plugin Functions]]
-  * Plugin types: [[Action plugins|Action]], [[Admin plugins|Admin]], [[Remote plugins|Remote]], [[Helper plugins|Helper]], [[Syntax plugins|Syntax]] and [[Renderer plugins|Renderer]]+  * 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   * [[security|Security Guidelines]] for plugin developers
   * [[Plugin programming tips]]   * [[Plugin programming tips]]
 +
 +
devel/plugin_file_structure.txt · Last modified: 2023-04-13 11:47 by hsins

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki