插件文件结构
兼容的版本 Dokuwiki
2017-07-20
The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
插件名称包含下划线,无法产生受欢迎度点数。
This extension is not in the 'plugin' or 'template' namespace and is therefore ignored.
DokuWiki插件类的文件有两个结构。选择的结构决定了插件类的名称。
定义:
<pluginname>
– 简单而唯一的名称,也插件目录的名称<plugin type>
– 插件功能的描述,如. syntax, auth, action…<plugin component>
– 当插件拥有一种类型的更多组件时,需要
类定义:
- 一个插件类型的单一组件:
<dokuwiki>/lib/plugins/<plugin name>/<plugin type>.php
插件类名将会是<plugin type>_plugin_<plugin name>
e.g. file name type class <dokuwiki>/lib/plugins/acl/admin.php => admin_plugin_acl
- 一个插件类型的更多组件:
<dokuwiki>/lib/plugins/<plugin name>/<plugin type>/<filename>.php
这个结构允许插件类型的多个插件类在一个插件。
插件类名将会是<plugin type>_plugin_<plugin name>_<filename>
.e.g. file name 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 or <dokuwiki>/lib/plugins/code/auth/file.php => auth_plugin_code_file <dokuwiki>/lib/plugins/code/auth/file.php => auth_plugin_code_file
插件名的命名约定
- _ (下划线)是一个保留字符,不能用于
<pluginname>
- 有效的
<pluginname>
应该只包含字符a - z和0 - 9 - 两个具有相同名称的不同插件是相互排斥和固有的不兼容的。
插件类型和功能的结合
一个插件可能包含几个不同的插件类型,以及每个类型的几个不同的插件类(组件)。
另外,一个插件可以(可选地)利用其他内置的工具来实现它的样式、JavaScript、本地化和在DokuWiki中包含的配置。参见常见的插件功能。
文件结构
所有路径和文件都是相对于插件根目录。
<dokuwiki>/lib/plugins/<pluginname>/
style.css
– 插件的CSS样式print.css
– 打印插件的CSS样式script.js
– 插件的JavaScript样式plugin.info.txt
– 一个文本文件包含所需的插件信息!deleted.files
– (可选的)一个文本文件,列出文件删除,如果插件更新。lang/
<language>/settings.php
– 本地化字符串用于配置管理器<language>/<filename>.txt
– 本地化文本包括DokuWiki标记 (访问通过$this->locale_xhtml()
)
conf/
metadata.php
– 配置元数据描述配置管理器使用的设置的属性
使用插件向导
CSS 样式
请参考CSS样式表,以获得更多信息,您可以使用哪些样式文件,以及如何使用。只有下面列出的CSS样式文件是可用的,所有CSS都应该合并到其中一个文件中,包括或引用其他样式文件是不可用的。
可能文件,所有可选:
<dokuwiki>/lib/plugins/<pluginname>/
因为Binky DokuWiki支持较少的解析,所以您可以使用*.less文件。
Javascript
请阅读javascript的javascript加载和编码指南。Javascript文件可以包含DokuWiki特定的语法,包括其他Javascript文件。
可能文件,所有可选:
<dokuwiki>/lib/plugins/<pluginname>/
script.js
– 插件使用的 JavaScriptscripts/<filename>.js
– 在script.js可以包含其他脚本文件。
不包括插件管理器文件
也可以从插件管理器自动生成的文件,不包括这些在你最终的插件下载包:
<dokuwiki>/lib/plugins/<pluginname>/
disabled
– 这个0字节文件表明插件是禁用的。manager.dat
– 存储插件管理器数据,例如下载url和安装日期