diff options
Diffstat (limited to 'lib/plugins/syntax.php')
-rw-r--r-- | lib/plugins/syntax.php | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index 12451f636..552cc747a 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -37,6 +37,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { $info = DOKU_PLUGIN.'/'.$parts[2].'/plugin.info.txt'; if(@file_exists($info)) return confToHash($info); trigger_error('getInfo() not implemented in '.get_class($this).' and '.$info.' not found', E_USER_WARNING); + return array(); } /** @@ -83,13 +84,13 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { * * Usually you should only need the $match param. * - * @param $match string The text matched by the patterns - * @param $state int The lexer state for the match - * @param $pos int The character position of the matched text - * @param $handler ref Reference to the Doku_Handler object - * @return array Return an array with all data you want to use in render + * @param string $match The text matched by the patterns + * @param int $state The lexer state for the match + * @param int $pos The character position of the matched text + * @param Doku_Handler $handler Reference to the Doku_Handler object + * @return array Return an array with all data you want to use in render */ - function handle($match, $state, $pos, &$handler){ + function handle($match, $state, $pos, Doku_Handler &$handler){ trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); } @@ -111,12 +112,12 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { * The contents of the $data array depends on what the handler() function above * created * - * @param $format string output format being rendered - * @param $renderer ref reference to the current renderer object - * @param $data array data created by handler() - * @return boolean rendered correctly? + * @param $format string output format being rendered + * @param $renderer Doku_Renderer reference to the current renderer object + * @param $data array data created by handler() + * @return boolean rendered correctly? */ - function render($format, &$renderer, $data) { + function render($format, Doku_Renderer &$renderer, $data) { trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING); } @@ -148,6 +149,12 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { // extract from class name, format = <plugin type>_plugin_<name>[_<component name>] function getPluginType() { list($t) = explode('_', get_class($this), 2); return $t; } function getPluginName() { list($t, $p, $n) = explode('_', get_class($this), 4); return $n; } + + /** + * Get the name of the component of the current class + * + * @return string component name + */ function getPluginComponent() { list($t, $p, $n, $c) = explode('_', get_class($this), 4); return (isset($c)?$c:''); } // localisation methods @@ -158,7 +165,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { * to try to minimise unnecessary loading of the strings when the plugin doesn't require them * e.g. when info plugin is querying plugins for information about themselves. * - * @param $id id of the string to be retrieved + * @param string $id id of the string to be retrieved * @return string string in appropriate language or english if not available */ function getLang($id) { @@ -173,7 +180,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { * retrieve a language dependent wiki page and pass to xhtml renderer for display * plugin equivalent of p_locale_xhtml() * - * @param $id id of language dependent wiki page + * @param string $id id of language dependent wiki page * @return string parsed contents of the wiki page in xhtml format */ function locale_xhtml($id) { @@ -210,6 +217,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { global $conf; // definitely don't invoke "global $lang" $path = DOKU_PLUGIN.$this->getPluginName().'/lang/'; + $lang = array(); // don't include once, in case several plugin components require the same language file @include($path.'en/lang.php'); if ($conf['lang'] != 'en') @include($path.$conf['lang'].'/lang.php'); |