====== Common Plugin Functions ====== Each of the currently implemented [[:DokuWiki]] plugin classes, [[devel:Syntax Plugins|syntax]], [[devel:Admin Plugins|admin]], [[devel:Action Plugins|action]], [[devel:Helper Plugins|helper]] and [[devel:Renderer Plugins|renderer]] provide a common set of methods and properties enabling standard [[#configuration]], [[#introspection]], [[#localisation]] and [[#output]] facilities. These functions produce their results taking into account local installation settings and specific DokuWiki requirements. These functions are declared in the foundation plugin class, ''DokuWiki_Plugin'', defined in ''inc/plugin.php''. A summary of the functions and properties are shown below. For full and up-to-date details refer to [[http://dev.splitbrain.org/reference/dokuwiki/lib/plugins/base.php.html|base.php]] in the [[http://dev.splitbrain.org/reference/dokuwiki/|API Reference]] and the source itself in the [[http://dev.splitbrain.org/browse/darcs/dokuwiki|Source Repository]] ===== Configuration ===== * ''$conf'' --- An array containing the plugin's configuration settings, setting => value. It is empty until populated by ''loadConfig()'' * ''$configloaded'' --- bool, set to true by ''loadConfig()'' after it has established the current settings * ''getConf($setting)'' --- return the value of ''$setting'', will call ''loadConfig()'' if required. * ''loadConfig()'' --- merges local settings with the plugin's default settings and populates ''$this->conf'' array. * ''readDefaultSettings()'' --- reads the default settings file, ''lib/plugins//conf/default.php'' 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 [[plugin file structure]]). If a plugin handles its configuration through these functions, the wiki admin will be able to manage the settings interactively through the [[plugin:config|Configuration Manager]]. See [[configuration#Configuration Metadata]] to learn more about how to tell the Configuration Manager what to do with your settings. ===== Introspection ===== * ''getPluginType()'' --- return the plugin type, e.g. ''syntax'', ''admin'' or ''action''. * ''getPluginName()'' --- return the plugin name * ''getPluginComponent()'' --- return the plugin component name ===== Localisation ===== For information on where the localised strings and files are stored see plugin [[deveL:plugin_file_structure]]. * ''$lang'' --- An array containing the plugin's localised strings, id => localised string, may contain English strings where a localised version doesn't exist. It is empty until populated by ''setupLocale()''. * ''$localised'' --- bool, set to true by ''setupLocale()'' after it has populated ''$this->lang''. * ''getLang($id)'' --- return the localised string for ''$id'', or English string if localised version doesn't exist. Will call ''setupLocale()'' if required. * ''locale_xhtml($id)'' --- uses DokuWiki's rendering engine to return xhtml created from the localised file, ''$id'', containing DokuWiki markup. * ''setupLocale()'' --- populates ''$this->lang'' with strings based on localisation settings ===== Output ==== * ''email()'' --- output an email link using the installation's email obfuscation settings. * ''external_link()'' --- output an external link using the installation's target settings. * ''render()'' --- uses the parser to parse and output a string containing wiki markup.