devel:common_plugin_functions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
devel:common_plugin_functions [2008-11-07 21:44] – 70.103.232.219 | devel:common_plugin_functions [2023-02-28 22:24] (current) – Aleksandr | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Common Plugin Functions ====== | ====== Common Plugin Functions ====== | ||
- | Each of the currently implemented [[: | + | Each of the currently implemented [[: |
These functions are declared in the foundation plugin class, '' | These functions are declared in the foundation plugin class, '' | ||
- | A summary of the functions and properties are shown below. For full and up-to-date details refer to [[http://dev.splitbrain.org/ | + | A summary of the functions and properties are shown below. For full and up-to-date details refer to [[xref> |
+ | |||
+ | |||
+ | **Inherited methods** available in all plugins | ||
+ | |||
+ | ^Name ^Description ^ | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |[[xref>inc/plugin.php# | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |[[xref> | ||
+ | |||
+ | The following additional methods can be **overridden** when required: | ||
+ | |||
+ | ^Name ^Description ^ | ||
+ | |[[xref> | ||
===== Configuration ===== | ===== Configuration ===== | ||
- | * '' | + | Please refer to [[Configuration]] for more info. The additional files used by plugins are: |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * contains |
- | * '' | + | * accessible via '' |
+ | * :!: modified settings | ||
+ | * '' | ||
+ | * '' | ||
- | The plugin's configuration settings are stored in the installation local settings file, local.php and in the plugin specific file, default.php (refer plugin | + | > Use '' |
- | If a plugin | + | If a plugin |
+ | |||
+ | ===Example=== | ||
+ | Read setting ' | ||
+ | <code php> | ||
+ | $sort = $this-> | ||
+ | </ | ||
===== Introspection ===== | ===== Introspection ===== | ||
Line 26: | Line 57: | ||
- | ===== Localisation | + | ===== Localization |
- | For information on where the localised strings and files are stored | + | Localizations |
+ | * ''< | ||
+ | * '' | ||
+ | * accessible via '' | ||
+ | * '' | ||
+ | * Shows up in the [[plugin:config|configuration manager]]\\ \\ | ||
+ | * '' | ||
+ | * accessible via '' | ||
- | * '' | + | Please see the developer info about [[devel: |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
+ | |||
+ | ===== Instantiating ===== | ||
+ | Default DokuWiki reuses instances of plugins. This can be prevented by adding the function '' | ||
+ | <code php> | ||
+ | /** | ||
+ | * Return false to prevent DokuWiki reusing instances of the plugin | ||
+ | | ||
+ | * @return bool | ||
+ | */ | ||
+ | public function isSingleton() { | ||
+ | return false; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | =====Load Helper plugins===== | ||
+ | In all plugins Helper plugins can be loaded by '' | ||
+ | |||
+ | It loads a given helper plugin if the plugin is enabled. Details and examples in [[helper plugins]]. | ||
+ | |||
+ | ===Example=== | ||
+ | Load helper of the tag plugin: | ||
+ | <code php> | ||
+ | //get the instance of Tag Helper | ||
+ | $tag = $this-> | ||
+ | |||
+ | if($tag) { | ||
+ | $entries = $tag-> | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Load other plugins ===== | ||
+ | If you want to use another plugin in your plugin you have to use the '' | ||
+ | |||
+ | It will return a plugin object. Default this object is the unique plugin instance stored by the plugin controller, but when the requested plugin is marked as not singleton by '' | ||
+ | |||
+ | Or use instead the additional parameter options of [[xref> | ||
+ | |||
+ | Load helper plugin component from Tag plugin, which has only one helper component: | ||
+ | <code php> | ||
+ | if(!plugin_isdisabled(' | ||
+ | $tag =& plugin_load(' | ||
+ | if($tag) { | ||
+ | $entries = $tag-> | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Or load syntax plugin component from Data plugin, which has several syntax components, so specifying of the component needed: | ||
+ | <code php> | ||
+ | if(!plugin_isdisabled(' | ||
+ | $table =& plugin_load(' | ||
+ | if($table) { | ||
+ | $hasfilter = $table-> | ||
+ | } | ||
+ | } | ||
+ | </ | ||
===== Output ==== | ===== Output ==== | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | * '' |
+ | |||
+ | |||
+ | |||
+ | ===== See also ===== | ||
+ | * [[Plugin file structure]] | ||
+ | * [[Plugin file structure# | ||
+ | * [[Plugin programming tips]] | ||
+ | * [[devel: | ||
+ |
devel/common_plugin_functions.1226090699.txt.gz · Last modified: 2012-07-10 18:07 (external edit)